@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.
- package/dist-cjs/index.d.ts +3 -3
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js +4 -1
- package/dist-cjs/lib/components/default-components/DefaultErrorFallback.js.map +3 -3
- package/dist-cjs/lib/components/default-components/DefaultLoadingScreen.js +2 -2
- package/dist-cjs/lib/components/default-components/DefaultLoadingScreen.js.map +2 -2
- package/dist-cjs/lib/components/default-components/DefaultShapeErrorFallback.js +1 -1
- package/dist-cjs/lib/components/default-components/DefaultShapeErrorFallback.js.map +3 -3
- package/dist-cjs/lib/components/default-components/DefaultSvgDefs.js +2 -2
- package/dist-cjs/lib/components/default-components/DefaultSvgDefs.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/bindingsIndex.js +2 -2
- package/dist-cjs/lib/editor/derivations/bindingsIndex.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/parentsToChildren.js +2 -2
- package/dist-cjs/lib/editor/derivations/parentsToChildren.js.map +2 -2
- package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js +2 -2
- package/dist-cjs/lib/editor/derivations/shapeIdsInCurrentPage.js.map +2 -2
- package/dist-cjs/lib/license/LicenseProvider.js +3 -1
- package/dist-cjs/lib/license/LicenseProvider.js.map +2 -2
- package/dist-cjs/lib/primitives/utils.js +2 -2
- package/dist-cjs/lib/primitives/utils.js.map +2 -2
- package/dist-cjs/lib/utils/dom.js +5 -3
- package/dist-cjs/lib/utils/dom.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +3 -3
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs +4 -1
- package/dist-esm/lib/components/default-components/DefaultErrorFallback.mjs.map +3 -3
- package/dist-esm/lib/components/default-components/DefaultLoadingScreen.mjs +2 -2
- package/dist-esm/lib/components/default-components/DefaultLoadingScreen.mjs.map +2 -2
- package/dist-esm/lib/components/default-components/DefaultShapeErrorFallback.mjs +1 -1
- package/dist-esm/lib/components/default-components/DefaultShapeErrorFallback.mjs.map +3 -3
- package/dist-esm/lib/components/default-components/DefaultSvgDefs.mjs +2 -2
- package/dist-esm/lib/components/default-components/DefaultSvgDefs.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/bindingsIndex.mjs +2 -2
- package/dist-esm/lib/editor/derivations/bindingsIndex.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/parentsToChildren.mjs +2 -2
- package/dist-esm/lib/editor/derivations/parentsToChildren.mjs.map +2 -2
- package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs +2 -2
- package/dist-esm/lib/editor/derivations/shapeIdsInCurrentPage.mjs.map +2 -2
- package/dist-esm/lib/license/LicenseProvider.mjs +3 -1
- package/dist-esm/lib/license/LicenseProvider.mjs.map +2 -2
- package/dist-esm/lib/primitives/utils.mjs +2 -2
- package/dist-esm/lib/primitives/utils.mjs.map +2 -2
- package/dist-esm/lib/utils/dom.mjs +5 -3
- package/dist-esm/lib/utils/dom.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/components/default-components/DefaultErrorFallback.tsx +4 -1
- package/src/lib/components/default-components/DefaultLoadingScreen.tsx +1 -1
- package/src/lib/components/default-components/DefaultShapeErrorFallback.tsx +4 -3
- package/src/lib/components/default-components/DefaultSvgDefs.tsx +1 -1
- package/src/lib/editor/derivations/bindingsIndex.ts +1 -1
- package/src/lib/editor/derivations/parentsToChildren.ts +1 -1
- package/src/lib/editor/derivations/shapeIdsInCurrentPage.ts +1 -1
- package/src/lib/license/LicenseProvider.tsx +3 -1
- package/src/lib/primitives/utils.ts +1 -1
- package/src/lib/utils/dom.ts +5 -3
- 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.
|
|
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.
|
|
53
|
-
"@tldraw/state-react": "5.
|
|
54
|
-
"@tldraw/store": "5.
|
|
55
|
-
"@tldraw/tlschema": "5.
|
|
56
|
-
"@tldraw/utils": "5.
|
|
57
|
-
"@tldraw/validate": "5.
|
|
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 = ({
|
|
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
|
|
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
|
-
|
|
9
|
-
|
|
7
|
+
export const DefaultShapeErrorFallback: TLShapeErrorFallbackComponent =
|
|
8
|
+
function DefaultShapeErrorFallback() {
|
|
9
|
+
return <div className="tl-shape-error-boundary" />
|
|
10
|
+
}
|
|
@@ -29,7 +29,7 @@ function fromScratch(bindingsQuery: Computed<TLBinding[], unknown>) {
|
|
|
29
29
|
return shapesToBindings
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export
|
|
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
|
|
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
|
|
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
|
|
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
|
|
366
|
+
export function isSafeFloat(n: number) {
|
|
367
367
|
return Math.abs(n) < Number.MAX_SAFE_INTEGER
|
|
368
368
|
}
|
|
369
369
|
|
package/src/lib/utils/dom.ts
CHANGED
|
@@ -86,14 +86,16 @@ export function releasePointerCapture(
|
|
|
86
86
|
*
|
|
87
87
|
* @public
|
|
88
88
|
*/
|
|
89
|
-
export
|
|
89
|
+
export function stopEventPropagation(e: any) {
|
|
90
|
+
return e.stopPropagation()
|
|
91
|
+
}
|
|
90
92
|
|
|
91
93
|
/** @internal */
|
|
92
|
-
export
|
|
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.
|
|
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:
|
|
8
|
-
patch: '2026-06-03T10:
|
|
7
|
+
minor: '2026-06-03T10:38:24.758Z',
|
|
8
|
+
patch: '2026-06-03T10:38:24.758Z',
|
|
9
9
|
}
|