Tldraw/packages/tlschema/src/misc
alex 87e3d60c90
rework canBind callback (#3797)
This PR reworks the `canBind` callback to work with customizable
bindings. It now accepts an object with a the shape, the other shape
(optional - it may not exist yet), the direction, and the type of the
binding. Devs can use this to create shapes that only participate in
certain binding types, can have bindings from but not to them, etc.

If you're implementing a binding, you can see if binding two shapes is
allowed using `editor.canBindShapes(fromShape, toShape, 'my binding
type')`

### Change Type

- [x] `sdk` — Changes the tldraw SDK
- [x] `improvement` — Improving existing features

### Release Notes

#### Breaking changes
The `canBind` flag now accepts an options object instead of just the
shape in question. If you're relying on its arguments, you need to
change from `canBind(shape) {}` to `canBind({shape}) {}`.
2024-05-23 13:32:02 +00:00
..
TLColor.ts mini `defineShape` API (#1563) 2023-06-12 14:04:14 +00:00
TLCursor.ts Expose migrations, validators, and versions from tlschema (#3613) 2024-04-25 14:31:26 +00:00
TLHandle.ts rework canBind callback (#3797) 2024-05-23 13:32:02 +00:00
TLOpacity.ts Expose migrations, validators, and versions from tlschema (#3613) 2024-04-25 14:31:26 +00:00
TLScribble.ts Force `interface` instead of `type` for better docs (#3815) 2024-05-22 15:55:49 +00:00
geometry-types.ts [tech debt] Primitives renaming party / cleanup (#2396) 2024-01-03 12:13:15 +00:00
id-validator.ts Expose migrations, validators, and versions from tlschema (#3613) 2024-04-25 14:31:26 +00:00