@ibodr/editor 0.2.5 → 0.2.7

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 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, AtomSet, HistoryEntry, StoreSideEffects, SerializedStore, StoreSchema } from '@ibodr/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, VecModel, BoxModel, DrHandle, DrShapeId, DrCursorType, DrUnknownShape, DrShapePartial, DrFontFace, DrShapeCrop, DrParentId, DrGroupShape, DrPageId, DrBoardBackgroundType, DrStore, DrStoreSnapshot, DrUser, DrRichText, StyleProp, DrInstancePresence, DrScribble, DrDefaultHorizontalAlignStyle, DrRecord, 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';
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' | 'triple_click' | 'quadruple_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;
@@ -1859,6 +1913,29 @@ declare abstract class ShapeUtil<Shape extends DrShape = DrShape> {
1859
1913
  * @public
1860
1914
  */
1861
1915
  onBeforeCreate?(next: Shape): Shape | void;
1916
+ /**
1917
+ * A callback called when a shape is reproduced from an existing shape, either by duplicating
1918
+ * ({@link Editor.duplicateShapes}) or by pasting/putting content onto the page
1919
+ * ({@link Editor.putContentOntoCurrentPage}). This provides a last chance to modify the copy
1920
+ * before it's created — for example, to re-stamp attribution so the copy is credited to the
1921
+ * current user rather than the original author. It is not called when content is put with
1922
+ * `preserveIds` (e.g. {@link Editor.moveShapesToPage}), since the shape keeps its identity
1923
+ * and no copy is made.
1924
+ *
1925
+ * @example
1926
+ *
1927
+ * ```ts
1928
+ * onBeforeDuplicate = (source, duplicate) => {
1929
+ * return { ...duplicate, props: { ...duplicate.props, editedBy: this.editor.getAttributionUserId() } }
1930
+ * }
1931
+ * ```
1932
+ *
1933
+ * @param source - The shape being copied from.
1934
+ * @param duplicate - The new copy (with its own id), before it's created.
1935
+ * @returns The next shape or void.
1936
+ * @public
1937
+ */
1938
+ onBeforeDuplicate?(source: Shape, duplicate: Shape): Shape | void;
1862
1939
  /**
1863
1940
  * A callback called just before a shape is updated. This method provides a last chance to modify
1864
1941
  * the updated shape.
@@ -2136,6 +2213,45 @@ declare abstract class ShapeUtil<Shape extends DrShape = DrShape> {
2136
2213
  * @public
2137
2214
  */
2138
2215
  onEditEnd?(shape: Shape): void;
2216
+ /**
2217
+ * Provide an app-owned element to be rendered inside the shape, alongside the output of
2218
+ * {@link ShapeUtil.component}. While the shape remains mounted, tldraw guarantees the
2219
+ * element keeps the same DOM position: it is never unmounted, recreated, or relocated by
2220
+ * reordering, reparenting, culling, or re-renders. When adopting the element, tldraw uses
2221
+ * `Node.moveBefore` where available so stateful content like cross-origin iframes keeps
2222
+ * its state across the move, falling back to `appendChild` elsewhere.
2223
+ *
2224
+ * Pair this with {@link ShapeUtil.onReleaseAppOwnedElement} to reclaim the element before
2225
+ * the shape or editor unmounts.
2226
+ *
2227
+ * This is called once per shape mount, not on every prop change, so the adopted element is
2228
+ * not refreshed when the shape's props change. If the element's content depends on props,
2229
+ * return a stable element and mutate it in place (for example from {@link ShapeUtil.component}
2230
+ * or an effect) rather than returning a different element.
2231
+ *
2232
+ * @param shape - The shape.
2233
+ * @returns The element to adopt, or null to render nothing.
2234
+ * @public
2235
+ */
2236
+ getAppOwnedElement?(shape: Shape): HTMLElement | null;
2237
+ /**
2238
+ * A callback called before the shape's app-owned element slot is destroyed: when the shape
2239
+ * unmounts (for example when it is deleted or the current page changes) or when the whole
2240
+ * editor unmounts, including error teardown. The slot is still connected to the document
2241
+ * when this is called, so the app can move the element to another connected parent with
2242
+ * `Node.moveBefore` to preserve its state. An element left in the slot is destroyed along
2243
+ * with it.
2244
+ *
2245
+ * This is not only a "shape deleted" signal: it also fires on page changes, editor unmount,
2246
+ * and (in dev under React StrictMode) on the throwaway mount/unmount cycle while the shape
2247
+ * still exists. Make it safe to call when the shape is still present, and check the store
2248
+ * (`this.editor.getShape(shape.id)`) if you need to distinguish deletion from a remount.
2249
+ *
2250
+ * @param shape - The shape.
2251
+ * @param element - The element returned by {@link ShapeUtil.getAppOwnedElement}.
2252
+ * @public
2253
+ */
2254
+ onReleaseAppOwnedElement?(shape: Shape, element: HTMLElement): void;
2139
2255
  }
2140
2256
  /**
2141
2257
  * Info about a crop.
@@ -2154,6 +2270,7 @@ interface DrCropInfo<T extends DrShape> {
2154
2270
  };
2155
2271
  initialShape: T;
2156
2272
  aspectRatioLocked?: boolean;
2273
+ isResizingFromCenter?: boolean;
2157
2274
  }
2158
2275
  /** @public */
