@mocanvas/wasm 4.1.0 → 4.2.0
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/MIGRATION.md +36 -0
- package/package.json +1 -1
package/MIGRATION.md
CHANGED
|
@@ -253,6 +253,40 @@ during the zero-rename step. Under pnpm's strict `node_modules` that means
|
|
|
253
253
|
adding `@mocanvas/mocanvas` to your own dependencies alongside
|
|
254
254
|
`@mocanvas/compat`.
|
|
255
255
|
|
|
256
|
+
**If your own CSS reads tldraw's custom properties, add a second line:**
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
import "@mocanvas/compat/compat.css"
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
This is the half of the compat layer that nothing checks for you. The package
|
|
263
|
+
alias covers the symbols TypeScript sees; it cannot cover the `--tl-*` names in
|
|
264
|
+
your stylesheets. Without it a migration goes green — build, types, tests — and
|
|
265
|
+
the damage shows up only to the eye, because a `var()` that resolves to nothing
|
|
266
|
+
does not fail, it deletes the declaration it sits in (and inside `calc()`, the
|
|
267
|
+
whole property). One consumer found it as a cursor whose white outline had
|
|
268
|
+
quietly stopped being drawn.
|
|
269
|
+
|
|
270
|
+
`compat.css` maps tldraw's tokens onto mocanvas's and gives **every** one a
|
|
271
|
+
literal fallback, so a token with no counterpart cannot take a rule down with
|
|
272
|
+
it. Two groups are worth knowing about:
|
|
273
|
+
|
|
274
|
+
| tldraw token | What you get |
|
|
275
|
+
| --- | --- |
|
|
276
|
+
| `--tl-zoom`, `--tl-scale` | Real values. mocanvas now stamps `--mocanvas-zoom` and `--mocanvas-scale` on the canvas container and restamps them on zoom, so `calc()` rules that hold a constant on-screen size keep working. |
|
|
277
|
+
| `--tl-color-overlay`, `--tl-color-background-overlay`, `--tl-color-warn` | A static fallback. mocanvas has no equivalent, so these do not follow your theme — set them yourself if they matter. |
|
|
278
|
+
|
|
279
|
+
Everything else maps onto a themed mocanvas variable and follows a theme swap
|
|
280
|
+
or a flip to dark. The stylesheet is scoped to `.mocanvas` rather than `:root`,
|
|
281
|
+
so a page that still renders a real tldraw editor somewhere keeps its own
|
|
282
|
+
values.
|
|
283
|
+
|
|
284
|
+
**Next.js**: an app coming from tldraw almost certainly lists it in
|
|
285
|
+
`serverExternalPackages`. Next matches that by package name, so leaving
|
|
286
|
+
`@mocanvas/mocanvas` in the list turns `…/mocanvas.css` into a request Node has
|
|
287
|
+
to resolve — and Node has no loader for `.css`. Take mocanvas out of the list
|
|
288
|
+
entirely; there is nothing in it that needs to be external.
|
|
289
|
+
|
|
256
290
|
### Step 2 — drop the prefixes
|
|
257
291
|
|
|
258
292
|
Once the app builds and runs against `@mocanvas/compat`, rename `TLFoo` →
|
|
@@ -663,6 +697,8 @@ aspirational.
|
|
|
663
697
|
| `ShapeUtil.toSvg`, `ShapeUtil.toBackgroundSvg` | Not `ShapeUtil` members. Custom shapes contribute to SVG export through `registerShapeSvgRenderer(type, renderer)`; without one they fall back to `geometryFallbackSvg`. |
|
|
664
698
|
| Sync protocol | Wire compatibility with tldraw's own sync protocol is not planned. `@mocanvas/sync` is a working transport of its own — presence records, `store.mergeRemoteChanges`, and a relay — but it does not speak tldraw's wire format. |
|
|
665
699
|
| `image` shape on the GPU | The texture path exists in the engine (`StyleWords.texture` + `uploadTexture`) but the `image` shape still draws an `<img>` in the DOM overlay. |
|
|
700
|
+
| `FrameShapeUtil` default size | mocanvas creates a frame at **160×90**; tldraw creates one at 320×180. Same aspect, half the size. It only bites code that creates a frame *programmatically* without passing `w`/`h` — drawing one with the tool sizes it from the drag either way. Pass explicit dimensions if the size matters to you. Aligning the default is a behaviour change and is not being made in a patch release. |
|
|
701
|
+
| An unregistered shape type in `store.put()` | Accepted, deliberately, and confirmed rather than fixed. A `.tldr` written by a build that knows a shape type this one does not must survive a load/save round trip instead of being dropped on the next save, so an unknown `type` passes its props through untouched. Its *other* fields are still validated — `x` must be a number whatever the type is — and a type you did register is validated in full. See `COMPAT.md`. |
|
|
666
702
|
| Text rendering | DOM overlay. Glyph-atlas text in WASM is phase 3. |
|
|
667
703
|
| GPU frame clipping | The `CLIP` flag and `isClipShape` hook are wired end to end, but no built-in shape enables it yet (phase 3). |
|
|
668
704
|
| WebGPU backend | Phase 3. WebGL2 is the only backend today, behind `RenderBackend`. |
|
package/package.json
CHANGED