@tldraw/editor 5.3.0-next.fc37bd96825b → 5.4.0-canary.b41840d4f0e4

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.
Files changed (116) hide show
  1. package/dist-cjs/index.d.ts +153 -9
  2. package/dist-cjs/index.js +13 -3
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +24 -19
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/EditorPortal.js +44 -0
  7. package/dist-cjs/lib/components/EditorPortal.js.map +7 -0
  8. package/dist-cjs/lib/components/LiveCollaborators.js +102 -0
  9. package/dist-cjs/lib/components/LiveCollaborators.js.map +7 -0
  10. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +4 -10
  11. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +3 -3
  12. package/dist-cjs/lib/components/default-components/DefaultCursor.js +59 -0
  13. package/dist-cjs/lib/components/default-components/DefaultCursor.js.map +7 -0
  14. package/dist-cjs/lib/editor/Editor.js +72 -14
  15. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  16. package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js +4 -4
  17. package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js.map +2 -2
  18. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +5 -1
  19. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
  20. package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
  21. package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
  22. package/dist-cjs/lib/hooks/EditorComponentsContext.js.map +2 -2
  23. package/dist-cjs/lib/hooks/useCursor.js +1 -0
  24. package/dist-cjs/lib/hooks/useCursor.js.map +2 -2
  25. package/dist-cjs/lib/hooks/useEditorComponents.js +2 -0
  26. package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
  27. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js +49 -18
  28. package/dist-cjs/lib/hooks/usePassThroughWheelEvents.js.map +3 -3
  29. package/dist-cjs/lib/hooks/useTransform.js +45 -0
  30. package/dist-cjs/lib/hooks/useTransform.js.map +7 -0
  31. package/dist-cjs/lib/hooks/useViewportHeight.js.map +2 -2
  32. package/dist-cjs/lib/license/LicenseManager.js +51 -2
  33. package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
  34. package/dist-cjs/lib/license/useLicenseManagerState.js +7 -0
  35. package/dist-cjs/lib/license/useLicenseManagerState.js.map +2 -2
  36. package/dist-cjs/lib/utils/collaborators.js +27 -0
  37. package/dist-cjs/lib/utils/collaborators.js.map +7 -0
  38. package/dist-cjs/lib/utils/getHtmlLayerTransform.js +33 -0
  39. package/dist-cjs/lib/utils/getHtmlLayerTransform.js.map +7 -0
  40. package/dist-cjs/version.js +3 -3
  41. package/dist-cjs/version.js.map +1 -1
  42. package/dist-esm/index.d.mts +153 -9
  43. package/dist-esm/index.mjs +19 -4
  44. package/dist-esm/index.mjs.map +2 -2
  45. package/dist-esm/lib/TldrawEditor.mjs +23 -18
  46. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  47. package/dist-esm/lib/components/EditorPortal.mjs +24 -0
  48. package/dist-esm/lib/components/EditorPortal.mjs.map +7 -0
  49. package/dist-esm/lib/components/LiveCollaborators.mjs +82 -0
  50. package/dist-esm/lib/components/LiveCollaborators.mjs.map +7 -0
  51. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +5 -11
  52. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  53. package/dist-esm/lib/components/default-components/DefaultCursor.mjs +29 -0
  54. package/dist-esm/lib/components/default-components/DefaultCursor.mjs.map +7 -0
  55. package/dist-esm/lib/editor/Editor.mjs +72 -14
  56. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  57. package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs +5 -5
  58. package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs.map +2 -2
  59. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +5 -1
  60. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
  61. package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
  62. package/dist-esm/lib/hooks/EditorComponentsContext.mjs.map +2 -2
  63. package/dist-esm/lib/hooks/useCursor.mjs +1 -0
  64. package/dist-esm/lib/hooks/useCursor.mjs.map +2 -2
  65. package/dist-esm/lib/hooks/useEditorComponents.mjs +2 -0
  66. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  67. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs +50 -19
  68. package/dist-esm/lib/hooks/usePassThroughWheelEvents.mjs.map +3 -3
  69. package/dist-esm/lib/hooks/useTransform.mjs +25 -0
  70. package/dist-esm/lib/hooks/useTransform.mjs.map +7 -0
  71. package/dist-esm/lib/hooks/useViewportHeight.mjs.map +2 -2
  72. package/dist-esm/lib/license/LicenseManager.mjs +52 -3
  73. package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
  74. package/dist-esm/lib/license/useLicenseManagerState.mjs +7 -0
  75. package/dist-esm/lib/license/useLicenseManagerState.mjs.map +2 -2
  76. package/dist-esm/lib/utils/collaborators.mjs +7 -0
  77. package/dist-esm/lib/utils/collaborators.mjs.map +7 -0
  78. package/dist-esm/lib/utils/getHtmlLayerTransform.mjs +13 -0
  79. package/dist-esm/lib/utils/getHtmlLayerTransform.mjs.map +7 -0
  80. package/dist-esm/version.mjs +3 -3
  81. package/dist-esm/version.mjs.map +1 -1
  82. package/editor.css +43 -4
  83. package/package.json +7 -7
  84. package/src/index.ts +15 -2
  85. package/src/lib/TldrawEditor.tsx +21 -13
  86. package/src/lib/components/EditorPortal.tsx +77 -0
  87. package/src/lib/components/LiveCollaborators.tsx +133 -0
  88. package/src/lib/components/default-components/DefaultCanvas.tsx +5 -17
  89. package/src/lib/components/default-components/DefaultCursor.tsx +65 -0
  90. package/src/lib/editor/Editor.ts +109 -15
  91. package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.test.ts +46 -1
  92. package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.ts +10 -5
  93. package/src/lib/editor/managers/TextManager/TextManager.test.ts +42 -0
  94. package/src/lib/editor/managers/TextManager/TextManager.ts +8 -2
  95. package/src/lib/editor/shapes/ShapeUtil.ts +24 -0
  96. package/src/lib/editor/types/external-content.ts +5 -0
  97. package/src/lib/hooks/EditorComponentsContext.tsx +2 -0
  98. package/src/lib/hooks/useCursor.ts +1 -0
  99. package/src/lib/hooks/useEditorComponents.tsx +2 -0
  100. package/src/lib/hooks/usePassThroughWheelEvents.ts +83 -24
  101. package/src/lib/hooks/useTransform.ts +38 -0
  102. package/src/lib/hooks/useViewportHeight.ts +9 -1
  103. package/src/lib/license/LicenseManager.test.ts +146 -0
  104. package/src/lib/license/LicenseManager.ts +98 -2
  105. package/src/lib/license/useLicenseManagerState.ts +17 -1
  106. package/src/lib/test/EditorPortal.test.tsx +48 -0
  107. package/src/lib/test/usePassThroughWheelEvents.test.tsx +77 -0
  108. package/src/lib/utils/collaborators.test.ts +34 -0
  109. package/src/lib/utils/collaborators.ts +25 -0
  110. package/src/lib/utils/getHtmlLayerTransform.ts +22 -0
  111. package/src/version.ts +3 -3
  112. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js +0 -51
  113. package/dist-cjs/lib/hooks/usePassThroughMouseOverEvents.js.map +0 -7
  114. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs +0 -31
  115. package/dist-esm/lib/hooks/usePassThroughMouseOverEvents.mjs.map +0 -7
  116. package/src/lib/hooks/usePassThroughMouseOverEvents.ts +0 -32
@@ -19,12 +19,14 @@ import { JsonObject } from '@tldraw/utils';
19
19
  import { JSX } from 'react/jsx-runtime';
20
20
  import { LegacyMigrations } from '@tldraw/store';
21
21
  import { MigrationSequence } from '@tldraw/store';
