@ibodr/editor 0.2.6 → 0.2.9
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/index.d.ts +923 -463
- package/dist/index.mjs +3547 -2468
- package/dist/index.mjs.map +1 -1
- package/editor.css +88 -9
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ import { Signal, Computed, Atom } from '@ibodr/state';
|
|
|
3
3
|
export * from '@ibodr/state';
|
|
4
4
|
export * from '@ibodr/state-react';
|
|
5
5
|
import * as _ibodr_store from '@ibodr/store';
|
|
6
|
-
import { LegacyMigrations, MigrationSequence, UnknownRecord, SerializedSchema, RecordsDiff, Store,
|
|
6
|
+
import { LegacyMigrations, MigrationSequence, UnknownRecord, SerializedSchema, RecordsDiff, Store, HistoryEntry, AtomSet, StoreSideEffects, SerializedStore, StoreSchema } from '@ibodr/store';
|
|
7
7
|
export * from '@ibodr/store';
|
|
8
8
|
import * as _ibodr_schema from '@ibodr/schema';
|
|
9
|
-
import { DrAsset, RecordProps, DrPropsMigrations, DrUnknownAsset, DrAssetId, DrBinding, DrUnknownBinding, DrShape,
|
|
9
|
+
import { VecModel, DrAsset, RecordProps, DrPropsMigrations, DrUnknownAsset, DrAssetId, DrBinding, DrUnknownBinding, DrShape, BoxModel, DrHandle, DrShapeId, DrCursorType, DrUnknownShape, DrShapePartial, DrFontFace, DrShapeCrop, DrParentId, DrGroupShape, DrPageId, DrBoardBackgroundType, DrStore, DrStoreSnapshot, DrUser, DrRichText, StyleProp, DrInstancePresence, DrRecord, DrScribble, DrDefaultHorizontalAlignStyle, DrUserId, DrThemes, DrThemeId, DrTheme, DrInstancePageState, DrInstance, DrDocument, DrCursor, DrCamera, DrPage, DrImageAsset, DrVideoAsset, DrAssetPartial, DrBindingId, DrBindingCreate, DrBindingUpdate, DrCreateShapePartial, StylePropValue, DrAssetStore, DrUserStore, DrStoreProps, CustomRecordInfo, DrThemeColors, DrDefaultColorStyle, DrDefaultColor, ExtractShapeByProps, DrDefaultDashStyle, DrBaseShape, DrStoreSchema } from '@ibodr/schema';
|
|
10
10
|
export * from '@ibodr/schema';
|
|
11
11
|
import { IndexKey, Awaitable, PerformanceTracker, JsonObject, Timers } from '@ibodr/utils';
|
|
12
12
|
export * from '@ibodr/utils';
|
|
@@ -20,6 +20,36 @@ import { Editor as Editor$1 } from '@tiptap/core';
|
|
|
20
20
|
import { Node as Node$1 } from '@tiptap/pm/model';
|
|
21
21
|
import { EditorProviderProps as EditorProviderProps$1 } from '@tiptap/react';
|
|
22
22
|
|
|
23
|
+
/** @public */
|
|
24
|
+
interface DrCollaboratorCursorLayout {
|
|
25
|
+
/** Offset of the name/chat badge from the cursor anchor (px, before zoom scale). */
|
|
26
|
+
badgeOffset: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
};
|
|
30
|
+
/** Offset of the pointer icon from the cursor anchor (px, before zoom scale). */
|
|
31
|
+
iconOffset: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** @public */
|
|
38
|
+
interface DrCollaboratorCursorProps {
|
|
39
|
+
/** Screen position relative to the editor container. */
|
|
40
|
+
point: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
color: string;
|
|
45
|
+
name?: string | null;
|
|
46
|
+
chatMessage?: string;
|
|
47
|
+
/** Scale relative to camera zoom (1 = base size at 100% zoom). */
|
|
48
|
+
scale: number;
|
|
49
|
+
/** Layout offsets for the pointer icon and name badge. */
|
|
50
|
+
layout?: DrCollaboratorCursorLayout;
|
|
51
|
+
}
|
|
52
|
+
|
|
23
53
|
/** @public */
|
|
24
54
|
interface DrBackgroundProps {
|
|
25
55
|
x: number;
|
|
@@ -36,6 +66,25 @@ interface DrCanvasComponentProps {
|
|
|
36
66
|
/** @public @react */
|
|
37
67
|
declare function DefaultCanvas({ className }: DrCanvasComponentProps): react_jsx_runtime.JSX.Element;
|
|
38
68
|
|
|
69
|
+
/** @public */
|
|
70
|
+
interface DrCursorProps {
|
|
71
|
+
userId: string;
|
|
72
|
+
className?: string;
|
|
73
|
+
point: VecModel | null;
|
|
74
|
+
zoom: number;
|
|
75
|
+
color?: string;
|
|
76
|
+
name: string | null;
|
|
77
|
+
chatMessage: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The default collaborator cursor: the arrow glyph plus a name tag or chat bubble. The arrow is a
|
|
81
|
+
* `<use>` of a shared `<defs>` symbol that `LiveCollaborators` renders, so a `DefaultCursor`
|
|
82
|
+
* used outside that layer draws no arrow.
|
|
83
|
+
*
|
|
84
|
+
* @public @react
|
|
85
|
+
*/
|
|
86
|
+
declare const DefaultCursor: React$1.NamedExoticComponent<DrCursorProps>;
|
|
87
|
+
|
|
39
88
|
/**
|
|
40
89
|
* A user of tldraw
|
|
41
90
|
*
|
|
@@ -1149,7 +1198,7 @@ type DrPointerEventTarget = {
|
|
|
1149
1198
|
/** @public */
|
|
1150
1199
|
type DrPointerEventName = 'pointer_down' | 'pointer_move' | 'long_press' | 'pointer_up' | 'right_click' | 'middle_click';
|
|
1151
1200
|
/** @public */
|
|
1152
|
-
type DrCLickEventName = 'double_click'
|
|
1201
|
+
type DrCLickEventName = 'double_click';
|
|
1153
1202
|
/** @public */
|
|
1154
1203
|
type DrPinchEventName = 'pinch_start' | 'pinch' | 'pinch_end';
|
|
1155
1204
|
/** @public */
|
|
@@ -1173,6 +1222,13 @@ type DrPointerEventInfo = DrBaseEventInfo & {
|
|
|
1173
1222
|
pointerId: number;
|
|
1174
1223
|
button: number;
|
|
1175
1224
|
isPen: boolean;
|
|
1225
|
+
/**
|
|
1226
|
+
* Whether this pen event appears to be direct manipulation on the display (e.g. Apple Pencil on
|
|
1227
|
+
* an iPad or a Surface Pen on a touchscreen) rather than indirect input from a desktop graphics
|
|
1228
|
+
* tablet (e.g. a Wacom Intuos). Only direct-display pens should auto-enable pen mode. Drawing and
|
|
1229
|
+
* pressure behavior is driven by `isPen` and applies to all pens regardless of this flag.
|
|
1230
|
+
*/
|
|
1231
|
+
isPenDirect?: boolean;
|
|
1176
1232
|
} & DrPointerEventTarget;
|
|
1177
1233
|
/** @public */
|
|
1178
1234
|
type DrClickEventInfo = DrBaseEventInfo & {
|
|
@@ -1181,7 +1237,7 @@ type DrClickEventInfo = DrBaseEventInfo & {
|
|
|
1181
1237
|
point: VecLike;
|
|
1182
1238
|
pointerId: number;
|
|
1183
1239
|
button: number;
|
|
1184
|
-
phase: 'down' | 'up' | 'settle';
|
|
1240
|
+
phase: 'down' | 'up' | 'settle-down' | 'settle-up';
|
|
1185
1241
|
} & DrPointerEventTarget;
|
|
1186
1242
|
/** @public */
|
|
1187
1243
|
type DrKeyboardEventInfo = DrBaseEventInfo & {
|
|
@@ -1258,8 +1314,6 @@ interface DrEventHandlers {
|
|
|
1258
1314
|
onLongPress: DrPointerEvent;
|
|
1259
1315
|
onRightClick: DrPointerEvent;
|
|
1260
1316
|
onDoubleClick: DrClickEvent;
|
|
1261
|
-
onTripleClick: DrClickEvent;
|
|
1262
|
-
onQuadrupleClick: DrClickEvent;
|
|
1263
1317
|
onMiddleClick: DrPointerEvent;
|
|
1264
1318
|
onPointerUp: DrPointerEvent;
|
|
1265
1319
|
onKeyDown: DrKeyboardEvent;
|
|
@@ -1628,6 +1682,16 @@ declare abstract class ShapeUtil<Shape extends DrShape = DrShape> {
|
|
|
1628
1682
|
* @param shape - The shape.
|
|
1629
1683
|
*/
|
|
1630
1684
|
canCull(shape: Shape): boolean;
|
|
1685
|
+
/**
|
|
1686
|
+
* Cheap canvas stand-in used when this shape is zoomed out or far outside the viewport.
|
|
1687
|
+
* Return null to keep the regular DOM node (media, in-progress strokes, anything stateful).
|
|
1688
|
+
* Selected and edited shapes always stay in the DOM.
|
|
1689
|
+
*
|
|
1690
|
+
* Coordinates consumed by the canvas are the shape's local geometry.
|
|
1691
|
+
*
|
|
1692
|
+
* @param shape - The shape.
|
|
1693
|
+
*/
|
|
1694
|
+
getLodStyle(_shape: Shape): DrLodStyle | null;
|
|
1631
1695
|
/**
|
|
1632
1696
|
* Does this shape provide a background for its children? If this is true,
|
|
1633
1697
|
* then any children with a `renderBackground` method will have their
|
|
@@ -1859,6 +1923,29 @@ declare abstract class ShapeUtil<Shape extends DrShape = DrShape> {
|
|
|
1859
1923
|
* @public
|
|
1860
1924
|
*/
|
|
1861
1925
|
onBeforeCreate?(next: Shape): Shape | void;
|
|
1926
|
+
/**
|
|
1927
|
+
* A callback called when a shape is reproduced from an existing shape, either by duplicating
|
|
1928
|
+
* ({@link Editor.duplicateShapes}) or by pasting/putting content onto the page
|
|
1929
|
+
* ({@link Editor.putContentOntoCurrentPage}). This provides a last chance to modify the copy
|
|
1930
|
+
* before it's created — for example, to re-stamp attribution so the copy is credited to the
|
|
1931
|
+
* current user rather than the original author. It is not called when content is put with
|
|
1932
|
+
* `preserveIds` (e.g. {@link Editor.moveShapesToPage}), since the shape keeps its identity
|
|
1933
|
+
* and no copy is made.
|
|
1934
|
+
*
|
|
1935
|
+
* @example
|
|
1936
|
+
*
|
|
1937
|
+
* ```ts
|
|
1938
|
+
* onBeforeDuplicate = (source, duplicate) => {
|
|
1939
|
+
* return { ...duplicate, props: { ...duplicate.props, editedBy: this.editor.getAttributionUserId() } }
|
|
1940
|
+
* }
|
|
1941
|
+
* ```
|
|
1942
|
+
*
|
|
1943
|
+
* @param source - The shape being copied from.
|
|
1944
|
+
* @param duplicate - The new copy (with its own id), before it's created.
|
|
1945
|
+
* @returns The next shape or void.
|
|
1946
|
+
* @public
|
|
1947
|
+
*/
|
|
1948
|
+
onBeforeDuplicate?(source: Shape, duplicate: Shape): Shape | void;
|
|
1862
1949
|
/**
|
|
1863
1950
|
* A callback called just before a shape is updated. This method provides a last chance to modify
|
|
1864
1951
|
* the updated shape.
|
|
@@ -2136,6 +2223,45 @@ declare abstract class ShapeUtil<Shape extends DrShape = DrShape> {
|
|
|
2136
2223
|
* @public
|
|
2137
2224
|
*/
|
|
2138
2225
|
onEditEnd?(shape: Shape): void;
|
|
2226
|
+
/**
|
|
2227
|
+
* Provide an app-owned element to be rendered inside the shape, alongside the output of
|
|
2228
|
+
* {@link ShapeUtil.component}. While the shape remains mounted, tldraw guarantees the
|
|
2229
|
+
* element keeps the same DOM position: it is never unmounted, recreated, or relocated by
|
|
2230
|
+
* reordering, reparenting, culling, or re-renders. When adopting the element, tldraw uses
|
|
2231
|
+
* `Node.moveBefore` where available so stateful content like cross-origin iframes keeps
|
|
2232
|
+
* its state across the move, falling back to `appendChild` elsewhere.
|
|
2233
|
+
*
|
|
2234
|
+
* Pair this with {@link ShapeUtil.onReleaseAppOwnedElement} to reclaim the element before
|
|
2235
|
+
* the shape or editor unmounts.
|
|
2236
|
+
*
|
|
2237
|
+
* This is called once per shape mount, not on every prop change, so the adopted element is
|
|
2238
|
+
* not refreshed when the shape's props change. If the element's content depends on props,
|
|
2239
|
+
* return a stable element and mutate it in place (for example from {@link ShapeUtil.component}
|
|
2240
|
+
* or an effect) rather than returning a different element.
|
|
2241
|
+
*
|
|
2242
|
+
* @param shape - The shape.
|
|
2243
|
+
* @returns The element to adopt, or null to render nothing.
|
|
2244
|
+
* @public
|
|
2245
|
+
*/
|
|
2246
|
+
getAppOwnedElement?(shape: Shape): HTMLElement | null;
|
|
2247
|
+
/**
|
|
2248
|
+
* A callback called before the shape's app-owned element slot is destroyed: when the shape
|
|
2249
|
+
* unmounts (for example when it is deleted or the current page changes) or when the whole
|
|
2250
|
+
* editor unmounts, including error teardown. The slot is still connected to the document
|
|
2251
|
+
* when this is called, so the app can move the element to another connected parent with
|
|
2252
|
+
* `Node.moveBefore` to preserve its state. An element left in the slot is destroyed along
|
|
2253
|
+
* with it.
|
|
2254
|
+
*
|
|
2255
|
+
* This is not only a "shape deleted" signal: it also fires on page changes, editor unmount,
|
|
2256
|
+
* and (in dev under React StrictMode) on the throwaway mount/unmount cycle while the shape
|
|
2257
|
+
* still exists. Make it safe to call when the shape is still present, and check the store
|
|
2258
|
+
* (`this.editor.getShape(shape.id)`) if you need to distinguish deletion from a remount.
|
|
2259
|
+
*
|
|
2260
|
+
* @param shape - The shape.
|
|
2261
|
+
* @param element - The element returned by {@link ShapeUtil.getAppOwnedElement}.
|
|
2262
|
+
* @public
|
|
2263
|
+
*/
|
|
2264
|
+
onReleaseAppOwnedElement?(shape: Shape, element: HTMLElement): void;
|
|
2139
2265
|
}
|
|
2140
2266
|
/**
|
|
2141
2267
|
* Info about a crop.
|
|
@@ -2144,6 +2270,26 @@ declare abstract class ShapeUtil<Shape extends DrShape = DrShape> {
|
|
|
2144
2270
|
* @param initialShape - The shape at the start of the resize.
|
|
2145
2271
|
* @public
|
|
2146
2272
|
*/
|
|
2273
|
+
/**
|
|
2274
|
+
* How to paint a shape into the shared low-detail canvas.
|
|
2275
|
+
* `fill` with no `stroke` paints the geometry bounds.
|
|
2276
|
+
* `stroke` paints a decimated polyline of the geometry vertices.
|
|
2277
|
+
*
|
|
2278
|
+
* @public
|
|
2279
|
+
*/
|
|
2280
|
+
interface DrLodStyle {
|
|
2281
|
+
fill: string | null;
|
|
2282
|
+
stroke: string | null;
|
|
2283
|
+
strokeWidth: number;
|
|
2284
|
+
/** Multiplied by the shape's own opacity. Defaults to 1. */
|
|
2285
|
+
opacity?: number;
|
|
2286
|
+
/**
|
|
2287
|
+
* Unmount the shape when it is far outside the viewport, but keep the real DOM
|
|
2288
|
+
* whenever it is on screen. Used for images so a pan back does not replace the
|
|
2289
|
+
* picture with a flat stand-in.
|
|
2290
|
+
*/
|
|
2291
|
+
unmountWhenCulled?: boolean;
|
|
2292
|
+
}
|
|
2147
2293
|
interface DrCropInfo<T extends DrShape> {
|
|
2148
2294
|
handle: SelectionHandle;
|
|
2149
2295
|
change: Vec;
|
|
@@ -2154,6 +2300,7 @@ interface DrCropInfo<T extends DrShape> {
|
|
|
2154
2300
|
};
|
|
2155
2301
|
initialShape: T;
|
|
2156
2302
|
aspectRatioLocked?: boolean;
|
|
2303
|
+
isResizingFromCenter?: boolean;
|
|
2157
2304
|
}
|
|
2158
2305
|
/** @public */
|
|
2159
2306
|
interface DrDragShapesInInfo {
|
|
@@ -2380,6 +2527,11 @@ interface DrDrawLegacyExternalContentSource {
|
|
|
2380
2527
|
type DrExternalContentSource = DrDrawExternalContentSource | DrDrawLegacyExternalContentSource | DrExcalidrawExternalContentSource | DrMiroExternalContentSource | DrTextExternalContentSource | DrErrorExternalContentSource;
|
|
2381
2528
|
/** @public */
|
|
2382
2529
|
interface DrBaseExternalContent {
|
|
2530
|
+
/**
|
|
2531
|
+
* The other content sources found on the clipboard alongside this content. For example, when
|
|
2532
|
+
* pasting an image copied together with HTML and plain text, the `files` content will have
|
|
2533
|
+
* text sources for the HTML and plain text parts.
|
|
2534
|
+
*/
|
|
2383
2535
|
sources?: DrExternalContentSource[];
|
|
2384
2536
|
point?: VecLike;
|
|
2385
2537
|
}
|
|
@@ -2407,6 +2559,11 @@ interface DrFileReplaceExternalContent extends DrBaseExternalContent {
|
|
|
2407
2559
|
interface DrUrlExternalContent extends DrBaseExternalContent {
|
|
2408
2560
|
type: 'url';
|
|
2409
2561
|
url: string;
|
|
2562
|
+
/**
|
|
2563
|
+
* A shape to set the url on, instead of creating a bookmark or an embed. The shape must have a
|
|
2564
|
+
* `url` prop; the clipboard sets this when a link is pasted with one such shape selected.
|
|
2565
|
+
*/
|
|
2566
|
+
shapeId?: DrShapeId;
|
|
2410
2567
|
}
|
|
2411
2568
|
/** @public */
|
|
2412
2569
|
interface DrSvgTextExternalContent extends DrBaseExternalContent {
|
|
@@ -2839,6 +2996,7 @@ interface DrawOptions {
|
|
|
2839
2996
|
readonly collaboratorCheckIntervalMs: number;
|
|
2840
2997
|
readonly cameraMovingTimeoutMs: number;
|
|
2841
2998
|
readonly hitTestMargin: number;
|
|
2999
|
+
readonly coarseHitTestMargin: number;
|
|
2842
3000
|
readonly edgeScrollDelay: number;
|
|
2843
3001
|
readonly edgeScrollEaseDuration: number;
|
|
2844
3002
|
readonly edgeScrollSpeed: number;
|
|
@@ -2904,6 +3062,12 @@ interface DrawOptions {
|
|
|
2904
3062
|
* Defaults to 500 shapes.
|
|
2905
3063
|
*/
|
|
2906
3064
|
readonly debouncedZoomThreshold: number;
|
|
3065
|
+
/**
|
|
3066
|
+
* Zoom level below which shapes that implement {@link ShapeUtil.getLodStyle} are painted into
|
|
3067
|
+
* one canvas instead of a DOM node each. Shapes whose on-screen size is still large stay in
|
|
3068
|
+
* the DOM. Defaults to 0.6.
|
|
3069
|
+
*/
|
|
3070
|
+
readonly lodZoom: number;
|
|
2907
3071
|
/**
|
|
2908
3072
|
* Whether to allow spacebar panning. When true, the spacebar will pan the camera when held down.
|
|
2909
3073
|
* When false, the spacebar will not pan the camera.
|
|
@@ -3076,7 +3240,8 @@ declare const defaultDrawOptions: {
|
|
|
3076
3240
|
readonly collaboratorIdleTimeoutMs: 3000;
|
|
3077
3241
|
readonly collaboratorCheckIntervalMs: 1200;
|
|
3078
3242
|
readonly cameraMovingTimeoutMs: 64;
|
|
3079
|
-
readonly hitTestMargin:
|
|
3243
|
+
readonly hitTestMargin: 3;
|
|
3244
|
+
readonly coarseHitTestMargin: 4;
|
|
3080
3245
|
readonly edgeScrollDelay: 200;
|
|
3081
3246
|
readonly edgeScrollEaseDuration: 200;
|
|
3082
3247
|
readonly edgeScrollSpeed: 25;
|
|
@@ -3102,6 +3267,7 @@ declare const defaultDrawOptions: {
|
|
|
3102
3267
|
readonly nonce: undefined;
|
|
3103
3268
|
readonly debouncedZoom: true;
|
|
3104
3269
|
readonly debouncedZoomThreshold: 500;
|
|
3270
|
+
readonly lodZoom: 0.6;
|
|
3105
3271
|
readonly spacebarPanning: true;
|
|
3106
3272
|
readonly rightClickPanning: true;
|
|
3107
3273
|
readonly zoomToFitPadding: 128;
|
|
@@ -3159,7 +3325,7 @@ declare class SharedStyleMap extends ReadonlySharedStyleMap {
|
|
|
3159
3325
|
}
|
|
3160
3326
|
|
|
3161
3327
|
/** @public */
|
|
3162
|
-
type DrClickState = 'idle' | 'pendingDouble' | '
|
|
3328
|
+
type DrClickState = 'idle' | 'pendingDouble' | 'pendingOverflow' | 'overflow';
|
|
3163
3329
|
/** @public */
|
|
3164
3330
|
declare class ClickManager {
|
|
3165
3331
|
editor: Editor;
|
|
@@ -3168,6 +3334,7 @@ declare class ClickManager {
|
|
|
3168
3334
|
private _clickTimeout?;
|
|
3169
3335
|
private _clickScreenPoint?;
|
|
3170
3336
|
private _previousScreenPoint?;
|
|
3337
|
+
private _isPressingWhilePending;
|
|
3171
3338
|
_getClickTimeout(state: DrClickState, id?: string): void;
|
|
3172
3339
|
/**
|
|
3173
3340
|
* The current click state.
|
|
@@ -3329,6 +3496,10 @@ declare class HistoryManager<R extends UnknownRecord> {
|
|
|
3329
3496
|
getNumUndos(): number;
|
|
3330
3497
|
getNumRedos(): number;
|
|
3331
3498
|
/** @internal */
|
|
3499
|
+
private _isReplaying;
|
|
3500
|
+
/** @internal */
|
|
3501
|
+
isReplaying(): boolean;
|
|
3502
|
+
/** @internal */
|
|
3332
3503
|
_isInBatch: boolean;
|
|
3333
3504
|
batch(fn: () => void, opts?: DrHistoryBatchOptions): this;
|
|
3334
3505
|
_undo({ pushToRedoStack, toMark }: {
|
|
@@ -3358,9 +3529,123 @@ declare class HistoryManager<R extends UnknownRecord> {
|
|
|
3358
3529
|
}
|
|
3359
3530
|
|
|
3360
3531
|
/** @public */
|
|
3361
|
-
|
|
3362
|
-
|
|
3532
|
+
interface DrEventMap {
|
|
3533
|
+
mount: [];
|
|
3534
|
+
unmount: [];
|
|
3535
|
+
'max-shapes': [{
|
|
3536
|
+
name: string;
|
|
3537
|
+
pageId: DrPageId;
|
|
3538
|
+
count: number;
|
|
3539
|
+
}];
|
|
3540
|
+
change: [HistoryEntry<DrRecord>];
|
|
3541
|
+
update: [];
|
|
3542
|
+
crash: [{
|
|
3543
|
+
error: unknown;
|
|
3544
|
+
}];
|
|
3545
|
+
'stop-camera-animation': [];
|
|
3546
|
+
'stop-following': [];
|
|
3547
|
+
'before-event': [DrEventInfo];
|
|
3548
|
+
event: [DrEventInfo];
|
|
3549
|
+
tick: [number];
|
|
3550
|
+
frame: [number];
|
|
3551
|
+
resize: [BoxModel];
|
|
3552
|
+
'select-all-text': [{
|
|
3553
|
+
shapeId: DrShapeId;
|
|
3554
|
+
}];
|
|
3555
|
+
'place-caret': [{
|
|
3556
|
+
shapeId: DrShapeId;
|
|
3557
|
+
point: {
|
|
3558
|
+
x: number;
|
|
3559
|
+
y: number;
|
|
3560
|
+
};
|
|
3561
|
+
}];
|
|
3562
|
+
'created-shapes': [DrRecord[]];
|
|
3563
|
+
'edited-shapes': [DrRecord[]];
|
|
3564
|
+
'deleted-shapes': [DrShapeId[]];
|
|
3565
|
+
/**
|
|
3566
|
+
* Fired after a successful Miro clipboard paste (`miro-data-v1`).
|
|
3567
|
+
* Payload is produced by `@ibodr/draw` putMiroContent.
|
|
3568
|
+
*/
|
|
3569
|
+
'paste-miro': [
|
|
3570
|
+
{
|
|
3571
|
+
shapeCount: number;
|
|
3572
|
+
shapeIds: DrShapeId[];
|
|
3573
|
+
widgetTypes: string[];
|
|
3574
|
+
miroBoardId: string | null;
|
|
3575
|
+
miroHost: string | null;
|
|
3576
|
+
}
|
|
3577
|
+
];
|
|
3578
|
+
edit: [];
|
|
3579
|
+
dispose: [];
|
|
3580
|
+
}
|
|
3581
|
+
/** @public */
|
|
3582
|
+
type DrEventMapHandler<T extends keyof DrEventMap> = (...args: DrEventMap[T]) => void;
|
|
3583
|
+
|
|
3584
|
+
/**
|
|
3585
|
+
* Base class for editor-attached managers that need to clean up after themselves.
|
|
3586
|
+
*
|
|
3587
|
+
* Extending `EditorManager` gives a manager one consistent teardown contract: register
|
|
3588
|
+
* anything that needs undoing, and it runs automatically on `dispose()`. This keeps
|
|
3589
|
+
* subscription lifecycle symmetric — whatever sets a thing up is what tears it down — so
|
|
3590
|
+
* it can't be forgotten (the failure mode behind the strict-mode camera bug, #8892).
|
|
3591
|
+
*
|
|
3592
|
+
* Register cleanup by what you're creating:
|
|
3593
|
+
*
|
|
3594
|
+
* - Editor bus event (`tick`, `frame`, `change`, …): {@link EditorManager.addEditorEvent}
|
|
3595
|
+
* - Store side effect (`editor.sideEffects.register…`): `this.register(disposer)`
|
|
3596
|
+
* - Reaction (`react(...)` from `@ibodr/state`): `this.register(react(...))`
|
|
3597
|
+
* - DOM listener: `this.register(() => el.removeEventListener(...))`
|
|
3598
|
+
* - Other resource (cache, index, child manager): `this.register(() => x.dispose())`
|
|
3599
|
+
* - Resource held only part of the time (a listener attached while subscribers exist):
|
|
3600
|
+
* `this.register(...)` on attach and `this.unregister(...)` on detach, see `PerformanceManager`
|
|
3601
|
+
*
|
|
3602
|
+
* For timeouts, intervals, and animation frames prefer `editor.timers` (context-grouped
|
|
3603
|
+
* and auto-disposed) over raw `setTimeout`. For cleanup on the editor itself rather than a
|
|
3604
|
+
* manager, use `editor.disposables`.
|
|
3605
|
+
*
|
|
3606
|
+
* If a manager needs ordered teardown (e.g. pause a loop before cancelling it), override
|
|
3607
|
+
* `dispose()` and call `super.dispose()` last — see `TickManager`.
|
|
3608
|
+
*
|
|
3609
|
+
* @public
|
|
3610
|
+
*/
|
|
3611
|
+
declare abstract class EditorManager {
|
|
3612
|
+
protected readonly editor: Editor;
|
|
3613
|
+
protected readonly disposables: Set<() => void>;
|
|
3614
|
+
constructor(editor: Editor);
|
|
3615
|
+
/**
|
|
3616
|
+
* Register a teardown function to run on `dispose()`. The universal way for a manager to
|
|
3617
|
+
* make a resource "see itself out". Returns the same function for convenience.
|
|
3618
|
+
*/
|
|
3619
|
+
protected register(dispose: () => void): () => void;
|
|
3620
|
+
/**
|
|
3621
|
+
* Run a registered teardown now instead of at `dispose()`. A teardown that is no longer
|
|
3622
|
+
* registered (already run by `dispose()`, or never registered) is skipped, so nothing is
|
|
3623
|
+
* torn down twice.
|
|
3624
|
+
*/
|
|
3625
|
+
protected unregister(dispose: () => void): void;
|
|
3626
|
+
/**
|
|
3627
|
+
* Subscribe to an editor bus event and register the matching unsubscribe, so the listener
|
|
3628
|
+
* is removed automatically on `dispose()`. Returns that unsubscribe, for passing to
|
|
3629
|
+
* {@link EditorManager.unregister} to detach it before `dispose()`.
|
|
3630
|
+
*/
|
|
3631
|
+
protected addEditorEvent<E extends keyof DrEventMap>(event: E, fn: (...args: DrEventMap[E]) => void): () => void;
|
|
3632
|
+
/** @internal */
|
|
3633
|
+
dispose(): void;
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
/** @public */
|
|
3637
|
+
declare class InputsManager extends EditorManager {
|
|
3363
3638
|
constructor(editor: Editor);
|
|
3639
|
+
private _detachActivityListenersFn;
|
|
3640
|
+
/**
|
|
3641
|
+
* User input anywhere in the editor's tab counts as activity for collaborator presence —
|
|
3642
|
+
* presence means "this person is here", whether or not the input lands on the editor itself
|
|
3643
|
+
* (e.g. typing in a sidebar next to the canvas). Listen in the capture phase so input that
|
|
3644
|
+
* other handlers swallow still counts.
|
|
3645
|
+
*/
|
|
3646
|
+
private _attachActivityListeners;
|
|
3647
|
+
private _detachActivityListeners;
|
|
3648
|
+
private _onFrame;
|
|
3364
3649
|
private _originPagePoint;
|
|
3365
3650
|
/**
|
|
3366
3651
|
* The most recent pointer down's position in the current page space.
|
|
@@ -3425,8 +3710,7 @@ declare class InputsManager {
|
|
|
3425
3710
|
*/
|
|
3426
3711
|
get pointerVelocity(): Vec;
|
|
3427
3712
|
/**
|
|
3428
|
-
* Normally you shouldn't need to set the pointer velocity directly
|
|
3429
|
-
* However, this is currently used in tests to fake pointer velocity.
|
|
3713
|
+
* Normally you shouldn't need to set the pointer velocity directly. Used in tests to fake pointer velocity.
|
|
3430
3714
|
* @param pointerVelocity - The pointer velocity.
|
|
3431
3715
|
* @internal
|
|
3432
3716
|
*/
|
|
@@ -3617,6 +3901,26 @@ declare class InputsManager {
|
|
|
3617
3901
|
*/
|
|
3618
3902
|
setIsSpacebarPanning(isSpacebarPanning: boolean): void;
|
|
3619
3903
|
private _getHasCollaborators;
|
|
3904
|
+
private readonly _throttledActivityStamp;
|
|
3905
|
+
/**
|
|
3906
|
+
* Mark the current user as active for collaborator presence. User input anywhere in the
|
|
3907
|
+
* editor's tab counts as activity automatically; call this to make input that doesn't produce
|
|
3908
|
+
* DOM events count too, so peers don't classify this user as idle or inactive while they're
|
|
3909
|
+
* still interacting. Calls are throttled on the leading edge, so it's safe to call from
|
|
3910
|
+
* high-frequency input events.
|
|
3911
|
+
*
|
|
3912
|
+
* @example
|
|
3913
|
+
* ```ts
|
|
3914
|
+
* // Gamepads are polled rather than event-driven, so stamp activity from the poll
|
|
3915
|
+
* editor.timers.setInterval(() => {
|
|
3916
|
+
* const isPressed = navigator
|
|
3917
|
+
* .getGamepads()
|
|
3918
|
+
* .some((pad) => pad?.buttons.some((button) => button.pressed))
|
|
3919
|
+
* if (isPressed) editor.inputs.markActivity()
|
|
3920
|
+
* }, 50)
|
|
3921
|
+
* ```
|
|
3922
|
+
*/
|
|
3923
|
+
markActivity(): void;
|
|
3620
3924
|
/**
|
|
3621
3925
|
* The previous point used for velocity calculation (updated each tick, not each pointer event).
|
|
3622
3926
|
* @internal
|
|
@@ -3861,18 +4165,12 @@ interface DrPerfEventMap {
|
|
|
3861
4165
|
*
|
|
3862
4166
|
* @public
|
|
3863
4167
|
*/
|
|
3864
|
-
declare class PerformanceManager {
|
|
4168
|
+
declare class PerformanceManager extends EditorManager {
|
|
3865
4169
|
/** @internal */
|
|
3866
4170
|
readonly emitter: EventEmitter<DrPerfEventMap, any>;
|
|
3867
|
-
private editor;
|
|
3868
4171
|
private activeInteraction;
|
|
3869
4172
|
private activeCamera;
|
|
3870
|
-
private
|
|
3871
|
-
private shapeCreatedCleanup;
|
|
3872
|
-
private shapeEditedCleanup;
|
|
3873
|
-
private shapeDeletedCleanup;
|
|
3874
|
-
private loafObserver;
|
|
3875
|
-
constructor(editor: Editor);
|
|
4173
|
+
private readonly lazyCleanups;
|
|
3876
4174
|
/**
|
|
3877
4175
|
* Subscribe to a performance event. Returns an unsubscribe function.
|
|
3878
4176
|
*
|
|
@@ -3911,11 +4209,11 @@ declare class PerformanceManager {
|
|
|
3911
4209
|
private _onShapesEdited;
|
|
3912
4210
|
private _onShapesDeleted;
|
|
3913
4211
|
private _startLoafObserver;
|
|
3914
|
-
private _stopLoafObserver;
|
|
3915
4212
|
private _needsFrameListener;
|
|
3916
4213
|
private _needsLoafObserver;
|
|
3917
4214
|
private _maybeAttachLazyListeners;
|
|
3918
4215
|
private _maybeDetachLazyListeners;
|
|
4216
|
+
private _detachLazy;
|
|
3919
4217
|
}
|
|
3920
4218
|
|
|
3921
4219
|
/** @public */
|
|
@@ -4076,6 +4374,18 @@ declare class ScribbleManager {
|
|
|
4076
4374
|
private tickGroupedFade;
|
|
4077
4375
|
}
|
|
4078
4376
|
|
|
4377
|
+
/**
|
|
4378
|
+
* The whole-pixel line-height for a given font size and tldraw's unitless line-height
|
|
4379
|
+
* multiplier. tldraw's theme stores line-height as a multiplier (e.g. 1.35); resolving it
|
|
4380
|
+
* to a whole pixel keeps line spacing identical across rendering engines, which otherwise
|
|
4381
|
+
* disagree on fractional line boxes (WebKit snaps them to whole pixels, Blink keeps the
|
|
4382
|
+
* fraction) and let multi-line text drift apart. Apply it everywhere line-height is used —
|
|
4383
|
+
* measurement, on-canvas render, and export — so geometry and rendering agree.
|
|
4384
|
+
* See https://github.com/tldraw/tldraw/issues/8970.
|
|
4385
|
+
*
|
|
4386
|
+
* @public
|
|
4387
|
+
*/
|
|
4388
|
+
declare function resolveLineHeightPx(fontSize: number, lineHeight: number): number;
|
|
4079
4389
|
/** @public */
|
|
4080
4390
|
interface BatchMeasurementRequest {
|
|
4081
4391
|
html: string;
|
|
@@ -4121,8 +4431,7 @@ interface DrMeasureTextSpanOpts {
|
|
|
4121
4431
|
measureScrollWidth?: boolean;
|
|
4122
4432
|
}
|
|
4123
4433
|
/** @public */
|
|
4124
|
-
declare class TextManager {
|
|
4125
|
-
editor: Editor;
|
|
4434
|
+
declare class TextManager extends EditorManager {
|
|
4126
4435
|
private elm;
|
|
4127
4436
|
private poolElms;
|
|
4128
4437
|
constructor(editor: Editor);
|
|
@@ -4130,7 +4439,6 @@ declare class TextManager {
|
|
|
4130
4439
|
private resetElementStyles;
|
|
4131
4440
|
private setElementStyles;
|
|
4132
4441
|
private getMeasureStyles;
|
|
4133
|
-
dispose(): void;
|
|
4134
4442
|
private ensurePoolSize;
|
|
4135
4443
|
private getPoolItem;
|
|
4136
4444
|
measureHtmlBatch(requests: BatchMeasurementRequest[]): DrMeasuredTextSize[];
|
|
@@ -4168,6 +4476,7 @@ declare class UserPreferencesManager {
|
|
|
4168
4476
|
private readonly user;
|
|
4169
4477
|
private readonly colorScheme;
|
|
4170
4478
|
systemColorScheme: _ibodr_state.Atom<"light" | "dark", unknown>;
|
|
4479
|
+
private readonly systemPrefersReducedMotion;
|
|
4171
4480
|
disposables: Set<() => void>;
|
|
4172
4481
|
dispose(): void;
|
|
4173
4482
|
constructor(user: DrCurrentUser, colorScheme: 'light' | 'dark' | 'system' | 'inherit');
|
|
@@ -4195,7 +4504,25 @@ declare class UserPreferencesManager {
|
|
|
4195
4504
|
getEdgeScrollSpeed(): number;
|
|
4196
4505
|
getAnimationSpeed(): number;
|
|
4197
4506
|
getAreKeyboardShortcutsEnabled(): boolean;
|
|
4507
|
+
/**
|
|
4508
|
+
* The current user's raw, app-provided id — the value set in the user's
|
|
4509
|
+
* {@link @ibodr/editor#DrUserPreferences}. Use this when you need the id your application
|
|
4510
|
+
* assigned to the user. To compare against or look up store records, use
|
|
4511
|
+
* {@link UserPreferencesManager.getRecordId} instead.
|
|
4512
|
+
*/
|
|
4513
|
+
getExternalId(): string;
|
|
4514
|
+
/**
|
|
4515
|
+
* @deprecated Use {@link UserPreferencesManager.getExternalId} for the raw app-provided id, or
|
|
4516
|
+
* {@link UserPreferencesManager.getRecordId} for the prefixed `DrUserId` record id.
|
|
4517
|
+
*/
|
|
4198
4518
|
getId(): string;
|
|
4519
|
+
/**
|
|
4520
|
+
* The current user's id as a tldraw {@link @ibodr/schema#DrUserId} record id (prefixed
|
|
4521
|
+
* with `user:`). Use this when comparing against or looking up store records, such as a
|
|
4522
|
+
* presence record's `userId` or `followingUserId`. For the raw, app-provided id, use
|
|
4523
|
+
* {@link UserPreferencesManager.getExternalId}.
|
|
4524
|
+
*/
|
|
4525
|
+
getRecordId(): DrUserId;
|
|
4199
4526
|
getName(): string;
|
|
4200
4527
|
getLocale(): string;
|
|
4201
4528
|
getColor(): string;
|
|
@@ -4398,8 +4725,6 @@ declare abstract class StateNode implements Partial<DrEventHandlers> {
|
|
|
4398
4725
|
onLongPress?(info: DrPointerEventInfo): void;
|
|
4399
4726
|
onPointerUp?(info: DrPointerEventInfo): void;
|
|
4400
4727
|
onDoubleClick?(info: DrClickEventInfo): void;
|
|
4401
|
-
onTripleClick?(info: DrClickEventInfo): void;
|
|
4402
|
-
onQuadrupleClick?(info: DrClickEventInfo): void;
|
|
4403
4728
|
onRightClick?(info: DrPointerEventInfo): void;
|
|
4404
4729
|
onMiddleClick?(info: DrPointerEventInfo): void;
|
|
4405
4730
|
onKeyDown?(info: DrKeyboardEventInfo): void;
|
|
@@ -4413,58 +4738,6 @@ declare abstract class StateNode implements Partial<DrEventHandlers> {
|
|
|
4413
4738
|
onExit?(info: any, to: string): void;
|
|
4414
4739
|
}
|
|
4415
4740
|
|
|
4416
|
-
/** @public */
|
|
4417
|
-
interface DrEventMap {
|
|
4418
|
-
mount: [];
|
|
4419
|
-
'max-shapes': [{
|
|
4420
|
-
name: string;
|
|
4421
|
-
pageId: DrPageId;
|
|
4422
|
-
count: number;
|
|
4423
|
-
}];
|
|
4424
|
-
change: [HistoryEntry<DrRecord>];
|
|
4425
|
-
update: [];
|
|
4426
|
-
crash: [{
|
|
4427
|
-
error: unknown;
|
|
4428
|
-
}];
|
|
4429
|
-
'stop-camera-animation': [];
|
|
4430
|
-
'stop-following': [];
|
|
4431
|
-
'before-event': [DrEventInfo];
|
|
4432
|
-
event: [DrEventInfo];
|
|
4433
|
-
tick: [number];
|
|
4434
|
-
frame: [number];
|
|
4435
|
-
resize: [BoxModel];
|
|
4436
|
-
'select-all-text': [{
|
|
4437
|
-
shapeId: DrShapeId;
|
|
4438
|
-
}];
|
|
4439
|
-
'place-caret': [{
|
|
4440
|
-
shapeId: DrShapeId;
|
|
4441
|
-
point: {
|
|
4442
|
-
x: number;
|
|
4443
|
-
y: number;
|
|
4444
|
-
};
|
|
4445
|
-
}];
|
|
4446
|
-
'created-shapes': [DrRecord[]];
|
|
4447
|
-
'edited-shapes': [DrRecord[]];
|
|
4448
|
-
'deleted-shapes': [DrShapeId[]];
|
|
4449
|
-
/**
|
|
4450
|
-
* Fired after a successful Miro clipboard paste (`miro-data-v1`).
|
|
4451
|
-
* Payload is produced by `@ibodr/draw` putMiroContent.
|
|
4452
|
-
*/
|
|
4453
|
-
'paste-miro': [
|
|
4454
|
-
{
|
|
4455
|
-
shapeCount: number;
|
|
4456
|
-
shapeIds: DrShapeId[];
|
|
4457
|
-
widgetTypes: string[];
|
|
4458
|
-
miroBoardId: string | null;
|
|
4459
|
-
miroHost: string | null;
|
|
4460
|
-
}
|
|
4461
|
-
];
|
|
4462
|
-
edit: [];
|
|
4463
|
-
dispose: [];
|
|
4464
|
-
}
|
|
4465
|
-
/** @public */
|
|
4466
|
-
type DrEventMapHandler<T extends keyof DrEventMap> = (...args: DrEventMap[T]) => void;
|
|
4467
|
-
|
|
4468
4741
|
/** @public */
|
|
4469
4742
|
type DrResizeShapeOptions = Partial<{
|
|
4470
4743
|
initialBounds: Box;
|
|
@@ -4645,6 +4918,19 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
4645
4918
|
* @public
|
|
4646
4919
|
*/
|
|
4647
4920
|
isDisposed: boolean;
|
|
4921
|
+
private readonly _isMounted;
|
|
4922
|
+
/**
|
|
4923
|
+
* Whether the editor is currently mounted. This is `true` while the editor's component is
|
|
4924
|
+
* mounted in the DOM (after the `mount` event) and `false` before mount and after `unmount`.
|
|
4925
|
+
*
|
|
4926
|
+
* Unlike disposal, mounting is not terminal: the editor's component can unmount and remount
|
|
4927
|
+
* (for example when the canvas is replaced by an error fallback and restored) without the
|
|
4928
|
+
* editor itself being disposed. To react to the transitions, listen to the editor's `mount`
|
|
4929
|
+
* and `unmount` events.
|
|
4930
|
+
*
|
|
4931
|
+
* @public
|
|
4932
|
+
*/
|
|
4933
|
+
getIsMounted(): boolean;
|
|
4648
4934
|
/**
|
|
4649
4935
|
* A manager for the editor's tick events.
|
|
4650
4936
|
*
|
|
@@ -4684,6 +4970,9 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
4684
4970
|
setTimeout: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
|
|
4685
4971
|
setInterval: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
|
|
4686
4972
|
requestAnimationFrame: (callback: FrameRequestCallback) => number;
|
|
4973
|
+
clearTimeout: (id: number | undefined) => void;
|
|
4974
|
+
clearInterval: (id: number | undefined) => void;
|
|
4975
|
+
cancelAnimationFrame: (id: number | undefined) => void;
|
|
4687
4976
|
dispose: () => void;
|
|
4688
4977
|
};
|
|
4689
4978
|
/**
|
|
@@ -5036,6 +5325,12 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
5036
5325
|
* @internal this is only used to implement some backwards-compatibility logic. Should be fine to delete after 6 months or whatever.
|
|
5037
5326
|
*/
|
|
5038
5327
|
getMarkIdMatching(idSubstring: string): string | null;
|
|
5328
|
+
/**
|
|
5329
|
+
* Whether the editor is currently replaying history (i.e. an undo or redo is being applied).
|
|
5330
|
+
*
|
|
5331
|
+
* @internal
|
|
5332
|
+
*/
|
|
5333
|
+
isReplayingHistory(): boolean;
|
|
5039
5334
|
/**
|
|
5040
5335
|
* Coalesces all changes since the given mark into a single change, removing any intermediate marks.
|
|
5041
5336
|
*
|
|
@@ -5959,6 +6254,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
5959
6254
|
*
|
|
5960
6255
|
* @public */
|
|
5961
6256
|
getBaseZoom(): number;
|
|
6257
|
+
private _getFitZoom;
|
|
5962
6258
|
private _cameraOptions;
|
|
5963
6259
|
/**
|
|
5964
6260
|
* Get the current camera options.
|
|
@@ -6170,7 +6466,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
6170
6466
|
* @param opts - The camera move options.
|
|
6171
6467
|
* @public
|
|
6172
6468
|
*/
|
|
6173
|
-
zoomToUser(userId:
|
|
6469
|
+
zoomToUser(userId: DrUserId, opts?: DrCameraMoveOptions): this;
|
|
6174
6470
|
/** @internal */
|
|
6175
6471
|
private _willSetInitialBounds;
|
|
6176
6472
|
/**
|
|
@@ -6318,7 +6614,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
6318
6614
|
getAttributionUser(userId: string | null): DrUser | null;
|
|
6319
6615
|
/**
|
|
6320
6616
|
* Collect user IDs referenced by a set of shapes via shape-specific props
|
|
6321
|
-
* (e.g. `
|
|
6617
|
+
* (e.g. `textLastEditedBy` on notes).
|
|
6322
6618
|
*
|
|
6323
6619
|
* @internal
|
|
6324
6620
|
*/
|
|
@@ -6336,7 +6632,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
6336
6632
|
*
|
|
6337
6633
|
* @public
|
|
6338
6634
|
*/
|
|
6339
|
-
startFollowingUser(userId:
|
|
6635
|
+
startFollowingUser(userId: DrUserId): this;
|
|
6340
6636
|
/**
|
|
6341
6637
|
* Stop viewport-following a user.
|
|
6342
6638
|
*
|
|
@@ -6833,6 +7129,17 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
6833
7129
|
* @public
|
|
6834
7130
|
*/
|
|
6835
7131
|
getCurrentPageBounds(): Box | undefined;
|
|
7132
|
+
/**
|
|
7133
|
+
* Get the hit-test margin in page space—the distance in page units within which a pointer is
|
|
7134
|
+
* considered to be touching a shape. This resolves to {@link DrawOptions.hitTestMargin} (or
|
|
7135
|
+
* {@link DrawOptions.coarseHitTestMargin} when using a coarse pointer) divided by the current
|
|
7136
|
+
* zoom level, so it stays a constant distance in screen space.
|
|
7137
|
+
*
|
|
7138
|
+
* @returns The hit-test margin in page space.
|
|
7139
|
+
*
|
|
7140
|
+
* @public
|
|
7141
|
+
*/
|
|
7142
|
+
getHitTestMargin(): number;
|
|
6836
7143
|
/**
|
|
6837
7144
|
* Get the top-most selected shape at the given point, ignoring groups.
|
|
6838
7145
|
*
|
|
@@ -7201,6 +7508,15 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
7201
7508
|
deleteBindings(bindings: (DrBinding | DrBindingId)[], { isolateShapes }?: {
|
|
7202
7509
|
isolateShapes?: boolean | undefined;
|
|
7203
7510
|
}): this;
|
|
7511
|
+
/**
|
|
7512
|
+
* Unguarded so that withIsolatedShapes can transiently isolate shapes for copy and export in
|
|
7513
|
+
* readonly mode; the public deleteBindings is what readonly blocks.
|
|
7514
|
+
*
|
|
7515
|
+
* @internal
|
|
7516
|
+
*/
|
|
7517
|
+
_deleteBindings(bindings: (DrBinding | DrBindingId)[], { isolateShapes }?: {
|
|
7518
|
+
isolateShapes?: boolean | undefined;
|
|
7519
|
+
}): this;
|
|
7204
7520
|
/**
|
|
7205
7521
|
* Delete a binding by its ID. If the binding doesn't exist, it's ignored.
|
|
7206
7522
|
*/
|
|
@@ -7233,6 +7549,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
7233
7549
|
center?: VecLike;
|
|
7234
7550
|
}): this;
|
|
7235
7551
|
private getChangesToTranslateShape;
|
|
7552
|
+
private getChangesToTranslateShapeByPageDelta;
|
|
7236
7553
|
/**
|
|
7237
7554
|
* Move shapes by a delta.
|
|
7238
7555
|
*
|
|
@@ -7430,7 +7747,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
7430
7747
|
*
|
|
7431
7748
|
* @public
|
|
7432
7749
|
*/
|
|
7433
|
-
alignShapes(shapes: DrShapeId[] | DrShape[], operation: 'left' | 'center-horizontal' | 'right' | 'top' | 'center-vertical' | 'bottom'): this;
|
|
7750
|
+
alignShapes(shapes: DrShapeId[] | DrShape[], operation: 'left' | 'center-horizontal' | 'right' | 'top' | 'center-vertical' | 'bottom' | 'center'): this;
|
|
7434
7751
|
/**
|
|
7435
7752
|
* Distribute shape positions.
|
|
7436
7753
|
*
|
|
@@ -7487,10 +7804,22 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
7487
7804
|
* @public
|
|
7488
7805
|
*/
|
|
7489
7806
|
resizeShape(shape: DrShapeId | DrShape, scale: VecLike, opts?: DrResizeShapeOptions): this;
|
|
7490
|
-
/**
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7807
|
+
/**
|
|
7808
|
+
* Get the update for a resized shape without committing it to the store. Interactions that
|
|
7809
|
+
* resize many shapes at once use this to collect all of the updates and commit them in a
|
|
7810
|
+
* single batch. Returns null when there is nothing to update.
|
|
7811
|
+
*
|
|
7812
|
+
* Shapes that are rotated out of alignment with the scale axis cannot be resized with a
|
|
7813
|
+
* single update; those shapes are resized immediately (as `resizeShape` would do) and null
|
|
7814
|
+
* is returned.
|
|
7815
|
+
*
|
|
7816
|
+
* @internal
|
|
7817
|
+
*/
|
|
7818
|
+
getResizeShapePartial(shape: DrShapeId | DrShape, scale: VecLike, opts?: DrResizeShapeOptions): DrShapePartial | null;
|
|
7819
|
+
/** @internal */
|
|
7820
|
+
private _scalePagePoint;
|
|
7821
|
+
/** @internal */
|
|
7822
|
+
private _resizeUnalignedShape;
|
|
7494
7823
|
/**
|
|
7495
7824
|
* Get the initial meta value for a shape.
|
|
7496
7825
|
*
|
|
@@ -7684,11 +8013,12 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
7684
8013
|
deleteShape(id: DrShapeId): this;
|
|
7685
8014
|
deleteShape(shape: DrShape): this;
|
|
7686
8015
|
/**
|
|
7687
|
-
*
|
|
8016
|
+
* Groups have no styles of their own: a style read or write on a selection applies to the
|
|
8017
|
+
* non-group shapes beneath each group, however deeply nested. Returns those shapes.
|
|
7688
8018
|
*
|
|
7689
8019
|
* @internal
|
|
7690
8020
|
*/
|
|
7691
|
-
private
|
|
8021
|
+
private _getStyleableShapes;
|
|
7692
8022
|
/**
|
|
7693
8023
|
* A derived map containing all current styles among the user's selected shapes.
|
|
7694
8024
|
*
|
|
@@ -8242,26 +8572,65 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
8242
8572
|
private _prevCursor;
|
|
8243
8573
|
/** @internal */
|
|
8244
8574
|
private _shiftKeyTimeout;
|
|
8245
|
-
/**
|
|
8246
|
-
|
|
8575
|
+
/**
|
|
8576
|
+
* Release the shift modifier: clear its debounce timer id, drop the atom, and
|
|
8577
|
+
* dispatch a synthetic `key_up` so `inputs.keys` and tool `onKeyUp` handlers update.
|
|
8578
|
+
* Runs both as the 150ms debounce timer callback and when a pointer down flushes it.
|
|
8579
|
+
* @internal
|
|
8580
|
+
*/
|
|
8581
|
+
_releaseShiftKey(): void;
|
|
8247
8582
|
/** @internal */
|
|
8248
8583
|
private _altKeyTimeout;
|
|
8249
|
-
/**
|
|
8250
|
-
|
|
8584
|
+
/**
|
|
8585
|
+
* Release the alt modifier. See {@link Editor._releaseShiftKey}.
|
|
8586
|
+
* @internal
|
|
8587
|
+
*/
|
|
8588
|
+
_releaseAltKey(): void;
|
|
8251
8589
|
/** @internal */
|
|
8252
8590
|
private _ctrlKeyTimeout;
|
|
8253
|
-
/**
|
|
8254
|
-
|
|
8591
|
+
/**
|
|
8592
|
+
* Release the ctrl modifier. See {@link Editor._releaseShiftKey}.
|
|
8593
|
+
* @internal
|
|
8594
|
+
*/
|
|
8595
|
+
_releaseCtrlKey(): void;
|
|
8255
8596
|
/** @internal */
|
|
8256
8597
|
private _metaKeyTimeout;
|
|
8257
|
-
/**
|
|
8258
|
-
|
|
8598
|
+
/**
|
|
8599
|
+
* Release the meta modifier. See {@link Editor._releaseShiftKey}.
|
|
8600
|
+
* @internal
|
|
8601
|
+
*/
|
|
8602
|
+
_releaseMetaKey(): void;
|
|
8603
|
+
/**
|
|
8604
|
+
* Flush any modifier still sitting in its 150ms release-debounce window, so a new
|
|
8605
|
+
* interaction (a pointer down) starts with correct modifier state instead of a
|
|
8606
|
+
* just-released key still being counted as held. A pending timer is exactly
|
|
8607
|
+
* "released but still counted as held"; a genuinely-held modifier has no timer
|
|
8608
|
+
* (-1) and is left alone.
|
|
8609
|
+
*
|
|
8610
|
+
* Each modifier is released through the same path its timer would have taken
|
|
8611
|
+
* (`_releaseShiftKey` and friends), which dispatches the synthetic `key_up` so
|
|
8612
|
+
* stale codes (e.g. `ShiftLeft`) leave `inputs.keys` and tool `onKeyUp` handlers run.
|
|
8613
|
+
* We clear every pending modifier atom and timer *first*, then dispatch: a synthetic
|
|
8614
|
+
* `key_up` reports all currently-held modifiers, so releasing them one at a time
|
|
8615
|
+
* would make each event re-confirm the not-yet-released ones and cancel their flush.
|
|
8616
|
+
* @internal
|
|
8617
|
+
*/
|
|
8618
|
+
private _releaseDebouncedModifiers;
|
|
8259
8619
|
/** @internal */
|
|
8260
8620
|
private _restoreToolId;
|
|
8261
8621
|
/** @internal */
|
|
8262
8622
|
private _didPinch;
|
|
8263
8623
|
/** @internal */
|
|
8264
8624
|
private _selectedShapeIdsAtPointerDown;
|
|
8625
|
+
/**
|
|
8626
|
+
* Whether `_selectedShapeIdsAtPointerDown` holds a pre-gesture selection
|
|
8627
|
+
* captured by a `pointer_down` (the touch path) that a following pinch
|
|
8628
|
+
* should restore. False when no pointer_down preceded the pinch (the
|
|
8629
|
+
* Safari trackpad path uses gesture events), in which case `pinch_start`
|
|
8630
|
+
* captures the live selection instead.
|
|
8631
|
+
* @internal
|
|
8632
|
+
*/
|
|
8633
|
+
private _didCaptureSelectionAtPointerDown;
|
|
8265
8634
|
/** @internal */
|
|
8266
8635
|
private _longPressTimeout;
|
|
8267
8636
|
/** @internal */
|
|
@@ -8317,12 +8686,19 @@ declare class Editor extends EventEmitter<DrEventMap> {
|
|
|
8317
8686
|
}
|
|
8318
8687
|
|
|
8319
8688
|
/** @public */
|
|
8320
|
-
|
|
8689
|
+
interface DrErrorFallbackProps {
|
|
8690
|
+
/** The error that was caught. */
|
|
8321
8691
|
error: unknown;
|
|
8692
|
+
/**
|
|
8693
|
+
* Only set when the caller renders the fallback with an editor; the editor's own error
|
|
8694
|
+
* boundaries pass just `error`.
|
|
8695
|
+
*/
|
|
8322
8696
|
editor?: Editor;
|
|
8323
|
-
}
|
|
8697
|
+
}
|
|
8698
|
+
/** @public */
|
|
8699
|
+
type DrErrorFallbackComponent = ComponentType<DrErrorFallbackProps>;
|
|
8324
8700
|
/** @public @react */
|
|
8325
|
-
declare
|
|
8701
|
+
declare function DefaultErrorFallback({ error, editor }: DrErrorFallbackProps): react_jsx_runtime.JSX.Element;
|
|
8326
8702
|
|
|
8327
8703
|
/** @public */
|
|
8328
8704
|
interface DrGridProps {
|
|
@@ -8334,14 +8710,6 @@ interface DrGridProps {
|
|
|
8334
8710
|
/** @public @react */
|
|
8335
8711
|
declare function DefaultGrid({ x, y, z, size }: DrGridProps): react_jsx_runtime.JSX.Element;
|
|
8336
8712
|
|
|
8337
|
-
/** @public */
|
|
8338
|
-
interface DrSelectionBackgroundProps {
|
|
8339
|
-
bounds: Box;
|
|
8340
|
-
rotation: number;
|
|
8341
|
-
}
|
|
8342
|
-
/** @public @react */
|
|
8343
|
-
declare function DefaultSelectionBackground({ bounds, rotation }: DrSelectionBackgroundProps): react_jsx_runtime.JSX.Element;
|
|
8344
|
-
|
|
8345
8713
|
/** @public */
|
|
8346
8714
|
type DrShapeErrorFallbackComponent = ComponentType<{
|
|
8347
8715
|
error: any;
|
|
@@ -8359,11 +8727,67 @@ interface DrShapeWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
8359
8727
|
/** @public @react */
|
|
8360
8728
|
declare const DefaultShapeWrapper: React$1.ForwardRefExoticComponent<DrShapeWrapperProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
8361
8729
|
|
|
8730
|
+
/** @public */
|
|
8731
|
+
type DrSpinnerProps = React.SVGProps<SVGSVGElement>;
|
|
8362
8732
|
/** @public @react */
|
|
8363
|
-
declare function DefaultSpinner(props:
|
|
8733
|
+
declare function DefaultSpinner(props: DrSpinnerProps): react_jsx_runtime.JSX.Element;
|
|
8364
8734
|
|
|
8365
8735
|
/** @public @react */
|
|
8366
|
-
declare
|
|
8736
|
+
declare function DefaultSvgDefs(): null;
|
|
8737
|
+
|
|
8738
|
+
/**
|
|
8739
|
+
* The DOM node that {@link EditorPortal} renders into: an empty `display: contents` element the
|
|
8740
|
+
* editor renders last among its container's children, after the canvas and after the UI.
|
|
8741
|
+
*
|
|
8742
|
+
* Null until the container has mounted, so prefer {@link EditorPortal}, which handles that for you.
|
|
8743
|
+
*
|
|
8744
|
+
* @public
|
|
8745
|
+
*/
|
|
8746
|
+
declare function useEditorPortalHost(): HTMLElement | null;
|
|
8747
|
+
/** @public */
|
|
8748
|
+
interface EditorPortalProps {
|
|
8749
|
+
children: ReactNode;
|
|
8750
|
+
}
|
|
8751
|
+
/**
|
|
8752
|
+
* Renders its children into the end of the editor's container, escaping the canvas layer.
|
|
8753
|
+
*
|
|
8754
|
+
* Use this for anything anchored to canvas coordinates that also has to draw over the UI — a
|
|
8755
|
+
* popover on a shape, a comment thread, an annotation panel. The `OnTheCanvas` and
|
|
8756
|
+
* `InFrontOfTheCanvas` slots are fixed layers, each its own stacking context, so content mounted
|
|
8757
|
+
* there can't paint above whatever outranks its layer whatever z-index it asks for. Mount in
|
|
8758
|
+
* whichever slot suits your data flow, wrap the part that needs its own layer in this, and give
|
|
8759
|
+
* that part a z-index.
|
|
8760
|
+
*
|
|
8761
|
+
* This package's own layers stop at 250 (`--dr-layer-canvas-in-front`); above that belongs to
|
|
8762
|
+
* whatever renders the UI. In `tldraw` that's `--dr-layer-panels` (300) and `--dr-layer-menus`
|
|
8763
|
+
* (400), defined by `tldraw`'s stylesheet rather than this one.
|
|
8764
|
+
*
|
|
8765
|
+
* Positioning still resolves against the editor's container, so a `position: absolute` child uses
|
|
8766
|
+
* ordinary container coordinates.
|
|
8767
|
+
*
|
|
8768
|
+
* Prefer this over `createPortal(children, useContainer())`, which picks its DOM position from the
|
|
8769
|
+
* commit that mounts it — landing the node ahead of the UI and of the "skip to main content" link
|
|
8770
|
+
* that only works while nothing precedes it. This host is a real element placed last, so ordering
|
|
8771
|
+
* is fixed rather than dependent on mount timing.
|
|
8772
|
+
*
|
|
8773
|
+
* @example
|
|
8774
|
+
* ```tsx
|
|
8775
|
+
* // 400 clears tldraw's menus layer; the bare editor's own layers stop at 250.
|
|
8776
|
+
* function ShapeAnnotation({ point }: { point: VecLike }) {
|
|
8777
|
+
* return (
|
|
8778
|
+
* <EditorPortal>
|
|
8779
|
+
* <div style={{ position: 'absolute', left: point.x, top: point.y, zIndex: 400 }}>
|
|
8780
|
+
* Above the UI
|
|
8781
|
+
* </div>
|
|
8782
|
+
* </EditorPortal>
|
|
8783
|
+
* )
|
|
8784
|
+
* }
|
|
8785
|
+
* ```
|
|
8786
|
+
*
|
|
8787
|
+
* @public
|
|
8788
|
+
* @react
|
|
8789
|
+
*/
|
|
8790
|
+
declare function EditorPortal({ children }: EditorPortalProps): React$1.ReactPortal | null;
|
|
8367
8791
|
|
|
8368
8792
|
/** @public */
|
|
8369
8793
|
interface DrErrorBoundaryProps {
|
|
@@ -8480,20 +8904,50 @@ declare const DEFAULT_ANIMATION_OPTIONS: {
|
|
|
8480
8904
|
/** @public */
|
|
8481
8905
|
declare const SIDES: readonly ["top", "right", "bottom", "left"];
|
|
8482
8906
|
|
|
8907
|
+
/**
|
|
8908
|
+
* Optional adapter that pipes PerformanceManager events into browser
|
|
8909
|
+
* `performance.mark()` / `performance.measure()` for DevTools integration.
|
|
8910
|
+
*
|
|
8911
|
+
* Tree-shakeable — only included if imported.
|
|
8912
|
+
*
|
|
8913
|
+
* @example
|
|
8914
|
+
* ```ts
|
|
8915
|
+
* const adapter = new PerformanceApiAdapter(editor.performance)
|
|
8916
|
+
* // ... later
|
|
8917
|
+
* adapter.dispose()
|
|
8918
|
+
* ```
|
|
8919
|
+
*
|
|
8920
|
+
* @public
|
|
8921
|
+
*/
|
|
8922
|
+
declare class PerformanceApiAdapter {
|
|
8923
|
+
private cleanups;
|
|
8924
|
+
constructor(perfManager: PerformanceManager);
|
|
8925
|
+
/** Remove all listeners and stop piping events. @public */
|
|
8926
|
+
dispose(): void;
|
|
8927
|
+
}
|
|
8928
|
+
|
|
8483
8929
|
/**
|
|
8484
8930
|
* Manages spatial indexing for efficient shape location queries.
|
|
8485
8931
|
*
|
|
8486
8932
|
* Uses an R-tree (via RBush) to enable O(log n) spatial queries instead of O(n) iteration.
|
|
8487
|
-
*
|
|
8488
|
-
*
|
|
8933
|
+
* Derived-bounds changes (arrows following bound shapes, groups resizing with children) are
|
|
8934
|
+
* tracked structurally: each record diff is expanded into a dirty set covering the changed
|
|
8935
|
+
* shapes' descendants, ancestors, and binding partners, and only those shapes' bounds are
|
|
8936
|
+
* rechecked — O(affected) per update instead of O(page).
|
|
8489
8937
|
*
|
|
8490
8938
|
* Key features:
|
|
8491
|
-
* - Incremental updates using filterHistory pattern
|
|
8492
|
-
* -
|
|
8493
|
-
* - Works with any custom shape type with computed bounds
|
|
8939
|
+
* - Incremental updates using filterHistory pattern (shape and binding history)
|
|
8940
|
+
* - Dirty-set expansion via parent/child and binding relationships
|
|
8494
8941
|
* - Per-page index (rebuilds on page change)
|
|
8495
8942
|
* - Optimized for viewport culling queries
|
|
8496
8943
|
*
|
|
8944
|
+
* Known limitation: a custom shape whose geometry reads other shapes outside the
|
|
8945
|
+
* parent/child and binding relationships is not rechecked when those shapes change.
|
|
8946
|
+
* Core shapes only depend on other shapes via bindings (arrows) and parent/child
|
|
8947
|
+
* relationships (groups), which are both covered. This narrows the previous
|
|
8948
|
+
* approach, which rechecked every indexed shape on every update and so happened to
|
|
8949
|
+
* cover such shapes; the structural expansion trades that for O(affected) updates.
|
|
8950
|
+
*
|
|
8497
8951
|
* @internal
|
|
8498
8952
|
*/
|
|
8499
8953
|
declare class SpatialIndexManager {
|
|
@@ -8501,11 +8955,13 @@ declare class SpatialIndexManager {
|
|
|
8501
8955
|
private rbush;
|
|
8502
8956
|
private spatialIndexComputed;
|
|
8503
8957
|
private lastPageId;
|
|
8958
|
+
private _boundsEpoch;
|
|
8504
8959
|
constructor(editor: Editor);
|
|
8960
|
+
private rebuildAndBumpEpoch;
|
|
8505
8961
|
private createSpatialIndexComputed;
|
|
8506
8962
|
private buildFromScratch;
|
|
8507
8963
|
private processIncrementalUpdate;
|
|
8508
|
-
private
|
|
8964
|
+
private areBoundsEqualToSpatialElement;
|
|
8509
8965
|
/**
|
|
8510
8966
|
* Get shape IDs within the given bounds.
|
|
8511
8967
|
* Optimized for viewport culling queries.
|
|
@@ -8626,7 +9082,10 @@ declare class ThemeManager {
|
|
|
8626
9082
|
/** Get the id of the current theme. */
|
|
8627
9083
|
getCurrentThemeId(): DrThemeId;
|
|
8628
9084
|
getCurrentTheme(): DrTheme;
|
|
8629
|
-
/**
|
|
9085
|
+
/**
|
|
9086
|
+
* Set the current theme by id. The theme must have been previously registered; an
|
|
9087
|
+
* unregistered id is ignored and the current theme is kept.
|
|
9088
|
+
*/
|
|
8630
9089
|
setCurrentTheme(id: DrThemeId): void;
|
|
8631
9090
|
/** Replace all theme definitions, or update them via a callback that receives a deep copy. */
|
|
8632
9091
|
updateThemes(themes: DrThemes | ((themes: DrThemes) => DrThemes)): void;
|
|
@@ -8637,8 +9096,7 @@ declare class ThemeManager {
|
|
|
8637
9096
|
}
|
|
8638
9097
|
|
|
8639
9098
|
/** @internal */
|
|
8640
|
-
declare class TickManager {
|
|
8641
|
-
editor: Editor;
|
|
9099
|
+
declare class TickManager extends EditorManager {
|
|
8642
9100
|
constructor(editor: Editor);
|
|
8643
9101
|
cancelRaf?: null | (() => void);
|
|
8644
9102
|
isPaused: boolean;
|
|
@@ -8648,27 +9106,33 @@ declare class TickManager {
|
|
|
8648
9106
|
dispose(): void;
|
|
8649
9107
|
}
|
|
8650
9108
|
|
|
9109
|
+
/** @public */
|
|
9110
|
+
interface OverlayOptionsWithDisplayValues<Overlay extends DrOverlay, DisplayValues extends object> {
|
|
9111
|
+
getDefaultDisplayValues(editor: Editor, overlay: Overlay, theme: DrTheme, colorMode: 'light' | 'dark'): DisplayValues;
|
|
9112
|
+
getCustomDisplayValues(editor: Editor, overlay: Overlay, theme: DrTheme, colorMode: 'light' | 'dark'): Partial<DisplayValues>;
|
|
9113
|
+
}
|
|
8651
9114
|
/**
|
|
8652
|
-
*
|
|
8653
|
-
* `performance.mark()` / `performance.measure()` for DevTools integration.
|
|
9115
|
+
* Get the resolved display values for an overlay, merging the base values with any overrides.
|
|
8654
9116
|
*
|
|
8655
|
-
*
|
|
9117
|
+
* @public
|
|
9118
|
+
*/
|
|
9119
|
+
declare function getOverlayDisplayValues<Overlay extends DrOverlay, DisplayValues extends object>(util: {
|
|
9120
|
+
editor: Editor;
|
|
9121
|
+
options: OverlayOptionsWithDisplayValues<Overlay, DisplayValues>;
|
|
9122
|
+
}, overlay: Overlay, colorMode?: 'light' | 'dark'): DisplayValues;
|
|
9123
|
+
|
|
9124
|
+
/**
|
|
9125
|
+
* Combine every batchable shape indicator into a single page-space `Path2D` and
|
|
9126
|
+
* emit one stroke call. Shapes whose indicator needs an evenodd clip (e.g.
|
|
9127
|
+
* arrows with labels or complex arrowheads) can't be batched — they still
|
|
9128
|
+
* stroke individually inside a save/restore with `ctx.clip` applied.
|
|
8656
9129
|
*
|
|
8657
|
-
*
|
|
8658
|
-
*
|
|
8659
|
-
* const adapter = new PerformanceApiAdapter(editor.performance)
|
|
8660
|
-
* // ... later
|
|
8661
|
-
* adapter.dispose()
|
|
8662
|
-
* ```
|
|
9130
|
+
* Shared by any overlay util that paints shape indicators (e.g. collaborator
|
|
9131
|
+
* selections).
|
|
8663
9132
|
*
|
|
8664
9133
|
* @public
|
|
8665
9134
|
*/
|
|
8666
|
-
declare
|
|
8667
|
-
private cleanups;
|
|
8668
|
-
constructor(perfManager: PerformanceManager);
|
|
8669
|
-
/** Remove all listeners and stop piping events. @public */
|
|
8670
|
-
dispose(): void;
|
|
8671
|
-
}
|
|
9135
|
+
declare function strokeShapeIndicators(editor: Editor, ctx: CanvasRenderingContext2D, shapeIds: DrShapeId[]): void;
|
|
8672
9136
|
|
|
8673
9137
|
/** @public */
|
|
8674
9138
|
type DrBaseBoxShape = ExtractShapeByProps<{
|
|
@@ -8684,7 +9148,7 @@ declare abstract class BaseBoxShapeUtil<Shape extends DrBaseBoxShape> extends Sh
|
|
|
8684
9148
|
}
|
|
8685
9149
|
|
|
8686
9150
|
/**
|
|
8687
|
-
* A base class for frame-like shapes — containers that clip their children,
|
|
9151
|
+
* A base class for frame-like shapes — containers that clip their children except arrows,
|
|
8688
9152
|
* require full-brush selection, block erasure from inside, and support
|
|
8689
9153
|
* drag-and-drop reparenting.
|
|
8690
9154
|
*
|
|
@@ -8696,6 +9160,7 @@ declare abstract class BaseBoxShapeUtil<Shape extends DrBaseBoxShape> extends Sh
|
|
|
8696
9160
|
* - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
|
|
8697
9161
|
* - `canRemoveChildrenOfType()` returns `true` unless the container is locked
|
|
8698
9162
|
* - `getClipPath()` returns the shape geometry's vertices
|
|
9163
|
+
* - `shouldClipChild()` clips all children except arrows
|
|
8699
9164
|
* - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
|
|
8700
9165
|
* - `onDragShapesOut()` reparents shapes back to the page
|
|
8701
9166
|
*
|
|
@@ -8731,70 +9196,11 @@ declare abstract class BaseFrameLikeShapeUtil<Shape extends DrBaseBoxShape> exte
|
|
|
8731
9196
|
canReceiveNewChildrenOfType(shape: Shape, _type: DrShape['type']): boolean;
|
|
8732
9197
|
canRemoveChildrenOfType(shape: Shape, _type: DrShape['type']): boolean;
|
|
8733
9198
|
getClipPath(shape: Shape): Vec[] | undefined;
|
|
9199
|
+
shouldClipChild(child: DrShape): boolean;
|
|
8734
9200
|
onDragShapesIn(shape: Shape, draggingShapes: DrShape[], { initialParentIds, initialIndices }: DrDragShapesInInfo): void;
|
|
8735
9201
|
onDragShapesOut(shape: Shape, draggingShapes: DrShape[], info: DrDragShapesOutInfo): void;
|
|
8736
9202
|
}
|
|
8737
9203
|
|
|
8738
|
-
/** @public */
|
|
8739
|
-
interface OverlayOptionsWithDisplayValues<Overlay extends DrOverlay, DisplayValues extends object> {
|
|
8740
|
-
getDefaultDisplayValues(editor: Editor, overlay: Overlay, theme: DrTheme, colorMode: 'light' | 'dark'): DisplayValues;
|
|
8741
|
-
getCustomDisplayValues(editor: Editor, overlay: Overlay, theme: DrTheme, colorMode: 'light' | 'dark'): Partial<DisplayValues>;
|
|
8742
|
-
}
|
|
8743
|
-
/**
|
|
8744
|
-
* Get the resolved display values for an overlay, merging the base values with any overrides.
|
|
8745
|
-
*
|
|
8746
|
-
* @public
|
|
8747
|
-
*/
|
|
8748
|
-
declare function getOverlayDisplayValues<Overlay extends DrOverlay, DisplayValues extends object>(util: {
|
|
8749
|
-
editor: Editor;
|
|
8750
|
-
options: OverlayOptionsWithDisplayValues<Overlay, DisplayValues>;
|
|
8751
|
-
}, overlay: Overlay, colorMode?: 'light' | 'dark'): DisplayValues;
|
|
8752
|
-
|
|
8753
|
-
/** @public */
|
|
8754
|
-
interface DrShapeIndicatorOverlay extends DrOverlay {
|
|
8755
|
-
props: {
|
|
8756
|
-
idsToDisplay: DrShapeId[];
|
|
8757
|
-
hintingShapeIds: DrShapeId[];
|
|
8758
|
-
};
|
|
8759
|
-
}
|
|
8760
|
-
/**
|
|
8761
|
-
* Combine every batchable shape indicator into a single page-space `Path2D` and
|
|
8762
|
-
* emit one stroke call. Shapes whose indicator needs an evenodd clip (e.g.
|
|
8763
|
-
* arrows with labels or complex arrowheads) can't be batched — they still
|
|
8764
|
-
* stroke individually inside a save/restore with `ctx.clip` applied.
|
|
8765
|
-
*
|
|
8766
|
-
* Shared by {@link ShapeIndicatorOverlayUtil} and any overlay util that paints
|
|
8767
|
-
* shape indicators (e.g. collaborator selections).
|
|
8768
|
-
*
|
|
8769
|
-
* @public
|
|
8770
|
-
*/
|
|
8771
|
-
declare function strokeShapeIndicators(editor: Editor, ctx: CanvasRenderingContext2D, shapeIds: DrShapeId[]): void;
|
|
8772
|
-
/**
|
|
8773
|
-
* Overlay util for shape indicators — the selection / hover / hint outlines drawn
|
|
8774
|
-
* under the selection foreground. Paints local indicators in the theme's
|
|
8775
|
-
* selection color.
|
|
8776
|
-
*
|
|
8777
|
-
* Remote collaborator selection indicators are drawn by a separate overlay util
|
|
8778
|
-
* (e.g. `CollaboratorShapeIndicatorOverlayUtil` from `tldraw`) that runs at a
|
|
8779
|
-
* lower z-index so peer selections appear under the local indicators.
|
|
8780
|
-
*
|
|
8781
|
-
* Non-interactive: contributes no hit-test geometry.
|
|
8782
|
-
*
|
|
8783
|
-
* @public
|
|
8784
|
-
*/
|
|
8785
|
-
declare class ShapeIndicatorOverlayUtil extends OverlayUtil<DrShapeIndicatorOverlay> {
|
|
8786
|
-
static type: string;
|
|
8787
|
-
options: {
|
|
8788
|
-
zIndex: number;
|
|
8789
|
-
lineWidth: number;
|
|
8790
|
-
hintedLineWidth: number;
|
|
8791
|
-
};
|
|
8792
|
-
private _instanceFlags$;
|
|
8793
|
-
isActive(): boolean;
|
|
8794
|
-
getOverlays(): DrShapeIndicatorOverlay[];
|
|
8795
|
-
render(ctx: CanvasRenderingContext2D, overlays: DrShapeIndicatorOverlay[]): void;
|
|
8796
|
-
}
|
|
8797
|
-
|
|
8798
9204
|
/** @public */
|
|
8799
9205
|
type PerfectDashTerminal = 'skip' | 'outset' | 'none';
|
|
8800
9206
|
/** @public */
|
|
@@ -8876,6 +9282,38 @@ declare function getSvgAsImage(svgString: string, options: {
|
|
|
8876
9282
|
pixelRatio?: number;
|
|
8877
9283
|
}): Promise<Blob | null>;
|
|
8878
9284
|
|
|
9285
|
+
/**
|
|
9286
|
+
* A global registry of currently mounted editor instances. Use it to discover live editors from
|
|
9287
|
+
* outside the React tree, for example from sidebar chrome, keyboard shortcuts, or multi-editor
|
|
9288
|
+
* layouts.
|
|
9289
|
+
*
|
|
9290
|
+
* @example
|
|
9291
|
+
* ```ts
|
|
9292
|
+
* tleditors.getMounted() // readonly Editor[]
|
|
9293
|
+
*
|
|
9294
|
+
* const editors = useValue('mounted editors', () => tleditors.getMounted(), [])
|
|
9295
|
+
* ```
|
|
9296
|
+
*
|
|
9297
|
+
* @public
|
|
9298
|
+
*/
|
|
9299
|
+
declare const tleditors: {
|
|
9300
|
+
/**
|
|
9301
|
+
* A reactive list of currently mounted editor instances.
|
|
9302
|
+
*
|
|
9303
|
+
* An editor is added when it emits the `mount` event and removed when it emits `unmount`
|
|
9304
|
+
* (including when the editor is disposed while still mounted).
|
|
9305
|
+
*
|
|
9306
|
+
* @public
|
|
9307
|
+
*/
|
|
9308
|
+
mounted: Signal<readonly Editor[]>;
|
|
9309
|
+
/**
|
|
9310
|
+
* Get the currently mounted editor instances.
|
|
9311
|
+
*
|
|
9312
|
+
* @public
|
|
9313
|
+
*/
|
|
9314
|
+
getMounted(): readonly Editor[];
|
|
9315
|
+
};
|
|
9316
|
+
|
|
8879
9317
|
/**
|
|
8880
9318
|
* An object that contains information about the current device and environment.
|
|
8881
9319
|
* This object is not reactive and will not update automatically when the environment changes,
|
|
@@ -8892,6 +9330,7 @@ declare const tlenv: {
|
|
|
8892
9330
|
isWebview: boolean;
|
|
8893
9331
|
isDarwin: boolean;
|
|
8894
9332
|
hasCanvasSupport: boolean;
|
|
9333
|
+
isTouchDevice: boolean;
|
|
8895
9334
|
};
|
|
8896
9335
|
/**
|
|
8897
9336
|
* An atom that contains information about the current device and environment.
|
|
@@ -9056,6 +9495,9 @@ declare const tlmenus: {
|
|
|
9056
9495
|
*/
|
|
9057
9496
|
declare const tltime: Timers;
|
|
9058
9497
|
|
|
9498
|
+
/** @public */
|
|
9499
|
+
declare function useColorMode(): 'light' | 'dark';
|
|
9500
|
+
|
|
9059
9501
|
/** @public */
|
|
9060
9502
|
interface ContainerProviderProps {
|
|
9061
9503
|
container: HTMLElement;
|
|
@@ -9072,10 +9514,12 @@ declare function useContainer(): HTMLElement;
|
|
|
9072
9514
|
declare function useContainerIfExists(): HTMLElement | null;
|
|
9073
9515
|
|
|
9074
9516
|
/** @public */
|
|
9075
|
-
declare function
|
|
9517
|
+
declare function getCursor(cursor: DrCursorType, rotation?: number, color?: string): string;
|
|
9076
9518
|
|
|
9077
9519
|
/** @public */
|
|
9078
|
-
declare function
|
|
9520
|
+
declare function useDrStore(opts: DrStoreOptions): _ibodr_schema.DrStore;
|
|
9521
|
+
/** @public */
|
|
9522
|
+
declare function useDrSchemaFromUtils(opts: DrStoreSchemaOptions): _ibodr_store.StoreSchema<_ibodr_schema.DrRecord, _ibodr_schema.DrStoreProps>;
|
|
9079
9523
|
|
|
9080
9524
|
/** @public */
|
|
9081
9525
|
declare const EditorContext: React__default.Context<Editor | null>;
|
|
@@ -9091,36 +9535,6 @@ interface EditorProviderProps {
|
|
|
9091
9535
|
/** @public @react */
|
|
9092
9536
|
declare function EditorProvider({ editor, children }: EditorProviderProps): react_jsx_runtime.JSX.Element;
|
|
9093
9537
|
|
|
9094
|
-
/** @public */
|
|
9095
|
-
interface DrCollaboratorCursorLayout {
|
|
9096
|
-
/** Offset of the name/chat badge from the cursor anchor (px, before zoom scale). */
|
|
9097
|
-
badgeOffset: {
|
|
9098
|
-
x: number;
|
|
9099
|
-
y: number;
|
|
9100
|
-
};
|
|
9101
|
-
/** Offset of the pointer icon from the cursor anchor (px, before zoom scale). */
|
|
9102
|
-
iconOffset: {
|
|
9103
|
-
x: number;
|
|
9104
|
-
y: number;
|
|
9105
|
-
};
|
|
9106
|
-
}
|
|
9107
|
-
|
|
9108
|
-
/** @public */
|
|
9109
|
-
interface DrCollaboratorCursorProps {
|
|
9110
|
-
/** Screen position relative to the editor container. */
|
|
9111
|
-
point: {
|
|
9112
|
-
x: number;
|
|
9113
|
-
y: number;
|
|
9114
|
-
};
|
|
9115
|
-
color: string;
|
|
9116
|
-
name?: string | null;
|
|
9117
|
-
chatMessage?: string;
|
|
9118
|
-
/** Scale relative to camera zoom (1 = base size at 100% zoom). */
|
|
9119
|
-
scale: number;
|
|
9120
|
-
/** Layout offsets for the pointer icon and name badge. */
|
|
9121
|
-
layout?: DrCollaboratorCursorLayout;
|
|
9122
|
-
}
|
|
9123
|
-
|
|
9124
9538
|
/** @public */
|
|
9125
9539
|
interface DrEditorComponents {
|
|
9126
9540
|
Background?: ComponentType<DrBackgroundProps> | null;
|
|
@@ -9133,9 +9547,8 @@ interface DrEditorComponents {
|
|
|
9133
9547
|
InFrontOfTheCanvas?: ComponentType | null;
|
|
9134
9548
|
LoadingScreen?: ComponentType | null;
|
|
9135
9549
|
OnTheCanvas?: ComponentType | null;
|
|
9136
|
-
SelectionBackground?: ComponentType<DrSelectionBackgroundProps> | null;
|
|
9137
9550
|
ShapeWrapper?: ComponentType<DrShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
|
|
9138
|
-
Spinner?: ComponentType<
|
|
9551
|
+
Spinner?: ComponentType<DrSpinnerProps> | null;
|
|
9139
9552
|
SvgDefs?: ComponentType | null;
|
|
9140
9553
|
ErrorFallback?: DrErrorFallbackComponent;
|
|
9141
9554
|
ShapeErrorFallback?: DrShapeErrorFallbackComponent;
|
|
@@ -9219,9 +9632,6 @@ declare function useLocalStore(options: {
|
|
|
9219
9632
|
snapshot?: DrEditorSnapshot | DrStoreSnapshot;
|
|
9220
9633
|
} & DrStoreOptions): DrStoreWithStatus;
|
|
9221
9634
|
|
|
9222
|
-
/** @public */
|
|
9223
|
-
declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement | null>): void;
|
|
9224
|
-
|
|
9225
9635
|
/** @public */
|
|
9226
9636
|
declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
|
|
9227
9637
|
|
|
@@ -9234,13 +9644,13 @@ declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>):
|
|
|
9234
9644
|
* @returns The list of peer UserIDs
|
|
9235
9645
|
* @public
|
|
9236
9646
|
*/
|
|
9237
|
-
declare function usePeerIds():
|
|
9647
|
+
declare function usePeerIds(): _ibodr_schema.DrUserId[];
|
|
9238
9648
|
|
|
9239
9649
|
/**
|
|
9240
9650
|
* @returns The latest presence of the user matching userId
|
|
9241
9651
|
* @public
|
|
9242
9652
|
*/
|
|
9243
|
-
declare function usePresence(userId:
|
|
9653
|
+
declare function usePresence(userId: DrUserId): DrInstancePresence | null;
|
|
9244
9654
|
|
|
9245
9655
|
/**
|
|
9246
9656
|
* A `useState` that uses a `ref` to keep the state in sync with the last value assigned to it.
|
|
@@ -9317,37 +9727,262 @@ declare function useSharedSafeId(id: string): SafeId;
|
|
|
9317
9727
|
/** @public */
|
|
9318
9728
|
declare function sanitizeId(id: string): string;
|
|
9319
9729
|
|
|
9320
|
-
/**
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9324
|
-
|
|
9325
|
-
/** @public */
|
|
9730
|
+
/**
|
|
9731
|
+
* Position an element by writing its `transform` directly, outside React's render output — the
|
|
9732
|
+
* cheap path for elements that move at pointer/presence frequency.
|
|
9733
|
+
* @public
|
|
9734
|
+
*/
|
|
9326
9735
|
declare function useTransform(ref: React.RefObject<HTMLElement | SVGElement | null>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
|
|
9327
9736
|
|
|
9328
|
-
|
|
9329
|
-
*
|
|
9330
|
-
*
|
|
9737
|
+
/**
|
|
9738
|
+
* Whether a collaborator's cursor (page coords) is inside the viewport, with a small margin for the
|
|
9739
|
+
* cursor glyph so it isn't culled the instant its hotspot crosses the edge.
|
|
9331
9740
|
*
|
|
9332
|
-
*
|
|
9333
|
-
*
|
|
9741
|
+
* Single source of truth for the cursor/hint split: the DOM cursor layer renders a collaborator
|
|
9742
|
+
* when this is true, and `CollaboratorHintOverlayUtil` draws the viewport-edge hint when it's
|
|
9743
|
+
* false. Sharing the predicate keeps those two exhaustive and mutually exclusive — a margin change
|
|
9744
|
+
* can't open a dead zone (neither renders) or a double-render (both).
|
|
9334
9745
|
*
|
|
9335
|
-
*
|
|
9336
|
-
* while using the virtual keyboard.
|
|
9746
|
+
* @public
|
|
9337
9747
|
*/
|
|
9338
|
-
|
|
9339
|
-
|
|
9748
|
+
declare function isCursorInViewport(cursor: VecLike, viewport: {
|
|
9749
|
+
minX: number;
|
|
9750
|
+
minY: number;
|
|
9751
|
+
maxX: number;
|
|
9752
|
+
maxY: number;
|
|
9753
|
+
}, zoom: number): boolean;
|
|
9340
9754
|
|
|
9341
|
-
/**
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9755
|
+
/**
|
|
9756
|
+
* Props for the {@link tldraw#Draw} and {@link DrawEditor} components, when passing in a
|
|
9757
|
+
* `DrStore` directly. If you would like tldraw to create a store for you, use
|
|
9758
|
+
* {@link DrawEditorWithoutStoreProps}.
|
|
9759
|
+
*
|
|
9760
|
+
* @public
|
|
9761
|
+
*/
|
|
9762
|
+
interface DrawEditorWithStoreProps {
|
|
9763
|
+
/**
|
|
9764
|
+
* The store to use in the editor.
|
|
9765
|
+
*/
|
|
9766
|
+
store: DrStore | DrStoreWithStatus;
|
|
9767
|
+
}
|
|
9768
|
+
/**
|
|
9769
|
+
* Props for the {@link tldraw#Draw} and {@link DrawEditor} components, when not passing in a
|
|
9770
|
+
* `DrStore` directly. If you would like to pass in a store directly, use
|
|
9771
|
+
* {@link DrawEditorWithStoreProps}.
|
|
9772
|
+
*
|
|
9773
|
+
* @public
|
|
9774
|
+
*/
|
|
9775
|
+
interface DrawEditorWithoutStoreProps extends DrStoreBaseOptions {
|
|
9776
|
+
store?: undefined;
|
|
9777
|
+
/**
|
|
9778
|
+
* Additional migrations to use in the store
|
|
9779
|
+
*/
|
|
9780
|
+
migrations?: readonly MigrationSequence[];
|
|
9781
|
+
/**
|
|
9782
|
+
* A starting snapshot of data to pre-populate the store. Do not supply both this and
|
|
9783
|
+
* `initialData`.
|
|
9784
|
+
*/
|
|
9785
|
+
snapshot?: DrEditorSnapshot | DrStoreSnapshot;
|
|
9786
|
+
/**
|
|
9787
|
+
* If you would like to persist the store to the browser's local IndexedDB storage and sync it
|
|
9788
|
+
* across tabs, provide a key here. Each key represents a single tldraw document.
|
|
9789
|
+
*/
|
|
9790
|
+
persistenceKey?: string;
|
|
9791
|
+
sessionId?: string;
|
|
9792
|
+
}
|
|
9793
|
+
/** @public */
|
|
9794
|
+
type DrawEditorStoreProps = DrawEditorWithStoreProps | DrawEditorWithoutStoreProps;
|
|
9795
|
+
/** @public */
|
|
9796
|
+
type DrawEditorProps = DrawEditorBaseProps & DrawEditorStoreProps;
|
|
9797
|
+
/**
|
|
9798
|
+
* Base props for the {@link tldraw#Draw} and {@link DrawEditor} components.
|
|
9799
|
+
*
|
|
9800
|
+
* @public
|
|
9801
|
+
*/
|
|
9802
|
+
interface DrawEditorBaseProps {
|
|
9803
|
+
/**
|
|
9804
|
+
* The component's children.
|
|
9805
|
+
*/
|
|
9806
|
+
children?: ReactNode;
|
|
9807
|
+
/**
|
|
9808
|
+
* An array of shape utils to use in the editor.
|
|
9809
|
+
*/
|
|
9810
|
+
shapeUtils?: readonly DrAnyShapeUtilConstructor[];
|
|
9811
|
+
/**
|
|
9812
|
+
* An array of binding utils to use in the editor.
|
|
9813
|
+
*/
|
|
9814
|
+
bindingUtils?: readonly DrAnyBindingUtilConstructor[];
|
|
9815
|
+
/**
|
|
9816
|
+
* An array of asset utils to use in the editor.
|
|
9817
|
+
*/
|
|
9818
|
+
assetUtils?: readonly DrAnyAssetUtilConstructor[];
|
|
9819
|
+
/**
|
|
9820
|
+
* An array of overlay utils to use in the editor for canvas overlay UI elements.
|
|
9821
|
+
*/
|
|
9822
|
+
overlayUtils?: readonly DrAnyOverlayUtilConstructor[];
|
|
9823
|
+
/**
|
|
9824
|
+
* An array of tools to add to the editor's state chart.
|
|
9825
|
+
*/
|
|
9826
|
+
tools?: readonly DrStateNodeConstructor[];
|
|
9827
|
+
/**
|
|
9828
|
+
* Whether to automatically focus the editor when it mounts.
|
|
9829
|
+
*/
|
|
9830
|
+
autoFocus?: boolean;
|
|
9831
|
+
/**
|
|
9832
|
+
* Overrides for the editor's components, such as handles, collaborator cursors, etc.
|
|
9833
|
+
*/
|
|
9834
|
+
components?: DrEditorComponents;
|
|
9835
|
+
/**
|
|
9836
|
+
* Called when the editor has mounted.
|
|
9837
|
+
*/
|
|
9838
|
+
onMount?: DrOnMountHandler;
|
|
9839
|
+
/**
|
|
9840
|
+
* The editor's initial state (usually the id of the first active tool).
|
|
9841
|
+
*/
|
|
9842
|
+
initialState?: string;
|
|
9843
|
+
/**
|
|
9844
|
+
* A classname to pass to the editor's container.
|
|
9845
|
+
*/
|
|
9846
|
+
className?: string;
|
|
9847
|
+
/**
|
|
9848
|
+
* The user interacting with the editor.
|
|
9849
|
+
*/
|
|
9850
|
+
user?: DrCurrentUser;
|
|
9851
|
+
/**
|
|
9852
|
+
* The editor's color scheme. Defaults to `'light'`.
|
|
9853
|
+
*
|
|
9854
|
+
* - `'light'` - Always use light mode.
|
|
9855
|
+
* - `'dark'` - Always use dark mode.
|
|
9856
|
+
* - `'system'` - Follow the OS color scheme preference.
|
|
9857
|
+
* - `'inherit'` - Follow the nearest ancestor's `data-color-mode` attribute
|
|
9858
|
+
* (for embedding inside a host app that manages its own theme).
|
|
9859
|
+
*/
|
|
9860
|
+
colorScheme?: 'light' | 'dark' | 'system' | 'inherit';
|
|
9861
|
+
/**
|
|
9862
|
+
* Named themes for the editor.
|
|
9863
|
+
*/
|
|
9864
|
+
themes?: Partial<DrThemes>;
|
|
9865
|
+
/**
|
|
9866
|
+
* The id of the initially active theme. Defaults to `'default'`.
|
|
9867
|
+
*/
|
|
9868
|
+
initialTheme?: DrThemeId;
|
|
9869
|
+
/**
|
|
9870
|
+
* Camera options for the editor.
|
|
9871
|
+
*
|
|
9872
|
+
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
9873
|
+
*/
|
|
9874
|
+
cameraOptions?: Partial<DrCameraOptions>;
|
|
9875
|
+
/**
|
|
9876
|
+
* Options for the editor.
|
|
9877
|
+
*/
|
|
9878
|
+
options?: Partial<DrawOptions>;
|
|
9879
|
+
/**
|
|
9880
|
+
* Text options for the editor.
|
|
9881
|
+
*
|
|
9882
|
+
* @deprecated Use `options.text` instead. This prop will be removed in a future release.
|
|
9883
|
+
*/
|
|
9884
|
+
textOptions?: DrTextOptions;
|
|
9885
|
+
/**
|
|
9886
|
+
* Options for syncing the editor's camera state with the URL.
|
|
9887
|
+
*
|
|
9888
|
+
* @deprecated Use `options.deepLinks` instead. This prop will be removed in a future release.
|
|
9889
|
+
*/
|
|
9890
|
+
deepLinks?: true | DrDeepLinkOptions;
|
|
9891
|
+
/**
|
|
9892
|
+
* Provides a way to hide shapes.
|
|
9893
|
+
*
|
|
9894
|
+
* Hidden shapes will not render in the editor, and they will not be eligible for hit test via
|
|
9895
|
+
* {@link @ibodr/editor#Editor.getShapeAtPoint} and {@link @ibodr/editor#Editor.getShapesAtPoint}. But otherwise they will
|
|
9896
|
+
* remain in the store and participate in all other operations.
|
|
9897
|
+
*
|
|
9898
|
+
* @example
|
|
9899
|
+
* ```ts
|
|
9900
|
+
* getShapeVisibility={(shape, editor) => shape.meta.hidden ? 'hidden' : 'inherit'}
|
|
9901
|
+
* ```
|
|
9902
|
+
*
|
|
9903
|
+
* - `'inherit' | undefined` - (default) The shape will be visible unless its parent is hidden.
|
|
9904
|
+
* - `'hidden'` - The shape will be hidden.
|
|
9905
|
+
* - `'visible'` - The shape will be visible.
|
|
9906
|
+
*
|
|
9907
|
+
* @param shape - The shape to check.
|
|
9908
|
+
* @param editor - The editor instance.
|
|
9909
|
+
*/
|
|
9910
|
+
getShapeVisibility?(shape: DrShape, editor: Editor): 'visible' | 'hidden' | 'inherit' | null | undefined;
|
|
9911
|
+
/**
|
|
9912
|
+
* The URLs for the fonts to use in the editor.
|
|
9913
|
+
*/
|
|
9914
|
+
assetUrls?: {
|
|
9915
|
+
fonts?: {
|
|
9916
|
+
[key: string]: string | undefined;
|
|
9917
|
+
};
|
|
9918
|
+
};
|
|
9919
|
+
}
|
|
9920
|
+
/**
|
|
9921
|
+
* Called when the editor has mounted.
|
|
9922
|
+
* @example
|
|
9923
|
+
* ```ts
|
|
9924
|
+
* <Draw onMount={(editor) => editor.selectAll()} />
|
|
9925
|
+
* ```
|
|
9926
|
+
* @param editor - The editor instance.
|
|
9927
|
+
*
|
|
9928
|
+
* @public
|
|
9929
|
+
*/
|
|
9930
|
+
type DrOnMountHandler = (editor: Editor) => (() => void | undefined) | undefined | void;
|
|
9931
|
+
declare global {
|
|
9932
|
+
interface Window {
|
|
9933
|
+
drawReady: boolean;
|
|
9934
|
+
}
|
|
9935
|
+
}
|
|
9936
|
+
/**
|
|
9937
|
+
* The editor component without any of the default shapes, tools, or UI. It renders the canvas, or
|
|
9938
|
+
* your own children in its place, with the shape utils, binding utils, tools, and components you
|
|
9939
|
+
* pass in; the `Draw` component in the `tldraw` package wraps it with those defaults.
|
|
9940
|
+
*
|
|
9941
|
+
* @public @react
|
|
9942
|
+
*/
|
|
9943
|
+
declare const DrawEditor: React__default.NamedExoticComponent<DrawEditorProps>;
|
|
9944
|
+
/** @public */
|
|
9945
|
+
interface LoadingScreenProps {
|
|
9946
|
+
children: ReactNode;
|
|
9947
|
+
}
|
|
9948
|
+
/** @public @react */
|
|
9949
|
+
declare function LoadingScreen({ children }: LoadingScreenProps): react_jsx_runtime.JSX.Element;
|
|
9950
|
+
/** @public @react */
|
|
9951
|
+
declare function ErrorScreen({ children }: LoadingScreenProps): react_jsx_runtime.JSX.Element;
|
|
9952
|
+
/** @internal */
|
|
9953
|
+
declare function useOnMount(onMount?: DrOnMountHandler): void;
|
|
9954
|
+
|
|
9955
|
+
/*!
|
|
9956
|
+
* BSD License: https://github.com/outline/rich-markdown-editor/blob/main/LICENSE
|
|
9957
|
+
* Copyright (c) 2020 General Outline, Inc (https://www.getoutline.com/) and individual contributors.
|
|
9958
|
+
*
|
|
9959
|
+
* Returns the height of the viewport.
|
|
9960
|
+
* This is mainly to account for virtual keyboards on mobile devices.
|
|
9961
|
+
*
|
|
9962
|
+
* N.B. On iOS, you have to take into account the offsetTop as well so that you get an accurate position
|
|
9963
|
+
* while using the virtual keyboard.
|
|
9964
|
+
*/
|
|
9965
|
+
/**
|
|
9966
|
+
* The height of the visible viewport, including the visual viewport's own offset.
|
|
9967
|
+
*
|
|
9968
|
+
* @deprecated Read `window.visualViewport` directly: this flattens the visible rectangle to a
|
|
9969
|
+
* single scalar, and keeping UI clear of the software keyboard usually needs the other edges too.
|
|
9970
|
+
* Unused since v3.14; will be removed in a future release.
|
|
9971
|
+
*
|
|
9972
|
+
* @public
|
|
9973
|
+
*/
|
|
9974
|
+
declare function useViewportHeight(): number;
|
|
9975
|
+
|
|
9976
|
+
/** @public */
|
|
9977
|
+
declare const EASINGS: {
|
|
9978
|
+
readonly linear: (t: number) => number;
|
|
9979
|
+
readonly easeInQuad: (t: number) => number;
|
|
9980
|
+
readonly easeOutQuad: (t: number) => number;
|
|
9981
|
+
readonly easeInOutQuad: (t: number) => number;
|
|
9982
|
+
readonly easeInCubic: (t: number) => number;
|
|
9983
|
+
readonly easeOutCubic: (t: number) => number;
|
|
9984
|
+
readonly easeInOutCubic: (t: number) => number;
|
|
9985
|
+
readonly easeInQuart: (t: number) => number;
|
|
9351
9986
|
readonly easeOutQuart: (t: number) => number;
|
|
9352
9987
|
readonly easeInOutQuart: (t: number) => number;
|
|
9353
9988
|
readonly easeInQuint: (t: number) => number;
|
|
@@ -9531,7 +10166,7 @@ declare class Group2d extends Geometry2d {
|
|
|
9531
10166
|
intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
|
|
9532
10167
|
interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
|
|
9533
10168
|
uninterpolateAlongEdge(point: VecLike, filters?: Geometry2dFilters): number;
|
|
9534
|
-
transform(transform:
|
|
10169
|
+
transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
|
|
9535
10170
|
getArea(): number;
|
|
9536
10171
|
toSimpleSvgPath(): string;
|
|
9537
10172
|
getLength(filters?: Geometry2dFilters): number;
|
|
@@ -9869,7 +10504,7 @@ declare function toFixed(v: number): number;
|
|
|
9869
10504
|
* Check if a float is safe to use. ie: Not too big or small.
|
|
9870
10505
|
* @public
|
|
9871
10506
|
*/
|
|
9872
|
-
declare
|
|
10507
|
+
declare function isSafeFloat(n: number): boolean;
|
|
9873
10508
|
/**
|
|
9874
10509
|
* Get the angle of a point on an arc.
|
|
9875
10510
|
* @param fromAngle - The angle from center to arc's start point (A) on the circle
|
|
@@ -9920,204 +10555,6 @@ declare function centerOfCircleFromThreePoints(a: VecLike, b: VecLike, c: VecLik
|
|
|
9920
10555
|
/** @public */
|
|
9921
10556
|
declare function getPointsOnArc(startPoint: VecLike, endPoint: VecLike, center: VecLike | null, radius: number, numPoints: number): Vec[];
|
|
9922
10557
|
|
|
9923
|
-
/**
|
|
9924
|
-
* Props for the {@link tldraw#Draw} and {@link DrawEditor} components, when passing in a
|
|
9925
|
-
* `DrStore` directly. If you would like tldraw to create a store for you, use
|
|
9926
|
-
* {@link DrawEditorWithoutStoreProps}.
|
|
9927
|
-
*
|
|
9928
|
-
* @public
|
|
9929
|
-
*/
|
|
9930
|
-
interface DrawEditorWithStoreProps {
|
|
9931
|
-
/**
|
|
9932
|
-
* The store to use in the editor.
|
|
9933
|
-
*/
|
|
9934
|
-
store: DrStore | DrStoreWithStatus;
|
|
9935
|
-
}
|
|
9936
|
-
/**
|
|
9937
|
-
* Props for the {@link tldraw#Draw} and {@link DrawEditor} components, when not passing in a
|
|
9938
|
-
* `DrStore` directly. If you would like to pass in a store directly, use
|
|
9939
|
-
* {@link DrawEditorWithStoreProps}.
|
|
9940
|
-
*
|
|
9941
|
-
* @public
|
|
9942
|
-
*/
|
|
9943
|
-
interface DrawEditorWithoutStoreProps extends DrStoreBaseOptions {
|
|
9944
|
-
store?: undefined;
|
|
9945
|
-
/**
|
|
9946
|
-
* Additional migrations to use in the store
|
|
9947
|
-
*/
|
|
9948
|
-
migrations?: readonly MigrationSequence[];
|
|
9949
|
-
/**
|
|
9950
|
-
* A starting snapshot of data to pre-populate the store. Do not supply both this and
|
|
9951
|
-
* `initialData`.
|
|
9952
|
-
*/
|
|
9953
|
-
snapshot?: DrEditorSnapshot | DrStoreSnapshot;
|
|
9954
|
-
/**
|
|
9955
|
-
* If you would like to persist the store to the browser's local IndexedDB storage and sync it
|
|
9956
|
-
* across tabs, provide a key here. Each key represents a single tldraw document.
|
|
9957
|
-
*/
|
|
9958
|
-
persistenceKey?: string;
|
|
9959
|
-
sessionId?: string;
|
|
9960
|
-
}
|
|
9961
|
-
/** @public */
|
|
9962
|
-
type DrawEditorStoreProps = DrawEditorWithStoreProps | DrawEditorWithoutStoreProps;
|
|
9963
|
-
/**
|
|
9964
|
-
* Props for the {@link tldraw#Draw} and {@link DrawEditor} components.
|
|
9965
|
-
*
|
|
9966
|
-
* @public
|
|
9967
|
-
**/
|
|
9968
|
-
type DrawEditorProps = DrawEditorBaseProps & DrawEditorStoreProps;
|
|
9969
|
-
/**
|
|
9970
|
-
* Base props for the {@link tldraw#Draw} and {@link DrawEditor} components.
|
|
9971
|
-
*
|
|
9972
|
-
* @public
|
|
9973
|
-
*/
|
|
9974
|
-
interface DrawEditorBaseProps {
|
|
9975
|
-
/**
|
|
9976
|
-
* The component's children.
|
|
9977
|
-
*/
|
|
9978
|
-
children?: ReactNode;
|
|
9979
|
-
/**
|
|
9980
|
-
* An array of shape utils to use in the editor.
|
|
9981
|
-
*/
|
|
9982
|
-
shapeUtils?: readonly DrAnyShapeUtilConstructor[];
|
|
9983
|
-
/**
|
|
9984
|
-
* An array of binding utils to use in the editor.
|
|
9985
|
-
*/
|
|
9986
|
-
bindingUtils?: readonly DrAnyBindingUtilConstructor[];
|
|
9987
|
-
/**
|
|
9988
|
-
* An array of asset utils to use in the editor.
|
|
9989
|
-
*/
|
|
9990
|
-
assetUtils?: readonly DrAnyAssetUtilConstructor[];
|
|
9991
|
-
/**
|
|
9992
|
-
* An array of overlay utils to use in the editor for canvas overlay UI elements.
|
|
9993
|
-
*/
|
|
9994
|
-
overlayUtils?: readonly DrAnyOverlayUtilConstructor[];
|
|
9995
|
-
/**
|
|
9996
|
-
* An array of tools to add to the editor's state chart.
|
|
9997
|
-
*/
|
|
9998
|
-
tools?: readonly DrStateNodeConstructor[];
|
|
9999
|
-
/**
|
|
10000
|
-
* Whether to automatically focus the editor when it mounts.
|
|
10001
|
-
*/
|
|
10002
|
-
autoFocus?: boolean;
|
|
10003
|
-
/**
|
|
10004
|
-
* Overrides for the editor's components, such as handles, collaborator cursors, etc.
|
|
10005
|
-
*/
|
|
10006
|
-
components?: DrEditorComponents;
|
|
10007
|
-
/**
|
|
10008
|
-
* Called when the editor has mounted.
|
|
10009
|
-
*/
|
|
10010
|
-
onMount?: DrOnMountHandler;
|
|
10011
|
-
/**
|
|
10012
|
-
* The editor's initial state (usually the id of the first active tool).
|
|
10013
|
-
*/
|
|
10014
|
-
initialState?: string;
|
|
10015
|
-
/**
|
|
10016
|
-
* A classname to pass to the editor's container.
|
|
10017
|
-
*/
|
|
10018
|
-
className?: string;
|
|
10019
|
-
/**
|
|
10020
|
-
* The user interacting with the editor.
|
|
10021
|
-
*/
|
|
10022
|
-
user?: DrCurrentUser;
|
|
10023
|
-
/**
|
|
10024
|
-
* The editor's color scheme. Defaults to `'light'`.
|
|
10025
|
-
*
|
|
10026
|
-
* - `'light'` - Always use light mode.
|
|
10027
|
-
* - `'dark'` - Always use dark mode.
|
|
10028
|
-
* - `'system'` - Follow the OS color scheme preference.
|
|
10029
|
-
* - `'inherit'` - Follow the nearest ancestor's `data-color-mode` attribute
|
|
10030
|
-
* (for embedding inside a host app that manages its own theme).
|
|
10031
|
-
*/
|
|
10032
|
-
colorScheme?: 'light' | 'dark' | 'system' | 'inherit';
|
|
10033
|
-
/**
|
|
10034
|
-
* Named themes for the editor.
|
|
10035
|
-
*/
|
|
10036
|
-
themes?: Partial<DrThemes>;
|
|
10037
|
-
/**
|
|
10038
|
-
* The id of the initially active theme. Defaults to `'default'`.
|
|
10039
|
-
*/
|
|
10040
|
-
initialTheme?: DrThemeId;
|
|
10041
|
-
/**
|
|
10042
|
-
* Camera options for the editor.
|
|
10043
|
-
*
|
|
10044
|
-
* @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
|
|
10045
|
-
*/
|
|
10046
|
-
cameraOptions?: Partial<DrCameraOptions>;
|
|
10047
|
-
/**
|
|
10048
|
-
* Options for the editor.
|
|
10049
|
-
*/
|
|
10050
|
-
options?: Partial<DrawOptions>;
|
|
10051
|
-
/**
|
|
10052
|
-
* Text options for the editor.
|
|
10053
|
-
*
|
|
10054
|
-
* @deprecated Use `options.text` instead. This prop will be removed in a future release.
|
|
10055
|
-
*/
|
|
10056
|
-
textOptions?: DrTextOptions;
|
|
10057
|
-
/**
|
|
10058
|
-
* Options for syncing the editor's camera state with the URL.
|
|
10059
|
-
*
|
|
10060
|
-
* @deprecated Use `options.deepLinks` instead. This prop will be removed in a future release.
|
|
10061
|
-
*/
|
|
10062
|
-
deepLinks?: true | DrDeepLinkOptions;
|
|
10063
|
-
/**
|
|
10064
|
-
* Provides a way to hide shapes.
|
|
10065
|
-
*
|
|
10066
|
-
* Hidden shapes will not render in the editor, and they will not be eligible for hit test via
|
|
10067
|
-
* {@link @ibodr/editor#Editor.getShapeAtPoint} and {@link @ibodr/editor#Editor.getShapesAtPoint}. But otherwise they will
|
|
10068
|
-
* remain in the store and participate in all other operations.
|
|
10069
|
-
*
|
|
10070
|
-
* @example
|
|
10071
|
-
* ```ts
|
|
10072
|
-
* getShapeVisibility={(shape, editor) => shape.meta.hidden ? 'hidden' : 'inherit'}
|
|
10073
|
-
* ```
|
|
10074
|
-
*
|
|
10075
|
-
* - `'inherit' | undefined` - (default) The shape will be visible unless its parent is hidden.
|
|
10076
|
-
* - `'hidden'` - The shape will be hidden.
|
|
10077
|
-
* - `'visible'` - The shape will be visible.
|
|
10078
|
-
*
|
|
10079
|
-
* @param shape - The shape to check.
|
|
10080
|
-
* @param editor - The editor instance.
|
|
10081
|
-
*/
|
|
10082
|
-
getShapeVisibility?(shape: DrShape, editor: Editor): 'visible' | 'hidden' | 'inherit' | null | undefined;
|
|
10083
|
-
/**
|
|
10084
|
-
* The URLs for the fonts to use in the editor.
|
|
10085
|
-
*/
|
|
10086
|
-
assetUrls?: {
|
|
10087
|
-
fonts?: {
|
|
10088
|
-
[key: string]: string | undefined;
|
|
10089
|
-
};
|
|
10090
|
-
};
|
|
10091
|
-
}
|
|
10092
|
-
/**
|
|
10093
|
-
* Called when the editor has mounted.
|
|
10094
|
-
* @example
|
|
10095
|
-
* ```ts
|
|
10096
|
-
* <Draw onMount={(editor) => editor.selectAll()} />
|
|
10097
|
-
* ```
|
|
10098
|
-
* @param editor - The editor instance.
|
|
10099
|
-
*
|
|
10100
|
-
* @public
|
|
10101
|
-
*/
|
|
10102
|
-
type DrOnMountHandler = (editor: Editor) => (() => void | undefined) | undefined | void;
|
|
10103
|
-
declare global {
|
|
10104
|
-
interface Window {
|
|
10105
|
-
drawReady: boolean;
|
|
10106
|
-
}
|
|
10107
|
-
}
|
|
10108
|
-
/** @public @react */
|
|
10109
|
-
declare const DrawEditor: React__default.NamedExoticComponent<DrawEditorProps>;
|
|
10110
|
-
/** @public */
|
|
10111
|
-
interface LoadingScreenProps {
|
|
10112
|
-
children: ReactNode;
|
|
10113
|
-
}
|
|
10114
|
-
/** @public @react */
|
|
10115
|
-
declare function LoadingScreen({ children }: LoadingScreenProps): react_jsx_runtime.JSX.Element;
|
|
10116
|
-
/** @public @react */
|
|
10117
|
-
declare function ErrorScreen({ children }: LoadingScreenProps): react_jsx_runtime.JSX.Element;
|
|
10118
|
-
/** @internal */
|
|
10119
|
-
declare function useOnMount(onMount?: DrOnMountHandler): void;
|
|
10120
|
-
|
|
10121
10558
|
/**
|
|
10122
10559
|
* Converts a data URL to a file.
|
|
10123
10560
|
* @param url - The data URL to convert.
|
|
@@ -10152,8 +10589,6 @@ declare const debugFlags: {
|
|
|
10152
10589
|
readonly showFps: DebugFlag<boolean>;
|
|
10153
10590
|
readonly measurePerformance: DebugFlag<boolean>;
|
|
10154
10591
|
readonly throwToBlob: DebugFlag<boolean>;
|
|
10155
|
-
readonly reconnectOnPing: DebugFlag<boolean>;
|
|
10156
|
-
readonly debugCursors: DebugFlag<boolean>;
|
|
10157
10592
|
readonly forceSrgb: DebugFlag<boolean>;
|
|
10158
10593
|
readonly debugGeometry: DebugFlag<boolean>;
|
|
10159
10594
|
readonly hideShapes: DebugFlag<boolean>;
|
|
@@ -10211,7 +10646,25 @@ declare function releasePointerCapture(element: Element, event: React.PointerEve
|
|
|
10211
10646
|
*
|
|
10212
10647
|
* @public
|
|
10213
10648
|
*/
|
|
10214
|
-
declare
|
|
10649
|
+
declare function stopEventPropagation(e: any): any;
|
|
10650
|
+
/**
|
|
10651
|
+
* Move an element into a new parent, preserving its state where the platform allows it.
|
|
10652
|
+
*
|
|
10653
|
+
* Uses `Node.moveBefore` (Chromium 133+, Firefox 144+) when both the element and parent are
|
|
10654
|
+
* connected to the same document — this moves the element without resetting its state, so
|
|
10655
|
+
* iframes don't reload and media keeps playing. Otherwise (older browsers, disconnected nodes,
|
|
10656
|
+
* or a cross-document move) it falls back to `appendChild`, which moves the element but resets
|
|
10657
|
+
* its state like an iframe reload.
|
|
10658
|
+
*
|
|
10659
|
+
* This is the primitive tldraw uses to adopt `ShapeUtil.getAppOwnedElement` elements, exposed so
|
|
10660
|
+
* apps can perform symmetric state-preserving moves from `ShapeUtil.onReleaseAppOwnedElement` —
|
|
10661
|
+
* for example moving an element to an off-canvas parking lot between editor sessions.
|
|
10662
|
+
*
|
|
10663
|
+
* @param parent - The element to move `element` into, as its last child.
|
|
10664
|
+
* @param element - The element to move.
|
|
10665
|
+
* @public
|
|
10666
|
+
*/
|
|
10667
|
+
declare function moveElementInto(parent: HTMLElement, element: HTMLElement): void;
|
|
10215
10668
|
/** @internal */
|
|
10216
10669
|
declare function elementShouldCaptureKeys(el: Element | null, includeButtonsAndMenus?: boolean): boolean;
|
|
10217
10670
|
/**
|
|
@@ -10446,7 +10899,14 @@ declare class LocalIndexedDb {
|
|
|
10446
10899
|
sessionId?: string | null;
|
|
10447
10900
|
sessionStateSnapshot?: DrSessionStateSnapshot | null;
|
|
10448
10901
|
}): Promise<void>;
|
|
10449
|
-
|
|
10902
|
+
/**
|
|
10903
|
+
* Drop all but the most recently updated session state rows. The row for `keepSessionId` is never
|
|
10904
|
+
* deleted: it may be an old row that this tab restored its state from and has not rewritten yet,
|
|
10905
|
+
* and deleting it would make a later reload fall back to another tab's session state.
|
|
10906
|
+
*/
|
|
10907
|
+
pruneSessions({ keepSessionId }?: {
|
|
10908
|
+
keepSessionId?: string;
|
|
10909
|
+
}): Promise<void>;
|
|
10450
10910
|
getAsset(assetId: string): Promise<File | undefined>;
|
|
10451
10911
|
storeAsset(assetId: string, blob: File): Promise<void>;
|
|
10452
10912
|
removeAssets(assetId: string[]): Promise<void>;
|
|
@@ -10458,4 +10918,4 @@ declare function uniq<T>(array: {
|
|
|
10458
10918
|
readonly [n: number]: T;
|
|
10459
10919
|
} | null | undefined): T[];
|
|
10460
10920
|
|
|
10461
|
-
export { Arc2d, AssetUtil, BaseBoxShapeTool, BaseBoxShapeUtil, BaseFrameLikeShapeUtil, type BatchMeasurementRequest, type BindingOnChangeOptions, type BindingOnCreateOptions, type BindingOnDeleteOptions, type BindingOnShapeChangeOptions, type BindingOnShapeDeleteOptions, type BindingOnShapeIsolateOptions, BindingUtil, type BoundsSnapGeometry, type BoundsSnapPoint, BoundsSnaps, Box, type BoxLike, type CanvasMaxSize, Circle2d, ClickManager, CollaboratorsManager, ContainerProvider, type ContainerProviderProps, CubicBezier2d, CubicSpline2d, DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, DEFAULT_THEME, type DebugFlag, type DebugFlagDef, type DebugFlagDefaults, DefaultBackground, DefaultCanvas, DefaultErrorFallback, DefaultGrid,
|
|
10921
|
+
export { Arc2d, AssetUtil, BaseBoxShapeTool, BaseBoxShapeUtil, BaseFrameLikeShapeUtil, type BatchMeasurementRequest, type BindingOnChangeOptions, type BindingOnCreateOptions, type BindingOnDeleteOptions, type BindingOnShapeChangeOptions, type BindingOnShapeDeleteOptions, type BindingOnShapeIsolateOptions, BindingUtil, type BoundsSnapGeometry, type BoundsSnapPoint, BoundsSnaps, Box, type BoxLike, type CanvasMaxSize, Circle2d, ClickManager, CollaboratorsManager, ContainerProvider, type ContainerProviderProps, CubicBezier2d, CubicSpline2d, DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, DEFAULT_THEME, type DebugFlag, type DebugFlagDef, type DebugFlagDefaults, DefaultBackground, DefaultCanvas, DefaultCursor, DefaultErrorFallback, DefaultGrid, DefaultShapeWrapper, DefaultSpinner, DefaultSvgDefs, type DrAdjacentDirection, type DrAnyAssetUtilConstructor, type DrAnyBindingUtilConstructor, type DrAnyOverlayUtilConstructor, type DrAnyShapeUtilConstructor, type DrAssetUtilConstructor, type DrBackgroundProps, type DrBaseBoxShape, type DrBaseEventInfo, type DrBaseExternalContent, type DrBindingUtilConstructor, type DrCLickEventName, type DrCameraConstraints, type DrCameraEndPerfEvent, type DrCameraMoveOptions, type DrCameraOptions, type DrCameraStartPerfEvent, type DrCancelEvent, type DrCancelEventInfo, type DrCanvasComponentProps, type DrClickEvent, type DrClickEventInfo, type DrClickState, type DrClipboardPasteRawInfo, type DrClipboardWriteInfo, type DrCollaboratorCursorLayout, type DrCollaboratorCursorProps, type DrCompleteEvent, type DrCompleteEventInfo, type DrContent, type DrCropInfo, type DrCurrentUser, type DrCursorProps, type DrDeepLink, type DrDeepLinkOptions, type DrDragShapesInInfo, type DrDragShapesOutInfo, type DrDragShapesOverInfo, type DrDrawExternalContent, type DrDrawExternalContentSource, type DrDropShapesOverInfo, type DrEditStartInfo, type DrEditorComponents, type DrEditorOptions, type DrEditorRunOptions, type DrEditorSnapshot, type DrEmbedExternalContent, type DrEnterEventHandler, type DrErrorBoundaryProps, type DrErrorExternalContentSource, type DrErrorFallbackComponent, type DrErrorFallbackProps, type DrEventHandlers, type DrEventInfo, type DrEventMap, type DrEventMapHandler, type DrEventName, type DrExcalidrawExternalContent, type DrExcalidrawExternalContentSource, type DrExitEventHandler, type DrExportType, type DrExternalAsset, type DrExternalContent, type DrExternalContentSource, type DrFileExternalAsset, type DrFileReplaceExternalContent, type DrFilesExternalContent, type DrFramePerfEvent, type DrGeometryOpts, type DrGetShapeAtPointOptions, type DrGridProps, type DrHandleDragInfo, type DrHistoryBatchOptions, type DrHistoryDiff, type DrHistoryEntry, type DrHistoryMark, type DrImageExportOptions, type DrIndicatorPath, type DrInteractionEndPerfEvent, type DrInteractionStartPerfEvent, type DrInterruptEvent, type DrInterruptEventInfo, type DrKeyboardEvent, type DrKeyboardEventInfo, type DrKeyboardEventName, type DrLoadSessionStateSnapshotOptions, type DrLoadSnapshotOptions, type DrLodStyle, type DrMeasureTextOpts, type DrMeasureTextSpanOpts, type DrMeasuredTextSize, type DrMiroExternalContent, type DrMiroExternalContentSource, type DrOnMountHandler, type DrOverlay, type DrOverlayEntry, type DrOverlayUtilConstructor, type DrPerfEventMap, type DrPerfFrameTimeStats, type DrPerfLongAnimationFrame, type DrPerfLongAnimationFrameScript, type DrPinchEvent, type DrPinchEventInfo, type DrPinchEventName, type DrPointerEvent, type DrPointerEventInfo, type DrPointerEventName, type DrPointerEventTarget, type DrRenderingShape, type DrResizeHandle, type DrResizeInfo, type DrResizeMode, type DrResizeShapeOptions, type DrRotationSnapshot, type DrSelectionHandle, type DrSessionStateSnapshot, type DrShapeErrorFallbackComponent, type DrShapeOperationPerfEvent, type DrShapeUtilCanBeLaidOutOpts, type DrShapeUtilCanBindOpts, type DrShapeUtilCanvasSvgDef, type DrShapeUtilConstructor, type DrShapeWrapperProps, type DrSpinnerProps, type DrStateNodeConstructor, type DrStoreBaseOptions, type DrStoreEventInfo, type DrStoreOptions, type DrStoreSchemaOptions, type DrStoreWithStatus, type DrSvgExportOptions, type DrSvgTextExternalContent, type DrTextExternalContent, type DrTextExternalContentSource, type DrTextOptions, type DrTickEvent, type DrTickEventInfo, type DrUndoRedoPerfEvent, type DrUpdatePointerOptions, type DrUrlExternalAsset, type DrUrlExternalContent, type DrUserPreferences, type DrWheelEvent, type DrWheelEventInfo, DrawEditor, type DrawEditorBaseProps, type DrawEditorProps, type DrawEditorStoreProps, type DrawEditorWithStoreProps, type DrawEditorWithoutStoreProps, type DrawOptions, EASINGS, EVENT_NAME_MAP, Edge2d, EdgeScrollManager, Editor, EditorAtom, EditorContext, EditorManager, EditorPortal, type EditorPortalProps, EditorProvider, type EditorProviderProps, Ellipse2d, ErrorBoundary, ErrorScreen, FontManager, type GapsSnapIndicator, Geometry2d, Geometry2dFilters, type Geometry2dOptions, Group2d, GroupShapeUtil, HALF_PI, HTMLContainer, type HTMLContainerProps, type HandleSnapGeometry, HandleSnaps, HistoryManager, InputsManager, LoadingScreen, type LoadingScreenProps, LocalIndexedDb, Mat, type MatLike, type MatModel, MenuClickCapture, OptionalErrorBoundary, type OptionalKeys, OverlayManager, type OverlayOptionsWithDisplayValues, OverlayUtil, PI, PI2, type PerfectDashTerminal, PerformanceApiAdapter, PerformanceManager, Point2d, type PointsSnapIndicator, Polygon2d, Polyline2d, ROTATE_CORNER_TO_SELECTION_CORNER, ReadonlySharedStyleMap, Rectangle2d, type RequiredKeys, type ResizeBoxOptions, type RichTextFontVisitor, type RichTextFontVisitorState, type RotateCorner, SIDES, SIN, SVGContainer, type SVGContainerProps, type SafeId, type ScribbleItem, ScribbleManager, type ScribbleSessionOptions, type SelectionCorner, type SelectionEdge, type SelectionHandle, ShapeUtil, type SharedStyle, SharedStyleMap, type SnapData, type SnapIndicator, SnapManager, SpatialIndexManager, Stadium2d, StateNode, type StoreName, type SvgExportContext, type SvgExportDef, TAB_ID, Table, TextManager, ThemeManager, TickManager, type TiptapEditor, type TiptapNode, TransformedGeometry2d, type TransformedGeometry2dOptions, USER_COLORS, type UiEvent, type UiEventType, UserPreferencesManager, Vec, type VecLike, activeElementShouldCaptureKeys, angleDistance, applyRotationToSnapshotShapes, approximately, areAnglesCompatible, average, canonicalizeRotation, centerOfCircleFromThreePoints, clamp, clampRadians, clampToBrowserMaxCanvasSize, clockwiseAngleDist, coreShapes, counterClockwiseAngleDist, createDebugValue, createDeepLinkString, createDrCurrentUser, createDrSchemaFromUtils, createDrStore, createSessionStateSnapshotSignal, dataUrlToFile, debugFlags, defaultDrawOptions, defaultUserPreferences, defaultUserStore, degreesToRadians, elementShouldCaptureKeys, extractSessionStateFromLegacySnapshot, featureFlags, getArcMeasure, getColorValue, getCursor, getDefaultCdnBaseUrl, getDroppedShapesToNewParents, getFontsFromRichText, getFreshUserPreferences, getGlobalDocument, getGlobalWindow, getIncrementedName, getOverlayDisplayValues, getOwnerDocument, getOwnerWindow, getPerfectDashProps, getPointInArcT, getPointOnCircle, getPointerInfo, getPointsOnArc, getPolygonVertices, getRotationSnapshot, getSnapshot, getSvgAsImage, getSvgPathFromPoints, getUserPreferences, getVerticesCountForArcLength, hardReset, hardResetEditor, inlineBase64AssetStore, intersectCircleCircle, intersectCirclePolygon, intersectCirclePolyline, intersectLineSegmentCircle, intersectLineSegmentLineSegment, intersectLineSegmentPolygon, intersectLineSegmentPolyline, intersectPolygonBounds, intersectPolygonPolygon, isAccelKey, isCursorInViewport, isSafeFloat, kickoutOccludedShapes, linesIntersect, loadSessionStateSnapshotIntoStore, loadSnapshot, loopToHtmlElement, maybeSnapToGrid, moveElementInto, normalizeWheel, openWindow, parseDeepLinkString, perimeterOfEllipse, pointInPolygon, polygonIntersectsPolyline, polygonsIntersect, precise, preventDefault, radiansToDegrees, rangeIntersection, refreshPage, releasePointerCapture, resizeBox, resizeScaled, resolveLineHeightPx, resolveThemes, rotateSelectionHandle, runtime, sanitizeId, setPointerCapture, setRuntimeOverrides, setUserPreferences, shortAngleDist, snapAngle, stopEventPropagation, strokeShapeIndicators, suffixSafeId, tleditors, tlenv, tlenvReactive, tlmenus, tltime, toDomPrecision, toFixed, toPrecision, uniq, useColorMode, useContainer, useContainerIfExists, useDelaySvgExport, useDrSchemaFromUtils, useDrStore, useDrawCurrentUser, useEditor, useEditorComponents, useEditorPortalHost, useEvent, useGlobalMenuIsOpen, useIsCropping, useIsEditing, useLocalStore, useMaybeEditor, useOnMount, usePassThroughWheelEvents, usePeerIds, usePresence, useReactiveEvent, useRefState, useShallowArrayIdentity, useShallowObjectIdentity, useSharedSafeId, useSvgExportContext, useTransform, useUniqueSafeId, useViewportHeight, userTypeValidator };
|