@mocanvas/mocanvas 3.1.1 → 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/CLEAN_ROOM.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Clean-room policy
2
2
 
3
- mocanvas is an original work licensed under MIT. It is *shaped like* tldraw so
3
+ mocanvas is an original work. It is *shaped like* tldraw so
4
4
  that projects can migrate, but it is not derived from it.
5
5
 
6
6
  ## Rules for contributors (human or agent)
package/COMPAT.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Compatibility with tldraw 5.4
2
2
 
3
- mocanvas reimplements the tldraw API from scratch, under MIT, without reading
3
+ mocanvas reimplements the tldraw API from scratch, without reading
4
4
  tldraw's source — see [CLEAN_ROOM.md](CLEAN_ROOM.md). This document says what
5
5
  that covers today, what it deliberately does not, and where the two libraries
6
6
  behave differently on purpose.
@@ -199,7 +199,7 @@ services tldraw operates", which was wrong about sync — see below.
199
199
 
200
200
  | | Why |
201
201
  | :--- | :--- |
202
- | Licensing, watermark, license telemetry | mocanvas is MIT; there is no licence to check. `licenseKey` is accepted and ignored. |
202
+ | Licensing, watermark, license telemetry | mocanvas's own licence is a written agreement, not a key the canvas checks at runtime, so there is nothing to verify and no watermark to draw. `licenseKey` is accepted and ignored. |
203
203
  | `useSyncDemo` | Points at demo servers tldraw hosts. The only symbol in `@tldraw/sync` that genuinely does. |
204
204
  | The tldraw asset CDN defaults | The asset mechanism is kept; the host is not. Supply your own `AssetStore`. |
205
205
  | Third-party embed unfurling and integrations | Each is a call to somebody's API. `EmbedShapeUtil.configure({ embedConfig })` lets an app supply its own. |
package/LICENSE CHANGED
@@ -1,21 +1,115 @@
1
- MIT License
1
+ mocanvas License
2
+ Copyright (c) 2026 Symbio Digital. All rights reserved.
2
3
 
3
- Copyright (c) 2026 Symbio Digital
4
+ This software is source-available, not open source. It is free for the uses
5
+ listed in section 2. Commercial Use requires a separate written agreement with
6
+ Symbio Digital: contact mocanvas@symbio.agency.
4
7
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
8
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
9
+ 1. DEFINITIONS
10
+
11
+ "Software" means mocanvas — the packages published under the @mocanvas scope,
12
+ their source code, compiled artefacts, documentation and accompanying files.
13
+
14
+ "You" means the individual or legal entity exercising the rights granted below.
15
+
16
+ "Commercial Use" means any use of the Software in, or in the development or
17
+ operation of, a product, service, website, application or internal tool that is:
18
+
19
+ (a) sold, licensed, rented or otherwise offered for a fee;
20
+ (b) used to generate revenue directly or indirectly, including through
21
+ advertising, sponsorship, subscription or transaction fees; or
22
+ (c) used in the ordinary business operations of a for-profit entity.
23
+
24
+ "Non-Profit Organisation" means an entity organised and operated for charitable,
25
+ educational, scientific, cultural, religious or similar purposes, which does not
26
+ distribute profits to owners or shareholders, and which is recognised as such
27
+ under the law of its jurisdiction.
28
+
29
+ "Development Use" means use on a developer's own machine, or in evaluation,
30
+ testing, continuous integration, review or staging environments, where the
31
+ result is not offered to the public and is not used to operate a product or
32
+ service.
33
+
34
+
35
+ 2. GRANT
36
+
37
+ Subject to the terms of this Licence, Symbio Digital grants You a worldwide,
38
+ royalty-free, non-exclusive, non-transferable, revocable licence to use, copy,
39
+ modify and create derivative works of the Software, solely for:
40
+
41
+ (a) personal use that is not Commercial Use;
42
+ (b) use by a Non-Profit Organisation in pursuit of its non-profit purposes;
43
+ (c) Development Use, including by a for-profit entity evaluating the Software;
44
+ (d) teaching, study and academic research.
45
+
46
+ You may distribute the Software, or a derivative work of it, only if the
47
+ recipient receives it under this Licence, unmodified, with the notices in
48
+ section 4 intact, and only for the purposes above.
49
+
50
+
51
+ 3. COMMERCIAL USE
52
+
53
+ Commercial Use is not granted by this Licence. It requires a separate written
54
+ agreement with Symbio Digital.
55
+
56
+ Development Use under section 2(c) is permitted before such an agreement is in
57
+ place, so that a for-profit entity may evaluate the Software and build against
58
+ it — but shipping, deploying or operating the result as part of a commercial
59
+ product, service or website is Commercial Use and requires the agreement first.
60
+
61
+ To obtain one, contact:
62
+
63
+ mocanvas@symbio.agency
64
+
65
+
66
+ 4. CONDITIONS
67
+
68
+ You must retain, in all copies and derivative works of the Software, this
69
+ Licence text, the copyright notice above, and any notices identifying Symbio
70
+ Digital as the author.
71
+
72
+ You may not sublicense the Software, remove or alter its licence notices, or
73
+ represent that the Software is available under different terms.
74
+
75
+
76
+ 5. THIRD-PARTY COMPONENTS
77
+
78
+ The Software depends on third-party components distributed under their own
79
+ licences. Those licences govern those components, and nothing in this Licence
80
+ limits rights You have under them.
81
+
82
+
83
+ 6. NO WARRANTY
14
84
 