22
+ import { NamedExoticComponent } from 'react';
22
23
  import { Node as Node_2 } from '@tiptap/pm/model';
23
24
  import { PerformanceTracker } from '@tldraw/utils';
24
25
  import * as React_2 from 'react';
25
26
  import { default as React_3 } from 'react';
26
27
  import { ReactElement } from 'react';
27
28
  import { ReactNode } from 'react';
29
+ import { ReactPortal } from 'react';
28
30
  import { RecordProps } from '@tldraw/tlschema';
29
31
  import { RecordsDiff } from '@tldraw/store';
30
32
  import { RefAttributes } from 'react';
@@ -982,6 +984,15 @@ export declare function DefaultBackground(): JSX.Element;
982
984
  /** @public @react */
983
985
  export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
984
986
 
987
+ /**
988
+ * The default collaborator cursor: the arrow glyph plus a name tag or chat bubble. The arrow is a
989
+ * `<use>` of a shared `<defs>` symbol that `LiveCollaborators` renders, so a `DefaultCursor`
990
+ * used outside that layer draws no arrow.
991
+ *
992
+ * @public @react
993
+ */
994
+ export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
995
+
985
996
  /** @public @react */
986
997
  export declare const DefaultErrorFallback: TLErrorFallbackComponent;
987
998
 
@@ -3689,7 +3700,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3689
3700
  *
3690
3701
  * @public
3691
3702
  */
3692
- alignShapes(shapes: TLShape[] | TLShapeId[], operation: 'bottom' | 'center-horizontal' | 'center-vertical' | 'left' | 'right' | 'top'): this;
3703
+ alignShapes(shapes: TLShape[] | TLShapeId[], operation: 'bottom' | 'center-horizontal' | 'center-vertical' | 'center' | 'left' | 'right' | 'top'): this;
3693
3704
  /**
3694
3705
  * Distribute shape positions.
3695
3706
  *
@@ -4462,13 +4473,14 @@ export declare class Editor extends EventEmitter<TLEventMap> {
4462
4473
  cancelDoubleClick(): void;
4463
4474
  /* Excluded from this release type: _prevCursor */
4464
4475
  /* Excluded from this release type: _shiftKeyTimeout */
4465
- /* Excluded from this release type: _setShiftKeyTimeout */
4476
+ /* Excluded from this release type: _releaseShiftKey */
4466
4477
  /* Excluded from this release type: _altKeyTimeout */
4467
- /* Excluded from this release type: _setAltKeyTimeout */
4478
+ /* Excluded from this release type: _releaseAltKey */
4468
4479
  /* Excluded from this release type: _ctrlKeyTimeout */
4469
- /* Excluded from this release type: _setCtrlKeyTimeout */
4480
+ /* Excluded from this release type: _releaseCtrlKey */
4470
4481
  /* Excluded from this release type: _metaKeyTimeout */
4471
- /* Excluded from this release type: _setMetaKeyTimeout */
4482
+ /* Excluded from this release type: _releaseMetaKey */
4483
+ /* Excluded from this release type: _releaseDebouncedModifiers */
4472
4484
  /* Excluded from this release type: _restoreToolId */
4473
4485
  /* Excluded from this release type: _didPinch */
4474
4486
  /* Excluded from this release type: _selectedShapeIdsAtPointerDown */
@@ -4586,6 +4598,52 @@ export declare abstract class EditorManager {
4586
4598
  /* Excluded from this release type: dispose */
4587
4599
  }
4588
4600
 
4601
+ /**
4602
+ * Renders its children into the end of the editor's container, escaping the canvas layer.
4603
+ *
4604
+ * Use this for anything anchored to canvas coordinates that also has to draw over the UI — a
4605
+ * popover on a shape, a comment thread, an annotation panel. The `OnTheCanvas` and
4606
+ * `InFrontOfTheCanvas` slots are fixed layers, each its own stacking context, so content mounted
4607
+ * there can't paint above whatever outranks its layer whatever z-index it asks for. Mount in
4608
+ * whichever slot suits your data flow, wrap the part that needs its own layer in this, and give
4609
+ * that part a z-index.
4610
+ *
4611
+ * This package's own layers stop at 250 (`--tl-layer-canvas-in-front`); above that belongs to
4612
+ * whatever renders the UI. In `tldraw` that's `--tl-layer-panels` (300) and `--tl-layer-menus`
4613
+ * (400), defined by `tldraw`'s stylesheet rather than this one.
4614
+ *
4615
+ * Positioning still resolves against the editor's container, so a `position: absolute` child uses
4616
+ * ordinary container coordinates.
4617
+ *
4618
+ * Prefer this over `createPortal(children, useContainer())`, which picks its DOM position from the
4619
+ * commit that mounts it — landing the node ahead of the UI and of the "skip to main content" link
4620
+ * that only works while nothing precedes it. This host is a real element placed last, so ordering
4621
+ * is fixed rather than dependent on mount timing.
4622
+ *
4623
+ * @example
4624
+ * ```tsx
4625
+ * // 400 clears tldraw's menus layer; the bare editor's own layers stop at 250.
4626
+ * function ShapeAnnotation({ point }: { point: VecLike }) {
4627
+ * return (
4628
+ * <EditorPortal>
4629
+ * <div style={{ position: 'absolute', left: point.x, top: point.y, zIndex: 400 }}>
4630
+ * Above the UI
4631
+ * </div>
4632
+ * </EditorPortal>
4633
+ * )
4634
+ * }
4635
+ * ```
4636
+ *
4637
+ * @public
4638
+ * @react
4639
+ */
4640
+ export declare function EditorPortal({ children }: EditorPortalProps): ReactPortal | null;
4641
+
4642
+ /** @public */
4643
+ export declare interface EditorPortalProps {
4644
+ children: ReactNode;
4645
+ }
4646
+
4589
4647
  /** @public @react */
4590
4648
  export declare function EditorProvider({ editor, children }: EditorProviderProps): JSX.Element;
4591
4649
 