2159
2276
  interface DrDragShapesInInfo {
@@ -2380,6 +2497,11 @@ interface DrDrawLegacyExternalContentSource {
2380
2497
  type DrExternalContentSource = DrDrawExternalContentSource | DrDrawLegacyExternalContentSource | DrExcalidrawExternalContentSource | DrMiroExternalContentSource | DrTextExternalContentSource | DrErrorExternalContentSource;
2381
2498
  /** @public */
2382
2499
  interface DrBaseExternalContent {
2500
+ /**
2501
+ * The other content sources found on the clipboard alongside this content. For example, when
2502
+ * pasting an image copied together with HTML and plain text, the `files` content will have
2503
+ * text sources for the HTML and plain text parts.
2504
+ */
2383
2505
  sources?: DrExternalContentSource[];
2384
2506
  point?: VecLike;
2385
2507
  }
@@ -2407,6 +2529,11 @@ interface DrFileReplaceExternalContent extends DrBaseExternalContent {
2407
2529
  interface DrUrlExternalContent extends DrBaseExternalContent {
2408
2530
  type: 'url';
2409
2531
  url: string;
2532
+ /**
2533
+ * A shape to set the url on, instead of creating a bookmark or an embed. The shape must have a
2534
+ * `url` prop; the clipboard sets this when a link is pasted with one such shape selected.
2535
+ */
2536
+ shapeId?: DrShapeId;
2410
2537
  }
2411
2538
  /** @public */
2412
2539
  interface DrSvgTextExternalContent extends DrBaseExternalContent {
@@ -2839,6 +2966,7 @@ interface DrawOptions {
2839
2966
  readonly collaboratorCheckIntervalMs: number;
2840
2967
  readonly cameraMovingTimeoutMs: number;
2841
2968
  readonly hitTestMargin: number;
2969
+ readonly coarseHitTestMargin: number;
2842
2970
  readonly edgeScrollDelay: number;
2843
2971
  readonly edgeScrollEaseDuration: number;
2844
2972
  readonly edgeScrollSpeed: number;
@@ -3076,7 +3204,8 @@ declare const defaultDrawOptions: {
3076
3204
  readonly collaboratorIdleTimeoutMs: 3000;
3077
3205
  readonly collaboratorCheckIntervalMs: 1200;
3078
3206
  readonly cameraMovingTimeoutMs: 64;
3079
- readonly hitTestMargin: 8;
3207
+ readonly hitTestMargin: 3;
3208
+ readonly coarseHitTestMargin: 4;
3080
3209
  readonly edgeScrollDelay: 200;
3081
3210
  readonly edgeScrollEaseDuration: 200;
3082
3211
  readonly edgeScrollSpeed: 25;
@@ -3159,7 +3288,7 @@ declare class SharedStyleMap extends ReadonlySharedStyleMap {
3159
3288
  }
3160
3289
 
3161
3290
  /** @public */
3162
- type DrClickState = 'idle' | 'pendingDouble' | 'pendingTriple' | 'pendingQuadruple' | 'pendingOverflow' | 'overflow';
3291
+ type DrClickState = 'idle' | 'pendingDouble' | 'pendingOverflow' | 'overflow';
3163
3292
  /** @public */
3164
3293
  declare class ClickManager {
3165
3294
  editor: Editor;
@@ -3168,6 +3297,7 @@ declare class ClickManager {
3168
3297
  private _clickTimeout?;
3169
3298
  private _clickScreenPoint?;
3170
3299
  private _previousScreenPoint?;
3300
+ private _isPressingWhilePending;
3171
3301
  _getClickTimeout(state: DrClickState, id?: string): void;
3172
3302
  /**
3173
3303
  * The current click state.
@@ -3329,6 +3459,10 @@ declare class HistoryManager<R extends UnknownRecord> {
3329
3459
  getNumUndos(): number;
3330
3460
  getNumRedos(): number;
3331
3461
  /** @internal */
3462
+ private _isReplaying;
3463
+ /** @internal */
3464
+ isReplaying(): boolean;
3465
+ /** @internal */
3332
3466
  _isInBatch: boolean;
3333
3467
  batch(fn: () => void, opts?: DrHistoryBatchOptions): this;
3334
3468
  _undo({ pushToRedoStack, toMark }: {
@@ -3358,9 +3492,123 @@ declare class HistoryManager<R extends UnknownRecord> {
3358
3492
  }
3359
3493
 
3360
3494
  /** @public */
3361
- declare class InputsManager {
3362
- private readonly editor;
3495
+ interface DrEventMap {
3496
+ mount: [];
3497
+ unmount: [];
3498
+ 'max-shapes': [{
3499
+ name: string;
3500
+ pageId: DrPageId;
3501
+ count: number;
3502
+ }];
3503
+ change: [HistoryEntry<DrRecord>];
3504
+ update: [];
3505
+ crash: [{
3506
+ error: unknown;
3507
+ }];
3508
+ 'stop-camera-animation': [];
3509
+ 'stop-following': [];
3510
+ 'before-event': [DrEventInfo];
3511
+ event: [DrEventInfo];
3512
+ tick: [number];
3513
+ frame: [number];
3514
+ resize: [BoxModel];
3515
+ 'select-all-text': [{
3516
+ shapeId: DrShapeId;
3517
+ }];
3518
+ 'place-caret': [{
3519
+ shapeId: DrShapeId;
3520
+ point: {
3521
+ x: number;
3522
+ y: number;
3523
+ };
3524
+ }];
3525
+ 'created-shapes': [DrRecord[]];
3526
+ 'edited-shapes': [DrRecord[]];
3527
+ 'deleted-shapes': [DrShapeId[]];
3528
+ /**
3529
+ * Fired after a successful Miro clipboard paste (`miro-data-v1`).
3530
+ * Payload is produced by `@ibodr/draw` putMiroContent.
3531
+ */
3532
+ 'paste-miro': [
3533
+ {
3534
+ shapeCount: number;
3535
+ shapeIds: DrShapeId[];
3536
+ widgetTypes: string[];
3537
+ miroBoardId: string | null;
3538
+ miroHost: string | null;
3539
+ }
3540
+ ];
3541
+ edit: [];
3542
+ dispose: [];
3543
+ }
3544
+ /** @public */
3545
+ type DrEventMapHandler<T extends keyof DrEventMap> = (...args: DrEventMap[T]) => void;
3546
+
3547
+ /**
3548
+ * Base class for editor-attached managers that need to clean up after themselves.
3549
+ *
3550
+ * Extending `EditorManager` gives a manager one consistent teardown contract: register
3551
+ * anything that needs undoing, and it runs automatically on `dispose()`. This keeps
3552
+ * subscription lifecycle symmetric — whatever sets a thing up is what tears it down — so
3553
+ * it can't be forgotten (the failure mode behind the strict-mode camera bug, #8892).
3554
+ *
3555
+ * Register cleanup by what you're creating:
3556
+ *
3557
+ * - Editor bus event (`tick`, `frame`, `change`, …): {@link EditorManager.addEditorEvent}
3558
+ * - Store side effect (`editor.sideEffects.register…`): `this.register(disposer)`
3559
+ * - Reaction (`react(...)` from `@ibodr/state`): `this.register(react(...))`
3560
+ * - DOM listener: `this.register(() => el.removeEventListener(...))`
3561
+ * - Other resource (cache, index, child manager): `this.register(() => x.dispose())`
3562
+ * - Resource held only part of the time (a listener attached while subscribers exist):
3563
+ * `this.register(...)` on attach and `this.unregister(...)` on detach, see `PerformanceManager`
3564
+ *
3565
+ * For timeouts, intervals, and animation frames prefer `editor.timers` (context-grouped
3566
+ * and auto-disposed) over raw `setTimeout`. For cleanup on the editor itself rather than a
3567
+ * manager, use `editor.disposables`.
3568
+ *
3569
+ * If a manager needs ordered teardown (e.g. pause a loop before cancelling it), override
3570
+ * `dispose()` and call `super.dispose()` last — see `TickManager`.
3571
+ *
3572
+ * @public
3573
+ */
3574
+ declare abstract class EditorManager {
3575
+ protected readonly editor: Editor;
3576
+ protected readonly disposables: Set<() => void>;
3577
+ constructor(editor: Editor);
3578
+ /**
3579
+ * Register a teardown function to run on `dispose()`. The universal way for a manager to
3580
+ * make a resource "see itself out". Returns the same function for convenience.
3581
+ */
3582
+ protected register(dispose: () => void): () => void;
3583
+ /**
3584
+ * Run a registered teardown now instead of at `dispose()`. A teardown that is no longer
3585
+ * registered (already run by `dispose()`, or never registered) is skipped, so nothing is
3586
+ * torn down twice.
3587
+ */
3588
+ protected unregister(dispose: () => void): void;
3589
+ /**
3590
+ * Subscribe to an editor bus event and register the matching unsubscribe, so the listener
3591
+ * is removed automatically on `dispose()`. Returns that unsubscribe, for passing to
3592
+ * {@link EditorManager.unregister} to detach it before `dispose()`.
3593
+ */
3594
+ protected addEditorEvent<E extends keyof DrEventMap>(event: E, fn: (...args: DrEventMap[E]) => void): () => void;
3595
+ /** @internal */
3596
+ dispose(): void;
3597
+ }
3598
+
3599
+ /** @public */
3600
+ declare class InputsManager extends EditorManager {
3363
3601
  constructor(editor: Editor);
3602
+ private _detachActivityListenersFn;
3603
+ /**
3604
+ * User input anywhere in the editor's tab counts as activity for collaborator presence —
3605
+ * presence means "this person is here", whether or not the input lands on the editor itself
3606
+ * (e.g. typing in a sidebar next to the canvas). Listen in the capture phase so input that
3607
+ * other handlers swallow still counts.
3608
+ */
3609
+ private _attachActivityListeners;
3610
+ private _detachActivityListeners;
3611
+ private _onFrame;
3364
3612
  private _originPagePoint;
3365
3613
  /**
3366
3614
  * The most recent pointer down's position in the current page space.
@@ -3425,8 +3673,7 @@ declare class InputsManager {
3425
3673
  */
3426
3674
  get pointerVelocity(): Vec;
3427
3675
  /**
3428
- * Normally you shouldn't need to set the pointer velocity directly, this is set by the tick manager.
3429
- * However, this is currently used in tests to fake pointer velocity.
3676
+ * Normally you shouldn't need to set the pointer velocity directly. Used in tests to fake pointer velocity.
3430
3677
  * @param pointerVelocity - The pointer velocity.
3431
3678
  * @internal
3432
3679
  */
@@ -3617,6 +3864,26 @@ declare class InputsManager {
3617
3864
  */
3618
3865
  setIsSpacebarPanning(isSpacebarPanning: boolean): void;
3619
3866
  private _getHasCollaborators;
3867
+ private readonly _throttledActivityStamp;
3868
+ /**
3869
+ * Mark the current user as active for collaborator presence. User input anywhere in the
3870
+ * editor's tab counts as activity automatically; call this to make input that doesn't produce
3871
+ * DOM events count too, so peers don't classify this user as idle or inactive while they're
3872
+ * still interacting. Calls are throttled on the leading edge, so it's safe to call from
3873
+ * high-frequency input events.
3874
+ *
3875
+ * @example
3876
+ * ```ts
3877
+ * // Gamepads are polled rather than event-driven, so stamp activity from the poll
3878
+ * editor.timers.setInterval(() => {
3879
+ * const isPressed = navigator
3880
+ * .getGamepads()
3881
+ * .some((pad) => pad?.buttons.some((button) => button.pressed))
3882
+ * if (isPressed) editor.inputs.markActivity()
3883
+ * }, 50)
3884
+ * ```
3885
+ */
3886
+ markActivity(): void;
3620
3887
  /**
3621
3888
  * The previous point used for velocity calculation (updated each tick, not each pointer event).
3622
3889
  * @internal
@@ -3861,18 +4128,12 @@ interface DrPerfEventMap {
3861
4128
  *
3862
4129
  * @public
3863
4130
  */
3864
- declare class PerformanceManager {
4131
+ declare class PerformanceManager extends EditorManager {
3865
4132
  /** @internal */
3866
4133
  readonly emitter: EventEmitter<DrPerfEventMap, any>;
3867
- private editor;
3868
4134
  private activeInteraction;
3869
4135
  private activeCamera;
3870
- private frameCleanup;
3871
- private shapeCreatedCleanup;
3872
- private shapeEditedCleanup;
3873
- private shapeDeletedCleanup;
3874
- private loafObserver;
3875
- constructor(editor: Editor);
4136
+ private readonly lazyCleanups;
3876
4137
  /**
3877
4138
  * Subscribe to a performance event. Returns an unsubscribe function.
3878
4139
  *
@@ -3911,11 +4172,11 @@ declare class PerformanceManager {
3911
4172
  private _onShapesEdited;
3912
4173
  private _onShapesDeleted;
3913
4174
  private _startLoafObserver;
3914
- private _stopLoafObserver;
3915
4175
  private _needsFrameListener;
3916
4176
  private _needsLoafObserver;
3917
4177
  private _maybeAttachLazyListeners;
3918
4178
  private _maybeDetachLazyListeners;
4179
+ private _detachLazy;
3919
4180
  }
3920
4181
 
3921
4182
  /** @public */
@@ -4076,6 +4337,18 @@ declare class ScribbleManager {
4076
4337
  private tickGroupedFade;
4077
4338
  }
4078
4339
 
4340
+ /**
4341
+ * The whole-pixel line-height for a given font size and tldraw's unitless line-height
4342
+ * multiplier. tldraw's theme stores line-height as a multiplier (e.g. 1.35); resolving it
4343
+ * to a whole pixel keeps line spacing identical across rendering engines, which otherwise
4344
+ * disagree on fractional line boxes (WebKit snaps them to whole pixels, Blink keeps the
4345
+ * fraction) and let multi-line text drift apart. Apply it everywhere line-height is used —
4346
+ * measurement, on-canvas render, and export — so geometry and rendering agree.
4347
+ * See https://github.com/tldraw/tldraw/issues/8970.
4348
+ *
4349
+ * @public
4350
+ */
4351
+ declare function resolveLineHeightPx(fontSize: number, lineHeight: number): number;
4079
4352
  /** @public */
4080
4353
  interface BatchMeasurementRequest {
4081
4354
  html: string;
@@ -4121,8 +4394,7 @@ interface DrMeasureTextSpanOpts {
4121
4394
  measureScrollWidth?: boolean;
4122
4395
  }
4123
4396
  /** @public */
4124
- declare class TextManager {
4125
- editor: Editor;
4397
+ declare class TextManager extends EditorManager {
4126
4398
  private elm;
4127
4399
  private poolElms;
4128
4400
  constructor(editor: Editor);
@@ -4130,7 +4402,6 @@ declare class TextManager {
4130
4402
  private resetElementStyles;
4131
4403
  private setElementStyles;
4132
4404
  private getMeasureStyles;
4133
- dispose(): void;
4134
4405
  private ensurePoolSize;
4135
4406
  private getPoolItem;
4136
4407
  measureHtmlBatch(requests: BatchMeasurementRequest[]): DrMeasuredTextSize[];
@@ -4168,6 +4439,7 @@ declare class UserPreferencesManager {
4168
4439
  private readonly user;
4169
4440
  private readonly colorScheme;
4170
4441
  systemColorScheme: _ibodr_state.Atom<"light" | "dark", unknown>;
4442
+ private readonly systemPrefersReducedMotion;
4171
4443
  disposables: Set<() => void>;
4172
4444
  dispose(): void;
4173
4445
  constructor(user: DrCurrentUser, colorScheme: 'light' | 'dark' | 'system' | 'inherit');
@@ -4195,7 +4467,25 @@ declare class UserPreferencesManager {
4195
4467
  getEdgeScrollSpeed(): number;
4196
4468
  getAnimationSpeed(): number;
4197
4469
  getAreKeyboardShortcutsEnabled(): boolean;
4470
+ /**
4471
+ * The current user's raw, app-provided id — the value set in the user's
4472
+ * {@link @ibodr/editor#DrUserPreferences}. Use this when you need the id your application
4473
+ * assigned to the user. To compare against or look up store records, use
4474
+ * {@link UserPreferencesManager.getRecordId} instead.
4475
+ */
4476
+ getExternalId(): string;
4477
+ /**
4478
+ * @deprecated Use {@link UserPreferencesManager.getExternalId} for the raw app-provided id, or
4479
+ * {@link UserPreferencesManager.getRecordId} for the prefixed `DrUserId` record id.
4480
+ */
4198
4481
  getId(): string;
4482
+ /**
4483
+ * The current user's id as a tldraw {@link @ibodr/schema#DrUserId} record id (prefixed
4484
+ * with `user:`). Use this when comparing against or looking up store records, such as a
4485
+ * presence record's `userId` or `followingUserId`. For the raw, app-provided id, use
4486
+ * {@link UserPreferencesManager.getExternalId}.
4487
+ */
4488
+ getRecordId(): DrUserId;
4199
4489
  getName(): string;
4200
4490
  getLocale(): string;
4201
4491
  getColor(): string;
@@ -4398,8 +4688,6 @@ declare abstract class StateNode implements Partial<DrEventHandlers> {
4398
4688
  onLongPress?(info: DrPointerEventInfo): void;
4399
4689
  onPointerUp?(info: DrPointerEventInfo): void;
4400
4690
  onDoubleClick?(info: DrClickEventInfo): void;
4401
- onTripleClick?(info: DrClickEventInfo): void;
4402
- onQuadrupleClick?(info: DrClickEventInfo): void;
4403
4691
  onRightClick?(info: DrPointerEventInfo): void;
4404
4692
  onMiddleClick?(info: DrPointerEventInfo): void;
4405
4693
  onKeyDown?(info: DrKeyboardEventInfo): void;
@@ -4413,58 +4701,6 @@ declare abstract class StateNode implements Partial<DrEventHandlers> {
4413
4701
  onExit?(info: any, to: string): void;
4414
4702
  }
4415
4703
 
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
4704
  /** @public */
4469
4705
  type DrResizeShapeOptions = Partial<{
4470
4706
  initialBounds: Box;
@@ -4645,6 +4881,19 @@ declare class Editor extends EventEmitter<DrEventMap> {
4645
4881
  * @public
4646
4882
  */
4647
4883
  isDisposed: boolean;
4884
+ private readonly _isMounted;
4885
+ /**
4886
+ * Whether the editor is currently mounted. This is `true` while the editor's component is
4887
+ * mounted in the DOM (after the `mount` event) and `false` before mount and after `unmount`.
4888
+ *
4889
+ * Unlike disposal, mounting is not terminal: the editor's component can unmount and remount
4890
+ * (for example when the canvas is replaced by an error fallback and restored) without the
4891
+ * editor itself being disposed. To react to the transitions, listen to the editor's `mount`
4892
+ * and `unmount` events.
4893
+ *
4894
+ * @public
4895
+ */
4896
+ getIsMounted(): boolean;
4648
4897
  /**
4649
4898
  * A manager for the editor's tick events.
4650
4899
  *
@@ -4684,6 +4933,9 @@ declare class Editor extends EventEmitter<DrEventMap> {
4684
4933
  setTimeout: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
4685
4934
  setInterval: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
4686
4935
  requestAnimationFrame: (callback: FrameRequestCallback) => number;
4936
+ clearTimeout: (id: number | undefined) => void;
4937
+ clearInterval: (id: number | undefined) => void;
4938
+ cancelAnimationFrame: (id: number | undefined) => void;
4687
4939
  dispose: () => void;
4688
4940
  };
4689
4941
  /**
@@ -5036,6 +5288,12 @@ declare class Editor extends EventEmitter<DrEventMap> {
5036
5288
  * @internal this is only used to implement some backwards-compatibility logic. Should be fine to delete after 6 months or whatever.
5037
5289
  */
5038
5290
  getMarkIdMatching(idSubstring: string): string | null;
5291
+ /**
5292
+ * Whether the editor is currently replaying history (i.e. an undo or redo is being applied).
5293
+ *
5294
+ * @internal
5295
+ */
5296
+ isReplayingHistory(): boolean;
5039
5297
  /**
5040
5298
  * Coalesces all changes since the given mark into a single change, removing any intermediate marks.
5041
5299
  *
@@ -5959,6 +6217,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
5959
6217
  *
5960
6218
  * @public */
5961
6219
  getBaseZoom(): number;
6220
+ private _getFitZoom;
5962
6221
  private _cameraOptions;
5963
6222
  /**
5964
6223
  * Get the current camera options.
@@ -6170,7 +6429,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
6170
6429
  * @param opts - The camera move options.
6171
6430
  * @public
6172
6431
  */
6173
- zoomToUser(userId: string, opts?: DrCameraMoveOptions): this;
6432
+ zoomToUser(userId: DrUserId, opts?: DrCameraMoveOptions): this;
6174
6433
  /** @internal */
6175
6434
  private _willSetInitialBounds;
6176
6435
  /**
@@ -6318,7 +6577,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
6318
6577
  getAttributionUser(userId: string | null): DrUser | null;
6319
6578
  /**
6320
6579
  * Collect user IDs referenced by a set of shapes via shape-specific props
6321
- * (e.g. `textFirstEditedBy` on notes).
6580
+ * (e.g. `textLastEditedBy` on notes).
6322
6581
  *
6323
6582
  * @internal
6324
6583
  */
@@ -6336,7 +6595,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
6336
6595
  *
6337
6596
  * @public
6338
6597
  */
6339
- startFollowingUser(userId: string): this;
6598
+ startFollowingUser(userId: DrUserId): this;
6340
6599
  /**
6341
6600
  * Stop viewport-following a user.
6342
6601
  *
@@ -6833,6 +7092,17 @@ declare class Editor extends EventEmitter<DrEventMap> {
6833
7092
  * @public
6834
7093
  */
6835
7094
  getCurrentPageBounds(): Box | undefined;
7095
+ /**
7096
+ * Get the hit-test margin in page space—the distance in page units within which a pointer is
7097
+ * considered to be touching a shape. This resolves to {@link DrawOptions.hitTestMargin} (or
7098
+ * {@link DrawOptions.coarseHitTestMargin} when using a coarse pointer) divided by the current
7099
+ * zoom level, so it stays a constant distance in screen space.
7100
+ *
7101
+ * @returns The hit-test margin in page space.
7102
+ *
7103
+ * @public
7104
+ */
7105
+ getHitTestMargin(): number;
6836
7106
  /**
6837
7107
  * Get the top-most selected shape at the given point, ignoring groups.
6838
7108
  *
@@ -7201,6 +7471,15 @@ declare class Editor extends EventEmitter<DrEventMap> {
7201
7471
  deleteBindings(bindings: (DrBinding | DrBindingId)[], { isolateShapes }?: {
7202
7472
  isolateShapes?: boolean | undefined;
7203
7473
  }): this;
7474
+ /**
7475
+ * Unguarded so that withIsolatedShapes can transiently isolate shapes for copy and export in
7476
+ * readonly mode; the public deleteBindings is what readonly blocks.
7477
+ *
7478
+ * @internal
7479
+ */
7480
+ _deleteBindings(bindings: (DrBinding | DrBindingId)[], { isolateShapes }?: {
7481
+ isolateShapes?: boolean | undefined;
7482
+ }): this;
7204
7483
  /**
7205
7484
  * Delete a binding by its ID. If the binding doesn't exist, it's ignored.
7206
7485
  */
@@ -7233,6 +7512,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
7233
7512
  center?: VecLike;
7234
7513
  }): this;
7235
7514
  private getChangesToTranslateShape;
7515
+ private getChangesToTranslateShapeByPageDelta;
7236
7516
  /**
7237
7517
  * Move shapes by a delta.
7238
7518
  *
@@ -7430,7 +7710,7 @@ declare class Editor extends EventEmitter<DrEventMap> {
7430
7710
  *
7431
7711
  * @public
7432
7712
  */
7433
- alignShapes(shapes: DrShapeId[] | DrShape[], operation: 'left' | 'center-horizontal' | 'right' | 'top' | 'center-vertical' | 'bottom'): this;
7713
+ alignShapes(shapes: DrShapeId[] | DrShape[], operation: 'left' | 'center-horizontal' | 'right' | 'top' | 'center-vertical' | 'bottom' | 'center'): this;
7434
7714
  /**
7435
7715
  * Distribute shape positions.
7436
7716
  *
@@ -7487,6 +7767,18 @@ declare class Editor extends EventEmitter<DrEventMap> {
7487
7767
  * @public
7488
7768
  */
7489
7769
  resizeShape(shape: DrShapeId | DrShape, scale: VecLike, opts?: DrResizeShapeOptions): this;
7770
+ /**
7771
+ * Get the update for a resized shape without committing it to the store. Interactions that
7772
+ * resize many shapes at once use this to collect all of the updates and commit them in a
7773
+ * single batch. Returns null when there is nothing to update.
7774
+ *
7775
+ * Shapes that are rotated out of alignment with the scale axis cannot be resized with a
7776
+ * single update; those shapes are resized immediately (as `resizeShape` would do) and null
7777
+ * is returned.
7778
+ *
7779
+ * @internal
7780
+ */
7781
+ getResizeShapePartial(shape: DrShapeId | DrShape, scale: VecLike, opts?: DrResizeShapeOptions): DrShapePartial | null;
7490
7782
  /** @internal */
7491
7783
  private _scalePagePoint;
7492
7784
  /** @internal */
@@ -7684,11 +7976,12 @@ declare class Editor extends EventEmitter<DrEventMap> {
7684
7976
  deleteShape(id: DrShapeId): this;
7685
7977
  deleteShape(shape: DrShape): this;
7686
7978
  /**
7687
- * Get all the current styles among the users selected shapes
7979
+ * Groups have no styles of their own: a style read or write on a selection applies to the
7980
+ * non-group shapes beneath each group, however deeply nested. Returns those shapes.
7688
7981
  *
7689
7982
  * @internal
7690
7983
  */
7691
- private _extractSharedStyles;
7984
+ private _getStyleableShapes;
7692
7985
  /**
7693
7986
  * A derived map containing all current styles among the user's selected shapes.
7694
7987
  *
@@ -8242,26 +8535,65 @@ declare class Editor extends EventEmitter<DrEventMap> {
8242
8535
  private _prevCursor;
8243
8536
  /** @internal */
8244
8537
  private _shiftKeyTimeout;
8245
- /** @internal */
8246
- _setShiftKeyTimeout(): void;
8538
+ /**
8539
+ * Release the shift modifier: clear its debounce timer id, drop the atom, and
8540
+ * dispatch a synthetic `key_up` so `inputs.keys` and tool `onKeyUp` handlers update.
8541
+ * Runs both as the 150ms debounce timer callback and when a pointer down flushes it.
8542
+ * @internal
8543
+ */
8544
+ _releaseShiftKey(): void;
8247
8545
  /** @internal */
8248
8546
  private _altKeyTimeout;
8249
- /** @internal */
8250
- _setAltKeyTimeout(): void;
8547
+ /**
8548
+ * Release the alt modifier. See {@link Editor._releaseShiftKey}.
8549
+ * @internal
8550
+ */
8551
+ _releaseAltKey(): void;
8251
8552
  /** @internal */
8252
8553
  private _ctrlKeyTimeout;
8253
- /** @internal */
8254
- _setCtrlKeyTimeout(): void;
8554
+ /**
8555
+ * Release the ctrl modifier. See {@link Editor._releaseShiftKey}.
8556
+ * @internal
8557
+ */
8558
+ _releaseCtrlKey(): void;
8255
8559
  /** @internal */
8256
8560
  private _metaKeyTimeout;
8257
- /** @internal */
8258
- _setMetaKeyTimeout(): void;
8561
+ /**
8562
+ * Release the meta modifier. See {@link Editor._releaseShiftKey}.
8563
+ * @internal
8564
+ */
8565
+ _releaseMetaKey(): void;
8566
+ /**
8567
+ * Flush any modifier still sitting in its 150ms release-debounce window, so a new
8568
+ * interaction (a pointer down) starts with correct modifier state instead of a
8569
+ * just-released key still being counted as held. A pending timer is exactly
8570
+ * "released but still counted as held"; a genuinely-held modifier has no timer
8571
+ * (-1) and is left alone.
8572
+ *
8573
+ * Each modifier is released through the same path its timer would have taken
8574
+ * (`_releaseShiftKey` and friends), which dispatches the synthetic `key_up` so
8575
+ * stale codes (e.g. `ShiftLeft`) leave `inputs.keys` and tool `onKeyUp` handlers run.
8576
+ * We clear every pending modifier atom and timer *first*, then dispatch: a synthetic
8577
+ * `key_up` reports all currently-held modifiers, so releasing them one at a time
8578
+ * would make each event re-confirm the not-yet-released ones and cancel their flush.
8579
+ * @internal
8580
+ */
8581
+ private _releaseDebouncedModifiers;
8259
8582
  /** @internal */
8260
8583
  private _restoreToolId;
8261
8584
  /** @internal */
8262
8585
  private _didPinch;
8263
8586
  /** @internal */
8264
8587
  private _selectedShapeIdsAtPointerDown;
8588
+ /**
8589
+ * Whether `_selectedShapeIdsAtPointerDown` holds a pre-gesture selection
8590
+ * captured by a `pointer_down` (the touch path) that a following pinch
8591
+ * should restore. False when no pointer_down preceded the pinch (the
8592
+ * Safari trackpad path uses gesture events), in which case `pinch_start`
8593
+ * captures the live selection instead.
8594
+ * @internal
8595
+ */
8596
+ private _didCaptureSelectionAtPointerDown;
8265
8597
  /** @internal */
8266
8598
  private _longPressTimeout;
8267
8599
  /** @internal */
@@ -8317,12 +8649,19 @@ declare class Editor extends EventEmitter<DrEventMap> {
8317
8649
  }
8318
8650
 
8319
8651
  /** @public */
8320
- type DrErrorFallbackComponent = ComponentType<{
8652
+ interface DrErrorFallbackProps {
8653
+ /** The error that was caught. */
8321
8654
  error: unknown;
8655
+ /**
8656
+ * Only set when the caller renders the fallback with an editor; the editor's own error
8657
+ * boundaries pass just `error`.
8658
+ */
8322
8659
  editor?: Editor;
8323
- }>;
8660
+ }
8661
+ /** @public */
8662
+ type DrErrorFallbackComponent = ComponentType<DrErrorFallbackProps>;
8324
8663
  /** @public @react */
8325
- declare const DefaultErrorFallback: DrErrorFallbackComponent;
8664
+ declare function DefaultErrorFallback({ error, editor }: DrErrorFallbackProps): react_jsx_runtime.JSX.Element;
8326
8665
 
8327
8666
  /** @public */
8328
8667
  interface DrGridProps {
@@ -8334,14 +8673,6 @@ interface DrGridProps {
8334
8673
  /** @public @react */
8335
8674
  declare function DefaultGrid({ x, y, z, size }: DrGridProps): react_jsx_runtime.JSX.Element;
8336
8675
 
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
8676
  /** @public */
8346
8677
  type DrShapeErrorFallbackComponent = ComponentType<{
8347
8678
  error: any;
@@ -8359,11 +8690,67 @@ interface DrShapeWrapperProps extends React.HTMLAttributes<HTMLDivElement> {
8359
8690
  /** @public @react */
8360
8691
  declare const DefaultShapeWrapper: React$1.ForwardRefExoticComponent<DrShapeWrapperProps & React$1.RefAttributes<HTMLDivElement>>;
8361
8692
 
8693
+ /** @public */
8694
+ type DrSpinnerProps = React.SVGProps<SVGSVGElement>;
8362
8695
  /** @public @react */
8363
- declare function DefaultSpinner(props: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
8696
+ declare function DefaultSpinner(props: DrSpinnerProps): react_jsx_runtime.JSX.Element;
8364
8697
 
8365
8698
  /** @public @react */
8366
- declare const DefaultSvgDefs: () => null;
8699
+ declare function DefaultSvgDefs(): null;
8700
+
8701
+ /**
8702
+ * The DOM node that {@link EditorPortal} renders into: an empty `display: contents` element the
8703
+ * editor renders last among its container's children, after the canvas and after the UI.
8704
+ *
8705
+ * Null until the container has mounted, so prefer {@link EditorPortal}, which handles that for you.
8706
+ *
8707
+ * @public
8708
+ */
8709
+ declare function useEditorPortalHost(): HTMLElement | null;
8710
+ /** @public */
8711
+ interface EditorPortalProps {
8712
+ children: ReactNode;
8713
+ }
8714
+ /**
8715
+ * Renders its children into the end of the editor's container, escaping the canvas layer.
8716
+ *
8717
+ * Use this for anything anchored to canvas coordinates that also has to draw over the UI — a
8718
+ * popover on a shape, a comment thread, an annotation panel. The `OnTheCanvas` and
8719
+ * `InFrontOfTheCanvas` slots are fixed layers, each its own stacking context, so content mounted
8720
+ * there can't paint above whatever outranks its layer whatever z-index it asks for. Mount in
8721
+ * whichever slot suits your data flow, wrap the part that needs its own layer in this, and give
8722
+ * that part a z-index.
8723
+ *
8724
+ * This package's own layers stop at 250 (`--dr-layer-canvas-in-front`); above that belongs to
8725
+ * whatever renders the UI. In `tldraw` that's `--dr-layer-panels` (300) and `--dr-layer-menus`
8726
+ * (400), defined by `tldraw`'s stylesheet rather than this one.
8727
+ *
8728
+ * Positioning still resolves against the editor's container, so a `position: absolute` child uses
8729
+ * ordinary container coordinates.
8730
+ *
8731
+ * Prefer this over `createPortal(children, useContainer())`, which picks its DOM position from the
8732
+ * commit that mounts it — landing the node ahead of the UI and of the "skip to main content" link
8733
+ * that only works while nothing precedes it. This host is a real element placed last, so ordering
8734
+ * is fixed rather than dependent on mount timing.
8735
+ *
8736
+ * @example
8737
+ * ```tsx
8738
+ * // 400 clears tldraw's menus layer; the bare editor's own layers stop at 250.
8739
+ * function ShapeAnnotation({ point }: { point: VecLike }) {
8740
+ * return (
8741
+ * <EditorPortal>
8742
+ * <div style={{ position: 'absolute', left: point.x, top: point.y, zIndex: 400 }}>
8743
+ * Above the UI
8744
+ * </div>
8745
+ * </EditorPortal>
8746
+ * )
8747
+ * }
8748
+ * ```
8749
+ *
8750
+ * @public
8751
+ * @react
8752
+ */
8753
+ declare function EditorPortal({ children }: EditorPortalProps): React$1.ReactPortal | null;
8367
8754
 
8368
8755
  /** @public */
8369
8756
  interface DrErrorBoundaryProps {
@@ -8480,20 +8867,50 @@ declare const DEFAULT_ANIMATION_OPTIONS: {
8480
8867
  /** @public */
8481
8868
  declare const SIDES: readonly ["top", "right", "bottom", "left"];
8482
8869
 
8870
+ /**
8871
+ * Optional adapter that pipes PerformanceManager events into browser
8872
+ * `performance.mark()` / `performance.measure()` for DevTools integration.
8873
+ *
8874
+ * Tree-shakeable — only included if imported.
8875
+ *
8876
+ * @example
8877
+ * ```ts
8878
+ * const adapter = new PerformanceApiAdapter(editor.performance)
8879
+ * // ... later
8880
+ * adapter.dispose()
8881
+ * ```
8882
+ *
8883
+ * @public
8884
+ */
8885
+ declare class PerformanceApiAdapter {
8886
+ private cleanups;
8887
+ constructor(perfManager: PerformanceManager);
8888
+ /** Remove all listeners and stop piping events. @public */
8889
+ dispose(): void;
8890
+ }
8891
+
8483
8892
  /**
8484
8893
  * Manages spatial indexing for efficient shape location queries.
8485
8894
  *
8486
8895
  * Uses an R-tree (via RBush) to enable O(log n) spatial queries instead of O(n) iteration.
8487
- * Handles shapes with computed bounds (arrows, groups, custom shapes) by checking all shapes'
8488
- * bounds on each update using the reactive bounds cache.
8896
+ * Derived-bounds changes (arrows following bound shapes, groups resizing with children) are
8897
+ * tracked structurally: each record diff is expanded into a dirty set covering the changed
8898
+ * shapes' descendants, ancestors, and binding partners, and only those shapes' bounds are
8899
+ * rechecked — O(affected) per update instead of O(page).
8489
8900
  *
8490
8901
  * Key features:
8491
- * - Incremental updates using filterHistory pattern
8492
- * - Leverages existing bounds cache reactivity for dependency tracking
8493
- * - Works with any custom shape type with computed bounds
8902
+ * - Incremental updates using filterHistory pattern (shape and binding history)
8903
+ * - Dirty-set expansion via parent/child and binding relationships
8494
8904
  * - Per-page index (rebuilds on page change)
8495
8905
  * - Optimized for viewport culling queries
8496
8906
  *
8907
+ * Known limitation: a custom shape whose geometry reads other shapes outside the
8908
+ * parent/child and binding relationships is not rechecked when those shapes change.
8909
+ * Core shapes only depend on other shapes via bindings (arrows) and parent/child
8910
+ * relationships (groups), which are both covered. This narrows the previous
8911
+ * approach, which rechecked every indexed shape on every update and so happened to
8912
+ * cover such shapes; the structural expansion trades that for O(affected) updates.
8913
+ *
8497
8914
  * @internal
8498
8915
  */
8499
8916
  declare class SpatialIndexManager {
@@ -8501,11 +8918,13 @@ declare class SpatialIndexManager {
8501
8918
  private rbush;
8502
8919
  private spatialIndexComputed;
8503
8920
  private lastPageId;
8921
+ private _boundsEpoch;
8504
8922
  constructor(editor: Editor);
8923
+ private rebuildAndBumpEpoch;
8505
8924
  private createSpatialIndexComputed;
8506
8925
  private buildFromScratch;
8507
8926
  private processIncrementalUpdate;
8508
- private areBoundsEqual;
8927
+ private areBoundsEqualToSpatialElement;
8509
8928
  /**
8510
8929
  * Get shape IDs within the given bounds.
8511
8930
  * Optimized for viewport culling queries.
@@ -8626,7 +9045,10 @@ declare class ThemeManager {
8626
9045
  /** Get the id of the current theme. */
8627
9046
  getCurrentThemeId(): DrThemeId;
8628
9047
  getCurrentTheme(): DrTheme;
8629
- /** Set the current theme by id. The theme must have been previously registered. */
9048
+ /**
9049
+ * Set the current theme by id. The theme must have been previously registered; an
9050
+ * unregistered id is ignored and the current theme is kept.
9051
+ */
8630
9052
  setCurrentTheme(id: DrThemeId): void;
8631
9053
  /** Replace all theme definitions, or update them via a callback that receives a deep copy. */
8632
9054
  updateThemes(themes: DrThemes | ((themes: DrThemes) => DrThemes)): void;
@@ -8637,8 +9059,7 @@ declare class ThemeManager {
8637
9059
  }
8638
9060
 
8639
9061
  /** @internal */
8640
- declare class TickManager {
8641
- editor: Editor;
9062
+ declare class TickManager extends EditorManager {
8642
9063
  constructor(editor: Editor);
8643
9064
  cancelRaf?: null | (() => void);
8644
9065
  isPaused: boolean;
@@ -8648,27 +9069,33 @@ declare class TickManager {
8648
9069
  dispose(): void;
8649
9070
  }
8650
9071
 
9072
+ /** @public */
9073
+ interface OverlayOptionsWithDisplayValues<Overlay extends DrOverlay, DisplayValues extends object> {
9074
+ getDefaultDisplayValues(editor: Editor, overlay: Overlay, theme: DrTheme, colorMode: 'light' | 'dark'): DisplayValues;
9075
+ getCustomDisplayValues(editor: Editor, overlay: Overlay, theme: DrTheme, colorMode: 'light' | 'dark'): Partial<DisplayValues>;
9076
+ }
8651
9077
  /**
8652
- * Optional adapter that pipes PerformanceManager events into browser
8653
- * `performance.mark()` / `performance.measure()` for DevTools integration.
9078
+ * Get the resolved display values for an overlay, merging the base values with any overrides.
8654
9079
  *
8655
- * Tree-shakeable — only included if imported.
9080
+ * @public
9081
+ */
9082
+ declare function getOverlayDisplayValues<Overlay extends DrOverlay, DisplayValues extends object>(util: {
9083
+ editor: Editor;
9084
+ options: OverlayOptionsWithDisplayValues<Overlay, DisplayValues>;
9085
+ }, overlay: Overlay, colorMode?: 'light' | 'dark'): DisplayValues;
9086
+
9087
+ /**
9088
+ * Combine every batchable shape indicator into a single page-space `Path2D` and
9089
+ * emit one stroke call. Shapes whose indicator needs an evenodd clip (e.g.
9090
+ * arrows with labels or complex arrowheads) can't be batched — they still
9091
+ * stroke individually inside a save/restore with `ctx.clip` applied.
8656
9092
  *
8657
- * @example
8658
- * ```ts
8659
- * const adapter = new PerformanceApiAdapter(editor.performance)
8660
- * // ... later
8661
- * adapter.dispose()
8662
- * ```
9093
+ * Shared by any overlay util that paints shape indicators (e.g. collaborator
9094
+ * selections).
8663
9095
  *
8664
9096
  * @public
8665
9097
  */
8666
- declare class PerformanceApiAdapter {
8667
- private cleanups;
8668
- constructor(perfManager: PerformanceManager);
8669
- /** Remove all listeners and stop piping events. @public */
8670
- dispose(): void;
8671
- }
9098
+ declare function strokeShapeIndicators(editor: Editor, ctx: CanvasRenderingContext2D, shapeIds: DrShapeId[]): void;
8672
9099
 
8673
9100
  /** @public */
8674
9101
  type DrBaseBoxShape = ExtractShapeByProps<{
@@ -8684,7 +9111,7 @@ declare abstract class BaseBoxShapeUtil<Shape extends DrBaseBoxShape> extends Sh
8684
9111
  }
8685
9112
 
8686
9113
  /**
8687
- * A base class for frame-like shapes — containers that clip their children,
9114
+ * A base class for frame-like shapes — containers that clip their children except arrows,
8688
9115
  * require full-brush selection, block erasure from inside, and support
8689
9116
  * drag-and-drop reparenting.
8690
9117
  *
@@ -8696,6 +9123,7 @@ declare abstract class BaseBoxShapeUtil<Shape extends DrBaseBoxShape> extends Sh
8696
9123
  * - `canReceiveNewChildrenOfType()` returns `true` unless the container is locked
8697
9124
  * - `canRemoveChildrenOfType()` returns `true` unless the container is locked
8698
9125
  * - `getClipPath()` returns the shape geometry's vertices
9126
+ * - `shouldClipChild()` clips all children except arrows
8699
9127
  * - `onDragShapesIn()` reparents shapes into the frame (with index restoration)
8700
9128
  * - `onDragShapesOut()` reparents shapes back to the page
8701
9129
  *
@@ -8731,70 +9159,11 @@ declare abstract class BaseFrameLikeShapeUtil<Shape extends DrBaseBoxShape> exte
8731
9159
  canReceiveNewChildrenOfType(shape: Shape, _type: DrShape['type']): boolean;
8732
9160
  canRemoveChildrenOfType(shape: Shape, _type: DrShape['type']): boolean;
8733
9161
  getClipPath(shape: Shape): Vec[] | undefined;
9162
+ shouldClipChild(child: DrShape): boolean;
8734
9163
  onDragShapesIn(shape: Shape, draggingShapes: DrShape[], { initialParentIds, initialIndices }: DrDragShapesInInfo): void;
8735
9164
  onDragShapesOut(shape: Shape, draggingShapes: DrShape[], info: DrDragShapesOutInfo): void;
8736
9165
  }
8737
9166
 
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
9167
  /** @public */
8799
9168
  type PerfectDashTerminal = 'skip' | 'outset' | 'none';
8800
9169
  /** @public */
@@ -8876,6 +9245,38 @@ declare function getSvgAsImage(svgString: string, options: {
8876
9245
  pixelRatio?: number;
8877
9246
  }): Promise<Blob | null>;
8878
9247
 
9248
+ /**
9249
+ * A global registry of currently mounted editor instances. Use it to discover live editors from
9250
+ * outside the React tree, for example from sidebar chrome, keyboard shortcuts, or multi-editor
9251
+ * layouts.
9252
+ *
9253
+ * @example
9254
+ * ```ts
9255
+ * tleditors.getMounted() // readonly Editor[]
9256
+ *
9257
+ * const editors = useValue('mounted editors', () => tleditors.getMounted(), [])
9258
+ * ```
9259
+ *
9260
+ * @public
9261
+ */
9262
+ declare const tleditors: {
9263
+ /**
9264
+ * A reactive list of currently mounted editor instances.
9265
+ *
9266
+ * An editor is added when it emits the `mount` event and removed when it emits `unmount`
9267
+ * (including when the editor is disposed while still mounted).
9268
+ *
9269
+ * @public
9270
+ */
9271
+ mounted: Signal<readonly Editor[]>;
9272
+ /**
9273
+ * Get the currently mounted editor instances.
9274
+ *
9275
+ * @public
9276
+ */
9277
+ getMounted(): readonly Editor[];
9278
+ };
9279
+
8879
9280
  /**
8880
9281
  * An object that contains information about the current device and environment.
8881
9282
  * This object is not reactive and will not update automatically when the environment changes,
@@ -8892,6 +9293,7 @@ declare const tlenv: {
8892
9293
  isWebview: boolean;
8893
9294
  isDarwin: boolean;
8894
9295
  hasCanvasSupport: boolean;
9296
+ isTouchDevice: boolean;
8895
9297
  };
8896
9298
  /**
8897
9299
  * An atom that contains information about the current device and environment.
@@ -9056,6 +9458,9 @@ declare const tlmenus: {
9056
9458
  */
9057
9459
  declare const tltime: Timers;
9058
9460
 
9461
+ /** @public */
9462
+ declare function useColorMode(): 'light' | 'dark';
9463
+
9059
9464
  /** @public */
9060
9465
  interface ContainerProviderProps {
9061
9466
  container: HTMLElement;
@@ -9072,10 +9477,12 @@ declare function useContainer(): HTMLElement;
9072
9477
  declare function useContainerIfExists(): HTMLElement | null;
9073
9478
 
9074
9479
  /** @public */
9075
- declare function useColorMode(): 'light' | 'dark';
9480
+ declare function getCursor(cursor: DrCursorType, rotation?: number, color?: string): string;
9076
9481
 
9077
9482
  /** @public */
9078
- declare function getCursor(cursor: DrCursorType, rotation?: number, color?: string): string;
9483
+ declare function useDrStore(opts: DrStoreOptions): _ibodr_schema.DrStore;
9484
+ /** @public */
9485
+ declare function useDrSchemaFromUtils(opts: DrStoreSchemaOptions): _ibodr_store.StoreSchema<_ibodr_schema.DrRecord, _ibodr_schema.DrStoreProps>;
9079
9486
 
9080
9487
  /** @public */
9081
9488
  declare const EditorContext: React__default.Context<Editor | null>;
@@ -9091,36 +9498,6 @@ interface EditorProviderProps {
9091
9498
  /** @public @react */
9092
9499
  declare function EditorProvider({ editor, children }: EditorProviderProps): react_jsx_runtime.JSX.Element;
9093
9500
 
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
9501
  /** @public */
9125
9502
  interface DrEditorComponents {
9126
9503
  Background?: ComponentType<DrBackgroundProps> | null;
@@ -9133,9 +9510,8 @@ interface DrEditorComponents {
9133
9510
  InFrontOfTheCanvas?: ComponentType | null;
9134
9511
  LoadingScreen?: ComponentType | null;
9135
9512
  OnTheCanvas?: ComponentType | null;
9136
- SelectionBackground?: ComponentType<DrSelectionBackgroundProps> | null;
9137
9513
  ShapeWrapper?: ComponentType<DrShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
9138
- Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
9514
+ Spinner?: ComponentType<DrSpinnerProps> | null;
9139
9515
  SvgDefs?: ComponentType | null;
9140
9516
  ErrorFallback?: DrErrorFallbackComponent;
9141
9517
  ShapeErrorFallback?: DrShapeErrorFallbackComponent;
@@ -9219,9 +9595,6 @@ declare function useLocalStore(options: {
9219
9595
  snapshot?: DrEditorSnapshot | DrStoreSnapshot;
9220
9596
  } & DrStoreOptions): DrStoreWithStatus;
9221
9597
 
9222
- /** @public */
9223
- declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement | null>): void;
9224
-
9225
9598
  /** @public */
9226
9599
  declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
9227
9600
 
@@ -9234,13 +9607,13 @@ declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>):
9234
9607
  * @returns The list of peer UserIDs
9235
9608
  * @public
9236
9609
  */
9237
- declare function usePeerIds(): string[];
9610
+ declare function usePeerIds(): _ibodr_schema.DrUserId[];
9238
9611
 
9239
9612
  /**
9240
9613
  * @returns The latest presence of the user matching userId
9241
9614
  * @public
9242
9615
  */
9243
- declare function usePresence(userId: string): DrInstancePresence | null;
9616
+ declare function usePresence(userId: DrUserId): DrInstancePresence | null;
9244
9617
 
9245
9618
  /**
9246
9619
  * A `useState` that uses a `ref` to keep the state in sync with the last value assigned to it.
@@ -9317,59 +9690,284 @@ declare function useSharedSafeId(id: string): SafeId;
9317
9690
  /** @public */
9318
9691
  declare function sanitizeId(id: string): string;
9319
9692
 
9320
- /** @public */
9321
- declare function useDrStore(opts: DrStoreOptions): _ibodr_schema.DrStore;
9322
- /** @public */
9323
- declare function useDrSchemaFromUtils(opts: DrStoreSchemaOptions): _ibodr_store.StoreSchema<_ibodr_schema.DrRecord, _ibodr_schema.DrStoreProps>;
9324
-
9325
- /** @public */
9693
+ /**
9694
+ * Position an element by writing its `transform` directly, outside React's render output — the
9695
+ * cheap path for elements that move at pointer/presence frequency.
9696
+ * @public
9697
+ */
9326
9698
  declare function useTransform(ref: React.RefObject<HTMLElement | SVGElement | null>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
9327
9699
 
9328
- /*!
9329
- * BSD License: https://github.com/outline/rich-markdown-editor/blob/main/LICENSE
9330
- * Copyright (c) 2020 General Outline, Inc (https://www.getoutline.com/) and individual contributors.
9700
+ /**
9701
+ * Whether a collaborator's cursor (page coords) is inside the viewport, with a small margin for the
9702
+ * cursor glyph so it isn't culled the instant its hotspot crosses the edge.
9331
9703
  *
9332
- * Returns the height of the viewport.
9333
- * This is mainly to account for virtual keyboards on mobile devices.
9704
+ * Single source of truth for the cursor/hint split: the DOM cursor layer renders a collaborator
9705
+ * when this is true, and `CollaboratorHintOverlayUtil` draws the viewport-edge hint when it's
9706
+ * false. Sharing the predicate keeps those two exhaustive and mutually exclusive — a margin change
9707
+ * can't open a dead zone (neither renders) or a double-render (both).
9334
9708
  *
9335
- * N.B. On iOS, you have to take into account the offsetTop as well so that you get an accurate position
9336
- * while using the virtual keyboard.
9709
+ * @public
9337
9710
  */
9338
- /** @public */
9339
- declare function useViewportHeight(): number;
9711
+ declare function isCursorInViewport(cursor: VecLike, viewport: {
9712
+ minX: number;
9713
+ minY: number;
9714
+ maxX: number;
9715
+ maxY: number;
9716
+ }, zoom: number): boolean;
9340
9717
 
9341
- /** @public */
9342
- declare const EASINGS: {
9343
- readonly linear: (t: number) => number;
9344
- readonly easeInQuad: (t: number) => number;
9345
- readonly easeOutQuad: (t: number) => number;
9346
- readonly easeInOutQuad: (t: number) => number;
9347
- readonly easeInCubic: (t: number) => number;
9348
- readonly easeOutCubic: (t: number) => number;
9349
- readonly easeInOutCubic: (t: number) => number;
9350
- readonly easeInQuart: (t: number) => number;
9351
- readonly easeOutQuart: (t: number) => number;
9352
- readonly easeInOutQuart: (t: number) => number;
9353
- readonly easeInQuint: (t: number) => number;
9354
- readonly easeOutQuint: (t: number) => number;
9355
- readonly easeInOutQuint: (t: number) => number;
9356
- readonly easeInSine: (t: number) => number;
9357
- readonly easeOutSine: (t: number) => number;
9358
- readonly easeInOutSine: (t: number) => number;
9359
- readonly easeInExpo: (t: number) => number;
9360
- readonly easeOutExpo: (t: number) => number;
9361
- readonly easeInOutExpo: (t: number) => number;
9362
- };
9363
-
9364
- /** @public */
9365
- declare class Arc2d extends Geometry2d {
9366
- private _center;
9367
- private _radius;
9368
- private _start;
9369
- private _end;
9370
- private _largeArcFlag;
9371
- private _sweepFlag;
9372
- private _measure;
9718
+ /**
9719
+ * Props for the {@link tldraw#Draw} and {@link DrawEditor} components, when passing in a
9720
+ * `DrStore` directly. If you would like tldraw to create a store for you, use
9721
+ * {@link DrawEditorWithoutStoreProps}.
9722
+ *
9723
+ * @public
9724
+ */
9725
+ interface DrawEditorWithStoreProps {
9726
+ /**
9727
+ * The store to use in the editor.
9728
+ */
9729
+ store: DrStore | DrStoreWithStatus;
9730
+ }
9731
+ /**
9732
+ * Props for the {@link tldraw#Draw} and {@link DrawEditor} components, when not passing in a
9733
+ * `DrStore` directly. If you would like to pass in a store directly, use
9734
+ * {@link DrawEditorWithStoreProps}.
9735
+ *
9736
+ * @public
9737
+ */
9738
+ interface DrawEditorWithoutStoreProps extends DrStoreBaseOptions {
9739
+ store?: undefined;
9740
+ /**
9741
+ * Additional migrations to use in the store
9742
+ */
9743
+ migrations?: readonly MigrationSequence[];
9744
+ /**
9745
+ * A starting snapshot of data to pre-populate the store. Do not supply both this and
9746
+ * `initialData`.
9747
+ */
9748
+ snapshot?: DrEditorSnapshot | DrStoreSnapshot;
9749
+ /**
9750
+ * If you would like to persist the store to the browser's local IndexedDB storage and sync it
9751
+ * across tabs, provide a key here. Each key represents a single tldraw document.
9752
+ */
9753
+ persistenceKey?: string;
9754
+ sessionId?: string;
9755
+ }
9756
+ /** @public */
9757
+ type DrawEditorStoreProps = DrawEditorWithStoreProps | DrawEditorWithoutStoreProps;
9758
+ /** @public */
9759
+ type DrawEditorProps = DrawEditorBaseProps & DrawEditorStoreProps;
9760
+ /**
9761
+ * Base props for the {@link tldraw#Draw} and {@link DrawEditor} components.
9762
+ *
9763
+ * @public
9764
+ */
9765
+ interface DrawEditorBaseProps {
9766
+ /**
9767
+ * The component's children.
9768
+ */
9769
+ children?: ReactNode;
9770
+ /**
9771
+ * An array of shape utils to use in the editor.
9772
+ */
9773
+ shapeUtils?: readonly DrAnyShapeUtilConstructor[];
9774
+ /**
9775
+ * An array of binding utils to use in the editor.
9776
+ */
9777
+ bindingUtils?: readonly DrAnyBindingUtilConstructor[];
9778
+ /**
9779
+ * An array of asset utils to use in the editor.
9780
+ */
9781
+ assetUtils?: readonly DrAnyAssetUtilConstructor[];
9782
+ /**
9783
+ * An array of overlay utils to use in the editor for canvas overlay UI elements.
9784
+ */
9785
+ overlayUtils?: readonly DrAnyOverlayUtilConstructor[];
9786
+ /**
9787
+ * An array of tools to add to the editor's state chart.
9788
+ */
9789
+ tools?: readonly DrStateNodeConstructor[];
9790
+ /**
9791
+ * Whether to automatically focus the editor when it mounts.
9792
+ */
9793
+ autoFocus?: boolean;
9794
+ /**
9795
+ * Overrides for the editor's components, such as handles, collaborator cursors, etc.
9796
+ */
9797
+ components?: DrEditorComponents;
9798
+ /**
9799
+ * Called when the editor has mounted.
9800
+ */
9801
+ onMount?: DrOnMountHandler;
9802
+ /**
9803
+ * The editor's initial state (usually the id of the first active tool).
9804
+ */
9805
+ initialState?: string;
9806
+ /**
9807
+ * A classname to pass to the editor's container.
9808
+ */
9809
+ className?: string;
9810
+ /**
9811
+ * The user interacting with the editor.
9812
+ */
9813
+ user?: DrCurrentUser;
9814
+ /**
9815
+ * The editor's color scheme. Defaults to `'light'`.
9816
+ *
9817
+ * - `'light'` - Always use light mode.
9818
+ * - `'dark'` - Always use dark mode.
9819
+ * - `'system'` - Follow the OS color scheme preference.
9820
+ * - `'inherit'` - Follow the nearest ancestor's `data-color-mode` attribute
9821
+ * (for embedding inside a host app that manages its own theme).
9822
+ */
9823
+ colorScheme?: 'light' | 'dark' | 'system' | 'inherit';
9824
+ /**
9825
+ * Named themes for the editor.
9826
+ */
9827
+ themes?: Partial<DrThemes>;
9828
+ /**
9829
+ * The id of the initially active theme. Defaults to `'default'`.
9830
+ */
9831
+ initialTheme?: DrThemeId;
9832
+ /**
9833
+ * Camera options for the editor.
9834
+ *
9835
+ * @deprecated Use `options.cameraOptions` instead. This will be removed in a future release.
9836
+ */
9837
+ cameraOptions?: Partial<DrCameraOptions>;
9838
+ /**
9839
+ * Options for the editor.
9840
+ */
9841
+ options?: Partial<DrawOptions>;
9842
+ /**
9843
+ * Text options for the editor.
9844
+ *
9845
+ * @deprecated Use `options.text` instead. This prop will be removed in a future release.
9846
+ */
9847
+ textOptions?: DrTextOptions;
9848
+ /**
9849
+ * Options for syncing the editor's camera state with the URL.
9850
+ *
9851
+ * @deprecated Use `options.deepLinks` instead. This prop will be removed in a future release.
9852
+ */
9853
+ deepLinks?: true | DrDeepLinkOptions;
9854
+ /**
9855
+ * Provides a way to hide shapes.
9856
+ *
9857
+ * Hidden shapes will not render in the editor, and they will not be eligible for hit test via
9858
+ * {@link @ibodr/editor#Editor.getShapeAtPoint} and {@link @ibodr/editor#Editor.getShapesAtPoint}. But otherwise they will
9859
+ * remain in the store and participate in all other operations.
9860
+ *
9861
+ * @example
9862
+ * ```ts
9863
+ * getShapeVisibility={(shape, editor) => shape.meta.hidden ? 'hidden' : 'inherit'}
9864
+ * ```
9865
+ *
9866
+ * - `'inherit' | undefined` - (default) The shape will be visible unless its parent is hidden.
9867
+ * - `'hidden'` - The shape will be hidden.
9868
+ * - `'visible'` - The shape will be visible.
9869
+ *
9870
+ * @param shape - The shape to check.
9871
+ * @param editor - The editor instance.
9872
+ */
9873
+ getShapeVisibility?(shape: DrShape, editor: Editor): 'visible' | 'hidden' | 'inherit' | null | undefined;
9874
+ /**
9875
+ * The URLs for the fonts to use in the editor.
9876
+ */
9877
+ assetUrls?: {
9878
+ fonts?: {
9879
+ [key: string]: string | undefined;
9880
+ };
9881
+ };
9882
+ }
9883
+ /**
9884
+ * Called when the editor has mounted.
9885
+ * @example
9886
+ * ```ts
9887
+ * <Draw onMount={(editor) => editor.selectAll()} />
9888
+ * ```
9889
+ * @param editor - The editor instance.
9890
+ *
9891
+ * @public
9892
+ */
9893
+ type DrOnMountHandler = (editor: Editor) => (() => void | undefined) | undefined | void;
9894
+ declare global {
9895
+ interface Window {
9896
+ drawReady: boolean;
9897
+ }
9898
+ }
9899
+ /**
9900
+ * The editor component without any of the default shapes, tools, or UI. It renders the canvas, or
9901
+ * your own children in its place, with the shape utils, binding utils, tools, and components you
9902
+ * pass in; the `Draw` component in the `tldraw` package wraps it with those defaults.
9903
+ *
9904
+ * @public @react
9905
+ */
9906
+ declare const DrawEditor: React__default.NamedExoticComponent<DrawEditorProps>;
9907
+ /** @public */
9908
+ interface LoadingScreenProps {
9909
+ children: ReactNode;
9910
+ }
9911
+ /** @public @react */
9912
+ declare function LoadingScreen({ children }: LoadingScreenProps): react_jsx_runtime.JSX.Element;
9913
+ /** @public @react */
9914
+ declare function ErrorScreen({ children }: LoadingScreenProps): react_jsx_runtime.JSX.Element;
9915
+ /** @internal */
9916
+ declare function useOnMount(onMount?: DrOnMountHandler): void;
9917
+
9918
+ /*!
9919
+ * BSD License: https://github.com/outline/rich-markdown-editor/blob/main/LICENSE
9920
+ * Copyright (c) 2020 General Outline, Inc (https://www.getoutline.com/) and individual contributors.
9921
+ *
9922
+ * Returns the height of the viewport.
9923
+ * This is mainly to account for virtual keyboards on mobile devices.
9924
+ *
9925
+ * N.B. On iOS, you have to take into account the offsetTop as well so that you get an accurate position
9926
+ * while using the virtual keyboard.
9927
+ */
9928
+ /**
9929
+ * The height of the visible viewport, including the visual viewport's own offset.
9930
+ *
9931
+ * @deprecated Read `window.visualViewport` directly: this flattens the visible rectangle to a
9932
+ * single scalar, and keeping UI clear of the software keyboard usually needs the other edges too.
9933
+ * Unused since v3.14; will be removed in a future release.
9934
+ *
9935
+ * @public
9936
+ */
9937
+ declare function useViewportHeight(): number;
9938
+
9939
+ /** @public */
9940
+ declare const EASINGS: {
9941
+ readonly linear: (t: number) => number;
9942
+ readonly easeInQuad: (t: number) => number;
9943
+ readonly easeOutQuad: (t: number) => number;
9944
+ readonly easeInOutQuad: (t: number) => number;
9945
+ readonly easeInCubic: (t: number) => number;
9946
+ readonly easeOutCubic: (t: number) => number;
9947
+ readonly easeInOutCubic: (t: number) => number;
9948
+ readonly easeInQuart: (t: number) => number;
9949
+ readonly easeOutQuart: (t: number) => number;
9950
+ readonly easeInOutQuart: (t: number) => number;
9951
+ readonly easeInQuint: (t: number) => number;
9952
+ readonly easeOutQuint: (t: number) => number;
9953
+ readonly easeInOutQuint: (t: number) => number;
9954
+ readonly easeInSine: (t: number) => number;
9955
+ readonly easeOutSine: (t: number) => number;
9956
+ readonly easeInOutSine: (t: number) => number;
9957
+ readonly easeInExpo: (t: number) => number;
9958
+ readonly easeOutExpo: (t: number) => number;
9959
+ readonly easeInOutExpo: (t: number) => number;
9960
+ };
9961
+
9962
+ /** @public */
9963
+ declare class Arc2d extends Geometry2d {
9964
+ private _center;
9965
+ private _radius;
9966
+ private _start;
9967
+ private _end;
9968
+ private _largeArcFlag;
9969
+ private _sweepFlag;
9970
+ private _measure;
9373
9971
  private _angleStart;
9374
9972
  private _angleEnd;
9375
9973
  constructor(config: Omit<Geometry2dOptions, 'isFilled' | 'isClosed'> & {
@@ -9531,7 +10129,7 @@ declare class Group2d extends Geometry2d {
9531
10129
  intersectPolyline(polyline: VecLike[], filters?: Geometry2dFilters): VecLike[];
9532
10130
  interpolateAlongEdge(t: number, filters?: Geometry2dFilters): Vec;
9533
10131
  uninterpolateAlongEdge(point: VecLike, filters?: Geometry2dFilters): number;
9534
- transform(transform: Mat): Geometry2d;
10132
+ transform(transform: MatModel, opts?: TransformedGeometry2dOptions): Geometry2d;
9535
10133
  getArea(): number;
9536
10134
  toSimpleSvgPath(): string;
9537
10135
  getLength(filters?: Geometry2dFilters): number;
@@ -9869,7 +10467,7 @@ declare function toFixed(v: number): number;
9869
10467
  * Check if a float is safe to use. ie: Not too big or small.
9870
10468
  * @public
9871
10469
  */
9872
- declare const isSafeFloat: (n: number) => boolean;
10470
+ declare function isSafeFloat(n: number): boolean;
9873
10471
  /**
9874
10472
  * Get the angle of a point on an arc.
9875
10473
  * @param fromAngle - The angle from center to arc's start point (A) on the circle
@@ -9920,204 +10518,6 @@ declare function centerOfCircleFromThreePoints(a: VecLike, b: VecLike, c: VecLik
9920
10518
  /** @public */
9921
10519
  declare function getPointsOnArc(startPoint: VecLike, endPoint: VecLike, center: VecLike | null, radius: number, numPoints: number): Vec[];
9922
10520
 
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
10521
  /**
10122
10522
  * Converts a data URL to a file.
10123
10523
  * @param url - The data URL to convert.
@@ -10152,8 +10552,6 @@ declare const debugFlags: {
10152
10552
  readonly showFps: DebugFlag<boolean>;
10153
10553
  readonly measurePerformance: DebugFlag<boolean>;
10154
10554
  readonly throwToBlob: DebugFlag<boolean>;
10155
- readonly reconnectOnPing: DebugFlag<boolean>;
10156
- readonly debugCursors: DebugFlag<boolean>;
10157
10555
  readonly forceSrgb: DebugFlag<boolean>;
10158
10556
  readonly debugGeometry: DebugFlag<boolean>;
10159
10557
  readonly hideShapes: DebugFlag<boolean>;
@@ -10211,7 +10609,25 @@ declare function releasePointerCapture(element: Element, event: React.PointerEve
10211
10609
  *
10212
10610
  * @public
10213
10611
  */
10214
- declare const stopEventPropagation: (e: any) => any;
10612
+ declare function stopEventPropagation(e: any): any;
10613
+ /**
10614
+ * Move an element into a new parent, preserving its state where the platform allows it.
10615
+ *
10616
+ * Uses `Node.moveBefore` (Chromium 133+, Firefox 144+) when both the element and parent are
10617
+ * connected to the same document — this moves the element without resetting its state, so
10618
+ * iframes don't reload and media keeps playing. Otherwise (older browsers, disconnected nodes,
10619
+ * or a cross-document move) it falls back to `appendChild`, which moves the element but resets
10620
+ * its state like an iframe reload.
10621
+ *
10622
+ * This is the primitive tldraw uses to adopt `ShapeUtil.getAppOwnedElement` elements, exposed so
10623
+ * apps can perform symmetric state-preserving moves from `ShapeUtil.onReleaseAppOwnedElement` —
10624
+ * for example moving an element to an off-canvas parking lot between editor sessions.
10625
+ *
10626
+ * @param parent - The element to move `element` into, as its last child.
10627
+ * @param element - The element to move.
10628
+ * @public
10629
+ */
10630
+ declare function moveElementInto(parent: HTMLElement, element: HTMLElement): void;
10215
10631
  /** @internal */
10216
10632
  declare function elementShouldCaptureKeys(el: Element | null, includeButtonsAndMenus?: boolean): boolean;
10217
10633
  /**
@@ -10446,7 +10862,14 @@ declare class LocalIndexedDb {
10446
10862
  sessionId?: string | null;
10447
10863
  sessionStateSnapshot?: DrSessionStateSnapshot | null;
10448
10864
  }): Promise<void>;
10449
- pruneSessions(): Promise<void>;
10865
+ /**
10866
+ * Drop all but the most recently updated session state rows. The row for `keepSessionId` is never
10867
+ * deleted: it may be an old row that this tab restored its state from and has not rewritten yet,
10868
+ * and deleting it would make a later reload fall back to another tab's session state.
10869
+ */
10870
+ pruneSessions({ keepSessionId }?: {
10871
+ keepSessionId?: string;
10872
+ }): Promise<void>;
10450
10873
  getAsset(assetId: string): Promise<File | undefined>;
10451
10874
  storeAsset(assetId: string, blob: File): Promise<void>;
10452
10875
  removeAssets(assetId: string[]): Promise<void>;
@@ -10458,4 +10881,4 @@ declare function uniq<T>(array: {
10458
10881
  readonly [n: number]: T;
10459
10882
  } | null | undefined): T[];
10460
10883
 
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, DefaultSelectionBackground, 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 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 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 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 DrSelectionBackgroundProps, type DrSelectionHandle, type DrSessionStateSnapshot, type DrShapeErrorFallbackComponent, type DrShapeIndicatorOverlay, type DrShapeOperationPerfEvent, type DrShapeUtilCanBeLaidOutOpts, type DrShapeUtilCanBindOpts, type DrShapeUtilCanvasSvgDef, type DrShapeUtilConstructor, type DrShapeWrapperProps, 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, 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, ShapeIndicatorOverlayUtil, 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, isSafeFloat, kickoutOccludedShapes, linesIntersect, loadSessionStateSnapshotIntoStore, loadSnapshot, loopToHtmlElement, maybeSnapToGrid, normalizeWheel, openWindow, parseDeepLinkString, perimeterOfEllipse, pointInPolygon, polygonIntersectsPolyline, polygonsIntersect, precise, preventDefault, radiansToDegrees, rangeIntersection, refreshPage, releasePointerCapture, resizeBox, resizeScaled, resolveThemes, rotateSelectionHandle, runtime, sanitizeId, setPointerCapture, setRuntimeOverrides, setUserPreferences, shortAngleDist, snapAngle, stopEventPropagation, strokeShapeIndicators, suffixSafeId, tlenv, tlenvReactive, tlmenus, tltime, toDomPrecision, toFixed, toPrecision, uniq, useColorMode, useContainer, useContainerIfExists, useDelaySvgExport, useDrSchemaFromUtils, useDrStore, useDrawCurrentUser, useEditor, useEditorComponents, useEvent, useGlobalMenuIsOpen, useIsCropping, useIsEditing, useLocalStore, useMaybeEditor, useOnMount, usePassThroughMouseOverEvents, usePassThroughWheelEvents, usePeerIds, usePresence, useReactiveEvent, useRefState, useShallowArrayIdentity, useShallowObjectIdentity, useSharedSafeId, useSvgExportContext, useTransform, useUniqueSafeId, useViewportHeight, userTypeValidator };
10884
+ 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 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 };