@tldraw/editor 4.4.0 → 4.5.0-canary.1dbf0b796046

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 (224) hide show
  1. package/dist-cjs/index.d.ts +67 -49
  2. package/dist-cjs/index.js +4 -7
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/TldrawEditor.js +4 -3
  5. package/dist-cjs/lib/TldrawEditor.js.map +2 -2
  6. package/dist-cjs/lib/components/ErrorBoundary.js.map +1 -1
  7. package/dist-cjs/lib/components/LiveCollaborators.js +2 -2
  8. package/dist-cjs/lib/components/LiveCollaborators.js.map +2 -2
  9. package/dist-cjs/lib/components/Shape.js +2 -2
  10. package/dist-cjs/lib/components/Shape.js.map +2 -2
  11. package/dist-cjs/lib/components/default-components/DefaultCanvas.js +15 -15
  12. package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
  13. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +5 -6
  14. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +2 -2
  15. package/dist-cjs/lib/components/default-components/DefaultLoadingScreen.js +3 -4
  16. package/dist-cjs/lib/components/default-components/DefaultLoadingScreen.js.map +2 -2
  17. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js +2 -2
  18. package/dist-cjs/lib/components/default-components/DefaultShapeIndicator.js.map +2 -2
  19. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js +2 -2
  20. package/dist-cjs/lib/components/default-components/DefaultShapeIndicators.js.map +2 -2
  21. package/dist-cjs/lib/config/TLSessionStateSnapshot.js +3 -2
  22. package/dist-cjs/lib/config/TLSessionStateSnapshot.js.map +2 -2
  23. package/dist-cjs/lib/editor/Editor.js +12 -0
  24. package/dist-cjs/lib/editor/Editor.js.map +2 -2
  25. package/dist-cjs/lib/editor/bindings/BindingUtil.js.map +1 -1
  26. package/dist-cjs/lib/editor/derivations/bindingsIndex.js.map +1 -1
  27. package/dist-cjs/lib/editor/derivations/notVisibleShapes.js.map +1 -1
  28. package/dist-cjs/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.js.map +1 -1
  29. package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +1 -1
  30. package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +1 -1
  31. package/dist-cjs/lib/editor/managers/ScribbleManager/ScribbleManager.js.map +1 -1
  32. package/dist-cjs/lib/editor/managers/SnapManager/BoundsSnaps.js.map +1 -1
  33. package/dist-cjs/lib/editor/managers/SnapManager/HandleSnaps.js.map +1 -1
  34. package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +1 -1
  35. package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +1 -1
  36. package/dist-cjs/lib/editor/shapes/shared/resizeBox.js.map +1 -1
  37. package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +1 -1
  38. package/dist-cjs/lib/editor/types/SvgExportContext.js.map +1 -1
  39. package/dist-cjs/lib/exports/exportToSvg.js.map +1 -1
  40. package/dist-cjs/lib/exports/getSvgJsx.js.map +1 -1
  41. package/dist-cjs/lib/{utils/hardResetEditor.js → hooks/EditorComponentsContext.js} +14 -8
  42. package/dist-cjs/lib/hooks/EditorComponentsContext.js.map +7 -0
  43. package/dist-cjs/lib/hooks/useCanvasEvents.js +10 -2
  44. package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
  45. package/dist-cjs/lib/hooks/useEditor.js.map +1 -1
  46. package/dist-cjs/lib/hooks/useEditorComponents.js +4 -10
  47. package/dist-cjs/lib/hooks/useEditorComponents.js.map +3 -3
  48. package/dist-cjs/lib/options.js +2 -1
  49. package/dist-cjs/lib/options.js.map +2 -2
  50. package/dist-cjs/lib/primitives/Vec.js +10 -5
  51. package/dist-cjs/lib/primitives/Vec.js.map +2 -2
  52. package/dist-cjs/lib/utils/areShapesContentEqual.js +3 -1
  53. package/dist-cjs/lib/utils/areShapesContentEqual.js.map +2 -2
  54. package/dist-cjs/lib/utils/assets.js +4 -6
  55. package/dist-cjs/lib/utils/assets.js.map +2 -2
  56. package/dist-cjs/lib/utils/browserCanvasMaxSize.js +1 -2
  57. package/dist-cjs/lib/utils/browserCanvasMaxSize.js.map +2 -2
  58. package/dist-cjs/lib/utils/debug-flags.js.map +2 -2
  59. package/dist-cjs/lib/utils/deepLinks.js.map +1 -1
  60. package/dist-cjs/lib/utils/dom.js +3 -3
  61. package/dist-cjs/lib/utils/dom.js.map +2 -2
  62. package/dist-cjs/lib/utils/getIncrementedName.js +1 -1
  63. package/dist-cjs/lib/utils/getIncrementedName.js.map +2 -2
  64. package/dist-cjs/lib/utils/getPointerInfo.js.map +2 -2
  65. package/dist-cjs/lib/utils/getSvgPathFromPoints.js.map +1 -1
  66. package/dist-cjs/lib/utils/keyboard.js +2 -2
  67. package/dist-cjs/lib/utils/keyboard.js.map +2 -2
  68. package/dist-cjs/lib/utils/normalizeWheel.js +2 -5
  69. package/dist-cjs/lib/utils/normalizeWheel.js.map +2 -2
  70. package/dist-cjs/lib/utils/reorderShapes.js +6 -6
  71. package/dist-cjs/lib/utils/reorderShapes.js.map +2 -2
  72. package/dist-cjs/lib/utils/reparenting.js +3 -4
  73. package/dist-cjs/lib/utils/reparenting.js.map +2 -2
  74. package/dist-cjs/lib/utils/richText.js.map +1 -1
  75. package/dist-cjs/lib/utils/rotation.js.map +1 -1
  76. package/dist-cjs/lib/utils/runtime.js +12 -0
  77. package/dist-cjs/lib/utils/runtime.js.map +2 -2
  78. package/dist-cjs/version.js +3 -3
  79. package/dist-cjs/version.js.map +1 -1
  80. package/dist-esm/index.d.mts +67 -49
  81. package/dist-esm/index.mjs +8 -5
  82. package/dist-esm/index.mjs.map +2 -2
  83. package/dist-esm/lib/TldrawEditor.mjs +2 -4
  84. package/dist-esm/lib/TldrawEditor.mjs.map +2 -2
  85. package/dist-esm/lib/components/ErrorBoundary.mjs.map +1 -1
  86. package/dist-esm/lib/components/LiveCollaborators.mjs +1 -1
  87. package/dist-esm/lib/components/LiveCollaborators.mjs.map +2 -2
  88. package/dist-esm/lib/components/Shape.mjs +1 -1
  89. package/dist-esm/lib/components/Shape.mjs.map +2 -2
  90. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +1 -1
  91. package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
  92. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +2 -3
  93. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +2 -2
  94. package/dist-esm/lib/components/default-components/DefaultLoadingScreen.mjs +2 -3
  95. package/dist-esm/lib/components/default-components/DefaultLoadingScreen.mjs.map +2 -2
  96. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs +1 -1
  97. package/dist-esm/lib/components/default-components/DefaultShapeIndicator.mjs.map +2 -2
  98. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs +1 -1
  99. package/dist-esm/lib/components/default-components/DefaultShapeIndicators.mjs.map +2 -2
  100. package/dist-esm/lib/config/TLSessionStateSnapshot.mjs +3 -2
  101. package/dist-esm/lib/config/TLSessionStateSnapshot.mjs.map +2 -2
  102. package/dist-esm/lib/editor/Editor.mjs +12 -0
  103. package/dist-esm/lib/editor/Editor.mjs.map +2 -2
  104. package/dist-esm/lib/editor/bindings/BindingUtil.mjs.map +1 -1
  105. package/dist-esm/lib/editor/derivations/bindingsIndex.mjs.map +1 -1
  106. package/dist-esm/lib/editor/derivations/notVisibleShapes.mjs.map +1 -1
  107. package/dist-esm/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.mjs.map +1 -1
  108. package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +1 -1
  109. package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +1 -1
  110. package/dist-esm/lib/editor/managers/ScribbleManager/ScribbleManager.mjs.map +1 -1
  111. package/dist-esm/lib/editor/managers/SnapManager/BoundsSnaps.mjs.map +1 -1
  112. package/dist-esm/lib/editor/managers/SnapManager/HandleSnaps.mjs.map +1 -1
  113. package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +1 -1
  114. package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +1 -1
  115. package/dist-esm/lib/editor/shapes/shared/resizeBox.mjs.map +1 -1
  116. package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +1 -1
  117. package/dist-esm/lib/editor/types/SvgExportContext.mjs.map +1 -1
  118. package/dist-esm/lib/exports/exportToSvg.mjs.map +1 -1
  119. package/dist-esm/lib/exports/getSvgJsx.mjs.map +1 -1
  120. package/dist-esm/lib/hooks/EditorComponentsContext.mjs +14 -0
  121. package/dist-esm/lib/hooks/EditorComponentsContext.mjs.map +7 -0
  122. package/dist-esm/lib/hooks/useCanvasEvents.mjs +10 -2
  123. package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
  124. package/dist-esm/lib/hooks/useEditor.mjs.map +1 -1
  125. package/dist-esm/lib/hooks/useEditorComponents.mjs +12 -36
  126. package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
  127. package/dist-esm/lib/options.mjs +2 -1
  128. package/dist-esm/lib/options.mjs.map +2 -2
  129. package/dist-esm/lib/primitives/Vec.mjs +6 -1
  130. package/dist-esm/lib/primitives/Vec.mjs.map +2 -2
  131. package/dist-esm/lib/utils/areShapesContentEqual.mjs +3 -1
  132. package/dist-esm/lib/utils/areShapesContentEqual.mjs.map +2 -2
  133. package/dist-esm/lib/utils/assets.mjs +4 -6
  134. package/dist-esm/lib/utils/assets.mjs.map +2 -2
  135. package/dist-esm/lib/utils/browserCanvasMaxSize.mjs +1 -2
  136. package/dist-esm/lib/utils/browserCanvasMaxSize.mjs.map +2 -2
  137. package/dist-esm/lib/utils/debug-flags.mjs.map +2 -2
  138. package/dist-esm/lib/utils/deepLinks.mjs.map +1 -1
  139. package/dist-esm/lib/utils/dom.mjs +3 -3
  140. package/dist-esm/lib/utils/dom.mjs.map +2 -2
  141. package/dist-esm/lib/utils/getIncrementedName.mjs +1 -1
  142. package/dist-esm/lib/utils/getIncrementedName.mjs.map +2 -2
  143. package/dist-esm/lib/utils/getPointerInfo.mjs.map +2 -2
  144. package/dist-esm/lib/utils/getSvgPathFromPoints.mjs.map +1 -1
  145. package/dist-esm/lib/utils/keyboard.mjs +2 -2
  146. package/dist-esm/lib/utils/keyboard.mjs.map +2 -2
  147. package/dist-esm/lib/utils/normalizeWheel.mjs +2 -5
  148. package/dist-esm/lib/utils/normalizeWheel.mjs.map +2 -2
  149. package/dist-esm/lib/utils/reorderShapes.mjs +6 -6
  150. package/dist-esm/lib/utils/reorderShapes.mjs.map +2 -2
  151. package/dist-esm/lib/utils/reparenting.mjs +3 -4
  152. package/dist-esm/lib/utils/reparenting.mjs.map +2 -2
  153. package/dist-esm/lib/utils/richText.mjs.map +1 -1
  154. package/dist-esm/lib/utils/rotation.mjs.map +1 -1
  155. package/dist-esm/lib/utils/runtime.mjs +12 -0
  156. package/dist-esm/lib/utils/runtime.mjs.map +2 -2
  157. package/dist-esm/version.mjs +3 -3
  158. package/dist-esm/version.mjs.map +1 -1
  159. package/package.json +7 -7
  160. package/src/index.ts +7 -4
  161. package/src/lib/TldrawEditor.tsx +3 -5
  162. package/src/lib/components/ErrorBoundary.tsx +1 -1
  163. package/src/lib/components/LiveCollaborators.tsx +1 -1
  164. package/src/lib/components/Shape.tsx +1 -1
  165. package/src/lib/components/default-components/DefaultCanvas.tsx +1 -1
  166. package/src/lib/components/default-components/DefaultErrorFallback.tsx +2 -3
  167. package/src/lib/components/default-components/DefaultLoadingScreen.tsx +6 -3
  168. package/src/lib/components/default-components/DefaultShapeIndicator.tsx +1 -1
  169. package/src/lib/components/default-components/DefaultShapeIndicators.tsx +1 -1
  170. package/src/lib/config/TLSessionStateSnapshot.ts +3 -2
  171. package/src/lib/editor/Editor.ts +16 -0
  172. package/src/lib/editor/bindings/BindingUtil.ts +1 -1
  173. package/src/lib/editor/derivations/bindingsIndex.ts +1 -1
  174. package/src/lib/editor/derivations/notVisibleShapes.ts +1 -1
  175. package/src/lib/editor/managers/EdgeScrollManager/EdgeScrollManager.ts +1 -1
  176. package/src/lib/editor/managers/FontManager/FontManager.ts +1 -1
  177. package/src/lib/editor/managers/InputsManager/InputsManager.ts +1 -1
  178. package/src/lib/editor/managers/ScribbleManager/ScribbleManager.ts +1 -1
  179. package/src/lib/editor/managers/SnapManager/BoundsSnaps.ts +2 -2
  180. package/src/lib/editor/managers/SnapManager/HandleSnaps.ts +2 -2
  181. package/src/lib/editor/managers/TextManager/TextManager.ts +1 -1
  182. package/src/lib/editor/managers/TickManager/TickManager.ts +1 -1
  183. package/src/lib/editor/shapes/shared/resizeBox.ts +1 -1
  184. package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +2 -2
  185. package/src/lib/editor/types/SvgExportContext.tsx +1 -1
  186. package/src/lib/exports/exportToSvg.tsx +1 -1
  187. package/src/lib/exports/getSvgJsx.tsx +1 -1
  188. package/src/lib/hooks/EditorComponentsContext.tsx +63 -0
  189. package/src/lib/hooks/useCanvasEvents.ts +13 -2
  190. package/src/lib/hooks/useEditor.tsx +1 -1
  191. package/src/lib/hooks/useEditorComponents.tsx +20 -89
  192. package/src/lib/options.ts +11 -0
  193. package/src/lib/primitives/Vec.ts +7 -1
  194. package/src/lib/utils/areShapesContentEqual.ts +9 -2
  195. package/src/lib/utils/assets.ts +15 -10
  196. package/src/lib/utils/browserCanvasMaxSize.ts +4 -2
  197. package/src/lib/utils/debug-flags.ts +0 -20
  198. package/src/lib/utils/deepLinks.ts +1 -1
  199. package/src/lib/utils/dom.ts +6 -7
  200. package/src/lib/utils/getIncrementedName.ts +1 -1
  201. package/src/lib/utils/getPointerInfo.ts +1 -0
  202. package/src/lib/utils/getSvgPathFromPoints.ts +1 -1
  203. package/src/lib/utils/keyboard.ts +6 -4
  204. package/src/lib/utils/normalizeWheel.ts +8 -8
  205. package/src/lib/utils/reorderShapes.ts +17 -8
  206. package/src/lib/utils/reparenting.ts +5 -10
  207. package/src/lib/utils/richText.ts +1 -1
  208. package/src/lib/utils/rotation.ts +1 -1
  209. package/src/lib/utils/runtime.ts +26 -1
  210. package/src/version.ts +3 -3
  211. package/dist-cjs/lib/utils/hardResetEditor.js.map +0 -7
  212. package/dist-cjs/lib/utils/refreshPage.js +0 -28
  213. package/dist-cjs/lib/utils/refreshPage.js.map +0 -7
  214. package/dist-cjs/lib/utils/window-open.js +0 -28
  215. package/dist-cjs/lib/utils/window-open.js.map +0 -7
  216. package/dist-esm/lib/utils/hardResetEditor.mjs +0 -8
  217. package/dist-esm/lib/utils/hardResetEditor.mjs.map +0 -7
  218. package/dist-esm/lib/utils/refreshPage.mjs +0 -8
  219. package/dist-esm/lib/utils/refreshPage.mjs.map +0 -7
  220. package/dist-esm/lib/utils/window-open.mjs +0 -8
  221. package/dist-esm/lib/utils/window-open.mjs.map +0 -7
  222. package/src/lib/utils/hardResetEditor.ts +0 -6
  223. package/src/lib/utils/refreshPage.ts +0 -6
  224. package/src/lib/utils/window-open.ts +0 -16
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/utils/richText.ts"],
4
- "sourcesContent": ["import { getSchema, JSONContent, Editor as TTEditor } from '@tiptap/core'\nimport { Node, Schema } from '@tiptap/pm/model'\nimport { EditorProviderProps } from '@tiptap/react'\nimport { TLRichText } from '@tldraw/tlschema'\nimport { assert, WeakCache } from '@tldraw/utils'\nimport { Editor } from '../editor/Editor'\nimport { TLFontFace } from '../editor/managers/FontManager/FontManager'\n\n/**\n * This is the TipTap editor! Docs are {@link https://tiptap.dev/docs}.\n *\n * @public\n */\nexport type TiptapEditor = TTEditor\n\n/**\n * A TipTap node. See {@link https://tiptap.dev/docs}.\n * @public\n */\nexport type TiptapNode = Node\n\n/** @public */\nexport interface TLTextOptions {\n\ttipTapConfig?: EditorProviderProps\n\taddFontsFromNode?: RichTextFontVisitor\n}\n\n/** @public */\nexport interface RichTextFontVisitorState {\n\treadonly family: string\n\treadonly weight: string\n\treadonly style: string\n}\n\n/** @public */\nexport type RichTextFontVisitor = (\n\tnode: TiptapNode,\n\tstate: RichTextFontVisitorState,\n\taddFont: (font: TLFontFace) => void\n) => RichTextFontVisitorState\n\nconst schemaCache = new WeakCache<EditorProviderProps, Schema>()\nexport function getTipTapSchema(tipTapConfig: EditorProviderProps) {\n\treturn schemaCache.get(tipTapConfig, () => getSchema(tipTapConfig.extensions ?? []))\n}\n\n/** @public */\nexport function getFontsFromRichText(\n\teditor: Editor,\n\trichText: TLRichText,\n\tinitialState: RichTextFontVisitorState\n) {\n\tconst { tipTapConfig, addFontsFromNode } = editor.getTextOptions()\n\tassert(tipTapConfig, 'textOptions.tipTapConfig must be set to use rich text')\n\tassert(addFontsFromNode, 'textOptions.addFontsFromNode must be set to use rich text')\n\n\tconst schema = getTipTapSchema(tipTapConfig)\n\n\tconst rootNode = Node.fromJSON(schema, richText as JSONContent)\n\n\tconst fonts = new Set<TLFontFace>()\n\n\tfunction addFont(font: TLFontFace) {\n\t\tfonts.add(font)\n\t}\n\n\tfunction visit(node: TiptapNode, state: RichTextFontVisitorState) {\n\t\tstate = addFontsFromNode!(node, state, addFont)\n\n\t\tfor (const child of node.children) {\n\t\t\tvisit(child, state)\n\t\t}\n\t}\n\n\tvisit(rootNode, initialState)\n\n\treturn Array.from(fonts)\n}\n"],
4
+ "sourcesContent": ["import { getSchema, JSONContent, Editor as TTEditor } from '@tiptap/core'\nimport { Node, Schema } from '@tiptap/pm/model'\nimport { EditorProviderProps } from '@tiptap/react'\nimport { TLRichText } from '@tldraw/tlschema'\nimport { assert, WeakCache } from '@tldraw/utils'\nimport type { Editor } from '../editor/Editor'\nimport { TLFontFace } from '../editor/managers/FontManager/FontManager'\n\n/**\n * This is the TipTap editor! Docs are {@link https://tiptap.dev/docs}.\n *\n * @public\n */\nexport type TiptapEditor = TTEditor\n\n/**\n * A TipTap node. See {@link https://tiptap.dev/docs}.\n * @public\n */\nexport type TiptapNode = Node\n\n/** @public */\nexport interface TLTextOptions {\n\ttipTapConfig?: EditorProviderProps\n\taddFontsFromNode?: RichTextFontVisitor\n}\n\n/** @public */\nexport interface RichTextFontVisitorState {\n\treadonly family: string\n\treadonly weight: string\n\treadonly style: string\n}\n\n/** @public */\nexport type RichTextFontVisitor = (\n\tnode: TiptapNode,\n\tstate: RichTextFontVisitorState,\n\taddFont: (font: TLFontFace) => void\n) => RichTextFontVisitorState\n\nconst schemaCache = new WeakCache<EditorProviderProps, Schema>()\nexport function getTipTapSchema(tipTapConfig: EditorProviderProps) {\n\treturn schemaCache.get(tipTapConfig, () => getSchema(tipTapConfig.extensions ?? []))\n}\n\n/** @public */\nexport function getFontsFromRichText(\n\teditor: Editor,\n\trichText: TLRichText,\n\tinitialState: RichTextFontVisitorState\n) {\n\tconst { tipTapConfig, addFontsFromNode } = editor.getTextOptions()\n\tassert(tipTapConfig, 'textOptions.tipTapConfig must be set to use rich text')\n\tassert(addFontsFromNode, 'textOptions.addFontsFromNode must be set to use rich text')\n\n\tconst schema = getTipTapSchema(tipTapConfig)\n\n\tconst rootNode = Node.fromJSON(schema, richText as JSONContent)\n\n\tconst fonts = new Set<TLFontFace>()\n\n\tfunction addFont(font: TLFontFace) {\n\t\tfonts.add(font)\n\t}\n\n\tfunction visit(node: TiptapNode, state: RichTextFontVisitorState) {\n\t\tstate = addFontsFromNode!(node, state, addFont)\n\n\t\tfor (const child of node.children) {\n\t\t\tvisit(child, state)\n\t\t}\n\t}\n\n\tvisit(rootNode, initialState)\n\n\treturn Array.from(fonts)\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA2D;AAC3D,mBAA6B;AAG7B,mBAAkC;AAqClC,MAAM,cAAc,IAAI,uBAAuC;AACxD,SAAS,gBAAgB,cAAmC;AAClE,SAAO,YAAY,IAAI,cAAc,UAAM,uBAAU,aAAa,cAAc,CAAC,CAAC,CAAC;AACpF;AAGO,SAAS,qBACf,QACA,UACA,cACC;AACD,QAAM,EAAE,cAAc,iBAAiB,IAAI,OAAO,eAAe;AACjE,2BAAO,cAAc,uDAAuD;AAC5E,2BAAO,kBAAkB,2DAA2D;AAEpF,QAAM,SAAS,gBAAgB,YAAY;AAE3C,QAAM,WAAW,kBAAK,SAAS,QAAQ,QAAuB;AAE9D,QAAM,QAAQ,oBAAI,IAAgB;AAElC,WAAS,QAAQ,MAAkB;AAClC,UAAM,IAAI,IAAI;AAAA,EACf;AAEA,WAAS,MAAM,MAAkB,OAAiC;AACjE,YAAQ,iBAAkB,MAAM,OAAO,OAAO;AAE9C,eAAW,SAAS,KAAK,UAAU;AAClC,YAAM,OAAO,KAAK;AAAA,IACnB;AAAA,EACD;AAEA,QAAM,UAAU,YAAY;AAE5B,SAAO,MAAM,KAAK,KAAK;AACxB;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/utils/rotation.ts"],
4
- "sourcesContent": ["import { isShapeId, TLShape, TLShapeId, TLShapePartial } from '@tldraw/tlschema'\nimport { compact } from '@tldraw/utils'\nimport { Editor } from '../editor/Editor'\nimport { Mat } from '../primitives/Mat'\nimport { canonicalizeRotation } from '../primitives/utils'\nimport { Vec, VecLike } from '../primitives/Vec'\n\n/** @internal */\nexport function getRotationSnapshot({\n\teditor,\n\tids,\n}: {\n\teditor: Editor\n\tids: TLShapeId[]\n}): TLRotationSnapshot | null {\n\tconst shapes = compact(ids.map((id) => editor.getShape(id)))\n\tconst rotation = editor.getShapesSharedRotation(ids)\n\tconst rotatedPageBounds = editor.getShapesRotatedPageBounds(ids)\n\n\t// todo: this assumes we're rotating the selected shapes\n\t// if we try to rotate shapes that aren't selected, this\n\t// will produce the wrong results\n\n\t// Return null if there are no selected shapes\n\tif (!rotatedPageBounds) {\n\t\treturn null\n\t}\n\n\tconst initialPageCenter = rotatedPageBounds.center\n\t\t.clone()\n\t\t.rotWith(rotatedPageBounds.point, rotation)\n\n\treturn {\n\t\tinitialPageCenter,\n\t\tinitialCursorAngle: initialPageCenter.angle(editor.inputs.getOriginPagePoint()),\n\t\tinitialShapesRotation: rotation,\n\t\tshapeSnapshots: shapes.map((shape) => ({\n\t\t\tshape,\n\t\t\tinitialPagePoint: editor.getShapePageTransform(shape.id)!.point(),\n\t\t})),\n\t}\n}\n\n/**\n * @internal\n **/\nexport interface TLRotationSnapshot {\n\tinitialPageCenter: Vec\n\tinitialCursorAngle: number\n\tinitialShapesRotation: number\n\tshapeSnapshots: {\n\t\tshape: TLShape\n\t\tinitialPagePoint: Vec\n\t}[]\n}\n\n/** @internal */\nexport function applyRotationToSnapshotShapes({\n\tdelta,\n\teditor,\n\tsnapshot,\n\tstage,\n\tcenterOverride,\n}: {\n\tdelta: number\n\tsnapshot: TLRotationSnapshot\n\teditor: Editor\n\tstage: 'start' | 'update' | 'end' | 'one-off'\n\tcenterOverride?: VecLike\n}) {\n\tconst { initialPageCenter, shapeSnapshots } = snapshot\n\n\teditor.updateShapes(\n\t\tshapeSnapshots.map(({ shape, initialPagePoint }) => {\n\t\t\t// We need to both rotate each shape individually and rotate the shapes\n\t\t\t// around the pivot point (the average center of all rotating shapes.)\n\n\t\t\tconst parentTransform = isShapeId(shape.parentId)\n\t\t\t\t? editor.getShapePageTransform(shape.parentId)!\n\t\t\t\t: Mat.Identity()\n\n\t\t\tconst newPagePoint = Vec.RotWith(initialPagePoint, centerOverride ?? initialPageCenter, delta)\n\n\t\t\tconst newLocalPoint = Mat.applyToPoint(\n\t\t\t\t// use the current parent transform in case it has moved/resized since the start\n\t\t\t\t// (e.g. if rotating a shape at the edge of a group)\n\t\t\t\tMat.Inverse(parentTransform),\n\t\t\t\tnewPagePoint\n\t\t\t)\n\t\t\tconst newRotation = canonicalizeRotation(shape.rotation + delta)\n\n\t\t\treturn {\n\t\t\t\tid: shape.id,\n\t\t\t\ttype: shape.type,\n\t\t\t\tx: newLocalPoint.x,\n\t\t\t\ty: newLocalPoint.y,\n\t\t\t\trotation: newRotation,\n\t\t\t}\n\t\t})\n\t)\n\n\t// Handle change\n\n\tconst changes: TLShapePartial[] = []\n\n\tshapeSnapshots.forEach(({ shape }) => {\n\t\tconst current = editor.getShape(shape.id)\n\t\tif (!current) return\n\t\tconst util = editor.getShapeUtil(shape)\n\n\t\tif (stage === 'start' || stage === 'one-off') {\n\t\t\tconst changeStart = util.onRotateStart?.(shape)\n\t\t\tif (changeStart) changes.push(changeStart)\n\t\t}\n\n\t\tconst changeUpdate = util.onRotate?.(shape, current)\n\t\tif (changeUpdate) changes.push(changeUpdate)\n\n\t\tif (stage === 'end' || stage === 'one-off') {\n\t\t\tconst changeEnd = util.onRotateEnd?.(shape, current)\n\t\t\tif (changeEnd) changes.push(changeEnd)\n\t\t}\n\t})\n\n\tif (changes.length > 0) {\n\t\teditor.updateShapes(changes)\n\t}\n}\n"],
4
+ "sourcesContent": ["import { isShapeId, TLShape, TLShapeId, TLShapePartial } from '@tldraw/tlschema'\nimport { compact } from '@tldraw/utils'\nimport type { Editor } from '../editor/Editor'\nimport { Mat } from '../primitives/Mat'\nimport { canonicalizeRotation } from '../primitives/utils'\nimport { Vec, VecLike } from '../primitives/Vec'\n\n/** @internal */\nexport function getRotationSnapshot({\n\teditor,\n\tids,\n}: {\n\teditor: Editor\n\tids: TLShapeId[]\n}): TLRotationSnapshot | null {\n\tconst shapes = compact(ids.map((id) => editor.getShape(id)))\n\tconst rotation = editor.getShapesSharedRotation(ids)\n\tconst rotatedPageBounds = editor.getShapesRotatedPageBounds(ids)\n\n\t// todo: this assumes we're rotating the selected shapes\n\t// if we try to rotate shapes that aren't selected, this\n\t// will produce the wrong results\n\n\t// Return null if there are no selected shapes\n\tif (!rotatedPageBounds) {\n\t\treturn null\n\t}\n\n\tconst initialPageCenter = rotatedPageBounds.center\n\t\t.clone()\n\t\t.rotWith(rotatedPageBounds.point, rotation)\n\n\treturn {\n\t\tinitialPageCenter,\n\t\tinitialCursorAngle: initialPageCenter.angle(editor.inputs.getOriginPagePoint()),\n\t\tinitialShapesRotation: rotation,\n\t\tshapeSnapshots: shapes.map((shape) => ({\n\t\t\tshape,\n\t\t\tinitialPagePoint: editor.getShapePageTransform(shape.id)!.point(),\n\t\t})),\n\t}\n}\n\n/**\n * @internal\n **/\nexport interface TLRotationSnapshot {\n\tinitialPageCenter: Vec\n\tinitialCursorAngle: number\n\tinitialShapesRotation: number\n\tshapeSnapshots: {\n\t\tshape: TLShape\n\t\tinitialPagePoint: Vec\n\t}[]\n}\n\n/** @internal */\nexport function applyRotationToSnapshotShapes({\n\tdelta,\n\teditor,\n\tsnapshot,\n\tstage,\n\tcenterOverride,\n}: {\n\tdelta: number\n\tsnapshot: TLRotationSnapshot\n\teditor: Editor\n\tstage: 'start' | 'update' | 'end' | 'one-off'\n\tcenterOverride?: VecLike\n}) {\n\tconst { initialPageCenter, shapeSnapshots } = snapshot\n\n\teditor.updateShapes(\n\t\tshapeSnapshots.map(({ shape, initialPagePoint }) => {\n\t\t\t// We need to both rotate each shape individually and rotate the shapes\n\t\t\t// around the pivot point (the average center of all rotating shapes.)\n\n\t\t\tconst parentTransform = isShapeId(shape.parentId)\n\t\t\t\t? editor.getShapePageTransform(shape.parentId)!\n\t\t\t\t: Mat.Identity()\n\n\t\t\tconst newPagePoint = Vec.RotWith(initialPagePoint, centerOverride ?? initialPageCenter, delta)\n\n\t\t\tconst newLocalPoint = Mat.applyToPoint(\n\t\t\t\t// use the current parent transform in case it has moved/resized since the start\n\t\t\t\t// (e.g. if rotating a shape at the edge of a group)\n\t\t\t\tMat.Inverse(parentTransform),\n\t\t\t\tnewPagePoint\n\t\t\t)\n\t\t\tconst newRotation = canonicalizeRotation(shape.rotation + delta)\n\n\t\t\treturn {\n\t\t\t\tid: shape.id,\n\t\t\t\ttype: shape.type,\n\t\t\t\tx: newLocalPoint.x,\n\t\t\t\ty: newLocalPoint.y,\n\t\t\t\trotation: newRotation,\n\t\t\t}\n\t\t})\n\t)\n\n\t// Handle change\n\n\tconst changes: TLShapePartial[] = []\n\n\tshapeSnapshots.forEach(({ shape }) => {\n\t\tconst current = editor.getShape(shape.id)\n\t\tif (!current) return\n\t\tconst util = editor.getShapeUtil(shape)\n\n\t\tif (stage === 'start' || stage === 'one-off') {\n\t\t\tconst changeStart = util.onRotateStart?.(shape)\n\t\t\tif (changeStart) changes.push(changeStart)\n\t\t}\n\n\t\tconst changeUpdate = util.onRotate?.(shape, current)\n\t\tif (changeUpdate) changes.push(changeUpdate)\n\n\t\tif (stage === 'end' || stage === 'one-off') {\n\t\t\tconst changeEnd = util.onRotateEnd?.(shape, current)\n\t\t\tif (changeEnd) changes.push(changeEnd)\n\t\t}\n\t})\n\n\tif (changes.length > 0) {\n\t\teditor.updateShapes(changes)\n\t}\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAA8D;AAC9D,mBAAwB;AAExB,iBAAoB;AACpB,IAAAA,gBAAqC;AACrC,iBAA6B;AAGtB,SAAS,oBAAoB;AAAA,EACnC;AAAA,EACA;AACD,GAG8B;AAC7B,QAAM,aAAS,sBAAQ,IAAI,IAAI,CAAC,OAAO,OAAO,SAAS,EAAE,CAAC,CAAC;AAC3D,QAAM,WAAW,OAAO,wBAAwB,GAAG;AACnD,QAAM,oBAAoB,OAAO,2BAA2B,GAAG;AAO/D,MAAI,CAAC,mBAAmB;AACvB,WAAO;AAAA,EACR;AAEA,QAAM,oBAAoB,kBAAkB,OAC1C,MAAM,EACN,QAAQ,kBAAkB,OAAO,QAAQ;AAE3C,SAAO;AAAA,IACN;AAAA,IACA,oBAAoB,kBAAkB,MAAM,OAAO,OAAO,mBAAmB,CAAC;AAAA,IAC9E,uBAAuB;AAAA,IACvB,gBAAgB,OAAO,IAAI,CAAC,WAAW;AAAA,MACtC;AAAA,MACA,kBAAkB,OAAO,sBAAsB,MAAM,EAAE,EAAG,MAAM;AAAA,IACjE,EAAE;AAAA,EACH;AACD;AAgBO,SAAS,8BAA8B;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAMG;AACF,QAAM,EAAE,mBAAmB,eAAe,IAAI;AAE9C,SAAO;AAAA,IACN,eAAe,IAAI,CAAC,EAAE,OAAO,iBAAiB,MAAM;AAInD,YAAM,sBAAkB,2BAAU,MAAM,QAAQ,IAC7C,OAAO,sBAAsB,MAAM,QAAQ,IAC3C,eAAI,SAAS;AAEhB,YAAM,eAAe,eAAI,QAAQ,kBAAkB,kBAAkB,mBAAmB,KAAK;AAE7F,YAAM,gBAAgB,eAAI;AAAA;AAAA;AAAA,QAGzB,eAAI,QAAQ,eAAe;AAAA,QAC3B;AAAA,MACD;AACA,YAAM,kBAAc,oCAAqB,MAAM,WAAW,KAAK;AAE/D,aAAO;AAAA,QACN,IAAI,MAAM;AAAA,QACV,MAAM,MAAM;AAAA,QACZ,GAAG,cAAc;AAAA,QACjB,GAAG,cAAc;AAAA,QACjB,UAAU;AAAA,MACX;AAAA,IACD,CAAC;AAAA,EACF;AAIA,QAAM,UAA4B,CAAC;AAEnC,iBAAe,QAAQ,CAAC,EAAE,MAAM,MAAM;AACrC,UAAM,UAAU,OAAO,SAAS,MAAM,EAAE;AACxC,QAAI,CAAC,QAAS;AACd,UAAM,OAAO,OAAO,aAAa,KAAK;AAEtC,QAAI,UAAU,WAAW,UAAU,WAAW;AAC7C,YAAM,cAAc,KAAK,gBAAgB,KAAK;AAC9C,UAAI,YAAa,SAAQ,KAAK,WAAW;AAAA,IAC1C;AAEA,UAAM,eAAe,KAAK,WAAW,OAAO,OAAO;AACnD,QAAI,aAAc,SAAQ,KAAK,YAAY;AAE3C,QAAI,UAAU,SAAS,UAAU,WAAW;AAC3C,YAAM,YAAY,KAAK,cAAc,OAAO,OAAO;AACnD,UAAI,UAAW,SAAQ,KAAK,SAAS;AAAA,IACtC;AAAA,EACD,CAAC;AAED,MAAI,QAAQ,SAAS,GAAG;AACvB,WAAO,aAAa,OAAO;AAAA,EAC5B;AACD;",
6
6
  "names": ["import_utils"]
7
7
  }