15
85
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
86
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
87
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
88
+
89
+
90
+ 7. LIMITATION OF LIABILITY
91
+
92
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL SYMBIO
93
+ DIGITAL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
94
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
95
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
96
+
97
+
98
+ 8. TERMINATION
99
+
100
+ This Licence terminates automatically if You breach it. On termination You must
101
+ stop using the Software and destroy all copies in Your possession. Sections 5
102
+ through 7 survive termination.
103
+
104
+
105
+ 9. PRIOR RELEASES
106
+
107
+ Versions of the Software released under the MIT Licence remain available under
108
+ that licence, on the terms under which they were released. This Licence governs
109
+ this version and later ones.
110
+
111
+
112
+ 10. CONTACT
113
+
114
+ mocanvas@symbio.agency
115
+ Symbio Digital
package/README.md CHANGED
@@ -5,10 +5,96 @@ tools and UI, on top of a Rust + WebAssembly engine that does geometry,
5
5
  hit-testing, culling and tessellation and writes GPU buffers straight into
6
6
  linear memory.
7
7
 
8
- The guides ship inside this package rather than being linked: `COMPAT.md` for
9
- what exists of the tldraw API, `MIGRATION.md` for moving an app across,
10
- `CUSTOM_SHAPES.md` for writing a shape util and its tool, and `CLEAN_ROOM.md`
11
- for how this library was built.
8
+ ## Why this exists
9
+
10
+ We built products on [tldraw](https://tldraw.dev), and it is a genuinely
11
+ excellent library — the API model in this package is shaped after it because we
12
+ think they got that design right. What we ran out of was headroom: our canvases
13
+ grew past the point where a DOM-and-SVG renderer kept up, and the work we needed
14
+ to move off the main thread had nowhere to go.
15
+
16
+ So mocanvas is that same shape of API with a different engine underneath, and it
17
+ is built so you can come across without rewriting your app:
18
+
19
+ - **The API is the one you know.** `Editor`, `ShapeUtil`, `StateNode`, records
20
+ with `shape:` / `page:` ids, `createShapes`, `zoomToFit`, `.tldr` files.
21
+ - **Every symbol tldraw's reference documents exists here under the same name.**
22
+ 1,420 of 1,420 — see *Compatibility with tldraw* below for what that does and
23
+ does not promise.
24
+ - **`@mocanvas/compat` gives you the `TL`-prefixed spellings**, so a migration
25
+ can change import paths first and rename later. `MIGRATION.md`, shipped in
26
+ this package, walks through it.
27
+
28
+ ## Performance
29
+
30
+ The engine is the point. Geometry, hit-testing, spatial indexing, culling and
31
+ tessellation run in WebAssembly and write GPU vertex buffers straight into
32
+ linear memory; the renderer is WebGL2 today and WebGPU behind the same
33
+ interface next.
34
+
35
+ Creating shapes, median milliseconds — lower is better:
36
+
37
+ | Scene | mocanvas | tldraw 5.4 | |
38
+ | :--- | ---: | ---: | ---: |
39
+ | 1,000 geo shapes | 15.1 ms | 37.8 ms | **2.5× faster** |
40
+ | 5,000 geo shapes | 40.1 ms | 120.0 ms | **3.0× faster** |
41
+ | 20,000 geo shapes | 134.2 ms | 433.2 ms | **3.2× faster** |
42
+ | 1,000 mixed | 25.7 ms | 76.0 ms | **3.0× faster** |
43
+ | 5,000 mixed | 67.8 ms | 241.5 ms | **3.6× faster** |
44
+ | 20,000 mixed | 249.4 ms | 753.7 ms | **3.0× faster** |
45
+
46
+ Interaction at scale, dragging a selection, median milliseconds per frame:
47
+
48
+ | Scene | mocanvas | tldraw 5.4 | |
49
+ | :--- | ---: | ---: | ---: |
50
+ | 1,000 geo shapes | 33.0 ms | 25.1 ms | tldraw ahead |
51
+ | 5,000 geo shapes | 116.6 ms | 150.0 ms | **1.3× faster** |
52
+ | 20,000 geo shapes | 400.0 ms | 858.4 ms | **2.1× faster** |
53
+ | 20,000 mixed | 841.6 ms | 1,124.9 ms | **1.3× faster** |
54
+
55
+ The shape of it is that mocanvas scales: it wins by ~3× on building a scene at
56
+ every size, and the interaction gap opens as the scene grows. On small scenes
57
+ tldraw's renderer is ahead.
58
+
59
+ **Read these numbers with their caveats.** They were measured on 2026-09-04 on an
60
+ Apple M3 Pro in headless Chromium **with no hardware GPU** — Chromium fell back
61
+ to software rasterisation, which penalises mocanvas's WebGL2 renderer far more
62
+ than it penalises tldraw's DOM one, so the interaction numbers above are close to
63
+ a worst case for mocanvas. Both libraries ran on default settings, and this is
64
+ our own benchmark of our own library. `BENCHMARK.md`, shipped in this package,
65
+ has the method, the full tables and a longer list of caveats — including a
66
+ rendering-fidelity comparison against tldraw at 99.2% interior IoU.
67
+
68
+ ## Compatibility with tldraw
69
+
70
+ The API is shaped after **tldraw 5.4**, and every symbol its public reference
71
+ documents exists here under the same name — 1,420 of 1,420, across `tldraw`,
72
+ `@tldraw/editor`, `@tldraw/tlschema`, `@tldraw/store`, `@tldraw/state`,
73
+ `@tldraw/state-react` and `@tldraw/validate`. `@mocanvas/compat` carries the
74
+ `TL`-prefixed spellings so an existing codebase can switch imports first and
75
+ rename later.
76
+
77
+ Names are not behaviour, and the honest number is lower: across the symbols both
78
+ libraries share, 86.4% of `@tldraw/editor`'s members are present. `Vec`, `Box`
79
+ and `Mat` are complete; `Editor` has 304 of its 313 members and `ShapeUtil` 52 of
80
+ 77, the gap there being mostly the `can*` predicates.
81
+
82
+ Four documented packages are not implemented. `@tldraw/mermaid` and
83
+ `@tldraw/driver` are wanted and unbuilt. `@tldraw/sync` and `@tldraw/sync-core`
84
+ are a deliberate difference: mocanvas has multiplayer — `@mocanvas/sync`, with
85
+ its own transport and a field-level CRDT — but not tldraw's sync protocol, so an
86
+ app keeping its existing tldraw sync *server* would have to move. Licensing and
87
+ watermark checks, `useSyncDemo` and the asset CDN defaults are tied to services
88
+ tldraw runs and are not coming; each has a seam to supply your own.
89
+
90
+ `COMPAT.md` in this package has the measured breakdown and names what is missing.
91
+
92
+ ## Guides, shipped in this package
93
+
94
+ `COMPAT.md` for what exists of the tldraw API, `MIGRATION.md` for moving an app
95
+ across, `CUSTOM_SHAPES.md` for writing a shape util and its tool, `BENCHMARK.md`
96
+ for the performance and fidelity method, `ARCHITECTURE.md` for how the engine
97
+ works, and `CLEAN_ROOM.md` for how this library was built.
12
98
 
13
99
  ## Install
14
100
 
@@ -108,30 +194,6 @@ Two optional notes:
108
194
  | `@mocanvas/sync` | multiplayer: record diffs, presence, cursors |
109
195
  | `@mocanvas/compat` | `TL`-prefixed aliases for a tldraw migration |
110
196
 
111
- ## Compatibility with tldraw
112
-
113
- The API is shaped after **tldraw 5.4**, and every symbol its public reference
114
- documents exists here under the same name — 1,420 of 1,420, across `tldraw`,
115
- `@tldraw/editor`, `@tldraw/tlschema`, `@tldraw/store`, `@tldraw/state`,
116
- `@tldraw/state-react` and `@tldraw/validate`. `@mocanvas/compat` carries the
117
- `TL`-prefixed spellings so an existing codebase can switch imports first and
118
- rename later.
119
-
120
- Names are not behaviour, and the honest number is lower: across the symbols both
121
- libraries share, 86.4% of `@tldraw/editor`'s members are present. `Vec`, `Box`
122
- and `Mat` are complete; `Editor` has 304 of its 313 members and `ShapeUtil` 52 of
123
- 77, the gap there being mostly the `can*` predicates.
124
-
125
- Four documented packages are not implemented. `@tldraw/mermaid` and
126
- `@tldraw/driver` are wanted and unbuilt. `@tldraw/sync` and `@tldraw/sync-core`
127
- are a deliberate difference: mocanvas has multiplayer — `@mocanvas/sync`, with
128
- its own transport and a field-level CRDT — but not tldraw's sync protocol, so an
129
- app keeping its existing tldraw sync *server* would have to move. Licensing and
130
- watermark checks, `useSyncDemo` and the asset CDN defaults are tied to services
131
- tldraw runs and are not coming; each has a seam to supply your own.
132
-
133
- `COMPAT.md` in this package has the measured breakdown and names what is missing.
134
-
135
197
  ## Clean room
136
198
 
137
199
  **mocanvas has never been built by reading tldraw's source** — not the
@@ -139,11 +201,28 @@ repository, not a copy in `node_modules`, not a fork. It is written from first
139
201
  principles against the public API reference and guides on tldraw.dev and sample
140
202
  `.tldr` documents, and its compatibility is *measured* against that same
141
203
  reference. Names are not copyrightable expression (*Google v. Oracle*, 2021);
142
- the implementation behind them is original work under MIT. `CLEAN_ROOM.md` in
204
+ the implementation behind them is our own original work. `CLEAN_ROOM.md` in
143
205
  this package is the full policy.
144
206
 
145
207
  mocanvas is not affiliated with or endorsed by tldraw.
146
208
 
147
209
  ## License
148
210
 
149
- MIT
211
+ **Source-available, not open source.** Free to use for:
212
+
213
+ - personal, non-commercial projects;
214
+ - non-profit organisations;
215
+ - development, evaluation, testing and staging — including inside a for-profit
216
+ company, so you can try it and build against it before committing;
217
+ - teaching and academic research.
218
+
219
+ **Shipping it in a commercial product, service or website needs a written
220
+ agreement with us.** That includes anything sold, anything that earns revenue
221
+ directly or through advertising, and internal tools running a for-profit
222
+ business.
223
+
224
+ To arrange one, or if you are unsure which side of the line you are on, write to
225
+ **mocanvas@symbio.agency** — we would rather answer the question than have you
226
+ guess.
227
+
228
+ The full terms are in `LICENSE`, shipped in this package.
package/dist/index.d.ts CHANGED
@@ -8493,7 +8493,8 @@ interface MocanvasProps {
8493
8493
  */
8494
8494
  assetUrls?: TLAssetUrls;
8495
8495
  /**
8496
- * Accepted and ignored. mocanvas is MIT and has no licence to check; the
8496
+ * Accepted and ignored. mocanvas's licence is a written agreement rather
8497
+ * than a key the canvas verifies at runtime, so there is nothing to check; the
8497
8498
  * prop exists so an app migrating from a licensed canvas does not have to
8498
8499
  * strip it from every mount, and so that leaving it in place stays a no-op
8499
8500
  * rather than becoming a type error.