No description
Find a file
Steve Ruiz eb6aa9bbe4
[improvement] More nuanced cursor state (#1682)
This PR adds some more nuance to collaborator cursors.

Rather than being timed out or not timed out, a collaborator can now be
`active`, `idle` or `inactive`.

We calculate this based on the difference between the time that has
elapsed since the user's last activity timestamp.

After 3 seconds of inactivity, they go `idle`.
After sixty seconds of inactivity, they are `inactive`.
After any activity, they become `active` again.

When a user is `active`, we always show their cursor.
When a user is `idle`, we hide their cursor if they're following us,
unless they're highlighted
When a user is `inactive`, we hide their cursor unless they're
highlighted.

### Change Type

- [x] `minor`

### Test Plan

1. Find a friend and experiment with inactive times
2. Join a room that includes an inactive cursors; they should be hidden
on load
3. Have people follow you; do their timeouts feel natural?

### Release Notes

- Improve cursor timeouts and hiding logic.
2023-06-30 12:46:07 +00:00
.github Update publish-new.yml 2023-06-28 11:33:42 +01:00
.husky Fix VS Code commits failing on bublic? (#1680) 2023-06-30 12:25:16 +00:00
.yarn Styles API (#1580) 2023-06-16 10:33:47 +00:00
apps [fix] Lock shortcut (#1677) 2023-06-29 21:43:28 +00:00
assets Lokalise: Translations update (#1618) 2023-06-19 19:01:41 +00:00
config Revert "Update dependencies (#1613)" (#1617) 2023-06-19 09:49:44 +00:00
docs [feature] add meta property to records (#1627) 2023-06-28 14:24:05 +00:00
packages [improvement] More nuanced cursor state (#1682) 2023-06-30 12:46:07 +00:00
scripts [fix] remove docs scripts (#1651) 2023-06-27 08:34:26 +00:00
.eslintignore untrack generated files (#1646) 2023-06-24 08:22:42 +00:00
.eslintplugin.js transfer-out: transfer out 2023-04-25 12:01:25 +01:00
.eslintrc.js replace console.log with nicelog (#1496) 2023-06-01 18:01:49 +00:00
.gitignore untrack generated files (#1646) 2023-06-24 08:22:42 +00:00
.ignore untrack generated files (#1646) 2023-06-24 08:22:42 +00:00
.prettierignore untrack generated files (#1646) 2023-06-24 08:22:42 +00:00
.prettierrc Revert "Update dependencies (#1613)" (#1617) 2023-06-19 09:49:44 +00:00
.yarnrc.yml lite: tweak lockfile name 2023-04-25 12:01:38 +01:00
CHANGELOG.md Update CHANGELOG.md [skip ci] 2023-06-28 11:53:57 +01:00
CODE_OF_CONDUCT.md transfer-out: transfer out 2023-04-25 12:01:25 +01:00
CONTRIBUTING.md Add contributor license agreement. (#1556) 2023-06-08 12:45:44 +00:00
lazy.config.ts untrack generated files (#1646) 2023-06-24 08:22:42 +00:00
lerna.json Update CHANGELOG.md [skip ci] 2023-06-28 11:53:57 +01:00
LICENSE transfer-out: transfer out 2023-04-25 12:01:25 +01:00
package.json untrack generated files (#1646) 2023-06-24 08:22:42 +00:00
public-yarn.lock [improvemnet] drop crc, Buffer dependency (#1673) 2023-06-29 14:14:43 +00:00
README.md docs: remove not accepting contributions notice (#1647) 2023-06-24 13:45:20 +00:00

tldraw

tldraw

Welcome to the public monorepo for tldraw.

What is tldraw?

tldraw is a collaborative digital whiteboard available at tldraw.com. Its editor, user interface, and other underlying libraries are open source and available in this repository. They are also distributed on npm. You can use tldraw to create a drop-in whiteboard for your product or as the foundation on which to build your own infinite canvas applications.

Learn more at tldraw.dev.

Note

This repo contains source code for the current version of tldraw. You can find the source for the original version here.

Installation & Usage

To learn more about using tldraw in your React application, follow our guide here or see this StackBlitz.

import { Tldraw } from '@tldraw/tldraw'
import '@tldraw/tldraw/editor.css'
import '@tldraw/tldraw/ui.css'

function TldrawExample() {
	return <Tldraw />
}

Local development

To run the local development server, first clone this repo.

Install dependencies:

yarn

Start the local development server:

yarn dev

Open the example project at localhost:5420.

Examples

Our development server contains several examples that demonstrates different ways that you can customize tldraw or use its APIs. Each example is found in the apps/examples/src folder.

  • eg: localhost:5420 for the basic example.
  • eg: localhost:5420/api for the API example.

To learn more about using tldraw, visit our docs.

About this repository

Top-level layout

This repository's contents is divided across four primary sections:

  • /apps contains the source for our applications
  • /packages contains the source for our public packages
  • /scripts contains scripts used for building and publishing
  • /assets contains icons and translations relied on by the app

Applications

Packages

  • editor: the tldraw editor
  • ui: the editor's user interface
  • tldraw: the main tldraw package containing both the editor and the UI
  • primitives: low-level primitives for working with vectors and geometry
  • tlschema: shape definitions and migrations
  • tlsync-client: a library for (locally) syncronizing editor instances
  • tlstore: an in-memory reactive database
  • tlvalidate: a validation library used for run-time validation
  • tlassets: a library for working with tldraw's fonts and translations
  • file-format: a library for working with tldraw's .tldr file format
  • utils: low-level data utilities shared by other libraries

Community

Have questions, comments or feedback? Join our discord or start a discussion.

Distributions

You can find tldraw on npm here.

License

The source code for various apps and packages 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.

Contribution

Please see our contributing guide. Found a bug? Please submit an issue.

Contact

Find us on Twitter at @tldraw or email hello@tldraw.com. You can also join our discord for quick help and support.