tldraw/apps/docs
Steve Ruiz 57bb341593
ShapeUtil refactor, Editor cleanup (#1611)
This PR improves the ergonomics of `ShapeUtil` classes.

### Cached methods

First, I've remove the cached methods (such as `bounds`) from the
`ShapeUtil` class and lifted this to the `Editor` class.

Previously, calling `ShapeUtil.getBounds` would return the un-cached
bounds of a shape, while calling `ShapeUtil.bounds` would return the
cached bounds of a shape. We also had `Editor.getBounds`, which would
call `ShapeUtil.bounds`. It was confusing. The cached methods like
`outline` were also marked with "please don't override", which suggested
the architecture was just wrong.

The only weirdness from this is that utils sometimes reach out to the
editor for cached versions of data rather than calling their own cached
methods. It's still an easier story to tell than what we had before.

### More defaults

We now have three and only three `abstract` methods for a `ShapeUtil`:
- `getDefaultProps` (renamed from `defaultProps`)
- `getBounds`,
- `component`
-  `indicator`

Previously, we also had `getCenter` as an abstract method, though this
was usually just the middle of the bounds anyway.

### Editing bounds

This PR removes the concept of editingBounds. The viewport will no
longer animate to editing shapes.

### Active area manager

This PR also removes the active area manager, which was not being used
in the way we expected it to be.

### Dpr manager

This PR removes the dpr manager and uses a hook instead to update it
from React. This is one less runtime browser dependency in the app, one
less thing to document.

### Moving things around

This PR also continues to try to organize related methods and properties
in the editor.

### Change Type

- [x] `major` — Breaking change

### Release Notes

- [editor] renames `defaultProps` to `getDefaultProps`
- [editor] removes `outline`, `outlineSegments`, `handles`, `bounds`
- [editor] renames `renderBackground` to `backgroundComponent`
2023-06-19 14:01:18 +00:00
..
components Add anchor targets to our headings. (#1571) 2023-06-12 17:09:17 +00:00
content ShapeUtil refactor, Editor cleanup (#1611) 2023-06-19 14:01:18 +00:00
pages Add contributor license agreement. (#1556) 2023-06-08 12:45:44 +00:00
public [docs] editor API (#1328) 2023-05-07 19:10:59 +01:00
scripts Auto content refresh for docs site (#1606) 2023-06-17 09:46:46 +00:00
styles tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
types Auto content refresh for docs site (#1606) 2023-06-17 09:46:46 +00:00
utils transfer-out: transfer out 2023-04-25 12:01:25 +01:00
.eslintrc.json transfer-out: transfer out 2023-04-25 12:01:25 +01:00
.gitignore Auto content refresh for docs site (#1606) 2023-06-17 09:46:46 +00:00
CHANGELOG.md transfer-out: transfer out 2023-04-25 12:01:25 +01:00
content.d.ts transfer-out: transfer out 2023-04-25 12:01:25 +01:00
LICENSE readmes 2023-05-04 13:47:56 +01:00
next.config.js transfer-out: transfer out 2023-04-25 12:01:25 +01:00
package.json Revert "Update dependencies (#1613)" (#1617) 2023-06-19 09:49:44 +00:00
README.md transfer-out: transfer out 2023-04-25 12:01:25 +01:00
tsconfig.content.json transfer-out: transfer out 2023-04-25 12:01:25 +01:00
tsconfig.json transfer-out: transfer out 2023-04-25 12:01:25 +01:00

tldraw-docs

tldraw