canvu-react 0.3.5
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 +156 -0
- package/dist/camera-BwQjm5oh.d.cts +50 -0
- package/dist/camera-KwCYYPhm.d.ts +50 -0
- package/dist/chatbot.cjs +221 -0
- package/dist/chatbot.cjs.map +1 -0
- package/dist/chatbot.d.cts +36 -0
- package/dist/chatbot.d.ts +36 -0
- package/dist/chatbot.js +218 -0
- package/dist/chatbot.js.map +1 -0
- package/dist/index.cjs +1920 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +276 -0
- package/dist/index.d.ts +276 -0
- package/dist/index.js +1867 -0
- package/dist/index.js.map +1 -0
- package/dist/native.cjs +2572 -0
- package/dist/native.cjs.map +1 -0
- package/dist/native.d.cts +217 -0
- package/dist/native.d.ts +217 -0
- package/dist/native.js +2562 -0
- package/dist/native.js.map +1 -0
- package/dist/react.cjs +8540 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +481 -0
- package/dist/react.d.ts +481 -0
- package/dist/react.js +8492 -0
- package/dist/react.js.map +1 -0
- package/dist/realtime.cjs +2338 -0
- package/dist/realtime.cjs.map +1 -0
- package/dist/realtime.d.cts +309 -0
- package/dist/realtime.d.ts +309 -0
- package/dist/realtime.js +2317 -0
- package/dist/realtime.js.map +1 -0
- package/dist/shape-builders-DTYvub8W.d.ts +93 -0
- package/dist/shape-builders-DxPoOecg.d.cts +93 -0
- package/dist/tldraw.cjs +1948 -0
- package/dist/tldraw.cjs.map +1 -0
- package/dist/tldraw.d.cts +98 -0
- package/dist/tldraw.d.ts +98 -0
- package/dist/tldraw.js +1941 -0
- package/dist/tldraw.js.map +1 -0
- package/dist/types--ALu1mF-.d.ts +356 -0
- package/dist/types-B58i5k-u.d.cts +35 -0
- package/dist/types-CB0TZZuk.d.cts +157 -0
- package/dist/types-CB0TZZuk.d.ts +157 -0
- package/dist/types-D1ftVsOQ.d.cts +356 -0
- package/dist/types-DgEArHkA.d.ts +35 -0
- package/package.json +103 -0
package/dist/tldraw.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { V as VectorSceneItem } from './types-CB0TZZuk.js';
|
|
2
|
+
|
|
3
|
+
/** Types used by tldraw snapshots (subset needed for conversion). */
|
|
4
|
+
type TlUnknownObject = Record<string, unknown>;
|
|
5
|
+
type TlShapeProps = TlUnknownObject;
|
|
6
|
+
type TlShapeRecord<Props extends TlShapeProps = TlShapeProps> = {
|
|
7
|
+
id: string;
|
|
8
|
+
typeName: "shape" | string;
|
|
9
|
+
type: string;
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
rotation: number;
|
|
13
|
+
index: string;
|
|
14
|
+
parentId: string;
|
|
15
|
+
opacity: number;
|
|
16
|
+
isLocked: boolean;
|
|
17
|
+
props: Props;
|
|
18
|
+
meta: TlUnknownObject;
|
|
19
|
+
};
|
|
20
|
+
type TlAssetRecord = {
|
|
21
|
+
id: string;
|
|
22
|
+
typeName: "asset" | string;
|
|
23
|
+
type: string;
|
|
24
|
+
props: TlUnknownObject & {
|
|
25
|
+
src?: string;
|
|
26
|
+
w?: number;
|
|
27
|
+
h?: number;
|
|
28
|
+
name?: string;
|
|
29
|
+
mimeType?: string;
|
|
30
|
+
};
|
|
31
|
+
meta: TlUnknownObject;
|
|
32
|
+
};
|
|
33
|
+
type TlBindingRecord = {
|
|
34
|
+
id: string;
|
|
35
|
+
typeName: "binding" | string;
|
|
36
|
+
type: string;
|
|
37
|
+
fromId: string;
|
|
38
|
+
toId: string;
|
|
39
|
+
props: TlUnknownObject;
|
|
40
|
+
meta: TlUnknownObject;
|
|
41
|
+
};
|
|
42
|
+
type TlPageRecord = {
|
|
43
|
+
id: string;
|
|
44
|
+
typeName: "page" | string;
|
|
45
|
+
name?: string;
|
|
46
|
+
meta: TlUnknownObject;
|
|
47
|
+
};
|
|
48
|
+
type TlRecord = TlShapeRecord | TlAssetRecord | TlBindingRecord | TlPageRecord | (TlUnknownObject & {
|
|
49
|
+
id: string;
|
|
50
|
+
typeName: string;
|
|
51
|
+
});
|
|
52
|
+
type TlStoreSnapshot = {
|
|
53
|
+
schema?: unknown;
|
|
54
|
+
store: Record<string, TlRecord>;
|
|
55
|
+
};
|
|
56
|
+
type TlDocumentSnapshot = TlStoreSnapshot | {
|
|
57
|
+
schema?: unknown;
|
|
58
|
+
store?: Record<string, TlRecord>;
|
|
59
|
+
} | Record<string, TlRecord>;
|
|
60
|
+
type TlSessionSnapshot = TlUnknownObject & {
|
|
61
|
+
currentPageId?: string;
|
|
62
|
+
pageId?: string;
|
|
63
|
+
};
|
|
64
|
+
type TlDocumentSessionSnapshot = {
|
|
65
|
+
document?: TlDocumentSnapshot;
|
|
66
|
+
session?: TlSessionSnapshot;
|
|
67
|
+
schema?: unknown;
|
|
68
|
+
};
|
|
69
|
+
type RoomSnapshot = {
|
|
70
|
+
documents: Array<TlRecord | {
|
|
71
|
+
state: TlRecord;
|
|
72
|
+
lastChangedClock?: number;
|
|
73
|
+
}>;
|
|
74
|
+
schema?: unknown;
|
|
75
|
+
clock?: number;
|
|
76
|
+
};
|
|
77
|
+
type TlSnapshotInput = TlStoreSnapshot | TlDocumentSessionSnapshot | RoomSnapshot;
|
|
78
|
+
|
|
79
|
+
type TldrawSnapshotImportOptions = {
|
|
80
|
+
pageId?: string;
|
|
81
|
+
assetUrlResolver?: (asset: TlAssetRecord, shape: TlShapeRecord) => string | undefined;
|
|
82
|
+
onUnsupportedShape?: (shape: TlShapeRecord, reason: string) => void;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Converts tldraw snapshots into canvu VectorSceneItem[] ready for rendering.
|
|
86
|
+
*/
|
|
87
|
+
declare function tldrawSnapshotToItems(input: TlStoreSnapshot | RoomSnapshot | TlSnapshotInput, options?: TldrawSnapshotImportOptions): VectorSceneItem[];
|
|
88
|
+
/**
|
|
89
|
+
* Converts back: canvu VectorSceneItem[] → RoomSnapshot.
|
|
90
|
+
* This produces a minimal RoomSnapshot that can be stored or sent to tldraw.
|
|
91
|
+
* Only items with a recognized `toolKind` are included.
|
|
92
|
+
*
|
|
93
|
+
* Note: the reverse conversion is lossy — tldraw-specific props, asset references,
|
|
94
|
+
* page/camera records, and metadata are not preserved.
|
|
95
|
+
*/
|
|
96
|
+
declare function itemsToTldrawSnapshot(items: readonly VectorSceneItem[]): RoomSnapshot;
|
|
97
|
+
|
|
98
|
+
export { type TldrawSnapshotImportOptions, itemsToTldrawSnapshot, tldrawSnapshotToItems };
|