Remove deprecated getters (#2333)
Finally removing all these deprecated getters ahead of the full release. ### Change Type - [x] `major` — Breaking change ### Release Notes - (Breaking) Removed deprecated getters.
This commit is contained in:
parent
1712d96daa
commit
ded56e953a
13 changed files with 5 additions and 2776 deletions
|
@ -575,21 +575,13 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
tags?: Record<string, boolean | number | string>;
|
tags?: Record<string, boolean | number | string>;
|
||||||
extras?: Record<string, unknown>;
|
extras?: Record<string, unknown>;
|
||||||
}): this;
|
}): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get assets(): (TLBookmarkAsset | TLImageAsset | TLVideoAsset)[];
|
|
||||||
bail(): this;
|
bail(): this;
|
||||||
bailToMark(id: string): this;
|
bailToMark(id: string): this;
|
||||||
batch(fn: () => void): this;
|
batch(fn: () => void): this;
|
||||||
bringForward(shapes: TLShape[] | TLShapeId[]): this;
|
bringForward(shapes: TLShape[] | TLShapeId[]): this;
|
||||||
bringToFront(shapes: TLShape[] | TLShapeId[]): this;
|
bringToFront(shapes: TLShape[] | TLShapeId[]): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get cameraState(): "idle" | "moving";
|
|
||||||
cancel(): this;
|
cancel(): this;
|
||||||
cancelDoubleClick(): void;
|
cancelDoubleClick(): void;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get canRedo(): boolean;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get canUndo(): boolean;
|
|
||||||
// @internal (undocumented)
|
// @internal (undocumented)
|
||||||
capturedPointerId: null | number;
|
capturedPointerId: null | number;
|
||||||
centerOnPoint(point: VecLike, animation?: TLAnimationOptions): this;
|
centerOnPoint(point: VecLike, animation?: TLAnimationOptions): this;
|
||||||
|
@ -615,28 +607,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
createPage(page: Partial<TLPage>): this;
|
createPage(page: Partial<TLPage>): this;
|
||||||
createShape<T extends TLUnknownShape>(shape: OptionalKeys<TLShapePartial<T>, 'id'>): this;
|
createShape<T extends TLUnknownShape>(shape: OptionalKeys<TLShapePartial<T>, 'id'>): this;
|
||||||
createShapes<T extends TLUnknownShape>(shapes: OptionalKeys<TLShapePartial<T>, 'id'>[]): this;
|
createShapes<T extends TLUnknownShape>(shapes: OptionalKeys<TLShapePartial<T>, 'id'>[]): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get croppingShapeId(): null | TLShapeId;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentPage(): TLPage;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentPageBounds(): Box2d | undefined;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentPageId(): TLPageId;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentPageRenderingShapesSorted(): TLShape[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentPageShapeIds(): Set<TLShapeId>;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentPageShapes(): TLShape[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentPageShapesSorted(): TLShape[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentPageState(): TLInstancePageState;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentTool(): StateNode;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentToolId(): string;
|
|
||||||
deleteAssets(assets: TLAsset[] | TLAssetId[]): this;
|
deleteAssets(assets: TLAsset[] | TLAssetId[]): this;
|
||||||
deleteOpenMenu(id: string): this;
|
deleteOpenMenu(id: string): this;
|
||||||
deletePage(page: TLPage | TLPageId): this;
|
deletePage(page: TLPage | TLPageId): this;
|
||||||
|
@ -651,19 +621,9 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
readonly disposables: Set<() => void>;
|
readonly disposables: Set<() => void>;
|
||||||
dispose(): void;
|
dispose(): void;
|
||||||
distributeShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
|
distributeShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get documentSettings(): TLDocument;
|
|
||||||
duplicatePage(page: TLPage | TLPageId, createId?: TLPageId): this;
|
duplicatePage(page: TLPage | TLPageId, createId?: TLPageId): this;
|
||||||
duplicateShapes(shapes: TLShape[] | TLShapeId[], offset?: VecLike): this;
|
duplicateShapes(shapes: TLShape[] | TLShapeId[], offset?: VecLike): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get editingShape(): TLShape | undefined;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get editingShapeId(): null | TLShapeId;
|
|
||||||
readonly environment: EnvironmentManager;
|
readonly environment: EnvironmentManager;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get erasingShapeIds(): TLShapeId[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get erasingShapes(): NonNullable<TLShape | undefined>[];
|
|
||||||
// @internal (undocumented)
|
// @internal (undocumented)
|
||||||
externalAssetContentHandlers: {
|
externalAssetContentHandlers: {
|
||||||
[K in TLExternalAssetContent['type']]: {
|
[K in TLExternalAssetContent['type']]: {
|
||||||
|
@ -683,10 +643,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
findCommonAncestor(shapes: TLShape[] | TLShapeId[], predicate?: (shape: TLShape) => boolean): TLShapeId | undefined;
|
findCommonAncestor(shapes: TLShape[] | TLShapeId[], predicate?: (shape: TLShape) => boolean): TLShapeId | undefined;
|
||||||
findShapeAncestor(shape: TLShape | TLShapeId, predicate: (parent: TLShape) => boolean): TLShape | undefined;
|
findShapeAncestor(shape: TLShape | TLShapeId, predicate: (parent: TLShape) => boolean): TLShape | undefined;
|
||||||
flipShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
|
flipShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get focusedGroup(): TLShape | undefined;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get focusedGroupId(): TLPageId | TLShapeId;
|
|
||||||
getAncestorPageId(shape?: TLShape | TLShapeId): TLPageId | undefined;
|
getAncestorPageId(shape?: TLShape | TLShapeId): TLPageId | undefined;
|
||||||
getArrowInfo(shape: TLArrowShape | TLShapeId): TLArrowInfo | undefined;
|
getArrowInfo(shape: TLArrowShape | TLShapeId): TLArrowInfo | undefined;
|
||||||
getArrowsBoundTo(shapeId: TLShapeId): {
|
getArrowsBoundTo(shapeId: TLShapeId): {
|
||||||
|
@ -806,15 +762,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
getZoomLevel(): number;
|
getZoomLevel(): number;
|
||||||
groupShapes(shapes: TLShape[] | TLShapeId[], groupId?: TLShapeId): this;
|
groupShapes(shapes: TLShape[] | TLShapeId[], groupId?: TLShapeId): this;
|
||||||
hasAncestor(shape: TLShape | TLShapeId | undefined, ancestorId: TLShapeId): boolean;
|
hasAncestor(shape: TLShape | TLShapeId | undefined, ancestorId: TLShapeId): boolean;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get hintingShape(): NonNullable<TLShape | undefined>[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get hintingShapeIds(): TLShapeId[];
|
|
||||||
readonly history: HistoryManager<this>;
|
readonly history: HistoryManager<this>;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get hoveredShape(): TLShape | undefined;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get hoveredShapeId(): null | TLShapeId;
|
|
||||||
inputs: {
|
inputs: {
|
||||||
originPagePoint: Vec2d;
|
originPagePoint: Vec2d;
|
||||||
originScreenPoint: Vec2d;
|
originScreenPoint: Vec2d;
|
||||||
|
@ -835,14 +783,10 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
isPanning: boolean;
|
isPanning: boolean;
|
||||||
pointerVelocity: Vec2d;
|
pointerVelocity: Vec2d;
|
||||||
};
|
};
|
||||||
// @deprecated (undocumented)
|
|
||||||
get instanceState(): TLInstance;
|
|
||||||
interrupt(): this;
|
interrupt(): this;
|
||||||
isAncestorSelected(shape: TLShape | TLShapeId): boolean;
|
isAncestorSelected(shape: TLShape | TLShapeId): boolean;
|
||||||
isIn(path: string): boolean;
|
isIn(path: string): boolean;
|
||||||
isInAny(...paths: string[]): boolean;
|
isInAny(...paths: string[]): boolean;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get isMenuOpen(): boolean;
|
|
||||||
isPointInShape(shape: TLShape | TLShapeId, point: VecLike, opts?: {
|
isPointInShape(shape: TLShape | TLShapeId, point: VecLike, opts?: {
|
||||||
margin?: number | undefined;
|
margin?: number | undefined;
|
||||||
hitInside?: boolean | undefined;
|
hitInside?: boolean | undefined;
|
||||||
|
@ -857,15 +801,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
mark(markId?: string, onUndo?: boolean, onRedo?: boolean): this;
|
mark(markId?: string, onUndo?: boolean, onRedo?: boolean): this;
|
||||||
moveShapesToPage(shapes: TLShape[] | TLShapeId[], pageId: TLPageId): this;
|
moveShapesToPage(shapes: TLShape[] | TLShapeId[], pageId: TLPageId): this;
|
||||||
nudgeShapes(shapes: TLShape[] | TLShapeId[], offset: VecLike, historyOptions?: TLCommandHistoryOptions): this;
|
nudgeShapes(shapes: TLShape[] | TLShapeId[], offset: VecLike, historyOptions?: TLCommandHistoryOptions): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get onlySelectedShape(): null | TLShape;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get openMenus(): string[];
|
|
||||||
packShapes(shapes: TLShape[] | TLShapeId[], gap: number): this;
|
packShapes(shapes: TLShape[] | TLShapeId[], gap: number): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get pages(): TLPage[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get pageStates(): TLInstancePageState[];
|
|
||||||
pageToScreen(point: VecLike): {
|
pageToScreen(point: VecLike): {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
|
@ -889,22 +825,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
type: T;
|
type: T;
|
||||||
} : TLExternalContent) => void) | null): this;
|
} : TLExternalContent) => void) | null): this;
|
||||||
renamePage(page: TLPage | TLPageId, name: string, historyOptions?: TLCommandHistoryOptions): this;
|
renamePage(page: TLPage | TLPageId, name: string, historyOptions?: TLCommandHistoryOptions): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get renderingBounds(): Box2d;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get renderingBoundsExpanded(): Box2d;
|
|
||||||
renderingBoundsMargin: number;
|
renderingBoundsMargin: number;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get renderingShapes(): {
|
|
||||||
id: TLShapeId;
|
|
||||||
shape: TLShape;
|
|
||||||
util: ShapeUtil<TLUnknownShape>;
|
|
||||||
index: number;
|
|
||||||
backgroundIndex: number;
|
|
||||||
opacity: number;
|
|
||||||
isCulled: boolean;
|
|
||||||
maskedPageBounds: Box2d | undefined;
|
|
||||||
}[];
|
|
||||||
reparentShapes(shapes: TLShape[] | TLShapeId[], parentId: TLParentId, insertIndex?: string): this;
|
reparentShapes(shapes: TLShape[] | TLShapeId[], parentId: TLParentId, insertIndex?: string): this;
|
||||||
resetZoom(point?: Vec2d, animation?: TLAnimationOptions): this;
|
resetZoom(point?: Vec2d, animation?: TLAnimationOptions): this;
|
||||||
resizeShape(shape: TLShape | TLShapeId, scale: VecLike, options?: TLResizeShapeOptions): this;
|
resizeShape(shape: TLShape | TLShapeId, scale: VecLike, options?: TLResizeShapeOptions): this;
|
||||||
|
@ -918,16 +839,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
readonly scribbles: ScribbleManager;
|
readonly scribbles: ScribbleManager;
|
||||||
select(...shapes: TLShape[] | TLShapeId[]): this;
|
select(...shapes: TLShape[] | TLShapeId[]): this;
|
||||||
selectAll(): this;
|
selectAll(): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get selectedShapeIds(): TLShapeId[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get selectedShapes(): TLShape[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get selectionPageBounds(): Box2d | null;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get selectionRotatedPageBounds(): Box2d | undefined;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get selectionRotation(): number;
|
|
||||||
selectNone(): this;
|
selectNone(): this;
|
||||||
sendBackward(shapes: TLShape[] | TLShapeId[]): this;
|
sendBackward(shapes: TLShape[] | TLShapeId[]): this;
|
||||||
sendToBack(shapes: TLShape[] | TLShapeId[]): this;
|
sendToBack(shapes: TLShape[] | TLShapeId[]): this;
|
||||||
|
@ -949,10 +860,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
shapeUtils: {
|
shapeUtils: {
|
||||||
readonly [K in string]?: ShapeUtil<TLUnknownShape>;
|
readonly [K in string]?: ShapeUtil<TLUnknownShape>;
|
||||||
};
|
};
|
||||||
// @deprecated (undocumented)
|
|
||||||
get sharedOpacity(): SharedStyle<number>;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get sharedStyles(): ReadonlySharedStyleMap;
|
|
||||||
readonly sideEffects: SideEffectManager<this>;
|
readonly sideEffects: SideEffectManager<this>;
|
||||||
slideCamera(opts?: {
|
slideCamera(opts?: {
|
||||||
speed: number;
|
speed: number;
|
||||||
|
@ -988,18 +895,8 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
updateShapes<T extends TLUnknownShape>(partials: (null | TLShapePartial<T> | undefined)[], historyOptions?: TLCommandHistoryOptions): this;
|
updateShapes<T extends TLUnknownShape>(partials: (null | TLShapePartial<T> | undefined)[], historyOptions?: TLCommandHistoryOptions): this;
|
||||||
updateViewportScreenBounds(center?: boolean): this;
|
updateViewportScreenBounds(center?: boolean): this;
|
||||||
readonly user: UserPreferencesManager;
|
readonly user: UserPreferencesManager;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get viewportPageBounds(): Box2d;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get viewportPageCenter(): Vec2d;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get viewportScreenBounds(): Box2d;
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get viewportScreenCenter(): Vec2d;
|
|
||||||
visitDescendants(parent: TLPage | TLParentId | TLShape, visitor: (id: TLShapeId) => false | void): this;
|
visitDescendants(parent: TLPage | TLParentId | TLShape, visitor: (id: TLShapeId) => false | void): this;
|
||||||
zoomIn(point?: Vec2d, animation?: TLAnimationOptions): this;
|
zoomIn(point?: Vec2d, animation?: TLAnimationOptions): this;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get zoomLevel(): number;
|
|
||||||
zoomOut(point?: Vec2d, animation?: TLAnimationOptions): this;
|
zoomOut(point?: Vec2d, animation?: TLAnimationOptions): this;
|
||||||
zoomToBounds(bounds: Box2d, targetZoom?: number, animation?: TLAnimationOptions): this;
|
zoomToBounds(bounds: Box2d, targetZoom?: number, animation?: TLAnimationOptions): this;
|
||||||
zoomToContent(): this;
|
zoomToContent(): this;
|
||||||
|
@ -1808,8 +1705,6 @@ export class SnapManager {
|
||||||
constructor(editor: Editor);
|
constructor(editor: Editor);
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
clear(): void;
|
clear(): void;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentCommonAncestor(): TLShapeId | undefined;
|
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
readonly editor: Editor;
|
readonly editor: Editor;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
|
@ -1836,18 +1731,8 @@ export class SnapManager {
|
||||||
horizontal: Gap[];
|
horizontal: Gap[];
|
||||||
vertical: Gap[];
|
vertical: Gap[];
|
||||||
};
|
};
|
||||||
// @deprecated (undocumented)
|
|
||||||
get lines(): SnapLine[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get outlinesInPageSpace(): Vec2d[][];
|
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
setLines(lines: SnapLine[]): void;
|
setLines(lines: SnapLine[]): void;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get snappablePoints(): SnapPoint[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get snappableShapes(): GapNode[];
|
|
||||||
// @deprecated (undocumented)
|
|
||||||
get snapPointsCache(): ComputedCache<SnapPoint[], TLShape>;
|
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
snapResize({ initialSelectionPageBounds, dragDelta, handle: originalHandle, isAspectRatioLocked, isResizingFromCenter, }: {
|
snapResize({ initialSelectionPageBounds, dragDelta, handle: originalHandle, isAspectRatioLocked, isResizingFromCenter, }: {
|
||||||
initialSelectionPageBounds: Box2d;
|
initialSelectionPageBounds: Box2d;
|
||||||
|
@ -1856,8 +1741,6 @@ export class SnapManager {
|
||||||
isAspectRatioLocked: boolean;
|
isAspectRatioLocked: boolean;
|
||||||
isResizingFromCenter: boolean;
|
isResizingFromCenter: boolean;
|
||||||
}): SnapData;
|
}): SnapData;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get snapThreshold(): number;
|
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
snapTranslate({ lockedAxis, initialSelectionPageBounds, initialSelectionSnapPoints, dragDelta, }: {
|
snapTranslate({ lockedAxis, initialSelectionPageBounds, initialSelectionSnapPoints, dragDelta, }: {
|
||||||
lockedAxis: 'x' | 'y' | null;
|
lockedAxis: 'x' | 'y' | null;
|
||||||
|
@ -1865,11 +1748,6 @@ export class SnapManager {
|
||||||
initialSelectionPageBounds: Box2d;
|
initialSelectionPageBounds: Box2d;
|
||||||
dragDelta: Vec2d;
|
dragDelta: Vec2d;
|
||||||
}): SnapData;
|
}): SnapData;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get visibleGaps(): {
|
|
||||||
horizontal: Gap[];
|
|
||||||
vertical: Gap[];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
|
@ -1911,9 +1789,6 @@ export abstract class StateNode implements Partial<TLEventHandlers> {
|
||||||
static children?: () => TLStateNodeConstructor[];
|
static children?: () => TLStateNodeConstructor[];
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
children?: Record<string, StateNode>;
|
children?: Record<string, StateNode>;
|
||||||
// @deprecated (undocumented)
|
|
||||||
get currentToolIdMask(): string | undefined;
|
|
||||||
set currentToolIdMask(id: string | undefined);
|
|
||||||
_currentToolIdMask: Atom<string | undefined, unknown>;
|
_currentToolIdMask: Atom<string | undefined, unknown>;
|
||||||
// (undocumented)
|
// (undocumented)
|
||||||
editor: Editor;
|
editor: Editor;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -49,7 +49,6 @@ import {
|
||||||
hasOwnProperty,
|
hasOwnProperty,
|
||||||
sortById,
|
sortById,
|
||||||
structuredClone,
|
structuredClone,
|
||||||
warnDeprecatedGetter,
|
|
||||||
} from '@tldraw/utils'
|
} from '@tldraw/utils'
|
||||||
import { EventEmitter } from 'eventemitter3'
|
import { EventEmitter } from 'eventemitter3'
|
||||||
import { TLUser, createTLUser } from '../config/createTLUser'
|
import { TLUser, createTLUser } from '../config/createTLUser'
|
||||||
|
@ -805,15 +804,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.history.getNumUndos() > 0
|
return this.history.getNumUndos() > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCanUndo` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get canUndo(): boolean {
|
|
||||||
warnDeprecatedGetter('canUndo')
|
|
||||||
return this.getCanUndo()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redo to the next mark.
|
* Redo to the next mark.
|
||||||
*
|
*
|
||||||
|
@ -838,15 +828,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.history.getNumRedos() > 0
|
return this.history.getNumRedos() > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCanRedo` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get canRedo(): boolean {
|
|
||||||
warnDeprecatedGetter('canRedo')
|
|
||||||
return this.getCanRedo()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
|
* Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
|
||||||
* any redos.
|
* any redos.
|
||||||
|
@ -1144,15 +1125,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.root.getCurrent()!
|
return this.root.getCurrent()!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentTool` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentTool() {
|
|
||||||
warnDeprecatedGetter('currentTool')
|
|
||||||
return this.getCurrentTool()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The id of the current selected tool.
|
* The id of the current selected tool.
|
||||||
*
|
*
|
||||||
|
@ -1164,15 +1136,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return currentTool.getCurrentToolIdMask() ?? currentTool.id
|
return currentTool.getCurrentToolIdMask() ?? currentTool.id
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentToolId` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentToolId() {
|
|
||||||
warnDeprecatedGetter('currentToolId')
|
|
||||||
return this.getCurrentToolId()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a descendant by its path.
|
* Get a descendant by its path.
|
||||||
*
|
*
|
||||||
|
@ -1210,15 +1173,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.store.get(TLDOCUMENT_ID)!
|
return this.store.get(TLDOCUMENT_ID)!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getDocumentSettings` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get documentSettings() {
|
|
||||||
warnDeprecatedGetter('documentSettings')
|
|
||||||
return this.getDocumentSettings()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the global document settings that apply to all users.
|
* Update the global document settings that apply to all users.
|
||||||
*
|
*
|
||||||
|
@ -1240,15 +1194,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.store.get(TLINSTANCE_ID)!
|
return this.store.get(TLINSTANCE_ID)!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getInstanceState` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get instanceState() {
|
|
||||||
warnDeprecatedGetter('instanceState')
|
|
||||||
return this.getInstanceState()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the instance's state.
|
* Update the instance's state.
|
||||||
*
|
*
|
||||||
|
@ -1326,15 +1271,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getInstanceState().openMenus
|
return this.getInstanceState().openMenus
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getOpenMenus` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get openMenus() {
|
|
||||||
warnDeprecatedGetter('openMenus')
|
|
||||||
return this.getOpenMenus()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an open menu.
|
* Add an open menu.
|
||||||
*
|
*
|
||||||
|
@ -1387,15 +1323,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getOpenMenus().length > 0
|
return this.getOpenMenus().length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getIsMenuOpen` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get isMenuOpen() {
|
|
||||||
warnDeprecatedGetter('isMenuOpen')
|
|
||||||
return this.getIsMenuOpen()
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------- Cursor --------------------- */
|
/* --------------------- Cursor --------------------- */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1425,15 +1352,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this._getPageStatesQuery().get()
|
return this._getPageStatesQuery().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getPageStates` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get pageStates() {
|
|
||||||
warnDeprecatedGetter('pageStates')
|
|
||||||
return this.getPageStates()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
@computed private _getPageStatesQuery() {
|
@computed private _getPageStatesQuery() {
|
||||||
return this.store.query.records('instance_page_state')
|
return this.store.query.records('instance_page_state')
|
||||||
|
@ -1448,15 +1366,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.store.get(this._getCurrentPageStateId())!
|
return this.store.get(this._getCurrentPageStateId())!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentPageState` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentPageState() {
|
|
||||||
warnDeprecatedGetter('currentPageState')
|
|
||||||
return this.getCurrentPageState()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
@computed private _getCurrentPageStateId() {
|
@computed private _getCurrentPageStateId() {
|
||||||
return InstancePageStateRecordType.createId(this.getCurrentPageId())
|
return InstancePageStateRecordType.createId(this.getCurrentPageId())
|
||||||
|
@ -1515,15 +1424,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getCurrentPageState().selectedShapeIds
|
return this.getCurrentPageState().selectedShapeIds
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getSelectedShapeIds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get selectedShapeIds() {
|
|
||||||
warnDeprecatedGetter('selectedShapeIds')
|
|
||||||
return this.getSelectedShapeIds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array containing all of the currently selected shapes.
|
* An array containing all of the currently selected shapes.
|
||||||
*
|
*
|
||||||
|
@ -1535,15 +1435,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return compact(selectedShapeIds.map((id) => this.store.get(id)))
|
return compact(selectedShapeIds.map((id) => this.store.get(id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getSelectedShapes` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get selectedShapes() {
|
|
||||||
warnDeprecatedGetter('selectedShapes')
|
|
||||||
return this.getSelectedShapes()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select one or more shapes.
|
* Select one or more shapes.
|
||||||
*
|
*
|
||||||
|
@ -1713,15 +1604,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return selectedShapes.length === 1 ? selectedShapes[0] : null
|
return selectedShapes.length === 1 ? selectedShapes[0] : null
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getOnlySelectedShape` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get onlySelectedShape() {
|
|
||||||
warnDeprecatedGetter('onlySelectedShape')
|
|
||||||
return this.getOnlySelectedShape()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current page bounds of all the selected shapes. If the
|
* The current page bounds of all the selected shapes. If the
|
||||||
* selection is rotated, then these bounds are the axis-aligned
|
* selection is rotated, then these bounds are the axis-aligned
|
||||||
|
@ -1738,15 +1620,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return Box2d.Common(compact(selectedShapeIds.map((id) => this.getShapePageBounds(id))))
|
return Box2d.Common(compact(selectedShapeIds.map((id) => this.getShapePageBounds(id))))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getSelectionPageBounds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get selectionPageBounds() {
|
|
||||||
warnDeprecatedGetter('selectionPageBounds')
|
|
||||||
return this.getSelectionPageBounds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The rotation of the selection bounding box in the current page space.
|
* The rotation of the selection bounding box in the current page space.
|
||||||
*
|
*
|
||||||
|
@ -1769,16 +1642,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getSelectionRotation` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get selectionRotation() {
|
|
||||||
warnDeprecatedGetter('selectionRotation')
|
|
||||||
return this.getSelectionRotation()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The bounds of the selection bounding box in the current page space.
|
* The bounds of the selection bounding box in the current page space.
|
||||||
*
|
*
|
||||||
|
@ -1819,15 +1682,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return boxFromRotatedVertices
|
return boxFromRotatedVertices
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getSelectionRotatedPageBounds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get selectionRotatedPageBounds() {
|
|
||||||
warnDeprecatedGetter('selectionRotatedPageBounds')
|
|
||||||
return this.getSelectionRotatedPageBounds()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Focus Group
|
// Focus Group
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1839,15 +1693,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getCurrentPageState().focusedGroupId ?? this.getCurrentPageId()
|
return this.getCurrentPageState().focusedGroupId ?? this.getCurrentPageId()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getFocusedGroupId` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get focusedGroupId() {
|
|
||||||
warnDeprecatedGetter('focusedGroupId')
|
|
||||||
return this.getFocusedGroupId()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current focused group.
|
* The current focused group.
|
||||||
*
|
*
|
||||||
|
@ -1858,15 +1703,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return focusedGroupId ? this.getShape(focusedGroupId) : undefined
|
return focusedGroupId ? this.getShape(focusedGroupId) : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getFocusedGroup` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get focusedGroup() {
|
|
||||||
warnDeprecatedGetter('focusedGroup')
|
|
||||||
return this.getFocusedGroup()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current focused group shape.
|
* Set the current focused group shape.
|
||||||
*
|
*
|
||||||
|
@ -1957,15 +1793,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getCurrentPageState().editingShapeId
|
return this.getCurrentPageState().editingShapeId
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getEditingShapeId` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get editingShapeId() {
|
|
||||||
warnDeprecatedGetter('editingShapeId')
|
|
||||||
return this.getEditingShapeId()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current editing shape.
|
* The current editing shape.
|
||||||
*
|
*
|
||||||
|
@ -1976,15 +1803,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return editingShapeId ? this.getShape(editingShapeId) : undefined
|
return editingShapeId ? this.getShape(editingShapeId) : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getEditingShape` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get editingShape() {
|
|
||||||
warnDeprecatedGetter('editingShape')
|
|
||||||
return this.getEditingShape()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current editing shape.
|
* Set the current editing shape.
|
||||||
*
|
*
|
||||||
|
@ -2027,15 +1845,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getCurrentPageState().hoveredShapeId
|
return this.getCurrentPageState().hoveredShapeId
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getHoveredShapeId` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get hoveredShapeId() {
|
|
||||||
warnDeprecatedGetter('hoveredShapeId')
|
|
||||||
return this.getHoveredShapeId()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current hovered shape.
|
* The current hovered shape.
|
||||||
*
|
*
|
||||||
|
@ -2045,16 +1854,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
const hoveredShapeId = this.getHoveredShapeId()
|
const hoveredShapeId = this.getHoveredShapeId()
|
||||||
return hoveredShapeId ? this.getShape(hoveredShapeId) : undefined
|
return hoveredShapeId ? this.getShape(hoveredShapeId) : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getHoveredShape` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get hoveredShape() {
|
|
||||||
warnDeprecatedGetter('hoveredShape')
|
|
||||||
return this.getHoveredShape()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the editor's current hovered shape.
|
* Set the editor's current hovered shape.
|
||||||
*
|
*
|
||||||
|
@ -2085,16 +1884,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
@computed getHintingShapeIds() {
|
@computed getHintingShapeIds() {
|
||||||
return this.getCurrentPageState().hintingShapeIds
|
return this.getCurrentPageState().hintingShapeIds
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getHintingShapeIds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get hintingShapeIds() {
|
|
||||||
warnDeprecatedGetter('hintingShapeIds')
|
|
||||||
return this.getHintingShapeIds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The editor's current hinting shapes.
|
* The editor's current hinting shapes.
|
||||||
*
|
*
|
||||||
|
@ -2105,15 +1894,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return compact(hintingShapeIds.map((id) => this.getShape(id)))
|
return compact(hintingShapeIds.map((id) => this.getShape(id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getHintingShape` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get hintingShape() {
|
|
||||||
warnDeprecatedGetter('hintingShape')
|
|
||||||
return this.getHintingShape()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the editor's current hinting shapes.
|
* Set the editor's current hinting shapes.
|
||||||
*
|
*
|
||||||
|
@ -2148,15 +1928,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getCurrentPageState().erasingShapeIds
|
return this.getCurrentPageState().erasingShapeIds
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getErasingShapeIds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get erasingShapeIds() {
|
|
||||||
warnDeprecatedGetter('erasingShapeIds')
|
|
||||||
return this.getErasingShapeIds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The editor's current erasing shapes.
|
* The editor's current erasing shapes.
|
||||||
*
|
*
|
||||||
|
@ -2167,15 +1938,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return compact(erasingShapeIds.map((id) => this.getShape(id)))
|
return compact(erasingShapeIds.map((id) => this.getShape(id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getErasingShapes` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get erasingShapes() {
|
|
||||||
warnDeprecatedGetter('erasingShapes')
|
|
||||||
return this.getErasingShapes()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the editor's current erasing shapes.
|
* Set the editor's current erasing shapes.
|
||||||
*
|
*
|
||||||
|
@ -2225,15 +1987,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getCurrentPageState().croppingShapeId
|
return this.getCurrentPageState().croppingShapeId
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCroppingShapeId` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get croppingShapeId() {
|
|
||||||
warnDeprecatedGetter('croppingShapeId')
|
|
||||||
return this.getCroppingShapeId()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current cropping shape.
|
* Set the current cropping shape.
|
||||||
*
|
*
|
||||||
|
@ -2290,15 +2043,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getCamera().z
|
return this.getCamera().z
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getZoomLevel` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get zoomLevel() {
|
|
||||||
warnDeprecatedGetter('zoomLevel')
|
|
||||||
return this.getZoomLevel()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
private _setCamera(point: VecLike): this {
|
private _setCamera(point: VecLike): this {
|
||||||
const currentCamera = this.getCamera()
|
const currentCamera = this.getCamera()
|
||||||
|
@ -3003,15 +2747,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return new Box2d(x, y, w, h)
|
return new Box2d(x, y, w, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getViewportScreenBounds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get viewportScreenBounds() {
|
|
||||||
warnDeprecatedGetter('viewportScreenBounds')
|
|
||||||
return this.getViewportScreenBounds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The center of the editor's viewport in screen space.
|
* The center of the editor's viewport in screen space.
|
||||||
*
|
*
|
||||||
|
@ -3020,16 +2755,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
@computed getViewportScreenCenter() {
|
@computed getViewportScreenCenter() {
|
||||||
return this.getViewportScreenBounds().center
|
return this.getViewportScreenBounds().center
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getViewportScreenCenter` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get viewportScreenCenter() {
|
|
||||||
warnDeprecatedGetter('viewportScreenCenter')
|
|
||||||
return this.getViewportScreenCenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current viewport in the current page space.
|
* The current viewport in the current page space.
|
||||||
*
|
*
|
||||||
|
@ -3041,15 +2766,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return new Box2d(-cx, -cy, w / cz, h / cz)
|
return new Box2d(-cx, -cy, w / cz, h / cz)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getViewportPageBounds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get viewportPageBounds() {
|
|
||||||
warnDeprecatedGetter('viewportPageBounds')
|
|
||||||
return this.getViewportPageBounds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The center of the viewport in the current page space.
|
* The center of the viewport in the current page space.
|
||||||
*
|
*
|
||||||
|
@ -3058,16 +2774,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
@computed getViewportPageCenter() {
|
@computed getViewportPageCenter() {
|
||||||
return this.getViewportPageBounds().center
|
return this.getViewportPageBounds().center
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getViewportPageCenter` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get viewportPageCenter() {
|
|
||||||
warnDeprecatedGetter('viewportPageCenter')
|
|
||||||
return this.getViewportPageCenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a point in screen space to a point in the current page space.
|
* Convert a point in screen space to a point in the current page space.
|
||||||
*
|
*
|
||||||
|
@ -3264,15 +2970,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this._cameraState.get()
|
return this._cameraState.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCameraState` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get cameraState() {
|
|
||||||
warnDeprecatedGetter('cameraState')
|
|
||||||
return this.getCameraState()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Camera state does two things: first, it allows us to subscribe to whether
|
// Camera state does two things: first, it allows us to subscribe to whether
|
||||||
// the camera is moving or not; and second, it allows us to update the rendering
|
// the camera is moving or not; and second, it allows us to update the rendering
|
||||||
// shapes on the canvas. Changing the rendering shapes may cause shapes to
|
// shapes on the canvas. Changing the rendering shapes may cause shapes to
|
||||||
|
@ -3441,15 +3138,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return renderingShapes.sort(sortById)
|
return renderingShapes.sort(sortById)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getRenderingShapes` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get renderingShapes() {
|
|
||||||
warnDeprecatedGetter('renderingShapes')
|
|
||||||
return this.getRenderingShapes()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current rendering bounds in the current page space, used for checking which shapes are "on screen".
|
* The current rendering bounds in the current page space, used for checking which shapes are "on screen".
|
||||||
*
|
*
|
||||||
|
@ -3459,15 +3147,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this._renderingBounds.get()
|
return this._renderingBounds.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getRenderingBounds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get renderingBounds() {
|
|
||||||
warnDeprecatedGetter('renderingBounds')
|
|
||||||
return this.getRenderingBounds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
private readonly _renderingBounds = atom('rendering viewport', new Box2d())
|
private readonly _renderingBounds = atom('rendering viewport', new Box2d())
|
||||||
|
|
||||||
|
@ -3481,15 +3160,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this._renderingBoundsExpanded.get()
|
return this._renderingBoundsExpanded.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getRenderingBoundsExpanded` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get renderingBoundsExpanded() {
|
|
||||||
warnDeprecatedGetter('renderingBoundsExpanded')
|
|
||||||
return this.getRenderingBoundsExpanded()
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
private readonly _renderingBoundsExpanded = atom('rendering viewport expanded', new Box2d())
|
private readonly _renderingBoundsExpanded = atom('rendering viewport expanded', new Box2d())
|
||||||
|
|
||||||
|
@ -3543,15 +3213,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this._getAllPagesQuery().get().sort(sortByIndex)
|
return this._getAllPagesQuery().get().sort(sortByIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getPages` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get pages() {
|
|
||||||
warnDeprecatedGetter('pages')
|
|
||||||
return this.getPages()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current page.
|
* The current page.
|
||||||
*
|
*
|
||||||
|
@ -3561,15 +3222,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getPage(this.getCurrentPageId())!
|
return this.getPage(this.getCurrentPageId())!
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getCurrentPage` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentPage() {
|
|
||||||
warnDeprecatedGetter('currentPage')
|
|
||||||
return this.getCurrentPage()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current page id.
|
* The current page id.
|
||||||
*
|
*
|
||||||
|
@ -3579,15 +3231,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this.getInstanceState().currentPageId
|
return this.getInstanceState().currentPageId
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentPageId` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentPageId() {
|
|
||||||
warnDeprecatedGetter('currentPageId')
|
|
||||||
return this.getCurrentPageId()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a page.
|
* Get a page.
|
||||||
*
|
*
|
||||||
|
@ -3616,14 +3259,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
getCurrentPageShapeIds() {
|
getCurrentPageShapeIds() {
|
||||||
return this._currentPageShapeIds.get()
|
return this._currentPageShapeIds.get()
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentPageShapeIds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentPageShapeIds() {
|
|
||||||
warnDeprecatedGetter('currentPageShapeIds')
|
|
||||||
return this.getCurrentPageShapeIds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the ids of shapes on a page.
|
* Get the ids of shapes on a page.
|
||||||
|
@ -3970,15 +3605,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return this._getAllAssetsQuery().get()
|
return this._getAllAssetsQuery().get()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getAssets` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get assets() {
|
|
||||||
warnDeprecatedGetter('assets')
|
|
||||||
return this.getAssets()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create one or more assets.
|
* Create one or more assets.
|
||||||
*
|
*
|
||||||
|
@ -4590,15 +4216,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return commonBounds
|
return commonBounds
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentPageBounds` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentPageBounds() {
|
|
||||||
warnDeprecatedGetter('currentPageBounds')
|
|
||||||
return this.getCurrentPageBounds()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the top-most selected shape at the given point, ignoring groups.
|
* Get the top-most selected shape at the given point, ignoring groups.
|
||||||
*
|
*
|
||||||
|
@ -4908,15 +4525,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return Array.from(this.getCurrentPageShapeIds(), (id) => this.store.get(id)! as TLShape)
|
return Array.from(this.getCurrentPageShapeIds(), (id) => this.store.get(id)! as TLShape)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentPageShapes` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentPageShapes() {
|
|
||||||
warnDeprecatedGetter('currentPageShapes')
|
|
||||||
return this.getCurrentPageShapes()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array containing all of the shapes in the current page, sorted in z-index order (accounting
|
* An array containing all of the shapes in the current page, sorted in z-index order (accounting
|
||||||
* for nested shapes): e.g. A, B, BA, BB, C.
|
* for nested shapes): e.g. A, B, BA, BB, C.
|
||||||
|
@ -4951,15 +4559,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentPageShapesSorted` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentPageShapesSorted() {
|
|
||||||
warnDeprecatedGetter('currentPageShapesSorted')
|
|
||||||
return this.getCurrentPageShapesSorted()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An array containing all of the rendering shapes in the current page, sorted in z-index order (accounting
|
* An array containing all of the rendering shapes in the current page, sorted in z-index order (accounting
|
||||||
* for nested shapes): e.g. A, B, BA, BB, C.
|
* for nested shapes): e.g. A, B, BA, BB, C.
|
||||||
|
@ -4973,15 +4572,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
.map(({ shape }) => shape)
|
.map(({ shape }) => shape)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `getCurrentPageRenderingShapesSorted` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentPageRenderingShapesSorted() {
|
|
||||||
warnDeprecatedGetter('currentPageRenderingShapesSorted')
|
|
||||||
return this.getCurrentPageRenderingShapesSorted()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether a shape matches the type of a TLShapeUtil.
|
* Get whether a shape matches the type of a TLShapeUtil.
|
||||||
*
|
*
|
||||||
|
@ -7673,15 +7263,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return styles
|
return styles
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `editor.sharedStyles` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get sharedStyles() {
|
|
||||||
warnDeprecatedGetter('sharedStyles')
|
|
||||||
return this.getSharedStyles()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the currently selected shared opacity.
|
* Get the currently selected shared opacity.
|
||||||
* If any shapes are selected, this returns the shared opacity of the selected shapes.
|
* If any shapes are selected, this returns the shared opacity of the selected shapes.
|
||||||
|
@ -7724,15 +7305,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
||||||
return { type: 'shared', value: this.getInstanceState().opacityForNextShape }
|
return { type: 'shared', value: this.getInstanceState().opacityForNextShape }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use `editor.sharedOpacity` instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get sharedOpacity() {
|
|
||||||
warnDeprecatedGetter('sharedOpacity')
|
|
||||||
return this.getSharedOpacity()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the opacity for the next shapes. This will effect subsequently created shapes.
|
* Set the opacity for the next shapes. This will effect subsequently created shapes.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { atom, transact } from '@tldraw/state'
|
import { atom, transact } from '@tldraw/state'
|
||||||
import { devFreeze } from '@tldraw/store'
|
import { devFreeze } from '@tldraw/store'
|
||||||
import { warnDeprecatedGetter } from '@tldraw/utils'
|
|
||||||
import { uniqueId } from '../../utils/uniqueId'
|
import { uniqueId } from '../../utils/uniqueId'
|
||||||
import { TLCommandHandler, TLCommandHistoryOptions, TLHistoryEntry } from '../types/history-types'
|
import { TLCommandHandler, TLCommandHistoryOptions, TLHistoryEntry } from '../types/history-types'
|
||||||
import { Stack, stack } from './Stack'
|
import { Stack, stack } from './Stack'
|
||||||
|
@ -37,27 +36,9 @@ export class HistoryManager<
|
||||||
getNumUndos() {
|
getNumUndos() {
|
||||||
return this._undos.get().length
|
return this._undos.get().length
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @deprecated use `getNumUndos` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get numUndos() {
|
|
||||||
warnDeprecatedGetter('numUndos')
|
|
||||||
return this.getNumUndos()
|
|
||||||
}
|
|
||||||
|
|
||||||
getNumRedos() {
|
getNumRedos() {
|
||||||
return this._redos.get().length
|
return this._redos.get().length
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @deprecated use `getNumRedos` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get numRedos() {
|
|
||||||
warnDeprecatedGetter('numRedos')
|
|
||||||
return this.getNumRedos()
|
|
||||||
}
|
|
||||||
|
|
||||||
createCommand = <Name extends string, Constructor extends CommandFn<any>>(
|
createCommand = <Name extends string, Constructor extends CommandFn<any>>(
|
||||||
name: Name,
|
name: Name,
|
||||||
constructor: Constructor,
|
constructor: Constructor,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { atom, computed, EMPTY_ARRAY } from '@tldraw/state'
|
import { atom, computed, EMPTY_ARRAY } from '@tldraw/state'
|
||||||
import { TLGroupShape, TLParentId, TLShape, TLShapeId, Vec2dModel } from '@tldraw/tlschema'
|
import { TLGroupShape, TLParentId, TLShape, TLShapeId, Vec2dModel } from '@tldraw/tlschema'
|
||||||
import { dedupe, deepCopy, warnDeprecatedGetter } from '@tldraw/utils'
|
import { dedupe, deepCopy } from '@tldraw/utils'
|
||||||
import {
|
import {
|
||||||
Box2d,
|
Box2d,
|
||||||
flipSelectionHandleX,
|
flipSelectionHandleX,
|
||||||
|
@ -216,15 +216,6 @@ export class SnapManager {
|
||||||
return this._snapLines.get() ?? (EMPTY_ARRAY as SnapLine[])
|
return this._snapLines.get() ?? (EMPTY_ARRAY as SnapLine[])
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getLines` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get lines() {
|
|
||||||
warnDeprecatedGetter('lines')
|
|
||||||
return this.getLines()
|
|
||||||
}
|
|
||||||
|
|
||||||
clear() {
|
clear() {
|
||||||
if (this.getLines().length) {
|
if (this.getLines().length) {
|
||||||
this._snapLines.set(undefined)
|
this._snapLines.set(undefined)
|
||||||
|
@ -250,28 +241,10 @@ export class SnapManager {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getSnapPointsCache` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get snapPointsCache() {
|
|
||||||
warnDeprecatedGetter('snapPointsCache')
|
|
||||||
return this.getSnapPointsCache()
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed getSnapThreshold() {
|
@computed getSnapThreshold() {
|
||||||
return 8 / this.editor.getZoomLevel()
|
return 8 / this.editor.getZoomLevel()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getSnapThreshold` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get snapThreshold() {
|
|
||||||
warnDeprecatedGetter('snapThreshold')
|
|
||||||
return this.getSnapThreshold()
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: make this an incremental derivation
|
// TODO: make this an incremental derivation
|
||||||
@computed getSnappableShapes(): GapNode[] {
|
@computed getSnappableShapes(): GapNode[] {
|
||||||
const { editor } = this
|
const { editor } = this
|
||||||
|
@ -311,30 +284,11 @@ export class SnapManager {
|
||||||
return snappableShapes
|
return snappableShapes
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getSnappableShapes` instead
|
|
||||||
*/
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get snappableShapes() {
|
|
||||||
warnDeprecatedGetter('snappableShapes')
|
|
||||||
return this.getSnappableShapes()
|
|
||||||
}
|
|
||||||
|
|
||||||
// This needs to be external from any expensive work
|
// This needs to be external from any expensive work
|
||||||
@computed getCurrentCommonAncestor() {
|
@computed getCurrentCommonAncestor() {
|
||||||
return this.editor.findCommonAncestor(this.editor.getSelectedShapes())
|
return this.editor.findCommonAncestor(this.editor.getSelectedShapes())
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getCurrentCommonAncestor` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentCommonAncestor() {
|
|
||||||
warnDeprecatedGetter('currentCommonAncestor')
|
|
||||||
return this.getCurrentCommonAncestor()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Points which belong to snappable shapes
|
// Points which belong to snappable shapes
|
||||||
@computed getSnappablePoints() {
|
@computed getSnappablePoints() {
|
||||||
const snapPointsCache = this.getSnapPointsCache()
|
const snapPointsCache = this.getSnapPointsCache()
|
||||||
|
@ -351,15 +305,6 @@ export class SnapManager {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getSnappablePoints` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get snappablePoints() {
|
|
||||||
warnDeprecatedGetter('snappablePoints')
|
|
||||||
return this.getSnappablePoints()
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed getVisibleGaps(): { horizontal: Gap[]; vertical: Gap[] } {
|
@computed getVisibleGaps(): { horizontal: Gap[]; vertical: Gap[] } {
|
||||||
const horizontal: Gap[] = []
|
const horizontal: Gap[] = []
|
||||||
const vertical: Gap[] = []
|
const vertical: Gap[] = []
|
||||||
|
@ -457,15 +402,6 @@ export class SnapManager {
|
||||||
return { horizontal, vertical }
|
return { horizontal, vertical }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getVisibleGaps` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get visibleGaps() {
|
|
||||||
warnDeprecatedGetter('visibleGaps')
|
|
||||||
return this.getVisibleGaps()
|
|
||||||
}
|
|
||||||
|
|
||||||
snapTranslate({
|
snapTranslate({
|
||||||
lockedAxis,
|
lockedAxis,
|
||||||
initialSelectionPageBounds,
|
initialSelectionPageBounds,
|
||||||
|
@ -569,15 +505,6 @@ export class SnapManager {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getOutlinesInPageSpace` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get outlinesInPageSpace() {
|
|
||||||
warnDeprecatedGetter('outlinesInPageSpace')
|
|
||||||
return this.getOutlinesInPageSpace()
|
|
||||||
}
|
|
||||||
|
|
||||||
getSnappingHandleDelta({
|
getSnappingHandleDelta({
|
||||||
handlePoint,
|
handlePoint,
|
||||||
additionalSegments,
|
additionalSegments,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { computed } from '@tldraw/state'
|
import { computed } from '@tldraw/state'
|
||||||
import { warnDeprecatedGetter } from '@tldraw/utils'
|
|
||||||
import {
|
import {
|
||||||
TLUserPreferences,
|
TLUserPreferences,
|
||||||
defaultUserPreferences,
|
defaultUserPreferences,
|
||||||
|
@ -27,15 +26,6 @@ export class UserPreferencesManager {
|
||||||
isSnapMode: this.getIsSnapMode(),
|
isSnapMode: this.getIsSnapMode(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* @deprecated use `getUserPreferences` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get userPreferences() {
|
|
||||||
warnDeprecatedGetter('userPreferences')
|
|
||||||
return this.getUserPreferences()
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed getIsDarkMode() {
|
@computed getIsDarkMode() {
|
||||||
return (
|
return (
|
||||||
this.user.userPreferences.get().isDarkMode ??
|
this.user.userPreferences.get().isDarkMode ??
|
||||||
|
@ -43,15 +33,6 @@ export class UserPreferencesManager {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getIsDarkMode` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get isDarkMode() {
|
|
||||||
warnDeprecatedGetter('isDarkMode')
|
|
||||||
return this.getIsDarkMode()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The speed at which the user can scroll by dragging toward the edge of the screen.
|
* The speed at which the user can scroll by dragging toward the edge of the screen.
|
||||||
*/
|
*/
|
||||||
|
@ -63,77 +44,23 @@ export class UserPreferencesManager {
|
||||||
return this.user.userPreferences.get().animationSpeed ?? defaultUserPreferences.animationSpeed
|
return this.user.userPreferences.get().animationSpeed ?? defaultUserPreferences.animationSpeed
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getAnimationSpeed` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get animationSpeed() {
|
|
||||||
warnDeprecatedGetter('animationSpeed')
|
|
||||||
return this.getAnimationSpeed()
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed getId() {
|
@computed getId() {
|
||||||
return this.user.userPreferences.get().id
|
return this.user.userPreferences.get().id
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getId` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get id() {
|
|
||||||
warnDeprecatedGetter('id')
|
|
||||||
return this.getId()
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed getName() {
|
@computed getName() {
|
||||||
return this.user.userPreferences.get().name ?? defaultUserPreferences.name
|
return this.user.userPreferences.get().name ?? defaultUserPreferences.name
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getName` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get name() {
|
|
||||||
warnDeprecatedGetter('name')
|
|
||||||
return this.getName()
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed getLocale() {
|
@computed getLocale() {
|
||||||
return this.user.userPreferences.get().locale ?? defaultUserPreferences.locale
|
return this.user.userPreferences.get().locale ?? defaultUserPreferences.locale
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getLocale` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get locale() {
|
|
||||||
warnDeprecatedGetter('locale')
|
|
||||||
return this.getLocale()
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed getColor() {
|
@computed getColor() {
|
||||||
return this.user.userPreferences.get().color ?? defaultUserPreferences.color
|
return this.user.userPreferences.get().color ?? defaultUserPreferences.color
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getColor` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get color() {
|
|
||||||
warnDeprecatedGetter('color')
|
|
||||||
return this.getColor()
|
|
||||||
}
|
|
||||||
|
|
||||||
@computed getIsSnapMode() {
|
@computed getIsSnapMode() {
|
||||||
return this.user.userPreferences.get().isSnapMode ?? defaultUserPreferences.isSnapMode
|
return this.user.userPreferences.get().isSnapMode ?? defaultUserPreferences.isSnapMode
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getIsSnapMode` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get isSnapMode() {
|
|
||||||
warnDeprecatedGetter('isSnapMode')
|
|
||||||
return this.getIsSnapMode()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { Atom, Computed, atom, computed } from '@tldraw/state'
|
import { Atom, Computed, atom, computed } from '@tldraw/state'
|
||||||
import { warnDeprecatedGetter } from '@tldraw/utils'
|
|
||||||
import type { Editor } from '../Editor'
|
import type { Editor } from '../Editor'
|
||||||
import {
|
import {
|
||||||
EVENT_NAME_MAP,
|
EVENT_NAME_MAP,
|
||||||
|
@ -186,20 +185,6 @@ export abstract class StateNode implements Partial<TLEventHandlers> {
|
||||||
*/
|
*/
|
||||||
_currentToolIdMask = atom('curent tool id mask', undefined as string | undefined)
|
_currentToolIdMask = atom('curent tool id mask', undefined as string | undefined)
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated use `getCurrentToolIdMask()` instead
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get currentToolIdMask() {
|
|
||||||
warnDeprecatedGetter('currentToolIdMask')
|
|
||||||
return this._currentToolIdMask.get()
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
set currentToolIdMask(id: string | undefined) {
|
|
||||||
warnDeprecatedGetter('currentToolIdMask')
|
|
||||||
this._currentToolIdMask.set(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
getCurrentToolIdMask() {
|
getCurrentToolIdMask() {
|
||||||
return this._currentToolIdMask.get()
|
return this._currentToolIdMask.get()
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ function sharedStyleEquals<T>(a: SharedStyle<T>, b: SharedStyle<T> | undefined)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A map of {@link @tldraw/tlschema#StyleProp | StyleProps} to their {@link SharedStyle} values. See
|
* A map of {@link @tldraw/tlschema#StyleProp | StyleProps} to their {@link SharedStyle} values. See
|
||||||
* {@link Editor.sharedStyles}.
|
* {@link Editor.getSharedStyles}.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -102,8 +102,6 @@ export interface Signal<Value, Diff = unknown> {
|
||||||
getDiffSince(epoch: number): Diff[] | RESET_VALUE;
|
getDiffSince(epoch: number): Diff[] | RESET_VALUE;
|
||||||
lastChangedEpoch: number;
|
lastChangedEpoch: number;
|
||||||
name: string;
|
name: string;
|
||||||
// @deprecated (undocumented)
|
|
||||||
value: Value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @public
|
// @public
|
||||||
|
|
|
@ -2062,33 +2062,6 @@
|
||||||
"startIndex": 1,
|
"startIndex": 1,
|
||||||
"endIndex": 2
|
"endIndex": 2
|
||||||
}
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "PropertySignature",
|
|
||||||
"canonicalReference": "@tldraw/state!Signal#value:member",
|
|
||||||
"docComment": "/**\n * @deprecated\n *\n * Use [[Signal.get]] instead.\n */\n",
|
|
||||||
"excerptTokens": [
|
|
||||||
{
|
|
||||||
"kind": "Content",
|
|
||||||
"text": "value: "
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "Content",
|
|
||||||
"text": "Value"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"kind": "Content",
|
|
||||||
"text": ";"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"isReadonly": false,
|
|
||||||
"isOptional": false,
|
|
||||||
"releaseTag": "Public",
|
|
||||||
"name": "value",
|
|
||||||
"propertyTypeTokenRange": {
|
|
||||||
"startIndex": 1,
|
|
||||||
"endIndex": 2
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"extendsTokenRanges": []
|
"extendsTokenRanges": []
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { maybeCaptureParent } from './capture'
|
||||||
import { EMPTY_ARRAY, equals, singleton } from './helpers'
|
import { EMPTY_ARRAY, equals, singleton } from './helpers'
|
||||||
import { advanceGlobalEpoch, atomDidChange, getGlobalEpoch } from './transactions'
|
import { advanceGlobalEpoch, atomDidChange, getGlobalEpoch } from './transactions'
|
||||||
import { Child, ComputeDiff, RESET_VALUE, Signal } from './types'
|
import { Child, ComputeDiff, RESET_VALUE, Signal } from './types'
|
||||||
import { logDotValueWarning } from './warnings'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The options to configure an atom, passed into the [[atom]] function.
|
* The options to configure an atom, passed into the [[atom]] function.
|
||||||
|
@ -105,15 +104,6 @@ class __Atom__<Value, Diff = unknown> implements Atom<Value, Diff> {
|
||||||
return this.current
|
return this.current
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use [[Atom.get]] instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get value() {
|
|
||||||
logDotValueWarning()
|
|
||||||
return this.get()
|
|
||||||
}
|
|
||||||
|
|
||||||
set(value: Value, diff?: Diff): Value {
|
set(value: Value, diff?: Diff): Value {
|
||||||
// If the value has not changed, do nothing.
|
// If the value has not changed, do nothing.
|
||||||
if (this.isEqual?.(this.current, value) ?? equals(this.current, value)) {
|
if (this.isEqual?.(this.current, value) ?? equals(this.current, value)) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { GLOBAL_START_EPOCH } from './constants'
|
||||||
import { EMPTY_ARRAY, equals, haveParentsChanged, singleton } from './helpers'
|
import { EMPTY_ARRAY, equals, haveParentsChanged, singleton } from './helpers'
|
||||||
import { getGlobalEpoch } from './transactions'
|
import { getGlobalEpoch } from './transactions'
|
||||||
import { Child, ComputeDiff, RESET_VALUE, Signal } from './types'
|
import { Child, ComputeDiff, RESET_VALUE, Signal } from './types'
|
||||||
import { logComputedGetterWarning, logDotValueWarning } from './warnings'
|
import { logComputedGetterWarning } from './warnings'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
|
@ -218,15 +218,6 @@ class __UNSAFE__Computed<Value, Diff = unknown> implements Computed<Value, Diff>
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use [[get]] instead.
|
|
||||||
*/
|
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
|
||||||
get value() {
|
|
||||||
logDotValueWarning()
|
|
||||||
return this.get()
|
|
||||||
}
|
|
||||||
|
|
||||||
getDiffSince(epoch: number): RESET_VALUE | Diff[] {
|
getDiffSince(epoch: number): RESET_VALUE | Diff[] {
|
||||||
// need to call .get() to ensure both that this derivation is up to date
|
// need to call .get() to ensure both that this derivation is up to date
|
||||||
// and that tracking happens correctly
|
// and that tracking happens correctly
|
||||||
|
|
|
@ -27,10 +27,7 @@ export interface Signal<Value, Diff = unknown> {
|
||||||
* Any effect that depends on this signal will be rescheduled if this signal changes.
|
* Any effect that depends on this signal will be rescheduled if this signal changes.
|
||||||
*/
|
*/
|
||||||
get(): Value
|
get(): Value
|
||||||
/**
|
|
||||||
* @deprecated Use [[Signal.get]] instead.
|
|
||||||
*/
|
|
||||||
value: Value
|
|
||||||
/**
|
/**
|
||||||
* The epoch when this signal's value last changed. Note tha this is not the same as when the value was last computed.
|
* The epoch when this signal's value last changed. Note tha this is not the same as when the value was last computed.
|
||||||
* A signal may recopmute it's value without changing it.
|
* A signal may recopmute it's value without changing it.
|
||||||
|
|
Loading…
Reference in a new issue