@tldraw/editor 5.2.0-next.ee0fa4d6244f → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/dist-cjs/index.d.ts +117 -60
- package/dist-cjs/index.js +7 -8
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/components/MenuClickCapture.js +8 -5
- package/dist-cjs/lib/components/MenuClickCapture.js.map +2 -2
- package/dist-cjs/lib/components/Shape.js +47 -1
- package/dist-cjs/lib/components/Shape.js.map +3 -3
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js +1 -16
- package/dist-cjs/lib/components/default-components/DefaultCanvas.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +131 -57
- package/dist-cjs/lib/editor/Editor.js.map +3 -3
- package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js +8 -58
- package/dist-cjs/lib/editor/managers/ClickManager/ClickManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js +3 -3
- package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js +1 -2
- package/dist-cjs/lib/editor/managers/FocusManager/FocusManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js +28 -4
- package/dist-cjs/lib/editor/managers/FontManager/FontManager.js.map +3 -3
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js +24 -2
- package/dist-cjs/lib/editor/managers/HistoryManager/HistoryManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js +14 -3
- package/dist-cjs/lib/editor/managers/InputsManager/InputsManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js +4 -2
- package/dist-cjs/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +7 -3
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js +0 -1
- package/dist-cjs/lib/editor/managers/TickManager/TickManager.js.map +2 -2
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js +15 -2
- package/dist-cjs/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.js.map +2 -2
- package/dist-cjs/lib/editor/overlays/strokeShapeIndicators.js +79 -0
- package/dist-cjs/lib/editor/overlays/strokeShapeIndicators.js.map +7 -0
- package/dist-cjs/lib/editor/shapes/ShapeUtil.js.map +2 -2
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js +4 -0
- package/dist-cjs/lib/editor/tools/BaseBoxShapeTool/children/Pointing.js.map +2 -2
- package/dist-cjs/lib/editor/tools/StateNode.js.map +2 -2
- package/dist-cjs/lib/{hooks/useTransform.js → editor/tools/cancelShapeCreationOnLongPress.js} +8 -23
- package/dist-cjs/lib/editor/tools/cancelShapeCreationOnLongPress.js.map +7 -0
- package/dist-cjs/lib/editor/types/event-types.js +0 -2
- package/dist-cjs/lib/editor/types/event-types.js.map +2 -2
- package/dist-cjs/lib/globals/environment.js +6 -1
- package/dist-cjs/lib/globals/environment.js.map +2 -2
- package/dist-cjs/lib/hooks/EditorComponentsContext.js.map +2 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js +17 -8
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/lib/hooks/useEditorComponents.js +0 -1
- package/dist-cjs/lib/hooks/useEditorComponents.js.map +2 -2
- package/dist-cjs/lib/hooks/usePresence.js.map +2 -2
- package/dist-cjs/lib/hooks/useScreenBounds.js +1 -0
- package/dist-cjs/lib/hooks/useScreenBounds.js.map +2 -2
- package/dist-cjs/lib/license/LicenseManager.js +5 -1
- package/dist-cjs/lib/license/LicenseManager.js.map +2 -2
- package/dist-cjs/lib/primitives/Vec.js +3 -2
- package/dist-cjs/lib/primitives/Vec.js.map +2 -2
- package/dist-cjs/lib/utils/dom.js +12 -0
- package/dist-cjs/lib/utils/dom.js.map +2 -2
- package/dist-cjs/lib/utils/getPointerInfo.js +2 -1
- package/dist-cjs/lib/utils/getPointerInfo.js.map +2 -2
- package/dist-cjs/lib/utils/pointer.js +37 -0
- package/dist-cjs/lib/utils/pointer.js.map +7 -0
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +117 -60
- package/dist-esm/index.mjs +9 -13
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/components/MenuClickCapture.mjs +8 -5
- package/dist-esm/lib/components/MenuClickCapture.mjs.map +2 -2
- package/dist-esm/lib/components/Shape.mjs +48 -2
- package/dist-esm/lib/components/Shape.mjs.map +3 -3
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs +1 -16
- package/dist-esm/lib/components/default-components/DefaultCanvas.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +131 -57
- package/dist-esm/lib/editor/Editor.mjs.map +3 -3
- package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs +8 -58
- package/dist-esm/lib/editor/managers/ClickManager/ClickManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs +3 -3
- package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs +1 -2
- package/dist-esm/lib/editor/managers/FocusManager/FocusManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs +28 -4
- package/dist-esm/lib/editor/managers/FontManager/FontManager.mjs.map +3 -3
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs +24 -2
- package/dist-esm/lib/editor/managers/HistoryManager/HistoryManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs +14 -3
- package/dist-esm/lib/editor/managers/InputsManager/InputsManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs +4 -2
- package/dist-esm/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +7 -3
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs +0 -1
- package/dist-esm/lib/editor/managers/TickManager/TickManager.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs +15 -2
- package/dist-esm/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.mjs.map +2 -2
- package/dist-esm/lib/editor/overlays/strokeShapeIndicators.mjs +59 -0
- package/dist-esm/lib/editor/overlays/strokeShapeIndicators.mjs.map +7 -0
- package/dist-esm/lib/editor/shapes/ShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs +4 -0
- package/dist-esm/lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/StateNode.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/cancelShapeCreationOnLongPress.mjs +8 -0
- package/dist-esm/lib/editor/tools/cancelShapeCreationOnLongPress.mjs.map +7 -0
- package/dist-esm/lib/editor/types/event-types.mjs +0 -2
- package/dist-esm/lib/editor/types/event-types.mjs.map +2 -2
- package/dist-esm/lib/globals/environment.mjs +6 -1
- package/dist-esm/lib/globals/environment.mjs.map +2 -2
- package/dist-esm/lib/hooks/EditorComponentsContext.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +17 -8
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/lib/hooks/useEditorComponents.mjs +0 -1
- package/dist-esm/lib/hooks/useEditorComponents.mjs.map +2 -2
- package/dist-esm/lib/hooks/usePresence.mjs.map +2 -2
- package/dist-esm/lib/hooks/useScreenBounds.mjs +1 -0
- package/dist-esm/lib/hooks/useScreenBounds.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseManager.mjs +5 -1
- package/dist-esm/lib/license/LicenseManager.mjs.map +2 -2
- package/dist-esm/lib/primitives/Vec.mjs +3 -2
- package/dist-esm/lib/primitives/Vec.mjs.map +2 -2
- package/dist-esm/lib/utils/dom.mjs +12 -0
- package/dist-esm/lib/utils/dom.mjs.map +2 -2
- package/dist-esm/lib/utils/getPointerInfo.mjs +2 -1
- package/dist-esm/lib/utils/getPointerInfo.mjs.map +2 -2
- package/dist-esm/lib/utils/pointer.mjs +17 -0
- package/dist-esm/lib/utils/pointer.mjs.map +7 -0
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +15 -3
- package/package.json +11 -8
- package/src/index.ts +4 -10
- package/src/lib/components/MenuClickCapture.tsx +8 -4
- package/src/lib/components/Shape.tsx +88 -1
- package/src/lib/components/default-components/DefaultCanvas.tsx +1 -17
- package/src/lib/editor/Editor.test.ts +36 -0
- package/src/lib/editor/Editor.ts +204 -75
- package/src/lib/editor/managers/ClickManager/ClickManager.test.ts +54 -74
- package/src/lib/editor/managers/ClickManager/ClickManager.ts +15 -65
- package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.test.ts +43 -16
- package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.ts +8 -5
- package/src/lib/editor/managers/FocusManager/FocusManager.test.ts +4 -4
- package/src/lib/editor/managers/FocusManager/FocusManager.ts +1 -2
- package/src/lib/editor/managers/FontManager/FontManager.test.ts +37 -10
- package/src/lib/editor/managers/FontManager/FontManager.ts +46 -1
- package/src/lib/editor/managers/HistoryManager/HistoryManager.test.ts +32 -0
- package/src/lib/editor/managers/HistoryManager/HistoryManager.ts +34 -4
- package/src/lib/editor/managers/InputsManager/InputsManager.test.ts +61 -0
- package/src/lib/editor/managers/InputsManager/InputsManager.ts +16 -4
- package/src/lib/editor/managers/SpatialIndexManager/SpatialIndexManager.ts +9 -2
- package/src/lib/editor/managers/TextManager/TextManager.test.ts +16 -14
- package/src/lib/editor/managers/TextManager/TextManager.ts +17 -2
- package/src/lib/editor/managers/TickManager/TickManager.test.ts +0 -40
- package/src/lib/editor/managers/TickManager/TickManager.ts +0 -1
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +12 -2
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +27 -2
- package/src/lib/editor/overlays/strokeShapeIndicators.ts +86 -0
- package/src/lib/editor/shapes/ShapeUtil.ts +41 -0
- package/src/lib/editor/tools/BaseBoxShapeTool/children/Pointing.ts +5 -0
- package/src/lib/editor/tools/StateNode.ts +0 -2
- package/src/lib/editor/tools/cancelShapeCreationOnLongPress.ts +31 -0
- package/src/lib/editor/types/event-types.ts +9 -6
- package/src/lib/globals/environment.ts +7 -0
- package/src/lib/hooks/EditorComponentsContext.tsx +0 -2
- package/src/lib/hooks/useCanvasEvents.ts +24 -12
- package/src/lib/hooks/useEditorComponents.tsx +0 -1
- package/src/lib/hooks/usePresence.ts +2 -2
- package/src/lib/hooks/useScreenBounds.ts +3 -0
- package/src/lib/license/LicenseManager.test.ts +24 -16
- package/src/lib/license/LicenseManager.ts +8 -2
- package/src/lib/primitives/Vec.ts +5 -2
- package/src/lib/test/ContentElementSlot.test.tsx +201 -0
- package/src/lib/utils/dom.ts +34 -0
- package/src/lib/utils/getPointerInfo.ts +2 -1
- package/src/lib/utils/pointer.test.ts +76 -0
- package/src/lib/utils/pointer.ts +42 -0
- package/src/version.ts +3 -3
- package/dist-cjs/lib/components/default-components/DefaultSelectionBackground.js +0 -49
- package/dist-cjs/lib/components/default-components/DefaultSelectionBackground.js.map +0 -7
- package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js +0 -161
- package/dist-cjs/lib/editor/overlays/ShapeIndicatorOverlayUtil.js.map +0 -7
- package/dist-cjs/lib/hooks/useTransform.js.map +0 -7
- package/dist-esm/lib/components/default-components/DefaultSelectionBackground.mjs +0 -19
- package/dist-esm/lib/components/default-components/DefaultSelectionBackground.mjs.map +0 -7
- package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs +0 -141
- package/dist-esm/lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs.map +0 -7
- package/dist-esm/lib/hooks/useTransform.mjs +0 -23
- package/dist-esm/lib/hooks/useTransform.mjs.map +0 -7
- package/src/lib/components/default-components/DefaultSelectionBackground.tsx +0 -25
- package/src/lib/editor/overlays/ShapeIndicatorOverlayUtil.ts +0 -216
- package/src/lib/hooks/useTransform.ts +0 -30
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/utils/dom.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nThis is used to facilitate double clicking and pointer capture on elements.\n\nThe events in this file are possibly set on individual SVG elements, \nsuch as handles or corner handles, rather than on HTML elements or \nSVGSVGElements. Raw SVG elements do not support pointerCapture in\nmost cases, meaning that in order for pointer capture to work, we \nneed to crawl up the DOM tree to find the nearest HTML element. Then,\nin order for that element to also call the `onPointerUp` event from\nthis file, we need to manually set that event on that element and\nlater remove it when the pointerup occurs. This is a potential leak\nif the user clicks on a handle but the pointerup does not fire for\nwhatever reason.\n*/\n\nimport { debugFlags, pointerCaptureTrackingObject } from './debug-flags'\n\n/** @public */\nexport function loopToHtmlElement(elm: Element): HTMLElement {\n\tif (elm.nodeType === Node.ELEMENT_NODE) return elm as HTMLElement\n\tif (elm.parentElement) return loopToHtmlElement(elm.parentElement)\n\telse throw Error('Could not find a parent element of an HTML type!')\n}\n\n/**\n * This function calls `event.preventDefault()` for you. Why is that useful?\n *\n * Because if you enable `window.preventDefaultLogging = true` it'll log out a message when it\n * happens. Because we use console.warn rather than (log) you'll get a stack trace in the inspector\n * telling you exactly where it happened. This is important because `e.preventDefault()` is the\n * source of many bugs, but unfortunately it can't be avoided because it also stops a lot of default\n * behaviour which doesn't make sense in our UI\n *\n * @param event - To prevent default on\n * @public\n */\nexport function preventDefault(event: React.BaseSyntheticEvent | Event) {\n\tif ('cancelable' in event && !event.cancelable) return\n\tevent.preventDefault()\n\tif (debugFlags.logPreventDefaults.get()) {\n\t\tconsole.warn('preventDefault called on event:', event)\n\t}\n}\n\n/** @public */\nexport function setPointerCapture(\n\telement: Element,\n\tevent: React.PointerEvent<Element> | PointerEvent\n) {\n\telement.setPointerCapture(event.pointerId)\n\tif (debugFlags.logPointerCaptures.get()) {\n\t\tconst trackingObj = pointerCaptureTrackingObject.get()\n\t\ttrackingObj.set(element, (trackingObj.get(element) ?? 0) + 1)\n\t\tconsole.warn('setPointerCapture called on element:', element, event)\n\t}\n}\n\n/** @public */\nexport function releasePointerCapture(\n\telement: Element,\n\tevent: React.PointerEvent<Element> | PointerEvent\n) {\n\tif (!element.hasPointerCapture(event.pointerId)) {\n\t\treturn\n\t}\n\n\telement.releasePointerCapture(event.pointerId)\n\tif (debugFlags.logPointerCaptures.get()) {\n\t\tconst trackingObj = pointerCaptureTrackingObject.get()\n\t\tif (trackingObj.get(element) === 1) {\n\t\t\ttrackingObj.delete(element)\n\t\t} else if (trackingObj.has(element)) {\n\t\t\ttrackingObj.set(element, trackingObj.get(element)! - 1)\n\t\t} else {\n\t\t\tconsole.warn('Release without capture')\n\t\t}\n\t\tconsole.warn('releasePointerCapture called on element:', element, event)\n\t}\n}\n\n/**\n * Calls `event.stopPropagation()`.\n *\n * @deprecated Use {@link Editor.markEventAsHandled} instead, or manually call `event.stopPropagation()` if\n * that's what you really want.\n *\n * @public\n */\nexport function stopEventPropagation(e: any) {\n\treturn e.stopPropagation()\n}\n\n/** @internal */\nexport function setStyleProperty(\n\telm: HTMLElement | null,\n\tproperty: string,\n\tvalue: string | number\n) {\n\tif (!elm) return\n\telm.style.setProperty(property, String(value))\n}\n\n/** @internal */\nexport function elementShouldCaptureKeys(el: Element | null, includeButtonsAndMenus = true) {\n\tif (!el) return false\n\n\tconst tagName = el.tagName.toLowerCase()\n\treturn (\n\t\t(el as HTMLElement).isContentEditable ||\n\t\ttagName === 'input' ||\n\t\ttagName === 'textarea' ||\n\t\t(includeButtonsAndMenus && tagName === 'select') ||\n\t\t(includeButtonsAndMenus && tagName === 'button') ||\n\t\tel.classList.contains('tlui-slider__thumb')\n\t)\n}\n\n/**\n * Returns the global `document`. Use this instead of bare `document` to satisfy lint rules.\n *\n * When you have a DOM node or editor instance, prefer the scoped versions instead:\n * - `getOwnerDocument(node)` \u2013 the document that owns a specific DOM node\n * - `editor.getContainerDocument()` \u2013 the document where the editor is mounted\n *\n * @internal\n */\nexport function getGlobalDocument(): Document {\n\t// eslint-disable-next-line no-restricted-globals\n\tif (typeof document !== 'undefined') return document\n\treturn globalThis.document\n}\n\n/**\n * Returns the global `window`. Use this instead of bare `window` to satisfy lint rules.\n *\n * When you have a DOM node or editor instance, prefer the scoped versions instead:\n * - `getOwnerWindow(node)` \u2013 the window that owns a specific DOM node\n * - `editor.getContainerWindow()` \u2013 the window where the editor is mounted\n *\n * @internal\n */\nexport function getGlobalWindow(): Window & typeof globalThis {\n\tif (typeof window !== 'undefined') return window as Window & typeof globalThis\n\treturn globalThis as Window & typeof globalThis\n}\n\n/** @internal */\nexport function activeElementShouldCaptureKeys(includeButtonsAndMenus = true, doc?: Document) {\n\treturn elementShouldCaptureKeys(\n\t\t(doc ?? getGlobalDocument()).activeElement,\n\t\tincludeButtonsAndMenus\n\t)\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,yBAAyD;AAGlD,SAAS,kBAAkB,KAA2B;AAC5D,MAAI,IAAI,aAAa,KAAK,aAAc,QAAO;AAC/C,MAAI,IAAI,cAAe,QAAO,kBAAkB,IAAI,aAAa;AAAA,MAC5D,OAAM,MAAM,kDAAkD;AACpE;AAcO,SAAS,eAAe,OAAyC;AACvE,MAAI,gBAAgB,SAAS,CAAC,MAAM,WAAY;AAChD,QAAM,eAAe;AACrB,MAAI,8BAAW,mBAAmB,IAAI,GAAG;AACxC,YAAQ,KAAK,mCAAmC,KAAK;AAAA,EACtD;AACD;AAGO,SAAS,kBACf,SACA,OACC;AACD,UAAQ,kBAAkB,MAAM,SAAS;AACzC,MAAI,8BAAW,mBAAmB,IAAI,GAAG;AACxC,UAAM,cAAc,gDAA6B,IAAI;AACrD,gBAAY,IAAI,UAAU,YAAY,IAAI,OAAO,KAAK,KAAK,CAAC;AAC5D,YAAQ,KAAK,wCAAwC,SAAS,KAAK;AAAA,EACpE;AACD;AAGO,SAAS,sBACf,SACA,OACC;AACD,MAAI,CAAC,QAAQ,kBAAkB,MAAM,SAAS,GAAG;AAChD;AAAA,EACD;AAEA,UAAQ,sBAAsB,MAAM,SAAS;AAC7C,MAAI,8BAAW,mBAAmB,IAAI,GAAG;AACxC,UAAM,cAAc,gDAA6B,IAAI;AACrD,QAAI,YAAY,IAAI,OAAO,MAAM,GAAG;AACnC,kBAAY,OAAO,OAAO;AAAA,IAC3B,WAAW,YAAY,IAAI,OAAO,GAAG;AACpC,kBAAY,IAAI,SAAS,YAAY,IAAI,OAAO,IAAK,CAAC;AAAA,IACvD,OAAO;AACN,cAAQ,KAAK,yBAAyB;AAAA,IACvC;AACA,YAAQ,KAAK,4CAA4C,SAAS,KAAK;AAAA,EACxE;AACD;AAUO,SAAS,qBAAqB,GAAQ;AAC5C,SAAO,EAAE,gBAAgB;AAC1B;AAGO,SAAS,iBACf,KACA,UACA,OACC;AACD,MAAI,CAAC,IAAK;AACV,MAAI,MAAM,YAAY,UAAU,OAAO,KAAK,CAAC;AAC9C;AAGO,SAAS,yBAAyB,IAAoB,yBAAyB,MAAM;AAC3F,MAAI,CAAC,GAAI,QAAO;AAEhB,QAAM,UAAU,GAAG,QAAQ,YAAY;AACvC,SACE,GAAmB,qBACpB,YAAY,WACZ,YAAY,cACX,0BAA0B,YAAY,YACtC,0BAA0B,YAAY,YACvC,GAAG,UAAU,SAAS,oBAAoB;AAE5C;AAWO,SAAS,oBAA8B;AAE7C,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,SAAO,WAAW;AACnB;AAWO,SAAS,kBAA8C;AAC7D,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,SAAO;AACR;AAGO,SAAS,+BAA+B,yBAAyB,MAAM,KAAgB;AAC7F,SAAO;AAAA,KACL,OAAO,kBAAkB,GAAG;AAAA,IAC7B;AAAA,EACD;AACD;",
|
|
4
|
+
"sourcesContent": ["/*\nThis is used to facilitate double clicking and pointer capture on elements.\n\nThe events in this file are possibly set on individual SVG elements, \nsuch as handles or corner handles, rather than on HTML elements or \nSVGSVGElements. Raw SVG elements do not support pointerCapture in\nmost cases, meaning that in order for pointer capture to work, we \nneed to crawl up the DOM tree to find the nearest HTML element. Then,\nin order for that element to also call the `onPointerUp` event from\nthis file, we need to manually set that event on that element and\nlater remove it when the pointerup occurs. This is a potential leak\nif the user clicks on a handle but the pointerup does not fire for\nwhatever reason.\n*/\n\nimport { debugFlags, pointerCaptureTrackingObject } from './debug-flags'\n\n/** @public */\nexport function loopToHtmlElement(elm: Element): HTMLElement {\n\tif (elm.nodeType === Node.ELEMENT_NODE) return elm as HTMLElement\n\tif (elm.parentElement) return loopToHtmlElement(elm.parentElement)\n\telse throw Error('Could not find a parent element of an HTML type!')\n}\n\n/**\n * This function calls `event.preventDefault()` for you. Why is that useful?\n *\n * Because if you enable `window.preventDefaultLogging = true` it'll log out a message when it\n * happens. Because we use console.warn rather than (log) you'll get a stack trace in the inspector\n * telling you exactly where it happened. This is important because `e.preventDefault()` is the\n * source of many bugs, but unfortunately it can't be avoided because it also stops a lot of default\n * behaviour which doesn't make sense in our UI\n *\n * @param event - To prevent default on\n * @public\n */\nexport function preventDefault(event: React.BaseSyntheticEvent | Event) {\n\tif ('cancelable' in event && !event.cancelable) return\n\tevent.preventDefault()\n\tif (debugFlags.logPreventDefaults.get()) {\n\t\tconsole.warn('preventDefault called on event:', event)\n\t}\n}\n\n/** @public */\nexport function setPointerCapture(\n\telement: Element,\n\tevent: React.PointerEvent<Element> | PointerEvent\n) {\n\telement.setPointerCapture(event.pointerId)\n\tif (debugFlags.logPointerCaptures.get()) {\n\t\tconst trackingObj = pointerCaptureTrackingObject.get()\n\t\ttrackingObj.set(element, (trackingObj.get(element) ?? 0) + 1)\n\t\tconsole.warn('setPointerCapture called on element:', element, event)\n\t}\n}\n\n/** @public */\nexport function releasePointerCapture(\n\telement: Element,\n\tevent: React.PointerEvent<Element> | PointerEvent\n) {\n\tif (!element.hasPointerCapture(event.pointerId)) {\n\t\treturn\n\t}\n\n\telement.releasePointerCapture(event.pointerId)\n\tif (debugFlags.logPointerCaptures.get()) {\n\t\tconst trackingObj = pointerCaptureTrackingObject.get()\n\t\tif (trackingObj.get(element) === 1) {\n\t\t\ttrackingObj.delete(element)\n\t\t} else if (trackingObj.has(element)) {\n\t\t\ttrackingObj.set(element, trackingObj.get(element)! - 1)\n\t\t} else {\n\t\t\tconsole.warn('Release without capture')\n\t\t}\n\t\tconsole.warn('releasePointerCapture called on element:', element, event)\n\t}\n}\n\n/**\n * Calls `event.stopPropagation()`.\n *\n * @deprecated Use {@link Editor.markEventAsHandled} instead, or manually call `event.stopPropagation()` if\n * that's what you really want.\n *\n * @public\n */\nexport function stopEventPropagation(e: any) {\n\treturn e.stopPropagation()\n}\n\n/** @internal */\nexport function setStyleProperty(\n\telm: HTMLElement | null,\n\tproperty: string,\n\tvalue: string | number\n) {\n\tif (!elm) return\n\telm.style.setProperty(property, String(value))\n}\n\n/**\n * Move an element into a new parent, preserving its state where the platform allows it.\n *\n * Uses `Node.moveBefore` (Chromium 133+, Firefox 144+) when both the element and parent are\n * connected to the same document \u2014 this moves the element without resetting its state, so\n * iframes don't reload and media keeps playing. Otherwise (older browsers, disconnected nodes,\n * or a cross-document move) it falls back to `appendChild`, which moves the element but resets\n * its state like an iframe reload.\n *\n * This is the primitive tldraw uses to adopt `ShapeUtil.getAppOwnedElement` elements, exposed so\n * apps can perform symmetric state-preserving moves from `ShapeUtil.onReleaseAppOwnedElement` \u2014\n * for example moving an element to an off-canvas parking lot between editor sessions.\n *\n * @param parent - The element to move `element` into, as its last child.\n * @param element - The element to move.\n * @public\n */\nexport function moveElementInto(parent: HTMLElement, element: HTMLElement) {\n\tif (\n\t\telement.isConnected &&\n\t\tparent.isConnected &&\n\t\ttypeof (parent as any).moveBefore === 'function' &&\n\t\telement.ownerDocument === parent.ownerDocument\n\t) {\n\t\ttry {\n\t\t\t;(parent as any).moveBefore(element, null)\n\t\t\treturn\n\t\t} catch {\n\t\t\t// fall through to appendChild\n\t\t}\n\t}\n\tparent.appendChild(element)\n}\n\n/** @internal */\nexport function elementShouldCaptureKeys(el: Element | null, includeButtonsAndMenus = true) {\n\tif (!el) return false\n\n\tconst tagName = el.tagName.toLowerCase()\n\treturn (\n\t\t(el as HTMLElement).isContentEditable ||\n\t\ttagName === 'input' ||\n\t\ttagName === 'textarea' ||\n\t\t(includeButtonsAndMenus && tagName === 'select') ||\n\t\t(includeButtonsAndMenus && tagName === 'button') ||\n\t\tel.classList.contains('tlui-slider__thumb')\n\t)\n}\n\n/**\n * Returns the global `document`. Use this instead of bare `document` to satisfy lint rules.\n *\n * When you have a DOM node or editor instance, prefer the scoped versions instead:\n * - `getOwnerDocument(node)` \u2013 the document that owns a specific DOM node\n * - `editor.getContainerDocument()` \u2013 the document where the editor is mounted\n *\n * @internal\n */\nexport function getGlobalDocument(): Document {\n\t// eslint-disable-next-line no-restricted-globals\n\tif (typeof document !== 'undefined') return document\n\treturn globalThis.document\n}\n\n/**\n * Returns the global `window`. Use this instead of bare `window` to satisfy lint rules.\n *\n * When you have a DOM node or editor instance, prefer the scoped versions instead:\n * - `getOwnerWindow(node)` \u2013 the window that owns a specific DOM node\n * - `editor.getContainerWindow()` \u2013 the window where the editor is mounted\n *\n * @internal\n */\nexport function getGlobalWindow(): Window & typeof globalThis {\n\tif (typeof window !== 'undefined') return window as Window & typeof globalThis\n\treturn globalThis as Window & typeof globalThis\n}\n\n/** @internal */\nexport function activeElementShouldCaptureKeys(includeButtonsAndMenus = true, doc?: Document) {\n\treturn elementShouldCaptureKeys(\n\t\t(doc ?? getGlobalDocument()).activeElement,\n\t\tincludeButtonsAndMenus\n\t)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeA,yBAAyD;AAGlD,SAAS,kBAAkB,KAA2B;AAC5D,MAAI,IAAI,aAAa,KAAK,aAAc,QAAO;AAC/C,MAAI,IAAI,cAAe,QAAO,kBAAkB,IAAI,aAAa;AAAA,MAC5D,OAAM,MAAM,kDAAkD;AACpE;AAcO,SAAS,eAAe,OAAyC;AACvE,MAAI,gBAAgB,SAAS,CAAC,MAAM,WAAY;AAChD,QAAM,eAAe;AACrB,MAAI,8BAAW,mBAAmB,IAAI,GAAG;AACxC,YAAQ,KAAK,mCAAmC,KAAK;AAAA,EACtD;AACD;AAGO,SAAS,kBACf,SACA,OACC;AACD,UAAQ,kBAAkB,MAAM,SAAS;AACzC,MAAI,8BAAW,mBAAmB,IAAI,GAAG;AACxC,UAAM,cAAc,gDAA6B,IAAI;AACrD,gBAAY,IAAI,UAAU,YAAY,IAAI,OAAO,KAAK,KAAK,CAAC;AAC5D,YAAQ,KAAK,wCAAwC,SAAS,KAAK;AAAA,EACpE;AACD;AAGO,SAAS,sBACf,SACA,OACC;AACD,MAAI,CAAC,QAAQ,kBAAkB,MAAM,SAAS,GAAG;AAChD;AAAA,EACD;AAEA,UAAQ,sBAAsB,MAAM,SAAS;AAC7C,MAAI,8BAAW,mBAAmB,IAAI,GAAG;AACxC,UAAM,cAAc,gDAA6B,IAAI;AACrD,QAAI,YAAY,IAAI,OAAO,MAAM,GAAG;AACnC,kBAAY,OAAO,OAAO;AAAA,IAC3B,WAAW,YAAY,IAAI,OAAO,GAAG;AACpC,kBAAY,IAAI,SAAS,YAAY,IAAI,OAAO,IAAK,CAAC;AAAA,IACvD,OAAO;AACN,cAAQ,KAAK,yBAAyB;AAAA,IACvC;AACA,YAAQ,KAAK,4CAA4C,SAAS,KAAK;AAAA,EACxE;AACD;AAUO,SAAS,qBAAqB,GAAQ;AAC5C,SAAO,EAAE,gBAAgB;AAC1B;AAGO,SAAS,iBACf,KACA,UACA,OACC;AACD,MAAI,CAAC,IAAK;AACV,MAAI,MAAM,YAAY,UAAU,OAAO,KAAK,CAAC;AAC9C;AAmBO,SAAS,gBAAgB,QAAqB,SAAsB;AAC1E,MACC,QAAQ,eACR,OAAO,eACP,OAAQ,OAAe,eAAe,cACtC,QAAQ,kBAAkB,OAAO,eAChC;AACD,QAAI;AACH;AAAC,MAAC,OAAe,WAAW,SAAS,IAAI;AACzC;AAAA,IACD,QAAQ;AAAA,IAER;AAAA,EACD;AACA,SAAO,YAAY,OAAO;AAC3B;AAGO,SAAS,yBAAyB,IAAoB,yBAAyB,MAAM;AAC3F,MAAI,CAAC,GAAI,QAAO;AAEhB,QAAM,UAAU,GAAG,QAAQ,YAAY;AACvC,SACE,GAAmB,qBACpB,YAAY,WACZ,YAAY,cACX,0BAA0B,YAAY,YACtC,0BAA0B,YAAY,YACvC,GAAG,UAAU,SAAS,oBAAoB;AAE5C;AAWO,SAAS,oBAA8B;AAE7C,MAAI,OAAO,aAAa,YAAa,QAAO;AAC5C,SAAO,WAAW;AACnB;AAWO,SAAS,kBAA8C;AAC7D,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,SAAO;AACR;AAGO,SAAS,+BAA+B,yBAAyB,MAAM,KAAgB;AAC7F,SAAO;AAAA,KACL,OAAO,kBAAkB,GAAG;AAAA,IAC7B;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,6 +22,7 @@ __export(getPointerInfo_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(getPointerInfo_exports);
|
|
24
24
|
var import_keyboard = require("./keyboard");
|
|
25
|
+
var import_pointer = require("./pointer");
|
|
25
26
|
function getPointerInfo(editor, e) {
|
|
26
27
|
editor.markEventAsHandled(e);
|
|
27
28
|
return {
|
|
@@ -36,7 +37,7 @@ function getPointerInfo(editor, e) {
|
|
|
36
37
|
metaKey: e.metaKey,
|
|
37
38
|
accelKey: (0, import_keyboard.isAccelKey)(e),
|
|
38
39
|
pointerId: e.pointerId,
|
|
39
|
-
button: e
|
|
40
|
+
button: (0, import_pointer.getPointerEventButton)(e),
|
|
40
41
|
isPen: e.pointerType === "pen"
|
|
41
42
|
};
|
|
42
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/utils/getPointerInfo.ts"],
|
|
4
|
-
"sourcesContent": ["import type React from 'react'\nimport { Editor } from '../editor/Editor'\nimport { isAccelKey } from './keyboard'\n\n/** @public */\nexport function getPointerInfo(editor: Editor, e: React.PointerEvent | PointerEvent) {\n\teditor.markEventAsHandled(e)\n\n\treturn {\n\t\tpoint: {\n\t\t\tx: e.clientX,\n\t\t\ty: e.clientY,\n\t\t\tz: e.pressure,\n\t\t},\n\t\tshiftKey: e.shiftKey,\n\t\taltKey: e.altKey,\n\t\tctrlKey: e.metaKey || e.ctrlKey,\n\t\tmetaKey: e.metaKey,\n\t\taccelKey: isAccelKey(e),\n\t\tpointerId: e.pointerId,\n\t\tbutton: e
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA2B;
|
|
4
|
+
"sourcesContent": ["import type React from 'react'\nimport { Editor } from '../editor/Editor'\nimport { isAccelKey } from './keyboard'\nimport { getPointerEventButton } from './pointer'\n\n/** @public */\nexport function getPointerInfo(editor: Editor, e: React.PointerEvent | PointerEvent) {\n\teditor.markEventAsHandled(e)\n\n\treturn {\n\t\tpoint: {\n\t\t\tx: e.clientX,\n\t\t\ty: e.clientY,\n\t\t\tz: e.pressure,\n\t\t},\n\t\tshiftKey: e.shiftKey,\n\t\taltKey: e.altKey,\n\t\tctrlKey: e.metaKey || e.ctrlKey,\n\t\tmetaKey: e.metaKey,\n\t\taccelKey: isAccelKey(e),\n\t\tpointerId: e.pointerId,\n\t\tbutton: getPointerEventButton(e),\n\t\tisPen: e.pointerType === 'pen',\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,sBAA2B;AAC3B,qBAAsC;AAG/B,SAAS,eAAe,QAAgB,GAAsC;AACpF,SAAO,mBAAmB,CAAC;AAE3B,SAAO;AAAA,IACN,OAAO;AAAA,MACN,GAAG,EAAE;AAAA,MACL,GAAG,EAAE;AAAA,MACL,GAAG,EAAE;AAAA,IACN;AAAA,IACA,UAAU,EAAE;AAAA,IACZ,QAAQ,EAAE;AAAA,IACV,SAAS,EAAE,WAAW,EAAE;AAAA,IACxB,SAAS,EAAE;AAAA,IACX,cAAU,4BAAW,CAAC;AAAA,IACtB,WAAW,EAAE;AAAA,IACb,YAAQ,sCAAsB,CAAC;AAAA,IAC/B,OAAO,EAAE,gBAAgB;AAAA,EAC1B;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var pointer_exports = {};
|
|
20
|
+
__export(pointer_exports, {
|
|
21
|
+
getPointerEventButton: () => getPointerEventButton,
|
|
22
|
+
isDirectDisplayPen: () => isDirectDisplayPen,
|
|
23
|
+
isSecondaryClickEvent: () => isSecondaryClickEvent
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(pointer_exports);
|
|
26
|
+
var import_environment = require("../globals/environment");
|
|
27
|
+
function isDirectDisplayPen(e) {
|
|
28
|
+
if (e.pointerType !== "pen") return false;
|
|
29
|
+
return import_environment.tlenv.isTouchDevice;
|
|
30
|
+
}
|
|
31
|
+
function isSecondaryClickEvent(e) {
|
|
32
|
+
return e.button === 2 || import_environment.tlenv.isDarwin && e.button === 0 && e.ctrlKey && !e.metaKey;
|
|
33
|
+
}
|
|
34
|
+
function getPointerEventButton(e) {
|
|
35
|
+
return isSecondaryClickEvent(e) ? 2 : e.button;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=pointer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/utils/pointer.ts"],
|
|
4
|
+
"sourcesContent": ["import type React from 'react'\nimport { tlenv } from '../globals/environment'\n\n/**\n * Decide whether a pen pointer event looks like direct manipulation on the display (e.g. Apple\n * Pencil on an iPad or a Surface Pen on a touchscreen) rather than indirect input from a desktop\n * graphics tablet (e.g. a Wacom Intuos).\n *\n * We can't tell the two apart from the pointer event itself: both report `pointerType: 'pen'`, and\n * implicit pointer capture \u2014 which in theory distinguishes direct-manipulation pointers \u2014 isn't\n * reliably observable across browsers (notably WebKit/iPad). Instead we key off the device: a\n * direct-display pen draws on a touch-capable screen, while an indirect graphics tablet is used on\n * a non-touch desktop alongside a mouse. A device with no touch input therefore can't host a\n * direct-display pen.\n *\n * Note this uses {@link tlenv.isTouchDevice} \u2014 the device's fixed touch capability \u2014 not the\n * editor's dynamic `isCoarsePointer` state, which a pen `pointerdown` flips to coarse regardless\n * of device.\n *\n * @internal\n */\nexport function isDirectDisplayPen(e: React.PointerEvent | PointerEvent): boolean {\n\tif (e.pointerType !== 'pen') return false\n\treturn tlenv.isTouchDevice\n}\n\n/** @internal */\ninterface PointerLike {\n\tbutton: number\n\tctrlKey: boolean\n\tmetaKey: boolean\n}\n\n/** @internal */\nexport function isSecondaryClickEvent(e: PointerLike) {\n\treturn e.button === 2 || (tlenv.isDarwin && e.button === 0 && e.ctrlKey && !e.metaKey)\n}\n\n/** @internal */\nexport function getPointerEventButton(e: PointerLike) {\n\treturn isSecondaryClickEvent(e) ? 2 : e.button\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAAsB;AAoBf,SAAS,mBAAmB,GAA+C;AACjF,MAAI,EAAE,gBAAgB,MAAO,QAAO;AACpC,SAAO,yBAAM;AACd;AAUO,SAAS,sBAAsB,GAAgB;AACrD,SAAO,EAAE,WAAW,KAAM,yBAAM,YAAY,EAAE,WAAW,KAAK,EAAE,WAAW,CAAC,EAAE;AAC/E;AAGO,SAAS,sBAAsB,GAAgB;AACrD,SAAO,sBAAsB,CAAC,IAAI,IAAI,EAAE;AACzC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist-cjs/version.js
CHANGED
|
@@ -22,10 +22,10 @@ __export(version_exports, {
|
|
|
22
22
|
version: () => version
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(version_exports);
|
|
25
|
-
const version = "5.2.0
|
|
25
|
+
const version = "5.2.0";
|
|
26
26
|
const publishDates = {
|
|
27
27
|
major: "2026-05-06T16:28:18.473Z",
|
|
28
|
-
minor: "2026-
|
|
29
|
-
patch: "2026-
|
|
28
|
+
minor: "2026-07-01T09:20:01.735Z",
|
|
29
|
+
patch: "2026-07-01T09:20:01.735Z"
|
|
30
30
|
};
|
|
31
31
|
//# sourceMappingURL=version.js.map
|
package/dist-cjs/version.js.map
CHANGED
|
@@ -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 = '5.2.0
|
|
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 = '5.2.0'\nexport const publishDates = {\n\tmajor: '2026-05-06T16:28:18.473Z',\n\tminor: '2026-07-01T09:20:01.735Z',\n\tpatch: '2026-07-01T09:20:01.735Z',\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
|
}
|
package/dist-esm/index.d.mts
CHANGED
|
@@ -89,6 +89,7 @@ import { TLUnknownAsset } from '@tldraw/tlschema';
|
|
|
89
89
|
import { TLUnknownBinding } from '@tldraw/tlschema';
|
|
90
90
|
import { TLUnknownShape } from '@tldraw/tlschema';
|
|
91
91
|
import { TLUser } from '@tldraw/tlschema';
|
|
92
|
+
import { TLUserId } from '@tldraw/tlschema';
|
|
92
93
|
import { TLUserStore } from '@tldraw/tlschema';
|
|
93
94
|
import { TLVideoAsset } from '@tldraw/tlschema';
|
|
94
95
|
import { UnknownRecord } from '@tldraw/store';
|
|
@@ -646,6 +647,8 @@ export declare class Box {
|
|
|
646
647
|
/** @public */
|
|
647
648
|
export declare type BoxLike = Box | BoxModel;
|
|
648
649
|
|
|
650
|
+
/* Excluded from this release type: cancelShapeCreationOnLongPress */
|
|
651
|
+
|
|
649
652
|
/**
|
|
650
653
|
* @param a - Any angle in radians
|
|
651
654
|
* @returns A number between 0 and 2 * PI
|
|
@@ -746,6 +749,7 @@ export declare class ClickManager {
|
|
|
746
749
|
private _clickTimeout?;
|
|
747
750
|
private _clickScreenPoint?;
|
|
748
751
|
private _previousScreenPoint?;
|
|
752
|
+
private _isPressingWhilePending;
|
|
749
753
|
_getClickTimeout(state: TLClickState, id?: string): void;
|
|
750
754
|
/* Excluded from this release type: _clickState */
|
|
751
755
|
/**
|
|
@@ -984,9 +988,6 @@ export declare const DefaultErrorFallback: TLErrorFallbackComponent;
|
|
|
984
988
|
/** @public @react */
|
|
985
989
|
export declare function DefaultGrid({ x, y, z, size }: TLGridProps): JSX.Element;
|
|
986
990
|
|
|
987
|
-
/** @public @react */
|
|
988
|
-
export declare function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX.Element;
|
|
989
|
-
|
|
990
991
|
/** @public @react */
|
|
991
992
|
export declare const DefaultShapeWrapper: ForwardRefExoticComponent<TLShapeWrapperProps & RefAttributes<HTMLDivElement>>;
|
|
992
993
|
|
|
@@ -1575,6 +1576,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
1575
1576
|
*/
|
|
1576
1577
|
markHistoryStoppingPoint(name?: string): string;
|
|
1577
1578
|
/* Excluded from this release type: getMarkIdMatching */
|
|
1579
|
+
/* Excluded from this release type: isReplayingHistory */
|
|
1578
1580
|
/**
|
|
1579
1581
|
* Coalesces all changes since the given mark into a single change, removing any intermediate marks.
|
|
1580
1582
|
*
|
|
@@ -2455,7 +2457,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2455
2457
|
* @param opts - The camera move options.
|
|
2456
2458
|
* @public
|
|
2457
2459
|
*/
|
|
2458
|
-
zoomToUser(userId:
|
|
2460
|
+
zoomToUser(userId: TLUserId, opts?: TLCameraMoveOptions): this;
|
|
2459
2461
|
/* Excluded from this release type: _willSetInitialBounds */
|
|
2460
2462
|
/**
|
|
2461
2463
|
* Update the viewport. The viewport will measure the size and screen position of its container
|
|
@@ -2608,7 +2610,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2608
2610
|
*
|
|
2609
2611
|
* @public
|
|
2610
2612
|
*/
|
|
2611
|
-
startFollowingUser(userId:
|
|
2613
|
+
startFollowingUser(userId: TLUserId): this;
|
|
2612
2614
|
/**
|
|
2613
2615
|
* Stop viewport-following a user.
|
|
2614
2616
|
*
|
|
@@ -3719,6 +3721,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
3719
3721
|
* @public
|
|
3720
3722
|
*/
|
|
3721
3723
|
resizeShape(shape: TLShape | TLShapeId, scale: VecLike, opts?: TLResizeShapeOptions): this;
|
|
3724
|
+
/* Excluded from this release type: getResizeShapePartial */
|
|
3722
3725
|
/* Excluded from this release type: _scalePagePoint */
|
|
3723
3726
|
/* Excluded from this release type: _resizeUnalignedShape */
|
|
3724
3727
|
/**
|
|
@@ -4444,6 +4447,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
4444
4447
|
/* Excluded from this release type: _restoreToolId */
|
|
4445
4448
|
/* Excluded from this release type: _didPinch */
|
|
4446
4449
|
/* Excluded from this release type: _selectedShapeIdsAtPointerDown */
|
|
4450
|
+
/* Excluded from this release type: _didCaptureSelectionAtPointerDown */
|
|
4447
4451
|
/* Excluded from this release type: _longPressTimeout */
|
|
4448
4452
|
/* Excluded from this release type: capturedPointerId */
|
|
4449
4453
|
/* Excluded from this release type: performanceTracker */
|
|
@@ -5007,6 +5011,8 @@ export declare class HistoryManager<R extends UnknownRecord> {
|
|
|
5007
5011
|
private flushPendingDiff;
|
|
5008
5012
|
getNumUndos(): number;
|
|
5009
5013
|
getNumRedos(): number;
|
|
5014
|
+
/* Excluded from this release type: _isReplaying */
|
|
5015
|
+
/* Excluded from this release type: isReplaying */
|
|
5010
5016
|
/* Excluded from this release type: _isInBatch */
|
|
5011
5017
|
batch(fn: () => void, opts?: TLHistoryBatchOptions): this;
|
|
5012
5018
|
_undo({ pushToRedoStack, toMark }: {
|
|
@@ -5037,6 +5043,8 @@ export declare const inlineBase64AssetStore: TLAssetStore;
|
|
|
5037
5043
|
export declare class InputsManager {
|
|
5038
5044
|
private readonly editor;
|
|
5039
5045
|
constructor(editor: Editor);
|
|
5046
|
+
/* Excluded from this release type: dispose */
|
|
5047
|
+
private _onFrame;
|
|
5040
5048
|
private _originPagePoint;
|
|
5041
5049
|
/**
|
|
5042
5050
|
* The most recent pointer down's position in the current page space.
|
|
@@ -5529,6 +5537,25 @@ export declare function maybeSnapToGrid(point: Vec, editor: Editor): Vec;
|
|
|
5529
5537
|
*/
|
|
5530
5538
|
export declare function MenuClickCapture(): false | JSX.Element;
|
|
5531
5539
|
|
|
5540
|
+
/**
|
|
5541
|
+
* Move an element into a new parent, preserving its state where the platform allows it.
|
|
5542
|
+
*
|
|
5543
|
+
* Uses `Node.moveBefore` (Chromium 133+, Firefox 144+) when both the element and parent are
|
|
5544
|
+
* connected to the same document — this moves the element without resetting its state, so
|
|
5545
|
+
* iframes don't reload and media keeps playing. Otherwise (older browsers, disconnected nodes,
|
|
5546
|
+
* or a cross-document move) it falls back to `appendChild`, which moves the element but resets
|
|
5547
|
+
* its state like an iframe reload.
|
|
5548
|
+
*
|
|
5549
|
+
* This is the primitive tldraw uses to adopt `ShapeUtil.getAppOwnedElement` elements, exposed so
|
|
5550
|
+
* apps can perform symmetric state-preserving moves from `ShapeUtil.onReleaseAppOwnedElement` —
|
|
5551
|
+
* for example moving an element to an off-canvas parking lot between editor sessions.
|
|
5552
|
+
*
|
|
5553
|
+
* @param parent - The element to move `element` into, as its last child.
|
|
5554
|
+
* @param element - The element to move.
|
|
5555
|
+
* @public
|
|
5556
|
+
*/
|
|
5557
|
+
export declare function moveElementInto(parent: HTMLElement, element: HTMLElement): void;
|
|
5558
|
+
|
|
5532
5559
|
/* Excluded from this release type: normalizeWheel */
|
|
5533
5560
|
|
|
5534
5561
|
/**
|
|
@@ -6028,6 +6055,19 @@ export declare function resizeScaled(shape: TLBaseShape<any, {
|
|
|
6028
6055
|
y: number;
|
|
6029
6056
|
};
|
|
6030
6057
|
|
|
6058
|
+
/**
|
|
6059
|
+
* The whole-pixel line-height for a given font size and tldraw's unitless line-height
|
|
6060
|
+
* multiplier. tldraw's theme stores line-height as a multiplier (e.g. 1.35); resolving it
|
|
6061
|
+
* to a whole pixel keeps line spacing identical across rendering engines, which otherwise
|
|
6062
|
+
* disagree on fractional line boxes (WebKit snaps them to whole pixels, Blink keeps the
|
|
6063
|
+
* fraction) and let multi-line text drift apart. Apply it everywhere line-height is used —
|
|
6064
|
+
* measurement, on-canvas render, and export — so geometry and rendering agree.
|
|
6065
|
+
* See https://github.com/tldraw/tldraw/issues/8970.
|
|
6066
|
+
*
|
|
6067
|
+
* @public
|
|
6068
|
+
*/
|
|
6069
|
+
export declare function resolveLineHeightPx(fontSize: number, lineHeight: number): number;
|
|
6070
|
+
|
|
6031
6071
|
/**
|
|
6032
6072
|
* Resolve a partial set of user-provided themes into a complete `TLThemes`
|
|
6033
6073
|
* record by merging with `DEFAULT_THEME`. The result is suitable for passing to
|
|
@@ -6265,32 +6305,6 @@ export declare function setRuntimeOverrides(input: Partial<typeof runtime>): voi
|
|
|
6265
6305
|
/** @public */
|
|
6266
6306
|
export declare function setUserPreferences(user: TLUserPreferences): void;
|
|
6267
6307
|
|
|
6268
|
-
/**
|
|
6269
|
-
* Overlay util for shape indicators — the selection / hover / hint outlines drawn
|
|
6270
|
-
* under the selection foreground. Paints local indicators in the theme's
|
|
6271
|
-
* selection color.
|
|
6272
|
-
*
|
|
6273
|
-
* Remote collaborator selection indicators are drawn by a separate overlay util
|
|
6274
|
-
* (e.g. `CollaboratorShapeIndicatorOverlayUtil` from `tldraw`) that runs at a
|
|
6275
|
-
* lower z-index so peer selections appear under the local indicators.
|
|
6276
|
-
*
|
|
6277
|
-
* Non-interactive: contributes no hit-test geometry.
|
|
6278
|
-
*
|
|
6279
|
-
* @public
|
|
6280
|
-
*/
|
|
6281
|
-
export declare class ShapeIndicatorOverlayUtil extends OverlayUtil<TLShapeIndicatorOverlay> {
|
|
6282
|
-
static type: string;
|
|
6283
|
-
options: {
|
|
6284
|
-
hintedLineWidth: number;
|
|
6285
|
-
lineWidth: number;
|
|
6286
|
-
zIndex: number;
|
|
6287
|
-
};
|
|
6288
|
-
private _instanceFlags$;
|
|
6289
|
-
isActive(): boolean;
|
|
6290
|
-
getOverlays(): TLShapeIndicatorOverlay[];
|
|
6291
|
-
render(ctx: CanvasRenderingContext2D, overlays: TLShapeIndicatorOverlay[]): void;
|
|
6292
|
-
}
|
|
6293
|
-
|
|
6294
6308
|
/** @public */
|
|
6295
6309
|
export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
6296
6310
|
editor: Editor;
|
|
@@ -6986,6 +7000,45 @@ export declare abstract class ShapeUtil<Shape extends TLShape = TLShape> {
|
|
|
6986
7000
|
* @public
|
|
6987
7001
|
*/
|
|
6988
7002
|
onEditEnd?(shape: Shape): void;
|
|
7003
|
+
/**
|
|
7004
|
+
* Provide an app-owned element to be rendered inside the shape, alongside the output of
|
|
7005
|
+
* {@link ShapeUtil.component}. While the shape remains mounted, tldraw guarantees the
|
|
7006
|
+
* element keeps the same DOM position: it is never unmounted, recreated, or relocated by
|
|
7007
|
+
* reordering, reparenting, culling, or re-renders. When adopting the element, tldraw uses
|
|
7008
|
+
* `Node.moveBefore` where available so stateful content like cross-origin iframes keeps
|
|
7009
|
+
* its state across the move, falling back to `appendChild` elsewhere.
|
|
7010
|
+
*
|
|
7011
|
+
* Pair this with {@link ShapeUtil.onReleaseAppOwnedElement} to reclaim the element before
|
|
7012
|
+
* the shape or editor unmounts.
|
|
7013
|
+
*
|
|
7014
|
+
* This is called once per shape mount, not on every prop change, so the adopted element is
|
|
7015
|
+
* not refreshed when the shape's props change. If the element's content depends on props,
|
|
7016
|
+
* return a stable element and mutate it in place (for example from {@link ShapeUtil.component}
|
|
7017
|
+
* or an effect) rather than returning a different element.
|
|
7018
|
+
*
|
|
7019
|
+
* @param shape - The shape.
|
|
7020
|
+
* @returns The element to adopt, or null to render nothing.
|
|
7021
|
+
* @public
|
|
7022
|
+
*/
|
|
7023
|
+
getAppOwnedElement?(shape: Shape): HTMLElement | null;
|
|
7024
|
+
/**
|
|
7025
|
+
* A callback called before the shape's app-owned element slot is destroyed: when the shape
|
|
7026
|
+
* unmounts (for example when it is deleted or the current page changes) or when the whole
|
|
7027
|
+
* editor unmounts, including error teardown. The slot is still connected to the document
|
|
7028
|
+
* when this is called, so the app can move the element to another connected parent with
|
|
7029
|
+
* `Node.moveBefore` to preserve its state. An element left in the slot is destroyed along
|
|
7030
|
+
* with it.
|
|
7031
|
+
*
|
|
7032
|
+
* This is not only a "shape deleted" signal: it also fires on page changes, editor unmount,
|
|
7033
|
+
* and (in dev under React StrictMode) on the throwaway mount/unmount cycle while the shape
|
|
7034
|
+
* still exists. Make it safe to call when the shape is still present, and check the store
|
|
7035
|
+
* (`this.editor.getShape(shape.id)`) if you need to distinguish deletion from a remount.
|
|
7036
|
+
*
|
|
7037
|
+
* @param shape - The shape.
|
|
7038
|
+
* @param element - The element returned by {@link ShapeUtil.getAppOwnedElement}.
|
|
7039
|
+
* @public
|
|
7040
|
+
*/
|
|
7041
|
+
onReleaseAppOwnedElement?(shape: Shape, element: HTMLElement): void;
|
|
6989
7042
|
}
|
|
6990
7043
|
|
|
6991
7044
|
/**
|
|
@@ -7165,8 +7218,6 @@ export declare abstract class StateNode implements Partial<TLEventHandlers> {
|
|
|
7165
7218
|
onLongPress?(info: TLPointerEventInfo): void;
|
|
7166
7219
|
onPointerUp?(info: TLPointerEventInfo): void;
|
|
7167
7220
|
onDoubleClick?(info: TLClickEventInfo): void;
|
|
7168
|
-
onTripleClick?(info: TLClickEventInfo): void;
|
|
7169
|
-
onQuadrupleClick?(info: TLClickEventInfo): void;
|
|
7170
7221
|
onRightClick?(info: TLPointerEventInfo): void;
|
|
7171
7222
|
onMiddleClick?(info: TLPointerEventInfo): void;
|
|
7172
7223
|
onKeyDown?(info: TLKeyboardEventInfo): void;
|
|
@@ -7198,8 +7249,8 @@ export declare function stopEventPropagation(e: any): any;
|
|
|
7198
7249
|
* arrows with labels or complex arrowheads) can't be batched — they still
|
|
7199
7250
|
* stroke individually inside a save/restore with `ctx.clip` applied.
|
|
7200
7251
|
*
|
|
7201
|
-
* Shared by
|
|
7202
|
-
*
|
|
7252
|
+
* Shared by any overlay util that paints shape indicators (e.g. collaborator
|
|
7253
|
+
* selections).
|
|
7203
7254
|
*
|
|
7204
7255
|
* @public
|
|
7205
7256
|
*/
|
|
@@ -7566,17 +7617,17 @@ export declare type TLClickEvent = (info: TLClickEventInfo) => void;
|
|
|
7566
7617
|
export declare type TLClickEventInfo = TLBaseEventInfo & {
|
|
7567
7618
|
button: number;
|
|
7568
7619
|
name: TLCLickEventName;
|
|
7569
|
-
phase: 'down' | 'settle' | 'up';
|
|
7620
|
+
phase: 'down' | 'settle-down' | 'settle-up' | 'up';
|
|
7570
7621
|
point: VecLike;
|
|
7571
7622
|
pointerId: number;
|
|
7572
7623
|
type: 'click';
|
|
7573
7624
|
} & TLPointerEventTarget;
|
|
7574
7625
|
|
|
7575
7626
|
/** @public */
|
|
7576
|
-
export declare type TLCLickEventName = 'double_click'
|
|
7627
|
+
export declare type TLCLickEventName = 'double_click';
|
|
7577
7628
|
|
|
7578
7629
|
/** @public */
|
|
7579
|
-
export declare type TLClickState = 'idle' | 'overflow' | 'pendingDouble' | 'pendingOverflow'
|
|
7630
|
+
export declare type TLClickState = 'idle' | 'overflow' | 'pendingDouble' | 'pendingOverflow';
|
|
7580
7631
|
|
|
7581
7632
|
/**
|
|
7582
7633
|
* Raw clipboard paste payload, before tldraw parses clipboard contents into {@link TLExternalContent}.
|
|
@@ -8161,7 +8212,6 @@ export declare interface TLEditorComponents {
|
|
|
8161
8212
|
InFrontOfTheCanvas?: ComponentType | null;
|
|
8162
8213
|
LoadingScreen?: ComponentType | null;
|
|
8163
8214
|
OnTheCanvas?: ComponentType | null;
|
|
8164
|
-
SelectionBackground?: ComponentType<TLSelectionBackgroundProps> | null;
|
|
8165
8215
|
ShapeWrapper?: ComponentType<TLShapeWrapperProps & RefAttributes<HTMLDivElement>> | null;
|
|
8166
8216
|
Spinner?: ComponentType<React.SVGProps<SVGSVGElement>> | null;
|
|
8167
8217
|
SvgDefs?: ComponentType | null;
|
|
@@ -8314,6 +8364,7 @@ export declare const tlenv: {
|
|
|
8314
8364
|
isFirefox: boolean;
|
|
8315
8365
|
isIos: boolean;
|
|
8316
8366
|
isSafari: boolean;
|
|
8367
|
+
isTouchDevice: boolean;
|
|
8317
8368
|
isWebview: boolean;
|
|
8318
8369
|
};
|
|
8319
8370
|
|
|
@@ -8356,8 +8407,6 @@ export declare interface TLEventHandlers {
|
|
|
8356
8407
|
onLongPress: TLPointerEvent;
|
|
8357
8408
|
onRightClick: TLPointerEvent;
|
|
8358
8409
|
onDoubleClick: TLClickEvent;
|
|
8359
|
-
onTripleClick: TLClickEvent;
|
|
8360
|
-
onQuadrupleClick: TLClickEvent;
|
|
8361
8410
|
onMiddleClick: TLPointerEvent;
|
|
8362
8411
|
onPointerUp: TLPointerEvent;
|
|
8363
8412
|
onKeyDown: TLKeyboardEvent;
|
|
@@ -9031,6 +9080,13 @@ export declare type TLPointerEvent = (info: TLPointerEventInfo) => void;
|
|
|
9031
9080
|
|
|
9032
9081
|
/** @public */
|
|
9033
9082
|
export declare type TLPointerEventInfo = TLBaseEventInfo & {
|
|
9083
|
+
/**
|
|
9084
|
+
* Whether this pen event appears to be direct manipulation on the display (e.g. Apple Pencil on
|
|
9085
|
+
* an iPad or a Surface Pen on a touchscreen) rather than indirect input from a desktop graphics
|
|
9086
|
+
* tablet (e.g. a Wacom Intuos). Only direct-display pens should auto-enable pen mode. Drawing and
|
|
9087
|
+
* pressure behavior is driven by `isPen` and applies to all pens regardless of this flag.
|
|
9088
|
+
*/
|
|
9089
|
+
isPenDirect?: boolean;
|
|
9034
9090
|
button: number;
|
|
9035
9091
|
isPen: boolean;
|
|
9036
9092
|
name: TLPointerEventName;
|
|
@@ -9125,12 +9181,6 @@ export declare type TLResizeShapeOptions = Partial<{
|
|
|
9125
9181
|
|
|
9126
9182
|
/* Excluded from this release type: TLRotationSnapshot */
|
|
9127
9183
|
|
|
9128
|
-
/** @public */
|
|
9129
|
-
export declare interface TLSelectionBackgroundProps {
|
|
9130
|
-
bounds: Box;
|
|
9131
|
-
rotation: number;
|
|
9132
|
-
}
|
|
9133
|
-
|
|
9134
9184
|
/** @public */
|
|
9135
9185
|
export declare type TLSelectionHandle = RotateCorner | SelectionCorner | SelectionEdge;
|
|
9136
9186
|
|
|
@@ -9164,14 +9214,6 @@ export declare type TLShapeErrorFallbackComponent = ComponentType<{
|
|
|
9164
9214
|
error: any;
|
|
9165
9215
|
}>;
|
|
9166
9216
|
|
|
9167
|
-
/** @public */
|
|
9168
|
-
export declare interface TLShapeIndicatorOverlay extends TLOverlay {
|
|
9169
|
-
props: {
|
|
9170
|
-
hintingShapeIds: TLShapeId[];
|
|
9171
|
-
idsToDisplay: TLShapeId[];
|
|
9172
|
-
};
|
|
9173
|
-
}
|
|
9174
|
-
|
|
9175
9217
|
/**
|
|
9176
9218
|
* Emitted when shapes are created, updated, or deleted.
|
|
9177
9219
|
* @public
|
|
@@ -9653,13 +9695,13 @@ export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | n
|
|
|
9653
9695
|
* @returns The list of peer UserIDs
|
|
9654
9696
|
* @public
|
|
9655
9697
|
*/
|
|
9656
|
-
export declare function usePeerIds():
|
|
9698
|
+
export declare function usePeerIds(): TLUserId[];
|
|
9657
9699
|
|
|
9658
9700
|
/**
|
|
9659
9701
|
* @returns The latest presence of the user matching userId
|
|
9660
9702
|
* @public
|
|
9661
9703
|
*/
|
|
9662
|
-
export declare function usePresence(userId:
|
|
9704
|
+
export declare function usePresence(userId: TLUserId): null | TLInstancePresence;
|
|
9663
9705
|
|
|
9664
9706
|
/* Excluded from this release type: USER_COLORS */
|
|
9665
9707
|
|
|
@@ -9699,7 +9741,25 @@ export declare class UserPreferencesManager {
|
|
|
9699
9741
|
getEdgeScrollSpeed(): number;
|
|
9700
9742
|
getAnimationSpeed(): number;
|
|
9701
9743
|
getAreKeyboardShortcutsEnabled(): boolean;
|
|
9744
|
+
/**
|
|
9745
|
+
* The current user's raw, app-provided id — the value set in the user's
|
|
9746
|
+
* {@link @tldraw/editor#TLUserPreferences}. Use this when you need the id your application
|
|
9747
|
+
* assigned to the user. To compare against or look up store records, use
|
|
9748
|
+
* {@link UserPreferencesManager.getRecordId} instead.
|
|
9749
|
+
*/
|
|
9750
|
+
getExternalId(): string;
|
|
9751
|
+
/**
|
|
9752
|
+
* @deprecated Use {@link UserPreferencesManager.getExternalId} for the raw app-provided id, or
|
|
9753
|
+
* {@link UserPreferencesManager.getRecordId} for the prefixed `TLUserId` record id.
|
|
9754
|
+
*/
|
|
9702
9755
|
getId(): string;
|
|
9756
|
+
/**
|
|
9757
|
+
* The current user's id as a tldraw {@link @tldraw/tlschema#TLUserId} record id (prefixed
|
|
9758
|
+
* with `user:`). Use this when comparing against or looking up store records, such as a
|
|
9759
|
+
* presence record's `userId` or `followingUserId`. For the raw, app-provided id, use
|
|
9760
|
+
* {@link UserPreferencesManager.getExternalId}.
|
|
9761
|
+
*/
|
|
9762
|
+
getRecordId(): TLUserId;
|
|
9703
9763
|
getName(): string;
|
|
9704
9764
|
getLocale(): string;
|
|
9705
9765
|
getColor(): string;
|
|
@@ -9749,9 +9809,6 @@ export declare function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreS
|
|
|
9749
9809
|
/** @public */
|
|
9750
9810
|
export declare function useTLStore(opts: TLStoreOptions): TLStore;
|
|
9751
9811
|
|
|
9752
|
-
/** @public */
|
|
9753
|
-
export declare function useTransform(ref: React.RefObject<HTMLElement | null | SVGElement>, x?: number, y?: number, scale?: number, rotate?: number, additionalOffset?: VecLike): void;
|
|
9754
|
-
|
|
9755
9812
|
/**
|
|
9756
9813
|
* React's useId hook returns a unique id for the component. However, it uses a colon in the id,
|
|
9757
9814
|
* which is not valid for CSS selectors. This hook replaces the colon with an underscore.
|
package/dist-esm/index.mjs
CHANGED
|
@@ -13,9 +13,6 @@ import {
|
|
|
13
13
|
DefaultErrorFallback
|
|
14
14
|
} from "./lib/components/default-components/DefaultErrorFallback.mjs";
|
|
15
15
|
import { DefaultGrid } from "./lib/components/default-components/DefaultGrid.mjs";
|
|
16
|
-
import {
|
|
17
|
-
DefaultSelectionBackground
|
|
18
|
-
} from "./lib/components/default-components/DefaultSelectionBackground.mjs";
|
|
19
16
|
import {
|
|
20
17
|
DefaultShapeWrapper
|
|
21
18
|
} from "./lib/components/default-components/DefaultShapeWrapper.mjs";
|
|
@@ -82,7 +79,8 @@ import {
|
|
|
82
79
|
} from "./lib/editor/managers/SnapManager/SnapManager.mjs";
|
|
83
80
|
import { SpatialIndexManager } from "./lib/editor/managers/SpatialIndexManager/SpatialIndexManager.mjs";
|
|
84
81
|
import {
|
|
85
|
-
TextManager
|
|
82
|
+
TextManager,
|
|
83
|
+
resolveLineHeightPx
|
|
86
84
|
} from "./lib/editor/managers/TextManager/TextManager.mjs";
|
|
87
85
|
import { DEFAULT_THEME } from "./lib/editor/managers/ThemeManager/defaultThemes.mjs";
|
|
88
86
|
import { ThemeManager, resolveThemes } from "./lib/editor/managers/ThemeManager/ThemeManager.mjs";
|
|
@@ -104,10 +102,7 @@ import { OverlayManager } from "./lib/editor/overlays/OverlayManager.mjs";
|
|
|
104
102
|
import {
|
|
105
103
|
OverlayUtil
|
|
106
104
|
} from "./lib/editor/overlays/OverlayUtil.mjs";
|
|
107
|
-
import {
|
|
108
|
-
ShapeIndicatorOverlayUtil,
|
|
109
|
-
strokeShapeIndicators
|
|
110
|
-
} from "./lib/editor/overlays/ShapeIndicatorOverlayUtil.mjs";
|
|
105
|
+
import { strokeShapeIndicators } from "./lib/editor/overlays/strokeShapeIndicators.mjs";
|
|
111
106
|
import {
|
|
112
107
|
getPerfectDashProps
|
|
113
108
|
} from "./lib/editor/shapes/shared/getPerfectDashProps.mjs";
|
|
@@ -115,6 +110,7 @@ import { resizeBox } from "./lib/editor/shapes/shared/resizeBox.mjs";
|
|
|
115
110
|
import { resizeScaled } from "./lib/editor/shapes/shared/resizeScaled.mjs";
|
|
116
111
|
import { BaseBoxShapeTool } from "./lib/editor/tools/BaseBoxShapeTool/BaseBoxShapeTool.mjs";
|
|
117
112
|
import { maybeSnapToGrid } from "./lib/editor/tools/BaseBoxShapeTool/children/Pointing.mjs";
|
|
113
|
+
import { cancelShapeCreationOnLongPress } from "./lib/editor/tools/cancelShapeCreationOnLongPress.mjs";
|
|
118
114
|
import { StateNode } from "./lib/editor/tools/StateNode.mjs";
|
|
119
115
|
import {
|
|
120
116
|
EVENT_NAME_MAP
|
|
@@ -160,7 +156,6 @@ import {
|
|
|
160
156
|
useUniqueSafeId
|
|
161
157
|
} from "./lib/hooks/useSafeId.mjs";
|
|
162
158
|
import { useTLSchemaFromUtils, useTLStore } from "./lib/hooks/useTLStore.mjs";
|
|
163
|
-
import { useTransform } from "./lib/hooks/useTransform.mjs";
|
|
164
159
|
import { useViewportHeight } from "./lib/hooks/useViewportHeight.mjs";
|
|
165
160
|
import {
|
|
166
161
|
LicenseManager
|
|
@@ -265,6 +260,7 @@ import {
|
|
|
265
260
|
getGlobalDocument,
|
|
266
261
|
getGlobalWindow,
|
|
267
262
|
loopToHtmlElement,
|
|
263
|
+
moveElementInto,
|
|
268
264
|
preventDefault,
|
|
269
265
|
releasePointerCapture,
|
|
270
266
|
setPointerCapture,
|
|
@@ -300,7 +296,7 @@ import { LocalIndexedDb, Table } from "./lib/utils/sync/LocalIndexedDb.mjs";
|
|
|
300
296
|
import { uniq } from "./lib/utils/uniq.mjs";
|
|
301
297
|
registerTldrawLibraryVersion(
|
|
302
298
|
"@tldraw/editor",
|
|
303
|
-
"5.2.0
|
|
299
|
+
"5.2.0",
|
|
304
300
|
"esm"
|
|
305
301
|
);
|
|
306
302
|
import { getColorValue } from "./lib/editor/managers/ThemeManager/defaultThemes.mjs";
|
|
@@ -326,7 +322,6 @@ export {
|
|
|
326
322
|
DefaultCanvas,
|
|
327
323
|
DefaultErrorFallback,
|
|
328
324
|
DefaultGrid,
|
|
329
|
-
DefaultSelectionBackground,
|
|
330
325
|
DefaultShapeWrapper,
|
|
331
326
|
DefaultSpinner,
|
|
332
327
|
DefaultSvgDefs,
|
|
@@ -374,7 +369,6 @@ export {
|
|
|
374
369
|
SIN,
|
|
375
370
|
SVGContainer,
|
|
376
371
|
ScribbleManager,
|
|
377
|
-
ShapeIndicatorOverlayUtil,
|
|
378
372
|
ShapeUtil,
|
|
379
373
|
SharedStyleMap,
|
|
380
374
|
SnapManager,
|
|
@@ -397,6 +391,7 @@ export {
|
|
|
397
391
|
approximately,
|
|
398
392
|
areAnglesCompatible,
|
|
399
393
|
average,
|
|
394
|
+
cancelShapeCreationOnLongPress,
|
|
400
395
|
canonicalizeRotation,
|
|
401
396
|
centerOfCircleFromThreePoints,
|
|
402
397
|
clamp,
|
|
@@ -465,6 +460,7 @@ export {
|
|
|
465
460
|
loadSnapshot,
|
|
466
461
|
loopToHtmlElement,
|
|
467
462
|
maybeSnapToGrid,
|
|
463
|
+
moveElementInto,
|
|
468
464
|
normalizeWheel,
|
|
469
465
|
openWindow,
|
|
470
466
|
parseDeepLinkString,
|
|
@@ -480,6 +476,7 @@ export {
|
|
|
480
476
|
releasePointerCapture,
|
|
481
477
|
resizeBox,
|
|
482
478
|
resizeScaled,
|
|
479
|
+
resolveLineHeightPx,
|
|
483
480
|
resolveThemes,
|
|
484
481
|
rotateSelectionHandle,
|
|
485
482
|
runtime,
|
|
@@ -526,7 +523,6 @@ export {
|
|
|
526
523
|
useTLSchemaFromUtils,
|
|
527
524
|
useTLStore,
|
|
528
525
|
useTldrawCurrentUser,
|
|
529
|
-
useTransform,
|
|
530
526
|
useUniqueSafeId,
|
|
531
527
|
useViewportHeight,
|
|
532
528
|
userTypeValidator
|