@tldraw/editor 4.3.0-canary.9c474ef3fad5 → 4.3.0-canary.a2419250444e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-cjs/index.d.ts +387 -118
- package/dist-cjs/index.js +5 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/components/ErrorBoundary.js.map +1 -1
- package/dist-cjs/lib/components/GeometryDebuggingView.js +1 -17
- package/dist-cjs/lib/components/GeometryDebuggingView.js.map +2 -2
- package/dist-cjs/lib/constants.js +1 -3
- package/dist-cjs/lib/constants.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +247 -273
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/notVisibleShapes.js +18 -17
- package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +3 -3
- package/dist-cjs/lib/editor/derivations/parentsToChildren.js +12 -3
- package/dist-cjs/lib/editor/derivations/parentsToChildren.js.map +2 -2
- package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +1 -1
- package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js +5 -6
- package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +591 -0
- package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +7 -0
- package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js +1 -1
- package/dist-cjs/lib/editor/managers/SnapManager/SnapManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +1 -22
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +31 -23
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +3 -3
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
- package/dist-cjs/lib/exports/parseCss.js +1 -1
- package/dist-cjs/lib/exports/parseCss.js.map +2 -2
- package/dist-cjs/lib/hooks/useEvent.js +1 -1
- package/dist-cjs/lib/hooks/useEvent.js.map +2 -2
- package/dist-cjs/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useGestureEvents.js +1 -1
- package/dist-cjs/lib/hooks/useGestureEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useScreenBounds.js.map +2 -2
- package/dist-cjs/lib/hooks/useStateAttribute.js +4 -1
- package/dist-cjs/lib/hooks/useStateAttribute.js.map +2 -2
- package/dist-cjs/lib/hooks/useTransform.js.map +1 -1
- package/dist-cjs/lib/options.js +4 -1
- package/dist-cjs/lib/options.js.map +2 -2
- package/dist-cjs/lib/primitives/Box.js +3 -0
- package/dist-cjs/lib/primitives/Box.js.map +2 -2
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js +1 -0
- package/dist-cjs/lib/primitives/geometry/Geometry2d.js.map +2 -2
- package/dist-cjs/lib/utils/rotation.js +1 -1
- package/dist-cjs/lib/utils/rotation.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +387 -118
- package/dist-esm/index.mjs +5 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/components/ErrorBoundary.mjs.map +1 -1
- package/dist-esm/lib/components/GeometryDebuggingView.mjs +1 -17
- package/dist-esm/lib/components/GeometryDebuggingView.mjs.map +2 -2
- package/dist-esm/lib/constants.mjs +1 -3
- package/dist-esm/lib/constants.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +248 -276
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs +18 -17
- package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +3 -3
- package/dist-esm/lib/editor/derivations/parentsToChildren.mjs +13 -4
- package/dist-esm/lib/editor/derivations/parentsToChildren.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +1 -1
- package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs +5 -6
- package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +573 -0
- package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +7 -0
- package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs +1 -1
- package/dist-esm/lib/editor/managers/SnapManager/SnapManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +1 -22
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +31 -23
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +3 -3
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
- package/dist-esm/lib/exports/parseCss.mjs +1 -1
- package/dist-esm/lib/exports/parseCss.mjs.map +2 -2
- package/dist-esm/lib/hooks/useEvent.mjs +1 -1
- package/dist-esm/lib/hooks/useEvent.mjs.map +2 -2
- package/dist-esm/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useGestureEvents.mjs +1 -1
- package/dist-esm/lib/hooks/useGestureEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useScreenBounds.mjs.map +2 -2
- package/dist-esm/lib/hooks/useStateAttribute.mjs +4 -1
- package/dist-esm/lib/hooks/useStateAttribute.mjs.map +2 -2
- package/dist-esm/lib/hooks/useTransform.mjs.map +1 -1
- package/dist-esm/lib/options.mjs +4 -1
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/lib/primitives/Box.mjs +3 -0
- package/dist-esm/lib/primitives/Box.mjs.map +2 -2
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs +1 -0
- package/dist-esm/lib/primitives/geometry/Geometry2d.mjs.map +2 -2
- package/dist-esm/lib/utils/rotation.mjs +1 -1
- package/dist-esm/lib/utils/rotation.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +6 -8
- package/package.json +18 -16
- package/src/index.ts +3 -0
- package/src/lib/components/ErrorBoundary.tsx +1 -1
- package/src/lib/components/GeometryDebuggingView.tsx +1 -19
- package/src/lib/config/TLUserPreferences.test.ts +40 -0
- package/src/lib/constants.ts +0 -2
- package/src/lib/editor/Editor.test.ts +140 -0
- package/src/lib/editor/Editor.ts +300 -316
- package/src/lib/editor/derivations/notVisibleShapes.ts +37 -23
- package/src/lib/editor/derivations/parentsToChildren.ts +18 -7
- package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +17 -31
- package/src/lib/editor/managers/ClickManager/ClickManager.ts +1 -1
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.test.ts +129 -79
- package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +10 -6
- package/src/lib/editor/managers/InputsManager/InputsManager.ts +566 -0
- package/src/lib/editor/managers/ScribbleManager/ScribbleManager.test.ts +0 -4
- package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +12 -0
- package/src/lib/editor/managers/SnapManager/SnapManager.ts +1 -1
- package/src/lib/editor/managers/TickManager/TickManager.test.ts +40 -107
- package/src/lib/editor/managers/TickManager/TickManager.ts +2 -32
- package/src/lib/editor/shapes/ShapeUtil.ts +67 -24
- package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +3 -3
- package/src/lib/exports/parseCss.test.ts +1 -0
- package/src/lib/exports/parseCss.ts +1 -1
- package/src/lib/hooks/useEvent.tsx +1 -1
- package/src/lib/hooks/useFixSafariDoubleTapZoomPencilEvents.ts +1 -1
- package/src/lib/hooks/useGestureEvents.ts +2 -2
- package/src/lib/hooks/usePassThroughMouseOverEvents.ts +1 -1
- package/src/lib/hooks/usePassThroughWheelEvents.ts +1 -1
- package/src/lib/hooks/useScreenBounds.ts +1 -1
- package/src/lib/hooks/useStateAttribute.ts +4 -1
- package/src/lib/hooks/useTransform.ts +1 -1
- package/src/lib/options.ts +19 -0
- package/src/lib/primitives/Box.ts +9 -0
- package/src/lib/primitives/geometry/Geometry2d.ts +1 -0
- package/src/lib/utils/rotation.ts +1 -1
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Atom } from '@tldraw/state';
|
|
2
|
+
import { AtomSet } from '@tldraw/store';
|
|
2
3
|
import { BoxModel } from '@tldraw/tlschema';
|
|
3
4
|
import { ComponentType } from 'react';
|
|
4
5
|
import { Computed } from '@tldraw/state';
|
|
@@ -9,10 +10,11 @@ import EventEmitter from 'eventemitter3';
|
|
|
9
10
|
import { ExoticComponent } from 'react';
|
|
10
11
|
import { ExtractShapeByProps } from '@tldraw/tlschema';
|
|
11
12
|
import { ForwardRefExoticComponent } from 'react';
|
|
13
|
+
import { FragmentProps } from 'react';
|
|
12
14
|
import { HistoryEntry } from '@tldraw/store';
|
|
13
15
|
import { IndexKey } from '@tldraw/utils';
|
|
14
16
|
import { JsonObject } from '@tldraw/utils';
|
|
15
|
-
import { JSX
|
|
17
|
+
import { JSX } from 'react/jsx-runtime';
|
|
16
18
|
import { LegacyMigrations } from '@tldraw/store';
|
|
17
19
|
import { MigrationSequence } from '@tldraw/store';
|
|
18
20
|
import { NamedExoticComponent } from 'react';
|
|
@@ -488,6 +490,7 @@ export declare class Box {
|
|
|
488
490
|
get cornersAndCenter(): Vec[];
|
|
489
491
|
get sides(): Array<[Vec, Vec]>;
|
|
490
492
|
get size(): Vec;
|
|
493
|
+
isValid(): boolean;
|
|
491
494
|
toFixed(): this;
|
|
492
495
|
setTo(B: Box): this;
|
|
493
496
|
set(x?: number, y?: number, w?: number, h?: number): this;
|
|
@@ -655,7 +658,7 @@ export declare function clockwiseAngleDist(a0: number, a1: number): number;
|
|
|
655
658
|
* @public
|
|
656
659
|
* @react
|
|
657
660
|
*/
|
|
658
|
-
export declare function ContainerProvider({ container, children }: ContainerProviderProps):
|
|
661
|
+
export declare function ContainerProvider({ container, children }: ContainerProviderProps): JSX.Element;
|
|
659
662
|
|
|
660
663
|
/** @public */
|
|
661
664
|
export declare interface ContainerProviderProps {
|
|
@@ -796,16 +799,16 @@ export declare interface DebugFlagDefaults<T> {
|
|
|
796
799
|
/* Excluded from this release type: DEFAULT_CAMERA_OPTIONS */
|
|
797
800
|
|
|
798
801
|
/** @public @react */
|
|
799
|
-
export declare function DefaultBackground():
|
|
802
|
+
export declare function DefaultBackground(): JSX.Element;
|
|
800
803
|
|
|
801
804
|
/** @public @react */
|
|
802
|
-
export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) =>
|
|
805
|
+
export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
|
|
803
806
|
|
|
804
807
|
/** @public @react */
|
|
805
|
-
export declare function DefaultCanvas({ className }: TLCanvasComponentProps):
|
|
808
|
+
export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
|
|
806
809
|
|
|
807
810
|
/** @public @react */
|
|
808
|
-
export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity, }: TLCollaboratorHintProps):
|
|
811
|
+
export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity, }: TLCollaboratorHintProps): JSX.Element;
|
|
809
812
|
|
|
810
813
|
/** @public @react */
|
|
811
814
|
export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
|
|
@@ -814,22 +817,22 @@ export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
|
|
|
814
817
|
export declare const DefaultErrorFallback: TLErrorFallbackComponent;
|
|
815
818
|
|
|
816
819
|
/** @public @react */
|
|
817
|
-
export declare function DefaultGrid({ x, y, z, size }: TLGridProps):
|
|
820
|
+
export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
|
|
818
821
|
|
|
819
822
|
/** @public @react */
|
|
820
|
-
export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps):
|
|
823
|
+
export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
|
|
821
824
|
|
|
822
825
|
/** @public @react */
|
|
823
|
-
export declare const DefaultHandles: ({ children }: TLHandlesProps) =>
|
|
826
|
+
export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
|
|
824
827
|
|
|
825
828
|
/** @public @react */
|
|
826
|
-
export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps):
|
|
829
|
+
export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX.Element | null;
|
|
827
830
|
|
|
828
831
|
/** @public @react */
|
|
829
|
-
export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps):
|
|
832
|
+
export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
|
|
830
833
|
|
|
831
834
|
/** @public @react */
|
|
832
|
-
export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps):
|
|
835
|
+
export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
|
|
833
836
|
|
|
834
837
|
/** @public @react */
|
|
835
838
|
export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
|
|
@@ -841,10 +844,10 @@ export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicat
|
|
|
841
844
|
export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
842
845
|
|
|
843
846
|
/** @public @react */
|
|
844
|
-
export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps):
|
|
847
|
+
export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
|
|
845
848
|
|
|
846
849
|
/** @public @react */
|
|
847
|
-
export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>):
|
|
850
|
+
export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
|
|
848
851
|
|
|
849
852
|
/** @public @react */
|
|
850
853
|
export declare const DefaultSvgDefs: () => null;
|
|
@@ -873,9 +876,7 @@ export declare const defaultTldrawOptions: {
|
|
|
873
876
|
readonly edgeScrollEaseDuration: 200;
|
|
874
877
|
readonly edgeScrollSpeed: 25;
|
|
875
878
|
readonly enableToolbarKeyboardShortcuts: true;
|
|
876
|
-
readonly exportProvider: ExoticComponent<
|
|
877
|
-
children?: ReactNode | undefined;
|
|
878
|
-
}>;
|
|
879
|
+
readonly exportProvider: ExoticComponent<FragmentProps>;
|
|
879
880
|
readonly flattenImageBoundsExpand: 64;
|
|
880
881
|
readonly flattenImageBoundsPadding: 16;
|
|
881
882
|
readonly followChaseViewportSnap: 2;
|
|
@@ -907,11 +908,14 @@ export declare const defaultTldrawOptions: {
|
|
|
907
908
|
readonly maxShapesPerPage: 4000;
|
|
908
909
|
readonly multiClickDurationMs: 200;
|
|
909
910
|
readonly nonce: undefined;
|
|
911
|
+
readonly snapThreshold: 8;
|
|
912
|
+
readonly spacebarPanning: true;
|
|
910
913
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
911
914
|
readonly textShadowLod: 0.35;
|
|
912
915
|
readonly tooltipDelayMs: 700;
|
|
913
916
|
readonly uiCoarseDragDistanceSquared: 625;
|
|
914
917
|
readonly uiDragDistanceSquared: 16;
|
|
918
|
+
readonly zoomToFitPadding: 128;
|
|
915
919
|
};
|
|
916
920
|
|
|
917
921
|
/** @public */
|
|
@@ -985,6 +989,7 @@ export declare class EdgeScrollManager {
|
|
|
985
989
|
constructor(editor: Editor);
|
|
986
990
|
private _isEdgeScrolling;
|
|
987
991
|
private _edgeScrollDuration;
|
|
992
|
+
getIsEdgeScrolling(): boolean;
|
|
988
993
|
/**
|
|
989
994
|
* Update the camera position when the mouse is close to the edge of the screen.
|
|
990
995
|
* Run this on every tick when in a state where edge scrolling is enabled.
|
|
@@ -1043,7 +1048,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1043
1048
|
*/
|
|
1044
1049
|
removeTool(Tool: TLStateNodeConstructor, parent?: StateNode): void;
|
|
1045
1050
|
/**
|
|
1046
|
-
* A set of functions to call when the
|
|
1051
|
+
* A set of functions to call when the editor is disposed.
|
|
1047
1052
|
*
|
|
1048
1053
|
* @public
|
|
1049
1054
|
*/
|
|
@@ -1056,7 +1061,13 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1056
1061
|
isDisposed: boolean;
|
|
1057
1062
|
/* Excluded from this release type: _tickManager */
|
|
1058
1063
|
/**
|
|
1059
|
-
* A manager for the
|
|
1064
|
+
* A manager for the editor's input state.
|
|
1065
|
+
*
|
|
1066
|
+
* @public
|
|
1067
|
+
*/
|
|
1068
|
+
readonly inputs: InputsManager;
|
|
1069
|
+
/**
|
|
1070
|
+
* A manager for the editor's snapping feature.
|
|
1060
1071
|
*
|
|
1061
1072
|
* @public
|
|
1062
1073
|
*/
|
|
@@ -1197,7 +1208,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1197
1208
|
} | S): BindingUtil<S>;
|
|
1198
1209
|
getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
|
|
1199
1210
|
/**
|
|
1200
|
-
* A manager for the
|
|
1211
|
+
* A manager for the editor's history.
|
|
1201
1212
|
*
|
|
1202
1213
|
* @readonly
|
|
1203
1214
|
*/
|
|
@@ -1214,10 +1225,11 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1214
1225
|
*/
|
|
1215
1226
|
undo(): this;
|
|
1216
1227
|
/**
|
|
1217
|
-
* Whether the
|
|
1228
|
+
* Whether the editor can undo.
|
|
1218
1229
|
*
|
|
1219
1230
|
* @public
|
|
1220
1231
|
*/
|
|
1232
|
+
canUndo(): boolean;
|
|
1221
1233
|
getCanUndo(): boolean;
|
|
1222
1234
|
/**
|
|
1223
1235
|
* Redo to the next mark.
|
|
@@ -1230,13 +1242,14 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1230
1242
|
* @public
|
|
1231
1243
|
*/
|
|
1232
1244
|
redo(): this;
|
|
1233
|
-
clearHistory(): this;
|
|
1234
1245
|
/**
|
|
1235
|
-
* Whether the
|
|
1246
|
+
* Whether the editor can redo.
|
|
1236
1247
|
*
|
|
1237
1248
|
* @public
|
|
1238
1249
|
*/
|
|
1250
|
+
canRedo(): boolean;
|
|
1239
1251
|
getCanRedo(): boolean;
|
|
1252
|
+
clearHistory(): this;
|
|
1240
1253
|
/**
|
|
1241
1254
|
* Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
|
|
1242
1255
|
* any redos. You typically want to do this just before a user interaction begins or is handled.
|
|
@@ -1595,7 +1608,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1595
1608
|
*/
|
|
1596
1609
|
selectNone(): this;
|
|
1597
1610
|
/**
|
|
1598
|
-
* The id of the
|
|
1611
|
+
* The id of the editor's only selected shape.
|
|
1599
1612
|
*
|
|
1600
1613
|
* @returns Null if there is no shape or more than one selected shape, otherwise the selected shape's id.
|
|
1601
1614
|
*
|
|
@@ -1604,7 +1617,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1604
1617
|
*/
|
|
1605
1618
|
getOnlySelectedShapeId(): null | TLShapeId;
|
|
1606
1619
|
/**
|
|
1607
|
-
* The
|
|
1620
|
+
* The editor's only selected shape.
|
|
1608
1621
|
*
|
|
1609
1622
|
* @returns Null if there is no shape or more than one selected shape, otherwise the selected shape.
|
|
1610
1623
|
*
|
|
@@ -1696,6 +1709,16 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1696
1709
|
* @public
|
|
1697
1710
|
*/
|
|
1698
1711
|
getEditingShape(): TLShape | undefined;
|
|
1712
|
+
/**
|
|
1713
|
+
* Whether the shape can be edited.
|
|
1714
|
+
*
|
|
1715
|
+
* @param shape - The shape (or shape id) to check if it can be edited.
|
|
1716
|
+
* @param info - The info about the edit start.
|
|
1717
|
+
*
|
|
1718
|
+
* @public
|
|
1719
|
+
* @returns true if the shape can be edited, false otherwise.
|
|
1720
|
+
*/
|
|
1721
|
+
canEditShape<T extends TLShape | TLShapeId>(shape: null | T, info?: TLEditStartInfo): shape is T;
|
|
1699
1722
|
/**
|
|
1700
1723
|
* Set the current editing shape.
|
|
1701
1724
|
*
|
|
@@ -1815,6 +1838,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1815
1838
|
* @public
|
|
1816
1839
|
*/
|
|
1817
1840
|
getCroppingShapeId(): null | TLShapeId;
|
|
1841
|
+
/**
|
|
1842
|
+
* Whether the shape can be cropped.
|
|
1843
|
+
*
|
|
1844
|
+
* @param shape - The shape (or shape id) to check if it can be cropped.
|
|
1845
|
+
*
|
|
1846
|
+
* @public
|
|
1847
|
+
* @returns true if the shape can be cropped, false otherwise.
|
|
1848
|
+
*/
|
|
1849
|
+
canCropShape<T extends TLShape | TLShapeId>(shape: null | T): shape is T;
|
|
1818
1850
|
/**
|
|
1819
1851
|
* Set the current cropping shape.
|
|
1820
1852
|
*
|
|
@@ -1997,7 +2029,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1997
2029
|
* ```ts
|
|
1998
2030
|
* editor.zoomIn()
|
|
1999
2031
|
* editor.zoomIn(editor.getViewportScreenCenter(), { animation: { duration: 200 } })
|
|
2000
|
-
* editor.zoomIn(editor.inputs.
|
|
2032
|
+
* editor.zoomIn(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 200 } })
|
|
2001
2033
|
* ```
|
|
2002
2034
|
*
|
|
2003
2035
|
* @param point - The screen point to zoom in on. Defaults to the screen center
|
|
@@ -2013,7 +2045,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2013
2045
|
* ```ts
|
|
2014
2046
|
* editor.zoomOut()
|
|
2015
2047
|
* editor.zoomOut(editor.getViewportScreenCenter(), { animation: { duration: 120 } })
|
|
2016
|
-
* editor.zoomOut(editor.inputs.
|
|
2048
|
+
* editor.zoomOut(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 120 } })
|
|
2017
2049
|
* ```
|
|
2018
2050
|
*
|
|
2019
2051
|
* @param point - The point to zoom out on. Defaults to the viewport screen center.
|
|
@@ -3748,59 +3780,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3748
3780
|
url: string;
|
|
3749
3781
|
width: number;
|
|
3750
3782
|
}>;
|
|
3751
|
-
/**
|
|
3752
|
-
* The app's current input state.
|
|
3753
|
-
*
|
|
3754
|
-
* @public
|
|
3755
|
-
*/
|
|
3756
|
-
inputs: {
|
|
3757
|
-
/** A set containing the currently pressed buttons. */
|
|
3758
|
-
buttons: Set<number>;
|
|
3759
|
-
/** A set containing the currently pressed keys. */
|
|
3760
|
-
keys: Set<string>;
|
|
3761
|
-
/** The most recent pointer down's position in screen space. */
|
|
3762
|
-
originScreenPoint: Vec;
|
|
3763
|
-
/** The most recent pointer down's position in the current page space. */
|
|
3764
|
-
originPagePoint: Vec;
|
|
3765
|
-
/** The most recent pointer position in screen space. */
|
|
3766
|
-
currentScreenPoint: Vec;
|
|
3767
|
-
/** The most recent pointer position in the current page space. */
|
|
3768
|
-
currentPagePoint: Vec;
|
|
3769
|
-
/** The previous pointer position in screen space. */
|
|
3770
|
-
previousScreenPoint: Vec;
|
|
3771
|
-
/** The previous pointer position in the current page space. */
|
|
3772
|
-
previousPagePoint: Vec;
|
|
3773
|
-
/** Velocity of mouse pointer, in pixels per millisecond */
|
|
3774
|
-
pointerVelocity: Vec;
|
|
3775
|
-
/** Whether the alt or option key is currently pressed. */
|
|
3776
|
-
altKey: boolean;
|
|
3777
|
-
/** Whether the control or command key is currently pressed. */
|
|
3778
|
-
ctrlKey: boolean;
|
|
3779
|
-
/** Whether the input is from a pe. */
|
|
3780
|
-
isPen: boolean;
|
|
3781
|
-
/** Whether the meta key is currently pressed. */
|
|
3782
|
-
metaKey: boolean;
|
|
3783
|
-
/** Whether the shift key is currently pressed. */
|
|
3784
|
-
shiftKey: boolean;
|
|
3785
|
-
/** Whether the user is dragging. */
|
|
3786
|
-
isDragging: boolean;
|
|
3787
|
-
/** Whether the user is editing. */
|
|
3788
|
-
isEditing: boolean;
|
|
3789
|
-
/** Whether the user is panning. */
|
|
3790
|
-
isPanning: boolean;
|
|
3791
|
-
/** Whether the user is pinching. */
|
|
3792
|
-
isPinching: boolean;
|
|
3793
|
-
/** Whether the user is pointing. */
|
|
3794
|
-
isPointing: boolean;
|
|
3795
|
-
/** Whether the user is spacebar panning. */
|
|
3796
|
-
isSpacebarPanning: boolean;
|
|
3797
|
-
};
|
|
3798
|
-
/**
|
|
3799
|
-
* Update the input points from a pointer, pinch, or wheel event.
|
|
3800
|
-
*
|
|
3801
|
-
* @param info - The event info.
|
|
3802
|
-
*/
|
|
3803
|
-
private _updateInputsFromEvent;
|
|
3804
3783
|
/**
|
|
3805
3784
|
* Dispatch a cancel event.
|
|
3806
3785
|
*
|
|
@@ -4046,7 +4025,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
4046
4025
|
/* Excluded from this release type: _metaKeyTimeout */
|
|
4047
4026
|
/* Excluded from this release type: _setMetaKeyTimeout */
|
|
4048
4027
|
/* Excluded from this release type: _restoreToolId */
|
|
4049
|
-
/* Excluded from this release type: _pinchStart */
|
|
4050
4028
|
/* Excluded from this release type: _didPinch */
|
|
4051
4029
|
/* Excluded from this release type: _selectedShapeIdsAtPointerDown */
|
|
4052
4030
|
/* Excluded from this release type: _longPressTimeout */
|
|
@@ -4121,7 +4099,7 @@ export declare class EditorAtom<T> {
|
|
|
4121
4099
|
export declare const EditorContext: React_3.Context<Editor | null>;
|
|
4122
4100
|
|
|
4123
4101
|
/** @public @react */
|
|
4124
|
-
export declare function EditorProvider({ editor, children }: EditorProviderProps):
|
|
4102
|
+
export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX.Element;
|
|
4125
4103
|
|
|
4126
4104
|
/** @public */
|
|
4127
4105
|
export declare interface EditorProviderProps {
|
|
@@ -4152,7 +4130,7 @@ export declare class Ellipse2d extends Geometry2d {
|
|
|
4152
4130
|
}
|
|
4153
4131
|
|
|
4154
4132
|
/** @public */
|
|
4155
|
-
export declare class ErrorBoundary extends React_2.Component<React_2.
|
|
4133
|
+
export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithChildren<TLErrorBoundaryProps>, {
|
|
4156
4134
|
error: Error | null;
|
|
4157
4135
|
}> {
|
|
4158
4136
|
static getDerivedStateFromError(error: Error): {
|
|
@@ -4162,11 +4140,11 @@ export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithRe
|
|
|
4162
4140
|
error: null;
|
|
4163
4141
|
};
|
|
4164
4142
|
componentDidCatch(error: unknown): void;
|
|
4165
|
-
render(): boolean |
|
|
4143
|
+
render(): bigint | boolean | JSX.Element | Iterable<React_2.ReactNode> | null | number | Promise<bigint | boolean | Iterable<React_2.ReactNode> | null | number | React_2.ReactElement<unknown, React_2.JSXElementConstructor<any> | string> | React_2.ReactPortal | string | undefined> | string | undefined;
|
|
4166
4144
|
}
|
|
4167
4145
|
|
|
4168
4146
|
/** @public @react */
|
|
4169
|
-
export declare function ErrorScreen({ children }: LoadingScreenProps):
|
|
4147
|
+
export declare function ErrorScreen({ children }: LoadingScreenProps): JSX.Element;
|
|
4170
4148
|
|
|
4171
4149
|
/** @public */
|
|
4172
4150
|
export declare const EVENT_NAME_MAP: Record<Exclude<TLEventName, TLPinchEventName>, keyof TLEventHandlers>;
|
|
@@ -4466,8 +4444,8 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
4466
4444
|
canResizeChildren(): boolean;
|
|
4467
4445
|
getDefaultProps(): TLGroupShape['props'];
|
|
4468
4446
|
getGeometry(shape: TLGroupShape): Geometry2d;
|
|
4469
|
-
component(shape: TLGroupShape):
|
|
4470
|
-
indicator(shape: TLGroupShape):
|
|
4447
|
+
component(shape: TLGroupShape): JSX.Element | null;
|
|
4448
|
+
indicator(shape: TLGroupShape): JSX.Element;
|
|
4471
4449
|
onChildrenChange(group: TLGroupShape): void;
|
|
4472
4450
|
}
|
|
4473
4451
|
|
|
@@ -4571,7 +4549,7 @@ export declare class HistoryManager<R extends UnknownRecord> {
|
|
|
4571
4549
|
}
|
|
4572
4550
|
|
|
4573
4551
|
/** @public @react */
|
|
4574
|
-
export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps):
|
|
4552
|
+
export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX.Element;
|
|
4575
4553
|
|
|
4576
4554
|
/** @public */
|
|
4577
4555
|
export declare type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
|
|
@@ -4579,6 +4557,248 @@ export declare type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
|
|
|
4579
4557
|
/** @public */
|
|
4580
4558
|
export declare const inlineBase64AssetStore: TLAssetStore;
|
|
4581
4559
|
|
|
4560
|
+
/** @public */
|
|
4561
|
+
export declare class InputsManager {
|
|
4562
|
+
private readonly editor;
|
|
4563
|
+
constructor(editor: Editor);
|
|
4564
|
+
private _originPagePoint;
|
|
4565
|
+
/**
|
|
4566
|
+
* The most recent pointer down's position in the current page space.
|
|
4567
|
+
*/
|
|
4568
|
+
getOriginPagePoint(): Vec;
|
|
4569
|
+
/**
|
|
4570
|
+
* @deprecated Use `getOriginPagePoint()` instead.
|
|
4571
|
+
*/
|
|
4572
|
+
get originPagePoint(): Vec;
|
|
4573
|
+
private _originScreenPoint;
|
|
4574
|
+
/**
|
|
4575
|
+
* The most recent pointer down's position in screen space.
|
|
4576
|
+
*/
|
|
4577
|
+
getOriginScreenPoint(): Vec;
|
|
4578
|
+
/**
|
|
4579
|
+
* @deprecated Use `getOriginScreenPoint()` instead.
|
|
4580
|
+
*/
|
|
4581
|
+
get originScreenPoint(): Vec;
|
|
4582
|
+
private _previousPagePoint;
|
|
4583
|
+
/**
|
|
4584
|
+
* The previous pointer position in the current page space.
|
|
4585
|
+
*/
|
|
4586
|
+
getPreviousPagePoint(): Vec;
|
|
4587
|
+
/**
|
|
4588
|
+
* @deprecated Use `getPreviousPagePoint()` instead.
|
|
4589
|
+
*/
|
|
4590
|
+
get previousPagePoint(): Vec;
|
|
4591
|
+
private _previousScreenPoint;
|
|
4592
|
+
/**
|
|
4593
|
+
* The previous pointer position in screen space.
|
|
4594
|
+
*/
|
|
4595
|
+
getPreviousScreenPoint(): Vec;
|
|
4596
|
+
/**
|
|
4597
|
+
* @deprecated Use `getPreviousScreenPoint()` instead.
|
|
4598
|
+
*/
|
|
4599
|
+
get previousScreenPoint(): Vec;
|
|
4600
|
+
private _currentPagePoint;
|
|
4601
|
+
/**
|
|
4602
|
+
* The most recent pointer position in the current page space.
|
|
4603
|
+
*/
|
|
4604
|
+
getCurrentPagePoint(): Vec;
|
|
4605
|
+
/**
|
|
4606
|
+
* @deprecated Use `getCurrentPagePoint()` instead.
|
|
4607
|
+
*/
|
|
4608
|
+
get currentPagePoint(): Vec;
|
|
4609
|
+
private _currentScreenPoint;
|
|
4610
|
+
/**
|
|
4611
|
+
* The most recent pointer position in screen space.
|
|
4612
|
+
*/
|
|
4613
|
+
getCurrentScreenPoint(): Vec;
|
|
4614
|
+
/**
|
|
4615
|
+
* @deprecated Use `getCurrentScreenPoint()` instead.
|
|
4616
|
+
*/
|
|
4617
|
+
get currentScreenPoint(): Vec;
|
|
4618
|
+
private _pointerVelocity;
|
|
4619
|
+
/**
|
|
4620
|
+
* Velocity of mouse pointer, in pixels per millisecond.
|
|
4621
|
+
*/
|
|
4622
|
+
getPointerVelocity(): Vec;
|
|
4623
|
+
/**
|
|
4624
|
+
* @deprecated Use `getPointerVelocity()` instead.
|
|
4625
|
+
*/
|
|
4626
|
+
get pointerVelocity(): Vec;
|
|
4627
|
+
/* Excluded from this release type: setPointerVelocity */
|
|
4628
|
+
/**
|
|
4629
|
+
* A set containing the currently pressed keys.
|
|
4630
|
+
*/
|
|
4631
|
+
readonly keys: AtomSet<string>;
|
|
4632
|
+
/**
|
|
4633
|
+
* A set containing the currently pressed buttons.
|
|
4634
|
+
*/
|
|
4635
|
+
readonly buttons: AtomSet<number>;
|
|
4636
|
+
private _isPen;
|
|
4637
|
+
/**
|
|
4638
|
+
* Whether the input is from a pen.
|
|
4639
|
+
*/
|
|
4640
|
+
getIsPen(): boolean;
|
|
4641
|
+
/**
|
|
4642
|
+
* @deprecated Use `getIsPen()` instead.
|
|
4643
|
+
*/
|
|
4644
|
+
get isPen(): boolean;
|
|
4645
|
+
set isPen(isPen: boolean);
|
|
4646
|
+
/**
|
|
4647
|
+
* @param isPen - Whether the input is from a pen.
|
|
4648
|
+
*/
|
|
4649
|
+
setIsPen(isPen: boolean): void;
|
|
4650
|
+
private _shiftKey;
|
|
4651
|
+
/**
|
|
4652
|
+
* Whether the shift key is currently pressed.
|
|
4653
|
+
*/
|
|
4654
|
+
getShiftKey(): boolean;
|
|
4655
|
+
/**
|
|
4656
|
+
* @deprecated Use `getShiftKey()` instead.
|
|
4657
|
+
*/
|
|
4658
|
+
get shiftKey(): boolean;
|
|
4659
|
+
set shiftKey(shiftKey: boolean);
|
|
4660
|
+
/* Excluded from this release type: setShiftKey */
|
|
4661
|
+
private _metaKey;
|
|
4662
|
+
/**
|
|
4663
|
+
* Whether the meta key is currently pressed.
|
|
4664
|
+
*/
|
|
4665
|
+
getMetaKey(): boolean;
|
|
4666
|
+
/**
|
|
4667
|
+
* @deprecated Use `getMetaKey()` instead.
|
|
4668
|
+
*/
|
|
4669
|
+
get metaKey(): boolean;
|
|
4670
|
+
set metaKey(metaKey: boolean);
|
|
4671
|
+
/* Excluded from this release type: setMetaKey */
|
|
4672
|
+
private _ctrlKey;
|
|
4673
|
+
/**
|
|
4674
|
+
* Whether the ctrl or command key is currently pressed.
|
|
4675
|
+
*/
|
|
4676
|
+
getCtrlKey(): boolean;
|
|
4677
|
+
/**
|
|
4678
|
+
* @deprecated Use `getCtrlKey()` instead.
|
|
4679
|
+
*/
|
|
4680
|
+
get ctrlKey(): boolean;
|
|
4681
|
+
set ctrlKey(ctrlKey: boolean);
|
|
4682
|
+
/* Excluded from this release type: setCtrlKey */
|
|
4683
|
+
private _altKey;
|
|
4684
|
+
/**
|
|
4685
|
+
* Whether the alt or option key is currently pressed.
|
|
4686
|
+
*/
|
|
4687
|
+
getAltKey(): boolean;
|
|
4688
|
+
/**
|
|
4689
|
+
* @deprecated Use `getAltKey()` instead.
|
|
4690
|
+
*/
|
|
4691
|
+
get altKey(): boolean;
|
|
4692
|
+
set altKey(altKey: boolean);
|
|
4693
|
+
/* Excluded from this release type: setAltKey */
|
|
4694
|
+
/**
|
|
4695
|
+
* Is the accelerator key (cmd on mac, ctrl elsewhere) currently pressed.
|
|
4696
|
+
*/
|
|
4697
|
+
getAccelKey(): boolean;
|
|
4698
|
+
/**
|
|
4699
|
+
* @deprecated Use `getAccelKey()` instead.
|
|
4700
|
+
*/
|
|
4701
|
+
get accelKey(): boolean;
|
|
4702
|
+
private _isDragging;
|
|
4703
|
+
/**
|
|
4704
|
+
* Whether the user is dragging.
|
|
4705
|
+
*/
|
|
4706
|
+
getIsDragging(): boolean;
|
|
4707
|
+
/**
|
|
4708
|
+
* Soon to be deprecated, use `getIsDragging()` instead.
|
|
4709
|
+
*/
|
|
4710
|
+
get isDragging(): boolean;
|
|
4711
|
+
set isDragging(isDragging: boolean);
|
|
4712
|
+
/**
|
|
4713
|
+
* @param isDragging - Whether the user is dragging.
|
|
4714
|
+
*/
|
|
4715
|
+
setIsDragging(isDragging: boolean): void;
|
|
4716
|
+
private _isPointing;
|
|
4717
|
+
/**
|
|
4718
|
+
* Whether the user is pointing.
|
|
4719
|
+
*/
|
|
4720
|
+
getIsPointing(): boolean;
|
|
4721
|
+
/**
|
|
4722
|
+
* @deprecated Use `getIsPointing()` instead.
|
|
4723
|
+
*/
|
|
4724
|
+
get isPointing(): boolean;
|
|
4725
|
+
set isPointing(isPointing: boolean);
|
|
4726
|
+
/* Excluded from this release type: setIsPointing */
|
|
4727
|
+
private _isPinching;
|
|
4728
|
+
/**
|
|
4729
|
+
* Whether the user is pinching.
|
|
4730
|
+
*/
|
|
4731
|
+
getIsPinching(): boolean;
|
|
4732
|
+
/**
|
|
4733
|
+
* @deprecated Use `getIsPinching()` instead.
|
|
4734
|
+
*/
|
|
4735
|
+
get isPinching(): boolean;
|
|
4736
|
+
set isPinching(isPinching: boolean);
|
|
4737
|
+
/* Excluded from this release type: setIsPinching */
|
|
4738
|
+
private _isEditing;
|
|
4739
|
+
/**
|
|
4740
|
+
* Whether the user is editing.
|
|
4741
|
+
*/
|
|
4742
|
+
getIsEditing(): boolean;
|
|
4743
|
+
/**
|
|
4744
|
+
* @deprecated Use `getIsEditing()` instead.
|
|
4745
|
+
*/
|
|
4746
|
+
get isEditing(): boolean;
|
|
4747
|
+
set isEditing(isEditing: boolean);
|
|
4748
|
+
/**
|
|
4749
|
+
* @param isEditing - Whether the user is editing.
|
|
4750
|
+
*/
|
|
4751
|
+
setIsEditing(isEditing: boolean): void;
|
|
4752
|
+
private _isPanning;
|
|
4753
|
+
/**
|
|
4754
|
+
* Whether the user is panning.
|
|
4755
|
+
*/
|
|
4756
|
+
getIsPanning(): boolean;
|
|
4757
|
+
/**
|
|
4758
|
+
* @deprecated Use `getIsPanning()` instead.
|
|
4759
|
+
*/
|
|
4760
|
+
get isPanning(): boolean;
|
|
4761
|
+
set isPanning(isPanning: boolean);
|
|
4762
|
+
/* Excluded from this release type: setIsPanning */
|
|
4763
|
+
private _isSpacebarPanning;
|
|
4764
|
+
/**
|
|
4765
|
+
* Whether the user is spacebar panning.
|
|
4766
|
+
*/
|
|
4767
|
+
getIsSpacebarPanning(): boolean;
|
|
4768
|
+
/**
|
|
4769
|
+
* @deprecated Use `getIsSpacebarPanning()` instead.
|
|
4770
|
+
*/
|
|
4771
|
+
get isSpacebarPanning(): boolean;
|
|
4772
|
+
set isSpacebarPanning(isSpacebarPanning: boolean);
|
|
4773
|
+
/* Excluded from this release type: setIsSpacebarPanning */
|
|
4774
|
+
private _getHasCollaborators;
|
|
4775
|
+
/* Excluded from this release type: _velocityPrevPoint */
|
|
4776
|
+
/* Excluded from this release type: updatePointerVelocity */
|
|
4777
|
+
/* Excluded from this release type: updateFromEvent */
|
|
4778
|
+
toJson(): {
|
|
4779
|
+
altKey: boolean;
|
|
4780
|
+
buttons: number[];
|
|
4781
|
+
ctrlKey: boolean;
|
|
4782
|
+
currentPagePoint: VecModel;
|
|
4783
|
+
currentScreenPoint: VecModel;
|
|
4784
|
+
isDragging: boolean;
|
|
4785
|
+
isEditing: boolean;
|
|
4786
|
+
isPanning: boolean;
|
|
4787
|
+
isPen: boolean;
|
|
4788
|
+
isPinching: boolean;
|
|
4789
|
+
isPointing: boolean;
|
|
4790
|
+
isSpacebarPanning: boolean;
|
|
4791
|
+
keys: string[];
|
|
4792
|
+
metaKey: boolean;
|
|
4793
|
+
originPagePoint: VecModel;
|
|
4794
|
+
originScreenPoint: VecModel;
|
|
4795
|
+
pointerVelocity: VecModel;
|
|
4796
|
+
previousPagePoint: VecModel;
|
|
4797
|
+
previousScreenPoint: VecModel;
|
|
4798
|
+
shiftKey: boolean;
|
|
4799
|
+
};
|
|
4800
|
+
}
|
|
4801
|
+
|
|
4582
4802
|
/**
|
|
4583
4803
|
* Find the intersections between a circle and a circle.
|
|
4584
4804
|
*
|
|
@@ -4708,7 +4928,7 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
|
|
|
4708
4928
|
export declare function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
|
|
4709
4929
|
|
|
4710
4930
|
/** @public @react */
|
|
4711
|
-
export declare function LoadingScreen({ children }: LoadingScreenProps):
|
|
4931
|
+
export declare function LoadingScreen({ children }: LoadingScreenProps): JSX.Element;
|
|
4712
4932
|
|
|
4713
4933
|
/** @public */
|
|
4714
4934
|
export declare interface LoadingScreenProps {
|
|
@@ -4826,7 +5046,7 @@ export declare function maybeSnapToGrid(point: Vec, editor: Editor): Vec;
|
|
|
4826
5046
|
*
|
|
4827
5047
|
* @public @react
|
|
4828
5048
|
*/
|
|
4829
|
-
export declare function MenuClickCapture(): false |
|
|
5049
|
+
export declare function MenuClickCapture(): false | JSX.Element;
|
|
4830
5050
|
|
|
4831
5051
|
/* Excluded from this release type: normalizeWheel */
|
|
4832
5052
|
|
|
@@ -5259,20 +5479,20 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5259
5479
|
* @param shape - The shape.
|
|
5260
5480
|
* @public
|
|
5261
5481
|
*/
|
|
5262
|
-
canSnap(
|
|
5482
|
+
canSnap(shape: Shape): boolean;
|
|
5263
5483
|
/**
|
|
5264
5484
|
* Whether the shape can be tabbed to.
|
|
5265
5485
|
*
|
|
5266
5486
|
* @param shape - The shape.
|
|
5267
5487
|
* @public
|
|
5268
5488
|
*/
|
|
5269
|
-
canTabTo(
|
|
5489
|
+
canTabTo(shape: Shape): boolean;
|
|
5270
5490
|
/**
|
|
5271
5491
|
* Whether the shape can be scrolled while editing.
|
|
5272
5492
|
*
|
|
5273
5493
|
* @public
|
|
5274
5494
|
*/
|
|
5275
|
-
canScroll(
|
|
5495
|
+
canScroll(shape: Shape): boolean;
|
|
5276
5496
|
/**
|
|
5277
5497
|
* Whether the shape can be bound to. See {@link TLShapeUtilCanBindOpts} for details.
|
|
5278
5498
|
*
|
|
@@ -5284,31 +5504,37 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5284
5504
|
*
|
|
5285
5505
|
* @public
|
|
5286
5506
|
*/
|
|
5287
|
-
canEdit(
|
|
5507
|
+
canEdit(shape: Shape, info: TLEditStartInfo): boolean;
|
|
5288
5508
|
/**
|
|
5289
5509
|
* Whether the shape can be resized.
|
|
5290
5510
|
*
|
|
5291
5511
|
* @public
|
|
5292
5512
|
*/
|
|
5293
|
-
canResize(
|
|
5513
|
+
canResize(shape: Shape): boolean;
|
|
5294
5514
|
/**
|
|
5295
5515
|
* When the shape is resized, whether the shape's children should also be resized.
|
|
5296
5516
|
*
|
|
5297
5517
|
* @public
|
|
5298
5518
|
*/
|
|
5299
|
-
canResizeChildren(
|
|
5519
|
+
canResizeChildren(shape: Shape): boolean;
|
|
5300
5520
|
/**
|
|
5301
5521
|
* Whether the shape can be edited in read-only mode.
|
|
5302
5522
|
*
|
|
5303
5523
|
* @public
|
|
5304
5524
|
*/
|
|
5305
|
-
canEditInReadonly(
|
|
5525
|
+
canEditInReadonly(shape: Shape): boolean;
|
|
5526
|
+
/**
|
|
5527
|
+
* Whether the shape can be edited while locked or while an ancestor is locked.
|
|
5528
|
+
*
|
|
5529
|
+
* @public
|
|
5530
|
+
*/
|
|
5531
|
+
canEditWhileLocked(shape: Shape): boolean;
|
|
5306
5532
|
/**
|
|
5307
5533
|
* Whether the shape can be cropped.
|
|
5308
5534
|
*
|
|
5309
5535
|
* @public
|
|
5310
5536
|
*/
|
|
5311
|
-
canCrop(
|
|
5537
|
+
canCrop(shape: Shape): boolean;
|
|
5312
5538
|
/**
|
|
5313
5539
|
* Whether the shape can participate in layout functions such as alignment or distribution.
|
|
5314
5540
|
*
|
|
@@ -5318,7 +5544,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5318
5544
|
*
|
|
5319
5545
|
* @public
|
|
5320
5546
|
*/
|
|
5321
|
-
canBeLaidOut(
|
|
5547
|
+
canBeLaidOut(shape: Shape, info: TLShapeUtilCanBeLaidOutOpts): boolean;
|
|
5322
5548
|
/**
|
|
5323
5549
|
* Whether this shape can be culled. By default, shapes are culled for
|
|
5324
5550
|
* performance reasons when they are outside of the viewport. Culled shapes are still rendered
|
|
@@ -5326,11 +5552,31 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5326
5552
|
*
|
|
5327
5553
|
* @param shape - The shape.
|
|
5328
5554
|
*/
|
|
5329
|
-
canCull(
|
|
5555
|
+
canCull(shape: Shape): boolean;
|
|
5330
5556
|
/* Excluded from this release type: providesBackgroundForChildren */
|
|
5331
5557
|
/**
|
|
5332
5558
|
* Get the clip path to apply to this shape's children.
|
|
5333
5559
|
*
|
|
5560
|
+
* The returned points should define the **inner** clip boundary - the area where
|
|
5561
|
+
* children will be visible. If your shape has a stroke, you should inset the clip
|
|
5562
|
+
* path by half the stroke width so children are clipped to the inner edge of the
|
|
5563
|
+
* stroke rather than its center line.
|
|
5564
|
+
*
|
|
5565
|
+
* @example
|
|
5566
|
+
* ```ts
|
|
5567
|
+
* override getClipPath(shape: MyShape): Vec[] | undefined {
|
|
5568
|
+
* const strokeWidth = 2
|
|
5569
|
+
* const inset = strokeWidth / 2
|
|
5570
|
+
* // Return points inset by half the stroke width
|
|
5571
|
+
* return [
|
|
5572
|
+
* new Vec(inset, inset),
|
|
5573
|
+
* new Vec(shape.props.w - inset, inset),
|
|
5574
|
+
* new Vec(shape.props.w - inset, shape.props.h - inset),
|
|
5575
|
+
* new Vec(inset, shape.props.h - inset),
|
|
5576
|
+
* ]
|
|
5577
|
+
* }
|
|
5578
|
+
* ```
|
|
5579
|
+
*
|
|
5334
5580
|
* @param shape - The shape to get the clip path for
|
|
5335
5581
|
* @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
|
|
5336
5582
|
* @public
|
|
@@ -5355,37 +5601,37 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5355
5601
|
* @returns boolean indicating if this shape should hide in the minimap
|
|
5356
5602
|
* @public
|
|
5357
5603
|
*/
|
|
5358
|
-
hideInMinimap?(
|
|
5604
|
+
hideInMinimap?(shape: Shape): boolean;
|
|
5359
5605
|
/**
|
|
5360
5606
|
* Whether the shape should hide its resize handles when selected.
|
|
5361
5607
|
*
|
|
5362
5608
|
* @public
|
|
5363
5609
|
*/
|
|
5364
|
-
hideResizeHandles(
|
|
5610
|
+
hideResizeHandles(shape: Shape): boolean;
|
|
5365
5611
|
/**
|
|
5366
5612
|
* Whether the shape should hide its rotation handles when selected.
|
|
5367
5613
|
*
|
|
5368
5614
|
* @public
|
|
5369
5615
|
*/
|
|
5370
|
-
hideRotateHandle(
|
|
5616
|
+
hideRotateHandle(shape: Shape): boolean;
|
|
5371
5617
|
/**
|
|
5372
5618
|
* Whether the shape should hide its selection bounds background when selected.
|
|
5373
5619
|
*
|
|
5374
5620
|
* @public
|
|
5375
5621
|
*/
|
|
5376
|
-
hideSelectionBoundsBg(
|
|
5622
|
+
hideSelectionBoundsBg(shape: Shape): boolean;
|
|
5377
5623
|
/**
|
|
5378
5624
|
* Whether the shape should hide its selection bounds foreground when selected.
|
|
5379
5625
|
*
|
|
5380
5626
|
* @public
|
|
5381
5627
|
*/
|
|
5382
|
-
hideSelectionBoundsFg(
|
|
5628
|
+
hideSelectionBoundsFg(shape: Shape): boolean;
|
|
5383
5629
|
/**
|
|
5384
5630
|
* Whether the shape's aspect ratio is locked.
|
|
5385
5631
|
*
|
|
5386
5632
|
* @public
|
|
5387
5633
|
*/
|
|
5388
|
-
isAspectRatioLocked(
|
|
5634
|
+
isAspectRatioLocked(shape: Shape): boolean;
|
|
5389
5635
|
/**
|
|
5390
5636
|
* By default, the bounds of an image export are the bounds of all the shapes it contains, plus
|
|
5391
5637
|
* some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
|
|
@@ -5393,10 +5639,10 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5393
5639
|
* useful in cases like annotating on top of an image, where you usually want to avoid extra
|
|
5394
5640
|
* padding around the image if you don't need it.
|
|
5395
5641
|
*
|
|
5396
|
-
* @param
|
|
5642
|
+
* @param shape - The shape to check
|
|
5397
5643
|
* @returns True if this shape should be treated as an export bounds container
|
|
5398
5644
|
*/
|
|
5399
|
-
isExportBoundsContainer(
|
|
5645
|
+
isExportBoundsContainer(shape: Shape): boolean;
|
|
5400
5646
|
/* Excluded from this release type: backgroundComponent */
|
|
5401
5647
|
/**
|
|
5402
5648
|
* Get the interpolated props for an animating shape. This is an optional method.
|
|
@@ -5433,7 +5679,7 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5433
5679
|
* @param type - The shape type.
|
|
5434
5680
|
* @public
|
|
5435
5681
|
*/
|
|
5436
|
-
canReceiveNewChildrenOfType(
|
|
5682
|
+
canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
|
|
5437
5683
|
/**
|
|
5438
5684
|
* Get the shape as an SVG object.
|
|
5439
5685
|
*
|
|
@@ -5466,14 +5712,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
5466
5712
|
* Get the geometry to use when snapping to this this shape in translate/resize operations. See
|
|
5467
5713
|
* {@link BoundsSnapGeometry} for details.
|
|
5468
5714
|
*/
|
|
5469
|
-
getBoundsSnapGeometry(
|
|
5715
|
+
getBoundsSnapGeometry(shape: Shape): BoundsSnapGeometry;
|
|
5470
5716
|
/**
|
|
5471
5717
|
* Get the geometry to use when snapping handles to this shape. See {@link HandleSnapGeometry}
|
|
5472
5718
|
* for details.
|
|
5473
5719
|
*/
|
|
5474
|
-
getHandleSnapGeometry(
|
|
5475
|
-
getText(
|
|
5476
|
-
getAriaDescriptor(
|
|
5720
|
+
getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
|
|
5721
|
+
getText(shape: Shape): string | undefined;
|
|
5722
|
+
getAriaDescriptor(shape: Shape): string | undefined;
|
|
5477
5723
|
/**
|
|
5478
5724
|
* A callback called just before a shape is created. This method provides a last chance to modify
|
|
5479
5725
|
* the created shape.
|
|
@@ -5968,7 +6214,7 @@ export declare const stopEventPropagation: (e: any) => any;
|
|
|
5968
6214
|
export declare function suffixSafeId(id: SafeId, suffix: string): SafeId;
|
|
5969
6215
|
|
|
5970
6216
|
/** @public @react */
|
|
5971
|
-
export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps):
|
|
6217
|
+
export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX.Element;
|
|
5972
6218
|
|
|
5973
6219
|
/** @public */
|
|
5974
6220
|
export declare type SVGContainerProps = React_2.ComponentProps<'svg'>;
|
|
@@ -6066,6 +6312,8 @@ export declare class TextManager {
|
|
|
6066
6312
|
}[];
|
|
6067
6313
|
}
|
|
6068
6314
|
|
|
6315
|
+
/* Excluded from this release type: TickManager */
|
|
6316
|
+
|
|
6069
6317
|
/**
|
|
6070
6318
|
* This is the TipTap editor! Docs are {@link https://tiptap.dev/docs}.
|
|
6071
6319
|
*
|
|
@@ -6628,6 +6876,22 @@ export declare interface TldrawOptions {
|
|
|
6628
6876
|
* Defaults to 300 shapes.
|
|
6629
6877
|
*/
|
|
6630
6878
|
readonly debouncedZoomThreshold: number;
|
|
6879
|
+
/**
|
|
6880
|
+
* Whether to allow spacebar panning. When true, the spacebar will pan the camera when held down.
|
|
6881
|
+
* When false, the spacebar will not pan the camera.
|
|
6882
|
+
*/
|
|
6883
|
+
readonly spacebarPanning: boolean;
|
|
6884
|
+
/**
|
|
6885
|
+
* The default padding (in pixels) used when zooming to fit content in the viewport.
|
|
6886
|
+
* This affects methods like `zoomToFit()`, `zoomToSelection()`, and `zoomToBounds()`.
|
|
6887
|
+
* The actual padding used is the minimum of this value and 28% of the viewport width.
|
|
6888
|
+
* Defaults to 128 pixels.
|
|
6889
|
+
*/
|
|
6890
|
+
readonly zoomToFitPadding: number;
|
|
6891
|
+
/**
|
|
6892
|
+
* The distance (in screen pixels) at which shapes snap to guides and other shapes.
|
|
6893
|
+
*/
|
|
6894
|
+
readonly snapThreshold: number;
|
|
6631
6895
|
}
|
|
6632
6896
|
|
|
6633
6897
|
/** @public */
|
|
@@ -6673,7 +6937,7 @@ export declare interface TLEditorComponents {
|
|
|
6673
6937
|
/** @public */
|
|
6674
6938
|
export declare interface TLEditorOptions {
|
|
6675
6939
|
/**
|
|
6676
|
-
* The Store instance to use for keeping the
|
|
6940
|
+
* The Store instance to use for keeping the editor's data. This may be prepopulated, e.g. by loading
|
|
6677
6941
|
* from a server or database.
|
|
6678
6942
|
*/
|
|
6679
6943
|
store: TLStore;
|
|
@@ -6752,6 +7016,11 @@ export declare interface TLEditorSnapshot {
|
|
|
6752
7016
|
session: TLSessionStateSnapshot;
|
|
6753
7017
|
}
|
|
6754
7018
|
|
|
7019
|
+
/** @public */
|
|
7020
|
+
export declare interface TLEditStartInfo {
|
|
7021
|
+
type: 'click-header' | 'click' | 'double-click-corner' | 'double-click-edge' | 'double-click' | 'press_enter' | 'unknown';
|
|
7022
|
+
}
|
|
7023
|
+
|
|
6755
7024
|
/** @public */
|
|
6756
7025
|
export declare interface TLEmbedExternalContent<EmbedDefinition> extends TLBaseExternalContent {
|
|
6757
7026
|
type: 'embed';
|
|
@@ -7967,10 +8236,10 @@ export declare function useMaybeEditor(): Editor | null;
|
|
|
7967
8236
|
/* Excluded from this release type: useOnMount */
|
|
7968
8237
|
|
|
7969
8238
|
/** @public */
|
|
7970
|
-
export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement>): void;
|
|
8239
|
+
export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement | null>): void;
|
|
7971
8240
|
|
|
7972
8241
|
/** @public */
|
|
7973
|
-
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
|
|
8242
|
+
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
|
|
7974
8243
|
|
|
7975
8244
|
/**
|
|
7976
8245
|
* @returns The list of peer UserIDs
|
|
@@ -8078,7 +8347,7 @@ export declare function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreS
|
|
|
8078
8347
|
export declare function useTLStore(opts: TLStoreOptions): TLStore;
|
|
8079
8348
|
|
|
8080
8349
|
/** @public */
|
|
8081
|
-
export declare function useTransform(ref: React.RefObject<HTMLElement | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
|
|
8350
|
+
export declare function useTransform(ref: React.RefObject<HTMLElement | null | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
|
|
8082
8351
|
|
|
8083
8352
|
/**
|
|
8084
8353
|
* React's useId hook returns a unique id for the component. However, it uses a colon in the id,
|