f864d0cfbd
This PR adds a timeout to collaborator cursors. It's part 1 of two PRs. The second one is smaller: https://github.com/tldraw/brivate/pull/2053 # What is this? After three seconds of inactivity, collaborator cursors disappear. ![2023-06-08 at 10 42 43 - Moccasin Flamingo](https://github.com/tldraw/tldraw/assets/15892272/93e463aa-0329-4ecb-ada1-4c38b36a655b) If you're following someone, you can always see their cursor. ![2023-06-08 at 10 45 42 - Olive Crayfish](https://github.com/tldraw/tldraw/assets/15892272/11e8d85a-18a8-4976-85c5-d14f3841c296) # Is there anything else? The PR also adds support for the brivate PR: https://github.com/tldraw/brivate/pull/2053 # Admin ### Change Type - [x] `minor` — New Feature ### Test Plan You probably need to test this locally, as we don't do multiplayer previews on this repo yet. 1. Open the same shared project in two browser sessions. 2. Move around the cursor in one session, while able to see it from the other. 3. Stop moving the cursor. 4. Make sure that the cursor disappears on the other session after 3 seconds. 5. Move the cursor again, and make sure it reappears it. 6. Make sure that viewport-following the user makes the cursor show permanently. ### Release Notes - Brought back cursor timeouts. Collaborator cursors now disappear after 3 seconds of inactivity. --------- Co-authored-by: Steve Ruiz <steveruizok@gmail.com> |
||
---|---|---|
.. | ||
src | ||
api-extractor.json | ||
api-report.md | ||
CHANGELOG.md | ||
LICENSE | ||
package.json | ||
README.md | ||
tsconfig.json |
@tldraw/tlschema
This package houses type definitions, schema migrations, and other type metadata for the tldraw editor's default persisted data.
There are three main kinds of types:
-
Record types
These are root record types added to the
Store
class. They are defined in the./src/records
directory. -
Shape types
These are subtypes of the root TLShape record type. They allow specifying a unique name and custom props for a particular kind of shape.
-
Asset types
These are subtypes of the root TLAsset record type. They allow specifying a unique name and custom props for a particular kind of asset.
Adding migrations
If you make any kind of change to any persisted data shape in this package, you must add migrations that are able to convert old versions to new versions, and vice-versa.
If you are making a change that affects the structure of a record, shape, or asset, update the migrations in the same file as the record, shape, or asset is defined.
If you are making a change that affects the structure of the store (e.g. renaming or deleting a type, consolidating two shape types into one, etc), add your changes in the migrations in schema.ts
.
After making your changes, add a new version number, using a meaninful name. For example, if you add a new property
to the TLShape
type called ownerId
that points to a user, you might do this:
In TLShape.ts
const Versions = {
RemoveSomeProp: 1,
+ AddOwnerId: 2,
} as const
and then in the TLShape
type
x: number
y: number
+ ownerId: ID<TLUser> | null
props: Props
parentId: ID<TLShape> | ID<TLPage>
and then adding a migration:
export const shapeTypeMigrations = defineMigrations({
currentVersion: Versions.Initial,
firstVersion: Versions.Initial,
migrators: {
+ [Versions.AddOwnerId]: {
+ // add ownerId property
+ up: (shape) => ({...shape, ownerId: null}),
+ // remove ownerId property
+ down: ({ownerId, ...shape}) => shape,
+ }
},
After you've added your migration, make sure to add a test for it in src/migrations.test.ts
. It will complain if you do not!
License
The source code in this repository (as well as our 2.0+ distributions and releases) are currently licensed under Apache-2.0. These licenses are subject to change in our upcoming 2.0 release. If you are planning to use tldraw in a commercial product, please reach out at hello@tldraw.com.