@tldraw/editor 5.1.0 → 5.2.0-next.b91d4a4551c9

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 (60) hide show
  1. package/dist-cjs/index.d.ts +3 -3
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +4 -1
  4. package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +3 -3
  5. package/dist-cjs/lib/components/default-components/DefaultLoadingScreen.js +2 -2
  6. package/dist-cjs/lib/components/default-components/DefaultLoadingScreen.js.map +2 -2
  7. package/dist-cjs/lib/components/default-components/DefaultShapeErrorFallback.js +1 -1
  8. package/dist-cjs/lib/components/default-components/DefaultShapeErrorFallback.js.map +3 -3
  9. package/dist-cjs/lib/components/default-components/DefaultSvgDefs.js +2 -2
  10. package/dist-cjs/lib/components/default-components/DefaultSvgDefs.js.map +2 -2
  11. package/dist-cjs/lib/editor/derivations/bindingsIndex.js +2 -2
  12. package/dist-cjs/lib/editor/derivations/bindingsIndex.js.map +2 -2
  13. package/dist-cjs/lib/editor/derivations/parentsToChildren.js +2 -2
  14. package/dist-cjs/lib/editor/derivations/parentsToChildren.js.map +2 -2
  15. package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js +2 -2
  16. package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js.map +2 -2
  17. package/dist-cjs/lib/license/LicenseProvider.js +3 -1
  18. package/dist-cjs/lib/license/LicenseProvider.js.map +2 -2
  19. package/dist-cjs/lib/primitives/utils.js +2 -2
  20. package/dist-cjs/lib/primitives/utils.js.map +2 -2
  21. package/dist-cjs/lib/utils/dom.js +5 -3
  22. package/dist-cjs/lib/utils/dom.js.map +2 -2
  23. package/dist-cjs/version.js +3 -3
  24. package/dist-cjs/version.js.map +1 -1
  25. package/dist-esm/index.d.mts +3 -3
  26. package/dist-esm/index.mjs +1 -1
  27. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +4 -1
  28. package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +3 -3
  29. package/dist-esm/lib/components/default-components/DefaultLoadingScreen.mjs +2 -2
  30. package/dist-esm/lib/components/default-components/DefaultLoadingScreen.mjs.map +2 -2
  31. package/dist-esm/lib/components/default-components/DefaultShapeErrorFallback.mjs +1 -1
  32. package/dist-esm/lib/components/default-components/DefaultShapeErrorFallback.mjs.map +3 -3
  33. package/dist-esm/lib/components/default-components/DefaultSvgDefs.mjs +2 -2
  34. package/dist-esm/lib/components/default-components/DefaultSvgDefs.mjs.map +2 -2
  35. package/dist-esm/lib/editor/derivations/bindingsIndex.mjs +2 -2
  36. package/dist-esm/lib/editor/derivations/bindingsIndex.mjs.map +2 -2
  37. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs +2 -2
  38. package/dist-esm/lib/editor/derivations/parentsToChildren.mjs.map +2 -2
  39. package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs +2 -2
  40. package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs.map +2 -2
  41. package/dist-esm/lib/license/LicenseProvider.mjs +3 -1
  42. package/dist-esm/lib/license/LicenseProvider.mjs.map +2 -2
  43. package/dist-esm/lib/primitives/utils.mjs +2 -2
  44. package/dist-esm/lib/primitives/utils.mjs.map +2 -2
  45. package/dist-esm/lib/utils/dom.mjs +5 -3
  46. package/dist-esm/lib/utils/dom.mjs.map +2 -2
  47. package/dist-esm/version.mjs +3 -3
  48. package/dist-esm/version.mjs.map +1 -1
  49. package/package.json +7 -7
  50. package/src/lib/components/default-components/DefaultErrorFallback.tsx +4 -1
  51. package/src/lib/components/default-components/DefaultLoadingScreen.tsx +1 -1
  52. package/src/lib/components/default-components/DefaultShapeErrorFallback.tsx +4 -3
  53. package/src/lib/components/default-components/DefaultSvgDefs.tsx +1 -1
  54. package/src/lib/editor/derivations/bindingsIndex.ts +1 -1
  55. package/src/lib/editor/derivations/parentsToChildren.ts +1 -1
  56. package/src/lib/editor/derivations/shapeIdsInCurrentPage.ts +1 -1
  57. package/src/lib/license/LicenseProvider.tsx +3 -1
  58. package/src/lib/primitives/utils.ts +1 -1
  59. package/src/lib/utils/dom.ts +5 -3
  60. package/src/version.ts +3 -3
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tldraw/editor",
3
3
  "description": "tldraw infinite canvas SDK (editor).",