@@ -5449,6 +5507,24 @@ export declare function intersectPolygonPolygon(polygonA: VecLike[], polygonB: V
5449
5507
 
5450
5508
  /* Excluded from this release type: isAccelKey */
5451
5509
 
5510
+ /**
5511
+ * Whether a collaborator's cursor (page coords) is inside the viewport, with a small margin for the
5512
+ * cursor glyph so it isn't culled the instant its hotspot crosses the edge.
5513
+ *
5514
+ * Single source of truth for the cursor/hint split: the DOM cursor layer renders a collaborator
5515
+ * when this is true, and `CollaboratorHintOverlayUtil` draws the viewport-edge hint when it's
5516
+ * false. Sharing the predicate keeps those two exhaustive and mutually exclusive — a margin change
5517
+ * can't open a dead zone (neither renders) or a double-render (both).
5518
+ *
5519
+ * @public
5520
+ */
5521
+ export declare function isCursorInViewport(cursor: VecLike, viewport: {
5522
+ maxX: number;
5523
+ maxY: number;
5524
+ minX: number;
5525
+ minY: number;
5526
+ }, zoom: number): boolean;
5527
+
5452
5528
  /**
5453
5529
  * Check if a float is safe to use. ie: Not too big or small.
5454
5530
  * @public
@@ -5470,6 +5546,8 @@ export declare function kickoutOccludedShapes(editor: Editor, shapeIds: TLShapeI
5470
5546
 
5471
5547
  /* Excluded from this release type: LICENSE_TIMEOUT */
5472
5548
 
5549
+ /* Excluded from this release type: LicenseFeatureName */
5550
+
5473
5551
  /* Excluded from this release type: LicenseFromKeyResult */
5474
5552
 
5475
5553
  /* Excluded from this release type: LicenseInfo */
@@ -6793,6 +6871,29 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
6793
6871
  * @public
6794
6872
  */
6795
6873
  onBeforeCreate?(next: Shape): Shape | void;
6874
+ /**
6875
+ * A callback called when a shape is reproduced from an existing shape, either by duplicating
6876
+ * ({@link Editor.duplicateShapes}) or by pasting/putting content onto the page
6877
+ * ({@link Editor.putContentOntoCurrentPage}). This provides a last chance to modify the copy
6878
+ * before it's created — for example, to re-stamp attribution so the copy is credited to the
6879
+ * current user rather than the original author. It is not called when content is put with
6880
+ * `preserveIds` (e.g. {@link Editor.moveShapesToPage}), since the shape keeps its identity
6881
+ * and no copy is made.
6882
+ *
6883
+ * @example
6884
+ *
6885
+ * ```ts
6886
+ * onBeforeDuplicate = (source, duplicate) => {
6887
+ * return { ...duplicate, props: { ...duplicate.props, editedBy: this.editor.getAttributionUserId() } }
6888
+ * }
6889
+ * ```
6890
+ *
6891
+ * @param source - The shape being copied from.
6892
+ * @param duplicate - The new copy (with its own id), before it's created.
6893
+ * @returns The next shape or void.
6894
+ * @public
6895
+ */
6896
+ onBeforeDuplicate?(source: Shape, duplicate: Shape): Shape | void;
6796
6897
  /**
6797
6898
  * A callback called just before a shape is updated. This method provides a last chance to modify
6798
6899
  * the updated shape.
@@ -7525,6 +7626,11 @@ export declare interface TLBaseEventInfo {
7525
7626
 
7526
7627
  /** @public */
7527
7628
  export declare interface TLBaseExternalContent {
7629
+ /**
7630
+ * The other content sources found on the clipboard alongside this content. For example, when
7631
+ * pasting an image copied together with HTML and plain text, the `files` content will have
7632
+ * text sources for the HTML and plain text parts.
7633
+ */
7528
7634
  sources?: TLExternalContentSource[];
7529
7635
  point?: VecLike;
7530
7636
  }
@@ -7771,6 +7877,17 @@ export declare interface TLCurrentUser {
7771
7877
  readonly setUserPreferences: (userPreferences: TLUserPreferences) => void;
7772
7878
  }
7773
7879
 
7880
+ /** @public */
7881
+ export declare interface TLCursorProps {
7882
+ userId: string;
7883
+ className?: string;
7884
+ point: null | VecModel;
7885
+ zoom: number;
7886
+ color?: string;
7887
+ name: null | string;
7888
+ chatMessage: string;
7889
+ }
7890
+
7774
7891
  /** @public */
7775
7892
  export declare type TLDeepLink = {
7776
7893
  bounds: BoxModel;
@@ -8273,6 +8390,7 @@ export declare interface TLDropShapesOverInfo {
8273
8390
  export declare interface TLEditorComponents {
8274
8391
  Background?: ComponentType | null;
8275
8392
  Canvas?: ComponentType<TLCanvasComponentProps> | null;
8393
+ CollaboratorCursor?: ComponentType<TLCursorProps> | null;
8276
8394
  Grid?: ComponentType<TLGridProps> | null;
8277
8395
  InFrontOfTheCanvas?: ComponentType | null;
8278
8396
  LoadingScreen?: ComponentType | null;
@@ -9728,6 +9846,16 @@ export declare function useEditor(): Editor;
9728
9846
  /** @public */
9729
9847
  export declare function useEditorComponents(): Required<TLEditorComponents>;
9730
9848
 
9849
+ /**
9850
+ * The DOM node that {@link EditorPortal} renders into: an empty `display: contents` element the
9851
+ * editor renders last among its container's children, after the canvas and after the UI.
9852
+ *
9853
+ * Null until the container has mounted, so prefer {@link EditorPortal}, which handles that for you.
9854
+ *
9855
+ * @public
9856
+ */
9857
+ export declare function useEditorPortalHost(): HTMLElement | null;
9858
+
9731
9859
  /* Excluded from this release type: useEvent */
9732
9860
 
9733
9861
  /** @public */
@@ -9739,6 +9867,10 @@ export declare function useIsCropping(shapeId: TLShapeId): boolean;
9739
9867
  /** @public */
9740
9868
  export declare function useIsEditing(shapeId: TLShapeId): boolean;
9741
9869
 
9870
+ /* Excluded from this release type: useLicenseContext */
9871
+
9872
+ /* Excluded from this release type: useLicenseFeatureFlag */
9873
+
9742
9874
  /* Excluded from this release type: useLocalStore */
9743
9875
 
9744
9876
  /** @public */
@@ -9746,9 +9878,6 @@ export declare function useMaybeEditor(): Editor | null;
9746
9878
 
9747
9879
  /* Excluded from this release type: useOnMount */
9748
9880
 
9749
- /** @public */
9750
- export declare function usePassThroughMouseOverEvents(ref: RefObject<HTMLElement | null>): void;
9751
-
9752
9881
  /** @public */
9753
9882
  export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | null>): void;
9754
9883
 
@@ -9875,6 +10004,13 @@ export declare function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreS
9875
10004
  /** @public */
9876
10005
  export declare function useTLStore(opts: TLStoreOptions): TLStore;
9877
10006
 
10007
+ /**
10008
+ * Position an element by writing its `transform` directly, outside React's render output — the
10009
+ * cheap path for elements that move at pointer/presence frequency.
10010
+ * @public
10011
+ */
10012
+ export declare function useTransform(ref: React.RefObject<HTMLElement | null | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
10013
+
9878
10014
  /**
9879
10015
  * React's useId hook returns a unique id for the component. However, it uses a colon in the id,
9880
10016
  * which is not valid for CSS selectors. This hook replaces the colon with an underscore.
@@ -9883,7 +10019,15 @@ export declare function useTLStore(opts: TLStoreOptions): TLStore;
9883
10019
  */
9884
10020
  export declare function useUniqueSafeId(suffix?: string): SafeId;
9885
10021
 
9886
- /** @public */
10022
+ /**
10023
+ * The height of the visible viewport, including the visual viewport's own offset.
10024
+ *
10025
+ * @deprecated Read `window.visualViewport` directly: this flattens the visible rectangle to a
10026
+ * single scalar, and keeping UI clear of the software keyboard usually needs the other edges too.
10027
+ * Unused since v3.14; will be removed in a future release.
10028
+ *
10029
+ * @public
10030
+ */
9887
10031
  export declare function useViewportHeight(): number;
9888
10032
 
9889
10033
  /* Excluded from this release type: ValidLicenseKeyResult */
package/dist-cjs/index.js CHANGED
@@ -38,6 +38,7 @@ __export(index_exports, {
38
38
  DEFAULT_THEME: () => import_defaultThemes.DEFAULT_THEME,
39
39
  DefaultBackground: () => import_DefaultBackground.DefaultBackground,
40
40
  DefaultCanvas: () => import_DefaultCanvas.DefaultCanvas,
41
+ DefaultCursor: () => import_DefaultCursor.DefaultCursor,
41
42
  DefaultErrorFallback: () => import_DefaultErrorFallback.DefaultErrorFallback,
42
43
  DefaultGrid: () => import_DefaultGrid.DefaultGrid,
43
44
  DefaultShapeWrapper: () => import_DefaultShapeWrapper.DefaultShapeWrapper,
@@ -51,6 +52,7 @@ __export(index_exports, {
51
52
  EditorAtom: () => import_EditorAtom.EditorAtom,
52
53
  EditorContext: () => import_useEditor.EditorContext,
53
54
  EditorManager: () => import_EditorManager.EditorManager,
55
+ EditorPortal: () => import_EditorPortal.EditorPortal,
54
56
  EditorProvider: () => import_useEditor.EditorProvider,
55
57
  Ellipse2d: () => import_Ellipse2d.Ellipse2d,
56
58
  ErrorBoundary: () => import_ErrorBoundary.ErrorBoundary,
@@ -171,6 +173,7 @@ __export(index_exports, {
171
173
  intersectPolygonBounds: () => import_intersect.intersectPolygonBounds,
172
174
  intersectPolygonPolygon: () => import_intersect.intersectPolygonPolygon,
173
175
  isAccelKey: () => import_keyboard.isAccelKey,
176
+ isCursorInViewport: () => import_collaborators.isCursorInViewport,
174
177
  isSafeFloat: () => import_utils2.isSafeFloat,
175
178
  kickoutOccludedShapes: () => import_reparenting.kickoutOccludedShapes,
176
179
  linesIntersect: () => import_intersect.linesIntersect,
@@ -221,14 +224,16 @@ __export(index_exports, {
221
224
  useDelaySvgExport: () => import_SvgExportContext.useDelaySvgExport,
222
225
  useEditor: () => import_useEditor.useEditor,
223
226
  useEditorComponents: () => import_useEditorComponents.useEditorComponents,
227
+ useEditorPortalHost: () => import_EditorPortal.useEditorPortalHost,
224
228
  useEvent: () => import_useEvent.useEvent,
225
229
  useGlobalMenuIsOpen: () => import_useGlobalMenuIsOpen.useGlobalMenuIsOpen,
226
230
  useIsCropping: () => import_useIsCropping.useIsCropping,
227
231
  useIsEditing: () => import_useIsEditing.useIsEditing,
232
+ useLicenseContext: () => import_LicenseProvider.useLicenseContext,
233
+ useLicenseFeatureFlag: () => import_useLicenseManagerState.useLicenseFeatureFlag,
228
234
  useLocalStore: () => import_useLocalStore.useLocalStore,
229
235
  useMaybeEditor: () => import_useEditor.useMaybeEditor,
230
236
  useOnMount: () => import_TldrawEditor.useOnMount,
231
- usePassThroughMouseOverEvents: () => import_usePassThroughMouseOverEvents.usePassThroughMouseOverEvents,
232
237
  usePassThroughWheelEvents: () => import_usePassThroughWheelEvents.usePassThroughWheelEvents,
233
238
  usePeerIds: () => import_usePeerIds.usePeerIds,
234
239
  usePresence: () => import_usePresence.usePresence,
@@ -241,6 +246,7 @@ __export(index_exports, {
241
246
  useTLSchemaFromUtils: () => import_useTLStore.useTLSchemaFromUtils,
242
247
  useTLStore: () => import_useTLStore.useTLStore,
243
248
  useTldrawCurrentUser: () => import_createTLCurrentUser.useTldrawCurrentUser,
249
+ useTransform: () => import_useTransform.useTransform,
244
250
  useUniqueSafeId: () => import_useSafeId.useUniqueSafeId,
245
251
  useViewportHeight: () => import_useViewportHeight.useViewportHeight,
246
252
  userTypeValidator: () => import_TLUserPreferences.userTypeValidator
@@ -255,11 +261,13 @@ __reExport(index_exports, require("@tldraw/utils"), module.exports);
255
261
  __reExport(index_exports, require("@tldraw/validate"), module.exports);
256
262
  var import_DefaultBackground = require("./lib/components/default-components/DefaultBackground");
257
263
  var import_DefaultCanvas = require("./lib/components/default-components/DefaultCanvas");
264
+ var import_DefaultCursor = require("./lib/components/default-components/DefaultCursor");
258
265
  var import_DefaultErrorFallback = require("./lib/components/default-components/DefaultErrorFallback");
259
266
  var import_DefaultGrid = require("./lib/components/default-components/DefaultGrid");
260
267
  var import_DefaultShapeWrapper = require("./lib/components/default-components/DefaultShapeWrapper");
261
268
  var import_DefaultSpinner = require("./lib/components/default-components/DefaultSpinner");
262
269
  var import_DefaultSvgDefs = require("./lib/components/default-components/DefaultSvgDefs");
270
+ var import_EditorPortal = require("./lib/components/EditorPortal");
263
271
  var import_ErrorBoundary = require("./lib/components/ErrorBoundary");
264
272
  var import_HTMLContainer = require("./lib/components/HTMLContainer");
265
273
  var import_MenuClickCapture = require("./lib/components/MenuClickCapture");
@@ -325,16 +333,18 @@ var import_useIdentity = require("./lib/hooks/useIdentity");
325
333
  var import_useIsCropping = require("./lib/hooks/useIsCropping");
326
334
  var import_useIsEditing = require("./lib/hooks/useIsEditing");
327
335
  var import_useLocalStore = require("./lib/hooks/useLocalStore");
328
- var import_usePassThroughMouseOverEvents = require("./lib/hooks/usePassThroughMouseOverEvents");
329
336
  var import_usePassThroughWheelEvents = require("./lib/hooks/usePassThroughWheelEvents");
330
337
  var import_usePeerIds = require("./lib/hooks/usePeerIds");
331
338
  var import_usePresence = require("./lib/hooks/usePresence");
332
339
  var import_useRefState = require("./lib/hooks/useRefState");
333
340
  var import_useSafeId = require("./lib/hooks/useSafeId");
341
+ var import_useTransform = require("./lib/hooks/useTransform");
342
+ var import_collaborators = require("./lib/utils/collaborators");
334
343
  var import_useTLStore = require("./lib/hooks/useTLStore");
335
344
  var import_useViewportHeight = require("./lib/hooks/useViewportHeight");
336
345
  var import_LicenseManager = require("./lib/license/LicenseManager");
337
346
  var import_LicenseProvider = require("./lib/license/LicenseProvider");
347
+ var import_useLicenseManagerState = require("./lib/license/useLicenseManagerState");
338
348
  var import_options = require("./lib/options");
339
349
  var import_Box = require("./lib/primitives/Box");
340
350
  var import_easings = require("./lib/primitives/easings");
@@ -379,7 +389,7 @@ var import_uniq = require("./lib/utils/uniq");
379
389
  var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
380
390
  (0, import_utils.registerTldrawLibraryVersion)(
381
391
  "@tldraw/editor",
382
- "5.3.0-next.fc37bd96825b",
392
+ "5.4.0-canary.b41840d4f0e4",
383
393
  "cjs"
384
394
  );
385
395
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["import { registerTldrawLibraryVersion } from '@tldraw/utils'\n\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLCurrentUser,\n\tuseTldrawCurrentUser,\n\ttype TLCurrentUser,\n} from './lib/config/createTLCurrentUser'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tdefaultUserStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { type TLAnyAssetUtilConstructor } from './lib/config/defaultAssets'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport { AssetUtil, type TLAssetUtilConstructor } from './lib/editor/assets/AssetUtil'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport { FontManager } from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { EditorManager } from './lib/editor/managers/EditorManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\tresolveLineHeightPx,\n\ttype BatchMeasurementRequest,\n\ttype TLMeasuredTextSize,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { DEFAULT_THEME } from './lib/editor/managers/ThemeManager/defaultThemes'\nexport { ThemeManager, resolveThemes } from './lib/editor/managers/ThemeManager/ThemeManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { CollaboratorsManager } from './lib/editor/managers/CollaboratorsManager/CollaboratorsManager'\nexport { PerformanceApiAdapter } from './lib/editor/managers/PerformanceManager/PerformanceApiAdapter'\nexport { PerformanceManager } from './lib/editor/managers/PerformanceManager/PerformanceManager'\nexport {\n\ttype TLCameraEndPerfEvent,\n\ttype TLCameraStartPerfEvent,\n\ttype TLFramePerfEvent,\n\ttype TLInteractionEndPerfEvent,\n\ttype TLInteractionStartPerfEvent,\n\ttype TLPerfEventMap,\n\ttype TLPerfFrameTimeStats,\n\ttype TLPerfLongAnimationFrame,\n\ttype TLPerfLongAnimationFrameScript,\n\ttype TLShapeOperationPerfEvent,\n\ttype TLUndoRedoPerfEvent,\n} from './lib/editor/managers/PerformanceManager/perf-types'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { BaseFrameLikeShapeUtil } from './lib/editor/shapes/BaseFrameLikeShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetOverlayDisplayValues,\n\ttype OverlayOptionsWithDisplayValues,\n} from './lib/editor/overlays/getOverlayDisplayValues'\nexport { OverlayManager, type TLOverlayEntry } from './lib/editor/overlays/OverlayManager'\nexport {\n\tOverlayUtil,\n\ttype TLAnyOverlayUtilConstructor,\n\ttype TLOverlay,\n\ttype TLOverlayUtilConstructor,\n} from './lib/editor/overlays/OverlayUtil'\nexport { strokeShapeIndicators } from './lib/editor/overlays/strokeShapeIndicators'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getOwnerDocument, getOwnerWindow } from './lib/exports/domUtils'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { useColorMode } from './lib/hooks/useColorMode'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughMouseOverEvents } from './lib/hooks/usePassThroughMouseOverEvents'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT } from './lib/license/LicenseProvider'\nexport {\n\tdefaultTldrawOptions,\n\ttype TLClipboardPasteRawInfo,\n\ttype TLClipboardWriteInfo,\n\ttype TldrawOptions,\n} from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\telementShouldCaptureKeys,\n\tgetGlobalDocument,\n\tgetGlobalWindow,\n\tloopToHtmlElement,\n\tmoveElementInto,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { getColorValue } from './lib/editor/managers/ThemeManager/defaultThemes'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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@tldraw/utils'\n\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/state-react'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/store'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/tlschema'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/utils'\n// eslint-disable-next-line tldraw/no-export-star\nexport * from '@tldraw/validate'\n\nexport { DefaultBackground } from './lib/components/default-components/DefaultBackground'\nexport {\n\tDefaultCanvas,\n\ttype TLCanvasComponentProps,\n} from './lib/components/default-components/DefaultCanvas'\nexport {\n\tDefaultCursor,\n\ttype TLCursorProps,\n} from './lib/components/default-components/DefaultCursor'\nexport {\n\tDefaultErrorFallback,\n\ttype TLErrorFallbackComponent,\n} from './lib/components/default-components/DefaultErrorFallback'\nexport { DefaultGrid, type TLGridProps } from './lib/components/default-components/DefaultGrid'\nexport { type TLShapeErrorFallbackComponent } from './lib/components/default-components/DefaultShapeErrorFallback'\nexport {\n\tDefaultShapeWrapper,\n\ttype TLShapeWrapperProps,\n} from './lib/components/default-components/DefaultShapeWrapper'\nexport { DefaultSpinner } from './lib/components/default-components/DefaultSpinner'\nexport { DefaultSvgDefs } from './lib/components/default-components/DefaultSvgDefs'\nexport {\n\tEditorPortal,\n\tuseEditorPortalHost,\n\ttype EditorPortalProps,\n} from './lib/components/EditorPortal'\nexport {\n\tErrorBoundary,\n\tOptionalErrorBoundary,\n\ttype TLErrorBoundaryProps,\n} from './lib/components/ErrorBoundary'\nexport { HTMLContainer, type HTMLContainerProps } from './lib/components/HTMLContainer'\nexport { MenuClickCapture } from './lib/components/MenuClickCapture'\nexport { SVGContainer, type SVGContainerProps } from './lib/components/SVGContainer'\nexport {\n\tcreateTLCurrentUser,\n\tuseTldrawCurrentUser,\n\ttype TLCurrentUser,\n} from './lib/config/createTLCurrentUser'\nexport {\n\tcreateTLSchemaFromUtils,\n\tcreateTLStore,\n\tdefaultUserStore,\n\tinlineBase64AssetStore,\n\ttype TLStoreBaseOptions,\n\ttype TLStoreEventInfo,\n\ttype TLStoreOptions,\n\ttype TLStoreSchemaOptions,\n} from './lib/config/createTLStore'\nexport { type TLAnyAssetUtilConstructor } from './lib/config/defaultAssets'\nexport { type TLAnyBindingUtilConstructor } from './lib/config/defaultBindings'\nexport { coreShapes, type TLAnyShapeUtilConstructor } from './lib/config/defaultShapes'\nexport {\n\tgetSnapshot,\n\tloadSnapshot,\n\ttype TLEditorSnapshot,\n\ttype TLLoadSnapshotOptions,\n} from './lib/config/TLEditorSnapshot'\nexport {\n\tcreateSessionStateSnapshotSignal,\n\textractSessionStateFromLegacySnapshot,\n\tloadSessionStateSnapshotIntoStore,\n\tTAB_ID,\n\ttype TLLoadSessionStateSnapshotOptions,\n\ttype TLSessionStateSnapshot,\n} from './lib/config/TLSessionStateSnapshot'\nexport {\n\tdefaultUserPreferences,\n\tgetFreshUserPreferences,\n\tgetUserPreferences,\n\tsetUserPreferences,\n\tUSER_COLORS,\n\tuserTypeValidator,\n\ttype TLUserPreferences,\n} from './lib/config/TLUserPreferences'\nexport { DEFAULT_ANIMATION_OPTIONS, DEFAULT_CAMERA_OPTIONS, SIDES } from './lib/constants'\nexport { AssetUtil, type TLAssetUtilConstructor } from './lib/editor/assets/AssetUtil'\nexport {\n\tBindingUtil,\n\ttype BindingOnChangeOptions,\n\ttype BindingOnCreateOptions,\n\ttype BindingOnDeleteOptions,\n\ttype BindingOnShapeChangeOptions,\n\ttype BindingOnShapeDeleteOptions,\n\ttype BindingOnShapeIsolateOptions,\n\ttype TLBindingUtilConstructor,\n} from './lib/editor/bindings/BindingUtil'\nexport {\n\tEditor,\n\ttype TLEditorOptions,\n\ttype TLEditorRunOptions,\n\ttype TLRenderingShape,\n\ttype TLResizeShapeOptions,\n} from './lib/editor/Editor'\nexport { ClickManager, type TLClickState } from './lib/editor/managers/ClickManager/ClickManager'\nexport { EdgeScrollManager } from './lib/editor/managers/EdgeScrollManager/EdgeScrollManager'\nexport { FontManager } from './lib/editor/managers/FontManager/FontManager'\nexport { HistoryManager } from './lib/editor/managers/HistoryManager/HistoryManager'\nexport { EditorManager } from './lib/editor/managers/EditorManager'\nexport { InputsManager } from './lib/editor/managers/InputsManager/InputsManager'\nexport {\n\tScribbleManager,\n\ttype ScribbleItem,\n\ttype ScribbleSessionOptions,\n} from './lib/editor/managers/ScribbleManager/ScribbleManager'\nexport {\n\tBoundsSnaps,\n\ttype BoundsSnapGeometry,\n\ttype BoundsSnapPoint,\n} from './lib/editor/managers/SnapManager/BoundsSnaps'\nexport { HandleSnaps, type HandleSnapGeometry } from './lib/editor/managers/SnapManager/HandleSnaps'\nexport {\n\tSnapManager,\n\ttype GapsSnapIndicator,\n\ttype PointsSnapIndicator,\n\ttype SnapData,\n\ttype SnapIndicator,\n} from './lib/editor/managers/SnapManager/SnapManager'\nexport { SpatialIndexManager } from './lib/editor/managers/SpatialIndexManager/SpatialIndexManager'\nexport {\n\tTextManager,\n\tresolveLineHeightPx,\n\ttype BatchMeasurementRequest,\n\ttype TLMeasuredTextSize,\n\ttype TLMeasureTextOpts,\n\ttype TLMeasureTextSpanOpts,\n} from './lib/editor/managers/TextManager/TextManager'\nexport { DEFAULT_THEME } from './lib/editor/managers/ThemeManager/defaultThemes'\nexport { ThemeManager, resolveThemes } from './lib/editor/managers/ThemeManager/ThemeManager'\nexport { TickManager } from './lib/editor/managers/TickManager/TickManager'\nexport { CollaboratorsManager } from './lib/editor/managers/CollaboratorsManager/CollaboratorsManager'\nexport { PerformanceApiAdapter } from './lib/editor/managers/PerformanceManager/PerformanceApiAdapter'\nexport { PerformanceManager } from './lib/editor/managers/PerformanceManager/PerformanceManager'\nexport {\n\ttype TLCameraEndPerfEvent,\n\ttype TLCameraStartPerfEvent,\n\ttype TLFramePerfEvent,\n\ttype TLInteractionEndPerfEvent,\n\ttype TLInteractionStartPerfEvent,\n\ttype TLPerfEventMap,\n\ttype TLPerfFrameTimeStats,\n\ttype TLPerfLongAnimationFrame,\n\ttype TLPerfLongAnimationFrameScript,\n\ttype TLShapeOperationPerfEvent,\n\ttype TLUndoRedoPerfEvent,\n} from './lib/editor/managers/PerformanceManager/perf-types'\nexport { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'\nexport { BaseBoxShapeUtil, type TLBaseBoxShape } from './lib/editor/shapes/BaseBoxShapeUtil'\nexport { BaseFrameLikeShapeUtil } from './lib/editor/shapes/BaseFrameLikeShapeUtil'\nexport { GroupShapeUtil } from './lib/editor/shapes/group/GroupShapeUtil'\nexport {\n\tShapeUtil,\n\ttype TLCropInfo,\n\ttype TLDragShapesInInfo,\n\ttype TLDragShapesOutInfo,\n\ttype TLDragShapesOverInfo,\n\ttype TLDropShapesOverInfo,\n\ttype TLEditStartInfo,\n\ttype TLGeometryOpts,\n\ttype TLHandleDragInfo,\n\ttype TLIndicatorPath,\n\ttype TLResizeInfo,\n\ttype TLResizeMode,\n\ttype TLShapeUtilCanBeLaidOutOpts,\n\ttype TLShapeUtilCanBindOpts,\n\ttype TLShapeUtilCanvasSvgDef,\n\ttype TLShapeUtilConstructor,\n} from './lib/editor/shapes/ShapeUtil'\nexport {\n\tgetOverlayDisplayValues,\n\ttype OverlayOptionsWithDisplayValues,\n} from './lib/editor/overlays/getOverlayDisplayValues'\nexport { OverlayManager, type TLOverlayEntry } from './lib/editor/overlays/OverlayManager'\nexport {\n\tOverlayUtil,\n\ttype TLAnyOverlayUtilConstructor,\n\ttype TLOverlay,\n\ttype TLOverlayUtilConstructor,\n} from './lib/editor/overlays/OverlayUtil'\nexport { strokeShapeIndicators } from './lib/editor/overlays/strokeShapeIndicators'\nexport {\n\tgetPerfectDashProps,\n\ttype PerfectDashTerminal,\n} from './lib/editor/shapes/shared/getPerfectDashProps'\nexport { resizeBox, type ResizeBoxOptions } from './lib/editor/shapes/shared/resizeBox'\nexport { resizeScaled } from './lib/editor/shapes/shared/resizeScaled'\nexport { BaseBoxShapeTool } from './lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool'\nexport { maybeSnapToGrid } from './lib/editor/tools/BaseBoxShapeTool/children/Pointing'\nexport { StateNode, type TLStateNodeConstructor } from './lib/editor/tools/StateNode'\nexport { type TLContent } from './lib/editor/types/clipboard-types'\nexport { type TLEventMap, type TLEventMapHandler } from './lib/editor/types/emit-types'\nexport {\n\tEVENT_NAME_MAP,\n\ttype TLBaseEventInfo,\n\ttype TLCancelEvent,\n\ttype TLCancelEventInfo,\n\ttype TLClickEvent,\n\ttype TLClickEventInfo,\n\ttype TLCLickEventName,\n\ttype TLCompleteEvent,\n\ttype TLCompleteEventInfo,\n\ttype TLEnterEventHandler,\n\ttype TLEventHandlers,\n\ttype TLEventInfo,\n\ttype TLEventName,\n\ttype TLExitEventHandler,\n\ttype TLInterruptEvent,\n\ttype TLInterruptEventInfo,\n\ttype TLKeyboardEvent,\n\ttype TLKeyboardEventInfo,\n\ttype TLKeyboardEventName,\n\ttype TLPinchEvent,\n\ttype TLPinchEventInfo,\n\ttype TLPinchEventName,\n\ttype TLPointerEvent,\n\ttype TLPointerEventInfo,\n\ttype TLPointerEventName,\n\ttype TLPointerEventTarget,\n\ttype TLTickEvent,\n\ttype TLTickEventInfo,\n\ttype TLWheelEvent,\n\ttype TLWheelEventInfo,\n\ttype UiEvent,\n\ttype UiEventType,\n} from './lib/editor/types/event-types'\nexport {\n\ttype TLBaseExternalContent,\n\ttype TLEmbedExternalContent,\n\ttype TLErrorExternalContentSource,\n\ttype TLExcalidrawExternalContent,\n\ttype TLExcalidrawExternalContentSource,\n\ttype TLExternalAsset,\n\ttype TLExternalContent,\n\ttype TLExternalContentSource,\n\ttype TLFileExternalAsset,\n\ttype TLFileReplaceExternalContent,\n\ttype TLFilesExternalContent,\n\ttype TLSvgTextExternalContent,\n\ttype TLTextExternalContent,\n\ttype TLTextExternalContentSource,\n\ttype TLTldrawExternalContent,\n\ttype TLTldrawExternalContentSource,\n\ttype TLUrlExternalAsset,\n\ttype TLUrlExternalContent,\n} from './lib/editor/types/external-content'\nexport {\n\ttype TLHistoryBatchOptions,\n\ttype TLHistoryDiff,\n\ttype TLHistoryEntry,\n\ttype TLHistoryMark,\n} from './lib/editor/types/history-types'\nexport {\n\ttype OptionalKeys,\n\ttype RequiredKeys,\n\ttype TLCameraConstraints,\n\ttype TLCameraMoveOptions,\n\ttype TLCameraOptions,\n\ttype TLExportType,\n\ttype TLGetShapeAtPointOptions,\n\ttype TLImageExportOptions,\n\ttype TLSvgExportOptions,\n\ttype TLUpdatePointerOptions,\n} from './lib/editor/types/misc-types'\nexport {\n\ttype TLAdjacentDirection,\n\ttype TLResizeHandle,\n\ttype TLSelectionHandle,\n} from './lib/editor/types/selection-types'\nexport {\n\tuseDelaySvgExport,\n\tuseSvgExportContext,\n\ttype SvgExportContext,\n\ttype SvgExportDef,\n} from './lib/editor/types/SvgExportContext'\nexport { getOwnerDocument, getOwnerWindow } from './lib/exports/domUtils'\nexport { getSvgAsImage } from './lib/exports/getSvgAsImage'\nexport { tlenv, tlenvReactive } from './lib/globals/environment'\nexport { tlmenus } from './lib/globals/menus'\nexport { tltime } from './lib/globals/time'\nexport {\n\tContainerProvider,\n\tuseContainer,\n\tuseContainerIfExists,\n\ttype ContainerProviderProps,\n} from './lib/hooks/useContainer'\nexport { useColorMode } from './lib/hooks/useColorMode'\nexport { getCursor } from './lib/hooks/useCursor'\nexport {\n\tEditorContext,\n\tEditorProvider,\n\tuseEditor,\n\tuseMaybeEditor,\n\ttype EditorProviderProps,\n} from './lib/hooks/useEditor'\nexport { useEditorComponents } from './lib/hooks/useEditorComponents'\nexport type { TLEditorComponents } from './lib/hooks/useEditorComponents'\nexport { useEvent, useReactiveEvent } from './lib/hooks/useEvent'\nexport { useGlobalMenuIsOpen } from './lib/hooks/useGlobalMenuIsOpen'\nexport { useShallowArrayIdentity, useShallowObjectIdentity } from './lib/hooks/useIdentity'\nexport { useIsCropping } from './lib/hooks/useIsCropping'\nexport { useIsEditing } from './lib/hooks/useIsEditing'\nexport { useLocalStore } from './lib/hooks/useLocalStore'\nexport { usePassThroughWheelEvents } from './lib/hooks/usePassThroughWheelEvents'\nexport { usePeerIds } from './lib/hooks/usePeerIds'\nexport { usePresence } from './lib/hooks/usePresence'\nexport { useRefState } from './lib/hooks/useRefState'\nexport {\n\tsanitizeId,\n\tsuffixSafeId,\n\tuseSharedSafeId,\n\tuseUniqueSafeId,\n\ttype SafeId,\n} from './lib/hooks/useSafeId'\nexport { useTransform } from './lib/hooks/useTransform'\nexport { isCursorInViewport } from './lib/utils/collaborators'\nexport { useTLSchemaFromUtils, useTLStore } from './lib/hooks/useTLStore'\n// oxlint-disable-next-line typescript/no-deprecated\nexport { useViewportHeight } from './lib/hooks/useViewportHeight'\nexport {\n\tLicenseManager,\n\ttype InvalidLicenseKeyResult,\n\ttype InvalidLicenseReason,\n\ttype LicenseFeatureName,\n\ttype LicenseFromKeyResult,\n\ttype LicenseInfo,\n\ttype LicenseState,\n\ttype ValidLicenseKeyResult,\n} from './lib/license/LicenseManager'\nexport { LICENSE_TIMEOUT, useLicenseContext } from './lib/license/LicenseProvider'\nexport { useLicenseFeatureFlag } from './lib/license/useLicenseManagerState'\nexport {\n\tdefaultTldrawOptions,\n\ttype TLClipboardPasteRawInfo,\n\ttype TLClipboardWriteInfo,\n\ttype TldrawOptions,\n} from './lib/options'\nexport {\n\tBox,\n\tROTATE_CORNER_TO_SELECTION_CORNER,\n\trotateSelectionHandle,\n\ttype BoxLike,\n\ttype RotateCorner,\n\ttype SelectionCorner,\n\ttype SelectionEdge,\n\ttype SelectionHandle,\n} from './lib/primitives/Box'\nexport { EASINGS } from './lib/primitives/easings'\nexport { Arc2d } from './lib/primitives/geometry/Arc2d'\nexport { Circle2d } from './lib/primitives/geometry/Circle2d'\nexport { CubicBezier2d } from './lib/primitives/geometry/CubicBezier2d'\nexport { CubicSpline2d } from './lib/primitives/geometry/CubicSpline2d'\nexport { Edge2d } from './lib/primitives/geometry/Edge2d'\nexport { Ellipse2d } from './lib/primitives/geometry/Ellipse2d'\nexport { getVerticesCountForArcLength } from './lib/primitives/geometry/geometry-constants'\nexport {\n\tGeometry2d,\n\tGeometry2dFilters,\n\tTransformedGeometry2d,\n\ttype Geometry2dOptions,\n\ttype TransformedGeometry2dOptions,\n} from './lib/primitives/geometry/Geometry2d'\nexport { Group2d } from './lib/primitives/geometry/Group2d'\nexport { Point2d } from './lib/primitives/geometry/Point2d'\nexport { Polygon2d } from './lib/primitives/geometry/Polygon2d'\nexport { Polyline2d } from './lib/primitives/geometry/Polyline2d'\nexport { Rectangle2d } from './lib/primitives/geometry/Rectangle2d'\nexport { Stadium2d } from './lib/primitives/geometry/Stadium2d'\nexport {\n\tintersectCircleCircle,\n\tintersectCirclePolygon,\n\tintersectCirclePolyline,\n\tintersectLineSegmentCircle,\n\tintersectLineSegmentLineSegment,\n\tintersectLineSegmentPolygon,\n\tintersectLineSegmentPolyline,\n\tintersectPolygonBounds,\n\tintersectPolygonPolygon,\n\tlinesIntersect,\n\tpolygonIntersectsPolyline,\n\tpolygonsIntersect,\n} from './lib/primitives/intersect'\nexport { Mat, type MatLike, type MatModel } from './lib/primitives/Mat'\nexport {\n\tangleDistance,\n\tapproximately,\n\tareAnglesCompatible,\n\taverage,\n\tcanonicalizeRotation,\n\tcenterOfCircleFromThreePoints,\n\tclamp,\n\tclampRadians,\n\tclockwiseAngleDist,\n\tcounterClockwiseAngleDist,\n\tdegreesToRadians,\n\tgetArcMeasure,\n\tgetPointInArcT,\n\tgetPointOnCircle,\n\tgetPointsOnArc,\n\tgetPolygonVertices,\n\tHALF_PI,\n\tisSafeFloat,\n\tperimeterOfEllipse,\n\tPI,\n\tPI2,\n\tpointInPolygon,\n\tprecise,\n\tradiansToDegrees,\n\trangeIntersection,\n\tshortAngleDist,\n\tSIN,\n\tsnapAngle,\n\ttoDomPrecision,\n\ttoFixed,\n\ttoPrecision,\n} from './lib/primitives/utils'\nexport { Vec, type VecLike } from './lib/primitives/Vec'\nexport {\n\tErrorScreen,\n\tLoadingScreen,\n\tTldrawEditor,\n\tuseOnMount,\n\ttype LoadingScreenProps,\n\ttype TldrawEditorBaseProps,\n\ttype TldrawEditorProps,\n\ttype TldrawEditorStoreProps,\n\ttype TldrawEditorWithoutStoreProps,\n\ttype TldrawEditorWithStoreProps,\n\ttype TLOnMountHandler,\n} from './lib/TldrawEditor'\nexport { dataUrlToFile, getDefaultCdnBaseUrl } from './lib/utils/assets'\nexport { clampToBrowserMaxCanvasSize, type CanvasMaxSize } from './lib/utils/browserCanvasMaxSize'\nexport {\n\tcreateDebugValue,\n\tdebugFlags,\n\tfeatureFlags,\n\ttype DebugFlag,\n\ttype DebugFlagDef,\n\ttype DebugFlagDefaults,\n} from './lib/utils/debug-flags'\nexport {\n\tcreateDeepLinkString,\n\tparseDeepLinkString,\n\ttype TLDeepLink,\n\ttype TLDeepLinkOptions,\n} from './lib/utils/deepLinks'\nexport {\n\tactiveElementShouldCaptureKeys,\n\telementShouldCaptureKeys,\n\tgetGlobalDocument,\n\tgetGlobalWindow,\n\tloopToHtmlElement,\n\tmoveElementInto,\n\tpreventDefault,\n\treleasePointerCapture,\n\tsetPointerCapture,\n\t// eslint-disable-next-line @typescript-eslint/no-deprecated\n\tstopEventPropagation,\n} from './lib/utils/dom'\nexport { EditorAtom } from './lib/utils/EditorAtom'\nexport { getIncrementedName } from './lib/utils/getIncrementedName'\nexport { getPointerInfo } from './lib/utils/getPointerInfo'\nexport { getSvgPathFromPoints } from './lib/utils/getSvgPathFromPoints'\nexport { isAccelKey } from './lib/utils/keyboard'\nexport { normalizeWheel } from './lib/utils/normalizeWheel'\nexport { getDroppedShapesToNewParents, kickoutOccludedShapes } from './lib/utils/reparenting'\nexport {\n\tgetFontsFromRichText,\n\ttype RichTextFontVisitor,\n\ttype RichTextFontVisitorState,\n\ttype TiptapEditor,\n\ttype TiptapNode,\n\ttype TLTextOptions,\n} from './lib/utils/richText'\nexport {\n\tapplyRotationToSnapshotShapes,\n\tgetRotationSnapshot,\n\ttype TLRotationSnapshot,\n} from './lib/utils/rotation'\nexport {\n\thardResetEditor,\n\topenWindow,\n\trefreshPage,\n\truntime,\n\tsetRuntimeOverrides,\n} from './lib/utils/runtime'\nexport {\n\tReadonlySharedStyleMap,\n\tSharedStyleMap,\n\ttype SharedStyle,\n} from './lib/utils/SharedStylesMap'\nexport { hardReset } from './lib/utils/sync/hardReset'\nexport { LocalIndexedDb, Table, type StoreName } from './lib/utils/sync/LocalIndexedDb'\nexport { type TLStoreWithStatus } from './lib/utils/sync/StoreWithStatus'\nexport { uniq } from './lib/utils/uniq'\n\nregisterTldrawLibraryVersion(\n\t(globalThis as any).TLDRAW_LIBRARY_NAME,\n\t(globalThis as any).TLDRAW_LIBRARY_VERSION,\n\t(globalThis as any).TLDRAW_LIBRARY_MODULES\n)\n\nexport { getColorValue } from './lib/editor/managers/ThemeManager/defaultThemes'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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D;AACpD,kCAAgE;AAChE,yBAOO;AACP,uBAKO;AACP,iBAYO;AACP,wBAA2B;AAC3B,gCAAmC;AACnC,4BAA+B;AAC/B,kCAAqC;AACrC,sBAA2B;AAC3B,4BAA+B;AAC/B,yBAAoE;AACpE,sBAOO;AACP,sBAIO;AACP,qBAMO;AACP,6BAIO;AACP,uBAA0B;AAC1B,4BAAsD;AAEtD,kBAAqB;AAQrB,IAAAC,wBAA8B;AAAA,IAN9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AACF;",
6
6
  "names": ["import_utils", "import_defaultThemes"]
7
7
  }
@@ -35,10 +35,7 @@ __export(TldrawEditor_exports, {
35
35
  useOnMount: () => useOnMount
36
36
  });
37
37
  module.exports = __toCommonJS(TldrawEditor_exports);
38
- var import_jsx_runtime = (
39
- // Store is ready to go, whether externally synced or not
40
- require("react/jsx-runtime")
41
- );
38
+ var import_jsx_runtime = require("react/jsx-runtime");
42
39
  var import_store = require("@tldraw/store");
43
40
  var import_tlschema = require("@tldraw/tlschema");
44
41
  var import_utils = require("@tldraw/utils");
@@ -46,6 +43,7 @@ var import_classnames = __toESM(require("classnames"), 1);
46
43
  var import_react = __toESM(require("react"), 1);
47
44
  var import_version = require("../version");
48
45
  var import_DefaultErrorFallback = require("./components/default-components/DefaultErrorFallback");
46
+ var import_EditorPortal = require("./components/EditorPortal");
49
47
  var import_ErrorBoundary = require("./components/ErrorBoundary");
50
48
  var import_createTLCurrentUser = require("./config/createTLCurrentUser");
51
49
  var import_Editor = require("./editor/Editor");
@@ -87,6 +85,7 @@ const TldrawEditor = (0, import_react.memo)(function TldrawEditor2({
87
85
  (0, import_tlschema.registerColorsFromThemes)(resolvedThemes);
88
86
  (0, import_tlschema.registerFontsFromThemes)(resolvedThemes);
89
87
  const [container, setContainer] = (0, import_react.useState)(null);
88
+ const [portalHost, setPortalHost] = (0, import_react.useState)(null);
90
89
  const user = (0, import_react.useMemo)(() => _user ?? (0, import_createTLCurrentUser.createTLCurrentUser)(), [_user]);
91
90
  const ErrorFallback = components?.ErrorFallback === void 0 ? import_DefaultErrorFallback.DefaultErrorFallback : components?.ErrorFallback;
92
91
  const mergedOptions = (0, import_react.useMemo)(() => {
@@ -108,7 +107,7 @@ const TldrawEditor = (0, import_react.memo)(function TldrawEditor2({
108
107
  components,
109
108
  options: (0, import_useIdentity.useShallowObjectIdentity)(mergedOptions)
110
109
  };
111
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
110
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
112
111
  "div",
113
112
  {
114
113
  ref: setContainer,
@@ -118,20 +117,26 @@ const TldrawEditor = (0, import_react.memo)(function TldrawEditor2({
118
117
  tabIndex: -1,
119
118
  role: "application",
120
119
  "aria-label": _options?.branding ?? "tldraw",
121
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
- import_ErrorBoundary.OptionalErrorBoundary,
123
- {
124
- fallback: ErrorFallback,
125
- onError: (error) => (0, import_utils.annotateError)(error, { tags: { origin: "react.tldraw-before-app" } }),
126
- children: container && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LicenseProvider.LicenseProvider, { licenseKey: rest.licenseKey, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useContainer.ContainerProvider, { container, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useEditorComponents.EditorComponentsProvider, { overrides: components, children: store ? store instanceof import_store.Store ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithReadyStore, { ...withDefaults, store, user }) : (
127
- // Store is a synced store, so handle syncing stages internally
128
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithLoadingStore, { ...withDefaults, store, user })
129
- ) : (
130
- // We have no store (it's undefined) so create one and possibly sync it
131
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithOwnStore, { ...withDefaults, store, user })
132
- ) }) }) })
133
- }
134
- )
120
+ children: [
121
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
+ import_ErrorBoundary.OptionalErrorBoundary,
123
+ {
124
+ fallback: ErrorFallback,
125
+ onError: (error) => (0, import_utils.annotateError)(error, { tags: { origin: "react.tldraw-before-app" } }),
126
+ children: container && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_LicenseProvider.LicenseProvider, { licenseKey: rest.licenseKey, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useContainer.ContainerProvider, { container, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_EditorPortal.EditorPortalProvider, { host: portalHost, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_useEditorComponents.EditorComponentsProvider, { overrides: components, children: store ? store instanceof import_store.Store ? (
127
+ // Store is ready to go, whether externally synced or not
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithReadyStore, { ...withDefaults, store, user })
129
+ ) : (
130
+ // Store is a synced store, so handle syncing stages internally
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithLoadingStore, { ...withDefaults, store, user })
132
+ ) : (
133
+ // We have no store (it's undefined) so create one and possibly sync it
134
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TldrawEditorWithOwnStore, { ...withDefaults, store, user })
135
+ ) }) }) }) })
136
+ }
137
+ ),
138
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "tl-portal-host", ref: setPortalHost })
139
+ ]
135
140
  }
136
141
  );
137
142
  });