@tldraw/editor 4.3.0-next.a65ee816dbea → 4.3.0-next.bad71ed2ab6a
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 +55 -35
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +1 -12
- 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/managers/SnapManager/SnapManager.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/BaseBoxShapeUtil.js.map +1 -1
- package/dist-cjs/lib/editor/shapes/ShapeUtil.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.map +2 -2
- package/dist-cjs/lib/exports/getSvgJsx.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/utils/reparenting.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 +55 -35
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +1 -12
- 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/managers/SnapManager/SnapManager.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/BaseBoxShapeUtil.mjs.map +1 -1
- package/dist-esm/lib/editor/shapes/ShapeUtil.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.map +2 -2
- package/dist-esm/lib/exports/getSvgJsx.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/utils/reparenting.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +10 -10
- package/src/lib/editor/Editor.test.ts +10 -10
- package/src/lib/editor/Editor.ts +82 -59
- package/src/lib/editor/bindings/BindingUtil.ts +15 -9
- package/src/lib/editor/derivations/bindingsIndex.ts +2 -2
- package/src/lib/editor/managers/FontManager/FontManager.test.ts +14 -4
- package/src/lib/editor/managers/SnapManager/SnapManager.ts +3 -3
- package/src/lib/editor/shapes/BaseBoxShapeUtil.tsx +2 -2
- package/src/lib/editor/shapes/ShapeUtil.ts +5 -8
- 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 +3 -3
- package/src/lib/exports/getSvgJsx.test.ts +10 -19
- package/src/lib/exports/getSvgJsx.tsx +2 -5
- package/src/lib/globals/menus.ts +1 -1
- package/src/lib/utils/reparenting.ts +5 -5
- package/src/version.ts +3 -3
package/dist-cjs/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Editor as Editor_2 } from '@tiptap/core';
|
|
|
7
7
|
import { EditorProviderProps as EditorProviderProps_2 } from '@tiptap/react';
|
|
8
8
|
import EventEmitter from 'eventemitter3';
|
|
9
9
|
import { ExoticComponent } from 'react';
|
|
10
|
+
import { ExtractShapeByProps } from '@tldraw/tlschema';
|
|
10
11
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
12
|
import { HistoryEntry } from '@tldraw/store';
|
|
12
13
|
import { IndexKey } from '@tldraw/utils';
|
|
@@ -48,6 +49,7 @@ import { TLBindingId } from '@tldraw/tlschema';
|
|
|
48
49
|
import { TLBindingUpdate } from '@tldraw/tlschema';
|
|
49
50
|
import { TLBookmarkAsset } from '@tldraw/tlschema';
|
|
50
51
|
import { TLCamera } from '@tldraw/tlschema';
|
|
52
|
+
import { TLCreateShapePartial } from '@tldraw/tlschema';
|
|
51
53
|
import { TLCursor } from '@tldraw/tlschema';
|
|
52
54
|
import { TLCursorType } from '@tldraw/tlschema';
|
|
53
55
|
import { TLDefaultDashStyle } from '@tldraw/tlschema';
|
|
@@ -147,7 +149,7 @@ export declare abstract class BaseBoxShapeTool extends StateNode {
|
|
|
147
149
|
static id: string;
|
|
148
150
|
static initial: string;
|
|
149
151
|
static children(): TLStateNodeConstructor[];
|
|
150
|
-
abstract shapeType:
|
|
152
|
+
abstract shapeType: TLBaseBoxShape['type'];
|
|
151
153
|
onCreate?(_shape: null | TLShape): null | void;
|
|
152
154
|
}
|
|
153
155
|
|
|
@@ -165,7 +167,7 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
|
|
|
165
167
|
*
|
|
166
168
|
* @public
|
|
167
169
|
*/
|
|
168
|
-
export declare interface BindingOnChangeOptions<Binding extends
|
|
170
|
+
export declare interface BindingOnChangeOptions<Binding extends TLBinding = TLBinding> {
|
|
169
171
|
/** The binding record before the change is made. */
|
|
170
172
|
bindingBefore: Binding;
|
|
171
173
|
/** The binding record after the change is made. */
|
|
@@ -178,7 +180,7 @@ export declare interface BindingOnChangeOptions<Binding extends TLUnknownBinding
|
|
|
178
180
|
*
|
|
179
181
|
* @public
|
|
180
182
|
*/
|
|
181
|
-
export declare interface BindingOnCreateOptions<Binding extends
|
|
183
|
+
export declare interface BindingOnCreateOptions<Binding extends TLBinding = TLBinding> {
|
|
182
184
|
/** The binding being created. */
|
|
183
185
|
binding: Binding;
|
|
184
186
|
}
|
|
@@ -189,7 +191,7 @@ export declare interface BindingOnCreateOptions<Binding extends TLUnknownBinding
|
|
|
189
191
|
*
|
|
190
192
|
* @public
|
|
191
193
|
*/
|
|
192
|
-
export declare interface BindingOnDeleteOptions<Binding extends
|
|
194
|
+
export declare interface BindingOnDeleteOptions<Binding extends TLBinding = TLBinding> {
|
|
193
195
|
/** The binding being deleted. */
|
|
194
196
|
binding: Binding;
|
|
195
197
|
}
|
|
@@ -200,7 +202,7 @@ export declare interface BindingOnDeleteOptions<Binding extends TLUnknownBinding
|
|
|
200
202
|
*
|
|
201
203
|
* @public
|
|
202
204
|
*/
|
|
203
|
-
export declare interface BindingOnShapeChangeOptions<Binding extends
|
|
205
|
+
export declare interface BindingOnShapeChangeOptions<Binding extends TLBinding = TLBinding> {
|
|
204
206
|
/** The binding record linking these two shapes. */
|
|
205
207
|
binding: Binding;
|
|
206
208
|
/** The shape record before the change is made. */
|
|
@@ -224,7 +226,7 @@ export declare interface BindingOnShapeChangeOptions<Binding extends TLUnknownBi
|
|
|
224
226
|
*
|
|
225
227
|
* @public
|
|
226
228
|
*/
|
|
227
|
-
export declare interface BindingOnShapeDeleteOptions<Binding extends
|
|
229
|
+
export declare interface BindingOnShapeDeleteOptions<Binding extends TLBinding = TLBinding> {
|
|
228
230
|
/** The binding record that refers to the shape in question. */
|
|
229
231
|
binding: Binding;
|
|
230
232
|
/** The shape that is about to be deleted. */
|
|
@@ -256,7 +258,7 @@ export declare interface BindingOnShapeDeleteOptions<Binding extends TLUnknownBi
|
|
|
256
258
|
*
|
|
257
259
|
* @public
|
|
258
260
|
*/
|
|
259
|
-
export declare interface BindingOnShapeIsolateOptions<Binding extends
|
|
261
|
+
export declare interface BindingOnShapeIsolateOptions<Binding extends TLBinding = TLBinding> {
|
|
260
262
|
/** The binding record that refers to the shape in question. */
|
|
261
263
|
binding: Binding;
|
|
262
264
|
/**
|
|
@@ -267,7 +269,7 @@ export declare interface BindingOnShapeIsolateOptions<Binding extends TLUnknownB
|
|
|
267
269
|
}
|
|
268
270
|
|
|
269
271
|
/** @public */
|
|
270
|
-
export declare abstract class BindingUtil<Binding extends
|
|
272
|
+
export declare abstract class BindingUtil<Binding extends TLBinding = TLBinding> {
|
|
271
273
|
editor: Editor;
|
|
272
274
|
constructor(editor: Editor);
|
|
273
275
|
static props?: RecordProps<TLUnknownBinding>;
|
|
@@ -1129,7 +1131,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1129
1131
|
* @public
|
|
1130
1132
|
*/
|
|
1131
1133
|
shapeUtils: {
|
|
1132
|
-
readonly [K in string]?: ShapeUtil<
|
|
1134
|
+
readonly [K in string]?: ShapeUtil<TLShape>;
|
|
1133
1135
|
};
|
|
1134
1136
|
styleProps: {
|
|
1135
1137
|
[key: string]: Map<StyleProp<any>, string>;
|
|
@@ -1149,16 +1151,18 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1149
1151
|
*
|
|
1150
1152
|
* @public
|
|
1151
1153
|
*/
|
|
1152
|
-
getShapeUtil<
|
|
1153
|
-
|
|
1154
|
+
getShapeUtil<K extends TLShape['type']>(type: K): ShapeUtil<Extract<TLShape, {
|
|
1155
|
+
type: K;
|
|
1156
|
+
}>>;
|
|
1157
|
+
getShapeUtil<S extends TLShape>(shape: S | S['type'] | TLShapePartial<S>): ShapeUtil<S>;
|
|
1154
1158
|
getShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): T;
|
|
1155
1159
|
/**
|
|
1156
1160
|
* Returns true if the editor has a shape util for the given shape / shape type.
|
|
1157
1161
|
*
|
|
1158
1162
|
* @param shape - A shape, shape partial, or shape type.
|
|
1159
1163
|
*/
|
|
1160
|
-
hasShapeUtil
|
|
1161
|
-
hasShapeUtil
|
|
1164
|
+
hasShapeUtil(shape: TLShape | TLShapePartial<TLShape>): boolean;
|
|
1165
|
+
hasShapeUtil(type: TLShape['type']): boolean;
|
|
1162
1166
|
hasShapeUtil<T extends ShapeUtil>(type: T extends ShapeUtil<infer R> ? R['type'] : string): boolean;
|
|
1163
1167
|
/**
|
|
1164
1168
|
* A map of shape utility classes (TLShapeUtils) by shape type.
|
|
@@ -1166,7 +1170,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1166
1170
|
* @public
|
|
1167
1171
|
*/
|
|
1168
1172
|
bindingUtils: {
|
|
1169
|
-
readonly [K in string]?: BindingUtil<
|
|
1173
|
+
readonly [K in string]?: BindingUtil<TLBinding>;
|
|
1170
1174
|
};
|
|
1171
1175
|
/**
|
|
1172
1176
|
* Get a binding util from a binding itself.
|
|
@@ -1183,10 +1187,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1183
1187
|
*
|
|
1184
1188
|
* @public
|
|
1185
1189
|
*/
|
|
1186
|
-
getBindingUtil<
|
|
1190
|
+
getBindingUtil<K extends TLBinding['type']>(type: K): BindingUtil<Extract<TLBinding, {
|
|
1191
|
+
type: K;
|
|
1192
|
+
}>>;
|
|
1193
|
+
getBindingUtil<S extends TLBinding>(binding: {
|
|
1187
1194
|
type: S['type'];
|
|
1188
1195
|
} | S): BindingUtil<S>;
|
|
1189
|
-
getBindingUtil<S extends TLUnknownBinding>(type: S['type']): BindingUtil<S>;
|
|
1190
1196
|
getBindingUtil<T extends BindingUtil>(type: T extends BindingUtil<infer R> ? R['type'] : string): T;
|
|
1191
1197
|
/**
|
|
1192
1198
|
* A manager for the app's history.
|
|
@@ -2765,7 +2771,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2765
2771
|
*
|
|
2766
2772
|
* @example
|
|
2767
2773
|
* ```ts
|
|
2768
|
-
* const isArrowShape = isShapeOfType
|
|
2774
|
+
* const isArrowShape = isShapeOfType(someShape, 'arrow')
|
|
2769
2775
|
* ```
|
|
2770
2776
|
*
|
|
2771
2777
|
* @param util - the TLShapeUtil constructor to test against
|
|
@@ -2773,8 +2779,13 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2773
2779
|
*
|
|
2774
2780
|
* @public
|
|
2775
2781
|
*/
|
|
2776
|
-
isShapeOfType<
|
|
2777
|
-
|
|
2782
|
+
isShapeOfType<K extends TLShape['type']>(shape: TLShape, type: K): shape is Extract<TLShape, {
|
|
2783
|
+
type: K;
|
|
2784
|
+
}>;
|
|
2785
|
+
isShapeOfType<T extends TLShape>(shape: TLShape, type: T['type']): shape is Extract<TLShape, {
|
|
2786
|
+
type: T['type'];
|
|
2787
|
+
}>;
|
|
2788
|
+
isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
|
|
2778
2789
|
/**
|
|
2779
2790
|
* Get a shape by its id.
|
|
2780
2791
|
*
|
|
@@ -2925,17 +2936,26 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2925
2936
|
* Get all bindings of a certain type _from_ a particular shape. These are the bindings whose
|
|
2926
2937
|
* `fromId` matched the shape's ID.
|
|
2927
2938
|
*/
|
|
2928
|
-
getBindingsFromShape<
|
|
2939
|
+
getBindingsFromShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
2940
|
+
type: K;
|
|
2941
|
+
}>[];
|
|
2942
|
+
getBindingsFromShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
|
|
2929
2943
|
/**
|
|
2930
2944
|
* Get all bindings of a certain type _to_ a particular shape. These are the bindings whose
|
|
2931
2945
|
* `toId` matches the shape's ID.
|
|
2932
2946
|
*/
|
|
2933
|
-
getBindingsToShape<
|
|
2947
|
+
getBindingsToShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
2948
|
+
type: K;
|
|
2949
|
+
}>[];
|
|
2950
|
+
getBindingsToShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type: Binding['type']): Binding[];
|
|
2934
2951
|
/**
|
|
2935
2952
|
* Get all bindings involving a particular shape. This includes bindings where the shape is the
|
|
2936
2953
|
* `fromId` or `toId`. If a type is provided, only bindings of that type are returned.
|
|
2937
2954
|
*/
|
|
2938
|
-
getBindingsInvolvingShape<
|
|
2955
|
+
getBindingsInvolvingShape<K extends TLBinding['type']>(shape: TLShape | TLShapeId, type: K): Extract<TLBinding, {
|
|
2956
|
+
type: K;
|
|
2957
|
+
}>[];
|
|
2958
|
+
getBindingsInvolvingShape<Binding extends TLBinding = TLBinding>(shape: TLShape | TLShapeId, type?: Binding['type']): Binding[];
|
|
2939
2959
|
/**
|
|
2940
2960
|
* Create bindings from a list of partial bindings. You can omit the ID and most props of a
|
|
2941
2961
|
* binding, but the `type`, `toId`, and `fromId` must all be provided.
|
|
@@ -3250,7 +3270,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3250
3270
|
*
|
|
3251
3271
|
* @public
|
|
3252
3272
|
*/
|
|
3253
|
-
canCreateShape
|
|
3273
|
+
canCreateShape(shape: OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id']): boolean;
|
|
3254
3274
|
/**
|
|
3255
3275
|
* Get whether the provided shapes can be created.
|
|
3256
3276
|
*
|
|
@@ -3258,7 +3278,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3258
3278
|
*
|
|
3259
3279
|
* @public
|
|
3260
3280
|
*/
|
|
3261
|
-
canCreateShapes
|
|
3281
|
+
canCreateShapes(shapes: (OptionalKeys<TLShapePartial<TLShape>, 'id'> | TLShape['id'])[]): boolean;
|
|
3262
3282
|
/**
|
|
3263
3283
|
* Create a single shape.
|
|
3264
3284
|
*
|
|
@@ -3272,7 +3292,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3272
3292
|
*
|
|
3273
3293
|
* @public
|
|
3274
3294
|
*/
|
|
3275
|
-
createShape<
|
|
3295
|
+
createShape<TShape extends TLShape>(shape: TLCreateShapePartial<TShape>): this;
|
|
3276
3296
|
/**
|
|
3277
3297
|
* Create shapes.
|
|
3278
3298
|
*
|
|
@@ -3286,7 +3306,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3286
3306
|
*
|
|
3287
3307
|
* @public
|
|
3288
3308
|
*/
|
|
3289
|
-
createShapes<
|
|
3309
|
+
createShapes<TShape extends TLShape = TLShape>(shapes: TLCreateShapePartial<TShape>[]): this;
|
|
3290
3310
|
private animatingShapes;
|
|
3291
3311
|
/**
|
|
3292
3312
|
* Animate a shape.
|
|
@@ -3372,7 +3392,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3372
3392
|
*
|
|
3373
3393
|
* @public
|
|
3374
3394
|
*/
|
|
3375
|
-
updateShape<T extends
|
|
3395
|
+
updateShape<T extends TLShape = TLShape>(partial: null | TLShapePartial<T> | undefined): this;
|
|
3376
3396
|
/**
|
|
3377
3397
|
* Update shapes using partials of each shape.
|
|
3378
3398
|
*
|
|
@@ -3385,7 +3405,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3385
3405
|
*
|
|
3386
3406
|
* @public
|
|
3387
3407
|
*/
|
|
3388
|
-
updateShapes<T extends
|
|
3408
|
+
updateShapes<T extends TLShape>(partials: (null | TLShapePartial<T> | undefined)[]): this;
|
|
3389
3409
|
/* Excluded from this release type: _updateShapes */
|
|
3390
3410
|
/* Excluded from this release type: _getUnlockedShapeIds */
|
|
3391
3411
|
/**
|
|
@@ -5116,7 +5136,7 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
|
|
|
5116
5136
|
export declare function setUserPreferences(user: TLUserPreferences): void;
|
|
5117
5137
|
|
|
5118
5138
|
/** @public */
|
|
5119
|
-
export declare abstract class ShapeUtil<Shape extends
|
|
5139
|
+
export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
5120
5140
|
editor: Editor;
|
|
5121
5141
|
/** Configure this shape utils {@link ShapeUtil.options | `options`}. */
|
|
5122
5142
|
static configure<T extends TLShapeUtilConstructor<any, any>>(this: T, options: T extends new (...args: any[]) => {
|
|
@@ -6041,7 +6061,7 @@ export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
|
6041
6061
|
export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
|
|
6042
6062
|
|
|
6043
6063
|
/** @public */
|
|
6044
|
-
export declare type TLBaseBoxShape =
|
|
6064
|
+
export declare type TLBaseBoxShape = ExtractShapeByProps<{
|
|
6045
6065
|
h: number;
|
|
6046
6066
|
w: number;
|
|
6047
6067
|
}>;
|
|
@@ -6063,7 +6083,7 @@ export declare interface TLBaseExternalContent {
|
|
|
6063
6083
|
}
|
|
6064
6084
|
|
|
6065
6085
|
/** @public */
|
|
6066
|
-
export declare interface TLBindingUtilConstructor<T extends
|
|
6086
|
+
export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends BindingUtil<T> = BindingUtil<T>> {
|
|
6067
6087
|
new (editor: Editor): U;
|
|
6068
6088
|
type: T['type'];
|
|
6069
6089
|
/** Validations for this binding's props. */
|
|
@@ -7497,11 +7517,11 @@ export declare interface TLShapeUtilCanBeLaidOutOpts {
|
|
|
7497
7517
|
*
|
|
7498
7518
|
* @public
|
|
7499
7519
|
*/
|
|
7500
|
-
export declare interface TLShapeUtilCanBindOpts<Shape extends
|
|
7520
|
+
export declare interface TLShapeUtilCanBindOpts<Shape extends TLShape = TLShape> {
|
|
7501
7521
|
/** The type of shape referenced by the `fromId` of the binding. */
|
|
7502
|
-
fromShapeType:
|
|
7522
|
+
fromShapeType: TLShape['type'];
|
|
7503
7523
|
/** The type of shape referenced by the `toId` of the binding. */
|
|
7504
|
-
toShapeType:
|
|
7524
|
+
toShapeType: TLShape['type'];
|
|
7505
7525
|
/** The type of binding. */
|
|
7506
7526
|
bindingType: string;
|
|
7507
7527
|
}
|
|
@@ -7513,7 +7533,7 @@ export declare interface TLShapeUtilCanvasSvgDef {
|
|
|
7513
7533
|
}
|
|
7514
7534
|
|
|
7515
7535
|
/** @public */
|
|
7516
|
-
export declare interface TLShapeUtilConstructor<T extends
|
|
7536
|
+
export declare interface TLShapeUtilConstructor<T extends TLShape, U extends ShapeUtil<T> = ShapeUtil<T>> {
|
|
7517
7537
|
new (editor: Editor): U;
|
|
7518
7538
|
type: T['type'];
|
|
7519
7539
|
props?: RecordProps<T>;
|
package/dist-cjs/index.js
CHANGED
|
@@ -370,7 +370,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
370
370
|
var import_window_open = require("./lib/utils/window-open");
|
|
371
371
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
372
372
|
"@tldraw/editor",
|
|
373
|
-
"4.3.0-next.
|
|
373
|
+
"4.3.0-next.bad71ed2ab6a",
|
|
374
374
|
"cjs"
|
|
375
375
|
);
|
|
376
376
|
//# sourceMappingURL=index.js.map
|
|
@@ -4400,30 +4400,18 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
4400
4400
|
getBinding(id) {
|
|
4401
4401
|
return this.store.get(id);
|
|
4402
4402
|
}
|
|
4403
|
-
/**
|
|
4404
|
-
* Get all bindings of a certain type _from_ a particular shape. These are the bindings whose
|
|
4405
|
-
* `fromId` matched the shape's ID.
|
|
4406
|
-
*/
|
|
4407
4403
|
getBindingsFromShape(shape, type) {
|
|
4408
4404
|
const id = typeof shape === "string" ? shape : shape.id;
|
|
4409
4405
|
return this.getBindingsInvolvingShape(id).filter(
|
|
4410
4406
|
(b) => b.fromId === id && b.type === type
|
|
4411
4407
|
);
|
|
4412
4408
|
}
|
|
4413
|
-
/**
|
|
4414
|
-
* Get all bindings of a certain type _to_ a particular shape. These are the bindings whose
|
|
4415
|
-
* `toId` matches the shape's ID.
|
|
4416
|
-
*/
|
|
4417
4409
|
getBindingsToShape(shape, type) {
|
|
4418
4410
|
const id = typeof shape === "string" ? shape : shape.id;
|
|
4419
4411
|
return this.getBindingsInvolvingShape(id).filter(
|
|
4420
4412
|
(b) => b.toId === id && b.type === type
|
|
4421
4413
|
);
|
|
4422
4414
|
}
|
|
4423
|
-
/**
|
|
4424
|
-
* Get all bindings involving a particular shape. This includes bindings where the shape is the
|
|
4425
|
-
* `fromId` or `toId`. If a type is provided, only bindings of that type are returned.
|
|
4426
|
-
*/
|
|
4427
4415
|
getBindingsInvolvingShape(shape, type) {
|
|
4428
4416
|
const id = typeof shape === "string" ? shape : shape.id;
|
|
4429
4417
|
const result = this._getBindingsIndexCache().get(id) ?? import_state.EMPTY_ARRAY;
|
|
@@ -7481,6 +7469,7 @@ class Editor extends (_a = import_eventemitter3.default, _getIsShapeHiddenCache_
|
|
|
7481
7469
|
this.setCursor({ type: this._prevCursor, rotation: 0 });
|
|
7482
7470
|
}
|
|
7483
7471
|
}
|
|
7472
|
+
this.emit("event", info);
|
|
7484
7473
|
this.root.handleEvent(info);
|
|
7485
7474
|
return;
|
|
7486
7475
|
}
|