tldraw/packages/editor
alex b88a2370b3
Styles API (#1580)
Removes `propsForNextShape` and replaces it with the new styles API. 

Changes in here:
- New custom style example
- `setProp` is now `setStyle` and takes a `StyleProp` instead of a
string
- `Editor.props` and `Editor.opacity` are now `Editor.sharedStyles` and
`Editor.sharedOpacity`
- They return an object that flags mixed vs shared types instead of
using null to signal mixed types
- `Editor.styles` returns a `SharedStyleMap` - keyed on `StyleProp`
instead of `string`
- `StateNode.shapeType` is now the shape util rather than just a string.
This lets us pull the styles from the shape type directly.
- `color` is no longer a core part of the editor set on the shape
parent. Individual child shapes have to use color directly.
- `propsForNextShape` is now `stylesForNextShape`
- `InstanceRecordType` is created at runtime in the same way
`ShapeRecordType` is. This is so it can pull style validators out of
shape defs for `stylesForNextShape`
- Shape type are now defined by their props rather than having separate
validators & type defs

### Change Type

- [x] `major` — Breaking change

### Test Plan

1. Big time regression testing around styles!
2. Check UI works as intended for all shape/style/tool combos

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

### Release Notes

-

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2023-06-16 10:33:47 +00:00
..
src Styles API (#1580) 2023-06-16 10:33:47 +00:00
api-extractor.json transfer-out: transfer out 2023-04-25 12:01:25 +01:00
api-report.md Styles API (#1580) 2023-06-16 10:33:47 +00:00
CHANGELOG.md transfer-out: transfer out 2023-04-25 12:01:25 +01:00
editor.css (1/2) Cursor Chat - Presence (#1487) 2023-06-15 15:10:08 +00:00
LICENSE transfer-out: transfer out 2023-04-25 12:01:25 +01:00
package.json scale exported canvases when they reach the browsers max size (#1536) 2023-06-06 11:44:21 +00:00
README.md transfer-out: transfer out 2023-04-25 12:01:25 +01:00
setupTests.js derived presence state (#1204) 2023-04-27 18:03:19 +00:00
tsconfig.json Rename tlstore to store (#1507) 2023-06-03 08:59:04 +00:00

tldraw/tldraw

Benchmark

To run the benchmarks

yarn workspace @tldraw/tldraw benchmark

Or

yarn workspace @tldraw/tldraw benchmark "file_search_string"