[refactor] Remove TLShapeDef, getShapeUtilByType. (#1432)

This PR removes `TLShapeDef` and associated helpers / references.

It purposely loosens the configuration and typings to better support
customization.

### Change Type

- [x] `major` — Breaking Change

### Test Plan

1. Use the app!

### Release Notes

- [tlschema] Update props of `createTLSchema`
- [editor] Update props of `TldrawEditorConfig`
- [editor] Remove `App.getShapeUtilByType`
- [editor] Update `App.getShapeUtil` to take a type rather than a shape

---------

Co-authored-by: alex <alex@dytry.ch>
This commit is contained in:
Steve Ruiz 2023-05-23 13:32:42 +01:00 committed by GitHub
parent 3ce18c0c31
commit 649125cdad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 527 additions and 690 deletions

View file

@ -1,4 +1,4 @@
import { App, TLArrowShapeDef, useApp } from '@tldraw/editor'
import { App, TLArrowUtil, useApp } from '@tldraw/editor'
import { assert, exhaustiveSwitchError } from '@tldraw/utils'
import { useValue } from 'signia-react'
import { ActionItem } from './useActions'
@ -136,10 +136,10 @@ function shapesWithUnboundArrows(app: App) {
return selectedShapes.filter((shape) => {
if (!shape) return false
if (TLArrowShapeDef.is(shape) && shape.props.start.type === 'binding') {
if (app.isShapeOfType(shape, TLArrowUtil) && shape.props.start.type === 'binding') {
return false
}
if (TLArrowShapeDef.is(shape) && shape.props.end.type === 'binding') {
if (app.isShapeOfType(shape, TLArrowUtil) && shape.props.end.type === 'binding') {
return false
}
return true