4
- "version": "5.1.0",
4
+ "version": "5.2.0-next.b91d4a4551c9",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -49,12 +49,12 @@
49
49
  "@tiptap/core": "^3.12.1",
50
50
  "@tiptap/pm": "^3.12.1",
51
51
  "@tiptap/react": "^3.12.1",
52
- "@tldraw/state": "5.1.0",
53
- "@tldraw/state-react": "5.1.0",
54
- "@tldraw/store": "5.1.0",
55
- "@tldraw/tlschema": "5.1.0",
56
- "@tldraw/utils": "5.1.0",
57
- "@tldraw/validate": "5.1.0",
52
+ "@tldraw/state": "5.2.0-next.b91d4a4551c9",
53
+ "@tldraw/state-react": "5.2.0-next.b91d4a4551c9",
54
+ "@tldraw/store": "5.2.0-next.b91d4a4551c9",
55
+ "@tldraw/tlschema": "5.2.0-next.b91d4a4551c9",
56
+ "@tldraw/utils": "5.2.0-next.b91d4a4551c9",
57
+ "@tldraw/validate": "5.2.0-next.b91d4a4551c9",
58
58
  "classnames": "^2.5.1",
59
59
  "eventemitter3": "^4.0.7",
60
60
  "idb": "^7.1.1",
@@ -16,7 +16,10 @@ const BASE_ERROR_URL = 'https://github.com/tldraw/tldraw/issues/new'
16
16
  export type TLErrorFallbackComponent = ComponentType<{ error: unknown; editor?: Editor }>
17
17
 
18
18
  /** @public @react */
