@tldraw/editor 4.6.0-canary.f5b836df84b5 → 4.6.0-canary.f6b4d0101ca7
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 +373 -166
- package/dist-cjs/index.js +9 -21
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/TldrawEditor.js +3 -0
- package/dist-cjs/lib/TldrawEditor.js.map +2 -2
- package/dist-cjs/lib/components/default-components/CanvasOverlays.js +180 -0
- package/dist-cjs/lib/components/default-components/CanvasOverlays.js.map +7 -0
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +33 -238
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +3 -3
- package/dist-cjs/lib/editor/Editor.js +64 -4
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- 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/ThemeManager/defaultThemes.js +14 -0
- package/dist-cjs/lib/editor/managers/ThemeManager/defaultThemes.js.map +2 -2
- package/dist-cjs/lib/editor/overlays/OverlayManager.js +154 -0
- package/dist-cjs/lib/editor/overlays/OverlayManager.js.map +7 -0
- package/dist-cjs/lib/editor/overlays/OverlayUtil.js +92 -0
- package/dist-cjs/lib/editor/overlays/OverlayUtil.js.map +7 -0
- package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js +180 -0
- package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js.map +7 -0
- package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js +76 -0
- package/dist-cjs/lib/editor/shapes/BaseFrameLikeShapeUtil.js.map +7 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js +17 -22
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js +32 -2
- package/dist-cjs/lib/editor/shapes/group/GroupShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/types/event-types.js.map +2 -2
- package/dist-cjs/lib/exports/getSvgJsx.js +2 -1
- package/dist-cjs/lib/exports/getSvgJsx.js.map +2 -2
- package/dist-cjs/lib/hooks/EditorComponentsContext.js.map +2 -2
- package/dist-cjs/lib/hooks/useEditorComponents.js +0 -28
- package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePeerIds.js +1 -36
- package/dist-cjs/lib/hooks/usePeerIds.js.map +2 -2
- package/dist-cjs/lib/hooks/useShapeCulling.js +2 -1
- package/dist-cjs/lib/hooks/useShapeCulling.js.map +2 -2
- package/dist-cjs/lib/options.js +0 -1
- package/dist-cjs/lib/options.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 +373 -166
- package/dist-esm/index.mjs +13 -39
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/TldrawEditor.mjs +3 -0
- package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/CanvasOverlays.mjs +160 -0
- package/dist-esm/lib/components/default-components/CanvasOverlays.mjs.map +7 -0
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +34 -239
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +3 -3
- package/dist-esm/lib/editor/Editor.mjs +67 -4
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- 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/ThemeManager/defaultThemes.mjs +14 -0
- package/dist-esm/lib/editor/managers/ThemeManager/defaultThemes.mjs.map +2 -2
- package/dist-esm/lib/editor/overlays/OverlayManager.mjs +136 -0
- package/dist-esm/lib/editor/overlays/OverlayManager.mjs.map +7 -0
- package/dist-esm/lib/editor/overlays/OverlayUtil.mjs +72 -0
- package/dist-esm/lib/editor/overlays/OverlayUtil.mjs.map +7 -0
- package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs +160 -0
- package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs.map +7 -0
- package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs +56 -0
- package/dist-esm/lib/editor/shapes/BaseFrameLikeShapeUtil.mjs.map +7 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs +17 -22
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs +32 -2
- package/dist-esm/lib/editor/shapes/group/GroupShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/types/event-types.mjs.map +2 -2
- package/dist-esm/lib/exports/getSvgJsx.mjs +2 -1
- package/dist-esm/lib/exports/getSvgJsx.mjs.map +2 -2
- package/dist-esm/lib/hooks/EditorComponentsContext.mjs.map +2 -2
- package/dist-esm/lib/hooks/useEditorComponents.mjs +0 -28
- package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePeerIds.mjs +2 -40
- package/dist-esm/lib/hooks/usePeerIds.mjs.map +2 -2
- package/dist-esm/lib/hooks/useShapeCulling.mjs +2 -1
- package/dist-esm/lib/hooks/useShapeCulling.mjs.map +2 -2
- package/dist-esm/lib/options.mjs +0 -1
- package/dist-esm/lib/options.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +3 -219
- package/package.json +7 -7
- package/src/index.ts +12 -38
- package/src/lib/TldrawEditor.tsx +9 -0
- package/src/lib/components/default-components/CanvasOverlays.tsx +208 -0
- package/src/lib/components/default-components/DefaultCanvas.tsx +38 -313
- package/src/lib/editor/Editor.test.ts +3 -1
- package/src/lib/editor/Editor.ts +95 -8
- package/src/lib/editor/managers/SnapManager/SnapManager.test.ts +13 -2
- package/src/lib/editor/managers/SnapManager/SnapManager.ts +1 -1
- package/src/lib/editor/managers/ThemeManager/defaultThemes.ts +14 -0
- package/src/lib/editor/overlays/OverlayManager.ts +183 -0
- package/src/lib/editor/overlays/OverlayUtil.ts +143 -0
- package/src/lib/editor/overlays/ShapeIndicatorOverlayUtil.ts +230 -0
- package/src/lib/editor/shapes/BaseFrameLikeShapeUtil.tsx +123 -0
- package/src/lib/editor/shapes/ShapeUtil.ts +26 -25
- package/src/lib/editor/shapes/group/GroupShapeUtil.tsx +40 -3
- package/src/lib/editor/types/event-types.ts +2 -0
- package/src/lib/exports/getSvgJsx.test.ts +3 -1
- package/src/lib/exports/getSvgJsx.tsx +2 -1
- package/src/lib/hooks/EditorComponentsContext.tsx +0 -27
- package/src/lib/hooks/useEditorComponents.tsx +0 -28
- package/src/lib/hooks/usePeerIds.ts +6 -55
- package/src/lib/hooks/useShapeCulling.tsx +3 -1
- package/src/lib/options.ts +0 -7
- package/src/version.ts +3 -3
- package/dist-cjs/lib/components/LiveCollaborators.js +0 -152
- package/dist-cjs/lib/components/LiveCollaborators.js.map +0 -7
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js +0 -234
- package/dist-cjs/lib/components/default-components/CanvasShapeIndicators.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultBrush.js +0 -38
- package/dist-cjs/lib/components/default-components/DefaultBrush.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js +0 -71
- package/dist-cjs/lib/components/default-components/DefaultCollaboratorHint.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultHandle.js +0 -56
- package/dist-cjs/lib/components/default-components/DefaultHandle.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultHandles.js +0 -28
- package/dist-cjs/lib/components/default-components/DefaultHandles.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultScribble.js +0 -51
- package/dist-cjs/lib/components/default-components/DefaultScribble.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultSelectionForeground.js +0 -69
- package/dist-cjs/lib/components/default-components/DefaultSelectionForeground.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +0 -107
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicatorErrorFallback.js +0 -28
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicatorErrorFallback.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +0 -102
- package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +0 -7
- package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js +0 -170
- package/dist-cjs/lib/components/default-components/DefaultSnapIndictor.js.map +0 -7
- package/dist-esm/lib/components/LiveCollaborators.mjs +0 -135
- package/dist-esm/lib/components/LiveCollaborators.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs +0 -214
- package/dist-esm/lib/components/default-components/CanvasShapeIndicators.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultBrush.mjs +0 -18
- package/dist-esm/lib/components/default-components/DefaultBrush.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs +0 -41
- package/dist-esm/lib/components/default-components/DefaultCollaboratorHint.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultHandle.mjs +0 -26
- package/dist-esm/lib/components/default-components/DefaultHandle.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultHandles.mjs +0 -8
- package/dist-esm/lib/components/default-components/DefaultHandles.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultScribble.mjs +0 -21
- package/dist-esm/lib/components/default-components/DefaultScribble.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultSelectionForeground.mjs +0 -39
- package/dist-esm/lib/components/default-components/DefaultSelectionForeground.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +0 -77
- package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultShapeIndicatorErrorFallback.mjs +0 -8
- package/dist-esm/lib/components/default-components/DefaultShapeIndicatorErrorFallback.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +0 -82
- package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs +0 -142
- package/dist-esm/lib/components/default-components/DefaultSnapIndictor.mjs.map +0 -7
- package/src/lib/components/LiveCollaborators.tsx +0 -180
- package/src/lib/components/default-components/CanvasShapeIndicators.tsx +0 -300
- package/src/lib/components/default-components/DefaultBrush.tsx +0 -35
- package/src/lib/components/default-components/DefaultCollaboratorHint.tsx +0 -52
- package/src/lib/components/default-components/DefaultHandle.tsx +0 -42
- package/src/lib/components/default-components/DefaultHandles.tsx +0 -15
- package/src/lib/components/default-components/DefaultScribble.tsx +0 -31
- package/src/lib/components/default-components/DefaultSelectionForeground.tsx +0 -50
- package/src/lib/components/default-components/DefaultShapeIndicator.tsx +0 -104
- package/src/lib/components/default-components/DefaultShapeIndicatorErrorFallback.tsx +0 -9
- package/src/lib/components/default-components/DefaultShapeIndicators.tsx +0 -118
- package/src/lib/components/default-components/DefaultSnapIndictor.tsx +0 -174
package/dist-cjs/index.d.ts
CHANGED
|
@@ -19,7 +19,6 @@ import { JsonObject } from '@tldraw/utils';
|
|
|
19
19
|
import { JSX } from 'react/jsx-runtime';
|
|
20
20
|
import { LegacyMigrations } from '@tldraw/store';
|
|
21
21
|
import { MigrationSequence } from '@tldraw/store';
|
|
22
|
-
import { NamedExoticComponent } from 'react';
|
|
23
22
|
import { Node as Node_2 } from '@tiptap/pm/model';
|
|
24
23
|
import { PerformanceTracker } from '@tldraw/utils';
|
|
25
24
|
import { PointerEvent as PointerEvent_2 } from 'react';
|
|
@@ -220,6 +219,56 @@ export declare abstract class BaseBoxShapeUtil<Shape extends TLBaseBoxShape> ext
|
|
|
220
219
|
getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
|
|
221
220
|
}
|
|
222
221
|
|
|
222
|
+
/**
|
|
223
|
+
* A base class for frame-like shapes — containers that clip their children,
|
|
224
|
+
* require full-brush selection, block erasure from inside, and support
|
|
225
|
+
* drag-and-drop reparenting.
|
|
226
|
+
*
|
|
227
|
+
* Extending this class is the easiest way to create a custom frame-like shape.
|
|
228
|
+
* It provides sensible defaults for all frame-like behaviors:
|
|
229
|
+
*
|
|
230
|
+
* - `isFrameLike()` returns `true`
|
|
231
|
+
* - `providesBackgroundForChildren()` returns `true`
|
|
232
|
+
* - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
|
|
233
|
+
* - `getClipPath()` returns the shape geometry's vertices
|
|
234
|
+
* - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
|
|
235
|
+
* - `onDragShapesOut()` reparents shapes back to the page
|
|
236
|
+
*
|
|
237
|
+
* All methods can be overridden for custom behavior.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* class MyContainerUtil extends BaseFrameLikeShapeUtil<MyContainerShape> {
|
|
242
|
+
* static override type = 'my-container' as const
|
|
243
|
+
* static override props = myContainerShapeProps
|
|
244
|
+
*
|
|
245
|
+
* override getDefaultProps() {
|
|
246
|
+
* return { w: 300, h: 200 }
|
|
247
|
+
* }
|
|
248
|
+
*
|
|
249
|
+
* override component(shape: MyContainerShape) {
|
|
250
|
+
* return <SVGContainer>...</SVGContainer>
|
|
251
|
+
* }
|
|
252
|
+
*
|
|
253
|
+
* override getIndicatorPath(shape: MyContainerShape) {
|
|
254
|
+
* const path = new Path2D()
|
|
255
|
+
* path.rect(0, 0, shape.props.w, shape.props.h)
|
|
256
|
+
* return path
|
|
257
|
+
* }
|
|
258
|
+
* }
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* @public
|
|
262
|
+
*/
|
|
263
|
+
export declare abstract class BaseFrameLikeShapeUtil<Shape extends TLBaseBoxShape> extends BaseBoxShapeUtil<Shape> {
|
|
264
|
+
isFrameLike(_shape: Shape): boolean;
|
|
265
|
+
providesBackgroundForChildren(): boolean;
|
|
266
|
+
canReceiveNewChildrenOfType(shape: Shape, _type: TLShape['type']): boolean;
|
|
267
|
+
getClipPath(shape: Shape): undefined | Vec[];
|
|
268
|
+
onDragShapesIn(shape: Shape, draggingShapes: TLShape[], { initialParentIds, initialIndices }: TLDragShapesInInfo): void;
|
|
269
|
+
onDragShapesOut(shape: Shape, draggingShapes: TLShape[], info: TLDragShapesOutInfo): void;
|
|
270
|
+
}
|
|
271
|
+
|
|
223
272
|
/** @public */
|
|
224
273
|
export declare interface BatchMeasurementRequest {
|
|
225
274
|
html: string;
|
|
@@ -881,51 +930,21 @@ export declare const DEFAULT_THEME: TLTheme;
|
|
|
881
930
|
/** @public @react */
|
|
882
931
|
export declare function DefaultBackground(): JSX.Element;
|
|
883
932
|
|
|
884
|
-
/** @public @react */
|
|
885
|
-
export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX.Element;
|
|
886
|
-
|
|
887
933
|
/** @public @react */
|
|
888
934
|
export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
|
|
889
935
|
|
|
890
|
-
/** @public @react */
|
|
891
|
-
export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity }: TLCollaboratorHintProps): JSX.Element;
|
|
892
|
-
|
|
893
|
-
/** @public @react */
|
|
894
|
-
export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
|
|
895
|
-
|
|
896
936
|
/** @public @react */
|
|
897
937
|
export declare const DefaultErrorFallback: TLErrorFallbackComponent;
|
|
898
938
|
|
|
899
939
|
/** @public @react */
|
|
900
940
|
export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
|
|
901
941
|
|
|
902
|
-
/** @public @react */
|
|
903
|
-
export declare function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX.Element;
|
|
904
|
-
|
|
905
|
-
/** @public @react */
|
|
906
|
-
export declare const DefaultHandles: ({ children }: TLHandlesProps) => JSX.Element;
|
|
907
|
-
|
|
908
|
-
/** @public @react */
|
|
909
|
-
export declare function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX.Element | null;
|
|
910
|
-
|
|
911
942
|
/** @public @react */
|
|
912
943
|
export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
|
|
913
944
|
|
|
914
|
-
/** @public @react */
|
|
915
|
-
export declare function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX.Element;
|
|
916
|
-
|
|
917
|
-
/** @public @react */
|
|
918
|
-
export declare const DefaultShapeIndicator: NamedExoticComponent<TLShapeIndicatorProps>;
|
|
919
|
-
|
|
920
|
-
/** @public @react */
|
|
921
|
-
export declare const DefaultShapeIndicators: NamedExoticComponent<TLShapeIndicatorsProps>;
|
|
922
|
-
|
|
923
945
|
/** @public @react */
|
|
924
946
|
export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
925
947
|
|
|
926
|
-
/** @public @react */
|
|
927
|
-
export declare function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX.Element;
|
|
928
|
-
|
|
929
948
|
/** @public @react */
|
|
930
949
|
export declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): JSX.Element;
|
|
931
950
|
|
|
@@ -1005,7 +1024,6 @@ export declare const defaultTldrawOptions: {
|
|
|
1005
1024
|
readonly tooltipDelayMs: 700;
|
|
1006
1025
|
readonly uiCoarseDragDistanceSquared: 625;
|
|
1007
1026
|
readonly uiDragDistanceSquared: 16;
|
|
1008
|
-
readonly useCanvasIndicators: true;
|
|
1009
1027
|
readonly zoomToFitPadding: 128;
|
|
1010
1028
|
};
|
|
1011
1029
|
|
|
@@ -1105,7 +1123,7 @@ export declare class EdgeScrollManager {
|
|
|
1105
1123
|
/** @public */
|
|
1106
1124
|
export declare class Editor extends EventEmitter<TLEventMap> {
|
|
1107
1125
|
readonly id: string;
|
|
1108
|
-
constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
|
|
1126
|
+
constructor({ store, user, shapeUtils, bindingUtils, assetUtils: assetUtilConstructors, overlayUtils: overlayUtilConstructors, tools, getContainer, cameraOptions, initialState, autoFocus, options: _options, textOptions: _textOptions, getShapeVisibility, colorScheme, fontAssetUrls, themes, initialTheme }: TLEditorOptions);
|
|
1109
1127
|
private readonly _getShapeVisibility?;
|
|
1110
1128
|
private getIsShapeHiddenCache;
|
|
1111
1129
|
isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
|
|
@@ -1187,6 +1205,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1187
1205
|
setInterval: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
|
|
1188
1206
|
setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
|
|
1189
1207
|
};
|
|
1208
|
+
/* Excluded from this release type: _collaboratorVisibilityClock */
|
|
1190
1209
|
/**
|
|
1191
1210
|
* A manager for the user and their preferences.
|
|
1192
1211
|
*
|
|
@@ -1212,6 +1231,12 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1212
1231
|
* @public
|
|
1213
1232
|
*/
|
|
1214
1233
|
readonly scribbles: ScribbleManager;
|
|
1234
|
+
/**
|
|
1235
|
+
* A manager for canvas overlay UI elements (selection handles, shape handles, etc.).
|
|
1236
|
+
*
|
|
1237
|
+
* @public
|
|
1238
|
+
*/
|
|
1239
|
+
readonly overlays: OverlayManager;
|
|
1215
1240
|
/**
|
|
1216
1241
|
* A manager for side effects and correct state enforcement. See {@link @tldraw/store#StoreSideEffects} for details.
|
|
1217
1242
|
*
|
|
@@ -2464,6 +2489,23 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2464
2489
|
* @public
|
|
2465
2490
|
*/
|
|
2466
2491
|
getCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
2492
|
+
/**
|
|
2493
|
+
* Returns a list of presence records for peer collaborators who should currently be
|
|
2494
|
+
* shown in the UI. Filters {@link Editor.getCollaborators} by activity state
|
|
2495
|
+
* (active / idle / inactive) and visibility rules such as following and highlighted
|
|
2496
|
+
* users. Re-evaluates on the collaborator visibility clock, so callers don't need to
|
|
2497
|
+
* drive their own activity timer.
|
|
2498
|
+
*
|
|
2499
|
+
* @public
|
|
2500
|
+
*/
|
|
2501
|
+
getVisibleCollaborators(): TLInstancePresence[];
|
|
2502
|
+
/**
|
|
2503
|
+
* Returns a list of presence records for peer collaborators who should currently be
|
|
2504
|
+
* shown in the UI, filtered to those on the current page.
|
|
2505
|
+
*
|
|
2506
|
+
* @public
|
|
2507
|
+
*/
|
|
2508
|
+
getVisibleCollaboratorsOnCurrentPage(): TLInstancePresence[];
|
|
2467
2509
|
/**
|
|
2468
2510
|
* Get the current user's ID for attribution purposes.
|
|
2469
2511
|
* Also ensures a `user:` record exists in the store for the current user.
|
|
@@ -3124,6 +3166,20 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3124
3166
|
type: T['type'];
|
|
3125
3167
|
}>;
|
|
3126
3168
|
isShapeOfType<T extends TLShape = TLShape>(shapeId: TLShapeId, type: T['type']): boolean;
|
|
3169
|
+
/**
|
|
3170
|
+
* Get whether a shape behaves like a frame — a container that has child
|
|
3171
|
+
* shapes, requires full-brush selection, blocks erasure from inside, etc.
|
|
3172
|
+
*
|
|
3173
|
+
* @example
|
|
3174
|
+
* ```ts
|
|
3175
|
+
* const isFrameLike = editor.isShapeFrameLike(someShape)
|
|
3176
|
+
* ```
|
|
3177
|
+
*
|
|
3178
|
+
* @param shape - The shape (or shape id) to test.
|
|
3179
|
+
*
|
|
3180
|
+
* @public
|
|
3181
|
+
*/
|
|
3182
|
+
isShapeFrameLike(shape: TLShape | TLShapeId): boolean;
|
|
3127
3183
|
/**
|
|
3128
3184
|
* Get a shape by its id.
|
|
3129
3185
|
*
|
|
@@ -4790,7 +4846,7 @@ export declare class GroupShapeUtil extends ShapeUtil<TLGroupShape> {
|
|
|
4790
4846
|
getDefaultProps(): TLGroupShape['props'];
|
|
4791
4847
|
getGeometry(shape: TLGroupShape): Geometry2d;
|
|
4792
4848
|
component(shape: TLGroupShape): JSX.Element | null;
|
|
4793
|
-
|
|
4849
|
+
getIndicatorPath(shape: TLGroupShape): Path2D;
|
|
4794
4850
|
onChildrenChange(group: TLGroupShape): void;
|
|
4795
4851
|
}
|
|
4796
4852
|
|
|
@@ -5418,6 +5474,179 @@ export declare function openWindow(url: string, target?: string, allowReferrer?:
|
|
|
5418
5474
|
/** @public */
|
|
5419
5475
|
export declare type OptionalKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
5420
5476
|
|
|
5477
|
+
/** @public */
|
|
5478
|
+
export declare class OverlayManager {
|
|
5479
|
+
readonly editor: Editor;
|
|
5480
|
+
constructor(editor: Editor);
|
|
5481
|
+
/* Excluded from this release type: _overlayUtils */
|
|
5482
|
+
/* Excluded from this release type: registerUtil */
|
|
5483
|
+
/**
|
|
5484
|
+
* Get an overlay util by type string, overlay instance, or by passing
|
|
5485
|
+
* a util class as a generic parameter for type-safe lookup.
|
|
5486
|
+
*
|
|
5487
|
+
* @example
|
|
5488
|
+
* ```ts
|
|
5489
|
+
* const util = editor.overlays.getOverlayUtil('brush')
|
|
5490
|
+
* const util = editor.overlays.getOverlayUtil<BrushOverlayUtil>('brush')
|
|
5491
|
+
* const util = editor.overlays.getOverlayUtil(myOverlay)
|
|
5492
|
+
* ```
|
|
5493
|
+
*
|
|
5494
|
+
* @public
|
|
5495
|
+
*/
|
|
5496
|
+
getOverlayUtil<T extends OverlayUtil>(type: T extends OverlayUtil<infer O> ? O['type'] : string): T;
|
|
5497
|
+
getOverlayUtil<O extends TLOverlay>(overlay: O): OverlayUtil<O>;
|
|
5498
|
+
/**
|
|
5499
|
+
* Returns all registered overlay utils in paint order (ascending zIndex).
|
|
5500
|
+
* Utils with the same zIndex preserve their registration order.
|
|
5501
|
+
*
|
|
5502
|
+
* @public
|
|
5503
|
+
*/
|
|
5504
|
+
getOverlayUtilsInZOrder(): OverlayUtil[];
|
|
5505
|
+
/**
|
|
5506
|
+
* Reactive list of active overlay utils paired with the overlays they
|
|
5507
|
+
* produced for the current editor state, in paint order (ascending
|
|
5508
|
+
* zIndex). Both the hit-test and render paths read from this single
|
|
5509
|
+
* cached scan instead of each re-deriving the active set. Active utils
|
|
5510
|
+
* are included even when their `getOverlays()` returns an empty array,
|
|
5511
|
+
* since `render()` may still draw non-interactive UI (e.g. the selection
|
|
5512
|
+
* bounding box during brushing).
|
|
5513
|
+
*
|
|
5514
|
+
* @public
|
|
5515
|
+
*/
|
|
5516
|
+
getActiveOverlayEntries(): TLOverlayEntry[];
|
|
5517
|
+
/**
|
|
5518
|
+
* Reactively computed list of all currently active overlays, in paint order.
|
|
5519
|
+
* @public
|
|
5520
|
+
*/
|
|
5521
|
+
getCurrentOverlays(): TLOverlay[];
|
|
5522
|
+
private _geometryCache;
|
|
5523
|
+
/**
|
|
5524
|
+
* Get hit-test geometry for an overlay, cached by overlay identity. Lets
|
|
5525
|
+
* hit-testing on a pointermove storm skip the per-overlay geometry
|
|
5526
|
+
* allocation that {@link OverlayUtil.getGeometry} would otherwise do on
|
|
5527
|
+
* every call.
|
|
5528
|
+
*
|
|
5529
|
+
* @public
|
|
5530
|
+
*/
|
|
5531
|
+
getOverlayGeometry(overlay: TLOverlay): Geometry2d | null;
|
|
5532
|
+
/**
|
|
5533
|
+
* The currently hovered overlay id.
|
|
5534
|
+
* @public
|
|
5535
|
+
*/
|
|
5536
|
+
private _hoveredOverlayId;
|
|
5537
|
+
getHoveredOverlayId(): null | string;
|
|
5538
|
+
getHoveredOverlay(): null | TLOverlay;
|
|
5539
|
+
setHoveredOverlay(id: null | string): void;
|
|
5540
|
+
/**
|
|
5541
|
+
* Hit test all active overlays at a given page point.
|
|
5542
|
+
* Returns the topmost overlay whose geometry contains the point, or null.
|
|
5543
|
+
* Utils are walked from highest zIndex to lowest so the overlay painted on
|
|
5544
|
+
* top also wins the hit test. Within a util, overlays are walked in
|
|
5545
|
+
* array order: the first overlay whose geometry contains the point wins,
|
|
5546
|
+
* so utils should place highest-priority overlays first in `getOverlays`.
|
|
5547
|
+
* Interactive overlays (those with geometry) are checked; non-interactive are skipped.
|
|
5548
|
+
*
|
|
5549
|
+
* @param point - Point in page coordinates
|
|
5550
|
+
* @param margin - Hit test margin
|
|
5551
|
+
* @public
|
|
5552
|
+
*/
|
|
5553
|
+
getOverlayAtPoint(point: VecLike, margin?: number): null | TLOverlay;
|
|
5554
|
+
}
|
|
5555
|
+
|
|
5556
|
+
/**
|
|
5557
|
+
* Base class for overlay utilities. Overlays are ephemeral UI elements rendered
|
|
5558
|
+
* on top of the canvas (selection handles, rotation corners, shape handles, etc.).
|
|
5559
|
+
*
|
|
5560
|
+
* Each OverlayUtil defines a type of overlay and knows how to:
|
|
5561
|
+
* - Determine when its overlays should be active (predicate)
|
|
5562
|
+
* - Produce overlay instances from current editor state
|
|
5563
|
+
* - Provide hit-test geometry for interactive overlays
|
|
5564
|
+
* - Provide cursor style on hover
|
|
5565
|
+
* - Render into a canvas 2D context
|
|
5566
|
+
*
|
|
5567
|
+
* @public
|
|
5568
|
+
*/
|
|
5569
|
+
export declare abstract class OverlayUtil<T extends TLOverlay = TLOverlay> {
|
|
5570
|
+
editor: Editor;
|
|
5571
|
+
constructor(editor: Editor);
|
|
5572
|
+
static type: string;
|
|
5573
|
+
/**
|
|
5574
|
+
* Options for this overlay util. Override this to provide customization options.
|
|
5575
|
+
* Use {@link OverlayUtil.configure} to customize existing overlay utils.
|
|
5576
|
+
*
|
|
5577
|
+
* `zIndex` controls paint and hit-test order across utils — higher numbers
|
|
5578
|
+
* paint on top and are hit-tested first. Ties resolve by registration order.
|
|
5579
|
+
* Defaults to `0`; built-in utils use larger integers (100, 200, …) with
|
|
5580
|
+
* gaps so custom utils can slot between.
|
|
5581
|
+
*
|
|
5582
|
+
* @public
|
|
5583
|
+
*/
|
|
5584
|
+
options: {
|
|
5585
|
+
zIndex?: number;
|
|
5586
|
+
};
|
|
5587
|
+
/**
|
|
5588
|
+
* Create a new overlay util class with the given options merged in.
|
|
5589
|
+
*
|
|
5590
|
+
* @example
|
|
5591
|
+
* ```ts
|
|
5592
|
+
* const MyBrush = BrushOverlayUtil.configure({ fill: 'rgba(0,0,255,0.1)' })
|
|
5593
|
+
* ```
|
|
5594
|
+
*
|
|
5595
|
+
* @public
|
|
5596
|
+
*/
|
|
5597
|
+
static configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
|
|
5598
|
+
options: infer Options;
|
|
5599
|
+
} ? Partial<Options> : never): T;
|
|
5600
|
+
/**
|
|
5601
|
+
* Whether this overlay util's overlays should currently be active.
|
|
5602
|
+
* Checked reactively to determine which overlays exist at any given time.
|
|
5603
|
+
*/
|
|
5604
|
+
abstract isActive(): boolean;
|
|
5605
|
+
/**
|
|
5606
|
+
* Returns the overlay instances that currently exist.
|
|
5607
|
+
* Called only when `isActive()` returns true.
|
|
5608
|
+
*/
|
|
5609
|
+
abstract getOverlays(): T[];
|
|
5610
|
+
/**
|
|
5611
|
+
* Returns hit-test geometry for an overlay instance, in page coordinates.
|
|
5612
|
+
* Return null for non-interactive overlays (e.g. snap indicators, scribbles).
|
|
5613
|
+
*/
|
|
5614
|
+
getGeometry(_overlay: T): Geometry2d | null;
|
|
5615
|
+
/**
|
|
5616
|
+
* Returns the cursor type to show when hovering this overlay.
|
|
5617
|
+
*/
|
|
5618
|
+
getCursor(_overlay: T): TLCursorType | undefined;
|
|
5619
|
+
/**
|
|
5620
|
+
* Called when the user points down on this overlay, before the default
|
|
5621
|
+
* routing runs. Acts as an interrupt: define it to take over the event.
|
|
5622
|
+
*
|
|
5623
|
+
* Return `false` to continue with the default behavior (e.g. the
|
|
5624
|
+
* built-in rotate/resize handle transitions or shape-handle dispatch).
|
|
5625
|
+
* Return `true` — or nothing at all — to skip the default. In other
|
|
5626
|
+
* words, once you override this method you own the event unless you
|
|
5627
|
+
* explicitly opt back in by returning `false`.
|
|
5628
|
+
*/
|
|
5629
|
+
onPointerDown?(overlay: T, info: TLPointerEventInfo): boolean | void;
|
|
5630
|
+
/**
|
|
5631
|
+
* Render all active overlays into the canvas context.
|
|
5632
|
+
* The context is already transformed to page space (camera transform applied).
|
|
5633
|
+
* Called reactively when overlays or editor state changes.
|
|
5634
|
+
*/
|
|
5635
|
+
render(_ctx: CanvasRenderingContext2D, _overlays: T[]): void;
|
|
5636
|
+
/**
|
|
5637
|
+
* Optional: render all active overlays into the minimap canvas.
|
|
5638
|
+
* The context is already transformed to page space (minimap camera applied),
|
|
5639
|
+
* so overlays can use the same page-space coordinates as in {@link OverlayUtil.render}.
|
|
5640
|
+
*
|
|
5641
|
+
* `zoom` is the minimap's screen-pixels-per-page-unit, analogous to
|
|
5642
|
+
* `editor.getCamera().z`; use `1 / zoom` for one-minimap-pixel line widths.
|
|
5643
|
+
*
|
|
5644
|
+
* Most overlays should leave this blank — only overlays that are meaningful
|
|
5645
|
+
* at minimap scale (e.g. brushes, collaborator cursors) should opt in.
|
|
5646
|
+
*/
|
|
5647
|
+
renderMinimap(_ctx: CanvasRenderingContext2D, _overlays: T[], _zoom: number): void;
|
|
5648
|
+
}
|
|
5649
|
+
|
|
5421
5650
|
/**
|
|
5422
5651
|
* Parses a string created by {@link createDeepLinkString} back into a deep link descriptor.
|
|
5423
5652
|
*
|
|
@@ -5950,6 +6179,29 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
|
|
|
5950
6179
|
/** @public */
|
|
5951
6180
|
export declare function setUserPreferences(user: TLUserPreferences): void;
|
|
5952
6181
|
|
|
6182
|
+
/**
|
|
6183
|
+
* Overlay util for shape indicators — the selection / hover / hint outlines drawn
|
|
6184
|
+
* under the selection foreground. Paints local indicators in the theme's
|
|
6185
|
+
* selection color and remote collaborator indicators in each peer's color.
|
|
6186
|
+
*
|
|
6187
|
+
* Non-interactive: contributes no hit-test geometry.
|
|
6188
|
+
*
|
|
6189
|
+
* @public
|
|
6190
|
+
*/
|
|
6191
|
+
export declare class ShapeIndicatorOverlayUtil extends OverlayUtil<TLShapeIndicatorOverlay> {
|
|
6192
|
+
static type: string;
|
|
6193
|
+
options: {
|
|
6194
|
+
hintedLineWidth: number;
|
|
6195
|
+
lineWidth: number;
|
|
6196
|
+
zIndex: number;
|
|
6197
|
+
};
|
|
6198
|
+
private _instanceFlags$;
|
|
6199
|
+
isActive(): boolean;
|
|
6200
|
+
getOverlays(): TLShapeIndicatorOverlay[];
|
|
6201
|
+
render(ctx: CanvasRenderingContext2D, overlays: TLShapeIndicatorOverlay[]): void;
|
|
6202
|
+
private _strokeIndicatorBatch;
|
|
6203
|
+
}
|
|
6204
|
+
|
|
5953
6205
|
/** @public */
|
|
5954
6206
|
export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
5955
6207
|
editor: Editor;
|
|
@@ -6046,37 +6298,30 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6046
6298
|
*/
|
|
6047
6299
|
abstract component(shape: Shape): any;
|
|
6048
6300
|
/**
|
|
6049
|
-
* Get
|
|
6301
|
+
* Get a Path2D (or a richer object with clip/additional paths) for rendering the
|
|
6302
|
+
* shape's indicator on the canvas. Shapes that return `undefined` will not render
|
|
6303
|
+
* an indicator.
|
|
6050
6304
|
*
|
|
6051
|
-
*
|
|
6052
|
-
*
|
|
6053
|
-
*/
|
|
6054
|
-
abstract indicator(shape: Shape): any;
|
|
6055
|
-
/**
|
|
6056
|
-
* Whether to use the legacy React-based indicator rendering.
|
|
6057
|
-
*
|
|
6058
|
-
* Override this to return `false` if your shape implements {@link ShapeUtil.getIndicatorPath}
|
|
6059
|
-
* for canvas-based indicator rendering.
|
|
6305
|
+
* For complex indicators that need clipping (e.g., arrows with labels), return an
|
|
6306
|
+
* object with `path`, `clipPath`, and `additionalPaths` properties.
|
|
6060
6307
|
*
|
|
6061
|
-
* @
|
|
6308
|
+
* @param shape - The shape.
|
|
6309
|
+
* @returns A Path2D to stroke, or an object with clipping info, or undefined to skip.
|
|
6062
6310
|
* @public
|
|
6063
6311
|
*/
|
|
6064
|
-
|
|
6312
|
+
abstract getIndicatorPath(shape: Shape): TLIndicatorPath | undefined;
|
|
6065
6313
|
/**
|
|
6066
|
-
* Get
|
|
6067
|
-
*
|
|
6068
|
-
* When implemented, this is used instead of {@link ShapeUtil.indicator} for more
|
|
6069
|
-
* efficient canvas-based indicator rendering. Shapes that return `undefined` will
|
|
6070
|
-
* fall back to SVG-based rendering via {@link ShapeUtil.indicator}.
|
|
6314
|
+
* Get JSX describing the shape's indicator (as an SVG element).
|
|
6071
6315
|
*
|
|
6072
|
-
*
|
|
6073
|
-
*
|
|
6316
|
+
* @deprecated SVG indicators are no longer rendered. Override
|
|
6317
|
+
* {@link ShapeUtil.getIndicatorPath} instead. This stub is retained so legacy
|
|
6318
|
+
* subclasses that still call `super.indicator()` keep type-checking; new shapes
|
|
6319
|
+
* should not implement it.
|
|
6074
6320
|
*
|
|
6075
6321
|
* @param shape - The shape.
|
|
6076
|
-
* @returns A Path2D to stroke, or an object with clipping info, or undefined to use SVG fallback.
|
|
6077
6322
|
* @public
|
|
6078
6323
|
*/
|
|
6079
|
-
|
|
6324
|
+
indicator(_shape: Shape): any;
|
|
6080
6325
|
/**
|
|
6081
6326
|
* Get the font faces that should be rendered in the document in order for this shape to render
|
|
6082
6327
|
* correctly.
|
|
@@ -6244,6 +6489,14 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6244
6489
|
* @public
|
|
6245
6490
|
*/
|
|
6246
6491
|
isAspectRatioLocked(shape: Shape): boolean;
|
|
6492
|
+
/**
|
|
6493
|
+
* Whether the shape behaves like a frame — a container that has child shapes,
|
|
6494
|
+
* requires full-brush selection, blocks erasure from inside, etc.
|
|
6495
|
+
*
|
|
6496
|
+
* @param shape - The shape.
|
|
6497
|
+
* @public
|
|
6498
|
+
*/
|
|
6499
|
+
isFrameLike(_shape: Shape): boolean;
|
|
6247
6500
|
/**
|
|
6248
6501
|
* By default, the bounds of an image export are the bounds of all the shapes it contains, plus
|
|
6249
6502
|
* some padding. If an export includes a shape where `isExportBoundsContainer` is true, then the
|
|
@@ -7009,6 +7262,9 @@ export declare type TLAnyAssetUtilConstructor = TLAssetUtilConstructor<any>;
|
|
|
7009
7262
|
/** @public */
|
|
7010
7263
|
export declare type TLAnyBindingUtilConstructor = TLBindingUtilConstructor<any>;
|
|
7011
7264
|
|
|
7265
|
+
/** @public */
|
|
7266
|
+
export declare type TLAnyOverlayUtilConstructor = TLOverlayUtilConstructor<any>;
|
|
7267
|
+
|
|
7012
7268
|
/** @public */
|
|
7013
7269
|
export declare type TLAnyShapeUtilConstructor = TLShapeUtilConstructor<any>;
|
|
7014
7270
|
|
|
@@ -7052,15 +7308,6 @@ export declare interface TLBindingUtilConstructor<T extends TLBinding, U extends
|
|
|
7052
7308
|
migrations?: TLPropsMigrations;
|
|
7053
7309
|
}
|
|
7054
7310
|
|
|
7055
|
-
/** @public */
|
|
7056
|
-
export declare interface TLBrushProps {
|
|
7057
|
-
userId?: string;
|
|
7058
|
-
brush: BoxModel;
|
|
7059
|
-
color?: string;
|
|
7060
|
-
opacity?: number;
|
|
7061
|
-
className?: string;
|
|
7062
|
-
}
|
|
7063
|
-
|
|
7064
7311
|
/** @public */
|
|
7065
7312
|
export declare interface TLCameraConstraints {
|
|
7066
7313
|
/** The bounds (in page space) of the constrained space */
|
|
@@ -7248,17 +7495,6 @@ export declare interface TLClipboardWriteInfo {
|
|
|
7248
7495
|
readonly source: 'menu' | 'native';
|
|
7249
7496
|
}
|
|
7250
7497
|
|
|
7251
|
-
/** @public */
|
|
7252
|
-
export declare interface TLCollaboratorHintProps {
|
|
7253
|
-
userId: string;
|
|
7254
|
-
className?: string;
|
|
7255
|
-
point: VecModel;
|
|
7256
|
-
viewport: Box;
|
|
7257
|
-
zoom: number;
|
|
7258
|
-
opacity?: number;
|
|
7259
|
-
color: string;
|
|
7260
|
-
}
|
|
7261
|
-
|
|
7262
7498
|
/** @public */
|
|
7263
7499
|
export declare type TLCompleteEvent = (info: TLCompleteEventInfo) => void;
|
|
7264
7500
|
|
|
@@ -7303,17 +7539,6 @@ export declare interface TLCurrentUser {
|
|
|
7303
7539
|
readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
|
|
7304
7540
|
}
|
|
7305
7541
|
|
|
7306
|
-
/** @public */
|
|
7307
|
-
export declare interface TLCursorProps {
|
|
7308
|
-
userId: string;
|
|
7309
|
-
className?: string;
|
|
7310
|
-
point: null | VecModel;
|
|
7311
|
-
zoom: number;
|
|
7312
|
-
color?: string;
|
|
7313
|
-
name: null | string;
|
|
7314
|
-
chatMessage: string;
|
|
7315
|
-
}
|
|
7316
|
-
|
|
7317
7542
|
/** @public */
|
|
7318
7543
|
export declare type TLDeepLink = {
|
|
7319
7544
|
bounds: BoxModel;
|
|
@@ -7407,6 +7632,10 @@ export declare interface TldrawEditorBaseProps {
|
|
|
7407
7632
|
* An array of asset utils to use in the editor.
|
|
7408
7633
|
*/
|
|
7409
7634
|
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
7635
|
+
/**
|
|
7636
|
+
* An array of overlay utils to use in the editor for canvas overlay UI elements.
|
|
7637
|
+
*/
|
|
7638
|
+
overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
|
|
7410
7639
|
/**
|
|
7411
7640
|
* An array of tools to add to the editor's state chart.
|
|
7412
7641
|
*/
|
|
@@ -7716,12 +7945,6 @@ export declare interface TldrawOptions {
|
|
|
7716
7945
|
* viewport's page dimensions regardless of overview zoom changes.
|
|
7717
7946
|
*/
|
|
7718
7947
|
readonly quickZoomPreservesScreenBounds: boolean;
|
|
7719
|
-
/**
|
|
7720
|
-
* Whether to use 2D canvas rendering for shape indicators. When true (default),
|
|
7721
|
-
* shapes that support it will render indicators on a 2D canvas for better
|
|
7722
|
-
* performance. When false, all indicators use legacy SVG rendering.
|
|
7723
|
-
*/
|
|
7724
|
-
readonly useCanvasIndicators: boolean;
|
|
7725
7948
|
/**
|
|
7726
7949
|
* Called before content is written to the clipboard during a copy or cut operation.
|
|
7727
7950
|
* Receives the serialized content (shapes, bindings, assets) and can filter or transform
|
|
@@ -7809,34 +8032,17 @@ export declare interface TLDropShapesOverInfo {
|
|
|
7809
8032
|
/** @public */
|
|
7810
8033
|
export declare interface TLEditorComponents {
|
|
7811
8034
|
Background?: ComponentType | null;
|
|
7812
|
-
Brush?: ComponentType<TLBrushProps> | null;
|
|
7813
8035
|
Canvas?: ComponentType<TLCanvasComponentProps> | null;
|
|
7814
|
-
CollaboratorBrush?: ComponentType<TLBrushProps> | null;
|
|
7815
|
-
CollaboratorCursor?: ComponentType<TLCursorProps> | null;
|
|
7816
|
-
CollaboratorHint?: ComponentType<TLCollaboratorHintProps> | null;
|
|
7817
|
-
CollaboratorScribble?: ComponentType<TLScribbleProps> | null;
|
|
7818
|
-
CollaboratorShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
|
|
7819
|
-
Cursor?: ComponentType<TLCursorProps> | null;
|
|
7820
8036
|
Grid?: ComponentType<TLGridProps> | null;
|
|
7821
|
-
Handle?: ComponentType<TLHandleProps> | null;
|
|
7822
|
-
Handles?: ComponentType<TLHandlesProps> | null;
|
|
7823
8037
|
InFrontOfTheCanvas?: ComponentType | null;
|
|
7824
8038
|
LoadingScreen?: ComponentType | null;
|
|
7825
8039
|
OnTheCanvas?: ComponentType | null;
|
|
7826
|
-
Overlays?: ComponentType | null;
|
|
7827
|
-
Scribble?: ComponentType<TLScribbleProps> | null;
|
|
7828
8040
|
SelectionBackground?: ComponentType<TLSelectionBackgroundProps> | null;
|
|
7829
|
-
SelectionForeground?: ComponentType<TLSelectionForegroundProps> | null;
|
|
7830
|
-
ShapeIndicator?: ComponentType<TLShapeIndicatorProps> | null;
|
|
7831
|
-
ShapeIndicators?: ComponentType | null;
|
|
7832
8041
|
ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
|
|
7833
|
-
SnapIndicator?: ComponentType<TLSnapIndicatorProps> | null;
|
|
7834
8042
|
Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
|
|
7835
8043
|
SvgDefs?: ComponentType | null;
|
|
7836
|
-
ZoomBrush?: ComponentType<TLBrushProps> | null;
|
|
7837
8044
|
ErrorFallback?: TLErrorFallbackComponent;
|
|
7838
8045
|
ShapeErrorFallback?: TLShapeErrorFallbackComponent;
|
|
7839
|
-
ShapeIndicatorErrorFallback?: TLShapeIndicatorErrorFallbackComponent;
|
|
7840
8046
|
}
|
|
7841
8047
|
|
|
7842
8048
|
/** @public */
|
|
@@ -7858,6 +8064,11 @@ export declare interface TLEditorOptions {
|
|
|
7858
8064
|
* An array of asset utils to use in the editor. These will be used to handle asset-type-specific behavior.
|
|
7859
8065
|
*/
|
|
7860
8066
|
assetUtils?: readonly TLAnyAssetUtilConstructor[];
|
|
8067
|
+
/**
|
|
8068
|
+
* An array of overlay utils to use in the editor. These define canvas overlay UI elements
|
|
8069
|
+
* like selection handles, rotation corners, shape handles, etc.
|
|
8070
|
+
*/
|
|
8071
|
+
overlayUtils?: readonly TLAnyOverlayUtilConstructor[];
|
|
7861
8072
|
/**
|
|
7862
8073
|
* An array of tools to use in the editor. These will be used to handle events and manage user interactions in the editor.
|
|
7863
8074
|
*/
|
|
@@ -8224,20 +8435,6 @@ export declare interface TLHandleDragInfo<T extends TLShape> {
|
|
|
8224
8435
|
initial?: T | undefined;
|
|
8225
8436
|
}
|
|
8226
8437
|
|
|
8227
|
-
/** @public */
|
|
8228
|
-
export declare interface TLHandleProps {
|
|
8229
|
-
shapeId: TLShapeId;
|
|
8230
|
-
handle: TLHandle;
|
|
8231
|
-
zoom: number;
|
|
8232
|
-
isCoarse: boolean;
|
|
8233
|
-
className?: string;
|
|
8234
|
-
}
|
|
8235
|
-
|
|
8236
|
-
/** @public */
|
|
8237
|
-
export declare interface TLHandlesProps {
|
|
8238
|
-
children: ReactNode;
|
|
8239
|
-
}
|
|
8240
|
-
|
|
8241
8438
|
/** @public */
|
|
8242
8439
|
export declare interface TLHistoryBatchOptions {
|
|
8243
8440
|
/**
|
|
@@ -8567,6 +8764,42 @@ export declare const tlmenus: {
|
|
|
8567
8764
|
*/
|
|
8568
8765
|
export declare type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
|
|
8569
8766
|
|
|
8767
|
+
/** @public */
|
|
8768
|
+
export declare interface TLOverlay<Props = Record<string, unknown>> {
|
|
8769
|
+
/**
|
|
8770
|
+
* Globally unique id for this overlay instance across all overlay utils.
|
|
8771
|
+
* Hit-test and hover lookup key on `id` alone, so utils must namespace their
|
|
8772
|
+
* ids (e.g. `'selection_fg:top_left'`, `'handle:<shapeId>:<handleId>'`) to
|
|
8773
|
+
* avoid colliding with overlays from other utils.
|
|
8774
|
+
*/
|
|
8775
|
+
id: string;
|
|
8776
|
+
/** The overlay util type that owns this instance */
|
|
8777
|
+
type: string;
|
|
8778
|
+
/** Arbitrary props for the overlay (handle id, corner name, etc.) */
|
|
8779
|
+
props: Props;
|
|
8780
|
+
}
|
|
8781
|
+
|
|
8782
|
+
/**
|
|
8783
|
+
* An active overlay util paired with the overlays it produced for the current
|
|
8784
|
+
* editor state. Returned by {@link OverlayManager.getActiveOverlayEntries} so
|
|
8785
|
+
* hit-test, render, and debug paths share a single scan per reactive tick.
|
|
8786
|
+
*
|
|
8787
|
+
* @public
|
|
8788
|
+
*/
|
|
8789
|
+
export declare interface TLOverlayEntry {
|
|
8790
|
+
util: OverlayUtil;
|
|
8791
|
+
overlays: TLOverlay[];
|
|
8792
|
+
}
|
|
8793
|
+
|
|
8794
|
+
/** @public */
|
|
8795
|
+
export declare interface TLOverlayUtilConstructor<U extends OverlayUtil = OverlayUtil> {
|
|
8796
|
+
new (editor: Editor): U;
|
|
8797
|
+
type: string;
|
|
8798
|
+
configure<T extends TLOverlayUtilConstructor<any>>(this: T, options: T extends new (...args: any[]) => {
|
|
8799
|
+
options: infer Options;
|
|
8800
|
+
} ? Partial<Options> : never): T;
|
|
8801
|
+
}
|
|
8802
|
+
|
|
8570
8803
|
/**
|
|
8571
8804
|
* Map of all performance event names to their payload types.
|
|
8572
8805
|
* Used with {@link PerformanceManager.on} and {@link PerformanceManager.once}.
|
|
@@ -8694,6 +8927,10 @@ export declare type TLPointerEventTarget = {
|
|
|
8694
8927
|
handle?: TLSelectionHandle;
|
|
8695
8928
|
shape?: undefined;
|
|
8696
8929
|
target: 'selection';
|
|
8930
|
+
} | {
|
|
8931
|
+
overlay: TLOverlay;
|
|
8932
|
+
shape?: undefined;
|
|
8933
|
+
target: 'overlay';
|
|
8697
8934
|
} | {
|
|
8698
8935
|
shape: TLShape;
|
|
8699
8936
|
target: 'shape';
|
|
@@ -8764,28 +9001,12 @@ export declare type TLResizeShapeOptions = Partial<{
|
|
|
8764
9001
|
|
|
8765
9002
|
/* Excluded from this release type: TLRotationSnapshot */
|
|
8766
9003
|
|
|
8767
|
-
/** @public */
|
|
8768
|
-
export declare interface TLScribbleProps {
|
|
8769
|
-
userId?: string;
|
|
8770
|
-
scribble: TLScribble;
|
|
8771
|
-
zoom: number;
|
|
8772
|
-
color?: string;
|
|
8773
|
-
opacity?: number;
|
|
8774
|
-
className?: string;
|
|
8775
|
-
}
|
|
8776
|
-
|
|
8777
9004
|
/** @public */
|
|
8778
9005
|
export declare interface TLSelectionBackgroundProps {
|
|
8779
9006
|
bounds: Box;
|
|
8780
9007
|
rotation: number;
|
|
8781
9008
|
}
|
|
8782
9009
|
|
|
8783
|
-
/** @public */
|
|
8784
|
-
export declare interface TLSelectionForegroundProps {
|
|
8785
|
-
bounds: Box;
|
|
8786
|
-
rotation: number;
|
|
8787
|
-
}
|
|
8788
|
-
|
|
8789
9010
|
/** @public */
|
|
8790
9011
|
export declare type TLSelectionHandle = RotateCorner | SelectionCorner | SelectionEdge;
|
|
8791
9012
|
|
|
@@ -8820,26 +9041,15 @@ export declare type TLShapeErrorFallbackComponent = ComponentType<{
|
|
|
8820
9041
|
}>;
|
|
8821
9042
|
|
|
8822
9043
|
/** @public */
|
|
8823
|
-
export declare
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
opacity?: number;
|
|
8833
|
-
className?: string;
|
|
8834
|
-
hidden?: boolean;
|
|
8835
|
-
}
|
|
8836
|
-
|
|
8837
|
-
/** @public */
|
|
8838
|
-
export declare interface TLShapeIndicatorsProps {
|
|
8839
|
-
/** Whether to hide all of the indicators */
|
|
8840
|
-
hideAll?: boolean;
|
|
8841
|
-
/** Whether to show all of the indicators */
|
|
8842
|
-
showAll?: boolean;
|
|
9044
|
+
export declare interface TLShapeIndicatorOverlay extends TLOverlay {
|
|
9045
|
+
props: {
|
|
9046
|
+
collaboratorIndicators: Array<{
|
|
9047
|
+
color: string;
|
|
9048
|
+
shapeIds: TLShapeId[];
|
|
9049
|
+
}>;
|
|
9050
|
+
hintingShapeIds: TLShapeId[];
|
|
9051
|
+
idsToDisplay: TLShapeId[];
|
|
9052
|
+
};
|
|
8843
9053
|
}
|
|
8844
9054
|
|
|
8845
9055
|
/**
|
|
@@ -8927,13 +9137,6 @@ export declare interface TLShapeWrapperProps extends React.HTMLAttributes<HTMLDi
|
|
|
8927
9137
|
children: ReactNode;
|
|
8928
9138
|
}
|
|
8929
9139
|
|
|
8930
|
-
/** @public */
|
|
8931
|
-
export declare interface TLSnapIndicatorProps {
|
|
8932
|
-
className?: string;
|
|
8933
|
-
line: SnapIndicator;
|
|
8934
|
-
zoom: number;
|
|
8935
|
-
}
|
|
8936
|
-
|
|
8937
9140
|
/** @public */
|
|
8938
9141
|
export declare interface TLStateNodeConstructor {
|
|
8939
9142
|
new (editor: Editor, parent?: StateNode): StateNode;
|
|
@@ -9322,6 +9525,10 @@ export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement
|
|
|
9322
9525
|
export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
|
|
9323
9526
|
|
|
9324
9527
|
/**
|
|
9528
|
+
* Reactive list of peer user IDs for collaborators currently shown in the UI.
|
|
9529
|
+
* Mirrors {@link Editor.getVisibleCollaborators} — peers fade out as they
|
|
9530
|
+
* transition to idle/inactive, without requiring a manual re-render.
|
|
9531
|
+
*
|
|
9325
9532
|
* @returns The list of peer UserIDs
|
|
9326
9533
|
* @public
|
|
9327
9534
|
*/
|