@mocanvas/compat 1.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +421 -0
- package/BENCHMARK.md +519 -0
- package/CLEAN_ROOM.md +50 -0
- package/COMPAT.md +282 -0
- package/CUSTOM_SHAPES.md +880 -0
- package/LICENSE +110 -16
- package/MIGRATION.md +807 -0
- package/README.md +32 -7
- package/UI.md +256 -0
- package/dist/index.d.ts +72 -11
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +15 -17
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# @mocanvas/compat
|
|
2
2
|
|
|
3
|
-
`TL`-prefixed type and value aliases over the
|
|
4
|
-
[mocanvas](https://github.com/SYMBIO/mocanvas) API, for projects moving an
|
|
3
|
+
`TL`-prefixed type and value aliases over the mocanvas API, for projects moving an
|
|
5
4
|
existing tldraw app over. Every alias is a pure re-export — there is no runtime
|
|
6
5
|
code of its own — so you can switch imports first and rename at your own pace.
|
|
7
6
|
|
|
@@ -21,13 +20,39 @@ import { Tldraw } from "@mocanvas/compat" // alias of <Mocanvas />
|
|
|
21
20
|
The package also re-exports everything from `@mocanvas/mocanvas`, so a single import
|
|
22
21
|
source works during a migration.
|
|
23
22
|
|
|
24
|
-
What does and does not carry over is listed in
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
What does and does not carry over is listed in `COMPAT.md`; the step-by-step
|
|
24
|
+
move is in `MIGRATION.md`. Both are shipped inside this package.
|
|
25
|
+
|
|
26
|
+
## Clean room
|
|
27
|
+
|
|
28
|
+
mocanvas has never been built by reading tldraw's source. It is written from
|
|
29
|
+
first principles against the public API reference on tldraw.dev, and the
|
|
30
|
+
compatibility these aliases provide is measured against that same reference.
|
|
31
|
+
Names are not copyrightable expression (*Google v. Oracle*, 2021); the
|
|
32
|
+
implementation behind them is our own original work. `CLEAN_ROOM.md`, shipped
|
|
33
|
+
in this package, is the full policy.
|
|
34
|
+
|
|
35
|
+
mocanvas is not affiliated with or endorsed by tldraw.
|
|
28
36
|
|
|
29
37
|
ESM only.
|
|
30
38
|
|
|
31
39
|
## License
|
|
32
40
|
|
|
33
|
-
|
|
41
|
+
**Source-available, not open source.** Free to use for:
|
|
42
|
+
|
|
43
|
+
- personal, non-commercial projects;
|
|
44
|
+
- non-profit organisations;
|
|
45
|
+
- development, evaluation, testing and staging — including inside a for-profit
|
|
46
|
+
company, so you can try it and build against it before committing;
|
|
47
|
+
- teaching and academic research.
|
|
48
|
+
|
|
49
|
+
**Shipping it in a commercial product, service or website needs a written
|
|
50
|
+
agreement with us.** That includes anything sold, anything that earns revenue
|
|
51
|
+
directly or through advertising, and internal tools running a for-profit
|
|
52
|
+
business.
|
|
53
|
+
|
|
54
|
+
To arrange one, or if you are unsure which side of the line you are on, write to
|
|
55
|
+
**mocanvas@symbio.agency** — we would rather answer the question than have you
|
|
56
|
+
guess.
|
|
57
|
+
|
|
58
|
+
The full terms are in `LICENSE`, shipped in this package.
|
package/UI.md
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# The default UI
|
|
2
|
+
|
|
3
|
+
`<Mocanvas />` ships a small, opinionated interface: a toolbar, a zoom bar, a
|
|
4
|
+
style panel, an optional statistics chip, and the chrome the editor draws on the
|
|
5
|
+
canvas itself. All of it is optional and all of it is themeable from CSS.
|
|
6
|
+
|
|
7
|
+
Source lives in `packages/mocanvas/src/ui/`:
|
|
8
|
+
|
|
9
|
+
| File | What it holds |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `DefaultUi.tsx` | The toolbar, the zoom bar, the stats chip, and the `DefaultUi` wrapper |
|
|
12
|
+
| `StylePanel.tsx` | The style panel and `getStylePanelSections`, the rule for which rows appear |
|
|
13
|
+
| `icons.tsx` | The whole icon set, plus the geo icons generated from canvas geometry |
|
|
14
|
+
| `overlays.tsx` | The shared tooltip and popover layers, and `placeNear` |
|
|
15
|
+
| `ui.css` | Every design token and every rule |
|
|
16
|
+
| `useKeyboardShortcuts.ts` | The default key bindings |
|
|
17
|
+
|
|
18
|
+
## Design tokens
|
|
19
|
+
|
|
20
|
+
Tokens are declared on `.mocanvas` (the editor container), on `.mocanvas-panel`,
|
|
21
|
+
and on `.mocanvas-layer` (the floating tooltip and popover, which sit outside the
|
|
22
|
+
panels in the DOM). Override any of them on `.mocanvas`, on a wrapper, or on a
|
|
23
|
+
single panel.
|
|
24
|
+
|
|
25
|
+
### Surfaces and colour
|
|
26
|
+
|
|
27
|
+
| Token | Light | Dark | Used for |
|
|
28
|
+
| --- | --- | --- | --- |
|
|
29
|
+
| `--mocanvas-ui-panel` | `#ffffff` | `#1b1d22` | Panel, popover and picker background |
|
|
30
|
+
| `--mocanvas-ui-panel-border` | `#d6d9e0` | `#3c404a` | Panel hairline, dividers, group separators |
|
|
31
|
+
| `--mocanvas-ui-control` | `rgba(16,24,40,.06)` | `rgba(255,255,255,.08)` | Recessed background of a segmented button |
|
|
32
|
+
| `--mocanvas-ui-text` | `#16181d` | `#eceef3` | Icon and label colour |
|
|
33
|
+
| `--mocanvas-ui-muted` | `#5c6070` | `#a4a9b4` | Row labels, stats text |
|
|
34
|
+
| `--mocanvas-ui-accent` | `#2563eb` | `#6ea8fe` | Selected control, focus ring |
|
|
35
|
+
| `--mocanvas-ui-accent-fg` | `#ffffff` | `#0e1116` | Icon on an accent fill |
|
|
36
|
+
| `--mocanvas-ui-accent-soft` | 12% accent | 18% accent | Hover on a segmented button, open disclosure |
|
|
37
|
+
| `--mocanvas-ui-hover` | 6% ink | 9% white | Hover on a bare button |
|
|
38
|
+
| `--mocanvas-ui-active` | 13% ink | 18% white | Pointer-down on a bare button |
|
|
39
|
+
| `--mocanvas-ui-shadow` | — | — | Panel elevation |
|
|
40
|
+
| `--mocanvas-ui-tip-bg` / `-fg` / `-muted` | — | — | Tooltip pill, its label, its shortcut |
|
|
41
|
+
|
|
42
|
+
Every text-on-background pair is at or above 4.5:1 in both palettes. Measured on
|
|
43
|
+
the shipped values, the tightest are `accent` on a segmented control (4.58 light,
|
|
44
|
+
5.54 dark) and `muted` on the panel (6.25 light, 7.16 dark). Disabled controls
|
|
45
|
+
render at 35% opacity, which WCAG exempts.
|
|
46
|
+
|
|
47
|
+
### Metrics
|
|
48
|
+
|
|
49
|
+
| Token | Value | Meaning |
|
|
50
|
+
| --- | --- | --- |
|
|
51
|
+
| `--mocanvas-ui-btn` | `40px` | Every hit target — buttons, swatches, popover cells |
|
|
52
|
+
| `--mocanvas-ui-icon` | `20px` | Icon size inside a button |
|
|
53
|
+
| `--mocanvas-ui-gap` | `2px` | Gap between adjacent controls |
|
|
54
|
+
| `--mocanvas-ui-pad` | `4px` | Padding of a bar |
|
|
55
|
+
| `--mocanvas-ui-pad-lg` | `10px` | Padding of the style panel, gap between its groups |
|
|
56
|
+
| `--mocanvas-ui-inset` | `12px` | Distance from a panel to the viewport edge |
|
|
57
|
+
| `--mocanvas-ui-radius` / `-sm` | `12px` / `8px` | Panel radius / control radius |
|
|
58
|
+
| `--mocanvas-ui-dock` | `300px` | Width the bottom-left and bottom-right docks reserve beside the centred toolbar |
|
|
59
|
+
| `--mocanvas-ui-bottom-dock` | `62px` (`124px` under 1290px) | Height the bottom edge occupies; the style panel stops above it |
|
|
60
|
+
| `--mocanvas-ui-font` / `-mono` | system stacks | Panel type / stats chip |
|
|
61
|
+
|
|
62
|
+
`--mocanvas-ui-dock` is the mechanism that keeps the three bottom panels apart:
|
|
63
|
+
the toolbar is centred on the viewport but may not grow into the reservation, so
|
|
64
|
+
it wraps rather than collide. Shrink it if your zoom bar is narrower than the
|
|
65
|
+
default one.
|
|
66
|
+
|
|
67
|
+
### Canvas chrome
|
|
68
|
+
|
|
69
|
+
These are read by the editor's indicator layer (`Canvas.tsx`), not by the panels,
|
|
70
|
+
so they apply even with `hideUi`. They are deliberately **not** redefined for the
|
|
71
|
+
dark UI: the canvas keeps its own background, which does not follow
|
|
72
|
+
`prefers-color-scheme`.
|
|
73
|
+
|
|
74
|
+
| Token | Value | Used for |
|
|
75
|
+
| --- | --- | --- |
|
|
76
|
+
| `--mocanvas-selection` | `#2f6fe4` | Selection and hover outlines, handle strokes, brush border |
|
|
77
|
+
| `--mocanvas-selection-fg` | `#ffffff` | Fill behind a solid handle |
|
|
78
|
+
| `--mocanvas-brush-fill` | 12% selection | Brush rectangle interior |
|
|
79
|
+
| `--mocanvas-snap` | `#cf3fe0` | Snap lines and their end markers |
|
|
80
|
+
|
|
81
|
+
The two stroke colours clear 3:1 against a light canvas (`#f9fafb`: 4.45 and
|
|
82
|
+
3.69) and against a dark one (`#1b1d22`: 3.63 and 4.37). If you render a dark
|
|
83
|
+
canvas, swap `--mocanvas-selection-fg` for a dark value so handles stay filled
|
|
84
|
+
with the canvas colour rather than white.
|
|
85
|
+
|
|
86
|
+
Handles are drawn at 9px (corners), 6px (shape handles) and 5.5px (rotate) in
|
|
87
|
+
screen space, with a 1.5px stroke. Their hit radius is a separate editor
|
|
88
|
+
constant, `HANDLE_HIT_RADIUS` in `packages/editor/src/editor/selectionHandles.ts`.
|
|
89
|
+
|
|
90
|
+
## Icon grid rules
|
|
91
|
+
|
|
92
|
+
Icons are original artwork on a 24×24 viewBox, painted with `currentColor`.
|
|
93
|
+
|
|
94
|
+
- **Grid.** 24×24. Ink, stroke included, stays inside it.
|
|
95
|
+
- **Weight.** Stroke 1.75, round caps and joins. Only texture marks deviate and
|
|
96
|
+
say so at the call site: the fill hatching (1.25), the dotted rule (2.6 with a
|
|
97
|
+
zero-length dash, so the caps draw the dots), the mono rails (1.4).
|
|
98
|
+
- **Centring.** Ink is optically centred on (12, 12), within half a grid unit.
|
|
99
|
+
The only exceptions are semantic: `valign-top` and `valign-bottom` sit high and
|
|
100
|
+
low on purpose.
|
|
101
|
+
- **Extent.** The longest ink dimension lands between 16 and 18.25 units — about
|
|
102
|
+
17.75 for a full-bleed form — so no icon reads heavier than its neighbour. The
|
|
103
|
+
`size-*` ramp is exempt: its whole job is to differ in size.
|
|
104
|
+
- **Distinctness.** No two icons may draw the same artwork; `icons.test.tsx`
|
|
105
|
+
enforces this. It is why the handwriting font is a script `a` rather than a
|
|
106
|
+
fourth capital A, and why `oval` gets a wider box than `ellipse`.
|
|
107
|
+
- **Geo icons** are generated from `getGeoGeometry`, the same code the canvas
|
|
108
|
+
draws with, so a toolbar button always matches the shape it creates. Each kind
|
|
109
|
+
is fitted into the box `getGeoIconBox(kind)` returns: square at `GEO_BOX` (16)
|
|
110
|
+
by default, and flatter or narrower for kinds whose name implies a proportion
|
|
111
|
+
(`rectangle`, `oval`, the four arrows). The longest side is always `GEO_BOX`.
|
|
112
|
+
|
|
113
|
+
Render one with `<Icon name="select" size={20} />`. `size` sets the SVG's
|
|
114
|
+
attributes; buttons additionally take their icon size from `--mocanvas-ui-icon`,
|
|
115
|
+
so inline marks like the "mixed" badge keep the size they ask for.
|
|
116
|
+
|
|
117
|
+
## Overriding the UI
|
|
118
|
+
|
|
119
|
+
### Turn it off
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
<Mocanvas hideUi />
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This drops the toolbar, zoom bar, style panel and stats chip. `ui.css` still
|
|
126
|
+
loads, so the canvas chrome tokens above keep working. Default keyboard
|
|
127
|
+
shortcuts are wired by `<Mocanvas />` itself and are unaffected; call
|
|
128
|
+
`useKeyboardShortcuts(editor)` yourself if you build on `<Canvas />` directly.
|
|
129
|
+
|
|
130
|
+
### Replace the canvas chrome
|
|
131
|
+
|
|
132
|
+
```tsx
|
|
133
|
+
<Mocanvas components={{ Indicators: MyIndicators, Brush: MyBrush, Background: MyGrid }} />
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`components` is forwarded to `<Canvas />`. `Indicators` draws selection and hover
|
|
137
|
+
outlines and handles, `Brush` the marquee, `Background` a layer behind the canvas.
|
|
138
|
+
Each receives `{ editor }` and renders into the SVG overlay (`Background` into a
|
|
139
|
+
plain DOM layer). Omit one to keep the default.
|
|
140
|
+
|
|
141
|
+
### Rebuild the panels
|
|
142
|
+
|
|
143
|
+
Compose your own from the exported parts:
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { Mocanvas, Toolbar, ZoomBar, StylePanel, UiTooltip, Icon } from "mocanvas"
|
|
147
|
+
|
|
148
|
+
<Mocanvas hideUi>
|
|
149
|
+
<Toolbar />
|
|
150
|
+
<MyOwnInspector />
|
|
151
|
+
<UiTooltip />
|
|
152
|
+
</Mocanvas>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`Toolbar`, `ZoomBar`, `StylePanel`, `DebugStats`, `Popover`, `UiTooltip`, `Icon`
|
|
156
|
+
and `TOOLBAR_GROUPS` are all exported. Children of `<Mocanvas>` render above the
|
|
157
|
+
canvas inside the editor container, so the tokens apply to them too.
|
|
158
|
+
|
|
159
|
+
### Restyle it
|
|
160
|
+
|
|
161
|
+
```css
|
|
162
|
+
.mocanvas {
|
|
163
|
+
--mocanvas-ui-accent: #12b886;
|
|
164
|
+
--mocanvas-ui-radius: 6px;
|
|
165
|
+
--mocanvas-ui-btn: 44px;
|
|
166
|
+
--mocanvas-selection: #12b886;
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## The panels
|
|
171
|
+
|
|
172
|
+
### Toolbar — bottom centre
|
|
173
|
+
|
|
174
|
+
Tools in four groups separated by dividers: select and hand; draw and eraser; the
|
|
175
|
+
five common geo kinds plus a disclosure for the other fifteen; text, note, and
|
|
176
|
+
whichever of arrow, line and frame the app registered. Entries whose tool is not
|
|
177
|
+
registered disappear, so a cut-down `tools` prop yields a cut-down bar. The
|
|
178
|
+
active tool is `aria-pressed`; a geo button is pressed only when its own kind is
|
|
179
|
+
active. The disclosure opens a 5-column popover of the remaining kinds and is
|
|
180
|
+
itself marked pressed when one of them is active. The bar is centred on the
|
|
181
|
+
viewport, wraps to more rows rather than growing into the docks, and moves to a
|
|
182
|
+
row of its own below 1290px.
|
|
183
|
+
|
|
184
|
+
### Zoom bar — bottom left
|
|
185
|
+
|
|
186
|
+
Zoom out, the current percentage (a button that resets to 100%), zoom in, zoom to
|
|
187
|
+
fit, then a divider and undo/redo. Undo and redo are `disabled` when there is
|
|
188
|
+
nothing to undo or redo, at 35% opacity and without a tooltip.
|
|
189
|
+
|
|
190
|
+
### Style panel — top right
|
|
191
|
+
|
|
192
|
+
Appears when the selection carries at least one style, or when a drawing tool is
|
|
193
|
+
active with nothing selected. Rows are grouped, and separated by a hairline:
|
|
194
|
+
|
|
195
|
+
1. **Shape** — the geo kind, as one button showing the current shape that opens a
|
|
196
|
+
20-cell popover.
|
|
197
|
+
2. **Colour** — the stroke colour, and the label colour when the selection can
|
|
198
|
+
carry one; twelve swatches each, six to a row.
|
|
199
|
+
3. **Stroke and fill** — Fill, Dash and Size, four choices each.
|
|
200
|
+
4. **Text** — Font, then horizontal and vertical alignment sharing one row.
|
|
201
|
+
5. **Opacity** — a slider; only with a selection, since it edits shapes rather
|
|
202
|
+
than a style.
|
|
203
|
+
|
|
204
|
+
Which rows appear is decided by `getStylePanelSections(editor)`, which reads
|
|
205
|
+
`editor.getSharedStyles()` for a selection and
|
|
206
|
+
`editor.getStylePropsForType(toolId)` otherwise. A selection of two lines
|
|
207
|
+
therefore shows Colour, Dash and Size and nothing else. A row whose selected
|
|
208
|
+
shapes disagree shows a dashed "mixed" badge beside its label. The panel scrolls
|
|
209
|
+
when it is taller than the space above the bottom dock, with a fade and a shadow
|
|
210
|
+
at whichever edge has more content behind it. Below 560px it spans the width and
|
|
211
|
+
is capped at 42% of the height.
|
|
212
|
+
|
|
213
|
+
### Statistics chip — bottom right
|
|
214
|
+
|
|
215
|
+
Shape counts, drawn versus culled, and milliseconds per frame. Toggled with
|
|
216
|
+
`⌥D`, or with the `showStats` prop. It moves above the zoom bar below 560px.
|
|
217
|
+
|
|
218
|
+
### Tooltip and popover
|
|
219
|
+
|
|
220
|
+
Both are single, `position: fixed`, viewport-clamped layers (`overlays.tsx`).
|
|
221
|
+
A tooltip labels any element with `data-tooltip`, adding `data-shortcut` in a
|
|
222
|
+
muted weight; it appears after a 500ms rest, immediately on keyboard focus, sits
|
|
223
|
+
above its control so it never covers it, and flips below when there is no room.
|
|
224
|
+
`placeNear` does the arithmetic and is unit-tested. Popovers dismiss on outside
|
|
225
|
+
pointer-down and on Escape, which also returns focus to the button.
|
|
226
|
+
|
|
227
|
+
## States
|
|
228
|
+
|
|
229
|
+
| State | Bare button | Segmented button | Swatch |
|
|
230
|
+
| --- | --- | --- | --- |
|
|
231
|
+
| Rest | transparent | `--mocanvas-ui-control` | transparent |
|
|
232
|
+
| Hover | `--mocanvas-ui-hover` | `--mocanvas-ui-accent-soft` | `--mocanvas-ui-hover` |
|
|
233
|
+
| Pointer down | `--mocanvas-ui-active`, scaled 0.94 | as hover, scaled 0.94 | scaled 0.92 |
|
|
234
|
+
| Selected | accent fill, accent-fg icon | accent fill, accent-fg icon | double ring in accent |
|
|
235
|
+
| Selected + hover | accent fill plus an inset ring | same | same |
|
|
236
|
+
| Focus (keyboard) | 2px accent outline, 2px offset | same | same |
|
|
237
|
+
| Disabled | 35% opacity, no tooltip, default cursor | — | — |
|
|
238
|
+
|
|
239
|
+
The focus ring is offset by 2px so a ring of panel colour separates it from an
|
|
240
|
+
accent-filled button; without that gap, focus would be invisible on the active
|
|
241
|
+
tool. `prefers-reduced-motion` removes every transition.
|
|
242
|
+
|
|
243
|
+
## Pointer targets
|
|
244
|
+
|
|
245
|
+
Selection handles use a 24x24 px pointer target (`HANDLE_HIT_RADIUS = 12` in
|
|
246
|
+
`packages/editor/src/editor/selectionHandles.ts`), which is the WCAG 2.2
|
|
247
|
+
minimum. Two rules keep that from swallowing small shapes:
|
|
248
|
+
|
|
249
|
+
- Edge handles (top, right, bottom, left) only appear once that edge is at
|
|
250
|
+
least `4 * HANDLE_HIT_RADIUS` long on screen; below that the two corners
|
|
251
|
+
already cover the whole edge.
|
|
252
|
+
- On a selection smaller than six handles across, `getHandleHitRadius` scales
|
|
253
|
+
the target down (never below 4 px) so the shape's interior stays draggable.
|
|
254
|
+
|
|
255
|
+
Both measure the *screen-space* edge lengths of the transformed corners, so a
|
|
256
|
+
rotated selection behaves the same as an upright one.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _mocanvas_editor from '@mocanvas/editor';
|
|
2
|
+
import { BindingUtilConstructor, ShapeUtilConstructor, ArrowBinding, ArrowBindingProps, ArrowBindings, ArrowShape, ArrowShapeProps, Asset, AssetContext, AssetId, AssetPartial, AssetStore, BaseAsset, BaseBinding, BaseEventInfo, BaseShape, Binding, UnknownBinding, BindingCreate, BindingId, BookmarkAsset, BookmarkShape, BookmarkShapeProps, Camera, CameraId, CancelEventInfo, ClickEventInfo, CompleteEventInfo, CurrentUser, DefaultColorStyle, DefaultDashStyle, DefaultFillStyle, DefaultFontStyle, DefaultHorizontalAlignStyle, DefaultSizeStyle, DefaultVerticalAlignStyle, Document, DrawShape, DrawShapeProps, Editor, EditorOptions, EmbedDefinition, EmbedShape, EmbedShapeProps, EventHandlers, EventInfo, ExternalContent, FrameShape, FrameShapeProps, GeoShape, GeoShapeKind, GeoShapeProps, GroupShape, ShapeHandle, InstanceId, ImageAsset, ImageShape, ImageShapeProps, Instance, InstancePageState, InstancePageStateId, InstancePresence, InstancePresenceId, InterruptEventInfo, KeyboardEventInfo, KeyboardEventName, LineShape, LineShapeProps, NoteShape, NoteShapeProps, Page, PageId, ParentId, PinchEventInfo, PointerEventInfo, PointerEventName, PropsMigration, PropsMigrations, EditorRecord, UnknownShape, ResizeInfo, ResizeShapeOptions, RichText, Scribble, SelectionHandle, Shape, ShapeCreate, ShapeId, ShapePartial, StateNodeConstructor, EditorStore, TLSchema, EditorStoreSnapshot, SvgExportOptions, TextShape, TextShapeProps, TickEventInfo, User, UserId, UserPreferencesState, UserStore, VideoAsset, VideoShape, VideoShapeProps, WheelEventInfo, Mocanvas, Canvas, EditorStoreProps, MocanvasProps, createSchema, createStore, useCurrentUser } from '@mocanvas/mocanvas';
|
|
2
3
|
export * from '@mocanvas/mocanvas';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Migration aliases. Projects moving from a `TL`-prefixed API can switch their
|
|
6
|
-
* imports to `@mocanvas/compat` first and rename at their own pace.
|
|
7
|
-
*
|
|
8
|
-
* Every alias here is a pure re-export; there is no runtime code.
|
|
9
|
-
*/
|
|
4
|
+
import { SerializedStore } from '@mocanvas/store';
|
|
10
5
|
|
|
11
6
|
type TLRecord = EditorRecord;
|
|
12
7
|
type TLStore = EditorStore;
|
|
13
8
|
type TLStoreSnapshot = EditorStoreSnapshot;
|
|
14
|
-
type TLShape = Shape
|
|
9
|
+
type TLShape<Type extends string = never> = [Type] extends [never] ? Shape : Shape<Type>;
|
|
15
10
|
type TLUnknownShape = UnknownShape;
|
|
16
11
|
type TLShapeId = ShapeId;
|
|
17
12
|
type TLParentId = ParentId;
|
|
@@ -24,7 +19,7 @@ type TLCamera = Camera;
|
|
|
24
19
|
type TLCameraId = CameraId;
|
|
25
20
|
type TLInstance = Instance;
|
|
26
21
|
type TLInstancePageState = InstancePageState;
|
|
27
|
-
type TLBinding =
|
|
22
|
+
type TLBinding<Type extends string = never> = [Type] extends [never] ? Binding : Binding<Type>;
|
|
28
23
|
type TLBindingId = BindingId;
|
|
29
24
|
type TLArrowBinding = ArrowBinding;
|
|
30
25
|
type TLGeoShape = GeoShape;
|
|
@@ -55,6 +50,7 @@ type TLShapeUtilConstructor<T extends UnknownShape = UnknownShape> = ShapeUtilCo
|
|
|
55
50
|
type TLStateNodeConstructor = StateNodeConstructor;
|
|
56
51
|
type TLBindingUtilConstructor = BindingUtilConstructor;
|
|
57
52
|
type TLAnyShapeUtilConstructor = ShapeUtilConstructor;
|
|
53
|
+
type TLAnyBindingUtilConstructor = BindingUtilConstructor;
|
|
58
54
|
/** The batteries-included component. */
|
|
59
55
|
declare const Tldraw: typeof Mocanvas;
|
|
60
56
|
/** The bare canvas (bring your own shapes, tools and UI). */
|
|
@@ -62,5 +58,70 @@ declare const TldrawEditor: typeof Canvas;
|
|
|
62
58
|
declare const createTLStore: typeof createStore;
|
|
63
59
|
declare const createTLSchema: typeof createSchema;
|
|
64
60
|
type TLEditor = Editor;
|
|
61
|
+
type TLBaseShape<Type extends string, Props extends object> = BaseShape<Type, Props>;
|
|
62
|
+
type TLBaseBinding<Type extends string, Props extends object> = BaseBinding<Type, Props>;
|
|
63
|
+
type TLAsset = Asset;
|
|
64
|
+
type TLAssetId = AssetId;
|
|
65
|
+
type TLAssetStore = AssetStore;
|
|
66
|
+
type TLUser = User;
|
|
67
|
+
type TLUserStore = UserStore;
|
|
68
|
+
type TLCurrentUser = CurrentUser;
|
|
69
|
+
type TLUserPreferences = UserPreferencesState;
|
|
70
|
+
type TLInstancePresence = InstancePresence;
|
|
71
|
+
type TLInstancePresenceID = InstancePresenceId;
|
|
72
|
+
/** The `Tldraw`-spelled identity hook. */
|
|
73
|
+
declare const useTldrawCurrentUser: typeof useCurrentUser;
|
|
74
|
+
type TLEmbedDefinition = EmbedDefinition;
|
|
75
|
+
type TLBaseEventInfo = BaseEventInfo;
|
|
76
|
+
type TLCancelEventInfo = CancelEventInfo;
|
|
77
|
+
type TLCompleteEventInfo = CompleteEventInfo;
|
|
78
|
+
type TLEventHandlers = EventHandlers;
|
|
79
|
+
type TLInterruptEventInfo = InterruptEventInfo;
|
|
80
|
+
type TLKeyboardEventName = KeyboardEventName;
|
|
81
|
+
type TLPinchEventInfo = PinchEventInfo;
|
|
82
|
+
type TLPointerEventName = PointerEventName;
|
|
83
|
+
type TLTickEventInfo = TickEventInfo;
|
|
84
|
+
type TLArrowShapeProps = ArrowShapeProps;
|
|
85
|
+
type TLBookmarkShapeProps = BookmarkShapeProps;
|
|
86
|
+
type TLDrawShapeProps = DrawShapeProps;
|
|
87
|
+
type TLEmbedShapeProps = EmbedShapeProps;
|
|
88
|
+
type TLFrameShapeProps = FrameShapeProps;
|
|
89
|
+
type TLGeoShapeProps = GeoShapeProps;
|
|
90
|
+
type TLImageShapeProps = ImageShapeProps;
|
|
91
|
+
type TLLineShapeProps = LineShapeProps;
|
|
92
|
+
type TLNoteShapeProps = NoteShapeProps;
|
|
93
|
+
type TLTextShapeProps = TextShapeProps;
|
|
94
|
+
type TLVideoShapeProps = VideoShapeProps;
|
|
95
|
+
type TLBookmarkShape = BookmarkShape;
|
|
96
|
+
type TLEmbedShape = EmbedShape;
|
|
97
|
+
type TLImageShape = ImageShape;
|
|
98
|
+
type TLVideoShape = VideoShape;
|
|
99
|
+
type TLAssetContext = AssetContext;
|
|
100
|
+
type TLAssetPartial<A extends Asset = Asset> = AssetPartial<A>;
|
|
101
|
+
type TLBaseAsset<Type extends string, Props extends object> = BaseAsset<Type, Props>;
|
|
102
|
+
type TLBookmarkAsset = BookmarkAsset;
|
|
103
|
+
type TLImageAsset = ImageAsset;
|
|
104
|
+
type TLVideoAsset = VideoAsset;
|
|
105
|
+
type TLBindingCreate<B extends UnknownBinding = UnknownBinding> = BindingCreate<B>;
|
|
106
|
+
declare const TLDOCUMENT_ID: _mocanvas_editor.DocumentId;
|
|
107
|
+
declare const TLINSTANCE_ID: InstanceId;
|
|
108
|
+
type TLInstanceId = InstanceId;
|
|
109
|
+
type TLInstancePageStateId = InstancePageStateId;
|
|
110
|
+
type TLPropsMigration = PropsMigration;
|
|
111
|
+
type TLPropsMigrations = PropsMigrations;
|
|
112
|
+
type TLRichText = RichText;
|
|
113
|
+
type TLScribble = Scribble;
|
|
114
|
+
type TLSerializedStore = SerializedStore<EditorRecord>;
|
|
115
|
+
type TLStoreSchema = TLSchema;
|
|
116
|
+
type TLUnknownBinding = UnknownBinding;
|
|
117
|
+
type TLUserId = UserId;
|
|
118
|
+
type TLArrowBindingProps = ArrowBindingProps;
|
|
119
|
+
type TLArrowBindings = ArrowBindings;
|
|
120
|
+
type TldrawEditorStoreProps = EditorStoreProps;
|
|
121
|
+
type TldrawProps = MocanvasProps;
|
|
122
|
+
type TLEditorOptions = EditorOptions;
|
|
123
|
+
type TLExternalContent = ExternalContent;
|
|
124
|
+
type TLResizeShapeOptions = ResizeShapeOptions;
|
|
125
|
+
type TLSvgExportOptions = SvgExportOptions;
|
|
65
126
|
|
|
66
|
-
export { type TLAnyShapeUtilConstructor, type TLArrowBinding, type TLArrowShape, type TLBinding, type TLBindingId, type TLBindingUtilConstructor, type TLCamera, type TLCameraId, type TLClickEventInfo, type TLDefaultColorStyle, type TLDefaultDashStyle, type TLDefaultFillStyle, type TLDefaultFontStyle, type TLDefaultHorizontalAlignStyle, type TLDefaultSizeStyle, type TLDefaultVerticalAlignStyle, type TLDocument, type TLDrawShape, type TLEditor, type TLEventInfo, type TLFrameShape, type TLGeoShape, type TLGeoShapeGeoStyle, type TLGroupShape, type TLHandle, type TLInstance, type TLInstancePageState, type TLKeyboardEventInfo, type TLLineShape, type TLNoteShape, type TLPage, type TLPageId, type TLParentId, type TLPointerEventInfo, type TLRecord, type TLResizeInfo, type TLSelectionHandle, type TLShape, type TLShapeCreate, type TLShapeId, type TLShapePartial, type TLShapeUtilConstructor, type TLStateNodeConstructor, type TLStore, type TLStoreSnapshot, type TLTextShape, type TLUnknownShape, type TLWheelEventInfo, Tldraw, TldrawEditor, createTLSchema, createTLStore };
|
|
127
|
+
export { type TLAnyBindingUtilConstructor, type TLAnyShapeUtilConstructor, type TLArrowBinding, type TLArrowBindingProps, type TLArrowBindings, type TLArrowShape, type TLArrowShapeProps, type TLAsset, type TLAssetContext, type TLAssetId, type TLAssetPartial, type TLAssetStore, type TLBaseAsset, type TLBaseBinding, type TLBaseEventInfo, type TLBaseShape, type TLBinding, type TLBindingCreate, type TLBindingId, type TLBindingUtilConstructor, type TLBookmarkAsset, type TLBookmarkShape, type TLBookmarkShapeProps, type TLCamera, type TLCameraId, type TLCancelEventInfo, type TLClickEventInfo, type TLCompleteEventInfo, type TLCurrentUser, TLDOCUMENT_ID, type TLDefaultColorStyle, type TLDefaultDashStyle, type TLDefaultFillStyle, type TLDefaultFontStyle, type TLDefaultHorizontalAlignStyle, type TLDefaultSizeStyle, type TLDefaultVerticalAlignStyle, type TLDocument, type TLDrawShape, type TLDrawShapeProps, type TLEditor, type TLEditorOptions, type TLEmbedDefinition, type TLEmbedShape, type TLEmbedShapeProps, type TLEventHandlers, type TLEventInfo, type TLExternalContent, type TLFrameShape, type TLFrameShapeProps, type TLGeoShape, type TLGeoShapeGeoStyle, type TLGeoShapeProps, type TLGroupShape, type TLHandle, TLINSTANCE_ID, type TLImageAsset, type TLImageShape, type TLImageShapeProps, type TLInstance, type TLInstanceId, type TLInstancePageState, type TLInstancePageStateId, type TLInstancePresence, type TLInstancePresenceID, type TLInterruptEventInfo, type TLKeyboardEventInfo, type TLKeyboardEventName, type TLLineShape, type TLLineShapeProps, type TLNoteShape, type TLNoteShapeProps, type TLPage, type TLPageId, type TLParentId, type TLPinchEventInfo, type TLPointerEventInfo, type TLPointerEventName, type TLPropsMigration, type TLPropsMigrations, type TLRecord, type TLResizeInfo, type TLResizeShapeOptions, type TLRichText, type TLScribble, type TLSelectionHandle, type TLSerializedStore, type TLShape, type TLShapeCreate, type TLShapeId, type TLShapePartial, type TLShapeUtilConstructor, type TLStateNodeConstructor, type TLStore, type TLStoreSchema, type TLStoreSnapshot, type TLSvgExportOptions, type TLTextShape, type TLTextShapeProps, type TLTickEventInfo, type TLUnknownBinding, type TLUnknownShape, type TLUser, type TLUserId, type TLUserPreferences, type TLUserStore, type TLVideoAsset, type TLVideoShape, type TLVideoShapeProps, type TLWheelEventInfo, Tldraw, TldrawEditor, type TldrawEditorStoreProps, type TldrawProps, createTLSchema, createTLStore, useTldrawCurrentUser };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mocanvas, Canvas, createSchema, createStore } from '@mocanvas/mocanvas';
|
|
1
|
+
import { DOCUMENT_ID, INSTANCE_ID, Mocanvas, Canvas, createSchema, createStore, useCurrentUser } from '@mocanvas/mocanvas';
|
|
2
2
|
export * from '@mocanvas/mocanvas';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
@@ -6,7 +6,10 @@ var Tldraw = Mocanvas;
|
|
|
6
6
|
var TldrawEditor = Canvas;
|
|
7
7
|
var createTLStore = createStore;
|
|
8
8
|
var createTLSchema = createSchema;
|
|
9
|
+
var useTldrawCurrentUser = useCurrentUser;
|
|
10
|
+
var TLDOCUMENT_ID = DOCUMENT_ID;
|
|
11
|
+
var TLINSTANCE_ID = INSTANCE_ID;
|
|
9
12
|
|
|
10
|
-
export { Tldraw, TldrawEditor, createTLSchema, createTLStore };
|
|
13
|
+
export { TLDOCUMENT_ID, TLINSTANCE_ID, Tldraw, TldrawEditor, createTLSchema, createTLStore, useTldrawCurrentUser };
|
|
11
14
|
//# sourceMappingURL=index.js.map
|
|
12
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;AAmHO,IAAM,MAAA,GAAS;AAEf,IAAM,YAAA,GAAe;AACrB,IAAM,aAAA,GAAgB;AACtB,IAAM,cAAA,GAAiB","file":"index.js","sourcesContent":["/**\n * Migration aliases. Projects moving from a `TL`-prefixed API can switch their\n * imports to `@mocanvas/compat` first and rename at their own pace.\n *\n * Every alias here is a pure re-export; there is no runtime code.\n */\nexport * from \"@mocanvas/mocanvas\"\n\nimport type {\n ArrowBinding,\n ArrowShape,\n Camera,\n CameraId,\n ClickEventInfo,\n Document,\n DrawShape,\n EditorRecord,\n EditorStore,\n EditorStoreSnapshot,\n EventInfo,\n FrameShape,\n GeoShape,\n GroupShape,\n Instance,\n InstancePageState,\n KeyboardEventInfo,\n LineShape,\n NoteShape,\n Page,\n PageId,\n ParentId,\n PointerEventInfo,\n Shape,\n ShapeCreate,\n ShapeHandle,\n ShapeId,\n ShapePartial,\n ShapeUtilConstructor,\n StateNodeConstructor,\n TextShape,\n UnknownBinding,\n UnknownShape,\n WheelEventInfo,\n BindingId,\n BindingUtilConstructor,\n SelectionHandle,\n ResizeInfo,\n DefaultColorStyle as DefaultColorStyleValue,\n DefaultDashStyle as DefaultDashStyleValue,\n DefaultFillStyle as DefaultFillStyleValue,\n DefaultFontStyle as DefaultFontStyleValue,\n DefaultSizeStyle as DefaultSizeStyleValue,\n DefaultHorizontalAlignStyle as DefaultHorizontalAlignStyleValue,\n DefaultVerticalAlignStyle as DefaultVerticalAlignStyleValue,\n GeoShapeKind,\n} from \"@mocanvas/mocanvas\"\nimport { Mocanvas, createSchema, createStore, Canvas, Editor } from \"@mocanvas/mocanvas\"\n\n// ---- records ----------------------------------------------------------------\nexport type TLRecord = EditorRecord\nexport type TLStore = EditorStore\nexport type TLStoreSnapshot = EditorStoreSnapshot\nexport type TLShape = Shape\nexport type TLUnknownShape = UnknownShape\nexport type TLShapeId = ShapeId\nexport type TLParentId = ParentId\nexport type TLShapePartial<T extends UnknownShape = UnknownShape> = ShapePartial<T>\nexport type TLShapeCreate<T extends UnknownShape = UnknownShape> = ShapeCreate<T>\nexport type TLPage = Page\nexport type TLPageId = PageId\nexport type TLDocument = Document\nexport type TLCamera = Camera\nexport type TLCameraId = CameraId\nexport type TLInstance = Instance\nexport type TLInstancePageState = InstancePageState\nexport type TLBinding = UnknownBinding\nexport type TLBindingId = BindingId\nexport type TLArrowBinding = ArrowBinding\n\n// ---- default shapes ---------------------------------------------------------\nexport type TLGeoShape = GeoShape\nexport type TLDrawShape = DrawShape\nexport type TLLineShape = LineShape\nexport type TLArrowShape = ArrowShape\nexport type TLTextShape = TextShape\nexport type TLNoteShape = NoteShape\nexport type TLFrameShape = FrameShape\nexport type TLGroupShape = GroupShape\nexport type TLGeoShapeGeoStyle = GeoShapeKind\n\n// ---- styles (value types) ---------------------------------------------------\nexport type TLDefaultColorStyle = DefaultColorStyleValue\nexport type TLDefaultDashStyle = DefaultDashStyleValue\nexport type TLDefaultFillStyle = DefaultFillStyleValue\nexport type TLDefaultFontStyle = DefaultFontStyleValue\nexport type TLDefaultSizeStyle = DefaultSizeStyleValue\nexport type TLDefaultHorizontalAlignStyle = DefaultHorizontalAlignStyleValue\nexport type TLDefaultVerticalAlignStyle = DefaultVerticalAlignStyleValue\n\n// ---- events / tools ---------------------------------------------------------\nexport type TLEventInfo = EventInfo\nexport type TLPointerEventInfo = PointerEventInfo\nexport type TLClickEventInfo = ClickEventInfo\nexport type TLKeyboardEventInfo = KeyboardEventInfo\nexport type TLWheelEventInfo = WheelEventInfo\nexport type TLHandle = ShapeHandle\nexport type TLSelectionHandle = SelectionHandle\nexport type TLResizeInfo<T extends UnknownShape> = ResizeInfo<T>\nexport type TLShapeUtilConstructor<T extends UnknownShape = UnknownShape> = ShapeUtilConstructor<T>\nexport type TLStateNodeConstructor = StateNodeConstructor\nexport type TLBindingUtilConstructor = BindingUtilConstructor\nexport type TLAnyShapeUtilConstructor = ShapeUtilConstructor\n\n// ---- values -----------------------------------------------------------------\n/** The batteries-included component. */\nexport const Tldraw = Mocanvas\n/** The bare canvas (bring your own shapes, tools and UI). */\nexport const TldrawEditor = Canvas\nexport const createTLStore = createStore\nexport const createTLSchema = createSchema\nexport type TLEditor = Editor\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;AAsLO,IAAM,MAAA,GAAS;AAEf,IAAM,YAAA,GAAe;AACrB,IAAM,aAAA,GAAgB;AACtB,IAAM,cAAA,GAAiB;AAsBvB,IAAM,oBAAA,GAAuB;AAqD7B,IAAM,aAAA,GAAgB;AACtB,IAAM,aAAA,GAAgB","file":"index.js","sourcesContent":["/**\n * Migration aliases. Projects moving from a `TL`-prefixed API can switch their\n * imports to `@mocanvas/compat` first and rename at their own pace.\n *\n * Every alias here is a pure re-export; there is no runtime code.\n */\nexport * from \"@mocanvas/mocanvas\"\n\nimport type {\n ArrowBinding,\n ArrowShape,\n Camera,\n CameraId,\n ClickEventInfo,\n Document,\n DrawShape,\n EditorRecord,\n EditorStore,\n EditorStoreSnapshot,\n EventInfo,\n FrameShape,\n GeoShape,\n GroupShape,\n Instance,\n InstancePageState,\n KeyboardEventInfo,\n LineShape,\n NoteShape,\n Page,\n PageId,\n ParentId,\n PointerEventInfo,\n Shape,\n ShapeCreate,\n ShapeHandle,\n ShapeId,\n ShapePartial,\n ShapeUtilConstructor,\n StateNodeConstructor,\n TextShape,\n UnknownBinding,\n UnknownShape,\n WheelEventInfo,\n BindingId,\n BindingUtilConstructor,\n SelectionHandle,\n ResizeInfo,\n DefaultColorStyle as DefaultColorStyleValue,\n DefaultDashStyle as DefaultDashStyleValue,\n DefaultFillStyle as DefaultFillStyleValue,\n DefaultFontStyle as DefaultFontStyleValue,\n DefaultSizeStyle as DefaultSizeStyleValue,\n DefaultHorizontalAlignStyle as DefaultHorizontalAlignStyleValue,\n DefaultVerticalAlignStyle as DefaultVerticalAlignStyleValue,\n GeoShapeKind,\n} from \"@mocanvas/mocanvas\"\nimport type {\n Asset,\n AssetId,\n AssetStore,\n BaseBinding,\n BaseShape,\n Binding,\n CurrentUser,\n EmbedDefinition,\n InstancePresence,\n InstancePresenceId,\n User,\n UserPreferencesState,\n UserStore,\n ArrowBindingProps,\n ArrowBindings,\n ArrowShapeProps,\n AssetContext,\n AssetPartial,\n BaseAsset,\n BaseEventInfo,\n BindingCreate,\n BookmarkAsset,\n BookmarkShape,\n BookmarkShapeProps,\n CancelEventInfo,\n CompleteEventInfo,\n DrawShapeProps,\n EditorOptions,\n EditorStoreProps,\n EmbedShape,\n EmbedShapeProps,\n EventHandlers,\n ExternalContent,\n FrameShapeProps,\n GeoShapeProps,\n ImageAsset,\n ImageShape,\n ImageShapeProps,\n InstanceId,\n InstancePageStateId,\n InterruptEventInfo,\n KeyboardEventName,\n LineShapeProps,\n MocanvasProps,\n NoteShapeProps,\n PinchEventInfo,\n PointerEventName,\n PropsMigration,\n PropsMigrations,\n ResizeShapeOptions,\n RichText,\n Scribble,\n SvgExportOptions,\n TLSchema,\n TextShapeProps,\n TickEventInfo,\n UserId,\n VideoAsset,\n VideoShape,\n VideoShapeProps,\n} from \"@mocanvas/mocanvas\"\nimport { Mocanvas, createSchema, createStore, Canvas, Editor, useCurrentUser, DOCUMENT_ID, INSTANCE_ID } from \"@mocanvas/mocanvas\"\nimport type { SerializedStore } from \"@mocanvas/store\"\n\n// ---- records ----------------------------------------------------------------\nexport type TLRecord = EditorRecord\nexport type TLStore = EditorStore\nexport type TLStoreSnapshot = EditorStoreSnapshot\n// `never` as the default so a bare `TLShape` is `Shape` itself — the union of\n// registered types. Spelling the default `string` collapsed it to one\n// non-union type and `shape.type === \"note\"` narrowed nothing.\nexport type TLShape<Type extends string = never> = [Type] extends [never] ? Shape : Shape<Type>\nexport type TLUnknownShape = UnknownShape\nexport type TLShapeId = ShapeId\nexport type TLParentId = ParentId\nexport type TLShapePartial<T extends UnknownShape = UnknownShape> = ShapePartial<T>\nexport type TLShapeCreate<T extends UnknownShape = UnknownShape> = ShapeCreate<T>\nexport type TLPage = Page\nexport type TLPageId = PageId\nexport type TLDocument = Document\nexport type TLCamera = Camera\nexport type TLCameraId = CameraId\nexport type TLInstance = Instance\nexport type TLInstancePageState = InstancePageState\nexport type TLBinding<Type extends string = never> = [Type] extends [never] ? Binding : Binding<Type>\nexport type TLBindingId = BindingId\nexport type TLArrowBinding = ArrowBinding\n\n// ---- default shapes ---------------------------------------------------------\nexport type TLGeoShape = GeoShape\nexport type TLDrawShape = DrawShape\nexport type TLLineShape = LineShape\nexport type TLArrowShape = ArrowShape\nexport type TLTextShape = TextShape\nexport type TLNoteShape = NoteShape\nexport type TLFrameShape = FrameShape\nexport type TLGroupShape = GroupShape\nexport type TLGeoShapeGeoStyle = GeoShapeKind\n\n// ---- styles (value types) ---------------------------------------------------\nexport type TLDefaultColorStyle = DefaultColorStyleValue\nexport type TLDefaultDashStyle = DefaultDashStyleValue\nexport type TLDefaultFillStyle = DefaultFillStyleValue\nexport type TLDefaultFontStyle = DefaultFontStyleValue\nexport type TLDefaultSizeStyle = DefaultSizeStyleValue\nexport type TLDefaultHorizontalAlignStyle = DefaultHorizontalAlignStyleValue\nexport type TLDefaultVerticalAlignStyle = DefaultVerticalAlignStyleValue\n\n// ---- events / tools ---------------------------------------------------------\nexport type TLEventInfo = EventInfo\nexport type TLPointerEventInfo = PointerEventInfo\nexport type TLClickEventInfo = ClickEventInfo\nexport type TLKeyboardEventInfo = KeyboardEventInfo\nexport type TLWheelEventInfo = WheelEventInfo\nexport type TLHandle = ShapeHandle\nexport type TLSelectionHandle = SelectionHandle\nexport type TLResizeInfo<T extends UnknownShape> = ResizeInfo<T>\nexport type TLShapeUtilConstructor<T extends UnknownShape = UnknownShape> = ShapeUtilConstructor<T>\nexport type TLStateNodeConstructor = StateNodeConstructor\nexport type TLBindingUtilConstructor = BindingUtilConstructor\nexport type TLAnyShapeUtilConstructor = ShapeUtilConstructor\nexport type TLAnyBindingUtilConstructor = BindingUtilConstructor\n\n// ---- values -----------------------------------------------------------------\n/** The batteries-included component. */\nexport const Tldraw = Mocanvas\n/** The bare canvas (bring your own shapes, tools and UI). */\nexport const TldrawEditor = Canvas\nexport const createTLStore = createStore\nexport const createTLSchema = createSchema\nexport type TLEditor = Editor\n\n// ---- custom shape and binding authoring -------------------------------------\n// The two base types a custom shape/binding is declared with. `Props` is the\n// object registered in `TLGlobalShapePropsMap` / `TLGlobalBindingPropsMap`.\nexport type TLBaseShape<Type extends string, Props extends object> = BaseShape<Type, Props>\nexport type TLBaseBinding<Type extends string, Props extends object> = BaseBinding<Type, Props>\n\n// ---- assets -----------------------------------------------------------------\nexport type TLAsset = Asset\nexport type TLAssetId = AssetId\nexport type TLAssetStore = AssetStore\n\n// ---- users and presence -----------------------------------------------------\nexport type TLUser = User\nexport type TLUserStore = UserStore\nexport type TLCurrentUser = CurrentUser\nexport type TLUserPreferences = UserPreferencesState\nexport type TLInstancePresence = InstancePresence\nexport type TLInstancePresenceID = InstancePresenceId\n/** The `Tldraw`-spelled identity hook. */\nexport const useTldrawCurrentUser = useCurrentUser\n\n// ---- embeds -----------------------------------------------------------------\nexport type TLEmbedDefinition = EmbedDefinition\n\n\n// ---- the documented `TL*` spellings ------------------------------------------\n//\n// Everything below is a name tldraw's reference documents and this package did\n// not carry. Each is a pure alias of a type mocanvas already exports unprefixed:\n// the capability was never missing, only the spelling a migrating codebase\n// imports it by. Kept in step by `pnpm --filter bench api-coverage`.\n\n// ---- events the tools and the editor emit ------------------------------------\nexport type TLBaseEventInfo = BaseEventInfo\nexport type TLCancelEventInfo = CancelEventInfo\nexport type TLCompleteEventInfo = CompleteEventInfo\nexport type TLEventHandlers = EventHandlers\nexport type TLInterruptEventInfo = InterruptEventInfo\nexport type TLKeyboardEventName = KeyboardEventName\nexport type TLPinchEventInfo = PinchEventInfo\nexport type TLPointerEventName = PointerEventName\nexport type TLTickEventInfo = TickEventInfo\n\n// ---- per-shape props ---------------------------------------------------------\nexport type TLArrowShapeProps = ArrowShapeProps\nexport type TLBookmarkShapeProps = BookmarkShapeProps\nexport type TLDrawShapeProps = DrawShapeProps\nexport type TLEmbedShapeProps = EmbedShapeProps\nexport type TLFrameShapeProps = FrameShapeProps\nexport type TLGeoShapeProps = GeoShapeProps\nexport type TLImageShapeProps = ImageShapeProps\nexport type TLLineShapeProps = LineShapeProps\nexport type TLNoteShapeProps = NoteShapeProps\nexport type TLTextShapeProps = TextShapeProps\nexport type TLVideoShapeProps = VideoShapeProps\n\n// ---- shapes ------------------------------------------------------------------\nexport type TLBookmarkShape = BookmarkShape\nexport type TLEmbedShape = EmbedShape\nexport type TLImageShape = ImageShape\nexport type TLVideoShape = VideoShape\n\n// ---- assets ------------------------------------------------------------------\nexport type TLAssetContext = AssetContext\nexport type TLAssetPartial<A extends Asset = Asset> = AssetPartial<A>\nexport type TLBaseAsset<Type extends string, Props extends object> = BaseAsset<Type, Props>\nexport type TLBookmarkAsset = BookmarkAsset\nexport type TLImageAsset = ImageAsset\nexport type TLVideoAsset = VideoAsset\n\n// ---- records and their ids ---------------------------------------------------\nexport type TLBindingCreate<B extends UnknownBinding = UnknownBinding> = BindingCreate<B>\nexport const TLDOCUMENT_ID = DOCUMENT_ID\nexport const TLINSTANCE_ID = INSTANCE_ID\nexport type TLInstanceId = InstanceId\nexport type TLInstancePageStateId = InstancePageStateId\nexport type TLPropsMigration = PropsMigration\nexport type TLPropsMigrations = PropsMigrations\nexport type TLRichText = RichText\nexport type TLScribble = Scribble\nexport type TLSerializedStore = SerializedStore<EditorRecord>\nexport type TLStoreSchema = TLSchema\nexport type TLUnknownBinding = UnknownBinding\nexport type TLUserId = UserId\n\n// ---- options, props and the rest ----------------------------------------\nexport type TLArrowBindingProps = ArrowBindingProps\nexport type TLArrowBindings = ArrowBindings\nexport type TldrawEditorStoreProps = EditorStoreProps\nexport type TldrawProps = MocanvasProps\nexport type TLEditorOptions = EditorOptions\nexport type TLExternalContent = ExternalContent\nexport type TLResizeShapeOptions = ResizeShapeOptions\nexport type TLSvgExportOptions = SvgExportOptions\n\n// `TldrawUiMenuItem` used to be aliased here, back when the flagship only had\n// `MocanvasUiMenuItem`. The UI layer now exports the documented name itself, and\n// an alias here would shadow it — so there is nothing to add.\n"]}
|
package/package.json
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mocanvas/compat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "TL-prefixed aliases over the mocanvas API, for projects migrating an existing tldraw app.",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Symbio Digital",
|
|
7
|
-
"homepage": "https://github.com/SYMBIO/mocanvas/tree/main/packages/compat#readme",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/SYMBIO/mocanvas.git",
|
|
11
|
-
"directory": "packages/compat"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/SYMBIO/mocanvas/issues"
|
|
15
|
-
},
|
|
16
7
|
"keywords": [
|
|
17
8
|
"tldraw",
|
|
18
9
|
"compat",
|
|
@@ -22,12 +13,19 @@
|
|
|
22
13
|
],
|
|
23
14
|
"type": "module",
|
|
24
15
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
16
|
+
"node": ">=22.12.0"
|
|
26
17
|
},
|
|
27
18
|
"files": [
|
|
28
19
|
"dist",
|
|
29
20
|
"README.md",
|
|
30
|
-
"LICENSE"
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"ARCHITECTURE.md",
|
|
23
|
+
"BENCHMARK.md",
|
|
24
|
+
"CLEAN_ROOM.md",
|
|
25
|
+
"COMPAT.md",
|
|
26
|
+
"CUSTOM_SHAPES.md",
|
|
27
|
+
"MIGRATION.md",
|
|
28
|
+
"UI.md"
|
|
31
29
|
],
|
|
32
30
|
"sideEffects": false,
|
|
33
31
|
"main": "./dist/index.js",
|
|
@@ -43,10 +41,10 @@
|
|
|
43
41
|
"access": "public"
|
|
44
42
|
},
|
|
45
43
|
"dependencies": {
|
|
46
|
-
"@mocanvas/editor": "
|
|
47
|
-
"@mocanvas/
|
|
48
|
-
"@mocanvas/
|
|
49
|
-
"@mocanvas/store": "
|
|
44
|
+
"@mocanvas/editor": "4.0.1",
|
|
45
|
+
"@mocanvas/state": "4.0.1",
|
|
46
|
+
"@mocanvas/mocanvas": "4.0.1",
|
|
47
|
+
"@mocanvas/store": "4.0.1"
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
50
|
"@types/react": "^19.1.0",
|