@tldraw/editor 4.3.0-next.f4772c19540d → 4.3.0
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 +498 -155
- package/dist-cjs/index.js +6 -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/components/default-components/DefaultCanvas.js +3 -3
- package/dist-cjs/lib/components/default-components/DefaultCanvas.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 +292 -286
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/bindingsIndex.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/BaseBoxShapeUtil.js.map +1 -1
- 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/shapes/group/DashedOutlineBox.js +1 -1
- package/dist-cjs/lib/editor/shapes/group/DashedOutlineBox.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.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/editor/types/emit-types.js.map +1 -1
- package/dist-cjs/lib/exports/getSvgJsx.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/globals/environment.js +45 -9
- package/dist-cjs/lib/globals/environment.js.map +2 -2
- package/dist-cjs/lib/globals/menus.js +1 -1
- package/dist-cjs/lib/globals/menus.js.map +2 -2
- package/dist-cjs/lib/hooks/useCoarsePointer.js +14 -29
- package/dist-cjs/lib/hooks/useCoarsePointer.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/hooks/useZoomCss.js +4 -8
- package/dist-cjs/lib/hooks/useZoomCss.js.map +2 -2
- package/dist-cjs/lib/options.js +6 -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/reparenting.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 +498 -155
- package/dist-esm/index.mjs +7 -2
- 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/components/default-components/DefaultCanvas.mjs +3 -3
- package/dist-esm/lib/components/default-components/DefaultCanvas.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 +293 -289
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/bindingsIndex.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/BaseBoxShapeUtil.mjs.map +1 -1
- 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/shapes/group/DashedOutlineBox.mjs +1 -1
- package/dist-esm/lib/editor/shapes/group/DashedOutlineBox.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.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/getSvgJsx.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/globals/environment.mjs +45 -9
- package/dist-esm/lib/globals/environment.mjs.map +2 -2
- package/dist-esm/lib/globals/menus.mjs +1 -1
- package/dist-esm/lib/globals/menus.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCoarsePointer.mjs +15 -30
- package/dist-esm/lib/hooks/useCoarsePointer.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/hooks/useZoomCss.mjs +4 -8
- package/dist-esm/lib/hooks/useZoomCss.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +6 -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/reparenting.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 +14 -12
- package/package.json +18 -16
- package/src/index.ts +4 -1
- package/src/lib/components/ErrorBoundary.tsx +1 -1
- package/src/lib/components/GeometryDebuggingView.tsx +1 -19
- package/src/lib/components/default-components/DefaultCanvas.tsx +4 -3
- package/src/lib/config/TLUserPreferences.test.ts +40 -0
- package/src/lib/constants.ts +0 -2
- package/src/lib/editor/Editor.test.ts +150 -10
- package/src/lib/editor/Editor.ts +459 -379
- package/src/lib/editor/bindings/BindingUtil.ts +15 -9
- package/src/lib/editor/derivations/bindingsIndex.ts +2 -2
- 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/FontManager/FontManager.test.ts +14 -4
- 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 +4 -4
- 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/BaseBoxShapeUtil.tsx +2 -2
- package/src/lib/editor/shapes/ShapeUtil.ts +72 -32
- package/src/lib/editor/shapes/group/DashedOutlineBox.tsx +1 -1
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +1 -3
- package/src/lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.ts +2 -1
- package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +6 -6
- package/src/lib/editor/types/emit-types.ts +3 -1
- package/src/lib/exports/getSvgJsx.test.ts +10 -19
- package/src/lib/exports/getSvgJsx.tsx +2 -5
- package/src/lib/exports/parseCss.test.ts +1 -0
- package/src/lib/exports/parseCss.ts +1 -1
- package/src/lib/globals/environment.ts +65 -10
- package/src/lib/globals/menus.ts +1 -1
- package/src/lib/hooks/useCoarsePointer.ts +16 -59
- 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/hooks/useZoomCss.ts +3 -8
- package/src/lib/options.ts +32 -0
- package/src/lib/primitives/Box.ts +9 -0
- package/src/lib/primitives/geometry/Geometry2d.ts +1 -0
- package/src/lib/utils/reparenting.ts +5 -5
- 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';
|
|
@@ -7,11 +8,13 @@ import { Editor as Editor_2 } from '@tiptap/core';
|
|
|
7
8
|
import { EditorProviderProps as EditorProviderProps_2 } from '@tiptap/react';
|
|
8
9
|
import EventEmitter from 'eventemitter3';
|
|
9
10
|
import { ExoticComponent } from 'react';
|
|
11
|
+
import { ExtractShapeByProps } from '@tldraw/tlschema';
|
|
10
12
|
import { ForwardRefExoticComponent } from 'react';
|
|
13
|
+
import { FragmentProps } from 'react';
|
|
11
14
|
import { HistoryEntry } from '@tldraw/store';
|
|
12
15
|
import { IndexKey } from '@tldraw/utils';
|
|
13
16
|
import { JsonObject } from '@tldraw/utils';
|
|
14
|
-
import { JSX
|
|
17
|
+
import { JSX } from 'react/jsx-runtime';
|
|
15
18
|
import { LegacyMigrations } from '@tldraw/store';
|
|
16
19
|
import { MigrationSequence } from '@tldraw/store';
|
|
17
20
|
import { NamedExoticComponent } from 'react';
|
|
@@ -48,6 +51,7 @@ import { TLBindingId } from '@tldraw/tlschema';
|
|
|
48
51
|
import { TLBindingUpdate } from '@tldraw/tlschema';
|
|
49
52
|
import { TLBookmarkAsset } from '@tldraw/tlschema';
|
|
50
53
|
import { TLCamera } from '@tldraw/tlschema';
|
|
54
|
+
import { TLCreateShapePartial } from '@tldraw/tlschema';
|
|
51
55
|
import { TLCursor } from '@tldraw/tlschema';
|
|
52
56
|
import { TLCursorType } from '@tldraw/tlschema';
|
|
53
57
|
import { TLDefaultDashStyle } from '@tldraw/tlschema';
|
|
@@ -147,7 +151,7 @@ export declare abstract class BaseBoxShapeTool extends StateNode {
|
|
|
147
151
|
static id: string;
|
|
148
152
|
static initial: string;
|
|
149
153
|
static children(): TLStateNodeConstructor[];
|
|
150
|
-
abstract shapeType:
|
|
154
|
+
abstract shapeType: TLBaseBoxShape['type'];
|
|
151
155
|
onCreate?(_shape: null | TLShape): null | void;
|
|
152
156
|
}
|
|
153
157
|
|
|
@@ -165,7 +169,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
|
|
|
165
169
|
*
|
|
166
170
|
* @public
|
|
167
171
|
*/
|
|
168
|
-
export declare interface BindingOnChangeOptions<Binding extends
|
|
172
|
+
export declare interface BindingOnChangeOptions<Binding extends TLBinding = TLBinding> {
|
|
169
173
|
/** The binding record before the change is made. */
|
|
170
174
|
bindingBefore: Binding;
|
|
171
175
|
/** The binding record after the change is made. */
|
|
@@ -178,7 +182,7 @@ export declare interface BindingOnChangeOptions<Binding extends TLUnknownBinding
|
|
|
178
182
|
*
|
|
179
183
|
* @public
|
|
180
184
|
*/
|
|
181
|
-
export declare interface BindingOnCreateOptions<Binding extends
|
|
185
|
+
export declare interface BindingOnCreateOptions<Binding extends TLBinding = TLBinding> {
|
|
182
186
|
/** The binding being created. */
|
|
183
187
|
binding: Binding;
|
|
184
188
|
}
|
|
@@ -189,7 +193,7 @@ export declare interface BindingOnCreateOptions<Binding extends TLUnknownBinding
|
|
|
189
193
|
*
|
|
190
194
|
* @public
|
|
191
195
|
*/
|
|
192
|
-
export declare interface BindingOnDeleteOptions<Binding extends
|
|
196
|
+
export declare interface BindingOnDeleteOptions<Binding extends TLBinding = TLBinding> {
|
|
193
197
|
/** The binding being deleted. */
|
|
194
198
|
binding: Binding;
|
|
195
199
|
}
|
|
@@ -200,7 +204,7 @@ export declare interface BindingOnDeleteOptions<Binding extends TLUnknownBinding
|
|
|
200
204
|
*
|
|
201
205
|
* @public
|
|
202
206
|
*/
|
|
203
|
-
export declare interface BindingOnShapeChangeOptions<Binding extends
|
|
207
|
+
export declare interface BindingOnShapeChangeOptions<Binding extends TLBinding = TLBinding> {
|
|
204
208
|
/** The binding record linking these two shapes. */
|
|
205
209
|
binding: Binding;
|
|
206
210
|
/** The shape record before the change is made. */
|
|
@@ -224,7 +228,7 @@ export declare interface BindingOnShapeChangeOptions<Binding extends TLUnknownBi
|
|
|
224
228
|
*
|
|
225
229
|
* @public
|
|
226
230
|
*/
|
|
227
|
-
export declare interface BindingOnShapeDeleteOptions<Binding extends
|
|
231
|
+
export declare interface BindingOnShapeDeleteOptions<Binding extends TLBinding = TLBinding> {
|
|
228
232
|
/** The binding record that refers to the shape in question. */
|
|
229
233
|
binding: Binding;
|
|
230
234
|
/** The shape that is about to be deleted. */
|
|
@@ -256,7 +260,7 @@ export declare interface BindingOnShapeDeleteOptions<Binding extends TLUnknownBi
|
|
|
256
260
|
*
|
|
257
261
|
* @public
|
|
258
262
|
*/
|
|
259
|
-
export declare interface BindingOnShapeIsolateOptions<Binding extends
|
|
263
|
+
export declare interface BindingOnShapeIsolateOptions<Binding extends TLBinding = TLBinding> {
|
|
260
264
|
/** The binding record that refers to the shape in question. */
|
|
261
265
|
binding: Binding;
|
|
262
266
|
/**
|
|
@@ -267,7 +271,7 @@ export declare interface BindingOnShapeIsolateOptions<Binding extends TLUnknownB
|
|
|
267
271
|
}
|
|
268
272
|
|
|
269
273
|
/** @public */
|
|
270
|
-
export declare abstract class BindingUtil<Binding extends
|
|
274
|
+
export declare abstract class BindingUtil<Binding extends TLBinding = TLBinding> {
|
|
271
275
|
editor: Editor;
|
|
272
276
|
constructor(editor: Editor);
|
|
273
277
|
static props?: RecordProps<TLUnknownBinding>;
|
|
@@ -486,6 +490,7 @@ export declare class Box {
|
|
|
486
490
|
get cornersAndCenter(): Vec[];
|
|
487
491
|
get sides(): Array<[Vec, Vec]>;
|
|
488
492
|
get size(): Vec;
|
|
493
|
+
isValid(): boolean;
|
|
489
494
|
toFixed(): this;
|
|
490
495
|
setTo(B: Box): this;
|
|
491
496
|
set(x?: number, y?: number, w?: number, h?: number): this;
|
|
@@ -653,7 +658,7 @@ export declare function clockwiseAngleDist(a0: number, a1: number): number;
|
|
|
653
658
|
* @public
|
|
654
659
|
* @react
|
|
655
660
|
*/
|
|
656
|
-
export declare function ContainerProvider({ container, children }: ContainerProviderProps):
|
|
661
|
+
export declare function ContainerProvider({ container, children }: ContainerProviderProps): JSX.Element;
|
|
657
662
|
|
|
658
663
|
/** @public */
|
|
659
664
|
export declare interface ContainerProviderProps {
|
|
@@ -794,16 +799,16 @@ export declare interface DebugFlagDefaults<T> {
|
|
|
794
799
|
/* Excluded from this release type: DEFAULT_CAMERA_OPTIONS */
|
|
795
800
|
|
|
796
801
|
/** @public @react */
|
|
797
|
-
export declare function DefaultBackground():
|
|
802
|
+
export declare function DefaultBackground(): JSX.Element;
|
|
798
803
|
|
|
799
804
|
/** @public @react */
|
|
800
|
-
export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) =>
|
|
805
|
+
export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
|
|
801
806
|
|
|
802
807
|
/** @public @react */
|
|
803
|
-
export declare function DefaultCanvas({ className }: TLCanvasComponentProps):
|
|
808
|
+
export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
|
|
804
809
|
|
|
805
810
|
/** @public @react */
|
|
806
|
-
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;
|
|
807
812
|
|
|
808
813
|
/** @public @react */
|
|
809
814
|
export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
|
|
@@ -812,22 +817,22 @@ export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
|
|
|
812
817
|
export declare const DefaultErrorFallback: TLErrorFallbackComponent;
|
|
813
818
|
|
|
814
819
|
/** @public @react */
|
|
815
|
-
export declare function DefaultGrid({ x, y, z, size }: TLGridProps):
|
|
820
|
+
export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
|
|
816
821
|
|
|
817
822
|
/** @public @react */
|
|
818
|
-
export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps):
|
|
823
|
+
export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
|
|
819
824
|
|
|
820
825
|
/** @public @react */
|
|
821
|
-
export declare const DefaultHandles: ({ children }: TLHandlesProps) =>
|
|
826
|
+
export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
|
|
822
827
|
|
|
823
828
|
/** @public @react */
|
|
824
|
-
export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps):
|
|
829
|
+
export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX.Element | null;
|
|
825
830
|
|
|
826
831
|
/** @public @react */
|
|
827
|
-
export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps):
|
|
832
|
+
export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
|
|
828
833
|
|
|
829
834
|
/** @public @react */
|
|
830
|
-
export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps):
|
|
835
|
+
export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
|
|
831
836
|
|
|
832
837
|
/** @public @react */
|
|
833
838
|
export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
|
|
@@ -839,10 +844,10 @@ export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicat
|
|
|
839
844
|
export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
840
845
|
|
|
841
846
|
/** @public @react */
|
|
842
|
-
export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps):
|
|
847
|
+
export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
|
|
843
848
|
|
|
844
849
|
/** @public @react */
|
|
845
|
-
export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>):
|
|
850
|
+
export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
|
|
846
851
|
|
|
847
852
|
/** @public @react */
|
|
848
853
|
export declare const DefaultSvgDefs: () => null;
|
|
@@ -861,6 +866,8 @@ export declare const defaultTldrawOptions: {
|
|
|
861
866
|
readonly collaboratorIdleTimeoutMs: 3000;
|
|
862
867
|
readonly collaboratorInactiveTimeoutMs: 60000;
|
|
863
868
|
readonly createTextOnCanvasDoubleClick: true;
|
|
869
|
+
readonly debouncedZoom: true;
|
|
870
|
+
readonly debouncedZoomThreshold: 500;
|
|
864
871
|
readonly defaultSvgPadding: 32;
|
|
865
872
|
readonly doubleClickDurationMs: 450;
|
|
866
873
|
readonly dragDistanceSquared: 16;
|
|
@@ -869,9 +876,7 @@ export declare const defaultTldrawOptions: {
|
|
|
869
876
|
readonly edgeScrollEaseDuration: 200;
|
|
870
877
|
readonly edgeScrollSpeed: 25;
|
|
871
878
|
readonly enableToolbarKeyboardShortcuts: true;
|
|
872
|
-
readonly exportProvider: ExoticComponent<
|
|
873
|
-
children?: ReactNode | undefined;
|
|
874
|
-
}>;
|
|
879
|
+
readonly exportProvider: ExoticComponent<FragmentProps>;
|
|
875
880
|
readonly flattenImageBoundsExpand: 64;
|
|
876
881
|
readonly flattenImageBoundsPadding: 16;
|
|
877
882
|
readonly followChaseViewportSnap: 2;
|
|
@@ -903,11 +908,14 @@ export declare const defaultTldrawOptions: {
|
|
|
903
908
|
readonly maxShapesPerPage: 4000;
|
|
904
909
|
readonly multiClickDurationMs: 200;
|
|
905
910
|
readonly nonce: undefined;
|
|
911
|
+
readonly snapThreshold: 8;
|
|
912
|
+
readonly spacebarPanning: true;
|
|
906
913
|
readonly temporaryAssetPreviewLifetimeMs: 180000;
|
|
907
914
|
readonly textShadowLod: 0.35;
|
|
908
915
|
readonly tooltipDelayMs: 700;
|
|
909
916
|
readonly uiCoarseDragDistanceSquared: 625;
|
|
910
917
|
readonly uiDragDistanceSquared: 16;
|
|
918
|
+
readonly zoomToFitPadding: 128;
|
|
911
919
|
};
|
|
912
920
|
|
|
913
921
|
/** @public */
|
|
@@ -981,6 +989,7 @@ export declare class EdgeScrollManager {
|
|
|
981
989
|
constructor(editor: Editor);
|
|
982
990
|
private _isEdgeScrolling;
|
|
983
991
|
private _edgeScrollDuration;
|
|
992
|
+
getIsEdgeScrolling(): boolean;
|
|
984
993
|
/**
|
|
985
994
|
* Update the camera position when the mouse is close to the edge of the screen.
|
|
986
995
|
* Run this on every tick when in a state where edge scrolling is enabled.
|
|
@@ -1039,7 +1048,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1039
1048
|
*/
|
|
1040
1049
|
removeTool(Tool: TLStateNodeConstructor, parent?: StateNode): void;
|
|
1041
1050
|
/**
|
|
1042
|
-
* A set of functions to call when the
|
|
1051
|
+
* A set of functions to call when the editor is disposed.
|
|
1043
1052
|
*
|
|
1044
1053
|
* @public
|
|
1045
1054
|
*/
|
|
@@ -1052,7 +1061,13 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1052
1061
|
isDisposed: boolean;
|
|
1053
1062
|
/* Excluded from this release type: _tickManager */
|
|
1054
1063
|
/**
|
|
1055
|
-
* 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.
|
|
1056
1071
|
*
|
|
1057
1072
|
* @public
|
|
1058
1073
|
*/
|
|
@@ -1129,7 +1144,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1129
1144
|
* @public
|
|
1130
1145
|
*/
|
|
1131
1146
|
shapeUtils: {
|
|
1132
|
-
readonly [K in string]?: ShapeUtil<
|
|
1147
|
+
readonly [K in string]?: ShapeUtil<TLShape>;
|
|
1133
1148
|
};
|
|
1134
1149
|
styleProps: {
|
|
1135
1150
|
[key: string]: Map<StyleProp<any>, string>;
|
|
@@ -1149,16 +1164,18 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1149
1164
|
*
|
|
1150
1165
|
* @public
|
|
1151
1166
|
*/
|
|
1152
|
-
getShapeUtil<
|
|
1153
|
-
|
|
1167
|
+
getShapeUtil<K extends TLShape['type']>(type: K): ShapeUtil<Extract<TLShape, {
|
|
1168
|
+
type: K;
|
|
1169
|
+
}>>;
|
|
1170
|
+
getShapeUtil<S extends TLShape>(shape: S | S['type'] | TLShapePartial<S>): ShapeUtil<S>;
|
|
1154
1171
|
getShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): T;
|
|
1155
1172
|
/**
|
|
1156
1173
|
* Returns true if the editor has a shape util for the given shape / shape type.
|
|
1157
1174
|
*
|
|
1158
1175
|
* @param shape - A shape, shape partial, or shape type.
|
|
1159
1176
|
*/
|
|
1160
|
-
hasShapeUtil
|
|
1161
|
-
hasShapeUtil
|
|
1177
|
+
hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
|
|
1178
|
+
hasShapeUtil(type: TLShape['type']): boolean;
|
|
1162
1179
|
hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
|
|
1163
1180
|
/**
|
|
1164
1181
|
* A map of shape utility classes (TLShapeUtils) by shape type.
|
|
@@ -1166,7 +1183,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1166
1183
|
* @public
|
|
1167
1184
|
*/
|
|
1168
1185
|
bindingUtils: {
|
|
1169
|
-
readonly [K in string]?: BindingUtil<
|
|
1186
|
+
readonly [K in string]?: BindingUtil<TLBinding>;
|
|
1170
1187
|
};
|
|
1171
1188
|
/**
|
|
1172
1189
|
* Get a binding util from a binding itself.
|
|
@@ -1183,13 +1200,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1183
1200
|
*
|
|
1184
1201
|
* @public
|
|
1185
1202
|
*/
|
|
1186
|
-
getBindingUtil<
|
|
1203
|
+
getBindingUtil<K extends TLBinding['type']>(type: K): BindingUtil<Extract<TLBinding, {
|
|
1204
|
+
type: K;
|
|
1205
|
+
}>>;
|
|
1206
|
+
getBindingUtil<S extends TLBinding>(binding: {
|
|
1187
1207
|
type: S['type'];
|
|
1188
1208
|
} | S): BindingUtil<S>;
|
|
1189
|
-
getBindingUtil<S extends TLUnknownBinding>(type: S['type']): BindingUtil<S>;
|
|
1190
1209
|
getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
|
|
1191
1210
|
/**
|
|
1192
|
-
* A manager for the
|
|
1211
|
+
* A manager for the editor's history.
|
|
1193
1212
|
*
|
|
1194
1213
|
* @readonly
|
|
1195
1214
|
*/
|
|
@@ -1206,10 +1225,11 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1206
1225
|
*/
|
|
1207
1226
|
undo(): this;
|
|
1208
1227
|
/**
|
|
1209
|
-
* Whether the
|
|
1228
|
+
* Whether the editor can undo.
|
|
1210
1229
|
*
|
|
1211
1230
|
* @public
|
|
1212
1231
|
*/
|
|
1232
|
+
canUndo(): boolean;
|
|
1213
1233
|
getCanUndo(): boolean;
|
|
1214
1234
|
/**
|
|
1215
1235
|
* Redo to the next mark.
|
|
@@ -1222,13 +1242,14 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1222
1242
|
* @public
|
|
1223
1243
|
*/
|
|
1224
1244
|
redo(): this;
|
|
1225
|
-
clearHistory(): this;
|
|
1226
1245
|
/**
|
|
1227
|
-
* Whether the
|
|
1246
|
+
* Whether the editor can redo.
|
|
1228
1247
|
*
|
|
1229
1248
|
* @public
|
|
1230
1249
|
*/
|
|
1250
|
+
canRedo(): boolean;
|
|
1231
1251
|
getCanRedo(): boolean;
|
|
1252
|
+
clearHistory(): this;
|
|
1232
1253
|
/**
|
|
1233
1254
|
* Create a new "mark", or stopping point, in the undo redo history. Creating a mark will clear
|
|
1234
1255
|
* any redos. You typically want to do this just before a user interaction begins or is handled.
|
|
@@ -1587,7 +1608,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1587
1608
|
*/
|
|
1588
1609
|
selectNone(): this;
|
|
1589
1610
|
/**
|
|
1590
|
-
* The id of the
|
|
1611
|
+
* The id of the editor's only selected shape.
|
|
1591
1612
|
*
|
|
1592
1613
|
* @returns Null if there is no shape or more than one selected shape, otherwise the selected shape's id.
|
|
1593
1614
|
*
|
|
@@ -1596,7 +1617,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1596
1617
|
*/
|
|
1597
1618
|
getOnlySelectedShapeId(): null | TLShapeId;
|
|
1598
1619
|
/**
|
|
1599
|
-
* The
|
|
1620
|
+
* The editor's only selected shape.
|
|
1600
1621
|
*
|
|
1601
1622
|
* @returns Null if there is no shape or more than one selected shape, otherwise the selected shape.
|
|
1602
1623
|
*
|
|
@@ -1688,6 +1709,16 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1688
1709
|
* @public
|
|
1689
1710
|
*/
|
|
1690
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;
|
|
1691
1722
|
/**
|
|
1692
1723
|
* Set the current editing shape.
|
|
1693
1724
|
*
|
|
@@ -1807,6 +1838,15 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1807
1838
|
* @public
|
|
1808
1839
|
*/
|
|
1809
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;
|
|
1810
1850
|
/**
|
|
1811
1851
|
* Set the current cropping shape.
|
|
1812
1852
|
*
|
|
@@ -1849,6 +1889,32 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1849
1889
|
* @public
|
|
1850
1890
|
*/
|
|
1851
1891
|
getZoomLevel(): number;
|
|
1892
|
+
private _debouncedZoomLevel;
|
|
1893
|
+
/**
|
|
1894
|
+
* Get the debounced zoom level. When the camera is moving, this returns the zoom level
|
|
1895
|
+
* from when the camera started moving rather than the current zoom level. This can be
|
|
1896
|
+
* used to avoid expensive re-renders during camera movements.
|
|
1897
|
+
*
|
|
1898
|
+
* This behavior is controlled by the `useDebouncedZoom` option. When `useDebouncedZoom`
|
|
1899
|
+
* is `false`, this method always returns the current zoom level.
|
|
1900
|
+
*
|
|
1901
|
+
* @public
|
|
1902
|
+
*/
|
|
1903
|
+
getDebouncedZoomLevel(): number;
|
|
1904
|
+
private _getAboveDebouncedZoomThreshold;
|
|
1905
|
+
/**
|
|
1906
|
+
* Get the efficient zoom level. This returns the current zoom level if there are less than 300 shapes on the page,
|
|
1907
|
+
* otherwise it returns the debounced zoom level. This can be used to avoid expensive re-renders during camera movements.
|
|
1908
|
+
*
|
|
1909
|
+
* @public
|
|
1910
|
+
* @example
|
|
1911
|
+
* ```ts
|
|
1912
|
+
* editor.getEfficientZoomLevel()
|
|
1913
|
+
* ```
|
|
1914
|
+
*
|
|
1915
|
+
* @public
|
|
1916
|
+
*/
|
|
1917
|
+
getEfficientZoomLevel(): number;
|
|
1852
1918
|
/**
|
|
1853
1919
|
* Get the camera's initial or reset zoom level.
|
|
1854
1920
|
*
|
|
@@ -1963,7 +2029,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1963
2029
|
* ```ts
|
|
1964
2030
|
* editor.zoomIn()
|
|
1965
2031
|
* editor.zoomIn(editor.getViewportScreenCenter(), { animation: { duration: 200 } })
|
|
1966
|
-
* editor.zoomIn(editor.inputs.
|
|
2032
|
+
* editor.zoomIn(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 200 } })
|
|
1967
2033
|
* ```
|
|
1968
2034
|
*
|
|
1969
2035
|
* @param point - The screen point to zoom in on. Defaults to the screen center
|
|
@@ -1979,7 +2045,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1979
2045
|
* ```ts
|
|
1980
2046
|
* editor.zoomOut()
|
|
1981
2047
|
* editor.zoomOut(editor.getViewportScreenCenter(), { animation: { duration: 120 } })
|
|
1982
|
-
* editor.zoomOut(editor.inputs.
|
|
2048
|
+
* editor.zoomOut(editor.inputs.getCurrentScreenPoint(), { animation: { duration: 120 } })
|
|
1983
2049
|
* ```
|
|
1984
2050
|
*
|
|
1985
2051
|
* @param point - The point to zoom out on. Defaults to the viewport screen center.
|
|
@@ -2192,8 +2258,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2192
2258
|
/* Excluded from this release type: getUnorderedRenderingShapes */
|
|
2193
2259
|
private _cameraState;
|
|
2194
2260
|
private _cameraStateTimeoutRemaining;
|
|
2195
|
-
_decayCameraStateTimeout
|
|
2196
|
-
_tickCameraState
|
|
2261
|
+
private _decayCameraStateTimeout;
|
|
2262
|
+
private _tickCameraState;
|
|
2197
2263
|
/**
|
|
2198
2264
|
* Whether the camera is moving or idle.
|
|
2199
2265
|
*
|
|
@@ -2765,7 +2831,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2765
2831
|
*
|
|
2766
2832
|
* @example
|
|
2767
2833
|
* ```ts
|
|
2768
|
-
* const isArrowShape = isShapeOfType
|
|
2834
|
+
* const isArrowShape = isShapeOfType(someShape, 'arrow')
|
|
2769
2835
|
* ```
|
|
2770
2836
|
*
|
|
2771
2837
|
* @param util - the TLShapeUtil constructor to test against
|
|
@@ -2773,8 +2839,13 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2773
2839
|
*
|
|
2774
2840
|
* @public
|
|
2775
2841
|
*/
|
|
2776
|
-
isShapeOfType<
|
|
2777
|
-
|
|
2842
|
+
isShapeOfType<K extends TLShape['type']>(shape: TLShape, type: K): shape is Extract<TLShape, {
|
|
2843
|
+
type: K;
|
|
2844
|
+
}>;
|
|
2845
|
+
isShapeOfType<T extends TLShape>(shape: TLShape, type: T['type']): shape is Extract<TLShape, {
|
|
2846
|
+
type: T['type'];
|
|
2847
|
+
}>;
|
|
2848
|
+
isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
|
|
2778
2849
|
/**
|
|
2779
2850
|
* Get a shape by its id.
|
|
2780
2851
|
*
|
|
@@ -2925,17 +2996,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2925
2996
|
* Get all bindings of a certain type _from_ a particular shape. These are the bindings whose
|
|
2926
2997
|
* `fromId` matched the shape's ID.
|
|
2927
2998
|
*/
|
|
2928
|
-
getBindingsFromShape<
|
|
2999
|
+
getBindingsFromShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
3000
|
+
type: K;
|
|
3001
|
+
}>[];
|
|
3002
|
+
getBindingsFromShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
|
|
2929
3003
|
/**
|
|
2930
3004
|
* Get all bindings of a certain type _to_ a particular shape. These are the bindings whose
|
|
2931
3005
|
* `toId` matches the shape's ID.
|
|
2932
3006
|
*/
|
|
2933
|
-
getBindingsToShape<
|
|
3007
|
+
getBindingsToShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
3008
|
+
type: K;
|
|
3009
|
+
}>[];
|
|
3010
|
+
getBindingsToShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
|
|
2934
3011
|
/**
|
|
2935
3012
|
* Get all bindings involving a particular shape. This includes bindings where the shape is the
|
|
2936
3013
|
* `fromId` or `toId`. If a type is provided, only bindings of that type are returned.
|
|
2937
3014
|
*/
|
|
2938
|
-
getBindingsInvolvingShape<
|
|
3015
|
+
getBindingsInvolvingShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
3016
|
+
type: K;
|
|
3017
|
+
}>[];
|
|
3018
|
+
getBindingsInvolvingShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type?: Binding['type']): Binding[];
|
|
2939
3019
|
/**
|
|
2940
3020
|
* Create bindings from a list of partial bindings. You can omit the ID and most props of a
|
|
2941
3021
|
* binding, but the `type`, `toId`, and `fromId` must all be provided.
|
|
@@ -3250,7 +3330,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3250
3330
|
*
|
|
3251
3331
|
* @public
|
|
3252
3332
|
*/
|
|
3253
|
-
canCreateShape
|
|
3333
|
+
canCreateShape(shape: OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id']): boolean;
|
|
3254
3334
|
/**
|
|
3255
3335
|
* Get whether the provided shapes can be created.
|
|
3256
3336
|
*
|
|
@@ -3258,7 +3338,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3258
3338
|
*
|
|
3259
3339
|
* @public
|
|
3260
3340
|
*/
|
|
3261
|
-
canCreateShapes
|
|
3341
|
+
canCreateShapes(shapes: (OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id'])[]): boolean;
|
|
3262
3342
|
/**
|
|
3263
3343
|
* Create a single shape.
|
|
3264
3344
|
*
|
|
@@ -3272,7 +3352,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3272
3352
|
*
|
|
3273
3353
|
* @public
|
|
3274
3354
|
*/
|
|
3275
|
-
createShape<
|
|
3355
|
+
createShape<TShape extends TLShape>(shape: TLCreateShapePartial<TShape>): this;
|
|
3276
3356
|
/**
|
|
3277
3357
|
* Create shapes.
|
|
3278
3358
|
*
|
|
@@ -3286,7 +3366,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3286
3366
|
*
|
|
3287
3367
|
* @public
|
|
3288
3368
|
*/
|
|
3289
|
-
createShapes<
|
|
3369
|
+
createShapes<TShape extends TLShape = TLShape>(shapes: TLCreateShapePartial<TShape>[]): this;
|
|
3290
3370
|
private animatingShapes;
|
|
3291
3371
|
/**
|
|
3292
3372
|
* Animate a shape.
|
|
@@ -3372,7 +3452,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3372
3452
|
*
|
|
3373
3453
|
* @public
|
|
3374
3454
|
*/
|
|
3375
|
-
updateShape<T extends
|
|
3455
|
+
updateShape<T extends TLShape = TLShape>(partial: null | TLShapePartial<T> | undefined): this;
|
|
3376
3456
|
/**
|
|
3377
3457
|
* Update shapes using partials of each shape.
|
|
3378
3458
|
*
|
|
@@ -3385,7 +3465,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3385
3465
|
*
|
|
3386
3466
|
* @public
|
|
3387
3467
|
*/
|
|
3388
|
-
updateShapes<T extends
|
|
3468
|
+
updateShapes<T extends TLShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
|
|
3389
3469
|
/* Excluded from this release type: _updateShapes */
|
|
3390
3470
|
/* Excluded from this release type: _getUnlockedShapeIds */
|
|
3391
3471
|
/**
|
|
@@ -3700,59 +3780,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3700
3780
|
url: string;
|
|
3701
3781
|
width: number;
|
|
3702
3782
|
}>;
|
|
3703
|
-
/**
|
|
3704
|
-
* The app's current input state.
|
|
3705
|
-
*
|
|
3706
|
-
* @public
|
|
3707
|
-
*/
|
|
3708
|
-
inputs: {
|
|
3709
|
-
/** A set containing the currently pressed buttons. */
|
|
3710
|
-
buttons: Set<number>;
|
|
3711
|
-
/** A set containing the currently pressed keys. */
|
|
3712
|
-
keys: Set<string>;
|
|
3713
|
-
/** The most recent pointer down's position in screen space. */
|
|
3714
|
-
originScreenPoint: Vec;
|
|
3715
|
-
/** The most recent pointer down's position in the current page space. */
|
|
3716
|
-
originPagePoint: Vec;
|
|
3717
|
-
/** The most recent pointer position in screen space. */
|
|
3718
|
-
currentScreenPoint: Vec;
|
|
3719
|
-
/** The most recent pointer position in the current page space. */
|
|
3720
|
-
currentPagePoint: Vec;
|
|
3721
|
-
/** The previous pointer position in screen space. */
|
|
3722
|
-
previousScreenPoint: Vec;
|
|
3723
|
-
/** The previous pointer position in the current page space. */
|
|
3724
|
-
previousPagePoint: Vec;
|
|
3725
|
-
/** Velocity of mouse pointer, in pixels per millisecond */
|
|
3726
|
-
pointerVelocity: Vec;
|
|
3727
|
-
/** Whether the alt or option key is currently pressed. */
|
|
3728
|
-
altKey: boolean;
|
|
3729
|
-
/** Whether the control or command key is currently pressed. */
|
|
3730
|
-
ctrlKey: boolean;
|
|
3731
|
-
/** Whether the input is from a pe. */
|
|
3732
|
-
isPen: boolean;
|
|
3733
|
-
/** Whether the meta key is currently pressed. */
|
|
3734
|
-
metaKey: boolean;
|
|
3735
|
-
/** Whether the shift key is currently pressed. */
|
|
3736
|
-
shiftKey: boolean;
|
|
3737
|
-
/** Whether the user is dragging. */
|
|
3738
|
-
isDragging: boolean;
|
|
3739
|
-
/** Whether the user is editing. */
|
|
3740
|
-
isEditing: boolean;
|
|
3741
|
-
/** Whether the user is panning. */
|
|
3742
|
-
isPanning: boolean;
|
|
3743
|
-
/** Whether the user is pinching. */
|
|
3744
|
-
isPinching: boolean;
|
|
3745
|
-
/** Whether the user is pointing. */
|
|
3746
|
-
isPointing: boolean;
|
|
3747
|
-
/** Whether the user is spacebar panning. */
|
|
3748
|
-
isSpacebarPanning: boolean;
|
|
3749
|
-
};
|
|
3750
|
-
/**
|
|
3751
|
-
* Update the input points from a pointer, pinch, or wheel event.
|
|
3752
|
-
*
|
|
3753
|
-
* @param info - The event info.
|
|
3754
|
-
*/
|
|
3755
|
-
private _updateInputsFromEvent;
|
|
3756
3783
|
/**
|
|
3757
3784
|
* Dispatch a cancel event.
|
|
3758
3785
|
*
|
|
@@ -3998,7 +4025,6 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3998
4025
|
/* Excluded from this release type: _metaKeyTimeout */
|
|
3999
4026
|
/* Excluded from this release type: _setMetaKeyTimeout */
|
|
4000
4027
|
/* Excluded from this release type: _restoreToolId */
|
|
4001
|
-
/* Excluded from this release type: _pinchStart */
|
|
4002
4028
|
/* Excluded from this release type: _didPinch */
|
|
4003
4029
|
/* Excluded from this release type: _selectedShapeIdsAtPointerDown */
|
|
4004
4030
|
/* Excluded from this release type: _longPressTimeout */
|
|
@@ -4073,7 +4099,7 @@ export declare class EditorAtom<T> {
|
|
|
4073
4099
|
export declare const EditorContext: React_3.Context<Editor | null>;
|
|
4074
4100
|
|
|
4075
4101
|
/** @public @react */
|
|
4076
|
-
export declare function EditorProvider({ editor, children }: EditorProviderProps):
|
|
4102
|
+
export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX.Element;
|
|
4077
4103
|
|
|
4078
4104
|
/** @public */
|
|
4079
4105
|
export declare interface EditorProviderProps {
|
|
@@ -4104,7 +4130,7 @@ export declare class Ellipse2d extends Geometry2d {
|
|
|
4104
4130
|
}
|
|
4105
4131
|
|
|
4106
4132
|
/** @public */
|
|
4107
|
-
export declare class ErrorBoundary extends React_2.Component<React_2.
|
|
4133
|
+
export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithChildren<TLErrorBoundaryProps>, {
|
|
4108
4134
|
error: Error | null;
|
|
4109
4135
|
}> {
|
|
4110
4136
|
static getDerivedStateFromError(error: Error): {
|
|
@@ -4114,11 +4140,11 @@ export declare class ErrorBoundary extends React_2.Component<React_2.PropsWithRe
|
|
|
4114
4140
|
error: null;
|
|
4115
4141
|
};
|
|
4116
4142
|
componentDidCatch(error: unknown): void;
|
|
4117
|
-
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;
|
|
4118
4144
|
}
|
|
4119
4145
|
|
|
4120
4146
|
/** @public @react */
|
|
4121
|
-
export declare function ErrorScreen({ children }: LoadingScreenProps):
|
|
4147
|
+
export declare function ErrorScreen({ children }: LoadingScreenProps): JSX.Element;
|
|
4122
4148
|
|
|
4123
4149
|
/** @public */
|
|
4124
4150
|
export declare const EVENT_NAME_MAP: Record<Exclude<TLEventName, TLPinchEventName>, keyof TLEventHandlers>;
|
|
@@ -4418,8 +4444,8 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
4418
4444
|
canResizeChildren(): boolean;
|
|
4419
4445
|
getDefaultProps(): TLGroupShape['props'];
|
|
4420
4446
|
getGeometry(shape: TLGroupShape): Geometry2d;
|
|
4421
|
-
component(shape: TLGroupShape):
|
|
4422
|
-
indicator(shape: TLGroupShape):
|
|
4447
|
+
component(shape: TLGroupShape): JSX.Element | null;
|
|
4448
|
+
indicator(shape: TLGroupShape): JSX.Element;
|
|
4423
4449
|
onChildrenChange(group: TLGroupShape): void;
|
|
4424
4450
|
}
|
|
4425
4451
|
|
|
@@ -4523,7 +4549,7 @@ export declare class HistoryManager<R extends UnknownRecord> {
|
|
|
4523
4549
|
}
|
|
4524
4550
|
|
|
4525
4551
|
/** @public @react */
|
|
4526
|
-
export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps):
|
|
4552
|
+
export declare function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX.Element;
|
|
4527
4553
|
|
|
4528
4554
|
/** @public */
|
|
4529
4555
|
export declare type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
|
|
@@ -4531,6 +4557,248 @@ export declare type HTMLContainerProps = React_2.HTMLAttributes<HTMLDivElement>;
|
|
|
4531
4557
|
/** @public */
|
|
4532
4558
|
export declare const inlineBase64AssetStore: TLAssetStore;
|
|
4533
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
|
+
|
|
4534
4802
|
/**
|
|
4535
4803
|
* Find the intersections between a circle and a circle.
|
|
4536
4804
|
*
|
|
@@ -4660,7 +4928,7 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
|
|
|
4660
4928
|
export declare function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
|
|
4661
4929
|
|
|
4662
4930
|
/** @public @react */
|
|
4663
|
-
export declare function LoadingScreen({ children }: LoadingScreenProps):
|
|
4931
|
+
export declare function LoadingScreen({ children }: LoadingScreenProps): JSX.Element;
|
|
4664
4932
|
|
|
4665
4933
|
/** @public */
|
|
4666
4934
|
export declare interface LoadingScreenProps {
|
|
@@ -4778,7 +5046,7 @@ export declare function maybeSnapToGrid(point: Vec, editor: Editor): Vec;
|
|
|
4778
5046
|
*
|
|
4779
5047
|
* @public @react
|
|
4780
5048
|
*/
|
|
4781
|
-
export declare function MenuClickCapture(): false |
|
|
5049
|
+
export declare function MenuClickCapture(): false | JSX.Element;
|
|
4782
5050
|
|
|
4783
5051
|
/* Excluded from this release type: normalizeWheel */
|
|
4784
5052
|
|
|
@@ -5116,7 +5384,7 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
|
|
|
5116
5384
|
export declare function setUserPreferences(user: TLUserPreferences): void;
|
|
5117
5385
|
|
|
5118
5386
|
/** @public */
|
|
5119
|
-
export declare abstract class ShapeUtil<Shape extends
|
|
5387
|
+
export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
5120
5388
|
editor: Editor;
|
|
5121
5389
|
/** Configure this shape utils {@link ShapeUtil.options | `options`}. */
|
|
5122
5390
|
static configure<T extends TLShapeUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
|
|
@@ -5211,20 +5479,20 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5211
5479
|
* @param shape - The shape.
|
|
5212
5480
|
* @public
|
|
5213
5481
|
*/
|
|
5214
|
-
canSnap(
|
|
5482
|
+
canSnap(shape: Shape): boolean;
|
|
5215
5483
|
/**
|
|
5216
5484
|
* Whether the shape can be tabbed to.
|
|
5217
5485
|
*
|
|
5218
5486
|
* @param shape - The shape.
|
|
5219
5487
|
* @public
|
|
5220
5488
|
*/
|
|
5221
|
-
canTabTo(
|
|
5489
|
+
canTabTo(shape: Shape): boolean;
|
|
5222
5490
|
/**
|
|
5223
5491
|
* Whether the shape can be scrolled while editing.
|
|
5224
5492
|
*
|
|
5225
5493
|
* @public
|
|
5226
5494
|
*/
|
|
5227
|
-
canScroll(
|
|
5495
|
+
canScroll(shape: Shape): boolean;
|
|
5228
5496
|
/**
|
|
5229
5497
|
* Whether the shape can be bound to. See {@link TLShapeUtilCanBindOpts} for details.
|
|
5230
5498
|
*
|
|
@@ -5236,31 +5504,37 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5236
5504
|
*
|
|
5237
5505
|
* @public
|
|
5238
5506
|
*/
|
|
5239
|
-
canEdit(
|
|
5507
|
+
canEdit(shape: Shape, info: TLEditStartInfo): boolean;
|
|
5240
5508
|
/**
|
|
5241
5509
|
* Whether the shape can be resized.
|
|
5242
5510
|
*
|
|
5243
5511
|
* @public
|
|
5244
5512
|
*/
|
|
5245
|
-
canResize(
|
|
5513
|
+
canResize(shape: Shape): boolean;
|
|
5246
5514
|
/**
|
|
5247
5515
|
* When the shape is resized, whether the shape's children should also be resized.
|
|
5248
5516
|
*
|
|
5249
5517
|
* @public
|
|
5250
5518
|
*/
|
|
5251
|
-
canResizeChildren(
|
|
5519
|
+
canResizeChildren(shape: Shape): boolean;
|
|
5252
5520
|
/**
|
|
5253
5521
|
* Whether the shape can be edited in read-only mode.
|
|
5254
5522
|
*
|
|
5255
5523
|
* @public
|
|
5256
5524
|
*/
|
|
5257
|
-
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;
|
|
5258
5532
|
/**
|
|
5259
5533
|
* Whether the shape can be cropped.
|
|
5260
5534
|
*
|
|
5261
5535
|
* @public
|
|
5262
5536
|
*/
|
|
5263
|
-
canCrop(
|
|
5537
|
+
canCrop(shape: Shape): boolean;
|
|
5264
5538
|
/**
|
|
5265
5539
|
* Whether the shape can participate in layout functions such as alignment or distribution.
|
|
5266
5540
|
*
|
|
@@ -5270,7 +5544,7 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5270
5544
|
*
|
|
5271
5545
|
* @public
|
|
5272
5546
|
*/
|
|
5273
|
-
canBeLaidOut(
|
|
5547
|
+
canBeLaidOut(shape: Shape, info: TLShapeUtilCanBeLaidOutOpts): boolean;
|
|
5274
5548
|
/**
|
|
5275
5549
|
* Whether this shape can be culled. By default, shapes are culled for
|
|
5276
5550
|
* performance reasons when they are outside of the viewport. Culled shapes are still rendered
|
|
@@ -5278,11 +5552,31 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5278
5552
|
*
|
|
5279
5553
|
* @param shape - The shape.
|
|
5280
5554
|
*/
|
|
5281
|
-
canCull(
|
|
5555
|
+
canCull(shape: Shape): boolean;
|
|
5282
5556
|
/* Excluded from this release type: providesBackgroundForChildren */
|
|
5283
5557
|
/**
|
|
5284
5558
|
* Get the clip path to apply to this shape's children.
|
|
5285
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
|
+
*
|
|
5286
5580
|
* @param shape - The shape to get the clip path for
|
|
5287
5581
|
* @returns Array of points defining the clipping polygon in local coordinates, or undefined if no clipping
|
|
5288
5582
|
* @public
|
|
@@ -5307,37 +5601,37 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5307
5601
|
* @returns boolean indicating if this shape should hide in the minimap
|
|
5308
5602
|
* @public
|
|
5309
5603
|
*/
|
|
5310
|
-
hideInMinimap?(
|
|
5604
|
+
hideInMinimap?(shape: Shape): boolean;
|
|
5311
5605
|
/**
|
|
5312
5606
|
* Whether the shape should hide its resize handles when selected.
|
|
5313
5607
|
*
|
|
5314
5608
|
* @public
|
|
5315
5609
|
*/
|
|
5316
|
-
hideResizeHandles(
|
|
5610
|
+
hideResizeHandles(shape: Shape): boolean;
|
|
5317
5611
|
/**
|
|
5318
5612
|
* Whether the shape should hide its rotation handles when selected.
|
|
5319
5613
|
*
|
|
5320
5614
|
* @public
|
|
5321
5615
|
*/
|
|
5322
|
-
hideRotateHandle(
|
|
5616
|
+
hideRotateHandle(shape: Shape): boolean;
|
|
5323
5617
|
/**
|
|
5324
5618
|
* Whether the shape should hide its selection bounds background when selected.
|
|
5325
5619
|
*
|
|
5326
5620
|
* @public
|
|
5327
5621
|
*/
|
|
5328
|
-
hideSelectionBoundsBg(
|
|
5622
|
+
hideSelectionBoundsBg(shape: Shape): boolean;
|
|
5329
5623
|
/**
|
|
5330
5624
|
* Whether the shape should hide its selection bounds foreground when selected.
|
|
5331
5625
|
*
|
|
5332
5626
|
* @public
|
|
5333
5627
|
*/
|
|
5334
|
-
hideSelectionBoundsFg(
|
|
5628
|
+
hideSelectionBoundsFg(shape: Shape): boolean;
|
|
5335
5629
|
/**
|
|
5336
5630
|
* Whether the shape's aspect ratio is locked.
|
|
5337
5631
|
*
|
|
5338
5632
|
* @public
|
|
5339
5633
|
*/
|
|
5340
|
-
isAspectRatioLocked(
|
|
5634
|
+
isAspectRatioLocked(shape: Shape): boolean;
|
|
5341
5635
|
/**
|
|
5342
5636
|
* By default, the bounds of an image export are the bounds of all the shapes it contains, plus
|
|
5343
5637
|
* some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
|
|
@@ -5345,10 +5639,10 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5345
5639
|
* useful in cases like annotating on top of an image, where you usually want to avoid extra
|
|
5346
5640
|
* padding around the image if you don't need it.
|
|
5347
5641
|
*
|
|
5348
|
-
* @param
|
|
5642
|
+
* @param shape - The shape to check
|
|
5349
5643
|
* @returns True if this shape should be treated as an export bounds container
|
|
5350
5644
|
*/
|
|
5351
|
-
isExportBoundsContainer(
|
|
5645
|
+
isExportBoundsContainer(shape: Shape): boolean;
|
|
5352
5646
|
/* Excluded from this release type: backgroundComponent */
|
|
5353
5647
|
/**
|
|
5354
5648
|
* Get the interpolated props for an animating shape. This is an optional method.
|
|
@@ -5385,7 +5679,7 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5385
5679
|
* @param type - The shape type.
|
|
5386
5680
|
* @public
|
|
5387
5681
|
*/
|
|
5388
|
-
canReceiveNewChildrenOfType(
|
|
5682
|
+
canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
|
|
5389
5683
|
/**
|
|
5390
5684
|
* Get the shape as an SVG object.
|
|
5391
5685
|
*
|
|
@@ -5418,14 +5712,14 @@ export declare abstract class ShapeUtil<Shape extends TLUnknownShape = TLUnknown
|
|
|
5418
5712
|
* Get the geometry to use when snapping to this this shape in translate/resize operations. See
|
|
5419
5713
|
* {@link BoundsSnapGeometry} for details.
|
|
5420
5714
|
*/
|
|
5421
|
-
getBoundsSnapGeometry(
|
|
5715
|
+
getBoundsSnapGeometry(shape: Shape): BoundsSnapGeometry;
|
|
5422
5716
|
/**
|
|
5423
5717
|
* Get the geometry to use when snapping handles to this shape. See {@link HandleSnapGeometry}
|
|
5424
5718
|
* for details.
|
|
5425
5719
|
*/
|
|
5426
|
-
getHandleSnapGeometry(
|
|
5427
|
-
getText(
|
|
5428
|
-
getAriaDescriptor(
|
|
5720
|
+
getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
|
|
5721
|
+
getText(shape: Shape): string | undefined;
|
|
5722
|
+
getAriaDescriptor(shape: Shape): string | undefined;
|
|
5429
5723
|
/**
|
|
5430
5724
|
* A callback called just before a shape is created. This method provides a last chance to modify
|
|
5431
5725
|
* the created shape.
|
|
@@ -5920,7 +6214,7 @@ export declare const stopEventPropagation: (e: any) => any;
|
|
|
5920
6214
|
export declare function suffixSafeId(id: SafeId, suffix: string): SafeId;
|
|
5921
6215
|
|
|
5922
6216
|
/** @public @react */
|
|
5923
|
-
export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps):
|
|
6217
|
+
export declare function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX.Element;
|
|
5924
6218
|
|
|
5925
6219
|
/** @public */
|
|
5926
6220
|
export declare type SVGContainerProps = React_2.ComponentProps<'svg'>;
|
|
@@ -6018,6 +6312,8 @@ export declare class TextManager {
|
|
|
6018
6312
|
}[];
|
|
6019
6313
|
}
|
|
6020
6314
|
|
|
6315
|
+
/* Excluded from this release type: TickManager */
|
|
6316
|
+
|
|
6021
6317
|
/**
|
|
6022
6318
|
* This is the TipTap editor! Docs are {@link https://tiptap.dev/docs}.
|
|
6023
6319
|
*
|
|
@@ -6041,7 +6337,7 @@ export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
|
6041
6337
|
export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
|
|
6042
6338
|
|
|
6043
6339
|
/** @public */
|
|
6044
|
-
export declare type TLBaseBoxShape =
|
|
6340
|
+
export declare type TLBaseBoxShape = ExtractShapeByProps<{
|
|
6045
6341
|
h: number;
|
|
6046
6342
|
w: number;
|
|
6047
6343
|
}>;
|
|
@@ -6063,7 +6359,7 @@ export declare interface TLBaseExternalContent {
|
|
|
6063
6359
|
}
|
|
6064
6360
|
|
|
6065
6361
|
/** @public */
|
|
6066
|
-
export declare interface TLBindingUtilConstructor<T extends
|
|
6362
|
+
export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends BindingUtil<T> = BindingUtil<T>> {
|
|
6067
6363
|
new (editor: Editor): U;
|
|
6068
6364
|
type: T['type'];
|
|
6069
6365
|
/** Validations for this binding's props. */
|
|
@@ -6569,6 +6865,33 @@ export declare interface TldrawOptions {
|
|
|
6569
6865
|
* Branding name of the app, currently only used for adding aria-label for the application.
|
|
6570
6866
|
*/
|
|
6571
6867
|
readonly branding?: string;
|
|
6868
|
+
/**
|
|
6869
|
+
* Whether to use debounced zoom level for certain rendering optimizations. When true,
|
|
6870
|
+
* `editor.getDebouncedZoomLevel()` returns a cached zoom value while the camera is moving,
|
|
6871
|
+
* reducing re-renders. When false, it always returns the current zoom level.
|
|
6872
|
+
*/
|
|
6873
|
+
readonly debouncedZoom: boolean;
|
|
6874
|
+
/**
|
|
6875
|
+
* The number of shapes that must be on the page for the debounced zoom level to be used.
|
|
6876
|
+
* Defaults to 300 shapes.
|
|
6877
|
+
*/
|
|
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;
|
|
6572
6895
|
}
|
|
6573
6896
|
|
|
6574
6897
|
/** @public */
|
|
@@ -6614,7 +6937,7 @@ export declare interface TLEditorComponents {
|
|
|
6614
6937
|
/** @public */
|
|
6615
6938
|
export declare interface TLEditorOptions {
|
|
6616
6939
|
/**
|
|
6617
|
-
* 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
|
|
6618
6941
|
* from a server or database.
|
|
6619
6942
|
*/
|
|
6620
6943
|
store: TLStore;
|
|
@@ -6693,6 +7016,11 @@ export declare interface TLEditorSnapshot {
|
|
|
6693
7016
|
session: TLSessionStateSnapshot;
|
|
6694
7017
|
}
|
|
6695
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
|
+
|
|
6696
7024
|
/** @public */
|
|
6697
7025
|
export declare interface TLEmbedExternalContent<EmbedDefinition> extends TLBaseExternalContent {
|
|
6698
7026
|
type: 'embed';
|
|
@@ -6705,6 +7033,8 @@ export declare type TLEnterEventHandler = (info: any, from: string) => void;
|
|
|
6705
7033
|
|
|
6706
7034
|
/**
|
|
6707
7035
|
* An object that contains information about the current device and environment.
|
|
7036
|
+
* This object is not reactive and will not update automatically when the environment changes,
|
|
7037
|
+
* so only include values that are fixed, such as the user's browser and operating system.
|
|
6708
7038
|
*
|
|
6709
7039
|
* @public
|
|
6710
7040
|
*/
|
|
@@ -6719,6 +7049,17 @@ export declare const tlenv: {
|
|
|
6719
7049
|
isWebview: boolean;
|
|
6720
7050
|
};
|
|
6721
7051
|
|
|
7052
|
+
/**
|
|
7053
|
+
* An atom that contains information about the current device and environment.
|
|
7054
|
+
* This object is reactive and will update automatically when the environment changes.
|
|
7055
|
+
* Use it for values that may change over time, such as the pointer type.
|
|
7056
|
+
*
|
|
7057
|
+
* @public
|
|
7058
|
+
*/
|
|
7059
|
+
export declare const tlenvReactive: Atom< {
|
|
7060
|
+
isCoarsePointer: boolean;
|
|
7061
|
+
}, unknown>;
|
|
7062
|
+
|
|
6722
7063
|
/** @public */
|
|
6723
7064
|
export declare interface TLErrorBoundaryProps {
|
|
6724
7065
|
children: React_2.ReactNode;
|
|
@@ -6782,6 +7123,7 @@ export declare interface TLEventMap {
|
|
|
6782
7123
|
event: [TLEventInfo];
|
|
6783
7124
|
tick: [number];
|
|
6784
7125
|
frame: [number];
|
|
7126
|
+
resize: [BoxModel];
|
|
6785
7127
|
'select-all-text': [{
|
|
6786
7128
|
shapeId: TLShapeId;
|
|
6787
7129
|
}];
|
|
@@ -6796,6 +7138,7 @@ export declare interface TLEventMap {
|
|
|
6796
7138
|
'edited-shapes': [TLRecord[]];
|
|
6797
7139
|
'deleted-shapes': [TLShapeId[]];
|
|
6798
7140
|
edit: [];
|
|
7141
|
+
dispose: [];
|
|
6799
7142
|
}
|
|
6800
7143
|
|
|
6801
7144
|
/** @public */
|
|
@@ -7497,11 +7840,11 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
|
|
|
7497
7840
|
*
|
|
7498
7841
|
* @public
|
|
7499
7842
|
*/
|
|
7500
|
-
export declare interface TLShapeUtilCanBindOpts<Shape extends
|
|
7843
|
+
export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
|
|
7501
7844
|
/** The type of shape referenced by the `fromId` of the binding. */
|
|
7502
|
-
fromShapeType:
|
|
7845
|
+
fromShapeType: TLShape['type'];
|
|
7503
7846
|
/** The type of shape referenced by the `toId` of the binding. */
|
|
7504
|
-
toShapeType:
|
|
7847
|
+
toShapeType: TLShape['type'];
|
|
7505
7848
|
/** The type of binding. */
|
|
7506
7849
|
bindingType: string;
|
|
7507
7850
|
}
|
|
@@ -7513,7 +7856,7 @@ export declare interface TLShapeUtilCanvasSvgDef {
|
|
|
7513
7856
|
}
|
|
7514
7857
|
|
|
7515
7858
|
/** @public */
|
|
7516
|
-
export declare interface TLShapeUtilConstructor<T extends
|
|
7859
|
+
export declare interface TLShapeUtilConstructor<T extends TLShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
|
|
7517
7860
|
new (editor: Editor): U;
|
|
7518
7861
|
type: T['type'];
|
|
7519
7862
|
props?: RecordProps<T>;
|
|
@@ -7893,10 +8236,10 @@ export declare function useMaybeEditor(): Editor | null;
|
|
|
7893
8236
|
/* Excluded from this release type: useOnMount */
|
|
7894
8237
|
|
|
7895
8238
|
/** @public */
|
|
7896
|
-
export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement>): void;
|
|
8239
|
+
export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement | null>): void;
|
|
7897
8240
|
|
|
7898
8241
|
/** @public */
|
|
7899
|
-
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement>): void;
|
|
8242
|
+
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
|
|
7900
8243
|
|
|
7901
8244
|
/**
|
|
7902
8245
|
* @returns The list of peer UserIDs
|
|
@@ -8004,7 +8347,7 @@ export declare function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreS
|
|
|
8004
8347
|
export declare function useTLStore(opts: TLStoreOptions): TLStore;
|
|
8005
8348
|
|
|
8006
8349
|
/** @public */
|
|
8007
|
-
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;
|
|
8008
8351
|
|
|
8009
8352
|
/**
|
|
8010
8353
|
* React's useId hook returns a unique id for the component. However, it uses a colon in the id,
|