@tldraw/editor 3.13.0-canary.d403fcffd1eb → 3.13.0-canary.d84fd6da5b87
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 +1 -0
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +25 -20
- package/dist-cjs/lib/editor/Editor.js.map +3 -3
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +1 -0
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +25 -20
- package/dist-esm/lib/editor/Editor.mjs.map +3 -3
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/package.json +7 -7
- package/src/lib/editor/Editor.ts +22 -19
- package/src/version.ts +3 -3
package/dist-esm/version.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const version = "3.13.0-canary.
|
|
1
|
+
const version = "3.13.0-canary.d84fd6da5b87";
|
|
2
2
|
const publishDates = {
|
|
3
3
|
major: "2024-09-13T14:36:29.063Z",
|
|
4
|
-
minor: "2025-04-
|
|
5
|
-
patch: "2025-04-
|
|
4
|
+
minor: "2025-04-22T11:11:30.840Z",
|
|
5
|
+
patch: "2025-04-22T11:11:30.840Z"
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
8
|
publishDates,
|
package/dist-esm/version.mjs.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 = '3.13.0-canary.
|
|
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 = '3.13.0-canary.d84fd6da5b87'\nexport const publishDates = {\n\tmajor: '2024-09-13T14:36:29.063Z',\n\tminor: '2025-04-22T11:11:30.840Z',\n\tpatch: '2025-04-22T11:11:30.840Z',\n}\n"],
|
|
5
5
|
"mappings": "AAGO,MAAM,UAAU;AAChB,MAAM,eAAe;AAAA,EAC3B,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tldraw/editor",
|
|
3
3
|
"description": "A tiny little drawing app (editor).",
|
|
4
|
-
"version": "3.13.0-canary.
|
|
4
|
+
"version": "3.13.0-canary.d84fd6da5b87",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@tiptap/core": "^2.9.1",
|
|
49
49
|
"@tiptap/pm": "^2.9.1",
|
|
50
50
|
"@tiptap/react": "^2.9.1",
|
|
51
|
-
"@tldraw/state": "3.13.0-canary.
|
|
52
|
-
"@tldraw/state-react": "3.13.0-canary.
|
|
53
|
-
"@tldraw/store": "3.13.0-canary.
|
|
54
|
-
"@tldraw/tlschema": "3.13.0-canary.
|
|
55
|
-
"@tldraw/utils": "3.13.0-canary.
|
|
56
|
-
"@tldraw/validate": "3.13.0-canary.
|
|
51
|
+
"@tldraw/state": "3.13.0-canary.d84fd6da5b87",
|
|
52
|
+
"@tldraw/state-react": "3.13.0-canary.d84fd6da5b87",
|
|
53
|
+
"@tldraw/store": "3.13.0-canary.d84fd6da5b87",
|
|
54
|
+
"@tldraw/tlschema": "3.13.0-canary.d84fd6da5b87",
|
|
55
|
+
"@tldraw/utils": "3.13.0-canary.d84fd6da5b87",
|
|
56
|
+
"@tldraw/validate": "3.13.0-canary.d84fd6da5b87",
|
|
57
57
|
"@types/core-js": "^2.5.8",
|
|
58
58
|
"@use-gesture/react": "^10.3.1",
|
|
59
59
|
"classnames": "^2.5.1",
|
package/src/lib/editor/Editor.ts
CHANGED
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
TLImageAsset,
|
|
43
43
|
TLInstance,
|
|
44
44
|
TLInstancePageState,
|
|
45
|
+
TLInstancePresence,
|
|
45
46
|
TLNoteShape,
|
|
46
47
|
TLPOINTER_ID,
|
|
47
48
|
TLPage,
|
|
@@ -1704,8 +1705,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
1704
1705
|
* @readonly
|
|
1705
1706
|
*/
|
|
1706
1707
|
@computed getSelectedShapes(): TLShape[] {
|
|
1707
|
-
|
|
1708
|
-
return compact(selectedShapeIds.map((id) => this.store.get(id)))
|
|
1708
|
+
return compact(this.getSelectedShapeIds().map((id) => this.store.get(id)))
|
|
1709
1709
|
}
|
|
1710
1710
|
|
|
1711
1711
|
/**
|
|
@@ -2575,14 +2575,25 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
2575
2575
|
return baseCamera
|
|
2576
2576
|
}
|
|
2577
2577
|
|
|
2578
|
+
private _getFollowingPresence(targetUserId: string | null) {
|
|
2579
|
+
const visited = [this.user.getId()]
|
|
2580
|
+
const collaborators = this.getCollaborators()
|
|
2581
|
+
let leaderPresence = null as null | TLInstancePresence
|
|
2582
|
+
while (targetUserId && !visited.includes(targetUserId)) {
|
|
2583
|
+
leaderPresence = collaborators.find((c) => c.userId === targetUserId) ?? null
|
|
2584
|
+
targetUserId = leaderPresence?.followingUserId ?? null
|
|
2585
|
+
if (leaderPresence) {
|
|
2586
|
+
visited.push(leaderPresence.userId)
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2589
|
+
return leaderPresence
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2578
2592
|
@computed
|
|
2579
2593
|
private getViewportPageBoundsForFollowing(): null | Box {
|
|
2580
|
-
const
|
|
2581
|
-
if (!followingUserId) return null
|
|
2582
|
-
const leaderPresence = this.getCollaborators().find((c) => c.userId === followingUserId)
|
|
2583
|
-
if (!leaderPresence) return null
|
|
2594
|
+
const leaderPresence = this._getFollowingPresence(this.getInstanceState().followingUserId)
|
|
2584
2595
|
|
|
2585
|
-
if (!leaderPresence
|
|
2596
|
+
if (!leaderPresence?.camera || !leaderPresence?.screenBounds) return null
|
|
2586
2597
|
|
|
2587
2598
|
// Fit their viewport inside of our screen bounds
|
|
2588
2599
|
// 1. calculate their viewport in page space
|
|
@@ -3781,15 +3792,6 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
3781
3792
|
// if we were already following someone, stop following them
|
|
3782
3793
|
this.stopFollowingUser()
|
|
3783
3794
|
|
|
3784
|
-
const leaderPresences = this._getCollaboratorsQuery()
|
|
3785
|
-
.get()
|
|
3786
|
-
.filter((p) => p.userId === userId)
|
|
3787
|
-
|
|
3788
|
-
if (!leaderPresences.length) {
|
|
3789
|
-
console.warn('User not found')
|
|
3790
|
-
return this
|
|
3791
|
-
}
|
|
3792
|
-
|
|
3793
3795
|
const thisUserId = this.user.getId()
|
|
3794
3796
|
|
|
3795
3797
|
if (!thisUserId) {
|
|
@@ -3797,13 +3799,14 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
3797
3799
|
// allow to continue since it's probably fine most of the time.
|
|
3798
3800
|
}
|
|
3799
3801
|
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
+
const leaderPresence = this._getFollowingPresence(userId)
|
|
3803
|
+
|
|
3804
|
+
if (!leaderPresence) {
|
|
3802
3805
|
return this
|
|
3803
3806
|
}
|
|
3804
3807
|
|
|
3805
3808
|
const latestLeaderPresence = computed('latestLeaderPresence', () => {
|
|
3806
|
-
return this.
|
|
3809
|
+
return this._getFollowingPresence(userId)
|
|
3807
3810
|
})
|
|
3808
3811
|
|
|
3809
3812
|
transact(() => {
|
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 = '3.13.0-canary.
|
|
4
|
+
export const version = '3.13.0-canary.d84fd6da5b87'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2024-09-13T14:36:29.063Z',
|
|
7
|
-
minor: '2025-04-
|
|
8
|
-
patch: '2025-04-
|
|
7
|
+
minor: '2025-04-22T11:11:30.840Z',
|
|
8
|
+
patch: '2025-04-22T11:11:30.840Z',
|
|
9
9
|
}
|