Some checks failed
Checks / Tests & checks (push) Has been cancelled
Checks / Build all projects (push) Has been cancelled
Deploy .com / Deploy dotcom to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Has been cancelled
Deploy templates / Deploy templates (push) Has been cancelled
End to end tests (examples) / End to end tests (examples) (push) Has been cancelled
End to end tests (perf) / End to end tests (perf) (push) Has been cancelled
Publish SDK packages / Publish SDK packages (push) Has been cancelled
End to end tests (dotcom) / End to end tests (dotcom) (push) Has been cancelled
End to end tests (mermaid readability) / End to end tests (mermaid readability) (push) Has been cancelled
Publish SDK packages / Tell user released version (push) Has been cancelled
Publish SDK packages / Publishes code templates to separate repositories (push) Has been cancelled
Publish SDK packages / Deploys the template demos with the new SDK version (push) Has been cancelled
Deploy grafana resources / ${{ github.event_name == 'push' && 'Deploy grafana resources' || 'Validate grafana resources (dry run)' }} (push) Failing after 0s
i18n upload strings / Upload latest strings (push) Failing after 0s
Deploy analytics worker / Deploy analytics worker to ${{ (github.ref == 'refs/heads/production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 0s
Deploy bemo / Deploy bemo to ${{ (github.ref == 'refs/heads/bemo-production' && 'production') || (github.ref == 'refs/heads/main' && 'staging') || 'preview' }} (push) Failing after 0s
End to end tests (dotcom) / Check for relevant changes (push) Failing after 0s
End to end tests (examples) / Check for relevant changes (push) Failing after 0s
End to end tests (mermaid readability) / Check for relevant changes (push) Failing after 0s
End to end tests (perf) / Check for relevant changes (push) Failing after 0s
Publish editor extensions / Publish editor extensions (push) Failing after 0s
Publish SDK packages / Remove the publish-packages label (push) Has been skipped
Close inactive issues / close-issues (push) Failing after 3s
i18n download strings / Download latest strings (push) Failing after 0s
Post release marketing summary to Discord / Post release marketing summary to Discord (push) Failing after 0s
Post release crew to Discord / Post release crew to Discord (push) Failing after 0s
Staging E2E Daily Cleanup / Daily Cleanup of Test Files (push) Failing after 1s
Prune preview deploys / Prune preview deploys (push) Failing after 1s
5521 lines
174 KiB
Markdown
5521 lines
174 KiB
Markdown
## 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 { AtomSet } from '@tldraw/store';
|
|
import { Awaitable } from '@tldraw/utils';
|
|
import { BoxModel } from '@tldraw/tlschema';
|
|
import { ComponentType } from 'react';
|
|
import { Computed } from '@tldraw/state';
|
|
import { CustomRecordInfo } from '@tldraw/tlschema';
|
|
import { Dispatch } from 'react';
|
|
import { Editor as Editor_2 } from '@tiptap/core';
|
|
import { EditorProviderProps as EditorProviderProps_2 } from '@tiptap/react';
|
|
import EventEmitter from 'eventemitter3';
|
|
import { ExoticComponent } from 'react';
|
|
import { ExtractShapeByProps } from '@tldraw/tlschema';
|
|
import { ForwardRefExoticComponent } from 'react';
|
|
import { FragmentProps } from 'react';
|
|
import { HistoryEntry } from '@tldraw/store';
|
|
import { IndexKey } from '@tldraw/utils';
|
|
import { JsonObject } from '@tldraw/utils';
|
|
import { JSX } from 'react/jsx-runtime';
|
|
import { LegacyMigrations } from '@tldraw/store';
|
|
import { MemoExoticComponent } from 'react';
|
|
import { MigrationSequence } from '@tldraw/store';
|
|
import { Node as Node_2 } from '@tiptap/pm/model';
|
|
import { PerformanceTracker } from '@tldraw/utils';
|
|
import * as React_2 from 'react';
|
|
import { default as React_3 } from 'react';
|
|
import { ReactElement } from 'react';
|
|
import { ReactNode } from 'react';
|
|
import { ReactPortal } from 'react';
|
|
import { RecordProps } from '@tldraw/tlschema';
|
|
import { RecordsDiff } from '@tldraw/store';
|
|
import { RefAttributes } from 'react';
|
|
import { RefObject } from 'react';
|
|
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 { T } from '@tldraw/validate';
|
|
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 { TLCreateShapePartial } from '@tldraw/tlschema';
|
|
import { TLCursor } from '@tldraw/tlschema';
|
|
import { TLCursorType } from '@tldraw/tlschema';
|
|
import { TLDefaultColor } from '@tldraw/tlschema';
|
|
import { TLDefaultColorStyle } from '@tldraw/tlschema';
|
|
import { TLDefaultDashStyle } from '@tldraw/tlschema';
|
|
import { TLDefaultHorizontalAlignStyle } from '@tldraw/tlschema';
|
|
import { TLDocument } from '@tldraw/tlschema';
|
|
import { TLFontFace } 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 { TLOpacityType } 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 { TLRichText } from '@tldraw/tlschema';
|
|
import { TLScribble } from '@tldraw/tlschema';
|
|
import { TLShape } from '@tldraw/tlschema';
|
|
import { TLShapeCrop } from '@tldraw/tlschema';
|
|
import { TLShapeId } from '@tldraw/tlschema';
|
|
import { TLShapePartial } from '@tldraw/tlschema';
|
|
import { TLStore } from '@tldraw/tlschema';
|
|
import { TLStoreProps } from '@tldraw/tlschema';
|
|
import { TLStoreSchema } from '@tldraw/tlschema';
|
|
import { TLStoreSnapshot } from '@tldraw/tlschema';
|
|
import { TLTheme } from '@tldraw/tlschema';
|
|
import { TLThemeColors } from '@tldraw/tlschema';
|
|
import { TLThemeId } from '@tldraw/tlschema';
|
|
import { TLThemes } from '@tldraw/tlschema';
|
|
import { TLUnknownAsset } from '@tldraw/tlschema';
|
|
import { TLUnknownBinding } from '@tldraw/tlschema';
|
|
import { TLUnknownShape } from '@tldraw/tlschema';
|
|
import { TLUser } from '@tldraw/tlschema';
|
|
import { TLUserId } from '@tldraw/tlschema';
|
|
import { TLUserStore } from '@tldraw/tlschema';
|
|
import { TLVideoAsset } from '@tldraw/tlschema';
|
|
import { UnknownRecord } from '@tldraw/store';
|
|
import { VecModel } from '@tldraw/tlschema';
|
|
|
|
// @internal (undocumented)
|
|
export function activeElementShouldCaptureKeys(includeButtonsAndMenus?: boolean, doc?: Document): boolean;
|
|
|
|
// @public
|
|
export function angleDistance(fromAngle: number, toAngle: number, direction: number): number;
|
|
|
|
// @internal (undocumented)
|
|
export function applyRotationToSnapshotShapes({ delta, editor, snapshot, stage, centerOverride, }: {
|
|
centerOverride?: VecLike;
|
|
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<Geometry2dOptions, 'isClosed' | 'isFilled'> & {
|
|
center: Vec;
|
|
end: Vec;
|
|
largeArcFlag: number;
|
|
start: Vec;
|
|
sweepFlag: number;
|
|
});
|
|
// (undocumented)
|
|
getLength(): number;
|
|
// (undocumented)
|
|
getSvgPathData(first?: boolean): string;
|
|
// (undocumented)
|
|
getVertices(): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike): boolean;
|
|
// (undocumented)
|
|
nearestPoint(point: VecLike): Vec;
|
|
}
|
|
|
|
// @public
|
|
export function areAnglesCompatible(a: number, b: number): boolean;
|
|
|
|
// @public
|
|
export abstract class AssetUtil<Asset extends TLAsset = TLAsset> {
|
|
constructor(editor: Editor);
|
|
acceptsMimeType(mimeType: string): boolean;
|
|
static configure<T extends TLAssetUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
|
|
options: infer Options;
|
|
} ? Partial<Options> : never): T;
|
|
// (undocumented)
|
|
editor: Editor;
|
|
getAssetFromFile(_file: File, _assetId: TLAssetId): Promise<Asset | null>;
|
|
abstract getDefaultProps(): Asset['props'];
|
|
getSupportedMimeTypes(): readonly string[];
|
|
// (undocumented)
|
|
static migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
options: {};
|
|
// (undocumented)
|
|
static props?: RecordProps<TLUnknownAsset>;
|
|
static type: string;
|
|
}
|
|
|
|
// @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: TLBaseBoxShape['type'];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> extends ShapeUtil<Shape> {
|
|
// (undocumented)
|
|
getGeometry(shape: Shape): Geometry2d;
|
|
// (undocumented)
|
|
getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
|
|
// (undocumented)
|
|
getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
|
|
// (undocumented)
|
|
onResize(shape: any, info: TLResizeInfo<any>): any;
|
|
}
|
|
|
|
// @public
|
|
export abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShape> extends BaseBoxShapeUtil<Shape> {
|
|
// (undocumented)
|
|
canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
|
|
// (undocumented)
|
|
canRemoveChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
|
|
// (undocumented)
|
|
getClipPath(shape: Shape): undefined | Vec[];
|
|
// (undocumented)
|
|
isFrameLike(_shape: Shape): boolean;
|
|
// (undocumented)
|
|
onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
|
|
// (undocumented)
|
|
onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
|
|
// (undocumented)
|
|
providesBackgroundForChildren(): boolean;
|
|
// (undocumented)
|
|
shouldClipChild(child: TLShape): boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface BatchMeasurementRequest {
|
|
// (undocumented)
|
|
html: string;
|
|
// (undocumented)
|
|
opts: TLMeasureTextOpts;
|
|
}
|
|
|
|
// @public
|
|
export interface BindingOnChangeOptions<Binding extends TLBinding = TLBinding> {
|
|
bindingAfter: Binding;
|
|
bindingBefore: Binding;
|
|
}
|
|
|
|
// @public
|
|
export interface BindingOnCreateOptions<Binding extends TLBinding = TLBinding> {
|
|
binding: Binding;
|
|
}
|
|
|
|
// @public
|
|
export interface BindingOnDeleteOptions<Binding extends TLBinding = TLBinding> {
|
|
binding: Binding;
|
|
}
|
|
|
|
// @public
|
|
export interface BindingOnShapeChangeOptions<Binding extends TLBinding = TLBinding> {
|
|
binding: Binding;
|
|
reason: 'ancestry' | 'self';
|
|
shapeAfter: TLShape;
|
|
shapeBefore: TLShape;
|
|
}
|
|
|
|
// @public
|
|
export interface BindingOnShapeDeleteOptions<Binding extends TLBinding = TLBinding> {
|
|
binding: Binding;
|
|
shape: TLShape;
|
|
}
|
|
|
|
// @public
|
|
export interface BindingOnShapeIsolateOptions<Binding extends TLBinding = TLBinding> {
|
|
binding: Binding;
|
|
removedShape: TLShape;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export abstract class BindingUtil<Binding extends TLBinding = TLBinding> {
|
|
constructor(editor: Editor);
|
|
// (undocumented)
|
|
editor: Editor;
|
|
abstract getDefaultProps(): Partial<Binding['props']>;
|
|
// (undocumented)
|
|
static migrations?: TLPropsMigrations;
|
|
onAfterChange?(options: BindingOnChangeOptions<Binding>): void;
|
|
onAfterChangeFromShape?(options: BindingOnShapeChangeOptions<Binding>): void;
|
|
onAfterChangeToShape?(options: BindingOnShapeChangeOptions<Binding>): void;
|
|
onAfterCreate?(options: BindingOnCreateOptions<Binding>): void;
|
|
onAfterDelete?(options: BindingOnDeleteOptions<Binding>): void;
|
|
onBeforeChange?(options: BindingOnChangeOptions<Binding>): Binding | void;
|
|
onBeforeCreate?(options: BindingOnCreateOptions<Binding>): Binding | void;
|
|
onBeforeDelete?(options: BindingOnDeleteOptions<Binding>): void;
|
|
onBeforeDeleteFromShape?(options: BindingOnShapeDeleteOptions<Binding>): void;
|
|
onBeforeDeleteToShape?(options: BindingOnShapeDeleteOptions<Binding>): void;
|
|
onBeforeIsolateFromShape?(options: BindingOnShapeIsolateOptions<Binding>): void;
|
|
onBeforeIsolateToShape?(options: BindingOnShapeIsolateOptions<Binding>): void;
|
|
onOperationComplete?(): void;
|
|
// (undocumented)
|
|
static props?: RecordProps<TLUnknownBinding>;
|
|
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 bottom(): 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 ContainsApproximately(A: Box, B: Box, precision?: number): 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)
|
|
isValid(): boolean;
|
|
// (undocumented)
|
|
get left(): number;
|
|
// (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)
|
|
get right(): number;
|
|
// (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)
|
|
get top(): number;
|
|
// (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;
|
|
|
|
// @internal (undocumented)
|
|
export interface CanvasMaxSize {
|
|
// (undocumented)
|
|
maxArea: number;
|
|
// (undocumented)
|
|
maxHeight: number;
|
|
// (undocumented)
|
|
maxWidth: number;
|
|
}
|
|
|
|
// @public
|
|
export function centerOfCircleFromThreePoints(a: VecLike, b: VecLike, c: VecLike): null | Vec;
|
|
|
|
// @public (undocumented)
|
|
export class Circle2d extends Geometry2d {
|
|
constructor(config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
isFilled: boolean;
|
|
radius: number;
|
|
x?: number;
|
|
y?: number;
|
|
});
|
|
// (undocumented)
|
|
config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
isFilled: boolean;
|
|
radius: number;
|
|
x?: number;
|
|
y?: number;
|
|
};
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, hitInside?: boolean): number;
|
|
// (undocumented)
|
|
getBounds(): Box;
|
|
// (undocumented)
|
|
getSvgPathData(): string;
|
|
// (undocumented)
|
|
getVertices(): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number): boolean;
|
|
// (undocumented)
|
|
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean): boolean;
|
|
// (undocumented)
|
|
nearestPoint(point: VecLike): Vec;
|
|
}
|
|
|
|
// @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;
|
|
|
|
// @internal (undocumented)
|
|
export function clampToBrowserMaxCanvasSize(width: number, height: number): [number, number];
|
|
|
|
// @public (undocumented)
|
|
export class ClickManager {
|
|
constructor(editor: Editor);
|
|
// @internal
|
|
cancelDoubleClickTimeout(): void;
|
|
get clickState(): TLClickState | undefined;
|
|
// (undocumented)
|
|
editor: Editor;
|
|
// (undocumented)
|
|
_getClickTimeout(state: TLClickState, id?: string): void;
|
|
// (undocumented)
|
|
handlePointerEvent(info: TLPointerEventInfo): TLClickEventInfo | TLPointerEventInfo;
|
|
// (undocumented)
|
|
lastPointerInfo: TLPointerEventInfo;
|
|
}
|
|
|
|
// @public
|
|
export function clockwiseAngleDist(a0: number, a1: number): number;
|
|
|
|
// @public
|
|
export class CollaboratorsManager {
|
|
constructor(editor: Editor);
|
|
getCollaborators(): TLInstancePresence[];
|
|
getCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
getVisibleCollaborators(): TLInstancePresence[];
|
|
getVisibleCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export function ContainerProvider({ container, children }: ContainerProviderProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export interface ContainerProviderProps {
|
|
// (undocumented)
|
|
children: React.ReactNode;
|
|
// (undocumented)
|
|
container: HTMLElement;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const coreShapes: readonly [typeof GroupShapeUtil];
|
|
|
|
// @public
|
|
export function counterClockwiseAngleDist(a0: number, a1: number): number;
|
|
|
|
// @public (undocumented)
|
|
export function createDebugValue<T>(name: string, { defaults, shouldStoreForSession, }: {
|
|
defaults: DebugFlagDefaults<T>;
|
|
shouldStoreForSession?: boolean;
|
|
}): DebugFlag<T>;
|
|
|
|
// @public
|
|
export function createDeepLinkString(deepLink: TLDeepLink): string;
|
|
|
|
// @public
|
|
export function createSessionStateSnapshotSignal(store: TLStore): Signal<null | TLSessionStateSnapshot>;
|
|
|
|
// @public (undocumented)
|
|
export function createTLCurrentUser(opts?: {
|
|
setUserPreferences?: (userPreferences: TLUserPreferences) => void;
|
|
userPreferences?: Signal<TLUserPreferences>;
|
|
}): TLCurrentUser;
|
|
|
|
// @public
|
|
export function createTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreSchema<TLRecord, TLStoreProps>;
|
|
|
|
// @public
|
|
export function createTLStore({ initialData, defaultName, id, assets, users, onMount, collaboration, themes, ...rest }?: TLStoreOptions): TLStore;
|
|
|
|
// @public (undocumented)
|
|
export class CubicBezier2d extends Polyline2d {
|
|
constructor(config: Omit<Geometry2dOptions, 'isClosed' | 'isFilled'> & {
|
|
cp1: Vec;
|
|
cp2: Vec;
|
|
end: Vec;
|
|
resolution?: number;
|
|
start: Vec;
|
|
});
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, _hitInside?: boolean): number;
|
|
// (undocumented)
|
|
static GetAtT(segment: CubicBezier2d, t: number): Vec;
|
|
// (undocumented)
|
|
getLength(_filters?: Geometry2dFilters, precision?: number): number;
|
|
// (undocumented)
|
|
getSvgPathData(first?: boolean): string;
|
|
// (undocumented)
|
|
getVertices(): Vec[];
|
|
// (undocumented)
|
|
nearestPoint(A: VecLike): Vec;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class CubicSpline2d extends Geometry2d {
|
|
constructor(config: Omit<Geometry2dOptions, 'isClosed' | 'isFilled'> & {
|
|
points: Vec[];
|
|
});
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, _hitInside?: boolean): number;
|
|
// (undocumented)
|
|
getLength(): number;
|
|
// (undocumented)
|
|
getSvgPathData(): string;
|
|
// (undocumented)
|
|
getVertices(): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike): boolean;
|
|
// (undocumented)
|
|
nearestPoint(A: VecLike): Vec;
|
|
// (undocumented)
|
|
get segments(): CubicBezier2d[];
|
|
}
|
|
|
|
// @public
|
|
export function dataUrlToFile(url: string, filename: string, mimeType: string): Promise<File>;
|
|
|
|
// @public (undocumented)
|
|
export interface DebugFlag<T> extends DebugFlagDef<T>, Atom<T> {
|
|
// (undocumented)
|
|
reset(): void;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface DebugFlagDef<T> {
|
|
// (undocumented)
|
|
defaults: DebugFlagDefaults<T>;
|
|
// (undocumented)
|
|
name: string;
|
|
// (undocumented)
|
|
shouldStoreForSession: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface DebugFlagDefaults<T> {
|
|
// (undocumented)
|
|
all: T;
|
|
// (undocumented)
|
|
development?: T;
|
|
// (undocumented)
|
|
production?: T;
|
|
// (undocumented)
|
|
staging?: T;
|
|
}
|
|
|
|
// @internal (undocumented)
|
|
export const debugFlags: {
|
|
readonly a11y: DebugFlag<boolean>;
|
|
readonly debugElbowArrows: DebugFlag<boolean>;
|
|
readonly debugGeometry: DebugFlag<boolean>;
|
|
readonly debugSvg: DebugFlag<boolean>;
|
|
readonly editOnType: DebugFlag<boolean>;
|
|
readonly forceSrgb: DebugFlag<boolean>;
|
|
readonly hideShapes: DebugFlag<boolean>;
|
|
readonly logElementRemoves: DebugFlag<boolean>;
|
|
readonly logPointerCaptures: DebugFlag<boolean>;
|
|
readonly logPreventDefaults: DebugFlag<boolean>;
|
|
readonly measurePerformance: DebugFlag<boolean>;
|
|
readonly showFps: DebugFlag<boolean>;
|
|
readonly throwToBlob: DebugFlag<boolean>;
|
|
};
|
|
|
|
// @internal (undocumented)
|
|
export const DEFAULT_ANIMATION_OPTIONS: {
|
|
duration: number;
|
|
easing: (t: number) => number;
|
|
};
|
|
|
|
// @internal (undocumented)
|
|
export const DEFAULT_CAMERA_OPTIONS: TLCameraOptions;
|
|
|
|
// @public
|
|
export const DEFAULT_THEME: TLTheme;
|
|
|
|
// @public (undocumented)
|
|
export function DefaultBackground(): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
|
|
|
|
// @public
|
|
export const DefaultCursor: MemoExoticComponent<({ className, zoom, point, color, name, chatMessage, }: TLCursorProps) => JSX.Element | null>;
|
|
|
|
// @public (undocumented)
|
|
export function DefaultErrorFallback({ error, editor }: TLErrorFallbackProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
|
|
// @public (undocumented)
|
|
export function DefaultSpinner(props: TLSpinnerProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export function DefaultSvgDefs(): null;
|
|
|
|
// @public (undocumented)
|
|
export const defaultTldrawOptions: {
|
|
readonly actionShortcutsLocation: 'swap';
|
|
readonly adjacentShapeMargin: 10;
|
|
readonly animationMediumMs: 320;
|
|
readonly camera: TLCameraOptions;
|
|
readonly cameraMovingTimeoutMs: 64;
|
|
readonly cameraSlideFriction: 0.09;
|
|
readonly coarseDragDistanceSquared: 36;
|
|
readonly coarseHandleRadius: 20;
|
|
readonly coarseHitTestMargin: 4;
|
|
readonly coarsePointerWidth: 12;
|
|
readonly collaboratorCheckIntervalMs: 1200;
|
|
readonly collaboratorIdleTimeoutMs: 3000;
|
|
readonly collaboratorInactiveTimeoutMs: 60000;
|
|
readonly createTextOnCanvasDoubleClick: true;
|
|
readonly debouncedZoom: true;
|
|
readonly debouncedZoomThreshold: 500;
|
|
readonly deepLinks: undefined;
|
|
readonly defaultSvgPadding: 32;
|
|
readonly doubleClickDurationMs: 450;
|
|
readonly dragDistanceSquared: 16;
|
|
readonly edgeScrollDelay: 200;
|
|
readonly edgeScrollDistance: 8;
|
|
readonly edgeScrollEaseDuration: 200;
|
|
readonly edgeScrollSpeed: 25;
|
|
readonly enableToolbarKeyboardShortcuts: true;
|
|
readonly experimental__onDropOnCanvas: undefined;
|
|
readonly exportProvider: ExoticComponent<FragmentProps>;
|
|
readonly flattenImageBoundsExpand: 64;
|
|
readonly flattenImageBoundsPadding: 16;
|
|
readonly followChaseViewportSnap: 2;
|
|
readonly gridSteps: readonly [{
|
|
readonly mid: 0.15;
|
|
readonly min: -1;
|
|
readonly step: 64;
|
|
}, {
|
|
readonly mid: 0.375;
|
|
readonly min: 0.05;
|
|
readonly step: 16;
|
|
}, {
|
|
readonly mid: 1;
|
|
readonly min: 0.15;
|
|
readonly step: 4;
|
|
}, {
|
|
readonly mid: 2.5;
|
|
readonly min: 0.7;
|
|
readonly step: 1;
|
|
}];
|
|
readonly handleRadius: 12;
|
|
readonly hitTestMargin: 3;
|
|
readonly laserDelayMs: 1200;
|
|
readonly laserFadeoutMs: 500;
|
|
readonly longPressDurationMs: 500;
|
|
readonly maxExportDelayMs: 5000;
|
|
readonly maxFilesAtOnce: 100;
|
|
readonly maxFontsToLoadBeforeRender: number;
|
|
readonly maxPages: 40;
|
|
readonly maxShapesPerPage: 4000;
|
|
readonly multiClickDurationMs: 200;
|
|
readonly nonce: undefined;
|
|
readonly onBeforeCopyToClipboard: undefined;
|
|
readonly onBeforePasteFromClipboard: undefined;
|
|
readonly onClipboardPasteRaw: undefined;
|
|
readonly quickZoomPreservesScreenBounds: true;
|
|
readonly rightClickPanning: true;
|
|
readonly selectLockedShapes: false;
|
|
readonly snapThreshold: 8;
|
|
readonly spacebarPanning: true;
|
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
readonly text: {};
|
|
readonly textShadowLod: 0.35;
|
|
readonly tooltipDelayMs: 700;
|
|
readonly uiCoarseDragDistanceSquared: 625;
|
|
readonly uiDragDistanceSquared: 16;
|
|
readonly zoomToFitPadding: 128;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export const defaultUserPreferences: Readonly<{
|
|
animationSpeed: 0 | 1;
|
|
areKeyboardShortcutsEnabled: true;
|
|
color: "#02B1CC" | "#11B3A3" | "#39B178" | "#55B467" | "#7B66DC" | "#9D5BD2" | "#BD54C6" | "#E34BA9" | "#EC5E41" | "#F04F88" | "#F2555A" | "#FF802B";
|
|
colorScheme: "light";
|
|
edgeScrollSpeed: 1;
|
|
enhancedA11yMode: false;
|
|
inputMode: null;
|
|
isDynamicSizeMode: false;
|
|
isPasteAtCursorMode: false;
|
|
isSnapMode: false;
|
|
isWrapMode: false;
|
|
isZoomDirectionInverted: false;
|
|
locale: "ar" | "bn" | "ca" | "cs" | "da" | "de" | "el" | "en" | "es" | "fa" | "fi" | "fr" | "gl" | "gu-in" | "he" | "hi-in" | "hr" | "hu" | "id" | "it" | "ja" | "km-kh" | "kn" | "ko-kr" | "ml" | "mr" | "ms" | "ne" | "nl" | "no" | "pa" | "pl" | "pt-br" | "pt-pt" | "ro" | "ru" | "sl" | "so" | "sv" | "ta" | "te" | "th" | "tl" | "tr" | "uk" | "ur" | "vi" | "zh-cn" | "zh-tw";
|
|
name: "";
|
|
}>;
|
|
|
|
// @public (undocumented)
|
|
export const defaultUserStore: TLUserStore;
|
|
|
|
// @public
|
|
export function degreesToRadians(d: number): number;
|
|
|
|
// @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)
|
|
distanceToPoint(point: VecLike, _hitInside?: boolean): number;
|
|
// (undocumented)
|
|
getLength(): number;
|
|
// (undocumented)
|
|
getSvgPathData(first?: boolean): string;
|
|
// (undocumented)
|
|
getVertices(): Vec[];
|
|
// (undocumented)
|
|
nearestPoint(point: VecLike): Vec;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class EdgeScrollManager {
|
|
constructor(editor: Editor);
|
|
// (undocumented)
|
|
editor: Editor;
|
|
// (undocumented)
|
|
getIsEdgeScrolling(): boolean;
|
|
updateEdgeScrolling(elapsed: number): void;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class Editor extends EventEmitter<TLEventMap> {
|
|
constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme, }: TLEditorOptions);
|
|
alignShapes(shapes: TLShape[] | TLShapeId[], operation: 'bottom' | 'center-horizontal' | 'center-vertical' | 'center' | 'left' | 'right' | 'top'): this;
|
|
animateShape(partial: null | TLShapePartial | undefined, opts?: TLCameraMoveOptions): this;
|
|
animateShapes(partials: (null | TLShapePartial | undefined)[], opts?: TLCameraMoveOptions): this;
|
|
// @internal (undocumented)
|
|
annotateError(error: unknown, { origin, willCrashApp, tags, extras, }: {
|
|
extras?: Record<string, unknown>;
|
|
origin: string;
|
|
tags?: Record<string, boolean | number | string>;
|
|
willCrashApp: boolean;
|
|
}): this;
|
|
assetUtils: {
|
|
readonly [K in string]?: AssetUtil<TLAsset>;
|
|
};
|
|
bail(): this;
|
|
bailToMark(id: string): this;
|
|
bindingUtils: {
|
|
readonly [K in string]?: BindingUtil<TLBinding>;
|
|
};
|
|
blur({ blurContainer }?: {
|
|
blurContainer?: boolean | undefined;
|
|
}): this;
|
|
bringForward(shapes: TLShape[] | TLShapeId[], opts?: {
|
|
considerAllShapes?: boolean;
|
|
}): this;
|
|
bringToFront(shapes: TLShape[] | TLShapeId[]): this;
|
|
// (undocumented)
|
|
canBindShapes({ fromShape, toShape, binding, }: {
|
|
binding: {
|
|
type: TLBinding['type'];
|
|
} | TLBinding | TLBinding['type'];
|
|
fromShape: {
|
|
type: TLShape['type'];
|
|
} | TLShape | TLShape['type'];
|
|
toShape: {
|
|
type: TLShape['type'];
|
|
} | TLShape | TLShape['type'];
|
|
}): boolean;
|
|
cancel(): this;
|
|
cancelDoubleClick(): void;
|
|
canCreateShape(shape: OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id']): boolean;
|
|
canCreateShapes(shapes: (OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id'])[]): boolean;
|
|
canCropShape<T extends TLShape | TLShapeId>(shape: null | T): shape is T;
|
|
canEditShape<T extends TLShape | TLShapeId>(shape: null | T, info?: TLEditStartInfo): shape is T;
|
|
canRedo(): boolean;
|
|
canUndo(): boolean;
|
|
// @internal (undocumented)
|
|
capturedPointerId: null | number;
|
|
centerOnPoint(point: VecLike, opts?: TLCameraMoveOptions): this;
|
|
// (undocumented)
|
|
clearHistory(): this;
|
|
// @internal
|
|
protected _clickManager: ClickManager;
|
|
readonly collaborators: CollaboratorsManager;
|
|
complete(): this;
|
|
// (undocumented)
|
|
readonly contextId: string;
|
|
// @internal (undocumented)
|
|
crash(error: unknown): this;
|
|
createAssets(assets: TLAsset[]): this;
|
|
createBinding<B extends TLBinding = TLBinding>(partial: TLBindingCreate<B>): this;
|
|
createBindings<B extends TLBinding = TLBinding>(partials: TLBindingCreate<B>[]): this;
|
|
createDeepLink(opts?: {
|
|
param?: string;
|
|
to?: TLDeepLink;
|
|
url?: string | URL;
|
|
}): URL;
|
|
// @internal (undocumented)
|
|
createErrorAnnotations(origin: string, willCrashApp: 'unknown' | boolean): {
|
|
extras: {
|
|
activeStateNode: string;
|
|
collaboratorCount: number;
|
|
editingShape: TLShape | undefined;
|
|
inputs: {
|
|
altKey: boolean;
|
|
buttons: number[];
|
|
ctrlKey: boolean;
|
|
currentPagePoint: VecModel;
|
|
currentScreenPoint: VecModel;
|
|
isDragging: boolean;
|
|
isEditing: boolean;
|
|
isPanning: boolean;
|
|
isPen: boolean;
|
|
isPinching: boolean;
|
|
isPointing: boolean;
|
|
isSpacebarPanning: boolean;
|
|
keys: string[];
|
|
metaKey: boolean;
|
|
originPagePoint: VecModel;
|
|
originScreenPoint: VecModel;
|
|
pointerVelocity: VecModel;
|
|
previousPagePoint: VecModel;
|
|
previousScreenPoint: VecModel;
|
|
shiftKey: boolean;
|
|
};
|
|
instanceState: TLInstance;
|
|
pageState: TLInstancePageState;
|
|
selectedShapes: ({
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "arrow";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "bookmark";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "draw";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "embed";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "frame";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "geo";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "group";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "highlight";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "image";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "line";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "my-custom-shape";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "note";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "test-persistent";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "test-shape";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "text";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
} | {
|
|
id: TLShapeId;
|
|
index: IndexKey;
|
|
isLocked: boolean;
|
|
meta: JsonObject;
|
|
opacity: TLOpacityType;
|
|
parentId: TLParentId;
|
|
props: any;
|
|
rotation: number;
|
|
type: "video";
|
|
typeName: 'shape';
|
|
x: number;
|
|
y: number;
|
|
})[];
|
|
selectionCount: number;
|
|
};
|
|
tags: {
|
|
origin: string;
|
|
willCrashApp: "unknown" | boolean;
|
|
};
|
|
} | {
|
|
extras: {
|
|
activeStateNode?: undefined;
|
|
collaboratorCount?: undefined;
|
|
editingShape?: undefined;
|
|
inputs?: undefined;
|
|
instanceState?: undefined;
|
|
pageState?: undefined;
|
|
selectedShapes?: undefined;
|
|
selectionCount?: undefined;
|
|
};
|
|
tags: {
|
|
origin: string;
|
|
willCrashApp: "unknown" | boolean;
|
|
};
|
|
};
|
|
createPage(page: Partial<TLPage>): this;
|
|
createShape<TShape extends TLShape>(shape: TLCreateShapePartial<TShape>): this;
|
|
createShapes<TShape extends TLShape = TLShape>(shapes: TLCreateShapePartial<TShape>[]): this;
|
|
createTemporaryAssetPreview(assetId: TLAssetId, file: File): string | undefined;
|
|
deleteAssets(assets: TLAsset[] | TLAssetId[]): this;
|
|
deleteBinding(binding: TLBinding | TLBindingId, opts?: Parameters<this['deleteBindings']>[1]): this;
|
|
deleteBindings(bindings: (TLBinding | TLBindingId)[], { isolateShapes }?: {
|
|
isolateShapes?: boolean | undefined;
|
|
}): this;
|
|
// @internal
|
|
_deleteBindings(bindings: (TLBinding | TLBindingId)[], { isolateShapes }?: {
|
|
isolateShapes?: boolean | undefined;
|
|
}): 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;
|
|
edgeScrollManager: EdgeScrollManager;
|
|
// @internal
|
|
_ensureUserRecord(user: TLUser): void;
|
|
// @internal (undocumented)
|
|
externalAssetContentHandlers: {
|
|
[K in TLExternalAsset['type']]: {
|
|
[Key in K]: ((info: TLExternalAsset & {
|
|
type: Key;
|
|
}) => Promise<TLAsset | undefined>) | null;
|
|
}[K];
|
|
};
|
|
// @internal (undocumented)
|
|
externalContentHandlers: {
|
|
[K in TLExternalContent<any>['type']]: {
|
|
[Key in K]: ((info: Extract<TLExternalContent<any>, {
|
|
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;
|
|
// (undocumented)
|
|
_flushEventForTick(info: TLEventInfo): this | undefined;
|
|
focus({ focusContainer }?: {
|
|
focusContainer?: boolean | undefined;
|
|
}): this;
|
|
readonly fonts: FontManager;
|
|
getAncestorPageId(shape?: TLShape | TLShapeId): TLPageId | undefined;
|
|
getAsset<T extends TLAsset>(asset: T | T['id']): T | undefined;
|
|
getAssetForExternalContent(info: TLExternalAsset): Promise<TLAsset | undefined>;
|
|
getAssets(): (TLBookmarkAsset | TLImageAsset | TLVideoAsset)[];
|
|
getAssetUtil<S extends TLAsset>(asset: {
|
|
type: S['type'];
|
|
} | S): AssetUtil<S>;
|
|
// (undocumented)
|
|
getAssetUtil(type: string): AssetUtil;
|
|
getAssetUtilForMimeType(mimeType: string): AssetUtil | null;
|
|
getAttributionDisplayName(userId: null | string): null | string;
|
|
getAttributionUser(userId: null | string): null | TLUser;
|
|
getAttributionUserId(): null | string;
|
|
getBaseZoom(): number;
|
|
getBinding(id: TLBindingId): TLBinding | undefined;
|
|
getBindingsFromShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
type: K;
|
|
}>[];
|
|
// (undocumented)
|
|
getBindingsFromShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
|
|
getBindingsInvolvingShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
type: K;
|
|
}>[];
|
|
// (undocumented)
|
|
getBindingsInvolvingShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type?: Binding['type']): Binding[];
|
|
getBindingsToShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
type: K;
|
|
}>[];
|
|
// (undocumented)
|
|
getBindingsToShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
|
|
getBindingUtil<K extends TLBinding['type']>(type: K): BindingUtil<Extract<TLBinding, {
|
|
type: K;
|
|
}>>;
|
|
// (undocumented)
|
|
getBindingUtil<S extends TLBinding>(binding: {
|
|
type: S['type'];
|
|
} | S): BindingUtil<S>;
|
|
// (undocumented)
|
|
getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
|
|
getCamera(): TLCamera;
|
|
getCameraOptions(): TLCameraOptions;
|
|
getCameraState(): "idle" | "moving";
|
|
// (undocumented)
|
|
getCanRedo(): boolean;
|
|
// (undocumented)
|
|
getCanUndo(): boolean;
|
|
getCollaborators(): TLInstancePresence[];
|
|
getCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
getColorMode(): 'dark' | 'light';
|
|
getContainer: () => HTMLElement;
|
|
// @internal
|
|
getContainerDocument(): Document;
|
|
// @internal
|
|
getContainerWindow(): Window & typeof globalThis;
|
|
getContentFromCurrentPage(shapes: TLShape[] | TLShapeId[]): TLContent | undefined;
|
|
// @internal
|
|
getCrashingError(): unknown;
|
|
getCroppingShapeId(): null | TLShapeId;
|
|
getCulledShapes(): Set<TLShapeId>;
|
|
getCurrentPage(): TLPage;
|
|
getCurrentPageBounds(): Box | undefined;
|
|
getCurrentPageId(): TLPageId;
|
|
getCurrentPageRenderingShapesSorted(): TLShape[];
|
|
getCurrentPageShapeIds(): Set<TLShapeId>;
|
|
// @internal (undocumented)
|
|
getCurrentPageShapeIdsSorted(): TLShapeId[];
|
|
getCurrentPageShapes(): TLShape[];
|
|
getCurrentPageShapesInReadingOrder(): TLShape[];
|
|
getCurrentPageShapesSorted(): TLShape[];
|
|
getCurrentPageState(): TLInstancePageState;
|
|
getCurrentTheme(): TLTheme;
|
|
getCurrentThemeId(): TLThemeId;
|
|
getCurrentTool(): StateNode;
|
|
getCurrentToolId(): string;
|
|
getDebouncedZoomLevel(): number;
|
|
getDocumentSettings(): TLDocument;
|
|
getDraggingOverShape(point: Vec, droppingShapes: TLShape[]): TLShape | undefined;
|
|
getEditingShape(): TLShape | undefined;
|
|
getEditingShapeId(): null | TLShapeId;
|
|
getEfficientZoomLevel(): number;
|
|
getErasingShapeIds(): TLShapeId[];
|
|
getErasingShapes(): NonNullable<TLShape | undefined>[];
|
|
getFocusedGroup(): TLShape | undefined;
|
|
getFocusedGroupId(): TLPageId | TLShapeId;
|
|
getHighestIndexForParent(parent: TLPage | TLParentId | TLShape): IndexKey;
|
|
getHintingShape(): NonNullable<TLShape | undefined>[];
|
|
getHintingShapeIds(): TLShapeId[];
|
|
getHitTestMargin(): number;
|
|
getHoveredShape(): TLShape | undefined;
|
|
getHoveredShapeId(): null | TLShapeId;
|
|
getInitialMetaForShape(_shape: TLShape): JsonObject;
|
|
getInitialZoom(): number;
|
|
getInstanceState(): TLInstance;
|
|
// (undocumented)
|
|
getIsFocused(): boolean;
|
|
getIsMounted(): boolean;
|
|
// (undocumented)
|
|
getIsReadonly(): boolean;
|
|
// @internal
|
|
getMarkIdMatching(idSubstring: string): null | string;
|
|
getNearestAdjacentShape(shapes: TLShape[], currentShapeId: TLShapeId, direction: 'down' | 'left' | 'right' | 'up'): TLShapeId;
|
|
getNotVisibleShapes(): Set<TLShapeId>;
|
|
getOnlySelectedShape(): null | TLShape;
|
|
getOnlySelectedShapeId(): null | TLShapeId;
|
|
getOutermostSelectableShape(shape: TLShape | TLShapeId, filter?: (shape: TLShape) => boolean): TLShape;
|
|
getPage(page: TLPage | TLPageId): TLPage | undefined;
|
|
getPages(): TLPage[];
|
|
getPageShapeIds(page: TLPage | TLPageId): Set<TLShapeId>;
|
|
getPageStates(): TLInstancePageState[];
|
|
getPath(): string;
|
|
getPointInParentSpace(shape: TLShape | TLShapeId, point: VecLike): Vec;
|
|
getPointInShapeSpace(shape: TLShape | TLShapeId, point: VecLike): Vec;
|
|
// @internal
|
|
_getReferencedUserIds(shapes: TLShape[]): Set<string>;
|
|
getRenderingShapes(): TLRenderingShape[];
|
|
getResizeScaleFactor(): number;
|
|
// @internal
|
|
getResizeShapePartial(shape: TLShape | TLShapeId, scale: VecLike, opts?: TLResizeShapeOptions): null | TLShapePartial;
|
|
getRichTextEditor(): null | TiptapEditor;
|
|
getSelectedShapeAtPoint(point: VecLike): TLShape | undefined;
|
|
getSelectedShapeIds(): TLShapeId[];
|
|
getSelectedShapes(): TLShape[];
|
|
getSelectionPageBounds(): Box | null;
|
|
getSelectionRotatedPageBounds(): Box | undefined;
|
|
getSelectionRotatedScreenBounds(): Box | undefined;
|
|
getSelectionRotation(): number;
|
|
getSelectionScreenBounds(): Box | undefined;
|
|
getShape<T extends TLShape = TLShape>(shape: TLParentId | TLShape): T | undefined;
|
|
getShapeAncestors(shape: TLShape | TLShapeId, acc?: TLShape[]): TLShape[];
|
|
getShapeAndDescendantIds(ids: TLShapeId[]): Set<TLShapeId>;
|
|
getShapeAtPoint(point: VecLike, opts?: TLGetShapeAtPointOptions): TLShape | undefined;
|
|
getShapeClipPath(shape: TLShape | TLShapeId): string | undefined;
|
|
getShapeGeometry<T extends Geometry2d>(shape: TLShape | TLShapeId, opts?: TLGeometryOpts): T;
|
|
getShapeHandles<T extends TLShape>(shape: T | T['id']): TLHandle[] | undefined;
|
|
getShapeIdsInsideBounds(bounds: Box): Set<TLShapeId>;
|
|
getShapeLocalTransform(shape: TLShape | TLShapeId): Mat;
|
|
getShapeMask(shape: TLShape | TLShapeId): undefined | VecLike[];
|
|
getShapeMaskedPageBounds(shape: TLShape | TLShapeId): Box | undefined;
|
|
// @internal
|
|
getShapeNearestSibling(siblingShape: TLShape, targetShape: TLShape | undefined): TLShape | 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;
|
|
margin?: number;
|
|
}): TLShape[];
|
|
getShapesPageBounds(shapeIds: TLShapeId[]): Box | null;
|
|
// @internal (undocumented)
|
|
getShapesRotatedPageBounds(shapeIds: TLShapeId[]): Box | undefined;
|
|
// @internal (undocumented)
|
|
getShapesSharedRotation(shapeIds: TLShapeId[]): number;
|
|
// (undocumented)
|
|
getShapeStyleIfExists<T>(shape: TLShape, style: StyleProp<T>): T | undefined;
|
|
getShapeUtil<K extends TLShape['type']>(type: K): ShapeUtil<Extract<TLShape, {
|
|
type: K;
|
|
}>>;
|
|
// (undocumented)
|
|
getShapeUtil<S extends TLShape>(shape: S | S['type'] | TLShapePartial<S>): ShapeUtil<S>;
|
|
// (undocumented)
|
|
getShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): T;
|
|
getShapeUtilForAssetType(assetType: string): ShapeUtil | undefined;
|
|
getSharedOpacity(): SharedStyle<number>;
|
|
getSharedStyles(): ReadonlySharedStyleMap;
|
|
// (undocumented)
|
|
getSnapshot(): TLEditorSnapshot;
|
|
getSortedChildIdsForParent(parent: TLPage | TLParentId | TLShape): TLShapeId[];
|
|
getStateDescendant<T extends StateNode>(path: string): T | undefined;
|
|
getStyleForNextShape<T>(style: StyleProp<T>): T;
|
|
getSvgElement(shapes: TLShape[] | TLShapeId[], opts?: TLSvgExportOptions): Promise<{
|
|
height: number;
|
|
svg: SVGSVGElement;
|
|
trimPadding: number;
|
|
width: number;
|
|
} | undefined>;
|
|
getSvgString(shapes: TLShape[] | TLShapeId[], opts?: TLSvgExportOptions): Promise<{
|
|
height: number;
|
|
svg: string;
|
|
trimPadding: number;
|
|
width: number;
|
|
} | undefined>;
|
|
getTemporaryAssetPreview(assetId: TLAssetId): string | undefined;
|
|
getTextOptions(): TLTextOptions;
|
|
getTheme(id: TLThemeId): TLTheme | undefined;
|
|
getThemes(): TLThemes;
|
|
// @internal (undocumented)
|
|
getUnorderedRenderingShapes(useEditorState: boolean): TLRenderingShape[];
|
|
getViewportPageBounds(): Box;
|
|
getViewportScreenBounds(): Box;
|
|
getViewportScreenCenter(): Vec;
|
|
getVisibleCollaborators(): TLInstancePresence[];
|
|
getVisibleCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
getZoomLevel(): number;
|
|
groupShapes(shapes: TLShape[], opts?: Partial<{
|
|
groupId: TLShapeId;
|
|
select: boolean;
|
|
}>): this;
|
|
// (undocumented)
|
|
groupShapes(ids: TLShapeId[], opts?: Partial<{
|
|
groupId: TLShapeId;
|
|
select: boolean;
|
|
}>): this;
|
|
hasAncestor(shape: TLShape | TLShapeId | undefined, ancestorId: TLShapeId): boolean;
|
|
hasAssetUtil(arg: {
|
|
type: string;
|
|
} | string): boolean;
|
|
// (undocumented)
|
|
hasExternalAssetHandler(type: TLExternalAsset['type']): boolean;
|
|
hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
|
|
// (undocumented)
|
|
hasShapeUtil(type: TLShape['type']): boolean;
|
|
// (undocumented)
|
|
hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
|
|
protected readonly history: HistoryManager<TLRecord>;
|
|
// (undocumented)
|
|
readonly id: string;
|
|
readonly inputs: InputsManager;
|
|
interrupt(): this;
|
|
isAncestorSelected(shape: TLShape | TLShapeId): boolean;
|
|
isDisposed: boolean;
|
|
isIn(path: string): boolean;
|
|
isInAny(...paths: string[]): boolean;
|
|
isPointInShape(shape: TLShape | TLShapeId, point: VecLike, opts?: {
|
|
hitInside?: boolean;
|
|
margin?: number;
|
|
}): boolean;
|
|
// @internal
|
|
isReplayingHistory(): boolean;
|
|
isShapeFrameLike(shape: TLShape | TLShapeId): boolean;
|
|
// (undocumented)
|
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
isShapeInPage(shape: TLShape | TLShapeId, pageId?: TLPageId): boolean;
|
|
isShapeOfType<K extends TLShape['type']>(shape: TLShape, type: K): shape is Extract<TLShape, {
|
|
type: K;
|
|
}>;
|
|
// (undocumented)
|
|
isShapeOfType<T extends TLShape>(shape: TLShape, type: T['type']): shape is Extract<TLShape, {
|
|
type: T['type'];
|
|
}>;
|
|
// (undocumented)
|
|
isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
|
|
isShapeOrAncestorLocked(shape?: TLShape | TLShapeId): boolean;
|
|
// @internal
|
|
licenseManager?: LicenseManager;
|
|
loadSnapshot(snapshot: Partial<TLEditorSnapshot> | TLStoreSnapshot, opts?: TLLoadSnapshotOptions): this;
|
|
markEventAsHandled(e: {
|
|
nativeEvent: Event;
|
|
} | Event): void;
|
|
markHistoryStoppingPoint(name?: string): string;
|
|
// (undocumented)
|
|
menus: {
|
|
addOpenMenu: (id: string) => void;
|
|
clearOpenMenus: () => void;
|
|
deleteOpenMenu: (id: string) => void;
|
|
getOpenMenus: () => string[];
|
|
hasAnyOpenMenus: () => boolean;
|
|
hasOpenMenus: () => boolean;
|
|
isMenuOpen: (id: string) => boolean;
|
|
};
|
|
moveShapesToPage(shapes: TLShape[] | TLShapeId[], pageId: TLPageId): this;
|
|
navigateToDeepLink(opts?: {
|
|
param?: string;
|
|
url?: string | URL;
|
|
} | TLDeepLink): Editor;
|
|
nudgeShapes(shapes: TLShape[] | TLShapeId[], offset: VecLike): this;
|
|
// (undocumented)
|
|
readonly options: TldrawOptions;
|
|
readonly overlays: OverlayManager;
|
|
packShapes(shapes: TLShape[] | TLShapeId[], _gap?: number): this;
|
|
pageToScreen(point: VecLike): Vec;
|
|
pageToViewport(point: VecLike): Vec;
|
|
readonly performance: PerformanceManager;
|
|
popFocusedGroupId(): this;
|
|
putContentOntoCurrentPage(content: TLContent, opts?: {
|
|
point?: VecLike;
|
|
preserveIds?: boolean;
|
|
preservePosition?: boolean;
|
|
select?: boolean;
|
|
}): this;
|
|
putExternalContent<E>(info: TLExternalContent<E>, opts?: {
|
|
force?: boolean;
|
|
}): Promise<void>;
|
|
redo(): this;
|
|
registerDeepLinkListener(opts?: TLDeepLinkOptions): () => void;
|
|
registerExternalAssetHandler<T extends TLExternalAsset['type']>(type: T, handler: ((info: TLExternalAsset & {
|
|
type: T;
|
|
}) => Promise<TLAsset>) | null): this;
|
|
registerExternalContentHandler<T extends TLExternalContent<E>['type'], E>(type: T, handler: ((info: T extends TLExternalContent<E>['type'] ? Extract<TLExternalContent<E>, {
|
|
type: T;
|
|
}> : TLExternalContent<E>) => void) | null): this;
|
|
// @internal
|
|
_releaseAltKey(): void;
|
|
// @internal
|
|
_releaseCtrlKey(): void;
|
|
// @internal
|
|
_releaseMetaKey(): void;
|
|
// @internal
|
|
_releaseShiftKey(): void;
|
|
removeTool(Tool: TLStateNodeConstructor, parent?: StateNode): void;
|
|
renamePage(page: TLPage | TLPageId, name: string): this;
|
|
reparentShapes(shapes: TLShape[] | TLShapeId[], parentId: TLParentId, insertIndex?: IndexKey): this;
|
|
replaceExternalContent<E>(info: TLExternalContent<E>, opts?: {
|
|
force?: boolean;
|
|
}): Promise<void>;
|
|
resetZoom(point?: Vec, opts?: TLCameraMoveOptions): this;
|
|
resizeShape(shape: TLShape | TLShapeId, scale: VecLike, opts?: TLResizeShapeOptions): this;
|
|
resizeToBounds(shapes: TLShape[] | TLShapeId[], bounds: BoxLike): this;
|
|
// (undocumented)
|
|
resolveAssetsInContent(content: TLContent | undefined): Promise<TLContent | undefined>;
|
|
// (undocumented)
|
|
resolveAssetUrl(assetId: null | TLAssetId, context: {
|
|
dpr?: number;
|
|
screenScale?: number;
|
|
shouldResolveToOriginal?: boolean;
|
|
}): Promise<null | string>;
|
|
readonly root: StateNode;
|
|
rotateShapesBy(shapes: TLShape[] | TLShapeId[], delta: number, opts?: {
|
|
center?: VecLike;
|
|
}): this;
|
|
run(fn: () => void, opts?: TLEditorRunOptions): this;
|
|
screenToPage(point: VecLike): Vec;
|
|
readonly scribbles: ScribbleManager;
|
|
select(...shapes: TLShape[] | TLShapeId[]): this;
|
|
selectAdjacentShape(direction: TLAdjacentDirection): void;
|
|
selectAll(): this;
|
|
// (undocumented)
|
|
selectFirstChildShape(): void;
|
|
selectNone(): this;
|
|
// (undocumented)
|
|
selectParentShape(): void;
|
|
sendBackward(shapes: TLShape[] | TLShapeId[], opts?: {
|
|
considerAllShapes?: boolean;
|
|
}): this;
|
|
sendToBack(shapes: TLShape[] | TLShapeId[]): this;
|
|
setCamera(point: VecLike, opts?: TLCameraMoveOptions): this;
|
|
setCameraOptions(opts: Partial<TLCameraOptions>): this;
|
|
setColorMode(mode: 'dark' | 'light'): this;
|
|
setCroppingShape(shape: null | TLShape | TLShapeId): this;
|
|
setCurrentPage(page: TLPage | TLPageId): this;
|
|
setCurrentTheme(id: TLThemeId): this;
|
|
setCurrentTool(id: string, info?: {}): this;
|
|
setCursor(cursor: Partial<TLCursor>): 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?: TLHistoryBatchOptions): this;
|
|
setOpacityForSelectedShapes(opacity: number): this;
|
|
setRichTextEditor(textEditor: null | TiptapEditor): this;
|
|
setSelectedShapes(shapes: TLShape[] | TLShapeId[]): this;
|
|
setStyleForNextShapes<T>(style: StyleProp<T>, value: T, historyOptions?: TLHistoryBatchOptions): this;
|
|
setStyleForSelectedShapes<S extends StyleProp<any>>(style: S, value: StylePropValue<S>): this;
|
|
setTool(Tool: TLStateNodeConstructor, parent?: StateNode): void;
|
|
shapeUtils: {
|
|
readonly [K in string]?: ShapeUtil<TLShape>;
|
|
};
|
|
readonly sideEffects: StoreSideEffects<TLRecord>;
|
|
slideCamera(opts?: {
|
|
direction: VecLike;
|
|
force?: boolean;
|
|
friction?: number;
|
|
speed: number;
|
|
speedThreshold?: number;
|
|
}): this;
|
|
readonly snaps: SnapManager;
|
|
squashToMark(markId: string): this;
|
|
stackShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical', gap?: number): this;
|
|
startFollowingUser(userId: TLUserId): this;
|
|
stopCameraAnimation(): this;
|
|
stopFollowingUser(): this;
|
|
readonly store: TLStore;
|
|
stretchShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
|
|
// (undocumented)
|
|
styleProps: {
|
|
[key: string]: Map<StyleProp<any>, string>;
|
|
};
|
|
readonly textMeasure: TextManager;
|
|
readonly timers: {
|
|
cancelAnimationFrame: (id: number | undefined) => void;
|
|
clearInterval: (id: number | undefined) => void;
|
|
clearTimeout: (id: number | undefined) => void;
|
|
dispose: () => void;
|
|
requestAnimationFrame: (callback: FrameRequestCallback) => number;
|
|
setInterval: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
|
|
setTimeout: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
|
|
};
|
|
toggleLock(shapes: TLShape[] | TLShapeId[]): this;
|
|
toImage(shapes: TLShape[] | TLShapeId[], opts?: TLImageExportOptions): Promise<{
|
|
blob: Blob;
|
|
height: number;
|
|
width: number;
|
|
}>;
|
|
toImageDataUrl(shapes: TLShape[] | TLShapeId[], opts?: TLImageExportOptions): Promise<{
|
|
height: number;
|
|
url: string;
|
|
width: number;
|
|
}>;
|
|
undo(): this;
|
|
ungroupShapes(ids: TLShapeId[], opts?: Partial<{
|
|
select: boolean;
|
|
}>): this;
|
|
// (undocumented)
|
|
ungroupShapes(shapes: TLShape[], opts?: Partial<{
|
|
select: boolean;
|
|
}>): this;
|
|
updateAssets(assets: TLAssetPartial[]): this;
|
|
updateBinding<B extends TLBinding = TLBinding>(partial: TLBindingUpdate<B>): this;
|
|
updateBindings(partials: (null | TLBindingUpdate | undefined)[]): this;
|
|
updateCurrentPageState(partial: Partial<Omit<TLInstancePageState, 'editingShapeId' | 'focusedGroupId' | 'pageId' | 'selectedShapeIds'>>): this;
|
|
// (undocumented)
|
|
_updateCurrentPageState(partial: Partial<Omit<TLInstancePageState, 'selectedShapeIds'>>): void;
|
|
updateDocumentSettings(settings: Partial<TLDocument>): this;
|
|
updateInstanceState(partial: Partial<Omit<TLInstance, 'currentPageId'>>, historyOptions?: TLHistoryBatchOptions): this;
|
|
// @internal (undocumented)
|
|
_updateInstanceState(partial: Partial<Omit<TLInstance, 'currentPageId'>>, opts?: TLHistoryBatchOptions): void;
|
|
updatePage(partial: RequiredKeys<Partial<TLPage>, 'id'>): this;
|
|
updatePointer(options?: TLUpdatePointerOptions): this;
|
|
updateShape<T extends TLShape = TLShape>(partial: null | TLShapePartial<T> | undefined): this;
|
|
updateShapes<T extends TLShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
|
|
// @internal (undocumented)
|
|
_updateShapes(_partials: (null | TLShapePartial | undefined)[]): void;
|
|
updateTheme(theme: TLTheme): this;
|
|
updateThemes(themes: ((themes: TLThemes) => TLThemes) | TLThemes): this;
|
|
updateViewportScreenBounds(screenBounds: Box | HTMLElement, center?: boolean): this;
|
|
uploadAsset(asset: TLAsset, file: File, abortSignal?: AbortSignal): Promise<{
|
|
meta?: JsonObject;
|
|
src: string;
|
|
}>;
|
|
readonly user: UserPreferencesManager;
|
|
visitDescendants(parent: TLPage | TLParentId | TLShape, visitor: (id: TLShapeId) => false | void): this;
|
|
wasEventAlreadyHandled(e: {
|
|
nativeEvent: Event;
|
|
} | Event): boolean;
|
|
zoomIn(point?: Vec, opts?: TLCameraMoveOptions): this;
|
|
zoomOut(point?: Vec, opts?: TLCameraMoveOptions): this;
|
|
zoomToBounds(bounds: BoxLike, opts?: {
|
|
inset?: number;
|
|
targetZoom?: number;
|
|
} & TLCameraMoveOptions): this;
|
|
zoomToFit(opts?: TLCameraMoveOptions): this;
|
|
zoomToSelection(opts?: TLCameraMoveOptions): this;
|
|
zoomToSelectionIfOffscreen(padding?: number, opts?: {
|
|
inset?: number;
|
|
targetZoom?: number;
|
|
} & TLCameraMoveOptions): void;
|
|
zoomToUser(userId: TLUserId, opts?: TLCameraMoveOptions): this;
|
|
}
|
|
|
|
// @public
|
|
export class EditorAtom<T> {
|
|
constructor(name: string, getInitialState: (editor: Editor) => T);
|
|
// (undocumented)
|
|
get(editor: Editor): T;
|
|
// (undocumented)
|
|
getAtom(editor: Editor): Atom<T>;
|
|
// (undocumented)
|
|
set(editor: Editor, state: T): T;
|
|
// (undocumented)
|
|
update(editor: Editor, update: (state: T) => T): T;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const EditorContext: React_3.Context<Editor | null>;
|
|
|
|
// @public
|
|
export abstract class EditorManager {
|
|
constructor(editor: Editor);
|
|
protected addEditorEvent<E extends keyof TLEventMap>(event: E, fn: (...args: TLEventMap[E]) => void): () => void;
|
|
// (undocumented)
|
|
protected readonly disposables: Set<() => void>;
|
|
// @internal (undocumented)
|
|
dispose(): void;
|
|
// (undocumented)
|
|
protected readonly editor: Editor;
|
|
protected register(dispose: () => void): () => void;
|
|
protected unregister(dispose: () => void): void;
|
|
}
|
|
|
|
// @public
|
|
export function EditorPortal({ children }: EditorPortalProps): ReactPortal | null;
|
|
|
|
// @public (undocumented)
|
|
export interface EditorPortalProps {
|
|
// (undocumented)
|
|
children: ReactNode;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export function EditorProvider({ editor, children }: EditorProviderProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export interface EditorProviderProps {
|
|
// (undocumented)
|
|
children: React_3.ReactNode;
|
|
// (undocumented)
|
|
editor: Editor;
|
|
}
|
|
|
|
// @internal (undocumented)
|
|
export function elementShouldCaptureKeys(el: Element | null, includeButtonsAndMenus?: boolean): boolean;
|
|
|
|
// @public (undocumented)
|
|
export class Ellipse2d extends Geometry2d {
|
|
constructor(config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
height: number;
|
|
width: number;
|
|
});
|
|
// (undocumented)
|
|
config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
height: number;
|
|
width: number;
|
|
};
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, hitInside?: boolean): number;
|
|
// (undocumented)
|
|
get edges(): Edge2d[];
|
|
// (undocumented)
|
|
getBounds(): Box;
|
|
// (undocumented)
|
|
getLength(): number;
|
|
// (undocumented)
|
|
getSvgPathData(first?: boolean): string;
|
|
// (undocumented)
|
|
getVertices(): any[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike): boolean;
|
|
// (undocumented)
|
|
nearestPoint(A: VecLike): Vec;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class ErrorBoundary extends React_2.Component<React_2.PropsWithChildren<TLErrorBoundaryProps>, {
|
|
error: Error | null;
|
|
}> {
|
|
// (undocumented)
|
|
componentDidCatch(error: unknown): void;
|
|
// (undocumented)
|
|
static getDerivedStateFromError(error: Error): {
|
|
error: Error;
|
|
};
|
|
// (undocumented)
|
|
render(): bigint | boolean | JSX.Element | Iterable<React_2.ReactNode> | null | number | Promise<bigint | boolean | Iterable<React_2.ReactNode> | null | number | React_2.ReactElement<unknown, React_2.JSXElementConstructor<any> | string> | React_2.ReactPortal | string | undefined> | string | undefined;
|
|
// (undocumented)
|
|
state: {
|
|
error: null;
|
|
};
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export function ErrorScreen({ children }: LoadingScreenProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export const EVENT_NAME_MAP: Record<Exclude<TLEventName, TLPinchEventName>, keyof TLEventHandlers>;
|
|
|
|
// @internal (undocumented)
|
|
export function extractSessionStateFromLegacySnapshot(store: Record<string, UnknownRecord>): null | TLSessionStateSnapshot;
|
|
|
|
// @internal (undocumented)
|
|
export const featureFlags: Record<string, DebugFlag<boolean>>;
|
|
|
|
// @public (undocumented)
|
|
export class FontManager {
|
|
constructor(editor: Editor, assetUrls?: {
|
|
[key: string]: string | undefined;
|
|
} | undefined);
|
|
// (undocumented)
|
|
dispose(): void;
|
|
// (undocumented)
|
|
ensureFontIsLoaded(font: TLFontFace): Promise<void>;
|
|
// (undocumented)
|
|
getShapeFontFaces(shape: TLShape | TLShapeId): TLFontFace[];
|
|
// (undocumented)
|
|
loadRequiredFontsForCurrentPage(limit?: number): Promise<void>;
|
|
// (undocumented)
|
|
requestFonts(fonts: TLFontFace[]): void;
|
|
// (undocumented)
|
|
toEmbeddedCssDeclaration(font: TLFontFace): Promise<string>;
|
|
// (undocumented)
|
|
trackFontsForShape(shape: TLShape | TLShapeId): void;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface GapsSnapIndicator {
|
|
// (undocumented)
|
|
direction: 'horizontal' | 'vertical';
|
|
// (undocumented)
|
|
gaps: Array<{
|
|
endEdge: [VecLike, VecLike];
|
|
startEdge: [VecLike, VecLike];
|
|
}>;
|
|
// (undocumented)
|
|
id: string;
|
|
// (undocumented)
|
|
type: 'gaps';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export abstract class Geometry2d {
|
|
constructor(opts: Geometry2dOptions);
|
|
// (undocumented)
|
|
get area(): number;
|
|
// (undocumented)
|
|
get bounds(): Box;
|
|
// (undocumented)
|
|
get boundsVertices(): Vec[];
|
|
// (undocumented)
|
|
get center(): Vec;
|
|
// (undocumented)
|
|
debugColor?: string;
|
|
// (undocumented)
|
|
distanceToLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): number;
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
// (undocumented)
|
|
excludeFromShapeBounds: boolean;
|
|
// (undocumented)
|
|
getArea(): number;
|
|
// (undocumented)
|
|
getBounds(): Box;
|
|
// (undocumented)
|
|
getBoundsVertices(): Vec[];
|
|
// (undocumented)
|
|
getLength(_filters?: Geometry2dFilters): number;
|
|
// (undocumented)
|
|
abstract getSvgPathData(first: boolean): string;
|
|
// (undocumented)
|
|
abstract getVertices(filters: Geometry2dFilters): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number, filters?: Geometry2dFilters): boolean;
|
|
// (undocumented)
|
|
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, _filters?: Geometry2dFilters): boolean;
|
|
// (undocumented)
|
|
ignore?: boolean;
|
|
ignoreHit(_point: VecLike): boolean;
|
|
interpolateAlongEdge(t: number, _filters?: Geometry2dFilters): Vec;
|
|
// (undocumented)
|
|
intersectCircle(center: VecLike, radius: number, _filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
intersectLineSegment(A: VecLike, B: VecLike, _filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
intersectPolygon(polygon: VecLike[], _filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
intersectPolyline(polyline: VecLike[], _filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
isClosed: boolean;
|
|
// (undocumented)
|
|
isEmptyLabel: boolean;
|
|
// (undocumented)
|
|
isExcludedByFilter(filters?: Geometry2dFilters): boolean;
|
|
// (undocumented)
|
|
isFilled: boolean;
|
|
// (undocumented)
|
|
isInternal: boolean;
|
|
// (undocumented)
|
|
isLabel: boolean;
|
|
// (undocumented)
|
|
isPointInBounds(point: VecLike, margin?: number): boolean;
|
|
// (undocumented)
|
|
get length(): number;
|
|
// (undocumented)
|
|
abstract nearestPoint(point: VecLike, _filters?: Geometry2dFilters): Vec;
|
|
// (undocumented)
|
|
overlapsPolygon(_polygon: VecLike[]): boolean;
|
|
// (undocumented)
|
|
toSimpleSvgPath(): string;
|
|
// (undocumented)
|
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
uninterpolateAlongEdge(point: VecLike, _filters?: Geometry2dFilters): number;
|
|
// (undocumented)
|
|
get vertices(): Vec[];
|
|
}
|
|
|
|
// @public
|
|
export interface Geometry2dFilters {
|
|
// (undocumented)
|
|
readonly includeInternal?: boolean;
|
|
// (undocumented)
|
|
readonly includeLabels?: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const Geometry2dFilters: {
|
|
EXCLUDE_INTERNAL: Geometry2dFilters;
|
|
EXCLUDE_LABELS: Geometry2dFilters;
|
|
EXCLUDE_NON_STANDARD: Geometry2dFilters;
|
|
INCLUDE_ALL: Geometry2dFilters;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export interface Geometry2dOptions extends TransformedGeometry2dOptions {
|
|
// (undocumented)
|
|
isClosed: boolean;
|
|
// (undocumented)
|
|
isFilled: boolean;
|
|
}
|
|
|
|
// @public
|
|
export function getArcMeasure(A: number, B: number, sweepFlag: number, largeArcFlag: number): number;
|
|
|
|
// @public
|
|
export function getColorValue(colors: TLThemeColors, color: string | TLDefaultColorStyle, variant: keyof TLDefaultColor): string;
|
|
|
|
// @public (undocumented)
|
|
export function getCursor(cursor: TLCursorType, rotation?: number, color?: string): string;
|
|
|
|
// @public
|
|
export function getDefaultCdnBaseUrl(): string;
|
|
|
|
// @public
|
|
export function getDroppedShapesToNewParents(editor: Editor, shapes: Set<TLShape> | TLShape[], cb?: (shape: TLShape, parent: TLShape) => boolean): {
|
|
remainingShapesToReparent: Set<TLShape>;
|
|
reparenting: Map<TLShapeId, TLShape[]>;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export function getFontsFromRichText(editor: Editor, richText: TLRichText, initialState: RichTextFontVisitorState): TLFontFace[];
|
|
|
|
// @public (undocumented)
|
|
export function getFreshUserPreferences(): TLUserPreferences;
|
|
|
|
// @internal
|
|
export function getGlobalDocument(): Document;
|
|
|
|
// @internal
|
|
export function getGlobalWindow(): Window & typeof globalThis;
|
|
|
|
// @public
|
|
export function getIncrementedName(name: string, others: string[]): string;
|
|
|
|
// @public
|
|
export function getOverlayDisplayValues<Overlay extends TLOverlay, DisplayValues extends object>(util: {
|
|
editor: Editor;
|
|
options: OverlayOptionsWithDisplayValues<Overlay, DisplayValues>;
|
|
}, overlay: Overlay, colorMode?: 'dark' | 'light'): DisplayValues;
|
|
|
|
// @internal (undocumented)
|
|
export function getOwnerDocument(nodeOrDocument: Document | Node | null | undefined): Document;
|
|
|
|
// @internal (undocumented)
|
|
export function getOwnerWindow(nodeOrDocument: Document | Node | null | undefined): Window & typeof globalThis;
|
|
|
|
// @public (undocumented)
|
|
export function getPerfectDashProps(totalLength: number, strokeWidth: number, opts?: {
|
|
closed?: boolean;
|
|
end?: PerfectDashTerminal;
|
|
forceSolid?: boolean;
|
|
lengthRatio?: number;
|
|
snap?: number;
|
|
start?: PerfectDashTerminal;
|
|
style?: TLDefaultDashStyle;
|
|
}): {
|
|
strokeDasharray: string;
|
|
strokeDashoffset: string;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export function getPointerInfo(editor: Editor, e: PointerEvent | React_3.PointerEvent): {
|
|
accelKey: boolean;
|
|
altKey: boolean;
|
|
button: number;
|
|
ctrlKey: boolean;
|
|
isPen: boolean;
|
|
metaKey: 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 getPointsOnArc(startPoint: VecLike, endPoint: VecLike, center: null | VecLike, radius: number, numPoints: number): Vec[];
|
|
|
|
// @public (undocumented)
|
|
export function getPolygonVertices(width: number, height: number, sides: number): Vec[];
|
|
|
|
// @internal (undocumented)
|
|
export function getRotationSnapshot({ editor, ids, }: {
|
|
editor: Editor;
|
|
ids: TLShapeId[];
|
|
}): null | TLRotationSnapshot;
|
|
|
|
// @public (undocumented)
|
|
export function getSnapshot(store: TLStore): TLEditorSnapshot;
|
|
|
|
// @public (undocumented)
|
|
export function getSvgAsImage(svgString: string, options: {
|
|
height: number;
|
|
pixelRatio?: number;
|
|
quality?: number;
|
|
type: 'jpeg' | 'png' | 'webp';
|
|
width: number;
|
|
}): Promise<Blob | null>;
|
|
|
|
// @public
|
|
export function getSvgPathFromPoints(points: VecLike[], closed?: boolean): string;
|
|
|
|
// @public (undocumented)
|
|
export function getUserPreferences(): TLUserPreferences;
|
|
|
|
// @internal (undocumented)
|
|
export function getVerticesCountForArcLength(length: number, spacing?: number): number;
|
|
|
|
// @public (undocumented)
|
|
export class Group2d extends Geometry2d {
|
|
constructor(config: Omit<Geometry2dOptions, 'isClosed' | 'isFilled'> & {
|
|
children: Geometry2d[];
|
|
});
|
|
// (undocumented)
|
|
children: Geometry2d[];
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
// (undocumented)
|
|
getArea(): number;
|
|
// (undocumented)
|
|
getBoundsVertices(): Vec[];
|
|
// (undocumented)
|
|
getLength(filters?: Geometry2dFilters): number;
|
|
// (undocumented)
|
|
getSvgPathData(): string;
|
|
// (undocumented)
|
|
getVertices(filters: Geometry2dFilters): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike, zoom: number, filters?: Geometry2dFilters): boolean;
|
|
// (undocumented)
|
|
hitTestPoint(point: VecLike, margin: number, hitInside: boolean, filters?: Geometry2dFilters): boolean;
|
|
// (undocumented)
|
|
ignoredChildren: Geometry2d[];
|
|
// (undocumented)
|
|
interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
|
|
// (undocumented)
|
|
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec;
|
|
// (undocumented)
|
|
overlapsPolygon(polygon: VecLike[]): boolean;
|
|
// (undocumented)
|
|
toSimpleSvgPath(): string;
|
|
// (undocumented)
|
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
// (undocumented)
|
|
uninterpolateAlongEdge(point: VecLike, filters?: Geometry2dFilters): number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
// (undocumented)
|
|
canBind(): boolean;
|
|
// (undocumented)
|
|
canResize(): boolean;
|
|
// (undocumented)
|
|
canResizeChildren(): boolean;
|
|
// (undocumented)
|
|
component(shape: TLGroupShape): JSX.Element | null;
|
|
// (undocumented)
|
|
getDefaultProps(): TLGroupShape['props'];
|
|
// (undocumented)
|
|
getGeometry(shape: TLGroupShape): Geometry2d;
|
|
// (undocumented)
|
|
getIndicatorPath(shape: TLGroupShape): Path2D;
|
|
// (undocumented)
|
|
hideSelectionBoundsFg(shape: TLGroupShape): boolean;
|
|
// (undocumented)
|
|
static migrations: TLPropsMigrations;
|
|
// (undocumented)
|
|
onChildrenChange(group: TLGroupShape): void;
|
|
// (undocumented)
|
|
static props: RecordProps<TLGroupShape>;
|
|
// (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 (undocumented)
|
|
export class HandleSnaps {
|
|
constructor(manager: SnapManager);
|
|
// (undocumented)
|
|
readonly editor: Editor;
|
|
// (undocumented)
|
|
readonly manager: SnapManager;
|
|
// (undocumented)
|
|
snapHandle({ currentShapeId, handle, }: {
|
|
currentShapeId: TLShapeId;
|
|
handle: TLHandle;
|
|
}): null | SnapData;
|
|
}
|
|
|
|
// @public
|
|
export function hardReset({ shouldReload }?: {
|
|
shouldReload?: boolean | undefined;
|
|
}): Promise<void>;
|
|
|
|
// @public (undocumented)
|
|
export function hardResetEditor(): void;
|
|
|
|
// @public (undocumented)
|
|
export class HistoryManager<R extends UnknownRecord> {
|
|
constructor(opts: {
|
|
annotateError?(error: unknown): void;
|
|
store: Store<R>;
|
|
});
|
|
// (undocumented)
|
|
bail(): this;
|
|
// (undocumented)
|
|
bailToMark(id: string): this;
|
|
// (undocumented)
|
|
batch(fn: () => void, opts?: TLHistoryBatchOptions): this;
|
|
// (undocumented)
|
|
clear(): void;
|
|
// @internal (undocumented)
|
|
debug(): {
|
|
pendingDiff: {
|
|
diff: RecordsDiff<R>;
|
|
isEmpty: boolean;
|
|
};
|
|
redos: TLHistoryEntry<R>[];
|
|
state: string;
|
|
undos: TLHistoryEntry<R>[];
|
|
};
|
|
// (undocumented)
|
|
readonly dispose: () => void;
|
|
// @internal (undocumented)
|
|
getMarkIdMatching(idSubstring: string): null | string;
|
|
// (undocumented)
|
|
getNumRedos(): number;
|
|
// (undocumented)
|
|
getNumUndos(): number;
|
|
// @internal (undocumented)
|
|
_isInBatch: boolean;
|
|
// @internal (undocumented)
|
|
isReplaying(): boolean;
|
|
// @internal (undocumented)
|
|
_mark(id: string): void;
|
|
// (undocumented)
|
|
redo(): this;
|
|
// (undocumented)
|
|
squashToMark(id: string): this;
|
|
// (undocumented)
|
|
undo(): this;
|
|
// (undocumented)
|
|
_undo({ pushToRedoStack, toMark }: {
|
|
pushToRedoStack: boolean;
|
|
toMark?: string;
|
|
}): this;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
|
|
|
|
// @public (undocumented)
|
|
export const inlineBase64AssetStore: TLAssetStore;
|
|
|
|
// @public (undocumented)
|
|
export class InputsManager extends EditorManager {
|
|
constructor(editor: Editor);
|
|
// @deprecated (undocumented)
|
|
get accelKey(): boolean;
|
|
// @deprecated (undocumented)
|
|
get altKey(): boolean;
|
|
set altKey(altKey: boolean);
|
|
readonly buttons: AtomSet<number>;
|
|
// @deprecated (undocumented)
|
|
get ctrlKey(): boolean;
|
|
set ctrlKey(ctrlKey: boolean);
|
|
// @deprecated (undocumented)
|
|
get currentPagePoint(): Vec;
|
|
// @deprecated (undocumented)
|
|
get currentScreenPoint(): Vec;
|
|
getAccelKey(): boolean;
|
|
getAltKey(): boolean;
|
|
getCtrlKey(): boolean;
|
|
getCurrentPagePoint(): Vec;
|
|
getCurrentScreenPoint(): Vec;
|
|
getIsDragging(): boolean;
|
|
getIsEditing(): boolean;
|
|
getIsPanning(): boolean;
|
|
getIsPen(): boolean;
|
|
getIsPinching(): boolean;
|
|
getIsPointing(): boolean;
|
|
getIsRightPointing(): boolean;
|
|
getIsSpacebarPanning(): boolean;
|
|
getMetaKey(): boolean;
|
|
getOriginPagePoint(): Vec;
|
|
getOriginScreenPoint(): Vec;
|
|
getPointerVelocity(): Vec;
|
|
getPreviousPagePoint(): Vec;
|
|
getPreviousScreenPoint(): Vec;
|
|
getShiftKey(): boolean;
|
|
get isDragging(): boolean;
|
|
set isDragging(isDragging: boolean);
|
|
// @deprecated (undocumented)
|
|
get isEditing(): boolean;
|
|
set isEditing(isEditing: boolean);
|
|
// @deprecated (undocumented)
|
|
get isPanning(): boolean;
|
|
set isPanning(isPanning: boolean);
|
|
// @deprecated (undocumented)
|
|
get isPen(): boolean;
|
|
set isPen(isPen: boolean);
|
|
// @deprecated (undocumented)
|
|
get isPinching(): boolean;
|
|
set isPinching(isPinching: boolean);
|
|
// @deprecated (undocumented)
|
|
get isPointing(): boolean;
|
|
set isPointing(isPointing: boolean);
|
|
// @deprecated (undocumented)
|
|
get isSpacebarPanning(): boolean;
|
|
set isSpacebarPanning(isSpacebarPanning: boolean);
|
|
readonly keys: AtomSet<string>;
|
|
markActivity(): void;
|
|
// @deprecated (undocumented)
|
|
get metaKey(): boolean;
|
|
set metaKey(metaKey: boolean);
|
|
// @deprecated (undocumented)
|
|
get originPagePoint(): Vec;
|
|
// @deprecated (undocumented)
|
|
get originScreenPoint(): Vec;
|
|
// @deprecated (undocumented)
|
|
get pointerVelocity(): Vec;
|
|
// @deprecated (undocumented)
|
|
get previousPagePoint(): Vec;
|
|
// @deprecated (undocumented)
|
|
get previousScreenPoint(): Vec;
|
|
// @internal (undocumented)
|
|
setAltKey(altKey: boolean): void;
|
|
// @internal (undocumented)
|
|
setCtrlKey(ctrlKey: boolean): void;
|
|
// (undocumented)
|
|
setIsDragging(isDragging: boolean): void;
|
|
// (undocumented)
|
|
setIsEditing(isEditing: boolean): void;
|
|
// @internal (undocumented)
|
|
setIsPanning(isPanning: boolean): void;
|
|
// (undocumented)
|
|
setIsPen(isPen: boolean): void;
|
|
// @internal (undocumented)
|
|
setIsPinching(isPinching: boolean): void;
|
|
// @internal (undocumented)
|
|
setIsPointing(isPointing: boolean): void;
|
|
// @internal (undocumented)
|
|
setIsRightPointing(isRightPointing: boolean): void;
|
|
// @internal (undocumented)
|
|
setIsSpacebarPanning(isSpacebarPanning: boolean): void;
|
|
// @internal (undocumented)
|
|
setMetaKey(metaKey: boolean): void;
|
|
// @internal
|
|
setPointerVelocity(pointerVelocity: Vec): void;
|
|
// @internal (undocumented)
|
|
setShiftKey(shiftKey: boolean): void;
|
|
// @deprecated (undocumented)
|
|
get shiftKey(): boolean;
|
|
set shiftKey(shiftKey: boolean);
|
|
// (undocumented)
|
|
toJson(): {
|
|
altKey: boolean;
|
|
buttons: number[];
|
|
ctrlKey: boolean;
|
|
currentPagePoint: VecModel;
|
|
currentScreenPoint: VecModel;
|
|
isDragging: boolean;
|
|
isEditing: boolean;
|
|
isPanning: boolean;
|
|
isPen: boolean;
|
|
isPinching: boolean;
|
|
isPointing: boolean;
|
|
isSpacebarPanning: boolean;
|
|
keys: string[];
|
|
metaKey: boolean;
|
|
originPagePoint: VecModel;
|
|
originScreenPoint: VecModel;
|
|
pointerVelocity: VecModel;
|
|
previousPagePoint: VecModel;
|
|
previousScreenPoint: VecModel;
|
|
shiftKey: boolean;
|
|
};
|
|
// @internal
|
|
updateFromEvent(info: TLPinchEventInfo | TLPointerEventInfo | TLWheelEventInfo): void;
|
|
// @internal
|
|
updatePointerVelocity(elapsed: number): void;
|
|
}
|
|
|
|
// @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, precision?: number): 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[];
|
|
|
|
// @internal (undocumented)
|
|
export interface InvalidLicenseKeyResult {
|
|
// (undocumented)
|
|
isLicenseParseable: false;
|
|
// (undocumented)
|
|
reason: InvalidLicenseReason;
|
|
}
|
|
|
|
// @internal (undocumented)
|
|
export type InvalidLicenseReason = 'has-key-development-mode' | 'invalid-license-key' | 'no-key-provided';
|
|
|
|
// @internal
|
|
export function isAccelKey(e: {
|
|
ctrlKey: boolean;
|
|
metaKey: boolean;
|
|
}): boolean;
|
|
|
|
// @public
|
|
export function isCursorInViewport(cursor: VecLike, viewport: {
|
|
maxX: number;
|
|
maxY: number;
|
|
minX: number;
|
|
minY: number;
|
|
}, zoom: number): boolean;
|
|
|
|
// @public
|
|
export function isSafeFloat(n: number): boolean;
|
|
|
|
// @public
|
|
export function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeId[], opts?: {
|
|
filter?(parent: TLShape): boolean;
|
|
}): void;
|
|
|
|
// @internal (undocumented)
|
|
export const LICENSE_TIMEOUT = 5000;
|
|
|
|
// @internal
|
|
export type LicenseFeatureName = 'collaboration' | 'commenting';
|
|
|
|
// @internal (undocumented)
|
|
export type LicenseFromKeyResult = InvalidLicenseKeyResult | ValidLicenseKeyResult;
|
|
|
|
// @internal (undocumented)
|
|
export interface LicenseInfo {
|
|
// (undocumented)
|
|
expiryDate: string;
|
|
// (undocumented)
|
|
flags: number;
|
|
// (undocumented)
|
|
hosts: string[];
|
|
// (undocumented)
|
|
id: string;
|
|
}
|
|
|
|
// @internal (undocumented)
|
|
export class LicenseManager {
|
|
constructor(licenseKey: string | undefined, testPublicKey?: string);
|
|
// (undocumented)
|
|
static className: string;
|
|
dispose(): void;
|
|
// (undocumented)
|
|
featureFlags: Atom<Record<LicenseFeatureName, boolean>, unknown>;
|
|
// (undocumented)
|
|
getLicenseFromKey(licenseKey?: string): Promise<LicenseFromKeyResult>;
|
|
// (undocumented)
|
|
isCryptoAvailable: boolean;
|
|
// (undocumented)
|
|
isDevelopment: boolean;
|
|
isFeatureEnabled(feature: LicenseFeatureName): boolean;
|
|
// (undocumented)
|
|
isTest: boolean;
|
|
// (undocumented)
|
|
state: Atom<LicenseState, unknown>;
|
|
// (undocumented)
|
|
verbose: boolean;
|
|
}
|
|
|
|
// @internal (undocumented)
|
|
export type LicenseState = 'expired' | 'licensed-with-watermark' | 'licensed' | 'pending' | 'unlicensed-production' | 'unlicensed';
|
|
|
|
// @public (undocumented)
|
|
export function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
|
|
|
|
// @public (undocumented)
|
|
export function LoadingScreen({ children }: LoadingScreenProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export interface LoadingScreenProps {
|
|
// (undocumented)
|
|
children: ReactNode;
|
|
}
|
|
|
|
// @public
|
|
export function loadSessionStateSnapshotIntoStore(store: TLStore, snapshot: TLSessionStateSnapshot, opts?: TLLoadSessionStateSnapshotOptions): void;
|
|
|
|
// @public
|
|
export function loadSnapshot(store: TLStore, _snapshot: Partial<TLEditorSnapshot> | TLStoreSnapshot, opts?: TLLoadSnapshotOptions): void;
|
|
|
|
// @internal (undocumented)
|
|
export class LocalIndexedDb {
|
|
constructor(persistenceKey: string);
|
|
// (undocumented)
|
|
close(): Promise<void>;
|
|
// (undocumented)
|
|
static connectedInstances: Set<LocalIndexedDb>;
|
|
// (undocumented)
|
|
getAsset(assetId: string): Promise<File | undefined>;
|
|
// (undocumented)
|
|
load({ sessionId }?: {
|
|
sessionId?: string;
|
|
}): Promise<{
|
|
records: any[];
|
|
schema: any;
|
|
sessionStateSnapshot: TLSessionStateSnapshot | undefined;
|
|
}>;
|
|
pending(): Promise<void>;
|
|
pruneSessions({ keepSessionId }?: {
|
|
keepSessionId?: string;
|
|
}): Promise<void>;
|
|
// (undocumented)
|
|
removeAssets(assetId: string[]): Promise<void>;
|
|
// (undocumented)
|
|
storeAsset(assetId: string, blob: File): Promise<void>;
|
|
// (undocumented)
|
|
storeChanges({ schema, changes, sessionId, sessionStateSnapshot, }: {
|
|
changes: RecordsDiff<any>;
|
|
schema: TLStoreSchema;
|
|
sessionId?: null | string;
|
|
sessionStateSnapshot?: null | TLSessionStateSnapshot;
|
|
}): Promise<void>;
|
|
// (undocumented)
|
|
storeSnapshot({ schema, snapshot, sessionId, sessionStateSnapshot, }: {
|
|
schema: TLStoreSchema;
|
|
sessionId?: null | string;
|
|
sessionStateSnapshot?: null | TLSessionStateSnapshot;
|
|
snapshot: SerializedStore<any>;
|
|
}): Promise<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): Mat;
|
|
// (undocumented)
|
|
static Scale(x: number, y: number, cx: number, cy: number): Mat;
|
|
// (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;
|
|
}
|
|
|
|
// @public
|
|
export function maybeSnapToGrid(point: Vec, editor: Editor): Vec;
|
|
|
|
// @public
|
|
export function MenuClickCapture(): false | JSX.Element;
|
|
|
|
// @public
|
|
export function moveElementInto(parent: HTMLElement, element: HTMLElement): void;
|
|
|
|
// @internal
|
|
export function normalizeWheel(event: React.WheelEvent<HTMLElement> | WheelEvent): {
|
|
x: number;
|
|
y: number;
|
|
z: number;
|
|
};
|
|
|
|
// @public
|
|
export function openWindow(url: string, target?: string, allowReferrer?: boolean): void;
|
|
|
|
// @internal (undocumented)
|
|
export function OptionalErrorBoundary({ children, fallback, ...props }: Omit<TLErrorBoundaryProps, 'fallback'> & {
|
|
fallback: TLErrorFallbackComponent;
|
|
}): bigint | boolean | JSX.Element | Iterable<React_2.ReactNode> | null | number | Promise<bigint | boolean | Iterable<React_2.ReactNode> | null | number | React_2.ReactElement<unknown, React_2.JSXElementConstructor<any> | string> | React_2.ReactPortal | string | undefined> | string | undefined;
|
|
|
|
// @public (undocumented)
|
|
export type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
|
|
// @public (undocumented)
|
|
export class OverlayManager {
|
|
constructor(editor: Editor);
|
|
// (undocumented)
|
|
dispose(): void;
|
|
// (undocumented)
|
|
readonly editor: Editor;
|
|
getActiveOverlayEntries(): TLOverlayEntry[];
|
|
getCurrentOverlays(): TLOverlay[];
|
|
// (undocumented)
|
|
getHoveredOverlay(): null | TLOverlay;
|
|
// (undocumented)
|
|
getHoveredOverlayId(): null | string;
|
|
getOverlayAtPoint(point: VecLike, margin?: number): null | TLOverlay;
|
|
getOverlayGeometry(overlay: TLOverlay): Geometry2d | null;
|
|
getOverlayUtil<T extends OverlayUtil>(type: T extends OverlayUtil<infer O> ? O['type'] : string): T;
|
|
// (undocumented)
|
|
getOverlayUtil<O extends TLOverlay>(overlay: O): OverlayUtil<O>;
|
|
getOverlayUtilsInZOrder(): OverlayUtil[];
|
|
// @internal (undocumented)
|
|
readonly _overlayUtils: Map<string, OverlayUtil<TLOverlay<Record<string, unknown>>>>;
|
|
// @internal
|
|
registerUtil(util: OverlayUtil): void;
|
|
// (undocumented)
|
|
setHoveredOverlay(id: null | string): void;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface OverlayOptionsWithDisplayValues<Overlay extends TLOverlay, DisplayValues extends object> {
|
|
// (undocumented)
|
|
getCustomDisplayValues(editor: Editor, overlay: Overlay, theme: TLTheme, colorMode: 'dark' | 'light'): Partial<DisplayValues>;
|
|
// (undocumented)
|
|
getDefaultDisplayValues(editor: Editor, overlay: Overlay, theme: TLTheme, colorMode: 'dark' | 'light'): DisplayValues;
|
|
}
|
|
|
|
// @public
|
|
export abstract class OverlayUtil<T extends TLOverlay = TLOverlay> {
|
|
constructor(editor: Editor);
|
|
static configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
|
|
options: infer Options;
|
|
} ? Partial<Options> : never): T;
|
|
dispose(): void;
|
|
// (undocumented)
|
|
editor: Editor;
|
|
getCursor(_overlay: T): TLCursorType | undefined;
|
|
getGeometry(_overlay: T): Geometry2d | null;
|
|
abstract getOverlays(): T[];
|
|
abstract isActive(): boolean;
|
|
onPointerDown?(overlay: T, info: TLPointerEventInfo): boolean | void;
|
|
options: {
|
|
zIndex?: number;
|
|
};
|
|
render(_ctx: CanvasRenderingContext2D, _overlays: T[]): void;
|
|
renderMinimap(_ctx: CanvasRenderingContext2D, _overlays: T[], _zoom: number): void;
|
|
// (undocumented)
|
|
static type: string;
|
|
}
|
|
|
|
// @public
|
|
export function parseDeepLinkString(deepLinkString: string): TLDeepLink;
|
|
|
|
// @public (undocumented)
|
|
export type PerfectDashTerminal = 'none' | 'outset' | 'skip';
|
|
|
|
// @public
|
|
export class PerformanceApiAdapter {
|
|
constructor(perfManager: PerformanceManager);
|
|
dispose(): void;
|
|
}
|
|
|
|
// @public
|
|
export class PerformanceManager extends EditorManager {
|
|
// @internal (undocumented)
|
|
dispose(): void;
|
|
// @internal (undocumented)
|
|
readonly emitter: EventEmitter<TLPerfEventMap, any>;
|
|
// @internal (undocumented)
|
|
_notifyCameraOperation(type: 'panning' | 'zooming'): void;
|
|
// @internal (undocumented)
|
|
_notifyInteractionEnd(): void;
|
|
// @internal (undocumented)
|
|
_notifyInteractionStart(name: string, path: string): void;
|
|
// @internal (undocumented)
|
|
_notifyUndoRedo(type: 'redo' | 'undo', undoDepth: number, redoDepth: number): void;
|
|
on<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
|
|
once<K extends keyof TLPerfEventMap>(event: K, fn: (...args: TLPerfEventMap[K]) => void): () => void;
|
|
}
|
|
|
|
// @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<Geometry2dOptions, 'isClosed' | 'isFilled'> & {
|
|
margin: number;
|
|
point: Vec;
|
|
});
|
|
// (undocumented)
|
|
getSvgPathData(): string;
|
|
// (undocumented)
|
|
getVertices(): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike, margin: number): boolean;
|
|
// (undocumented)
|
|
nearestPoint(): Vec;
|
|
}
|
|
|
|
// @public
|
|
export function pointInPolygon(A: VecLike, points: VecLike[]): boolean;
|
|
|
|
// @public (undocumented)
|
|
export interface PointsSnapIndicator {
|
|
// (undocumented)
|
|
id: string;
|
|
// (undocumented)
|
|
points: VecLike[];
|
|
// (undocumented)
|
|
type: 'points';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class Polygon2d extends Polyline2d {
|
|
constructor(config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
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<Geometry2dOptions, 'isClosed' | 'isFilled'> & {
|
|
points: Vec[];
|
|
});
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, hitInside?: boolean): number;
|
|
// (undocumented)
|
|
getLength(): number;
|
|
// (undocumented)
|
|
getSvgPathData(): string;
|
|
// (undocumented)
|
|
getVertices(): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number): boolean;
|
|
// (undocumented)
|
|
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean): boolean;
|
|
// (undocumented)
|
|
nearestPoint(A: VecLike): Vec;
|
|
// (undocumented)
|
|
protected get segments(): Edge2d[];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export function precise(A: VecLike): string;
|
|
|
|
// @public
|
|
export function preventDefault(event: Event | React.BaseSyntheticEvent): void;
|
|
|
|
// @public
|
|
export function radiansToDegrees(r: number): number;
|
|
|
|
// @public
|
|
export function rangeIntersection(a0: number, a1: number, b0: number, b1: number): [number, number] | null;
|
|
|
|
// @public
|
|
export class ReadonlySharedStyleMap {
|
|
// (undocumented)
|
|
[Symbol.iterator](): MapIterator<[StyleProp<any>, SharedStyle<unknown>]>;
|
|
constructor(entries?: Iterable<[StyleProp<unknown>, SharedStyle<unknown>]>);
|
|
// (undocumented)
|
|
entries(): MapIterator<[StyleProp<any>, SharedStyle<unknown>]>;
|
|
// (undocumented)
|
|
equals(other: ReadonlySharedStyleMap): boolean;
|
|
// (undocumented)
|
|
get<T>(prop: StyleProp<T>): SharedStyle<T> | undefined;
|
|
// (undocumented)
|
|
getAsKnownValue<T>(prop: StyleProp<T>): T | undefined;
|
|
// (undocumented)
|
|
keys(): MapIterator<StyleProp<any>>;
|
|
// @internal (undocumented)
|
|
protected map: Map<StyleProp<any>, SharedStyle<unknown>>;
|
|
// (undocumented)
|
|
get size(): number;
|
|
// (undocumented)
|
|
values(): MapIterator<SharedStyle<unknown>>;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class Rectangle2d extends Polygon2d {
|
|
constructor(config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
height: number;
|
|
width: number;
|
|
x?: number;
|
|
y?: number;
|
|
});
|
|
// (undocumented)
|
|
getBounds(): Box;
|
|
// (undocumented)
|
|
getSvgPathData(): string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export function refreshPage(): void;
|
|
|
|
// @public (undocumented)
|
|
export function releasePointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
|
|
|
|
// @public (undocumented)
|
|
export type RequiredKeys<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
|
|
// @public (undocumented)
|
|
export function resizeBox<T extends TLBaseBoxShape>(shape: T, info: {
|
|
handle: TLResizeHandle;
|
|
initialBounds: Box;
|
|
initialShape: T;
|
|
mode: TLResizeMode;
|
|
newPoint: VecModel;
|
|
scaleX: number;
|
|
scaleY: number;
|
|
}, opts?: ResizeBoxOptions): T;
|
|
|
|
// @public (undocumented)
|
|
export interface ResizeBoxOptions {
|
|
// (undocumented)
|
|
maxHeight?: number;
|
|
// (undocumented)
|
|
maxWidth?: number;
|
|
// (undocumented)
|
|
minHeight?: number;
|
|
// (undocumented)
|
|
minWidth?: number;
|
|
}
|
|
|
|
// @public
|
|
export function resizeScaled(shape: TLBaseShape<any, {
|
|
scale: number;
|
|
}>, { initialBounds, scaleX, scaleY, newPoint, handle }: TLResizeInfo<any>): {
|
|
props: {
|
|
scale: number;
|
|
};
|
|
x: number;
|
|
y: number;
|
|
};
|
|
|
|
// @public
|
|
export function resolveLineHeightPx(fontSize: number, lineHeight: number): number;
|
|
|
|
// @public
|
|
export function resolveThemes(themes?: Partial<TLThemes>): TLThemes;
|
|
|
|
// @public (undocumented)
|
|
export type RichTextFontVisitor = (node: TiptapNode, state: RichTextFontVisitorState, addFont: (font: TLFontFace) => void) => RichTextFontVisitorState;
|
|
|
|
// @public (undocumented)
|
|
export interface RichTextFontVisitorState {
|
|
// (undocumented)
|
|
readonly family: string;
|
|
// (undocumented)
|
|
readonly style: string;
|
|
// (undocumented)
|
|
readonly weight: string;
|
|
}
|
|
|
|
// @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(): Promise<void>;
|
|
openWindow(url: string, target: string, allowReferrer?: boolean): void;
|
|
refreshPage(): void;
|
|
};
|
|
|
|
// @public
|
|
export type SafeId = string & {
|
|
__brand: 'SafeId';
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export function sanitizeId(id: string): string;
|
|
|
|
// @public (undocumented)
|
|
export interface ScribbleItem {
|
|
// (undocumented)
|
|
delayRemaining: number;
|
|
// (undocumented)
|
|
id: string;
|
|
// (undocumented)
|
|
next: null | VecModel;
|
|
// (undocumented)
|
|
prev: null | VecModel;
|
|
// (undocumented)
|
|
scribble: TLScribble;
|
|
// (undocumented)
|
|
timeoutMs: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class ScribbleManager {
|
|
constructor(editor: Editor);
|
|
addPoint(id: string, x: number, y: number, z?: number): ScribbleItem;
|
|
addPointToSession(sessionId: string, scribbleId: string, x: number, y: number, z?: number): ScribbleItem;
|
|
addScribble(scribble: Partial<TLScribble>, id?: string): ScribbleItem;
|
|
addScribbleToSession(sessionId: string, scribble: Partial<TLScribble>, scribbleId?: string): ScribbleItem;
|
|
clearSession(sessionId: string): void;
|
|
complete(id: string): ScribbleItem;
|
|
extendSession(sessionId: string): void;
|
|
isSessionActive(sessionId: string): boolean;
|
|
reset(): void;
|
|
startSession(options?: ScribbleSessionOptions): string;
|
|
stop(id: string): ScribbleItem;
|
|
stopSession(sessionId: string): void;
|
|
tick(elapsed: number): void;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface ScribbleSessionOptions {
|
|
fadeDurationMs?: number;
|
|
fadeEasing?: 'ease-in' | 'linear';
|
|
fadeMode?: 'grouped' | 'individual';
|
|
id?: string;
|
|
idleTimeoutMs?: number;
|
|
selfConsume?: boolean;
|
|
}
|
|
|
|
// @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.PointerEvent<Element>): void;
|
|
|
|
// @public (undocumented)
|
|
export function setRuntimeOverrides(input: Partial<typeof runtime>): void;
|
|
|
|
// @public (undocumented)
|
|
export function setUserPreferences(user: TLUserPreferences): void;
|
|
|
|
// @public (undocumented)
|
|
export abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
constructor(editor: Editor);
|
|
// @internal
|
|
backgroundComponent?(shape: Shape): any;
|
|
canBeLaidOut(shape: Shape, info: TLShapeUtilCanBeLaidOutOpts): boolean;
|
|
canBind(opts: TLShapeUtilCanBindOpts): boolean;
|
|
canCrop(shape: Shape): boolean;
|
|
canCull(shape: Shape): boolean;
|
|
canEdit(shape: Shape, info: TLEditStartInfo): boolean;
|
|
canEditInReadonly(shape: Shape): boolean;
|
|
canEditWhileLocked(shape: Shape): boolean;
|
|
canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
|
|
canRemoveChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
|
|
canResize(shape: Shape): boolean;
|
|
canResizeChildren(shape: Shape): boolean;
|
|
canScroll(shape: Shape): boolean;
|
|
canSnap(shape: Shape): boolean;
|
|
canTabTo(shape: Shape): boolean;
|
|
abstract component(shape: Shape): any;
|
|
static configure<T extends TLShapeUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
|
|
options: infer Options;
|
|
} ? Partial<Options> : never): T;
|
|
createShapeForAsset?(asset: TLAsset, position: VecModel): null | TLShapePartial;
|
|
// (undocumented)
|
|
editor: Editor;
|
|
// @internal (undocumented)
|
|
expandSelectionOutlinePx(shape: Shape): Box | number;
|
|
getAppOwnedElement?(shape: Shape): HTMLElement | null;
|
|
// (undocumented)
|
|
getAriaDescriptor(shape: Shape): string | undefined;
|
|
getBoundsSnapGeometry(shape: Shape): BoundsSnapGeometry;
|
|
getCanvasSvgDefs(): TLShapeUtilCanvasSvgDef[];
|
|
getClipPath?(shape: Shape): undefined | Vec[];
|
|
abstract getDefaultProps(): Shape['props'];
|
|
getFontFaces(shape: Shape): TLFontFace[];
|
|
abstract getGeometry(shape: Shape, opts?: TLGeometryOpts): Geometry2d;
|
|
getHandles?(shape: Shape): TLHandle[];
|
|
getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
|
|
abstract getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
|
|
getInterpolatedProps?(startShape: Shape, endShape: Shape, progress: number): Shape['props'];
|
|
getReferencedUserIds(shape: Shape): string[];
|
|
// (undocumented)
|
|
getText(shape: Shape): string | undefined;
|
|
static handledAssetTypes?: readonly string[];
|
|
hideInMinimap?(shape: Shape): boolean;
|
|
hideResizeHandles(shape: Shape): boolean;
|
|
hideRotateHandle(shape: Shape): boolean;
|
|
hideSelectionBoundsBg(shape: Shape): boolean;
|
|
hideSelectionBoundsFg(shape: Shape): boolean;
|
|
// @deprecated
|
|
indicator(_shape: Shape): any;
|
|
isAspectRatioLocked(shape: Shape): boolean;
|
|
isExportBoundsContainer(shape: Shape): boolean;
|
|
isFrameLike(_shape: Shape): boolean;
|
|
static migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
onBeforeCreate?(next: Shape): Shape | void;
|
|
onBeforeDuplicate?(source: Shape, duplicate: Shape): Shape | void;
|
|
onBeforeUpdate?(prev: Shape, next: Shape): Shape | void;
|
|
// @internal
|
|
onBindingChange?(shape: Shape): TLShapePartial<Shape> | void;
|
|
onChildrenChange?(shape: Shape): TLShapePartial[] | void;
|
|
onClick?(shape: Shape): TLShapePartial<Shape> | void;
|
|
onCrop?(shape: Shape, info: TLCropInfo<Shape>): Omit<TLShapePartial<Shape>, 'id' | 'type'> | undefined | void;
|
|
onDoubleClick?(shape: Shape): TLShapePartial<Shape> | void;
|
|
onDoubleClickCorner?(shape: Shape, info: TLClickEventInfo): TLShapePartial<Shape> | void;
|
|
onDoubleClickEdge?(shape: Shape, info: TLClickEventInfo): TLShapePartial<Shape> | void;
|
|
onDoubleClickHandle?(shape: Shape, handle: TLHandle): TLShapePartial<Shape> | void;
|
|
onDragShapesIn?(shape: Shape, shapes: TLShape[], info: TLDragShapesInInfo): void;
|
|
onDragShapesOut?(shape: Shape, shapes: TLShape[], info: TLDragShapesOutInfo): void;
|
|
onDragShapesOver?(shape: Shape, shapes: TLShape[], info: TLDragShapesOverInfo): void;
|
|
onDropShapesOver?(shape: Shape, shapes: TLShape[], info: TLDropShapesOverInfo): void;
|
|
onEditEnd?(shape: Shape): void;
|
|
onEditStart?(shape: Shape): void;
|
|
onHandleDrag?(shape: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
|
|
onHandleDragCancel?(current: Shape, info: TLHandleDragInfo<Shape>): void;
|
|
onHandleDragEnd?(current: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
|
|
onHandleDragStart?(shape: Shape, info: TLHandleDragInfo<Shape>): TLShapePartial<Shape> | void;
|
|
onReleaseAppOwnedElement?(shape: Shape, element: HTMLElement): void;
|
|
onResize?(shape: Shape, info: TLResizeInfo<Shape>): Omit<TLShapePartial<Shape>, 'id' | 'type'> | undefined | void;
|
|
onResizeCancel?(initial: Shape, current: Shape): void;
|
|
onResizeEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
|
|
onResizeStart?(shape: Shape): TLShapePartial<Shape> | void;
|
|
onRotate?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
|
|
onRotateCancel?(initial: Shape, current: Shape): void;
|
|
onRotateEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
|
|
onRotateStart?(shape: Shape): TLShapePartial<Shape> | void;
|
|
onTranslate?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
|
|
onTranslateCancel?(initial: Shape, current: Shape): void;
|
|
onTranslateEnd?(initial: Shape, current: Shape): TLShapePartial<Shape> | void;
|
|
onTranslateStart?(shape: Shape): TLShapePartial<Shape> | void;
|
|
options: {};
|
|
static props?: RecordProps<TLUnknownShape>;
|
|
// @internal
|
|
providesBackgroundForChildren(shape: Shape): boolean;
|
|
shouldClipChild?(child: TLShape): boolean;
|
|
toBackgroundSvg?(shape: Shape, ctx: SvgExportContext): null | Promise<null | ReactElement> | ReactElement;
|
|
toSvg?(shape: Shape, ctx: SvgExportContext): null | Promise<null | ReactElement> | ReactElement;
|
|
static type: string;
|
|
}
|
|
|
|
// @public
|
|
export type SharedStyle<T> = {
|
|
readonly type: 'mixed';
|
|
} | {
|
|
readonly type: 'shared';
|
|
readonly value: T;
|
|
};
|
|
|
|
// @internal (undocumented)
|
|
export class SharedStyleMap extends ReadonlySharedStyleMap {
|
|
// (undocumented)
|
|
applyValue<T>(prop: StyleProp<T>, value: T): void;
|
|
// (undocumented)
|
|
set<T>(prop: StyleProp<T>, value: SharedStyle<T>): void;
|
|
}
|
|
|
|
// @public
|
|
export function shortAngleDist(a0: number, a1: number): number;
|
|
|
|
// @public (undocumented)
|
|
export const SIDES: readonly ['top', 'right', 'bottom', 'left'];
|
|
|
|
// @public (undocumented)
|
|
export const SIN: (x: number) => number;
|
|
|
|
// @public
|
|
export function snapAngle(r: number, segments: number): number;
|
|
|
|
// @public (undocumented)
|
|
export interface SnapData {
|
|
// (undocumented)
|
|
nudge: Vec;
|
|
}
|
|
|
|
// @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<TLShapeId>;
|
|
// (undocumented)
|
|
getSnapThreshold(): number;
|
|
// (undocumented)
|
|
readonly handles: HandleSnaps;
|
|
// (undocumented)
|
|
setIndicators(indicators: SnapIndicator[]): void;
|
|
// (undocumented)
|
|
readonly shapeBounds: BoundsSnaps;
|
|
}
|
|
|
|
// @internal
|
|
export class SpatialIndexManager {
|
|
constructor(editor: Editor);
|
|
// @public
|
|
dispose(): void;
|
|
// (undocumented)
|
|
readonly editor: Editor;
|
|
// @public
|
|
getShapeIdsAtPoint(point: {
|
|
x: number;
|
|
y: number;
|
|
}, margin?: number): Set<TLShapeId>;
|
|
// @public
|
|
getShapeIdsInsideBounds(bounds: Box): Set<TLShapeId>;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class Stadium2d extends Geometry2d {
|
|
constructor(config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
height: number;
|
|
width: number;
|
|
});
|
|
// (undocumented)
|
|
config: Omit<Geometry2dOptions, 'isClosed'> & {
|
|
height: number;
|
|
width: number;
|
|
};
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, hitInside?: boolean): number;
|
|
// (undocumented)
|
|
getBounds(): Box;
|
|
// (undocumented)
|
|
getLength(): number;
|
|
// (undocumented)
|
|
getSvgPathData(): string;
|
|
// (undocumented)
|
|
getVertices(): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike): boolean;
|
|
// (undocumented)
|
|
nearestPoint(A: VecLike): Vec;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export abstract class StateNode implements Partial<TLEventHandlers> {
|
|
constructor(editor: Editor, parent?: StateNode);
|
|
addChild(childConstructor: TLStateNodeConstructor): this;
|
|
// (undocumented)
|
|
static children?: () => TLStateNodeConstructor[];
|
|
// (undocumented)
|
|
children?: Record<string, StateNode>;
|
|
_currentToolIdMask: Atom<string | undefined, unknown>;
|
|
// (undocumented)
|
|
editor: Editor;
|
|
// (undocumented)
|
|
enter(info: any, from: string): void;
|
|
// (undocumented)
|
|
exit(info: any, to: string): void;
|
|
getCurrent(): StateNode | undefined;
|
|
// (undocumented)
|
|
getCurrentToolIdMask(): string | undefined;
|
|
getIsActive(): boolean;
|
|
getPath(): string;
|
|
// (undocumented)
|
|
handleEvent(info: Exclude<TLEventInfo, TLPinchEventInfo>): void;
|
|
// (undocumented)
|
|
static id: string;
|
|
// (undocumented)
|
|
id: string;
|
|
// (undocumented)
|
|
static initial?: string;
|
|
// (undocumented)
|
|
initial?: string;
|
|
// (undocumented)
|
|
static isLockable: boolean;
|
|
// (undocumented)
|
|
isLockable: boolean;
|
|
// (undocumented)
|
|
onCancel?(info: TLCancelEventInfo): void;
|
|
// (undocumented)
|
|
onComplete?(info: TLCompleteEventInfo): void;
|
|
// (undocumented)
|
|
onDoubleClick?(info: TLClickEventInfo): void;
|
|
// (undocumented)
|
|
onEnter?(info: any, from: string): void;
|
|
// (undocumented)
|
|
onExit?(info: any, to: string): void;
|
|
// (undocumented)
|
|
onInterrupt?(info: TLInterruptEventInfo): void;
|
|
// (undocumented)
|
|
onKeyDown?(info: TLKeyboardEventInfo): void;
|
|
// (undocumented)
|
|
onKeyRepeat?(info: TLKeyboardEventInfo): void;
|
|
// (undocumented)
|
|
onKeyUp?(info: TLKeyboardEventInfo): void;
|
|
// (undocumented)
|
|
onLongPress?(info: TLPointerEventInfo): void;
|
|
// (undocumented)
|
|
onMiddleClick?(info: TLPointerEventInfo): void;
|
|
// (undocumented)
|
|
onPointerDown?(info: TLPointerEventInfo): void;
|
|
// (undocumented)
|
|
onPointerMove?(info: TLPointerEventInfo): void;
|
|
// (undocumented)
|
|
onPointerUp?(info: TLPointerEventInfo): void;
|
|
// (undocumented)
|
|
onRightClick?(info: TLPointerEventInfo): void;
|
|
// (undocumented)
|
|
onTick?(info: TLTickEventInfo): void;
|
|
// (undocumented)
|
|
onWheel?(info: TLWheelEventInfo): void;
|
|
// (undocumented)
|
|
parent: StateNode;
|
|
// (undocumented)
|
|
_path: Computed<string>;
|
|
// (undocumented)
|
|
performanceTracker: PerformanceTracker;
|
|
// (undocumented)
|
|
setCurrentToolIdMask(id: string | undefined): void;
|
|
// (undocumented)
|
|
shapeType?: string;
|
|
static trackPerformance: boolean;
|
|
transition(id: string, info?: any): this;
|
|
// (undocumented)
|
|
type: 'branch' | 'leaf' | 'root';
|
|
// (undocumented)
|
|
static useCoalescedEvents: boolean;
|
|
// (undocumented)
|
|
useCoalescedEvents: boolean;
|
|
}
|
|
|
|
// @public @deprecated
|
|
export function stopEventPropagation(e: any): any;
|
|
|
|
// @internal (undocumented)
|
|
export type StoreName = (typeof Table)[keyof typeof Table];
|
|
|
|
// @public
|
|
export function strokeShapeIndicators(editor: Editor, ctx: CanvasRenderingContext2D, shapeIds: TLShapeId[]): void;
|
|
|
|
// @public (undocumented)
|
|
export function suffixSafeId(id: SafeId, suffix: string): SafeId;
|
|
|
|
// @public (undocumented)
|
|
export function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX.Element;
|
|
|
|
// @public (undocumented)
|
|
export type SVGContainerProps = React_2.ComponentProps<'svg'>;
|
|
|
|
// @public (undocumented)
|
|
export interface SvgExportContext {
|
|
addExportDef(def: SvgExportDef): void;
|
|
readonly colorMode: 'dark' | 'light';
|
|
readonly isDarkMode: boolean;
|
|
readonly pixelRatio: null | number;
|
|
resolveAssetUrl(assetId: TLAssetId, width: number): Promise<null | string>;
|
|
readonly scale: number;
|
|
waitUntil(promise: Promise<void>): void;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface SvgExportDef {
|
|
// (undocumented)
|
|
getElement(): null | Promise<null | ReactElement> | ReactElement;
|
|
// (undocumented)
|
|
key: string;
|
|
}
|
|
|
|
// @public
|
|
export const TAB_ID: string;
|
|
|
|
// @internal (undocumented)
|
|
export const Table: {
|
|
readonly Assets: 'assets';
|
|
readonly Records: 'records';
|
|
readonly Schema: 'schema';
|
|
readonly SessionState: 'session_state';
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export class TextManager extends EditorManager {
|
|
constructor(editor: Editor);
|
|
measureElementTextNodeSpans(element: HTMLElement, { shouldTruncateToFirstLine }?: {
|
|
shouldTruncateToFirstLine?: boolean;
|
|
}): {
|
|
didTruncate: boolean;
|
|
spans: {
|
|
box: BoxModel;
|
|
text: string;
|
|
}[];
|
|
};
|
|
// (undocumented)
|
|
measureHtml(html: string, opts: TLMeasureTextOpts): TLMeasuredTextSize;
|
|
// (undocumented)
|
|
measureHtmlBatch(requests: BatchMeasurementRequest[]): TLMeasuredTextSize[];
|
|
// (undocumented)
|
|
measureText(textToMeasure: string, opts: TLMeasureTextOpts): TLMeasuredTextSize;
|
|
measureTextSpans(textToMeasure: string, opts: TLMeasureTextSpanOpts): {
|
|
box: BoxModel;
|
|
text: string;
|
|
}[];
|
|
}
|
|
|
|
// @public
|
|
export class ThemeManager {
|
|
constructor(editor: Editor, options: {
|
|
initial: TLThemeId;
|
|
themes: TLThemes;
|
|
});
|
|
dispose(): void;
|
|
getColorMode(): 'dark' | 'light';
|
|
// (undocumented)
|
|
getCurrentTheme(): TLTheme;
|
|
getCurrentThemeId(): TLThemeId;
|
|
getTheme(id: TLThemeId): TLTheme | undefined;
|
|
getThemes(): TLThemes;
|
|
setCurrentTheme(id: TLThemeId): void;
|
|
updateTheme(theme: TLTheme): void;
|
|
updateThemes(themes: ((themes: TLThemes) => TLThemes) | TLThemes): void;
|
|
}
|
|
|
|
// @internal (undocumented)
|
|
export class TickManager extends EditorManager {
|
|
constructor(editor: Editor);
|
|
// (undocumented)
|
|
cancelRaf?: (() => void) | null;
|
|
// (undocumented)
|
|
dispose(): void;
|
|
// (undocumented)
|
|
isPaused: boolean;
|
|
// (undocumented)
|
|
now: number;
|
|
// (undocumented)
|
|
start(): void;
|
|
// (undocumented)
|
|
tick(): void;
|
|
}
|
|
|
|
// @public
|
|
export type TiptapEditor = Editor_2;
|
|
|
|
// @public
|
|
export type TiptapNode = Node_2;
|
|
|
|
// @public (undocumented)
|
|
export type TLAdjacentDirection = 'down' | 'left' | 'next' | 'prev' | 'right' | 'up';
|
|
|
|
// @public (undocumented)
|
|
export type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any>;
|
|
|
|
// @public (undocumented)
|
|
export type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
|
|
// @public (undocumented)
|
|
export type TLAnyOverlayUtilConstructor = TLOverlayUtilConstructor<any>;
|
|
|
|
// @public (undocumented)
|
|
export type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
|
|
|
|
// @public (undocumented)
|
|
export interface TLAssetUtilConstructor<T extends TLAsset = TLAsset, U extends AssetUtil<T> = AssetUtil<T>> {
|
|
// (undocumented)
|
|
new (editor: Editor): U;
|
|
// (undocumented)
|
|
migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
// (undocumented)
|
|
props?: RecordProps<T>;
|
|
// (undocumented)
|
|
type: T['type'];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLBaseBoxShape = ExtractShapeByProps<{
|
|
h: number;
|
|
w: number;
|
|
}>;
|
|
|
|
// @public (undocumented)
|
|
export interface TLBaseEventInfo {
|
|
// (undocumented)
|
|
accelKey: boolean;
|
|
// (undocumented)
|
|
altKey: boolean;
|
|
// (undocumented)
|
|
ctrlKey: boolean;
|
|
// (undocumented)
|
|
metaKey: boolean;
|
|
// (undocumented)
|
|
shiftKey: boolean;
|
|
// (undocumented)
|
|
type: UiEventType;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLBaseExternalContent {
|
|
// (undocumented)
|
|
point?: VecLike;
|
|
sources?: TLExternalContentSource[];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLBindingUtilConstructor<T extends TLBinding, U extends BindingUtil<T> = BindingUtil<T>> {
|
|
// (undocumented)
|
|
new (editor: Editor): U;
|
|
migrations?: TLPropsMigrations;
|
|
props?: RecordProps<T>;
|
|
// (undocumented)
|
|
type: T['type'];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLCameraConstraints {
|
|
baseZoom: 'default' | 'fit-max-100' | 'fit-max' | 'fit-min-100' | 'fit-min' | 'fit-x-100' | 'fit-x' | 'fit-y-100' | 'fit-y';
|
|
behavior: 'contain' | 'fixed' | 'free' | 'inside' | 'outside' | {
|
|
x: 'contain' | 'fixed' | 'free' | 'inside' | 'outside';
|
|
y: 'contain' | 'fixed' | 'free' | 'inside' | 'outside';
|
|
};
|
|
bounds: BoxModel;
|
|
initialZoom: 'default' | 'fit-max-100' | 'fit-max' | 'fit-min-100' | 'fit-min' | 'fit-x-100' | 'fit-x' | 'fit-y-100' | 'fit-y';
|
|
origin: VecLike;
|
|
padding: VecLike;
|
|
}
|
|
|
|
// @public
|
|
export interface TLCameraEndPerfEvent extends TLPerfFrameTimeStats {
|
|
culledShapeCount: number;
|
|
shapeCount: number;
|
|
timestamp: number;
|
|
type: 'panning' | 'zooming';
|
|
viewportHeight: number;
|
|
viewportWidth: number;
|
|
visibleShapeCount: number;
|
|
zoomLevel: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLCameraMoveOptions {
|
|
animation?: {
|
|
easing?(t: number): number;
|
|
duration?: number;
|
|
};
|
|
force?: boolean;
|
|
immediate?: boolean;
|
|
reset?: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLCameraOptions {
|
|
constraints?: TLCameraConstraints;
|
|
isLocked: boolean;
|
|
panSpeed: number;
|
|
wheelBehavior: 'none' | 'pan' | 'zoom';
|
|
zoomSpeed: number;
|
|
zoomSteps: number[];
|
|
}
|
|
|
|
// @public
|
|
export interface TLCameraStartPerfEvent {
|
|
timestamp: number;
|
|
type: 'panning' | 'zooming';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLCancelEvent = (info: TLCancelEventInfo) => void;
|
|
|
|
// @public (undocumented)
|
|
export interface TLCancelEventInfo {
|
|
// (undocumented)
|
|
name: 'cancel';
|
|
// (undocumented)
|
|
type: 'misc';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLCanvasComponentProps {
|
|
// (undocumented)
|
|
className?: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLClickEvent = (info: TLClickEventInfo) => void;
|
|
|
|
// @public (undocumented)
|
|
export type TLClickEventInfo = TLBaseEventInfo & {
|
|
button: number;
|
|
name: TLCLickEventName;
|
|
phase: 'down' | 'settle-down' | 'settle-up' | 'up';
|
|
point: VecLike;
|
|
pointerId: number;
|
|
type: 'click';
|
|
} & TLPointerEventTarget;
|
|
|
|
// @public (undocumented)
|
|
export type TLCLickEventName = 'double_click';
|
|
|
|
// @public (undocumented)
|
|
export type TLClickState = 'idle' | 'overflow' | 'pendingDouble' | 'pendingOverflow';
|
|
|
|
// @public
|
|
export type TLClipboardPasteRawInfo = {
|
|
readonly clipboardData: DataTransfer | null;
|
|
readonly editor: Editor;
|
|
readonly event: ClipboardEvent;
|
|
readonly point: undefined | VecLike;
|
|
readonly source: 'native-event';
|
|
} | {
|
|
readonly clipboardItems: readonly ClipboardItem[];
|
|
readonly editor: Editor;
|
|
readonly point: undefined | VecLike;
|
|
readonly source: 'clipboard-read';
|
|
};
|
|
|
|
// @public
|
|
export interface TLClipboardWriteInfo {
|
|
// (undocumented)
|
|
readonly operation: 'copy' | 'cut';
|
|
// (undocumented)
|
|
readonly source: 'menu' | 'native';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLCompleteEvent = (info: TLCompleteEventInfo) => void;
|
|
|
|
// @public (undocumented)
|
|
export interface TLCompleteEventInfo {
|
|
// (undocumented)
|
|
name: 'complete';
|
|
// (undocumented)
|
|
type: 'misc';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLContent {
|
|
// (undocumented)
|
|
assets: TLAsset[];
|
|
// (undocumented)
|
|
bindings: TLBinding[] | undefined;
|
|
// (undocumented)
|
|
rootShapeIds: TLShapeId[];
|
|
// (undocumented)
|
|
schema: SerializedSchema;
|
|
// (undocumented)
|
|
shapes: TLShape[];
|
|
// (undocumented)
|
|
users?: TLUser[];
|
|
}
|
|
|
|
// @public
|
|
export interface TLCropInfo<T extends TLShape> {
|
|
// (undocumented)
|
|
aspectRatioLocked?: boolean;
|
|
// (undocumented)
|
|
change: Vec;
|
|
// (undocumented)
|
|
crop: TLShapeCrop;
|
|
// (undocumented)
|
|
handle: SelectionHandle;
|
|
// (undocumented)
|
|
initialShape: T;
|
|
// (undocumented)
|
|
isResizingFromCenter?: boolean;
|
|
// (undocumented)
|
|
uncroppedSize: {
|
|
h: number;
|
|
w: number;
|
|
};
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLCurrentUser {
|
|
// (undocumented)
|
|
readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
|
|
// (undocumented)
|
|
readonly userPreferences: Signal<TLUserPreferences>;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLCursorProps {
|
|
// (undocumented)
|
|
chatMessage: string;
|
|
// (undocumented)
|
|
className?: string;
|
|
// (undocumented)
|
|
color?: string;
|
|
// (undocumented)
|
|
name: null | string;
|
|
// (undocumented)
|
|
point: null | VecModel;
|
|
// (undocumented)
|
|
userId: string;
|
|
// (undocumented)
|
|
zoom: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLDeepLink = {
|
|
bounds: BoxModel;
|
|
pageId?: TLPageId;
|
|
type: 'viewport';
|
|
} | {
|
|
pageId: TLPageId;
|
|
type: 'page';
|
|
} | {
|
|
shapeIds: TLShapeId[];
|
|
type: 'shapes';
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export interface TLDeepLinkOptions {
|
|
debounceMs?: number;
|
|
getTarget?(editor: Editor): TLDeepLink;
|
|
getUrl?(editor: Editor): string | URL;
|
|
onChange?(url: URL, editor: Editor): void;
|
|
param?: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLDragShapesInInfo {
|
|
// (undocumented)
|
|
initialDraggingOverShapeId: null | TLShapeId;
|
|
// (undocumented)
|
|
initialIndices: Map<TLShapeId, IndexKey>;
|
|
// (undocumented)
|
|
initialParentIds: Map<TLShapeId, TLParentId>;
|
|
// (undocumented)
|
|
prevDraggingOverShapeId: null | TLShapeId;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLDragShapesOutInfo {
|
|
// (undocumented)
|
|
initialDraggingOverShapeId: null | TLShapeId;
|
|
// (undocumented)
|
|
initialIndices: Map<TLShapeId, IndexKey>;
|
|
// (undocumented)
|
|
initialParentIds: Map<TLShapeId, TLParentId>;
|
|
// (undocumented)
|
|
nextDraggingOverShapeId: null | TLShapeId;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLDragShapesOverInfo {
|
|
// (undocumented)
|
|
initialDraggingOverShapeId: null | TLShapeId;
|
|
// (undocumented)
|
|
initialIndices: Map<TLShapeId, IndexKey>;
|
|
// (undocumented)
|
|
initialParentIds: Map<TLShapeId, TLParentId>;
|
|
}
|
|
|
|
// @public
|
|
export const TldrawEditor: React_3.MemoExoticComponent<({ store, components, className, user: _user, options: _options, textOptions: _textOptions, deepLinks: _deepLinks, ...rest }: TldrawEditorProps) => JSX.Element>;
|
|
|
|
// @public
|
|
export interface TldrawEditorBaseProps {
|
|
assetUrls?: {
|
|
fonts?: {
|
|
[key: string]: string | undefined;
|
|
};
|
|
};
|
|
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
autoFocus?: boolean;
|
|
bindingUtils?: readonly TLAnyBindingUtilConstructor[];
|
|
// @deprecated
|
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
children?: ReactNode;
|
|
className?: string;
|
|
colorScheme?: 'dark' | 'light' | 'system';
|
|
components?: TLEditorComponents;
|
|
// @deprecated
|
|
deepLinks?: TLDeepLinkOptions | true;
|
|
getShapeVisibility?(shape: TLShape, editor: Editor): 'hidden' | 'inherit' | 'visible' | null | undefined;
|
|
initialState?: string;
|
|
initialTheme?: TLThemeId;
|
|
licenseKey?: string;
|
|
onMount?: TLOnMountHandler;
|
|
options?: Partial<TldrawOptions>;
|
|
overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
|
|
shapeUtils?: readonly TLAnyShapeUtilConstructor[];
|
|
// @deprecated
|
|
textOptions?: TLTextOptions;
|
|
themes?: Partial<TLThemes>;
|
|
tools?: readonly TLStateNodeConstructor[];
|
|
user?: TLCurrentUser;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TldrawEditorProps = TldrawEditorBaseProps & TldrawEditorStoreProps;
|
|
|
|
// @public (undocumented)
|
|
export type TldrawEditorStoreProps = TldrawEditorWithoutStoreProps | TldrawEditorWithStoreProps;
|
|
|
|
// @public
|
|
export interface TldrawEditorWithoutStoreProps extends TLStoreBaseOptions {
|
|
migrations?: readonly MigrationSequence[];
|
|
persistenceKey?: string;
|
|
// (undocumented)
|
|
sessionId?: string;
|
|
snapshot?: TLEditorSnapshot | TLStoreSnapshot;
|
|
// (undocumented)
|
|
store?: undefined;
|
|
}
|
|
|
|
// @public
|
|
export interface TldrawEditorWithStoreProps {
|
|
store: TLStore | TLStoreWithStatus;
|
|
}
|
|
|
|
// @public
|
|
export interface TldrawOptions {
|
|
// (undocumented)
|
|
readonly actionShortcutsLocation: 'menu' | 'swap' | 'toolbar';
|
|
// (undocumented)
|
|
readonly adjacentShapeMargin: number;
|
|
// (undocumented)
|
|
readonly animationMediumMs: number;
|
|
readonly branding?: string;
|
|
readonly camera: Partial<TLCameraOptions>;
|
|
// (undocumented)
|
|
readonly cameraMovingTimeoutMs: number;
|
|
// (undocumented)
|
|
readonly cameraSlideFriction: number;
|
|
// (undocumented)
|
|
readonly coarseDragDistanceSquared: number;
|
|
// (undocumented)
|
|
readonly coarseHandleRadius: number;
|
|
// (undocumented)
|
|
readonly coarseHitTestMargin: number;
|
|
// (undocumented)
|
|
readonly coarsePointerWidth: number;
|
|
// (undocumented)
|
|
readonly collaboratorCheckIntervalMs: number;
|
|
// (undocumented)
|
|
readonly collaboratorIdleTimeoutMs: number;
|
|
// (undocumented)
|
|
readonly collaboratorInactiveTimeoutMs: number;
|
|
// (undocumented)
|
|
readonly createTextOnCanvasDoubleClick: boolean;
|
|
readonly debouncedZoom: boolean;
|
|
readonly debouncedZoomThreshold: number;
|
|
readonly deepLinks: TLDeepLinkOptions | true | undefined;
|
|
// (undocumented)
|
|
readonly defaultSvgPadding: number;
|
|
// (undocumented)
|
|
readonly doubleClickDurationMs: number;
|
|
// (undocumented)
|
|
readonly dragDistanceSquared: number;
|
|
// (undocumented)
|
|
readonly edgeScrollDelay: number;
|
|
// (undocumented)
|
|
readonly edgeScrollDistance: number;
|
|
// (undocumented)
|
|
readonly edgeScrollEaseDuration: number;
|
|
// (undocumented)
|
|
readonly edgeScrollSpeed: number;
|
|
readonly enableToolbarKeyboardShortcuts: boolean;
|
|
experimental__onDropOnCanvas?(options: {
|
|
event: React.DragEvent<Element>;
|
|
point: VecLike;
|
|
}): boolean;
|
|
readonly exportProvider: ComponentType<{
|
|
children: React.ReactNode;
|
|
}>;
|
|
// (undocumented)
|
|
readonly flattenImageBoundsExpand: number;
|
|
// (undocumented)
|
|
readonly flattenImageBoundsPadding: number;
|
|
// (undocumented)
|
|
readonly followChaseViewportSnap: number;
|
|
// (undocumented)
|
|
readonly gridSteps: readonly {
|
|
readonly mid: number;
|
|
readonly min: number;
|
|
readonly step: number;
|
|
}[];
|
|
// (undocumented)
|
|
readonly handleRadius: number;
|
|
// (undocumented)
|
|
readonly hitTestMargin: number;
|
|
// (undocumented)
|
|
readonly laserDelayMs: number;
|
|
readonly laserFadeoutMs: number;
|
|
// (undocumented)
|
|
readonly longPressDurationMs: number;
|
|
// (undocumented)
|
|
readonly maxExportDelayMs: number;
|
|
// (undocumented)
|
|
readonly maxFilesAtOnce: number;
|
|
readonly maxFontsToLoadBeforeRender: number;
|
|
// (undocumented)
|
|
readonly maxPages: number;
|
|
// (undocumented)
|
|
readonly maxShapesPerPage: number;
|
|
// (undocumented)
|
|
readonly multiClickDurationMs: number;
|
|
readonly nonce: string | undefined;
|
|
onBeforeCopyToClipboard?(info: {
|
|
content: TLContent;
|
|
editor: Editor;
|
|
} & TLClipboardWriteInfo): Awaitable<false | TLContent | void>;
|
|
onBeforePasteFromClipboard?(info: {
|
|
content: TLExternalContent<unknown>;
|
|
editor: Editor;
|
|
point?: VecLike;
|
|
source: 'clipboard-read' | 'native-event';
|
|
}): Awaitable<false | TLExternalContent<unknown> | void>;
|
|
onClipboardPasteRaw?(info: TLClipboardPasteRawInfo): false | void;
|
|
readonly quickZoomPreservesScreenBounds: boolean;
|
|
readonly rightClickPanning: boolean;
|
|
readonly selectLockedShapes: boolean;
|
|
readonly snapThreshold: number;
|
|
readonly spacebarPanning: boolean;
|
|
readonly temporaryAssetPreviewLifetimeMs: number;
|
|
readonly text: TLTextOptions;
|
|
// (undocumented)
|
|
readonly textShadowLod: number;
|
|
// (undocumented)
|
|
readonly tooltipDelayMs: number;
|
|
// (undocumented)
|
|
readonly uiCoarseDragDistanceSquared: number;
|
|
// (undocumented)
|
|
readonly uiDragDistanceSquared: number;
|
|
readonly zoomToFitPadding: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLDropShapesOverInfo {
|
|
// (undocumented)
|
|
initialDraggingOverShapeId: null | TLShapeId;
|
|
// (undocumented)
|
|
initialIndices: Map<TLShapeId, IndexKey>;
|
|
// (undocumented)
|
|
initialParentIds: Map<TLShapeId, TLParentId>;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLEditorComponents {
|
|
// (undocumented)
|
|
Background?: ComponentType | null;
|
|
// (undocumented)
|
|
Canvas?: ComponentType<TLCanvasComponentProps> | null;
|
|
// (undocumented)
|
|
CollaboratorCursor?: ComponentType<TLCursorProps> | null;
|
|
// (undocumented)
|
|
ErrorFallback?: TLErrorFallbackComponent;
|
|
// (undocumented)
|
|
Grid?: ComponentType<TLGridProps> | null;
|
|
// (undocumented)
|
|
InFrontOfTheCanvas?: ComponentType | null;
|
|
// (undocumented)
|
|
LoadingScreen?: ComponentType | null;
|
|
// (undocumented)
|
|
OnTheCanvas?: ComponentType | null;
|
|
// (undocumented)
|
|
ShapeErrorFallback?: TLShapeErrorFallbackComponent;
|
|
// (undocumented)
|
|
ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
|
|
// (undocumented)
|
|
Spinner?: ComponentType<TLSpinnerProps> | null;
|
|
// (undocumented)
|
|
SvgDefs?: ComponentType | null;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLEditorOptions {
|
|
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
autoFocus?: boolean;
|
|
bindingUtils: readonly TLAnyBindingUtilConstructor[];
|
|
// @deprecated
|
|
cameraOptions?: Partial<TLCameraOptions>;
|
|
colorScheme?: 'dark' | 'light' | 'system';
|
|
// (undocumented)
|
|
fontAssetUrls?: {
|
|
[key: string]: string | undefined;
|
|
};
|
|
getContainer(): HTMLElement;
|
|
getShapeVisibility?(shape: TLShape, editor: Editor): 'hidden' | 'inherit' | 'visible' | null | undefined;
|
|
initialState?: string;
|
|
initialTheme?: TLThemeId;
|
|
// (undocumented)
|
|
licenseKey?: string;
|
|
options?: Partial<TldrawOptions>;
|
|
overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
|
|
shapeUtils: readonly TLAnyShapeUtilConstructor[];
|
|
store: TLStore;
|
|
// @deprecated
|
|
textOptions?: TLTextOptions;
|
|
themes?: Partial<TLThemes>;
|
|
tools: readonly TLStateNodeConstructor[];
|
|
user?: TLCurrentUser;
|
|
}
|
|
|
|
// @public
|
|
export interface TLEditorRunOptions extends TLHistoryBatchOptions {
|
|
// (undocumented)
|
|
ignoreShapeLock?: boolean;
|
|
}
|
|
|
|
// @public
|
|
export const tleditors: {
|
|
mounted: Signal<readonly Editor[]>;
|
|
getMounted(): readonly Editor[];
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export interface TLEditorSnapshot {
|
|
// (undocumented)
|
|
document: TLStoreSnapshot;
|
|
// (undocumented)
|
|
session: TLSessionStateSnapshot;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLEditStartInfo {
|
|
// (undocumented)
|
|
type: 'click-header' | 'click' | 'double-click-corner' | 'double-click-edge' | 'double-click' | 'press_enter' | 'unknown';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLEmbedExternalContent<EmbedDefinition> extends TLBaseExternalContent {
|
|
// (undocumented)
|
|
embed: EmbedDefinition;
|
|
// (undocumented)
|
|
type: 'embed';
|
|
// (undocumented)
|
|
url: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLEnterEventHandler = (info: any, from: string) => void;
|
|
|
|
// @public
|
|
export const tlenv: {
|
|
hasCanvasSupport: boolean;
|
|
isAndroid: boolean;
|
|
isChromeForIos: boolean;
|
|
isDarwin: boolean;
|
|
isFirefox: boolean;
|
|
isIos: boolean;
|
|
isSafari: boolean;
|
|
isTouchDevice: boolean;
|
|
isWebview: boolean;
|
|
};
|
|
|
|
// @public
|
|
export const tlenvReactive: Atom< {
|
|
isCoarsePointer: boolean;
|
|
supportsP3ColorSpace: boolean;
|
|
}, unknown>;
|
|
|
|
// @public (undocumented)
|
|
export interface TLErrorBoundaryProps {
|
|
// (undocumented)
|
|
children: React_2.ReactNode;
|
|
// (undocumented)
|
|
fallback: TLErrorFallbackComponent;
|
|
// (undocumented)
|
|
onError?: ((error: unknown) => void) | null;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLErrorExternalContentSource {
|
|
// (undocumented)
|
|
data: null | string;
|
|
// (undocumented)
|
|
reason: string;
|
|
// (undocumented)
|
|
type: 'error';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLErrorFallbackComponent = ComponentType<TLErrorFallbackProps>;
|
|
|
|
// @public (undocumented)
|
|
export interface TLErrorFallbackProps {
|
|
editor?: Editor;
|
|
error: unknown;
|
|
}
|
|
|
|
// @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)
|
|
onRightClick: TLPointerEvent;
|
|
// (undocumented)
|
|
onTick: TLTickEvent;
|
|
// (undocumented)
|
|
onWheel: TLWheelEvent;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLEventInfo = TLCancelEventInfo | TLClickEventInfo | TLCompleteEventInfo | TLInterruptEventInfo | TLKeyboardEventInfo | TLPinchEventInfo | TLPointerEventInfo | TLTickEventInfo | TLWheelEventInfo;
|
|
|
|
// @public (undocumented)
|
|
export interface TLEventMap {
|
|
// (undocumented)
|
|
'before-event': [TLEventInfo];
|
|
// (undocumented)
|
|
'created-shapes': [TLRecord[]];
|
|
// (undocumented)
|
|
'deleted-shapes': [TLShapeId[]];
|
|
// (undocumented)
|
|
'edited-shapes': [TLRecord[]];
|
|
// (undocumented)
|
|
'max-shapes': [{
|
|
count: number;
|
|
name: string;
|
|
pageId: TLPageId;
|
|
}];
|
|
// (undocumented)
|
|
'place-caret': [{
|
|
point: {
|
|
x: number;
|
|
y: number;
|
|
};
|
|
shapeId: TLShapeId;
|
|
}];
|
|
// (undocumented)
|
|
'select-all-text': [{
|
|
shapeId: TLShapeId;
|
|
}];
|
|
// (undocumented)
|
|
'stop-camera-animation': [];
|
|
// (undocumented)
|
|
'stop-following': [];
|
|
// (undocumented)
|
|
change: [HistoryEntry<TLRecord>];
|
|
// (undocumented)
|
|
crash: [{
|
|
error: unknown;
|
|
}];
|
|
// (undocumented)
|
|
dispose: [];
|
|
// (undocumented)
|
|
edit: [];
|
|
// (undocumented)
|
|
event: [TLEventInfo];
|
|
// (undocumented)
|
|
frame: [number];
|
|
// (undocumented)
|
|
mount: [];
|
|
// (undocumented)
|
|
resize: [BoxModel];
|
|
// (undocumented)
|
|
tick: [number];
|
|
// (undocumented)
|
|
unmount: [];
|
|
// (undocumented)
|
|
update: [];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLEventMapHandler<T extends keyof TLEventMap> = (...args: TLEventMap[T]) => void;
|
|
|
|
// @public (undocumented)
|
|
export type TLEventName = 'cancel' | 'complete' | 'interrupt' | 'tick' | 'wheel' | TLCLickEventName | TLKeyboardEventName | TLPinchEventName | TLPointerEventName;
|
|
|
|
// @public (undocumented)
|
|
export interface TLExcalidrawExternalContent extends TLBaseExternalContent {
|
|
// (undocumented)
|
|
content: any;
|
|
// (undocumented)
|
|
type: 'excalidraw';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLExcalidrawExternalContentSource {
|
|
// (undocumented)
|
|
data: any;
|
|
// (undocumented)
|
|
type: 'excalidraw';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLExitEventHandler = (info: any, to: string) => void;
|
|
|
|
// @public (undocumented)
|
|
export type TLExportType = 'jpeg' | 'png' | 'svg' | 'webp';
|
|
|
|
// @public (undocumented)
|
|
export type TLExternalAsset = TLFileExternalAsset | TLUrlExternalAsset;
|
|
|
|
// @public (undocumented)
|
|
export type TLExternalContent<EmbedDefinition> = TLEmbedExternalContent<EmbedDefinition> | TLExcalidrawExternalContent | TLFileReplaceExternalContent | TLFilesExternalContent | TLSvgTextExternalContent | TLTextExternalContent | TLTldrawExternalContent | TLUrlExternalContent;
|
|
|
|
// @public (undocumented)
|
|
export type TLExternalContentSource = TLErrorExternalContentSource | TLExcalidrawExternalContentSource | TLTextExternalContentSource | TLTldrawExternalContentSource;
|
|
|
|
// @public (undocumented)
|
|
export interface TLFileExternalAsset {
|
|
// (undocumented)
|
|
assetId?: TLAssetId;
|
|
// (undocumented)
|
|
file: File;
|
|
// (undocumented)
|
|
type: 'file';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLFileReplaceExternalContent extends TLBaseExternalContent {
|
|
// (undocumented)
|
|
file: File;
|
|
// @deprecated (undocumented)
|
|
isImage: boolean;
|
|
// (undocumented)
|
|
shapeId: TLShapeId;
|
|
// (undocumented)
|
|
type: 'file-replace';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLFilesExternalContent extends TLBaseExternalContent {
|
|
// (undocumented)
|
|
files: File[];
|
|
// (undocumented)
|
|
ignoreParent?: boolean;
|
|
// (undocumented)
|
|
type: 'files';
|
|
}
|
|
|
|
// @public
|
|
export interface TLFramePerfEvent {
|
|
culledShapeCount: number;
|
|
elapsed: number;
|
|
shapeCount: number;
|
|
visibleShapeCount: number;
|
|
}
|
|
|
|
// @public
|
|
export interface TLGeometryOpts {
|
|
context?: string;
|
|
}
|
|
|
|
// @public
|
|
export interface TLGetShapeAtPointOptions {
|
|
filter?(shape: TLShape): boolean;
|
|
hitFrameInside?: boolean;
|
|
hitInside?: boolean;
|
|
hitLabels?: boolean;
|
|
hitLocked?: boolean;
|
|
margin?: [number, number] | number;
|
|
renderingOnly?: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLGridProps {
|
|
// (undocumented)
|
|
size: number;
|
|
// (undocumented)
|
|
x: number;
|
|
// (undocumented)
|
|
y: number;
|
|
// (undocumented)
|
|
z: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLHandleDragInfo<T extends TLShape> {
|
|
// (undocumented)
|
|
handle: TLHandle;
|
|
// (undocumented)
|
|
initial?: T | undefined;
|
|
// (undocumented)
|
|
isCreatingShape: boolean;
|
|
// (undocumented)
|
|
isPrecise: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLHistoryBatchOptions {
|
|
history?: 'ignore' | 'record-preserveRedoStack' | 'record';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLHistoryDiff<R extends UnknownRecord> {
|
|
// (undocumented)
|
|
diff: RecordsDiff<R>;
|
|
// (undocumented)
|
|
type: 'diff';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLHistoryEntry<R extends UnknownRecord> = TLHistoryDiff<R> | TLHistoryMark;
|
|
|
|
// @public (undocumented)
|
|
export interface TLHistoryMark {
|
|
// (undocumented)
|
|
id: string;
|
|
// (undocumented)
|
|
type: 'stop';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLImageExportOptions extends TLSvgExportOptions {
|
|
format?: TLExportType;
|
|
quality?: number;
|
|
}
|
|
|
|
// @public
|
|
export type TLIndicatorPath = {
|
|
additionalPaths?: Path2D[];
|
|
clipPath?: Path2D;
|
|
path: Path2D;
|
|
} | Path2D;
|
|
|
|
// @public
|
|
export interface TLInteractionEndPerfEvent extends TLPerfFrameTimeStats {
|
|
name: string;
|
|
path: string;
|
|
selectedShapeTypes: Record<string, number>;
|
|
shapeCount: number;
|
|
timestamp: number;
|
|
zoomLevel: number;
|
|
}
|
|
|
|
// @public
|
|
export interface TLInteractionStartPerfEvent {
|
|
name: string;
|
|
path: string;
|
|
timestamp: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
|
|
|
|
// @public (undocumented)
|
|
export interface TLInterruptEventInfo {
|
|
// (undocumented)
|
|
name: 'interrupt';
|
|
// (undocumented)
|
|
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
|
|
export interface TLLoadSessionStateSnapshotOptions {
|
|
forceOverwrite?: boolean;
|
|
}
|
|
|
|
// @public
|
|
export interface TLLoadSnapshotOptions {
|
|
forceOverwriteSessionState?: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLMeasuredTextSize = BoxModel & {
|
|
scrollWidth: number;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export interface TLMeasureTextOpts {
|
|
// (undocumented)
|
|
disableOverflowWrapBreaking?: boolean;
|
|
// (undocumented)
|
|
fontFamily: string;
|
|
// (undocumented)
|
|
fontSize: number;
|
|
// (undocumented)
|
|
fontStyle: string;
|
|
// (undocumented)
|
|
fontWeight: string;
|
|
lineHeight: number;
|
|
maxWidth: null | number;
|
|
// (undocumented)
|
|
measureScrollWidth?: boolean;
|
|
// (undocumented)
|
|
minWidth?: null | number;
|
|
// (undocumented)
|
|
otherStyles?: Record<string, string>;
|
|
// (undocumented)
|
|
padding: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLMeasureTextSpanOpts {
|
|
// (undocumented)
|
|
fontFamily: string;
|
|
// (undocumented)
|
|
fontSize: number;
|
|
// (undocumented)
|
|
fontStyle: string;
|
|
// (undocumented)
|
|
fontWeight: string;
|
|
// (undocumented)
|
|
height: number;
|
|
// (undocumented)
|
|
lineHeight: number;
|
|
// (undocumented)
|
|
measureScrollWidth?: boolean;
|
|
// (undocumented)
|
|
otherStyles?: Record<string, string>;
|
|
// (undocumented)
|
|
overflow: 'truncate-clip' | 'truncate-ellipsis' | 'wrap';
|
|
// (undocumented)
|
|
padding: number;
|
|
// (undocumented)
|
|
textAlign: TLDefaultHorizontalAlignStyle;
|
|
// (undocumented)
|
|
width: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const tlmenus: {
|
|
_hiddenMenus: string[];
|
|
menus: Atom<string[], unknown>;
|
|
addOpenMenu(id: string, contextId?: string): void;
|
|
clearOpenMenus(contextId?: string): void;
|
|
deleteOpenMenu(id: string, contextId?: string): void;
|
|
getOpenMenus(contextId?: string): string[];
|
|
isMenuOpen(id: string, contextId?: string): boolean;
|
|
hasOpenMenus(contextId: string): boolean;
|
|
hasAnyOpenMenus(): boolean;
|
|
hideOpenMenus(contextId?: string): void;
|
|
showOpenMenus(contextId?: string): void;
|
|
forContext(contextId: string): {
|
|
addOpenMenu: (id: string) => void;
|
|
clearOpenMenus: () => void;
|
|
deleteOpenMenu: (id: string) => void;
|
|
getOpenMenus: () => string[];
|
|
hasAnyOpenMenus: () => boolean;
|
|
hasOpenMenus: () => boolean;
|
|
isMenuOpen: (id: string) => boolean;
|
|
};
|
|
};
|
|
|
|
// @public
|
|
export type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
|
|
|
|
// @public (undocumented)
|
|
export interface TLOverlay<Props = Record<string, unknown>> {
|
|
id: string;
|
|
props: Props;
|
|
type: string;
|
|
}
|
|
|
|
// @public
|
|
export interface TLOverlayEntry {
|
|
// (undocumented)
|
|
overlays: TLOverlay[];
|
|
// (undocumented)
|
|
util: OverlayUtil;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLOverlayUtilConstructor<U extends OverlayUtil = OverlayUtil> {
|
|
// (undocumented)
|
|
new (editor: Editor): U;
|
|
// (undocumented)
|
|
configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
|
|
options: infer Options;
|
|
} ? Partial<Options> : never): T;
|
|
// (undocumented)
|
|
type: string;
|
|
}
|
|
|
|
// @public
|
|
export interface TLPerfEventMap {
|
|
'camera-end': [TLCameraEndPerfEvent];
|
|
'camera-start': [TLCameraStartPerfEvent];
|
|
'interaction-end': [TLInteractionEndPerfEvent];
|
|
'interaction-start': [TLInteractionStartPerfEvent];
|
|
'shapes-created': [TLShapeOperationPerfEvent];
|
|
'shapes-deleted': [TLShapeOperationPerfEvent];
|
|
'shapes-updated': [TLShapeOperationPerfEvent];
|
|
frame: [TLFramePerfEvent];
|
|
redo: [TLUndoRedoPerfEvent];
|
|
undo: [TLUndoRedoPerfEvent];
|
|
}
|
|
|
|
// @public
|
|
export interface TLPerfFrameTimeStats {
|
|
avgFrameTime: number;
|
|
duration: number;
|
|
fps: number;
|
|
frameCount: number;
|
|
frameTimes: number[];
|
|
longAnimationFrames?: TLPerfLongAnimationFrame[];
|
|
maxFrameTime: number;
|
|
medianFrameTime: number;
|
|
minFrameTime: number;
|
|
p95FrameTime: number;
|
|
p99FrameTime: number;
|
|
}
|
|
|
|
// @public
|
|
export interface TLPerfLongAnimationFrame {
|
|
blockingDuration: number;
|
|
duration: number;
|
|
scripts: TLPerfLongAnimationFrameScript[];
|
|
startTime: number;
|
|
}
|
|
|
|
// @public
|
|
export interface TLPerfLongAnimationFrameScript {
|
|
duration: number;
|
|
invoker: string;
|
|
sourceURL: string;
|
|
}
|
|
|
|
// @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 & {
|
|
isPenDirect?: boolean;
|
|
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';
|
|
} | {
|
|
overlay: TLOverlay;
|
|
shape?: undefined;
|
|
target: 'overlay';
|
|
} | {
|
|
shape: TLShape;
|
|
target: 'shape';
|
|
} | {
|
|
shape?: undefined;
|
|
target: 'canvas';
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export interface TLRenderingShape {
|
|
// (undocumented)
|
|
backgroundIndex: number;
|
|
// (undocumented)
|
|
id: TLShapeId;
|
|
// (undocumented)
|
|
index: number;
|
|
// (undocumented)
|
|
opacity: number;
|
|
// (undocumented)
|
|
shape: TLShape;
|
|
// (undocumented)
|
|
util: ShapeUtil;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLResizeHandle = SelectionCorner | SelectionEdge;
|
|
|
|
// @public
|
|
export interface TLResizeInfo<T extends TLShape> {
|
|
// (undocumented)
|
|
handle: TLResizeHandle;
|
|
// (undocumented)
|
|
initialBounds: Box;
|
|
// (undocumented)
|
|
initialShape: T;
|
|
// (undocumented)
|
|
mode: TLResizeMode;
|
|
// (undocumented)
|
|
newPoint: Vec;
|
|
// (undocumented)
|
|
scaleX: number;
|
|
// (undocumented)
|
|
scaleY: number;
|
|
}
|
|
|
|
// @public
|
|
export type TLResizeMode = 'resize_bounds' | 'scale_shape';
|
|
|
|
// @public (undocumented)
|
|
export type TLResizeShapeOptions = Partial<{
|
|
dragHandle: TLResizeHandle;
|
|
initialBounds: Box;
|
|
initialPageTransform: MatLike;
|
|
initialShape: TLShape;
|
|
isAspectRatioLocked: boolean;
|
|
mode: TLResizeMode;
|
|
scaleAxisRotation: number;
|
|
scaleOrigin: VecLike;
|
|
skipStartAndEndCallbacks: boolean;
|
|
}>;
|
|
|
|
// @internal (undocumented)
|
|
export interface TLRotationSnapshot {
|
|
// (undocumented)
|
|
initialCursorAngle: number;
|
|
// (undocumented)
|
|
initialPageCenter: Vec;
|
|
// (undocumented)
|
|
initialShapesRotation: number;
|
|
// (undocumented)
|
|
shapeSnapshots: {
|
|
initialPagePoint: Vec;
|
|
shape: TLShape;
|
|
}[];
|
|
}
|
|
|
|
// @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 TLShapeErrorFallbackComponent = ComponentType<{
|
|
error: any;
|
|
}>;
|
|
|
|
// @public
|
|
export interface TLShapeOperationPerfEvent {
|
|
count: number;
|
|
operation: 'create' | 'delete' | 'update';
|
|
shapeTypes: Record<string, number>;
|
|
timestamp: number;
|
|
}
|
|
|
|
// @public
|
|
export interface TLShapeUtilCanBeLaidOutOpts {
|
|
shapes?: TLShape[];
|
|
type?: 'align' | 'distribute' | 'flip' | 'pack' | 'resize_to_bounds' | 'stack' | 'stretch';
|
|
}
|
|
|
|
// @public
|
|
export interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
|
|
bindingType: string;
|
|
fromShape: {
|
|
type: TLShape['type'];
|
|
} | TLShape;
|
|
// @deprecated
|
|
fromShapeType: TLShape['type'];
|
|
toShape: {
|
|
type: TLShape['type'];
|
|
} | TLShape;
|
|
// @deprecated
|
|
toShapeType: TLShape['type'];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLShapeUtilCanvasSvgDef {
|
|
// (undocumented)
|
|
component: React.ComponentType;
|
|
// (undocumented)
|
|
key: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLShapeUtilConstructor<T extends TLShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
|
|
// (undocumented)
|
|
new (editor: Editor): U;
|
|
// (undocumented)
|
|
handledAssetTypes?: readonly string[];
|
|
// (undocumented)
|
|
migrations?: LegacyMigrations | MigrationSequence | TLPropsMigrations;
|
|
// (undocumented)
|
|
props?: RecordProps<T>;
|
|
// (undocumented)
|
|
type: T['type'];
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
children: ReactNode;
|
|
isBackground: boolean;
|
|
shape: TLShape;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLSpinnerProps = React.SVGProps<SVGSVGElement>;
|
|
|
|
// @public (undocumented)
|
|
export interface TLStateNodeConstructor {
|
|
// (undocumented)
|
|
new (editor: Editor, parent?: StateNode): StateNode;
|
|
// (undocumented)
|
|
children?(): TLStateNodeConstructor[];
|
|
// (undocumented)
|
|
id: string;
|
|
// (undocumented)
|
|
initial?: string;
|
|
// (undocumented)
|
|
isLockable: boolean;
|
|
// (undocumented)
|
|
trackPerformance: boolean;
|
|
// (undocumented)
|
|
useCoalescedEvents: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLStoreBaseOptions {
|
|
assets?: TLAssetStore;
|
|
defaultName?: string;
|
|
initialData?: SerializedStore<TLRecord>;
|
|
onMount?(editor: Editor): (() => void) | void;
|
|
snapshot?: Partial<TLEditorSnapshot> | TLStoreSnapshot;
|
|
themes?: Partial<TLThemes>;
|
|
users?: TLUserStore;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLStoreEventInfo = HistoryEntry<TLRecord>;
|
|
|
|
// @public (undocumented)
|
|
export type TLStoreOptions = TLStoreBaseOptions & {
|
|
collaboration?: {
|
|
mode?: null | Signal<'readonly' | 'readwrite'>;
|
|
status: null | Signal<'offline' | 'online'>;
|
|
};
|
|
id?: string;
|
|
} & TLStoreSchemaOptions;
|
|
|
|
// @public (undocumented)
|
|
export type TLStoreSchemaOptions = {
|
|
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
bindingUtils?: readonly TLAnyBindingUtilConstructor[];
|
|
migrations?: readonly MigrationSequence[];
|
|
records?: Record<string, CustomRecordInfo>;
|
|
shapeUtils?: readonly TLAnyShapeUtilConstructor[];
|
|
} | {
|
|
schema?: StoreSchema<TLRecord, TLStoreProps>;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export type TLStoreWithStatus = {
|
|
readonly connectionStatus: 'offline' | 'online';
|
|
readonly error?: undefined;
|
|
readonly status: 'synced-remote';
|
|
readonly store: TLStore;
|
|
} | {
|
|
readonly error: Error;
|
|
readonly status: 'error';
|
|
readonly store?: undefined;
|
|
} | {
|
|
readonly error?: undefined;
|
|
readonly status: 'loading';
|
|
readonly store?: undefined;
|
|
} | {
|
|
readonly error?: undefined;
|
|
readonly status: 'not-synced';
|
|
readonly store: TLStore;
|
|
} | {
|
|
readonly error?: undefined;
|
|
readonly status: 'synced-local';
|
|
readonly store: TLStore;
|
|
};
|
|
|
|
// @public (undocumented)
|
|
export interface TLSvgExportOptions {
|
|
background?: boolean;
|
|
bounds?: Box;
|
|
darkMode?: boolean;
|
|
padding?: 'auto' | number;
|
|
pixelRatio?: number;
|
|
preserveAspectRatio?: React.SVGAttributes<SVGSVGElement>['preserveAspectRatio'];
|
|
scale?: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLSvgTextExternalContent extends TLBaseExternalContent {
|
|
// (undocumented)
|
|
text: string;
|
|
// (undocumented)
|
|
type: 'svg-text';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLTextExternalContent extends TLBaseExternalContent {
|
|
// (undocumented)
|
|
html?: string;
|
|
// (undocumented)
|
|
text: string;
|
|
// (undocumented)
|
|
type: 'text';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLTextExternalContentSource {
|
|
// (undocumented)
|
|
data: string;
|
|
// (undocumented)
|
|
subtype: 'html' | 'json' | 'text' | 'url';
|
|
// (undocumented)
|
|
type: 'text';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLTextOptions {
|
|
// (undocumented)
|
|
addFontsFromNode?: RichTextFontVisitor;
|
|
// (undocumented)
|
|
tipTapConfig?: EditorProviderProps_2;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLTickEvent = (info: TLTickEventInfo) => void;
|
|
|
|
// @public (undocumented)
|
|
export interface TLTickEventInfo {
|
|
// (undocumented)
|
|
elapsed: number;
|
|
// (undocumented)
|
|
name: 'tick';
|
|
// (undocumented)
|
|
type: 'misc';
|
|
}
|
|
|
|
// @public
|
|
export const tltime: Timers;
|
|
|
|
// @public (undocumented)
|
|
export interface TLTldrawExternalContent extends TLBaseExternalContent {
|
|
// (undocumented)
|
|
content: TLContent;
|
|
// (undocumented)
|
|
type: 'tldraw';
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLTldrawExternalContentSource {
|
|
// (undocumented)
|
|
data: TLContent;
|
|
// (undocumented)
|
|
type: 'tldraw';
|
|
}
|
|
|
|
// @public
|
|
export interface TLUndoRedoPerfEvent {
|
|
redoDepth: number;
|
|
type: 'redo' | 'undo';
|
|
undoDepth: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLUpdatePointerOptions {
|
|
// (undocumented)
|
|
accelKey?: boolean;
|
|
// (undocumented)
|
|
altKey?: boolean;
|
|
// (undocumented)
|
|
button?: number;
|
|
// (undocumented)
|
|
ctrlKey?: boolean;
|
|
immediate?: boolean;
|
|
// (undocumented)
|
|
isPen?: boolean;
|
|
// (undocumented)
|
|
metaKey?: boolean;
|
|
point?: VecLike;
|
|
// (undocumented)
|
|
pointerId?: number;
|
|
// (undocumented)
|
|
shiftKey?: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLUrlExternalAsset {
|
|
// (undocumented)
|
|
type: 'url';
|
|
// (undocumented)
|
|
url: string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TLUrlExternalContent extends TLBaseExternalContent {
|
|
shapeId?: TLShapeId;
|
|
// (undocumented)
|
|
type: 'url';
|
|
// (undocumented)
|
|
url: string;
|
|
}
|
|
|
|
// @public
|
|
export interface TLUserPreferences {
|
|
// (undocumented)
|
|
animationSpeed?: null | number;
|
|
// (undocumented)
|
|
areKeyboardShortcutsEnabled?: boolean | null;
|
|
// (undocumented)
|
|
color?: null | string;
|
|
// (undocumented)
|
|
colorScheme?: 'dark' | 'light' | 'system';
|
|
// (undocumented)
|
|
edgeScrollSpeed?: null | number;
|
|
// (undocumented)
|
|
enhancedA11yMode?: boolean | null;
|
|
// (undocumented)
|
|
id: string;
|
|
// (undocumented)
|
|
inputMode?: 'mouse' | 'trackpad' | null;
|
|
// (undocumented)
|
|
isDynamicSizeMode?: boolean | null;
|
|
// (undocumented)
|
|
isPasteAtCursorMode?: boolean | null;
|
|
// (undocumented)
|
|
isSnapMode?: boolean | null;
|
|
// (undocumented)
|
|
isWrapMode?: boolean | null;
|
|
// (undocumented)
|
|
isZoomDirectionInverted?: boolean | null;
|
|
// (undocumented)
|
|
locale?: null | string;
|
|
// (undocumented)
|
|
name?: null | string;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type TLWheelEvent = (info: TLWheelEventInfo) => void;
|
|
|
|
// @public (undocumented)
|
|
export type TLWheelEventInfo = TLBaseEventInfo & {
|
|
delta: VecModel;
|
|
name: 'wheel';
|
|
point: VecModel;
|
|
type: 'wheel';
|
|
};
|
|
|
|
// @public
|
|
export function toDomPrecision(v: number): number;
|
|
|
|
// @public (undocumented)
|
|
export function toFixed(v: number): number;
|
|
|
|
// @public
|
|
export function toPrecision(n: number, precision?: number): number;
|
|
|
|
// @public (undocumented)
|
|
export class TransformedGeometry2d extends Geometry2d {
|
|
constructor(geometry: Geometry2d, matrix: MatModel, opts?: TransformedGeometry2dOptions);
|
|
// (undocumented)
|
|
distanceToLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): number;
|
|
// (undocumented)
|
|
distanceToPoint(point: VecLike, hitInside?: boolean, filters?: Geometry2dFilters): number;
|
|
// (undocumented)
|
|
getBoundsVertices(): Vec[];
|
|
// (undocumented)
|
|
getSvgPathData(): string;
|
|
// (undocumented)
|
|
getVertices(filters: Geometry2dFilters): Vec[];
|
|
// (undocumented)
|
|
hitTestLineSegment(A: VecLike, B: VecLike, distance?: number, filters?: Geometry2dFilters): boolean;
|
|
// (undocumented)
|
|
hitTestPoint(point: VecLike, margin?: number, hitInside?: boolean, filters?: Geometry2dFilters): boolean;
|
|
// (undocumented)
|
|
ignoreHit(point: VecLike): boolean;
|
|
// (undocumented)
|
|
intersectCircle(center: VecLike, radius: number, filters?: Geometry2dFilters): Vec[];
|
|
// (undocumented)
|
|
intersectLineSegment(A: VecLike, B: VecLike, filters?: Geometry2dFilters): Vec[];
|
|
// (undocumented)
|
|
intersectPolygon(polygon: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
// (undocumented)
|
|
nearestPoint(point: VecLike, filters?: Geometry2dFilters): Vec;
|
|
// (undocumented)
|
|
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export interface TransformedGeometry2dOptions {
|
|
// (undocumented)
|
|
debugColor?: string;
|
|
// (undocumented)
|
|
excludeFromShapeBounds?: boolean;
|
|
// (undocumented)
|
|
ignore?: boolean;
|
|
// (undocumented)
|
|
isEmptyLabel?: boolean;
|
|
// (undocumented)
|
|
isInternal?: boolean;
|
|
// (undocumented)
|
|
isLabel?: boolean;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type UiEvent = TLCancelEvent | TLClickEvent | TLCompleteEvent | TLKeyboardEvent | TLPinchEvent | TLPointerEvent;
|
|
|
|
// @public (undocumented)
|
|
export type UiEventType = 'click' | 'keyboard' | 'pinch' | 'pointer' | 'wheel' | 'zoom';
|
|
|
|
// @public (undocumented)
|
|
export function uniq<T>(array: {
|
|
readonly [n: number]: T;
|
|
readonly length: number;
|
|
} | null | undefined): T[];
|
|
|
|
// @public (undocumented)
|
|
export function useColorMode(): 'dark' | 'light';
|
|
|
|
// @public (undocumented)
|
|
export function useContainer(): HTMLElement;
|
|
|
|
// @public (undocumented)
|
|
export function useContainerIfExists(): HTMLElement | null;
|
|
|
|
// @public
|
|
export function useDelaySvgExport(): () => void;
|
|
|
|
// @public (undocumented)
|
|
export function useEditor(): Editor;
|
|
|
|
// @public (undocumented)
|
|
export function useEditorComponents(): Required<TLEditorComponents>;
|
|
|
|
// @public
|
|
export function useEditorPortalHost(): HTMLElement | null;
|
|
|
|
// @internal
|
|
export function useEvent<Args extends Array<unknown>, Result>(handler: (...args: Args) => Result): (...args: Args) => Result;
|
|
|
|
// @public (undocumented)
|
|
export function useGlobalMenuIsOpen(id: string, onChange?: (isOpen: boolean) => void, onEvent?: (id: string) => void): readonly [boolean, (isOpen: boolean) => void];
|
|
|
|
// @public (undocumented)
|
|
export function useIsCropping(shapeId: TLShapeId): boolean;
|
|
|
|
// @public (undocumented)
|
|
export function useIsEditing(shapeId: TLShapeId): boolean;
|
|
|
|
// @internal (undocumented)
|
|
export function useLicenseContext(): LicenseManager;
|
|
|
|
// @internal
|
|
export function useLicenseFeatureFlag(licenseManager: LicenseManager | null, feature: LicenseFeatureName): boolean;
|
|
|
|
// @internal (undocumented)
|
|
export function useLocalStore(options: {
|
|
persistenceKey?: string;
|
|
sessionId?: string;
|
|
snapshot?: TLEditorSnapshot | TLStoreSnapshot;
|
|
} & TLStoreOptions): TLStoreWithStatus;
|
|
|
|
// @public (undocumented)
|
|
export function useMaybeEditor(): Editor | null;
|
|
|
|
// @internal
|
|
export function useMaybeLicenseManager(): LicenseManager | null;
|
|
|
|
// @internal (undocumented)
|
|
export function useOnMount(onMount?: TLOnMountHandler): void;
|
|
|
|
// @public (undocumented)
|
|
export function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
|
|
|
|
// @public
|
|
export function usePeerIds(): TLUserId[];
|
|
|
|
// @public (undocumented)
|
|
export function usePresence(userId: TLUserId): null | TLInstancePresence;
|
|
|
|
// @internal (undocumented)
|
|
export const USER_COLORS: readonly ['#FF802B', '#EC5E41', '#F2555A', '#F04F88', '#E34BA9', '#BD54C6', '#9D5BD2', '#7B66DC', '#02B1CC', '#11B3A3', '#39B178', '#55B467'];
|
|
|
|
// @internal
|
|
export function useReactiveEvent<Args extends Array<unknown>, Result>(handler: (...args: Args) => Result): (...args: Args) => Result;
|
|
|
|
// @internal
|
|
export function useRefState<T>(initialValue: T): [T, Dispatch<SetStateAction<T>>];
|
|
|
|
// @public (undocumented)
|
|
export class UserPreferencesManager {
|
|
constructor(user: TLCurrentUser, colorScheme: 'dark' | 'light' | 'system');
|
|
// (undocumented)
|
|
disposables: Set<() => void>;
|
|
// (undocumented)
|
|
dispose(): void;
|
|
// (undocumented)
|
|
getAnimationSpeed(): number;
|
|
// (undocumented)
|
|
getAreKeyboardShortcutsEnabled(): boolean;
|
|
// (undocumented)
|
|
getColor(): string;
|
|
getEdgeScrollSpeed(): number;
|
|
// (undocumented)
|
|
getEnhancedA11yMode(): boolean;
|
|
getExternalId(): string;
|
|
// @deprecated (undocumented)
|
|
getId(): string;
|
|
// (undocumented)
|
|
getInputMode(): "mouse" | "trackpad" | null;
|
|
// (undocumented)
|
|
getIsDarkMode(): boolean;
|
|
// (undocumented)
|
|
getIsDynamicResizeMode(): boolean;
|
|
// (undocumented)
|
|
getIsPasteAtCursorMode(): boolean;
|
|
// (undocumented)
|
|
getIsSnapMode(): boolean;
|
|
// (undocumented)
|
|
getIsWrapMode(): boolean;
|
|
// (undocumented)
|
|
getIsZoomDirectionInverted(): boolean;
|
|
// (undocumented)
|
|
getLocale(): string;
|
|
// (undocumented)
|
|
getName(): string;
|
|
getRecordId(): TLUserId;
|
|
// (undocumented)
|
|
getUserPreferences(): {
|
|
animationSpeed: number;
|
|
areKeyboardShortcutsEnabled: boolean;
|
|
color: string;
|
|
colorScheme: "dark" | "light" | "system" | undefined;
|
|
enhancedA11yMode: boolean;
|
|
id: string;
|
|
inputMode: "mouse" | "trackpad" | null;
|
|
isDarkMode: boolean;
|
|
isDynamicResizeMode: boolean;
|
|
isSnapMode: boolean;
|
|
isWrapMode: boolean;
|
|
isZoomDirectionInverted: boolean;
|
|
locale: string;
|
|
name: string;
|
|
};
|
|
// (undocumented)
|
|
systemColorScheme: Atom<"dark" | "light", unknown>;
|
|
// (undocumented)
|
|
updateUserPreferences(userPreferences: Partial<TLUserPreferences>): void;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export const userTypeValidator: T.Validator<TLUserPreferences>;
|
|
|
|
// @internal (undocumented)
|
|
export function useShallowArrayIdentity<T extends null | readonly any[] | undefined>(arr: T): T;
|
|
|
|
// @internal (undocumented)
|
|
export function useShallowObjectIdentity<T extends null | object | undefined>(obj: T): T;
|
|
|
|
// @public
|
|
export function useSharedSafeId(id: string): SafeId;
|
|
|
|
// @public
|
|
export function useSvgExportContext(): null | SvgExportContext;
|
|
|
|
// @public (undocumented)
|
|
export function useTldrawCurrentUser(opts: {
|
|
setUserPreferences?: (userPreferences: TLUserPreferences) => void;
|
|
userPreferences?: Signal<TLUserPreferences> | TLUserPreferences;
|
|
}): TLCurrentUser;
|
|
|
|
// @public (undocumented)
|
|
export function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreSchema<TLRecord, TLStoreProps>;
|
|
|
|
// @public (undocumented)
|
|
export function useTLStore(opts: TLStoreOptions): TLStore;
|
|
|
|
// @public
|
|
export function useTransform(ref: React.RefObject<HTMLElement | null | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
|
|
|
|
// @public
|
|
export function useUniqueSafeId(suffix?: string): SafeId;
|
|
|
|
// @public @deprecated
|
|
export function useViewportHeight(): number;
|
|
|
|
// @internal (undocumented)
|
|
export interface ValidLicenseKeyResult {
|
|
// (undocumented)
|
|
daysSinceExpiry: number;
|
|
// (undocumented)
|
|
expiryDate: Date;
|
|
// (undocumented)
|
|
isAnnualLicense: boolean;
|
|
// (undocumented)
|
|
isAnnualLicenseExpired: boolean;
|
|
// (undocumented)
|
|
isCollaborationEnabled: boolean;
|
|
// (undocumented)
|
|
isCommentingEnabled: boolean;
|
|
// (undocumented)
|
|
isDevelopment: boolean;
|
|
// (undocumented)
|
|
isDomainValid: boolean;
|
|
// (undocumented)
|
|
isEvaluationLicense: boolean;
|
|
// (undocumented)
|
|
isEvaluationLicenseExpired: boolean;
|
|
// (undocumented)
|
|
isInternalLicense: boolean;
|
|
// (undocumented)
|
|
isLicensedWithWatermark: boolean;
|
|
// (undocumented)
|
|
isLicenseParseable: true;
|
|
// (undocumented)
|
|
isNativeLicense: boolean;
|
|
// (undocumented)
|
|
isPerpetualLicense: boolean;
|
|
// (undocumented)
|
|
isPerpetualLicenseExpired: boolean;
|
|
// (undocumented)
|
|
license: LicenseInfo;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export class Vec {
|
|
constructor(x?: number, y?: number, z?: number);
|
|
// (undocumented)
|
|
static Abs(A: VecLike): Vec;
|
|
// (undocumented)
|
|
abs(): this;
|
|
// (undocumented)
|
|
static Add(A: VecLike, B: VecLike): Vec;
|
|
// (undocumented)
|
|
add(V: VecLike): this;
|
|
// (undocumented)
|
|
static AddScalar(A: VecLike, n: number): Vec;
|
|
// (undocumented)
|
|
addScalar(n: number): this;
|
|
// (undocumented)
|
|
static AddXY(A: VecLike, x: number, y: number): Vec;
|
|
// (undocumented)
|
|
addXY(x: number, y: number): this;
|
|
static Angle(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
angle(B: VecLike): number;
|
|
static AngleBetween(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
static Average(arr: VecLike[]): Vec;
|
|
// (undocumented)
|
|
static Cast(A: VecLike): Vec;
|
|
// (undocumented)
|
|
static Clamp(A: Vec, min: number, max?: number): Vec;
|
|
// (undocumented)
|
|
clamp(min: number, max?: number): this;
|
|
// (undocumented)
|
|
static Clockwise(A: VecLike, B: VecLike, C: VecLike): boolean;
|
|
// (undocumented)
|
|
clone(): Vec;
|
|
static Cpr(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
cpr(V: VecLike): number;
|
|
// (undocumented)
|
|
static Cross(A: VecLike, V: VecLike): Vec;
|
|
// (undocumented)
|
|
cross(V: VecLike): this;
|
|
// (undocumented)
|
|
static Dist(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
dist(V: VecLike): number;
|
|
// (undocumented)
|
|
static Dist2(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
static DistanceToLineSegment(A: VecLike, B: VecLike, P: VecLike, clamp?: boolean): number;
|
|
// (undocumented)
|
|
distanceToLineSegment(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
static DistanceToLineThroughPoint(A: VecLike, u: VecLike, P: VecLike): number;
|
|
// (undocumented)
|
|
static DistMin(A: VecLike, B: VecLike, n: number): boolean;
|
|
// (undocumented)
|
|
static Div(A: VecLike, t: number): Vec;
|
|
// (undocumented)
|
|
div(t: number): this;
|
|
// (undocumented)
|
|
static DivV(A: VecLike, B: VecLike): Vec;
|
|
// (undocumented)
|
|
divV(V: VecLike): this;
|
|
static Dpr(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
dpr(V: VecLike): number;
|
|
// (undocumented)
|
|
static Equals(A: VecLike, B: VecLike): boolean;
|
|
// (undocumented)
|
|
equals(B: VecLike): boolean;
|
|
// (undocumented)
|
|
static EqualsXY(A: VecLike, x: number, y: number): boolean;
|
|
// (undocumented)
|
|
equalsXY(x: number, y: number): boolean;
|
|
// (undocumented)
|
|
static From({ x, y, z }: VecModel): Vec;
|
|
// (undocumented)
|
|
static FromAngle(r: number, length?: number): Vec;
|
|
// (undocumented)
|
|
static FromArray(v: number[]): Vec;
|
|
// (undocumented)
|
|
static IsFinite(A: VecLike): boolean;
|
|
// (undocumented)
|
|
static IsNaN(A: VecLike): boolean;
|
|
// (undocumented)
|
|
static Len(A: VecLike): number;
|
|
// (undocumented)
|
|
len(): number;
|
|
// (undocumented)
|
|
static Len2(A: VecLike): number;
|
|
// (undocumented)
|
|
len2(): number;
|
|
static Lrp(A: VecLike, B: VecLike, t: number): Vec;
|
|
// (undocumented)
|
|
lrp(B: VecLike, t: number): Vec;
|
|
// (undocumented)
|
|
static ManhattanDist(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
static Max(A: VecLike, B: VecLike): Vec;
|
|
// (undocumented)
|
|
static Med(A: VecLike, B: VecLike): Vec;
|
|
// (undocumented)
|
|
static Min(A: VecLike, B: VecLike): Vec;
|
|
// (undocumented)
|
|
static Mul(A: VecLike, t: number): Vec;
|
|
// (undocumented)
|
|
mul(t: number): this;
|
|
// (undocumented)
|
|
static MulV(A: VecLike, B: VecLike): Vec;
|
|
// (undocumented)
|
|
mulV(V: VecLike): this;
|
|
// (undocumented)
|
|
static NearestPointOnLineSegment(A: VecLike, B: VecLike, P: VecLike, clamp?: boolean): Vec;
|
|
static NearestPointOnLineThroughPoint(A: VecLike, u: VecLike, P: VecLike): Vec;
|
|
// (undocumented)
|
|
static Neg(A: VecLike): Vec;
|
|
// (undocumented)
|
|
neg(): this;
|
|
// (undocumented)
|
|
static Nudge(A: VecLike, B: VecLike, distance: number): Vec;
|
|
// (undocumented)
|
|
nudge(B: VecLike, distance: number): this;
|
|
static Per(A: VecLike): Vec;
|
|
// (undocumented)
|
|
per(): this;
|
|
static PointsBetween(A: VecModel, B: VecModel, steps?: number, ease?: (t: number) => number): Vec[];
|
|
// (undocumented)
|
|
get pressure(): number;
|
|
static Pry(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
pry(V: VecLike): number;
|
|
// (undocumented)
|
|
static Rescale(A: VecLike, n: number): Vec;
|
|
// (undocumented)
|
|
static Rot(A: VecLike, r?: number): Vec;
|
|
// (undocumented)
|
|
rot(r: number): this;
|
|
// (undocumented)
|
|
static RotWith(A: VecLike, C: VecLike, r: number): Vec;
|
|
// (undocumented)
|
|
rotWith(C: VecLike, r: number): this;
|
|
// (undocumented)
|
|
static ScaleWithOrigin(A: VecLike, scale: number, origin: VecLike): Vec;
|
|
// (undocumented)
|
|
set(x?: number, y?: number, z?: number): this;
|
|
// (undocumented)
|
|
setTo({ x, y, z }: VecLike): this;
|
|
// (undocumented)
|
|
static Slope(A: VecLike, B: VecLike): number;
|
|
// (undocumented)
|
|
slope(B: VecLike): number;
|
|
// (undocumented)
|
|
static Snap(A: VecLike, step?: number): Vec;
|
|
// (undocumented)
|
|
static SnapToGrid(A: VecLike, gridSize?: number): Vec;
|
|
// (undocumented)
|
|
snapToGrid(gridSize: number): this;
|
|
// (undocumented)
|
|
static Sub(A: VecLike, B: VecLike): Vec;
|
|
// (undocumented)
|
|
sub(V: VecLike): this;
|
|
// (undocumented)
|
|
static SubScalar(A: VecLike, n: number): Vec;
|
|
// (undocumented)
|
|
subScalar(n: number): this;
|
|
// (undocumented)
|
|
static SubXY(A: VecLike, x: number, y: number): Vec;
|
|
// (undocumented)
|
|
subXY(x: number, y: number): this;
|
|
// (undocumented)
|
|
static Tan(A: VecLike, B: VecLike): Vec;
|
|
// (undocumented)
|
|
tan(V: VecLike): Vec;
|
|
// (undocumented)
|
|
static ToAngle(A: VecLike): number;
|
|
// (undocumented)
|
|
toAngle(): number;
|
|
// (undocumented)
|
|
static ToArray(A: VecLike): number[];
|
|
// (undocumented)
|
|
toArray(): number[];
|
|
// (undocumented)
|
|
static ToCss(A: VecLike): string;
|
|
// (undocumented)
|
|
static ToFixed(A: VecLike): Vec;
|
|
// (undocumented)
|
|
toFixed(): this;
|
|
// (undocumented)
|
|
static ToInt(A: VecLike): Vec;
|
|
// (undocumented)
|
|
static ToJson(A: VecLike): {
|
|
x: number;
|
|
y: number;
|
|
z: number | undefined;
|
|
};
|
|
// (undocumented)
|
|
toJson(): VecModel;
|
|
// (undocumented)
|
|
static ToString(A: VecLike): string;
|
|
// (undocumented)
|
|
toString(): string;
|
|
static Uni(A: VecLike): Vec;
|
|
// (undocumented)
|
|
uni(): this;
|
|
// (undocumented)
|
|
x: number;
|
|
// (undocumented)
|
|
y: number;
|
|
// (undocumented)
|
|
z: number;
|
|
}
|
|
|
|
// @public (undocumented)
|
|
export type VecLike = Vec | VecModel;
|
|
|
|
|
|
export * from "@tldraw/state";
|
|
export * from "@tldraw/state-react";
|
|
export * from "@tldraw/store";
|
|
export * from "@tldraw/tlschema";
|
|
export * from "@tldraw/utils";
|
|
export * from "@tldraw/validate";
|
|
|
|
// (No @packageDocumentation comment for this package)
|
|
|
|
```
|