Add tsdocs to Editor methods (#1581)
This PR does a first-pass of adding tsdocs to the methods of the Editor class. It's a minimal start — just descriptions of them, and their parameters. It makes the Editor docs page a lot more fleshed out though, and easier to quickly scan. There's still a lot more to do! ### Change Type - [x] `documentation` — Changes to the documentation only[^2] ### Release Notes - [dev] Added initial documentation for the Editor class. --------- Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
This commit is contained in:
parent
014576ba87
commit
3e2f2e0884
4 changed files with 546 additions and 265 deletions
|
@ -35,7 +35,7 @@ export async function cleanup({ page }: PlaywrightTestArgs) {
|
||||||
export async function setupPage(page: PlaywrightTestArgs['page']) {
|
export async function setupPage(page: PlaywrightTestArgs['page']) {
|
||||||
await page.goto('http://localhost:5420/end-to-end')
|
await page.goto('http://localhost:5420/end-to-end')
|
||||||
await page.waitForSelector('.tl-canvas')
|
await page.waitForSelector('.tl-canvas')
|
||||||
await page.evaluate(() => (editor.enableAnimations = false))
|
await page.evaluate(() => editor.setAnimationSpeed(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function setupPageWithShapes(page: PlaywrightTestArgs['page']) {
|
export async function setupPageWithShapes(page: PlaywrightTestArgs['page']) {
|
||||||
|
|
|
@ -372,9 +372,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
duration?: number;
|
duration?: number;
|
||||||
ease?: (t: number) => number;
|
ease?: (t: number) => number;
|
||||||
}): this;
|
}): this;
|
||||||
// (undocumented)
|
|
||||||
animateToShape(shapeId: TLShapeId, opts?: TLAnimationOptions): this;
|
animateToShape(shapeId: TLShapeId, opts?: TLAnimationOptions): this;
|
||||||
// (undocumented)
|
|
||||||
get animationSpeed(): number;
|
get animationSpeed(): number;
|
||||||
// @internal (undocumented)
|
// @internal (undocumented)
|
||||||
annotateError(error: unknown, { origin, willCrashApp, tags, extras, }: {
|
annotateError(error: unknown, { origin, willCrashApp, tags, extras, }: {
|
||||||
|
@ -390,7 +388,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
blur(): this;
|
blur(): this;
|
||||||
bringForward(ids?: TLShapeId[]): this;
|
bringForward(ids?: TLShapeId[]): this;
|
||||||
bringToFront(ids?: TLShapeId[]): this;
|
bringToFront(ids?: TLShapeId[]): this;
|
||||||
// (undocumented)
|
|
||||||
get brush(): Box2dModel | null;
|
get brush(): Box2dModel | null;
|
||||||
get camera(): TLCamera;
|
get camera(): TLCamera;
|
||||||
cancel(): this;
|
cancel(): this;
|
||||||
|
@ -435,28 +432,23 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
get currentPage(): TLPage;
|
get currentPage(): TLPage;
|
||||||
get currentPageId(): TLPageId;
|
get currentPageId(): TLPageId;
|
||||||
get currentToolId(): string;
|
get currentToolId(): string;
|
||||||
// (undocumented)
|
|
||||||
get cursor(): TLCursor;
|
get cursor(): TLCursor;
|
||||||
deleteAssets(ids: TLAssetId[]): this;
|
deleteAssets(ids: TLAssetId[]): this;
|
||||||
deleteOpenMenu(id: string): this;
|
deleteOpenMenu(id: string): this;
|
||||||
deletePage(id: TLPageId): void;
|
deletePage(id: TLPageId): void;
|
||||||
deleteShapes(ids?: TLShapeId[]): this;
|
deleteShapes(ids?: TLShapeId[]): this;
|
||||||
deselect(...ids: TLShapeId[]): this;
|
deselect(...ids: TLShapeId[]): this;
|
||||||
// (undocumented)
|
|
||||||
get devicePixelRatio(): number;
|
get devicePixelRatio(): number;
|
||||||
dispatch(info: TLEventInfo): this;
|
dispatch(info: TLEventInfo): this;
|
||||||
readonly disposables: Set<() => void>;
|
readonly disposables: Set<() => void>;
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
distributeShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[]): this;
|
distributeShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[]): this;
|
||||||
get documentSettings(): TLDocument;
|
get documentSettings(): TLDocument;
|
||||||
// (undocumented)
|
duplicatePage(id?: TLPageId, createId?: TLPageId): this;
|
||||||
duplicatePage(id?: TLPageId, createId?: TLPageId): void;
|
|
||||||
duplicateShapes(ids?: TLShapeId[], offset?: VecLike): this;
|
duplicateShapes(ids?: TLShapeId[], offset?: VecLike): this;
|
||||||
get editingId(): null | TLShapeId;
|
get editingId(): null | TLShapeId;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
get editingShape(): null | TLUnknownShape;
|
get editingShape(): null | TLUnknownShape;
|
||||||
// (undocumented)
|
|
||||||
enableAnimations: boolean;
|
|
||||||
get erasingIds(): TLShapeId[];
|
get erasingIds(): TLShapeId[];
|
||||||
get erasingIdsSet(): Set<TLShapeId>;
|
get erasingIdsSet(): Set<TLShapeId>;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
|
@ -465,9 +457,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
findCommonAncestor(shapes: TLShape[], predicate?: (shape: TLShape) => boolean): TLShapeId | undefined;
|
findCommonAncestor(shapes: TLShape[], predicate?: (shape: TLShape) => boolean): TLShapeId | undefined;
|
||||||
flipShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[]): this;
|
flipShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[]): this;
|
||||||
focus(): this;
|
focus(): this;
|
||||||
// (undocumented)
|
|
||||||
get focusLayerId(): TLPageId | TLShapeId;
|
get focusLayerId(): TLPageId | TLShapeId;
|
||||||
// (undocumented)
|
|
||||||
get focusLayerShape(): TLShape | undefined;
|
get focusLayerShape(): TLShape | undefined;
|
||||||
getAncestors(shape: TLShape, acc?: TLShape[]): TLShape[];
|
getAncestors(shape: TLShape, acc?: TLShape[]): TLShape[];
|
||||||
getAncestorsById(id: TLShapeId, acc?: TLShape[]): TLShape[];
|
getAncestorsById(id: TLShapeId, acc?: TLShape[]): TLShape[];
|
||||||
|
@ -481,24 +471,20 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
getBoundsById(id: TLShapeId): Box2d | undefined;
|
getBoundsById(id: TLShapeId): Box2d | undefined;
|
||||||
getClipPathById(id: TLShapeId): string | undefined;
|
getClipPathById(id: TLShapeId): string | undefined;
|
||||||
getContainer: () => HTMLElement;
|
getContainer: () => HTMLElement;
|
||||||
// (undocumented)
|
|
||||||
getContent(ids?: TLShapeId[]): TLContent | undefined;
|
getContent(ids?: TLShapeId[]): TLContent | undefined;
|
||||||
getCssColor(id: TLColorStyle['id']): string;
|
getCssColor(id: TLColorStyle['id']): string;
|
||||||
getDeltaInParentSpace(shape: TLShape, delta: VecLike): Vec2d;
|
getDeltaInParentSpace(shape: TLShape, delta: VecLike): Vec2d;
|
||||||
getDeltaInShapeSpace(shape: TLShape, delta: VecLike): Vec2d;
|
getDeltaInShapeSpace(shape: TLShape, delta: VecLike): Vec2d;
|
||||||
// (undocumented)
|
|
||||||
getDroppingShape(point: VecLike, droppingShapes?: TLShape[]): TLUnknownShape | undefined;
|
getDroppingShape(point: VecLike, droppingShapes?: TLShape[]): TLUnknownShape | undefined;
|
||||||
// (undocumented)
|
|
||||||
getHighestIndexForParent(parentId: TLPageId | TLShapeId): string;
|
getHighestIndexForParent(parentId: TLPageId | TLShapeId): string;
|
||||||
getMaskedPageBounds(shape: TLShape): Box2d | undefined;
|
getMaskedPageBounds(shape: TLShape): Box2d | undefined;
|
||||||
getMaskedPageBoundsById(id: TLShapeId): Box2d | undefined;
|
getMaskedPageBoundsById(id: TLShapeId): Box2d | undefined;
|
||||||
// (undocumented)
|
|
||||||
getOutermostSelectableShape(shape: TLShape, filter?: (shape: TLShape) => boolean): TLShape;
|
getOutermostSelectableShape(shape: TLShape, filter?: (shape: TLShape) => boolean): TLShape;
|
||||||
getOutline(shape: TLShape): Vec2dModel[];
|
getOutline(shape: TLShape): Vec2dModel[];
|
||||||
getOutlineById(id: TLShapeId): Vec2dModel[];
|
getOutlineById(id: TLShapeId): Vec2dModel[];
|
||||||
getPageBounds(shape: TLShape): Box2d | undefined;
|
getPageBounds(shape: TLShape): Box2d | undefined;
|
||||||
getPageBoundsById(id: TLShapeId): Box2d | undefined;
|
getPageBoundsById(id: TLShapeId): Box2d | undefined;
|
||||||
getPageById(id: TLPage['id']): TLPage | undefined;
|
getPageById(id: TLPageId): TLPage | undefined;
|
||||||
getPageCenter(shape: TLShape): null | Vec2d;
|
getPageCenter(shape: TLShape): null | Vec2d;
|
||||||
getPageCenterById(id: TLShapeId): null | Vec2d;
|
getPageCenterById(id: TLShapeId): null | Vec2d;
|
||||||
getPageCorners(shape: TLShape): Vec2d[];
|
getPageCorners(shape: TLShape): Vec2d[];
|
||||||
|
@ -510,7 +496,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
getPageStateByPageId(id: TLPageId): TLInstancePageState | undefined;
|
getPageStateByPageId(id: TLPageId): TLInstancePageState | undefined;
|
||||||
getPageTransform(shape: TLShape): Matrix2d | undefined;
|
getPageTransform(shape: TLShape): Matrix2d | undefined;
|
||||||
getPageTransformById(id: TLShapeId): Matrix2d | undefined;
|
getPageTransformById(id: TLShapeId): Matrix2d | undefined;
|
||||||
// (undocumented)
|
|
||||||
getParentIdForNewShapeAtPoint(point: VecLike, shapeType: TLShape['type']): TLPageId | TLShapeId;
|
getParentIdForNewShapeAtPoint(point: VecLike, shapeType: TLShape['type']): TLPageId | TLShapeId;
|
||||||
getParentPageId(shape?: TLShape): TLPageId | undefined;
|
getParentPageId(shape?: TLShape): TLPageId | undefined;
|
||||||
getParentShape(shape?: TLShape): TLShape | undefined;
|
getParentShape(shape?: TLShape): TLShape | undefined;
|
||||||
|
@ -518,7 +503,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
getParentTransform(shape: TLShape): Matrix2d;
|
getParentTransform(shape: TLShape): Matrix2d;
|
||||||
getPointInParentSpace(shapeId: TLShapeId, point: VecLike): Vec2d;
|
getPointInParentSpace(shapeId: TLShapeId, point: VecLike): Vec2d;
|
||||||
getPointInShapeSpace(shape: TLShape, point: VecLike): Vec2d;
|
getPointInShapeSpace(shape: TLShape, point: VecLike): Vec2d;
|
||||||
// (undocumented)
|
|
||||||
getShapeAndDescendantIds(ids: TLShapeId[]): Set<TLShapeId>;
|
getShapeAndDescendantIds(ids: TLShapeId[]): Set<TLShapeId>;
|
||||||
getShapeById<T extends TLShape = TLShape>(id: TLParentId): T | undefined;
|
getShapeById<T extends TLShape = TLShape>(id: TLParentId): T | undefined;
|
||||||
getShapeIdsInPage(pageId: TLPageId): Set<TLShapeId>;
|
getShapeIdsInPage(pageId: TLPageId): Set<TLShapeId>;
|
||||||
|
@ -531,7 +515,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
getSortedChildIds(parentId: TLParentId): TLShapeId[];
|
getSortedChildIds(parentId: TLParentId): TLShapeId[];
|
||||||
getStateDescendant(path: string): StateNode | undefined;
|
getStateDescendant(path: string): StateNode | undefined;
|
||||||
getStrokeWidth(id: TLSizeStyle['id']): number;
|
getStrokeWidth(id: TLSizeStyle['id']): number;
|
||||||
// (undocumented)
|
|
||||||
getSvg(ids?: TLShapeId[], opts?: Partial<{
|
getSvg(ids?: TLShapeId[], opts?: Partial<{
|
||||||
scale: number;
|
scale: number;
|
||||||
background: boolean;
|
background: boolean;
|
||||||
|
@ -540,16 +523,12 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
preserveAspectRatio: React.SVGAttributes<SVGSVGElement>['preserveAspectRatio'];
|
preserveAspectRatio: React.SVGAttributes<SVGSVGElement>['preserveAspectRatio'];
|
||||||
}>): Promise<SVGSVGElement | undefined>;
|
}>): Promise<SVGSVGElement | undefined>;
|
||||||
getTransform(shape: TLShape): Matrix2d;
|
getTransform(shape: TLShape): Matrix2d;
|
||||||
// (undocumented)
|
|
||||||
get gridSize(): number;
|
get gridSize(): number;
|
||||||
// (undocumented)
|
|
||||||
groupShapes(ids?: TLShapeId[], groupId?: TLShapeId): this;
|
groupShapes(ids?: TLShapeId[], groupId?: TLShapeId): this;
|
||||||
hasAncestor(shape: TLShape | undefined, ancestorId: TLShapeId): boolean;
|
hasAncestor(shape: TLShape | undefined, ancestorId: TLShapeId): boolean;
|
||||||
get hintingIds(): TLShapeId[];
|
get hintingIds(): TLShapeId[];
|
||||||
readonly history: HistoryManager<this>;
|
readonly history: HistoryManager<this>;
|
||||||
// (undocumented)
|
|
||||||
get hoveredId(): null | TLShapeId;
|
get hoveredId(): null | TLShapeId;
|
||||||
// (undocumented)
|
|
||||||
get hoveredShape(): null | TLUnknownShape;
|
get hoveredShape(): null | TLUnknownShape;
|
||||||
inputs: {
|
inputs: {
|
||||||
originPagePoint: Vec2d;
|
originPagePoint: Vec2d;
|
||||||
|
@ -578,21 +557,16 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
readonly isChromeForIos: boolean;
|
readonly isChromeForIos: boolean;
|
||||||
get isCoarsePointer(): boolean;
|
get isCoarsePointer(): boolean;
|
||||||
set isCoarsePointer(v: boolean);
|
set isCoarsePointer(v: boolean);
|
||||||
// (undocumented)
|
|
||||||
get isDarkMode(): boolean;
|
get isDarkMode(): boolean;
|
||||||
get isFocused(): boolean;
|
get isFocused(): boolean;
|
||||||
// (undocumented)
|
|
||||||
get isFocusMode(): boolean;
|
get isFocusMode(): boolean;
|
||||||
// (undocumented)
|
|
||||||
get isGridMode(): boolean;
|
get isGridMode(): boolean;
|
||||||
isIn(path: string): boolean;
|
isIn(path: string): boolean;
|
||||||
isInAny(...paths: string[]): boolean;
|
isInAny(...paths: string[]): boolean;
|
||||||
readonly isIos: boolean;
|
readonly isIos: boolean;
|
||||||
get isMenuOpen(): boolean;
|
get isMenuOpen(): boolean;
|
||||||
// (undocumented)
|
|
||||||
get isPenMode(): boolean;
|
get isPenMode(): boolean;
|
||||||
isPointInShape(point: VecLike, shape: TLShape): boolean;
|
isPointInShape(point: VecLike, shape: TLShape): boolean;
|
||||||
// (undocumented)
|
|
||||||
get isReadOnly(): boolean;
|
get isReadOnly(): boolean;
|
||||||
readonly isSafari: boolean;
|
readonly isSafari: boolean;
|
||||||
isSelected(id: TLShapeId): boolean;
|
isSelected(id: TLShapeId): boolean;
|
||||||
|
@ -603,9 +577,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
type: string;
|
type: string;
|
||||||
}): shape is T;
|
}): shape is T;
|
||||||
isShapeOrAncestorLocked(shape?: TLShape): boolean;
|
isShapeOrAncestorLocked(shape?: TLShape): boolean;
|
||||||
// (undocumented)
|
|
||||||
get isSnapMode(): boolean;
|
get isSnapMode(): boolean;
|
||||||
// (undocumented)
|
|
||||||
get isToolLocked(): boolean;
|
get isToolLocked(): boolean;
|
||||||
isWithinSelection(id: TLShapeId): boolean;
|
isWithinSelection(id: TLShapeId): boolean;
|
||||||
get locale(): string;
|
get locale(): string;
|
||||||
|
@ -613,7 +585,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
moveShapesToPage(ids: TLShapeId[], pageId: TLPageId): this;
|
moveShapesToPage(ids: TLShapeId[], pageId: TLPageId): this;
|
||||||
nudgeShapes(ids: TLShapeId[], direction: Vec2dModel, major?: boolean, ephemeral?: boolean): this;
|
nudgeShapes(ids: TLShapeId[], direction: Vec2dModel, major?: boolean, ephemeral?: boolean): this;
|
||||||
get onlySelectedShape(): null | TLShape;
|
get onlySelectedShape(): null | TLShape;
|
||||||
// (undocumented)
|
|
||||||
get opacity(): null | number;
|
get opacity(): null | number;
|
||||||
get openMenus(): string[];
|
get openMenus(): string[];
|
||||||
packShapes(ids?: TLShapeId[], padding?: number): this;
|
packShapes(ids?: TLShapeId[], padding?: number): this;
|
||||||
|
@ -626,13 +597,11 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
};
|
};
|
||||||
pan(dx: number, dy: number, opts?: TLAnimationOptions): this;
|
pan(dx: number, dy: number, opts?: TLAnimationOptions): this;
|
||||||
panZoomIntoView(ids: TLShapeId[], opts?: TLAnimationOptions): this;
|
panZoomIntoView(ids: TLShapeId[], opts?: TLAnimationOptions): this;
|
||||||
// (undocumented)
|
|
||||||
popFocusLayer(): this;
|
popFocusLayer(): this;
|
||||||
// @internal (undocumented)
|
// @internal (undocumented)
|
||||||
get projectName(): string;
|
get projectName(): string;
|
||||||
// @internal
|
// @internal
|
||||||
get props(): null | TLNullableShapeProps;
|
get props(): null | TLNullableShapeProps;
|
||||||
// (undocumented)
|
|
||||||
putContent(content: TLContent, options?: {
|
putContent(content: TLContent, options?: {
|
||||||
point?: VecLike;
|
point?: VecLike;
|
||||||
select?: boolean;
|
select?: boolean;
|
||||||
|
@ -653,10 +622,8 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
}[];
|
}[];
|
||||||
reorderShapes(operation: 'backward' | 'forward' | 'toBack' | 'toFront', ids: TLShapeId[]): this;
|
reorderShapes(operation: 'backward' | 'forward' | 'toBack' | 'toFront', ids: TLShapeId[]): this;
|
||||||
reparentShapesById(ids: TLShapeId[], parentId: TLParentId, insertIndex?: string): this;
|
reparentShapesById(ids: TLShapeId[], parentId: TLParentId, insertIndex?: string): this;
|
||||||
// (undocumented)
|
|
||||||
replaceStoreContentsWithRecordsForOtherDocument(records: TLRecord[]): void;
|
replaceStoreContentsWithRecordsForOtherDocument(records: TLRecord[]): void;
|
||||||
resetZoom(point?: Vec2d, opts?: TLAnimationOptions): this;
|
resetZoom(point?: Vec2d, opts?: TLAnimationOptions): this;
|
||||||
// (undocumented)
|
|
||||||
resizeShape(id: TLShapeId, scale: VecLike, options?: {
|
resizeShape(id: TLShapeId, scale: VecLike, options?: {
|
||||||
initialBounds?: Box2d;
|
initialBounds?: Box2d;
|
||||||
scaleOrigin?: VecLike;
|
scaleOrigin?: VecLike;
|
||||||
|
@ -673,7 +640,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
y: number;
|
y: number;
|
||||||
z: number;
|
z: number;
|
||||||
};
|
};
|
||||||
// (undocumented)
|
|
||||||
get scribble(): null | TLScribble;
|
get scribble(): null | TLScribble;
|
||||||
select(...ids: TLShapeId[]): this;
|
select(...ids: TLShapeId[]): this;
|
||||||
selectAll(): this;
|
selectAll(): this;
|
||||||
|
@ -681,49 +647,38 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
get selectedIdsSet(): ReadonlySet<TLShapeId>;
|
get selectedIdsSet(): ReadonlySet<TLShapeId>;
|
||||||
get selectedPageBounds(): Box2d | null;
|
get selectedPageBounds(): Box2d | null;
|
||||||
get selectedShapes(): TLShape[];
|
get selectedShapes(): TLShape[];
|
||||||
// (undocumented)
|
|
||||||
get selectionBounds(): Box2d | undefined;
|
get selectionBounds(): Box2d | undefined;
|
||||||
// (undocumented)
|
|
||||||
get selectionPageCenter(): null | Vec2d;
|
get selectionPageCenter(): null | Vec2d;
|
||||||
get selectionRotation(): number;
|
get selectionRotation(): number;
|
||||||
selectNone(): this;
|
selectNone(): this;
|
||||||
sendBackward(ids?: TLShapeId[]): this;
|
sendBackward(ids?: TLShapeId[]): this;
|
||||||
sendToBack(ids?: TLShapeId[]): this;
|
sendToBack(ids?: TLShapeId[]): this;
|
||||||
// (undocumented)
|
|
||||||
setAnimationSpeed(animationSpeed: number): this;
|
setAnimationSpeed(animationSpeed: number): this;
|
||||||
setBrush(brush?: Box2dModel | null): this;
|
setBrush(brush?: Box2dModel | null): this;
|
||||||
setCamera(x: number, y: number, z?: number, { stopFollowing }?: TLViewportOptions): this;
|
setCamera(x: number, y: number, z?: number, { stopFollowing }?: TLViewportOptions): this;
|
||||||
// (undocumented)
|
|
||||||
setCroppingId(id: null | TLShapeId): this;
|
setCroppingId(id: null | TLShapeId): this;
|
||||||
setCurrentPageId(pageId: TLPageId, { stopFollowing }?: TLViewportOptions): this;
|
setCurrentPageId(pageId: TLPageId, { stopFollowing }?: TLViewportOptions): this;
|
||||||
setCursor(cursor: Partial<TLCursor>): this;
|
setCursor(cursor: Partial<TLCursor>): this;
|
||||||
// (undocumented)
|
|
||||||
setDarkMode(isDarkMode: boolean): this;
|
setDarkMode(isDarkMode: boolean): this;
|
||||||
setEditingId(id: null | TLShapeId): this;
|
setEditingId(id: null | TLShapeId): this;
|
||||||
setErasingIds(ids?: TLShapeId[]): this;
|
setErasingIds(ids?: TLShapeId[]): this;
|
||||||
setFocusLayer(next: null | TLShapeId): this;
|
setFocusLayer(next: null | TLShapeId): this;
|
||||||
// (undocumented)
|
|
||||||
setFocusMode(isFocusMode: boolean): this;
|
setFocusMode(isFocusMode: boolean): this;
|
||||||
// (undocumented)
|
|
||||||
setGridMode(isGridMode: boolean): this;
|
setGridMode(isGridMode: boolean): this;
|
||||||
setHintingIds(ids: TLShapeId[]): this;
|
setHintingIds(ids: TLShapeId[]): this;
|
||||||
setHoveredId(id?: null | TLShapeId): this;
|
setHoveredId(id?: null | TLShapeId): this;
|
||||||
setInstancePageState(partial: Partial<TLInstancePageState>, ephemeral?: boolean): void;
|
setInstancePageState(partial: Partial<TLInstancePageState>, ephemeral?: boolean): void;
|
||||||
setLocale(locale: string): void;
|
setLocale(locale: string): void;
|
||||||
setOpacity(opacity: number, ephemeral?: boolean, squashing?: boolean): this;
|
setOpacity(opacity: number, ephemeral?: boolean, squashing?: boolean): this;
|
||||||
// (undocumented)
|
|
||||||
setPenMode(isPenMode: boolean): this;
|
setPenMode(isPenMode: boolean): this;
|
||||||
// @internal (undocumented)
|
// @internal (undocumented)
|
||||||
setProjectName(name: string): void;
|
setProjectName(name: string): void;
|
||||||
setProp(key: TLShapeProp, value: any, ephemeral?: boolean, squashing?: boolean): this;
|
setProp(key: TLShapeProp, value: any, ephemeral?: boolean, squashing?: boolean): this;
|
||||||
// (undocumented)
|
|
||||||
setReadOnly(isReadOnly: boolean): this;
|
setReadOnly(isReadOnly: boolean): this;
|
||||||
setScribble(scribble?: null | TLScribble): this;
|
setScribble(scribble?: null | TLScribble): this;
|
||||||
setSelectedIds(ids: TLShapeId[], squashing?: boolean): this;
|
setSelectedIds(ids: TLShapeId[], squashing?: boolean): this;
|
||||||
setSelectedTool(id: string, info?: {}): this;
|
setSelectedTool(id: string, info?: {}): this;
|
||||||
// (undocumented)
|
|
||||||
setSnapMode(isSnapMode: boolean): this;
|
setSnapMode(isSnapMode: boolean): this;
|
||||||
// (undocumented)
|
|
||||||
setToolLocked(isToolLocked: boolean): this;
|
setToolLocked(isToolLocked: boolean): this;
|
||||||
setZoomBrush(zoomBrush?: Box2dModel | null): this;
|
setZoomBrush(zoomBrush?: Box2dModel | null): this;
|
||||||
get shapeIds(): Set<TLShapeId>;
|
get shapeIds(): Set<TLShapeId>;
|
||||||
|
@ -731,7 +686,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
shapeUtils: {
|
shapeUtils: {
|
||||||
readonly [K in string]?: ShapeUtil<TLUnknownShape>;
|
readonly [K in string]?: ShapeUtil<TLUnknownShape>;
|
||||||
};
|
};
|
||||||
// (undocumented)
|
|
||||||
slideCamera(opts?: {
|
slideCamera(opts?: {
|
||||||
speed: number;
|
speed: number;
|
||||||
direction: Vec2d;
|
direction: Vec2d;
|
||||||
|
@ -748,28 +702,23 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
stretchShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[]): this;
|
stretchShapes(operation: 'horizontal' | 'vertical', ids?: TLShapeId[]): this;
|
||||||
static styles: TLStyleCollections;
|
static styles: TLStyleCollections;
|
||||||
textMeasure: TextManager;
|
textMeasure: TextManager;
|
||||||
// (undocumented)
|
|
||||||
toggleLock(ids?: TLShapeId[]): this;
|
toggleLock(ids?: TLShapeId[]): this;
|
||||||
undo(): HistoryManager<this>;
|
undo(): HistoryManager<this>;
|
||||||
// (undocumented)
|
|
||||||
ungroupShapes(ids?: TLShapeId[]): this;
|
ungroupShapes(ids?: TLShapeId[]): this;
|
||||||
updateAssets(assets: TLAssetPartial[]): this;
|
updateAssets(assets: TLAssetPartial[]): this;
|
||||||
// @internal
|
// @internal
|
||||||
updateCullingBounds(): this;
|
updateCullingBounds(): this;
|
||||||
// (undocumented)
|
|
||||||
updateDocumentSettings(settings: Partial<TLDocument>): void;
|
updateDocumentSettings(settings: Partial<TLDocument>): void;
|
||||||
updateInstanceState(partial: Partial<Omit<TLInstance, 'currentPageId'>>, ephemeral?: boolean, squashing?: boolean): this;
|
updateInstanceState(partial: Partial<Omit<TLInstance, 'currentPageId'>>, ephemeral?: boolean, squashing?: boolean): this;
|
||||||
updatePage(partial: RequiredKeys<TLPage, 'id'>, squashing?: boolean): this;
|
updatePage(partial: RequiredKeys<TLPage, 'id'>, squashing?: boolean): this;
|
||||||
updateShapes<T extends TLUnknownShape>(partials: (null | TLShapePartial<T> | undefined)[], squashing?: boolean): this;
|
updateShapes<T extends TLUnknownShape>(partials: (null | TLShapePartial<T> | undefined)[], squashing?: boolean): this;
|
||||||
updateViewportScreenBounds(center?: boolean): this;
|
updateViewportScreenBounds(center?: boolean): this;
|
||||||
// (undocumented)
|
|
||||||
readonly user: UserPreferencesManager;
|
readonly user: UserPreferencesManager;
|
||||||
get viewportPageBounds(): Box2d;
|
get viewportPageBounds(): Box2d;
|
||||||
get viewportPageCenter(): Vec2d;
|
get viewportPageCenter(): Vec2d;
|
||||||
get viewportScreenBounds(): Box2d;
|
get viewportScreenBounds(): Box2d;
|
||||||
get viewportScreenCenter(): Vec2d;
|
get viewportScreenCenter(): Vec2d;
|
||||||
visitDescendants(parentId: TLParentId, visitor: (id: TLShapeId) => false | void): void;
|
visitDescendants(parentId: TLParentId, visitor: (id: TLShapeId) => false | void): void;
|
||||||
// (undocumented)
|
|
||||||
get zoomBrush(): Box2dModel | null;
|
get zoomBrush(): Box2dModel | null;
|
||||||
zoomIn(point?: Vec2d, opts?: TLAnimationOptions): this;
|
zoomIn(point?: Vec2d, opts?: TLAnimationOptions): this;
|
||||||
get zoomLevel(): number;
|
get zoomLevel(): number;
|
||||||
|
|
|
@ -28,38 +28,24 @@ import { TLStoreWithStatus } from './utils/sync/StoreWithStatus'
|
||||||
/** @public */
|
/** @public */
|
||||||
export type TldrawEditorProps = {
|
export type TldrawEditorProps = {
|
||||||
children?: any
|
children?: any
|
||||||
/**
|
/** An array of shape utils to use in the editor. */
|
||||||
* An array of shape utils to use in the editor.
|
|
||||||
*/
|
|
||||||
shapes?: readonly AnyTLShapeInfo[]
|
shapes?: readonly AnyTLShapeInfo[]
|
||||||
/**
|
/** An array of tools to use in the editor. */
|
||||||
* An array of tools to use in the editor.
|
|
||||||
*/
|
|
||||||
tools?: readonly TLStateNodeConstructor[]
|
tools?: readonly TLStateNodeConstructor[]
|
||||||
/**
|
/** Urls for where to find fonts and other assets. */
|
||||||
* Urls for where to find fonts and other assets.
|
|
||||||
*/
|
|
||||||
assetUrls?: RecursivePartial<TLEditorAssetUrls>
|
assetUrls?: RecursivePartial<TLEditorAssetUrls>
|
||||||
/**
|
/** Whether to automatically focus the editor when it mounts. */
|
||||||
* Whether to automatically focus the editor when it mounts.
|
|
||||||
*/
|
|
||||||
autoFocus?: boolean
|
autoFocus?: boolean
|
||||||
/**
|
/** Overrides for the tldraw user interface components. */
|
||||||
* Overrides for the tldraw user interface components.
|
|
||||||
*/
|
|
||||||
components?: Partial<TLEditorComponents>
|
components?: Partial<TLEditorComponents>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the editor has mounted.
|
* Called when the editor has mounted.
|
||||||
*
|
|
||||||
* @example
|
* @example
|
||||||
*
|
|
||||||
* ```ts
|
* ```ts
|
||||||
* function TldrawEditor() {
|
* function TldrawEditor() {
|
||||||
* return <Editor onMount={(editor) => editor.selectAll()} />
|
* return <Editor onMount={(editor) => editor.selectAll()} />
|
||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
|
||||||
* @param editor - The editor instance.
|
* @param editor - The editor instance.
|
||||||
*/
|
*/
|
||||||
onMount?: (editor: Editor) => (() => void) | undefined | void
|
onMount?: (editor: Editor) => (() => void) | undefined | void
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue