@mocanvas/compat 1.0.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/LICENSE +21 -0
- package/README.md +33 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Symbio Digital
|
|
4
|
+
|
|
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
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @mocanvas/compat
|
|
2
|
+
|
|
3
|
+
`TL`-prefixed type and value aliases over the
|
|
4
|
+
[mocanvas](https://github.com/SYMBIO/mocanvas) API, for projects moving an
|
|
5
|
+
existing tldraw app over. Every alias is a pure re-export — there is no runtime
|
|
6
|
+
code of its own — so you can switch imports first and rename at your own pace.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @mocanvas/compat
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Use
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import type { TLShape, TLShapeId, TLGeoShape } from "@mocanvas/compat"
|
|
18
|
+
import { Tldraw } from "@mocanvas/compat" // alias of <Mocanvas />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The package also re-exports everything from `@mocanvas/mocanvas`, so a single import
|
|
22
|
+
source works during a migration.
|
|
23
|
+
|
|
24
|
+
What does and does not carry over is listed in
|
|
25
|
+
[docs/COMPAT.md](https://github.com/SYMBIO/mocanvas/blob/main/docs/COMPAT.md);
|
|
26
|
+
the step-by-step move is in
|
|
27
|
+
[docs/MIGRATION.md](https://github.com/SYMBIO/mocanvas/blob/main/docs/MIGRATION.md).
|
|
28
|
+
|
|
29
|
+
ESM only.
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ShapeUtilConstructor, ArrowBinding, ArrowShape, UnknownBinding, BindingId, BindingUtilConstructor, Camera, CameraId, ClickEventInfo, DefaultColorStyle, DefaultDashStyle, DefaultFillStyle, DefaultFontStyle, DefaultHorizontalAlignStyle, DefaultSizeStyle, DefaultVerticalAlignStyle, Document, DrawShape, Editor, EventInfo, FrameShape, GeoShape, GeoShapeKind, GroupShape, ShapeHandle, Instance, InstancePageState, KeyboardEventInfo, LineShape, NoteShape, Page, PageId, ParentId, PointerEventInfo, EditorRecord, UnknownShape, ResizeInfo, SelectionHandle, Shape, ShapeCreate, ShapeId, ShapePartial, StateNodeConstructor, EditorStore, EditorStoreSnapshot, TextShape, WheelEventInfo, Mocanvas, Canvas, createSchema, createStore } from '@mocanvas/mocanvas';
|
|
2
|
+
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
|
+
*/
|
|
10
|
+
|
|
11
|
+
type TLRecord = EditorRecord;
|
|
12
|
+
type TLStore = EditorStore;
|
|
13
|
+
type TLStoreSnapshot = EditorStoreSnapshot;
|
|
14
|
+
type TLShape = Shape;
|
|
15
|
+
type TLUnknownShape = UnknownShape;
|
|
16
|
+
type TLShapeId = ShapeId;
|
|
17
|
+
type TLParentId = ParentId;
|
|
18
|
+
type TLShapePartial<T extends UnknownShape = UnknownShape> = ShapePartial<T>;
|
|
19
|
+
type TLShapeCreate<T extends UnknownShape = UnknownShape> = ShapeCreate<T>;
|
|
20
|
+
type TLPage = Page;
|
|
21
|
+
type TLPageId = PageId;
|
|
22
|
+
type TLDocument = Document;
|
|
23
|
+
type TLCamera = Camera;
|
|
24
|
+
type TLCameraId = CameraId;
|
|
25
|
+
type TLInstance = Instance;
|
|
26
|
+
type TLInstancePageState = InstancePageState;
|
|
27
|
+
type TLBinding = UnknownBinding;
|
|
28
|
+
type TLBindingId = BindingId;
|
|
29
|
+
type TLArrowBinding = ArrowBinding;
|
|
30
|
+
type TLGeoShape = GeoShape;
|
|
31
|
+
type TLDrawShape = DrawShape;
|
|
32
|
+
type TLLineShape = LineShape;
|
|
33
|
+
type TLArrowShape = ArrowShape;
|
|
34
|
+
type TLTextShape = TextShape;
|
|
35
|
+
type TLNoteShape = NoteShape;
|
|
36
|
+
type TLFrameShape = FrameShape;
|
|
37
|
+
type TLGroupShape = GroupShape;
|
|
38
|
+
type TLGeoShapeGeoStyle = GeoShapeKind;
|
|
39
|
+
type TLDefaultColorStyle = DefaultColorStyle;
|
|
40
|
+
type TLDefaultDashStyle = DefaultDashStyle;
|
|
41
|
+
type TLDefaultFillStyle = DefaultFillStyle;
|
|
42
|
+
type TLDefaultFontStyle = DefaultFontStyle;
|
|
43
|
+
type TLDefaultSizeStyle = DefaultSizeStyle;
|
|
44
|
+
type TLDefaultHorizontalAlignStyle = DefaultHorizontalAlignStyle;
|
|
45
|
+
type TLDefaultVerticalAlignStyle = DefaultVerticalAlignStyle;
|
|
46
|
+
type TLEventInfo = EventInfo;
|
|
47
|
+
type TLPointerEventInfo = PointerEventInfo;
|
|
48
|
+
type TLClickEventInfo = ClickEventInfo;
|
|
49
|
+
type TLKeyboardEventInfo = KeyboardEventInfo;
|
|
50
|
+
type TLWheelEventInfo = WheelEventInfo;
|
|
51
|
+
type TLHandle = ShapeHandle;
|
|
52
|
+
type TLSelectionHandle = SelectionHandle;
|
|
53
|
+
type TLResizeInfo<T extends UnknownShape> = ResizeInfo<T>;
|
|
54
|
+
type TLShapeUtilConstructor<T extends UnknownShape = UnknownShape> = ShapeUtilConstructor<T>;
|
|
55
|
+
type TLStateNodeConstructor = StateNodeConstructor;
|
|
56
|
+
type TLBindingUtilConstructor = BindingUtilConstructor;
|
|
57
|
+
type TLAnyShapeUtilConstructor = ShapeUtilConstructor;
|
|
58
|
+
/** The batteries-included component. */
|
|
59
|
+
declare const Tldraw: typeof Mocanvas;
|
|
60
|
+
/** The bare canvas (bring your own shapes, tools and UI). */
|
|
61
|
+
declare const TldrawEditor: typeof Canvas;
|
|
62
|
+
declare const createTLStore: typeof createStore;
|
|
63
|
+
declare const createTLSchema: typeof createSchema;
|
|
64
|
+
type TLEditor = Editor;
|
|
65
|
+
|
|
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 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Mocanvas, Canvas, createSchema, createStore } from '@mocanvas/mocanvas';
|
|
2
|
+
export * from '@mocanvas/mocanvas';
|
|
3
|
+
|
|
4
|
+
// src/index.ts
|
|
5
|
+
var Tldraw = Mocanvas;
|
|
6
|
+
var TldrawEditor = Canvas;
|
|
7
|
+
var createTLStore = createStore;
|
|
8
|
+
var createTLSchema = createSchema;
|
|
9
|
+
|
|
10
|
+
export { Tldraw, TldrawEditor, createTLSchema, createTLStore };
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mocanvas/compat",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TL-prefixed aliases over the mocanvas API, for projects migrating an existing tldraw app.",
|
|
5
|
+
"license": "MIT",
|
|
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
|
+
"keywords": [
|
|
17
|
+
"tldraw",
|
|
18
|
+
"compat",
|
|
19
|
+
"migration",
|
|
20
|
+
"aliases",
|
|
21
|
+
"mocanvas"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@mocanvas/editor": "1.0.0",
|
|
47
|
+
"@mocanvas/mocanvas": "1.0.0",
|
|
48
|
+
"@mocanvas/state": "1.0.0",
|
|
49
|
+
"@mocanvas/store": "1.0.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@types/react": "^19.1.0",
|
|
53
|
+
"react": "^19.1.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": ">=18"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup",
|
|
60
|
+
"typecheck": "tsc --noEmit"
|
|
61
|
+
}
|
|
62
|
+
}
|