No description
Find a file
Steve Ruiz 3e31ef2a7d
Remove helpers / extraneous API methods. (#1745)
This PR removes several extraneous computed values from the editor. It
adds some silly instance state onto the instance state record and
unifies a few methods which were inconsistent. This is fit and finish
work 🧽

## Computed Values

In general, where once we had a getter and setter for `isBlahMode`,
which really masked either an `_isBlahMode` atom on the editor or
`instanceState.isBlahMode`, these are merged into `instanceState`; they
can be accessed / updated via `editor.instanceState` /
`editor.updateInstanceState`.

## tldraw select tool specific things

This PR also removes some tldraw specific state checks and creates new
component overrides to allow us to include them in tldraw/tldraw.

### Change Type

- [x] `major` — Breaking change

### Test Plan

- [x] Unit Tests
- [x] End to end tests

### Release Notes

- [tldraw] rename `useReadonly` to `useReadOnly`
- [editor] remove `Editor.isDarkMode`
- [editor] remove `Editor.isChangingStyle`
- [editor] remove `Editor.isCoarsePointer`
- [editor] remove `Editor.isDarkMode`
- [editor] remove `Editor.isFocused`
- [editor] remove `Editor.isGridMode`
- [editor] remove `Editor.isPenMode`
- [editor] remove `Editor.isReadOnly`
- [editor] remove `Editor.isSnapMode`
- [editor] remove `Editor.isToolLocked`
- [editor] remove `Editor.locale`
- [editor] rename `Editor.pageState` to `Editor.currentPageState`
- [editor] add `Editor.pageStates`
- [editor] add `Editor.setErasingIds`
- [editor] add `Editor.setEditingId`
- [editor] add several new component overrides
2023-07-18 21:50:23 +00:00
.github Add cloud shape (#1708) 2023-07-07 15:32:08 +00: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 Remove helpers / extraneous API methods. (#1745) 2023-07-18 21:50:23 +00:00
assets [fix] add cloud tooltip (#1728) 2023-07-11 10:01:53 +00:00
config Revert "Update dependencies (#1613)" (#1617) 2023-06-19 09:49:44 +00:00
docs add shapes docs content (#1705) 2023-07-17 22:06:20 +00:00
packages Remove helpers / extraneous API methods. (#1745) 2023-07-18 21:50:23 +00:00
scripts (chore) bump (#1744) 2023-07-18 10:19:28 +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 tldraw zero - package shuffle (#1710) 2023-07-17 21:22:34 +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-07-04 14:21:37 +00: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 (2/2) Add content to Tools docs page. (#1721) 2023-07-10 08:43:58 +00:00
LICENSE transfer-out: transfer out 2023-04-25 12:01:25 +01:00
package.json (chore) bump (#1744) 2023-07-18 10:19:28 +00:00
public-yarn.lock (chore) bump (#1744) 2023-07-18 10:19:28 +00:00
README.md tldraw zero - package shuffle (#1710) 2023-07-17 21:22:34 +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 the examples sandbox.

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

export default function () {
	return (
		<div style={{ position: 'fixed', inset: 0 }}>
			<Tldraw />
		</div>
	)
}

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 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
  • /docs contains the content for our docs site at tldraw.dev

Applications

Packages

  • assets: a library for working with tldraw's fonts and translations
  • editor: the tldraw editor
  • state: a signals library, also known as signia
  • store: an in-memory reactive database
  • tldraw: the main tldraw package containing both the editor and the UI
  • tlschema: shape definitions and migrations
  • utils: low-level data utilities shared by other libraries
  • validate: a validation library used for run-time validation

Community

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

Distributions

You can find tldraw on npm here.

At the moment the tldraw package is in alpha. We also ship a canary version which is always up to date with the main branch of this repo.

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.