19
- export const DefaultErrorFallback: TLErrorFallbackComponent = ({ error, editor }) => {
19
+ export const DefaultErrorFallback: TLErrorFallbackComponent = function DefaultErrorFallback({
20
+ error,
21
+ editor,
22
+ }) {
20
23
  const containerRef = useRef<HTMLDivElement>(null)
21
24
  const [shouldShowError, setShouldShowError] = useState(process.env.NODE_ENV === 'development')
22
25
  const [didCopy, setDidCopy] = useState(false)
@@ -1,7 +1,7 @@
1
1
  import { useEditorComponents } from '../../hooks/EditorComponentsContext'
2
2
 
3
3
  /** @public @react */
4
- export const DefaultLoadingScreen = () => {
4
+ export function DefaultLoadingScreen() {
5
5
  const { Spinner } = useEditorComponents()
6
6
  return (
7
7
  <div className="tl-loading" aria-busy="true" tabIndex={0}>
@@ -4,6 +4,7 @@ import { ComponentType } from 'react'
4
4
  export type TLShapeErrorFallbackComponent = ComponentType<{ error: any }>
5
5
 
6
6
  /** @internal */
7
- export const DefaultShapeErrorFallback: TLShapeErrorFallbackComponent = () => {
8
- return <div className="tl-shape-error-boundary" />
9
- }
7
+ export const DefaultShapeErrorFallback: TLShapeErrorFallbackComponent =
8
+ function DefaultShapeErrorFallback() {
9
+ return <div className="tl-shape-error-boundary" />
10
+ }
@@ -1,4 +1,4 @@
1
1
  /** @public @react */
2
- export const DefaultSvgDefs = () => {
2
+ export function DefaultSvgDefs() {
3
3
  return null
4
4
  }
@@ -29,7 +29,7 @@ function fromScratch(bindingsQuery: Computed<TLBinding[], unknown>) {
29
29
  return shapesToBindings
30
30
  }
31
31
 
32
- export const bindingsIndex = (editor: Editor): Computed<TLBindingsIndex> => {
32
+ export function bindingsIndex(editor: Editor): Computed<TLBindingsIndex> {
33
33
  const { store } = editor
34
34
  const bindingsHistory = store.query.filterHistory('binding')
35
35
  const bindingsQuery = store.query.records('binding')
@@ -22,7 +22,7 @@ function fromScratch(
22
22
  return result
23
23
  }
24
24
 
25
- export const parentsToChildren = (store: TLStore) => {
25
+ export function parentsToChildren(store: TLStore) {
26
26
  const shapeIdsQuery = store.query.ids<'shape'>('shape')
27
27
  const shapeHistory = store.query.filterHistory('shape')
28
28
 
@@ -33,7 +33,7 @@ const isShapeInPage = (store: TLStore, pageId: TLPageId, shape: TLShape): boolea
33
33
  * @param store - The tldraw store.
34
34
  * @param getCurrentPageId - A function that returns the current page id.
35
35
  */
36
- export const deriveShapeIdsInCurrentPage = (store: TLStore, getCurrentPageId: () => TLPageId) => {
36
+ export function deriveShapeIdsInCurrentPage(store: TLStore, getCurrentPageId: () => TLPageId) {
37
37
  const shapesIndex = store.query.ids('shape')
38
38
  let lastPageId: null | TLPageId = null
39
39
  function fromScratch() {
@@ -6,7 +6,9 @@ import { LicenseManager } from './LicenseManager'
6
6
  export const LicenseContext = createContext({} as LicenseManager)
7
7
 
8
8
  /** @internal */
9
- export const useLicenseContext = () => useContext(LicenseContext)
9
+ export function useLicenseContext() {
10
+ return useContext(LicenseContext)
11
+ }
10
12
 
11
13
  function shouldHideEditorAfterDelay(licenseState: string): boolean {
12
14
  return licenseState === 'expired' || licenseState === 'unlicensed-production'
@@ -363,7 +363,7 @@ export function toFixed(v: number) {
363
363
  * Check if a float is safe to use. ie: Not too big or small.
364
364
  * @public
365
365
  */
366
- export const isSafeFloat = (n: number) => {
366
+ export function isSafeFloat(n: number) {
367
367
  return Math.abs(n) < Number.MAX_SAFE_INTEGER
368
368
  }
369
369
 
@@ -86,14 +86,16 @@ export function releasePointerCapture(
86
86
  *
87
87
  * @public
88
88
  */
89
- export const stopEventPropagation = (e: any) => e.stopPropagation()
89
+ export function stopEventPropagation(e: any) {
90
+ return e.stopPropagation()
91
+ }
90
92
 
91
93
  /** @internal */
92
- export const setStyleProperty = (
94
+ export function setStyleProperty(
93
95
  elm: HTMLElement | null,
94
96
  property: string,
95
97
  value: string | number
96
- ) => {
98
+ ) {
97
99
  if (!elm) return
98
100
  elm.style.setProperty(property, String(value))
99
101
  }
package/src/version.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // This file is automatically generated by internal/scripts/refresh-assets.ts.
2
2
  // Do not edit manually. Or do, I'm a comment, not a cop.
3
3
 
4
- export const version = '5.1.0'
4
+ export const version = '5.2.0-next.b91d4a4551c9'
5
5
  export const publishDates = {
6
6
  major: '2026-05-06T16:28:18.473Z',
7
- minor: '2026-06-03T10:26:13.606Z',
8
- patch: '2026-06-03T10:26:13.606Z',
7
+ minor: '2026-06-03T10:38:24.758Z',
8
+ patch: '2026-06-03T10:38:24.758Z',
9
9
  }