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:
David Sheldrick 2023-12-19 10:39:58 +00:00 committed by GitHub
parent 1712d96daa
commit ded56e953a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 5 additions and 2776 deletions

View file

@ -575,21 +575,13 @@ export class Editor extends EventEmitter<TLEventMap> {
tags?: Record<string, boolean | number | string>;
extras?: Record<string, unknown>;
}): this;
// @deprecated (undocumented)
get assets(): (TLBookmarkAsset | TLImageAsset | TLVideoAsset)[];
bail(): this;
bailToMark(id: string): this;
batch(fn: () => void): this;
bringForward(shapes: TLShape[] | TLShapeId[]): this;
bringToFront(shapes: TLShape[] | TLShapeId[]): this;
// @deprecated (undocumented)
get cameraState(): "idle" | "moving";
cancel(): this;
cancelDoubleClick(): void;
// @deprecated (undocumented)
get canRedo(): boolean;
// @deprecated (undocumented)
get canUndo(): boolean;
// @internal (undocumented)
capturedPointerId: null | number;
centerOnPoint(point: VecLike, animation?: TLAnimationOptions): this;
@ -615,28 +607,6 @@ export class Editor extends EventEmitter<TLEventMap> {
createPage(page: Partial<TLPage>): this;
createShape<T extends TLUnknownShape>(shape: 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;
deleteOpenMenu(id: string): this;
deletePage(page: TLPage | TLPageId): this;
@ -651,19 +621,9 @@ export class Editor extends EventEmitter<TLEventMap> {
readonly disposables: Set<() => void>;
dispose(): void;
distributeShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
// @deprecated (undocumented)
get documentSettings(): TLDocument;
duplicatePage(page: TLPage | TLPageId, createId?: TLPageId): this;
duplicateShapes(shapes: TLShape[] | TLShapeId[], offset?: VecLike): this;
// @deprecated (undocumented)
get editingShape(): TLShape | undefined;
// @deprecated (undocumented)
get editingShapeId(): null | TLShapeId;
readonly environment: EnvironmentManager;
// @deprecated (undocumented)
get erasingShapeIds(): TLShapeId[];
// @deprecated (undocumented)
get erasingShapes(): NonNullable<TLShape | undefined>[];
// @internal (undocumented)
externalAssetContentHandlers: {
[K in TLExternalAssetContent['type']]: {
@ -683,10 +643,6 @@ export class Editor extends EventEmitter<TLEventMap> {
findCommonAncestor(shapes: TLShape[] | TLShapeId[], predicate?: (shape: TLShape) => boolean): TLShapeId | undefined;
findShapeAncestor(shape: TLShape | TLShapeId, predicate: (parent: TLShape) => boolean): TLShape | undefined;
flipShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
// @deprecated (undocumented)
get focusedGroup(): TLShape | undefined;
// @deprecated (undocumented)
get focusedGroupId(): TLPageId | TLShapeId;
getAncestorPageId(shape?: TLShape | TLShapeId): TLPageId | undefined;
getArrowInfo(shape: TLArrowShape | TLShapeId): TLArrowInfo | undefined;
getArrowsBoundTo(shapeId: TLShapeId): {
@ -806,15 +762,7 @@ export class Editor extends EventEmitter<TLEventMap> {
getZoomLevel(): number;
groupShapes(shapes: TLShape[] | TLShapeId[], groupId?: TLShapeId): this;
hasAncestor(shape: TLShape | TLShapeId | undefined, ancestorId: TLShapeId): boolean;
// @deprecated (undocumented)
get hintingShape(): NonNullable<TLShape | undefined>[];
// @deprecated (undocumented)
get hintingShapeIds(): TLShapeId[];
readonly history: HistoryManager<this>;
// @deprecated (undocumented)
get hoveredShape(): TLShape | undefined;
// @deprecated (undocumented)
get hoveredShapeId(): null | TLShapeId;
inputs: {
originPagePoint: Vec2d;
originScreenPoint: Vec2d;
@ -835,14 +783,10 @@ export class Editor extends EventEmitter<TLEventMap> {
isPanning: boolean;
pointerVelocity: Vec2d;
};
// @deprecated (undocumented)
get instanceState(): TLInstance;
interrupt(): this;
isAncestorSelected(shape: TLShape | TLShapeId): boolean;
isIn(path: string): boolean;
isInAny(...paths: string[]): boolean;
// @deprecated (undocumented)
get isMenuOpen(): boolean;
isPointInShape(shape: TLShape | TLShapeId, point: VecLike, opts?: {
margin?: number | undefined;
hitInside?: boolean | undefined;
@ -857,15 +801,7 @@ export class Editor extends EventEmitter<TLEventMap> {
mark(markId?: string, onUndo?: boolean, onRedo?: boolean): this;
moveShapesToPage(shapes: TLShape[] | TLShapeId[], pageId: TLPageId): 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;
// @deprecated (undocumented)
get pages(): TLPage[];
// @deprecated (undocumented)
get pageStates(): TLInstancePageState[];
pageToScreen(point: VecLike): {
x: number;
y: number;
@ -889,22 +825,7 @@ export class Editor extends EventEmitter<TLEventMap> {
type: T;
} : TLExternalContent) => void) | null): this;
renamePage(page: TLPage | TLPageId, name: string, historyOptions?: TLCommandHistoryOptions): this;
// @deprecated (undocumented)
get renderingBounds(): Box2d;
// @deprecated (undocumented)
get renderingBoundsExpanded(): Box2d;
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;
resetZoom(point?: Vec2d, animation?: TLAnimationOptions): this;
resizeShape(shape: TLShape | TLShapeId, scale: VecLike, options?: TLResizeShapeOptions): this;
@ -918,16 +839,6 @@ export class Editor extends EventEmitter<TLEventMap> {
readonly scribbles: ScribbleManager;
select(...shapes: TLShape[] | TLShapeId[]): 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;
sendBackward(shapes: TLShape[] | TLShapeId[]): this;
sendToBack(shapes: TLShape[] | TLShapeId[]): this;
@ -949,10 +860,6 @@ export class Editor extends EventEmitter<TLEventMap> {
shapeUtils: {
readonly [K in string]?: ShapeUtil<TLUnknownShape>;
};
// @deprecated (undocumented)
get sharedOpacity(): SharedStyle<number>;
// @deprecated (undocumented)
get sharedStyles(): ReadonlySharedStyleMap;
readonly sideEffects: SideEffectManager<this>;
slideCamera(opts?: {
speed: number;
@ -988,18 +895,8 @@ export class Editor extends EventEmitter<TLEventMap> {
updateShapes<T extends TLUnknownShape>(partials: (null | TLShapePartial<T> | undefined)[], historyOptions?: TLCommandHistoryOptions): this;
updateViewportScreenBounds(center?: boolean): this;
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;
zoomIn(point?: Vec2d, animation?: TLAnimationOptions): this;
// @deprecated (undocumented)
get zoomLevel(): number;
zoomOut(point?: Vec2d, animation?: TLAnimationOptions): this;
zoomToBounds(bounds: Box2d, targetZoom?: number, animation?: TLAnimationOptions): this;
zoomToContent(): this;
@ -1808,8 +1705,6 @@ export class SnapManager {
constructor(editor: Editor);
// (undocumented)
clear(): void;
// @deprecated (undocumented)
get currentCommonAncestor(): TLShapeId | undefined;
// (undocumented)
readonly editor: Editor;
// (undocumented)
@ -1836,18 +1731,8 @@ export class SnapManager {
horizontal: Gap[];
vertical: Gap[];
};
// @deprecated (undocumented)
get lines(): SnapLine[];
// @deprecated (undocumented)
get outlinesInPageSpace(): Vec2d[][];
// (undocumented)
setLines(lines: SnapLine[]): void;
// @deprecated (undocumented)
get snappablePoints(): SnapPoint[];
// @deprecated (undocumented)
get snappableShapes(): GapNode[];
// @deprecated (undocumented)
get snapPointsCache(): ComputedCache<SnapPoint[], TLShape>;
// (undocumented)
snapResize({ initialSelectionPageBounds, dragDelta, handle: originalHandle, isAspectRatioLocked, isResizingFromCenter, }: {
initialSelectionPageBounds: Box2d;
@ -1856,8 +1741,6 @@ export class SnapManager {
isAspectRatioLocked: boolean;
isResizingFromCenter: boolean;
}): SnapData;
// @deprecated (undocumented)
get snapThreshold(): number;
// (undocumented)
snapTranslate({ lockedAxis, initialSelectionPageBounds, initialSelectionSnapPoints, dragDelta, }: {
lockedAxis: 'x' | 'y' | null;
@ -1865,11 +1748,6 @@ export class SnapManager {
initialSelectionPageBounds: Box2d;
dragDelta: Vec2d;
}): SnapData;
// @deprecated (undocumented)
get visibleGaps(): {
horizontal: Gap[];
vertical: Gap[];
};
}
// @public (undocumented)
@ -1911,9 +1789,6 @@ export abstract class StateNode implements Partial<TLEventHandlers> {
static children?: () => TLStateNodeConstructor[];
// (undocumented)
children?: Record<string, StateNode>;
// @deprecated (undocumented)
get currentToolIdMask(): string | undefined;
set currentToolIdMask(id: string | undefined);
_currentToolIdMask: Atom<string | undefined, unknown>;
// (undocumented)
editor: Editor;

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,6 @@ import {
hasOwnProperty,
sortById,
structuredClone,
warnDeprecatedGetter,
} from '@tldraw/utils'
import { EventEmitter } from 'eventemitter3'
import { TLUser, createTLUser } from '../config/createTLUser'
@ -805,15 +804,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -838,15 +828,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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
* any redos.
@ -1144,15 +1125,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1164,15 +1136,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1210,15 +1173,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1240,15 +1194,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1326,15 +1271,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1387,15 +1323,6 @@ export class Editor extends EventEmitter<TLEventMap> {
return this.getOpenMenus().length > 0
}
/**
* @deprecated Use `getIsMenuOpen` instead.
*/
// eslint-disable-next-line no-restricted-syntax
get isMenuOpen() {
warnDeprecatedGetter('isMenuOpen')
return this.getIsMenuOpen()
}
/* --------------------- Cursor --------------------- */
/**
@ -1425,15 +1352,6 @@ export class Editor extends EventEmitter<TLEventMap> {
return this._getPageStatesQuery().get()
}
/**
* @deprecated Use `getPageStates` instead.
*/
// eslint-disable-next-line no-restricted-syntax
get pageStates() {
warnDeprecatedGetter('pageStates')
return this.getPageStates()
}
/** @internal */
@computed private _getPageStatesQuery() {
return this.store.query.records('instance_page_state')
@ -1448,15 +1366,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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 */
@computed private _getCurrentPageStateId() {
return InstancePageStateRecordType.createId(this.getCurrentPageId())
@ -1515,15 +1424,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1535,15 +1435,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1713,15 +1604,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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
* 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))))
}
/**
* @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.
*
@ -1769,16 +1642,6 @@ export class Editor extends EventEmitter<TLEventMap> {
}
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.
*
@ -1819,15 +1682,6 @@ export class Editor extends EventEmitter<TLEventMap> {
return boxFromRotatedVertices
}
/**
* @deprecated Use `getSelectionRotatedPageBounds` instead.
*/
// eslint-disable-next-line no-restricted-syntax
get selectionRotatedPageBounds() {
warnDeprecatedGetter('selectionRotatedPageBounds')
return this.getSelectionRotatedPageBounds()
}
// Focus Group
/**
@ -1839,15 +1693,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1858,15 +1703,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1957,15 +1793,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -1976,15 +1803,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -2027,15 +1845,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -2045,16 +1854,6 @@ export class Editor extends EventEmitter<TLEventMap> {
const hoveredShapeId = this.getHoveredShapeId()
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.
*
@ -2085,16 +1884,6 @@ export class Editor extends EventEmitter<TLEventMap> {
@computed getHintingShapeIds() {
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.
*
@ -2105,15 +1894,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -2148,15 +1928,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -2167,15 +1938,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -2225,15 +1987,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -2290,15 +2043,6 @@ export class Editor extends EventEmitter<TLEventMap> {
return this.getCamera().z
}
/**
* @deprecated Use `getZoomLevel` instead.
*/
// eslint-disable-next-line no-restricted-syntax
get zoomLevel() {
warnDeprecatedGetter('zoomLevel')
return this.getZoomLevel()
}
/** @internal */
private _setCamera(point: VecLike): this {
const currentCamera = this.getCamera()
@ -3003,15 +2747,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -3020,16 +2755,6 @@ export class Editor extends EventEmitter<TLEventMap> {
@computed getViewportScreenCenter() {
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.
*
@ -3041,15 +2766,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -3058,16 +2774,6 @@ export class Editor extends EventEmitter<TLEventMap> {
@computed getViewportPageCenter() {
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.
*
@ -3264,15 +2970,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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
// 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
@ -3441,15 +3138,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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".
*
@ -3459,15 +3147,6 @@ export class Editor extends EventEmitter<TLEventMap> {
return this._renderingBounds.get()
}
/**
* @deprecated Use `getRenderingBounds` instead.
*/
// eslint-disable-next-line no-restricted-syntax
get renderingBounds() {
warnDeprecatedGetter('renderingBounds')
return this.getRenderingBounds()
}
/** @internal */
private readonly _renderingBounds = atom('rendering viewport', new Box2d())
@ -3481,15 +3160,6 @@ export class Editor extends EventEmitter<TLEventMap> {
return this._renderingBoundsExpanded.get()
}
/**
* @deprecated Use `getRenderingBoundsExpanded` instead.
*/
// eslint-disable-next-line no-restricted-syntax
get renderingBoundsExpanded() {
warnDeprecatedGetter('renderingBoundsExpanded')
return this.getRenderingBoundsExpanded()
}
/** @internal */
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)
}
/**
* @deprecated Use `getPages` instead.
*/
// eslint-disable-next-line no-restricted-syntax
get pages() {
warnDeprecatedGetter('pages')
return this.getPages()
}
/**
* The current page.
*
@ -3561,15 +3222,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -3579,15 +3231,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -3616,14 +3259,6 @@ export class Editor extends EventEmitter<TLEventMap> {
getCurrentPageShapeIds() {
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.
@ -3970,15 +3605,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -4590,15 +4216,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
*
@ -4908,15 +4525,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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
* for nested shapes): e.g. A, B, BA, BB, C.
@ -4951,15 +4559,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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
* for nested shapes): e.g. A, B, BA, BB, C.
@ -4973,15 +4572,6 @@ export class Editor extends EventEmitter<TLEventMap> {
.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.
*
@ -7673,15 +7263,6 @@ export class Editor extends EventEmitter<TLEventMap> {
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.
* 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 }
}
/**
* @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.
*

View file

@ -1,6 +1,5 @@
import { atom, transact } from '@tldraw/state'
import { devFreeze } from '@tldraw/store'
import { warnDeprecatedGetter } from '@tldraw/utils'
import { uniqueId } from '../../utils/uniqueId'
import { TLCommandHandler, TLCommandHistoryOptions, TLHistoryEntry } from '../types/history-types'
import { Stack, stack } from './Stack'
@ -37,27 +36,9 @@ export class HistoryManager<
getNumUndos() {
return this._undos.get().length
}
/**
* @deprecated use `getNumUndos` instead
*/
// eslint-disable-next-line no-restricted-syntax
get numUndos() {
warnDeprecatedGetter('numUndos')
return this.getNumUndos()
}
getNumRedos() {
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>>(
name: Name,
constructor: Constructor,

View file

@ -1,6 +1,6 @@
import { atom, computed, EMPTY_ARRAY } from '@tldraw/state'
import { TLGroupShape, TLParentId, TLShape, TLShapeId, Vec2dModel } from '@tldraw/tlschema'
import { dedupe, deepCopy, warnDeprecatedGetter } from '@tldraw/utils'
import { dedupe, deepCopy } from '@tldraw/utils'
import {
Box2d,
flipSelectionHandleX,
@ -216,15 +216,6 @@ export class SnapManager {
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() {
if (this.getLines().length) {
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() {
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
@computed getSnappableShapes(): GapNode[] {
const { editor } = this
@ -311,30 +284,11 @@ export class SnapManager {
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
@computed getCurrentCommonAncestor() {
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
@computed getSnappablePoints() {
const snapPointsCache = this.getSnapPointsCache()
@ -351,15 +305,6 @@ export class SnapManager {
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[] } {
const horizontal: Gap[] = []
const vertical: Gap[] = []
@ -457,15 +402,6 @@ export class SnapManager {
return { horizontal, vertical }
}
/**
* @deprecated use `getVisibleGaps` instead
*/
// eslint-disable-next-line no-restricted-syntax
get visibleGaps() {
warnDeprecatedGetter('visibleGaps')
return this.getVisibleGaps()
}
snapTranslate({
lockedAxis,
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({
handlePoint,
additionalSegments,

View file

@ -1,5 +1,4 @@
import { computed } from '@tldraw/state'
import { warnDeprecatedGetter } from '@tldraw/utils'
import {
TLUserPreferences,
defaultUserPreferences,
@ -27,15 +26,6 @@ export class UserPreferencesManager {
isSnapMode: this.getIsSnapMode(),
}
}
/**
* @deprecated use `getUserPreferences` instead
*/
// eslint-disable-next-line no-restricted-syntax
get userPreferences() {
warnDeprecatedGetter('userPreferences')
return this.getUserPreferences()
}
@computed getIsDarkMode() {
return (
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.
*/
@ -63,77 +44,23 @@ export class UserPreferencesManager {
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() {
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() {
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() {
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() {
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() {
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()
}
}

View file

@ -1,5 +1,4 @@
import { Atom, Computed, atom, computed } from '@tldraw/state'
import { warnDeprecatedGetter } from '@tldraw/utils'
import type { Editor } from '../Editor'
import {
EVENT_NAME_MAP,
@ -186,20 +185,6 @@ export abstract class StateNode implements Partial<TLEventHandlers> {
*/
_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() {
return this._currentToolIdMask.get()
}

View file

@ -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
* {@link Editor.sharedStyles}.
* {@link Editor.getSharedStyles}.
*
* @public
*/

View file

@ -102,8 +102,6 @@ export interface Signal<Value, Diff = unknown> {
getDiffSince(epoch: number): Diff[] | RESET_VALUE;
lastChangedEpoch: number;
name: string;
// @deprecated (undocumented)
value: Value;
}
// @public

View file

@ -2062,33 +2062,6 @@
"startIndex": 1,
"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": []

View file

@ -4,7 +4,6 @@ import { maybeCaptureParent } from './capture'
import { EMPTY_ARRAY, equals, singleton } from './helpers'
import { advanceGlobalEpoch, atomDidChange, getGlobalEpoch } from './transactions'
import { Child, ComputeDiff, RESET_VALUE, Signal } from './types'
import { logDotValueWarning } from './warnings'
/**
* 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
}
/**
* @deprecated Use [[Atom.get]] instead.
*/
// eslint-disable-next-line no-restricted-syntax
get value() {
logDotValueWarning()
return this.get()
}
set(value: Value, diff?: Diff): Value {
// If the value has not changed, do nothing.
if (this.isEqual?.(this.current, value) ?? equals(this.current, value)) {

View file

@ -6,7 +6,7 @@ import { GLOBAL_START_EPOCH } from './constants'
import { EMPTY_ARRAY, equals, haveParentsChanged, singleton } from './helpers'
import { getGlobalEpoch } from './transactions'
import { Child, ComputeDiff, RESET_VALUE, Signal } from './types'
import { logComputedGetterWarning, logDotValueWarning } from './warnings'
import { logComputedGetterWarning } from './warnings'
/**
* @public
@ -218,15 +218,6 @@ class __UNSAFE__Computed<Value, Diff = unknown> implements Computed<Value, Diff>
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[] {
// need to call .get() to ensure both that this derivation is up to date
// and that tracking happens correctly

View file

@ -27,10 +27,7 @@ export interface Signal<Value, Diff = unknown> {
* Any effect that depends on this signal will be rescheduled if this signal changes.
*/
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.
* A signal may recopmute it's value without changing it.