tldraw/scripts
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
..
lib Use unpkg as a default for serving assets. (#1548) 2023-06-07 21:01:38 +00:00
api-check.ts replace console.log with nicelog (#1496) 2023-06-01 18:01:49 +00:00
build-api.ts [chore] update lazyrepo (#1211) 2023-05-02 12:25:26 +00:00
build-package.ts [chore] update lazyrepo (#1211) 2023-05-02 12:25:26 +00:00
CHANGELOG.md transfer-out: transfer out 2023-04-25 12:01:25 +01:00
check-scripts.ts Revert 09c36781 & tweak linting (#1501) 2023-06-02 10:45:51 +00:00
clean.sh [chore] use explicit yarn in clean script (#1216) 2023-05-02 13:33:30 +00:00
lint.ts Revert 09c36781 & tweak linting (#1501) 2023-06-02 10:45:51 +00:00
package.json Styles API (#1580) 2023-06-16 10:33:47 +00:00
postpack.sh transfer-out: transfer out 2023-04-25 12:01:25 +01:00
prepack.ts avoid lazy race conditions (#1364) 2023-05-12 15:41:40 +00:00
publish-canary.ts [infra] use npx to run auto (#1521) 2023-06-05 14:46:59 +00:00
publish-manual.ts Fix publishing (#1338) 2023-05-09 13:25:56 +00:00
publish-new.ts replace console.log with nicelog (#1496) 2023-06-01 18:01:49 +00:00
refresh-assets.ts Asset improvements (#1557) 2023-06-09 11:43:01 +00:00
tsconfig.json transfer-out: transfer out 2023-04-25 12:01:25 +01:00
typecheck.ts replace console.log with nicelog (#1496) 2023-06-01 18:01:49 +00:00