@@ -18,6 +18,9 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var runtime_exports = {};
20
20
  __export(runtime_exports, {
21
+ hardResetEditor: () => hardResetEditor,
22
+ openWindow: () => openWindow,
23
+ refreshPage: () => refreshPage,
21
24
  runtime: () => runtime,
22
25
  setRuntimeOverrides: () => setRuntimeOverrides
23
26
  });
@@ -36,4 +39,13 @@ const runtime = {
36
39
  function setRuntimeOverrides(input) {
37
40
  Object.assign(runtime, input);
38
41
  }
42
+ function openWindow(url, target = "_blank", allowReferrer) {
43
+ return runtime.openWindow(url, target, allowReferrer);
44
+ }
45
+ function refreshPage() {
46
+ runtime.refreshPage();
47
+ }
48
+ function hardResetEditor() {
49
+ runtime.hardReset();
50
+ }
39
51
  //# sourceMappingURL=runtime.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/utils/runtime.ts"],
4
- "sourcesContent": ["/** @public */\nexport const runtime: {\n\topenWindow(url: string, target: string, allowReferrer?: boolean): void\n\trefreshPage(): void\n\thardReset(): void\n} = {\n\topenWindow(url, target, allowReferrer = false) {\n\t\treturn window.open(url, target, allowReferrer ? 'noopener' : 'noopener noreferrer')\n\t},\n\trefreshPage() {\n\t\twindow.location.reload()\n\t},\n\tasync hardReset() {\n\t\treturn await (window as any).__tldraw__hardReset?.()\n\t},\n}\n\n/** @public */\nexport function setRuntimeOverrides(input: Partial<typeof runtime>) {\n\tObject.assign(runtime, input)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,MAAM,UAIT;AAAA,EACH,WAAW,KAAK,QAAQ,gBAAgB,OAAO;AAC9C,WAAO,OAAO,KAAK,KAAK,QAAQ,gBAAgB,aAAa,qBAAqB;AAAA,EACnF;AAAA,EACA,cAAc;AACb,WAAO,SAAS,OAAO;AAAA,EACxB;AAAA,EACA,MAAM,YAAY;AACjB,WAAO,MAAO,OAAe,sBAAsB;AAAA,EACpD;AACD;AAGO,SAAS,oBAAoB,OAAgC;AACnE,SAAO,OAAO,SAAS,KAAK;AAC7B;",
4
+ "sourcesContent": ["/** @public */\nexport const runtime: {\n\topenWindow(url: string, target: string, allowReferrer?: boolean): void\n\trefreshPage(): void\n\thardReset(): Promise<void>\n} = {\n\topenWindow(url, target, allowReferrer = false) {\n\t\treturn window.open(url, target, allowReferrer ? 'noopener' : 'noopener noreferrer')\n\t},\n\trefreshPage() {\n\t\twindow.location.reload()\n\t},\n\tasync hardReset() {\n\t\treturn await (window as any).__tldraw__hardReset?.()\n\t},\n}\n\n/** @public */\nexport function setRuntimeOverrides(input: Partial<typeof runtime>) {\n\tObject.assign(runtime, input)\n}\n\n/**\n * Open a new window with the given URL and target. Prefer this to the window.open function, as it\n * will work more reliably in embedded scenarios, such as our VS Code extension. See the runtime\n * object in tldraw/editor for more details.\n *\n * @param url - The URL to open.\n * @param target - The target window to open the URL in.\n * @param allowReferrer - Whether to allow the referrer to be sent to the new window.\n * @returns The new window object.\n * @public\n */\nexport function openWindow(url: string, target = '_blank', allowReferrer?: boolean) {\n\treturn runtime.openWindow(url, target, allowReferrer)\n}\n\n/** @public */\nexport function refreshPage() {\n\truntime.refreshPage()\n}\n\n/** @public */\nexport function hardResetEditor() {\n\truntime.hardReset()\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,MAAM,UAIT;AAAA,EACH,WAAW,KAAK,QAAQ,gBAAgB,OAAO;AAC9C,WAAO,OAAO,KAAK,KAAK,QAAQ,gBAAgB,aAAa,qBAAqB;AAAA,EACnF;AAAA,EACA,cAAc;AACb,WAAO,SAAS,OAAO;AAAA,EACxB;AAAA,EACA,MAAM,YAAY;AACjB,WAAO,MAAO,OAAe,sBAAsB;AAAA,EACpD;AACD;AAGO,SAAS,oBAAoB,OAAgC;AACnE,SAAO,OAAO,SAAS,KAAK;AAC7B;AAaO,SAAS,WAAW,KAAa,SAAS,UAAU,eAAyB;AACnF,SAAO,QAAQ,WAAW,KAAK,QAAQ,aAAa;AACrD;AAGO,SAAS,cAAc;AAC7B,UAAQ,YAAY;AACrB;AAGO,SAAS,kBAAkB;AACjC,UAAQ,UAAU;AACnB;",
6
6
  "names": []
7
7
  }
@@ -22,10 +22,10 @@ __export(version_exports, {
22
22
  version: () => version
23
23
  });
24
24
  module.exports = __toCommonJS(version_exports);
25
- const version = "4.4.0";
25
+ const version = "4.5.0-canary.1dbf0b796046";
26
26
  const publishDates = {
27
27
  major: "2025-09-18T14:39:22.803Z",
28
- minor: "2026-02-18T12:03:50.380Z",
29
- patch: "2026-02-18T12:03:50.380Z"
28
+ minor: "2026-02-20T11:38:52.737Z",
29
+ patch: "2026-02-20T11:38:52.737Z"
30
30
  };
31
31
  //# sourceMappingURL=version.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/version.ts"],
4
- "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '4.4.0'\nexport const publishDates = {\n\tmajor: '2025-09-18T14:39:22.803Z',\n\tminor: '2026-02-18T12:03:50.380Z',\n\tpatch: '2026-02-18T12:03:50.380Z',\n}\n"],
4
+ "sourcesContent": ["// This file is automatically generated by internal/scripts/refresh-assets.ts.\n// Do not edit manually. Or do, I'm a comment, not a cop.\n\nexport const version = '4.5.0-canary.1dbf0b796046'\nexport const publishDates = {\n\tmajor: '2025-09-18T14:39:22.803Z',\n\tminor: '2026-02-20T11:38:52.737Z',\n\tpatch: '2026-02-20T11:38:52.737Z',\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -20,6 +20,7 @@ import { MigrationSequence } from '@tldraw/store';
20
20
  import { NamedExoticComponent } from 'react';
21
21
  import { Node as Node_2 } from '@tiptap/pm/model';
22
22
  import { PerformanceTracker } from '@tldraw/utils';
23
+ import { PointerEvent as PointerEvent_2 } from 'react';
23
24
  import { PointerEventHandler } from 'react';
24
25
  import * as React_2 from 'react';
25
26
  import { default as React_3 } from 'react';
@@ -63,7 +64,6 @@ import { TLImageAsset } from '@tldraw/tlschema';
63
64
  import { TLInstance } from '@tldraw/tlschema';
64
65
  import { TLInstancePageState } from '@tldraw/tlschema';
65
66
  import { TLInstancePresence } from '@tldraw/tlschema';
66
- import { TLOpacityType } from '@tldraw/tlschema';
67
67
  import { TLPage } from '@tldraw/tlschema';
68
68
  import { TLPageId } from '@tldraw/tlschema';
69
69
  import { TLParentId } from '@tldraw/tlschema';
@@ -439,13 +439,13 @@ export declare class BoundsSnaps {
439
439
  private getSnappablePoints;
440
440
  private getSnappableGapNodes;
441
441
  private getVisibleGaps;
442
- snapTranslateShapes({ lockedAxis, initialSelectionPageBounds, initialSelectionSnapPoints, dragDelta, }: {
442
+ snapTranslateShapes({ lockedAxis, initialSelectionPageBounds, initialSelectionSnapPoints, dragDelta }: {
443
443
  dragDelta: Vec;
444
444
  initialSelectionPageBounds: Box;
445
445
  initialSelectionSnapPoints: BoundsSnapPoint[];
446
446
  lockedAxis: 'x' | 'y' | null;
447
447
  }): SnapData;
448
- snapResizeShapes({ initialSelectionPageBounds, dragDelta, handle: originalHandle, isAspectRatioLocked, isResizingFromCenter, }: {
448
+ snapResizeShapes({ initialSelectionPageBounds, dragDelta, handle: originalHandle, isAspectRatioLocked, isResizingFromCenter }: {
449
449
  dragDelta: Vec;
450
450
  handle: SelectionCorner | SelectionEdge;
451
451
  initialSelectionPageBounds: Box;
@@ -679,7 +679,7 @@ export declare const coreShapes: readonly [typeof GroupShapeUtil];
679
679
  export declare function counterClockwiseAngleDist(a0: number, a1: number): number;
680
680
 
681
681
  /** @public */
682
- export declare function createDebugValue<T>(name: string, { defaults, shouldStoreForSession, }: {
682
+ export declare function createDebugValue<T>(name: string, { defaults, shouldStoreForSession }: {
683
683
  defaults: DebugFlagDefaults<T>;
684
684
  shouldStoreForSession?: boolean;
685
685
  }): DebugFlag<T>;
@@ -729,8 +729,8 @@ export declare function createTLStore({ initialData, defaultName, id, assets, on
729
729
 
730
730
  /** @public */
731
731
  export declare function createTLUser(opts?: {
732
- setUserPreferences?: (userPreferences: TLUserPreferences) => void;
733
- userPreferences?: Signal<TLUserPreferences>;
732
+ setUserPreferences?: ((userPreferences: TLUserPreferences) => void) | undefined;
733
+ userPreferences?: Signal<TLUserPreferences, unknown> | undefined;
734
734
  }): TLUser;
735
735
 
736
736
  /** @public */
@@ -769,7 +769,13 @@ export declare class CubicSpline2d extends Geometry2d {
769
769
  getSvgPathData(): string;
770
770
  }
771
771
 
772
- /** @public */
772
+ /**
773
+ * Converts a data URL to a file.
774
+ * @param url - The data URL to convert.
775
+ * @param filename - The name of the file.
776
+ * @param mimeType - The MIME type of the file.
777
+ * @returns A promise that resolves to a file.
778
+ * @public */
773
779
  export declare function dataUrlToFile(url: string, filename: string, mimeType: string): Promise<File>;
774
780
 
775
781
  /** @public */
@@ -808,7 +814,7 @@ export declare const DefaultBrush: ({ brush, color, opacity, className }: TLBrus
808
814
  export declare function DefaultCanvas({ className }: TLCanvasComponentProps): JSX.Element;
809
815
 
810
816
  /** @public @react */
811
- export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity, }: TLCollaboratorHintProps): JSX.Element;
817
+ export declare function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity }: TLCollaboratorHintProps): JSX.Element;
812
818
 
813
819
  /** @public @react */
814
820
  export declare const DefaultCursor: NamedExoticComponent<TLCursorProps>;
@@ -878,6 +884,7 @@ export declare const defaultTldrawOptions: {
878
884
  readonly edgeScrollEaseDuration: 200;
879
885
  readonly edgeScrollSpeed: 25;
880
886
  readonly enableToolbarKeyboardShortcuts: true;
887
+ readonly experimental__onDropOnCanvas: undefined;
881
888
  readonly exportProvider: ExoticComponent<FragmentProps>;
882
889
  readonly flattenImageBoundsExpand: 64;
883
890
  readonly flattenImageBoundsPadding: 16;
@@ -1015,7 +1022,7 @@ export declare class EdgeScrollManager {
1015
1022
  /** @public */
1016
1023
  export declare class Editor extends EventEmitter<TLEventMap> {
1017
1024
  readonly id: string;
1018
- constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, initialState, autoFocus, inferDarkMode, options: _options, textOptions: _textOptions, getShapeVisibility, fontAssetUrls, }: TLEditorOptions);
1025
+ constructor({ store, user, shapeUtils, bindingUtils, tools, getContainer, cameraOptions, initialState, autoFocus, inferDarkMode, options: _options, textOptions: _textOptions, getShapeVisibility, fontAssetUrls }: TLEditorOptions);
1019
1026
  private readonly _getShapeVisibility?;
1020
1027
  private getIsShapeHiddenCache;
1021
1028
  isShapeHidden(shapeOrId: TLShape | TLShapeId): boolean;
@@ -1088,8 +1095,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1088
1095
  readonly timers: {
1089
1096
  dispose: () => void;
1090
1097
  requestAnimationFrame: (callback: FrameRequestCallback) => number;
1091
- setInterval: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
1092
- setTimeout: (handler: TimerHandler, timeout?: number, ...args: any[]) => number;
1098
+ setInterval: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
1099
+ setTimeout: (handler: TimerHandler, timeout?: number | undefined, ...args: any[]) => number;
1093
1100
  };
1094
1101
  /**
1095
1102
  * A manager for the user and their preferences.
@@ -1480,14 +1487,14 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1480
1487
  * @public
1481
1488
  */
1482
1489
  getPageStates(): TLInstancePageState[];
1483
- /* Excluded from this release type: _getPageStatesQuery */
1490
+ private _getPageStatesQuery;
1484
1491
  /**
1485
1492
  * The current page state.
1486
1493
  *
1487
1494
  * @public
1488
1495
  */
1489
1496
  getCurrentPageState(): TLInstancePageState;
1490
- /* Excluded from this release type: _getCurrentPageStateId */
1497
+ private _getCurrentPageStateId;
1491
1498
  /**
1492
1499
  * Update this instance's page state.
1493
1500
  *
@@ -1880,7 +1887,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
1880
1887
  *
1881
1888
  * @public */
1882
1889
  getTextOptions(): TLTextOptions;
1883
- /* Excluded from this release type: _unsafe_getCameraId */
1890
+ private _unsafe_getCameraId;
1884
1891
  /**
1885
1892
  * The current camera.
1886
1893
  *
@@ -2130,10 +2137,10 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2130
2137
  */
2131
2138
  slideCamera(opts?: {
2132
2139
  direction: VecLike;
2133
- force?: boolean;
2134
- friction?: number;
2140
+ force?: boolean | undefined;
2141
+ friction?: number | undefined;
2135
2142
  speed: number;
2136
- speedThreshold?: number;
2143
+ speedThreshold?: number | undefined;
2137
2144
  }): this;
2138
2145
  /**
2139
2146
  * Animate the camera to a user's cursor position. This also briefly show the user's cursor if it's not currently visible.
@@ -2441,7 +2448,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2441
2448
  * @public
2442
2449
  */
2443
2450
  renamePage(page: TLPage | TLPageId, name: string): this;
2444
- /* Excluded from this release type: _getAllAssetsQuery */
2451
+ private _getAllAssetsQuery;
2445
2452
  /**
2446
2453
  * Get all assets in the editor.
2447
2454
  *
@@ -2530,7 +2537,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2530
2537
  * @public
2531
2538
  */
2532
2539
  getShapeGeometry<T extends Geometry2d>(shape: TLShape | TLShapeId, opts?: TLGeometryOpts): T;
2533
- /* Excluded from this release type: _getShapeHandlesCache */
2540
+ private _getShapeHandlesCache;
2534
2541
  /**
2535
2542
  * Get the handles (if any) for a shape.
2536
2543
  *
@@ -2560,7 +2567,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2560
2567
  * @public
2561
2568
  */
2562
2569
  getShapeLocalTransform(shape: TLShape | TLShapeId): Mat;
2563
- /* Excluded from this release type: _getShapePageTransformCache */
2570
+ private _getShapePageTransformCache;
2564
2571
  /**
2565
2572
  * Get the local transform of a shape's parent as a matrix model.
2566
2573
  *
@@ -2588,7 +2595,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2588
2595
  * @public
2589
2596
  */
2590
2597
  getShapePageTransform(shape: TLShape | TLShapeId): Mat;
2591
- /* Excluded from this release type: _getShapePageBoundsCache */
2598
+ private _getShapePageBoundsCache;
2592
2599
  /**
2593
2600
  * Get the bounds of a shape in the current page space.
2594
2601
  *
@@ -2603,7 +2610,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2603
2610
  * @public
2604
2611
  */
2605
2612
  getShapePageBounds(shape: TLShape | TLShapeId): Box | undefined;
2606
- /* Excluded from this release type: _getShapeClipPathCache */
2613
+ private _getShapeClipPathCache;
2607
2614
  /**
2608
2615
  * Get the clip path for a shape.
2609
2616
  *
@@ -2620,7 +2627,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2620
2627
  * @public
2621
2628
  */
2622
2629
  getShapeClipPath(shape: TLShape | TLShapeId): string | undefined;
2623
- /* Excluded from this release type: _getShapeMaskCache */
2630
+ private _getShapeMaskCache;
2624
2631
  /**
2625
2632
  * Get the mask (in the current page space) for a shape.
2626
2633
  *
@@ -2652,7 +2659,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2652
2659
  * @public
2653
2660
  */
2654
2661
  getShapeMaskedPageBounds(shape: TLShape | TLShapeId): Box | undefined;
2655
- /* Excluded from this release type: _getShapeMaskedPageBoundsCache */
2662
+ private _getShapeMaskedPageBoundsCache;
2656
2663
  /**
2657
2664
  * Get the ancestors of a shape.
2658
2665
  *
@@ -2762,8 +2769,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2762
2769
  * @public
2763
2770
  */
2764
2771
  getShapesAtPoint(point: VecLike, opts?: {
2765
- hitInside?: boolean;
2766
- margin?: number;
2772
+ hitInside?: boolean | undefined;
2773
+ margin?: number | undefined;
2767
2774
  }): TLShape[];
2768
2775
  /**
2769
2776
  * Get shape IDs within the given bounds.
@@ -2799,8 +2806,8 @@ export declare class Editor extends EventEmitter<TLEventMap> {
2799
2806
  * @public
2800
2807
  */
2801
2808
  isPointInShape(shape: TLShape | TLShapeId, point: VecLike, opts?: {
2802
- hitInside?: boolean;
2803
- margin?: number;
2809
+ hitInside?: boolean | undefined;
2810
+ margin?: number | undefined;
2804
2811
  }): boolean;
2805
2812
  /**
2806
2813
  * Convert a point in the current page space to a point in the local space of a shape. For example, if a
@@ -3074,7 +3081,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3074
3081
  * Delete a binding by its ID. If the binding doesn't exist, it's ignored.
3075
3082
  */
3076
3083
  deleteBinding(binding: TLBinding | TLBindingId, opts?: Parameters<this['deleteBindings']>[1]): this;
3077
- canBindShapes({ fromShape, toShape, binding, }: {
3084
+ canBindShapes({ fromShape, toShape, binding }: {
3078
3085
  binding: {
3079
3086
  type: TLBinding['type'];
3080
3087
  } | TLBinding | TLBinding['type'];
@@ -3523,7 +3530,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3523
3530
  deleteShape(id: TLShapeId): this;
3524
3531
  deleteShape(shape: TLShape): this;
3525
3532
  /* Excluded from this release type: _extractSharedStyles */
3526
- /* Excluded from this release type: _getSelectionSharedStyles */
3533
+ private _getSelectionSharedStyles;
3527
3534
  /**
3528
3535
  * Get the style for the next shape.
3529
3536
  *
@@ -3712,7 +3719,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3712
3719
  * @param opts - Options for handling external content, including force flag to bypass readonly checks.
3713
3720
  */
3714
3721
  putExternalContent<E>(info: TLExternalContent<E>, opts?: {
3715
- force?: boolean;
3722
+ force?: boolean | undefined;
3716
3723
  }): Promise<void>;
3717
3724
  /**
3718
3725
  * Handle replacing external content.
@@ -3721,7 +3728,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
3721
3728
  * @param opts - Options for handling external content, including force flag to bypass readonly checks.
3722
3729
  */
3723
3730
  replaceExternalContent<E>(info: TLExternalContent<E>, opts?: {
3724
- force?: boolean;
3731
+ force?: boolean | undefined;
3725
3732
  }): Promise<void>;
3726
3733
  /**
3727
3734
  * Get content that can be exported for the given shape ids.
@@ -4308,7 +4315,10 @@ export declare function getArcMeasure(A: number, B: number, sweepFlag: number, l
4308
4315
  /** @public */
4309
4316
  export declare function getCursor(cursor: TLCursorType, rotation?: number, color?: string): string;
4310
4317
 
4311
- /** @public */
4318
+ /**
4319
+ * Gets the default CDN base URL.
4320
+ * @returns The default CDN base URL.
4321
+ * @public */
4312
4322
  export declare function getDefaultCdnBaseUrl(): string;
4313
4323
 
4314
4324
  /**
@@ -4357,7 +4367,7 @@ export declare function getPerfectDashProps(totalLength: number, strokeWidth: nu
4357
4367
  };
4358
4368
 
4359
4369
  /** @public */
4360
- export declare function getPointerInfo(editor: Editor, e: PointerEvent | React.PointerEvent): {
4370
+ export declare function getPointerInfo(editor: Editor, e: PointerEvent | React_3.PointerEvent): {
4361
4371
  accelKey: boolean;
4362
4372
  altKey: boolean;
4363
4373
  button: number;
@@ -4418,7 +4428,7 @@ export declare function getSvgAsImage(svgString: string, options: {
4418
4428
  }): Promise<Blob | null>;
4419
4429
 
4420
4430
  /**
4421
- * Turn an array of points into a path of quadradic curves.
4431
+ * Turn an array of points into a path of quadratic curves.
4422
4432
  *
4423
4433
  * @param points - The points returned from perfect-freehand
4424
4434
  * @param closed - Whether the stroke is closed
@@ -4525,7 +4535,7 @@ export declare class HandleSnaps {
4525
4535
  private iterateSnapOutlines;
4526
4536
  private getHandleSnapPosition;
4527
4537
  private getHandleSnapData;
4528
- snapHandle({ currentShapeId, handle, }: {
4538
+ snapHandle({ currentShapeId, handle }: {
4529
4539
  currentShapeId: TLShapeId;
4530
4540
  handle: TLHandle;
4531
4541
  }): null | SnapData;
@@ -4928,7 +4938,6 @@ export declare const isSafeFloat: (n: number) => boolean;
4928
4938
 
4929
4939
  /**
4930
4940
  * Reparents shapes that are no longer contained within their parent shapes.
4931
- * todo: rename me to something more descriptive, like `reparentOccludedShapes` or `reparentAutoDroppedShapes`
4932
4941
  *
4933
4942
  * @param editor - The editor instance.
4934
4943
  * @param shapeIds - The IDs of the shapes to reparent.
@@ -5187,16 +5196,16 @@ export declare function precise(A: VecLike): string;
5187
5196
  /**
5188
5197
  * This function calls `event.preventDefault()` for you. Why is that useful?
5189
5198
  *
5190
- * Beacuase if you enable `window.preventDefaultLogging = true` it'll log out a message when it
5199
+ * Because if you enable `window.preventDefaultLogging = true` it'll log out a message when it
5191
5200
  * happens. Because we use console.warn rather than (log) you'll get a stack trace in the inspector
5192
5201
  * telling you exactly where it happened. This is important because `e.preventDefault()` is the
5193
- * source of many bugs, but unfortuantly it can't be avoided because it also stops a lot of default
5202
+ * source of many bugs, but unfortunately it can't be avoided because it also stops a lot of default
5194
5203
  * behaviour which doesn't make sense in our UI
5195
5204
  *
5196
5205
  * @param event - To prevent default on
5197
5206
  * @public
5198
5207
  */
5199
- export declare function preventDefault(event: Event | React_3.BaseSyntheticEvent): void;
5208
+ export declare function preventDefault(event: Event | React.BaseSyntheticEvent): void;
5200
5209
 
5201
5210
  /**
5202
5211
  * Convert radians to degrees.
@@ -5258,7 +5267,7 @@ export declare class Rectangle2d extends Polygon2d {
5258
5267
  export declare function refreshPage(): void;
5259
5268
 
5260
5269
  /** @public */
5261
- export declare function releasePointerCapture(element: Element, event: PointerEvent | React_3.PointerEvent<Element>): void;
5270
+ export declare function releasePointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
5262
5271
 
5263
5272
  /** @public */
5264
5273
  export declare type RequiredKeys<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
@@ -5326,7 +5335,7 @@ export declare function rotateSelectionHandle(handle: SelectionHandle, rotation:
5326
5335
 
5327
5336
  /** @public */
5328
5337
  export declare const runtime: {
5329
- hardReset(): void;
5338
+ hardReset(): Promise<void>;
5330
5339
  openWindow(url: string, target: string, allowReferrer?: boolean): void;
5331
5340
  refreshPage(): void;
5332
5341
  };
@@ -5518,7 +5527,7 @@ export declare type SelectionEdge = 'bottom' | 'left' | 'right' | 'top';
5518
5527
  export declare type SelectionHandle = SelectionCorner | SelectionEdge;
5519
5528
 
5520
5529
  /** @public */
5521
- export declare function setPointerCapture(element: Element, event: PointerEvent | React_3.PointerEvent<Element>): void;
5530
+ export declare function setPointerCapture(element: Element, event: PointerEvent | React.PointerEvent<Element>): void;
5522
5531
 
5523
5532
  /** @public */
5524
5533
  export declare function setRuntimeOverrides(input: Partial<typeof runtime>): void;
@@ -7105,6 +7114,15 @@ export declare interface TldrawOptions {
7105
7114
  * viewport's page dimensions regardless of overview zoom changes.
7106
7115
  */
7107
7116
  readonly quickZoomPreservesScreenBounds: boolean;
7117
+ /**
7118
+ * Called when content is dropped on the canvas. Provides the page position
7119
+ * where the drop occurred and the underlying drag event object.
7120
+ * Return true to prevent default drop handling (files, URLs, etc.)
7121
+ */
7122
+ experimental__onDropOnCanvas?(options: {
7123
+ event: React.DragEvent<Element>;
7124
+ point: VecLike;
7125
+ }): boolean;
7108
7126
  }
7109
7127
 
7110
7128
  /** @public */
@@ -7753,7 +7771,7 @@ export declare const tlmenus: {
7753
7771
  *
7754
7772
  * @public
7755
7773
  */
7756
- clearOpenMenus(contextId?: string): void;
7774
+ clearOpenMenus(contextId?: string | undefined): void;
7757
7775
  /**
7758
7776
  * Delete an open menu.
7759
7777
  *
@@ -7776,7 +7794,7 @@ export declare const tlmenus: {
7776
7794
  *
7777
7795
  * @public
7778
7796
  */
7779
- getOpenMenus(contextId?: string): string[];
7797
+ getOpenMenus(contextId?: string | undefined): string[];
7780
7798
  /**
7781
7799
  * Get whether a menu is open for a given context.
7782
7800
  *
@@ -7790,7 +7808,7 @@ export declare const tlmenus: {
7790
7808
  *
7791
7809
  * @public
7792
7810
  */
7793
- isMenuOpen(id: string, contextId?: string): boolean;
7811
+ isMenuOpen(id: string, contextId?: string | undefined): boolean;
7794
7812
  /**
7795
7813
  * Get whether any menus are open for a given context.
7796
7814
  *
@@ -7828,7 +7846,7 @@ export declare const tlmenus: {
7828
7846
  *
7829
7847
  * @public
7830
7848
  */
7831
- hideOpenMenus(contextId?: string): void;
7849
+ hideOpenMenus(contextId?: string | undefined): void;
7832
7850
  /**
7833
7851
  * Show all hidden menus.
7834
7852
  *
@@ -7842,7 +7860,7 @@ export declare const tlmenus: {
7842
7860
  *
7843
7861
  * @public
7844
7862
  */
7845
- showOpenMenus(contextId?: string): void;
7863
+ showOpenMenus(contextId?: string | undefined): void;
7846
7864
  forContext(contextId: string): {
7847
7865
  addOpenMenu: (id: string) => void;
7848
7866
  clearOpenMenus: () => void;
@@ -8560,7 +8578,7 @@ export declare const userTypeValidator: T.Validator<TLUserPreferences>;
8560
8578
  /** @public */
8561
8579
  export declare function useSelectionEvents(handle: TLSelectionHandle): {
8562
8580
  onPointerDown: PointerEventHandler<Element>;
8563
- onPointerMove: (e: React.PointerEvent) => void;
8581
+ onPointerMove: (e: PointerEvent_2<Element>) => void;
8564
8582
  onPointerUp: PointerEventHandler<Element>;
8565
8583
  };
8566
8584
 
@@ -277,10 +277,8 @@ import { EditorAtom } from "./lib/utils/EditorAtom.mjs";
277
277
  import { getIncrementedName } from "./lib/utils/getIncrementedName.mjs";
278
278
  import { getPointerInfo } from "./lib/utils/getPointerInfo.mjs";
279
279
  import { getSvgPathFromPoints } from "./lib/utils/getSvgPathFromPoints.mjs";
280
- import { hardResetEditor } from "./lib/utils/hardResetEditor.mjs";
281
280
  import { isAccelKey } from "./lib/utils/keyboard.mjs";
282
281
  import { normalizeWheel } from "./lib/utils/normalizeWheel.mjs";
283
- import { refreshPage } from "./lib/utils/refreshPage.mjs";
284
282
  import { getDroppedShapesToNewParents, kickoutOccludedShapes } from "./lib/utils/reparenting.mjs";
285
283
  import {
286
284
  getFontsFromRichText
@@ -289,7 +287,13 @@ import {
289
287
  applyRotationToSnapshotShapes,
290
288
  getRotationSnapshot
291
289
  } from "./lib/utils/rotation.mjs";
292
- import { runtime, setRuntimeOverrides } from "./lib/utils/runtime.mjs";
290
+ import {
291
+ hardResetEditor,
292
+ openWindow,
293
+ refreshPage,
294
+ runtime,
295
+ setRuntimeOverrides
296
+ } from "./lib/utils/runtime.mjs";
293
297
  import {
294
298
  ReadonlySharedStyleMap,
295
299
  SharedStyleMap
@@ -297,10 +301,9 @@ import {
297
301
  import { hardReset } from "./lib/utils/sync/hardReset.mjs";
298
302
  import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
299
303
  import { uniq } from "./lib/utils/uniq.mjs";
300
- import { openWindow } from "./lib/utils/window-open.mjs";
301
304
  registerTldrawLibraryVersion(
302
305
  "@tldraw/editor",
303
- "4.4.0",
306
+ "4.5.0-canary.1dbf0b796046",
304
307
  "esm"
305
308
  );
306
309
  export {