@tldraw/editor 5.2.0-canary.083e81484bc9 → 5.2.0-canary.0878dbd31f0d
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 +6 -0
- package/dist-cjs/index.d.ts +23 -4
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/editor/Editor.js +10 -4
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.js +2 -2
- package/dist-cjs/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.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/hooks/usePresence.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 +23 -4
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/editor/Editor.mjs +10 -4
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.mjs +2 -2
- package/dist-esm/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.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/hooks/usePresence.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/editor/Editor.ts +15 -7
- package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.test.ts +31 -18
- package/src/lib/editor/managers/CollaboratorsManager/CollaboratorsManager.ts +2 -2
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.test.ts +12 -2
- package/src/lib/editor/managers/UserPreferencesManager/UserPreferencesManager.ts +27 -2
- package/src/lib/hooks/usePresence.ts +2 -2
- package/src/version.ts +3 -3
package/README.md
CHANGED
|
@@ -4,6 +4,12 @@ The core editor and composable parts for tldraw. [Click here](https://tldraw.dev
|
|
|
4
4
|
|
|
5
5
|
You might be more interested in the general package [tldraw](https://github.com/tldraw/tldraw/tree/main/packages/tldraw) instead of using this package directly.
|
|
6
6
|
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
Documentation for the most recent release can be found on [tldraw.dev/docs](https://tldraw.dev/docs), including [reference docs](https://tldraw.dev/reference/editor/Editor). Our release notes can be found [here](https://tldraw.dev/releases).
|
|
10
|
+
|
|
11
|
+
For more agent-friendly docs, see our [LLMs.txt](https://tldraw.dev/llms.txt).
|
|
12
|
+
|
|
7
13
|
## License
|
|
8
14
|
|
|
9
15
|
This project is part of the tldraw SDK. It is provided under the [tldraw SDK license](https://github.com/tldraw/tldraw/blob/main/LICENSE.md).
|
package/dist-cjs/index.d.ts
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';
|
|
@@ -2456,7 +2457,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2456
2457
|
* @param opts - The camera move options.
|
|
2457
2458
|
* @public
|
|
2458
2459
|
*/
|
|
2459
|
-
zoomToUser(userId:
|
|
2460
|
+
zoomToUser(userId: TLUserId, opts?: TLCameraMoveOptions): this;
|
|
2460
2461
|
/* Excluded from this release type: _willSetInitialBounds */
|
|
2461
2462
|
/**
|
|
2462
2463
|
* Update the viewport. The viewport will measure the size and screen position of its container
|
|
@@ -2609,7 +2610,7 @@ export declare class Editor extends EventEmitter<TLEventMap> {
|
|
|
2609
2610
|
*
|
|
2610
2611
|
* @public
|
|
2611
2612
|
*/
|
|
2612
|
-
startFollowingUser(userId:
|
|
2613
|
+
startFollowingUser(userId: TLUserId): this;
|
|
2613
2614
|
/**
|
|
2614
2615
|
* Stop viewport-following a user.
|
|
2615
2616
|
*
|
|
@@ -9617,13 +9618,13 @@ export declare function usePassThroughWheelEvents(ref: RefObject<HTMLElement | n
|
|
|
9617
9618
|
* @returns The list of peer UserIDs
|
|
9618
9619
|
* @public
|
|
9619
9620
|
*/
|
|
9620
|
-
export declare function usePeerIds():
|
|
9621
|
+
export declare function usePeerIds(): TLUserId[];
|
|
9621
9622
|
|
|
9622
9623
|
/**
|
|
9623
9624
|
* @returns The latest presence of the user matching userId
|
|
9624
9625
|
* @public
|
|
9625
9626
|
*/
|
|
9626
|
-
export declare function usePresence(userId:
|
|
9627
|
+
export declare function usePresence(userId: TLUserId): null | TLInstancePresence;
|
|
9627
9628
|
|
|
9628
9629
|
/* Excluded from this release type: USER_COLORS */
|
|
9629
9630
|
|
|
@@ -9663,7 +9664,25 @@ export declare class UserPreferencesManager {
|
|
|
9663
9664
|
getEdgeScrollSpeed(): number;
|
|
9664
9665
|
getAnimationSpeed(): number;
|
|
9665
9666
|
getAreKeyboardShortcutsEnabled(): boolean;
|
|
9667
|
+
/**
|
|
9668
|
+
* The current user's raw, app-provided id — the value set in the user's
|
|
9669
|
+
* {@link @tldraw/editor#TLUserPreferences}. Use this when you need the id your application
|
|
9670
|
+
* assigned to the user. To compare against or look up store records, use
|
|
9671
|
+
* {@link UserPreferencesManager.getRecordId} instead.
|
|
9672
|
+
*/
|
|
9673
|
+
getExternalId(): string;
|
|
9674
|
+
/**
|
|
9675
|
+
* @deprecated Use {@link UserPreferencesManager.getExternalId} for the raw app-provided id, or
|
|
9676
|
+
* {@link UserPreferencesManager.getRecordId} for the prefixed `TLUserId` record id.
|
|
9677
|
+
*/
|
|
9666
9678
|
getId(): string;
|
|
9679
|
+
/**
|
|
9680
|
+
* The current user's id as a tldraw {@link @tldraw/tlschema#TLUserId} record id (prefixed
|
|
9681
|
+
* with `user:`). Use this when comparing against or looking up store records, such as a
|
|
9682
|
+
* presence record's `userId` or `followingUserId`. For the raw, app-provided id, use
|
|
9683
|
+
* {@link UserPreferencesManager.getExternalId}.
|
|
9684
|
+
*/
|
|
9685
|
+
getRecordId(): TLUserId;
|
|
9667
9686
|
getName(): string;
|
|
9668
9687
|
getLocale(): string;
|
|
9669
9688
|
getColor(): string;
|
package/dist-cjs/index.js
CHANGED
|
@@ -379,7 +379,7 @@ var import_uniq = require("./lib/utils/uniq");
|
|
|
379
379
|
var import_defaultThemes2 = require("./lib/editor/managers/ThemeManager/defaultThemes");
|
|
380
380
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
381
381
|
"@tldraw/editor",
|
|
382
|
-
"5.2.0-canary.
|
|
382
|
+
"5.2.0-canary.0878dbd31f0d",
|
|
383
383
|
"cjs"
|
|
384
384
|
);
|
|
385
385
|
//# sourceMappingURL=index.js.map
|
|
@@ -2152,7 +2152,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
2152
2152
|
return baseCamera;
|
|
2153
2153
|
}
|
|
2154
2154
|
_getFollowingPresence(targetUserId) {
|
|
2155
|
-
const visited = [this.user.
|
|
2155
|
+
const visited = [this.user.getRecordId()];
|
|
2156
2156
|
const collaborators = this.getCollaborators();
|
|
2157
2157
|
let leaderPresence = null;
|
|
2158
2158
|
while (targetUserId && !visited.includes(targetUserId)) {
|
|
@@ -3200,7 +3200,7 @@ class Editor extends import_eventemitter3.default {
|
|
|
3200
3200
|
*/
|
|
3201
3201
|
startFollowingUser(userId) {
|
|
3202
3202
|
this.stopFollowingUser();
|
|
3203
|
-
const thisUserId = this.user.
|
|
3203
|
+
const thisUserId = this.user.getExternalId();
|
|
3204
3204
|
if (!thisUserId) {
|
|
3205
3205
|
console.warn("You should set the userId for the current instance before following a user");
|
|
3206
3206
|
}
|
|
@@ -8137,7 +8137,10 @@ class Editor extends import_eventemitter3.default {
|
|
|
8137
8137
|
inputs.buttons.add(info.button);
|
|
8138
8138
|
inputs.setIsPointing(true);
|
|
8139
8139
|
inputs.setIsDragging(false);
|
|
8140
|
-
if (!isPenMode && isPen)
|
|
8140
|
+
if (!isPenMode && isPen) {
|
|
8141
|
+
this.updateInstanceState({ isPenMode: true });
|
|
8142
|
+
this.interrupt();
|
|
8143
|
+
}
|
|
8141
8144
|
if (info.button === import_constants.STYLUS_ERASER_BUTTON) {
|
|
8142
8145
|
this._restoreToolId = this.getCurrentToolId();
|
|
8143
8146
|
this.complete();
|
|
@@ -8240,7 +8243,10 @@ class Editor extends import_eventemitter3.default {
|
|
|
8240
8243
|
this.setCursor({ type: this._prevCursor, rotation: 0 });
|
|
8241
8244
|
}
|
|
8242
8245
|
if (slideSpeed > 0) {
|
|
8243
|
-
this.slideCamera({
|
|
8246
|
+
this.slideCamera({
|
|
8247
|
+
speed: slideSpeed,
|
|
8248
|
+
direction: { x: slideDirection.x, y: slideDirection.y, z: 0 }
|
|
8249
|
+
});
|
|
8244
8250
|
}
|
|
8245
8251
|
this._selectedShapeIdsAtPointerDown = [];
|
|
8246
8252
|
this._didCaptureSelectionAtPointerDown = false;
|