tldraw/apps/examples/src
Steve Ruiz 910be6073f
[refactor] reduce dependencies on shape utils in editor (#1693)
We'd like to make the @tldraw/editor layer more independent of specific
shapes. Unfortunately there are many places where shape types and
certain shape behavior is deeply embedded in the Editor. This PR begins
to refactor out dependencies between the editor library and shape utils.

It does this in two ways:
- removing shape utils from the arguments of `isShapeOfType`, replacing
with a generic
- removing shape utils from the arguments of `getShapeUtil`, replacing
with a generic
- moving custom arrow info cache out of the util and into the editor
class
- changing the a tool's `shapeType` to be a string instead of a shape
util

We're here trading type safety based on inferred types—"hey editor, give
me your instance of this shape util class"—for knowledge at the point of
call—"hey editor, give me a shape util class of this type; and trust me
it'll be an instance this shape util class". Likewise for shapes.

### A note on style 

We haven't really established our conventions or style when it comes to
types, but I'm increasingly of the opinion that we should defer to the
point of call to narrow a type based on generics (keeping the types in
typescript land) rather than using arguments, which blur into JavaScript
land.

### Change Type

- [x] `major` — Breaking change

### Test Plan

- [x] Unit Tests

### Release Notes

- removes shape utils from the arguments of `isShapeOfType`, replacing
with a generic
- removes shape utils from the arguments of `getShapeUtil`, replacing
with a generic
- moves custom arrow info cache out of the util and into the editor
class
- changes the a tool's `shapeType` to be a string instead of a shape
util
2023-07-07 13:56:31 +00:00
..
1-basic tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
2-api tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
3-custom-config [refactor] reduce dependencies on shape utils in editor (#1693) 2023-07-07 13:56:31 +00:00
4-custom-ui Incorporate signia as @tldraw/state (#1620) 2023-06-20 13:31:26 +00:00
5-exploded tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
6-scroll [internal] Add basic list to examples (#1688) 2023-07-05 14:07:28 +00:00
7-multiple [docs] Update multiple test (#1685) 2023-06-30 13:30:06 +00:00
8-error-boundary [fix] react component runaways, error boundaries (#1625) 2023-06-20 14:06:28 +00:00
9-hide-ui tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
10-custom-components tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
11-user-presence tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
12-ui-events tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
13-store-events tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
14-persistence tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
15-custom-zones Styles API follow-ups (#1636) 2023-06-24 13:46:04 +00:00
16-custom-styles [refactor] reduce dependencies on shape utils in editor (#1693) 2023-07-07 13:56:31 +00:00
17-shape-meta [feature] add meta property to records (#1627) 2023-06-28 14:24:05 +00:00
components [internal] Add basic list to examples (#1688) 2023-07-05 14:07:28 +00:00
end-to-end tldraw.css (#1607) 2023-06-17 22:33:21 +00:00
icons New vite-based examples app (#1226) 2023-05-05 13:10:36 +00:00
yjs Incorporate signia as @tldraw/state (#1620) 2023-06-20 13:31:26 +00:00
ExamplesTldrawLogo.tsx [internal] Add basic list to examples (#1688) 2023-07-05 14:07:28 +00:00
index.html New vite-based examples app (#1226) 2023-05-05 13:10:36 +00:00
index.tsx [internal] Add basic list to examples (#1688) 2023-07-05 14:07:28 +00:00
styles.css [internal] Add basic list to examples (#1688) 2023-07-05 14:07:28 +00:00