@liveblocks/react-flow 0.0.0 → 3.16.0-flow1

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.
@@ -0,0 +1,150 @@
1
+ import * as react from 'react';
2
+ import { ComponentPropsWithoutRef } from 'react';
3
+ import { LiveObject, DistributiveOmit, LsonObject, LiveMap, Resolve, JsonObject } from '@liveblocks/core';
4
+ import { Node, Edge, OnNodesChange, OnEdgesChange, OnConnect } from '@xyflow/react';
5
+
6
+ interface CursorsProps extends ComponentPropsWithoutRef<"div"> {
7
+ /**
8
+ * The key used to store the cursors in users' Presence.
9
+ *
10
+ * Defaults to `"cursor"`.
11
+ */
12
+ presenceKey?: string;
13
+ }
14
+ /**
15
+ * Displays other users' cursors inside a React Flow canvas and stores the
16
+ * current user's cursor in Presence as `{ cursor: { x, y } }`.
17
+ *
18
+ * Cursor coordinates are kept in React Flow canvas space, so panning moves
19
+ * them correctly while zooming only affects their position, not their size.
20
+ */
21
+ declare const Cursors: react.ForwardRefExoticComponent<CursorsProps & react.RefAttributes<HTMLDivElement>>;
22
+
23
+ declare const NODE_LOCAL_KEYS: ["selected", "dragging", "measured", "resizing"];
24
+ declare const EDGE_LOCAL_KEYS: ["selected"];
25
+ type SerializableNode = Node<JsonObject>;
26
+ type SerializableEdge = Edge<JsonObject>;
27
+ /**
28
+ * The Liveblocks Storage representation of a React Flow `Node`.
29
+ *
30
+ * It doesn't include local-only properties.
31
+ * The entire node and its `data` property are both stored as `LiveObject`s.
32
+ */
33
+ type LiveblocksNode<TNode extends SerializableNode = SerializableNode> = LiveObject<DistributiveOmit<TNode, (typeof NODE_LOCAL_KEYS)[number] | "data"> & {
34
+ data: LiveObject<TNode["data"]>;
35
+ } & LsonObject>;
36
+ /**
37
+ * The Liveblocks Storage representation of a React Flow `Edge`.
38
+ *
39
+ * It doesn't include local-only properties.
40
+ * The entire edge and its `data` property are both stored as `LiveObject`s.
41
+ */
42
+ type LiveblocksEdge<TEdge extends SerializableEdge = SerializableEdge> = LiveObject<DistributiveOmit<TEdge, (typeof EDGE_LOCAL_KEYS)[number] | "data"> & {
43
+ data?: LiveObject<NonNullable<TEdge["data"]>>;
44
+ } & LsonObject>;
45
+ /**
46
+ * The Liveblocks Storage representation of a React Flow diagram made of nodes and edges.
47
+ *
48
+ * Nodes and edges are stored as `LiveMap`s keyed by their IDs, enabling
49
+ * fine-grained conflict-free updates from multiple clients simultaneously.
50
+ */
51
+ type LiveblocksFlow<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge> = LiveObject<{
52
+ nodes: LiveMap<string, LiveblocksNode<TNode>>;
53
+ edges: LiveMap<string, LiveblocksEdge<TEdge>>;
54
+ }>;
55
+ type UseLiveblocksFlowResult<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge> = Resolve<({
56
+ nodes: null;
57
+ edges: null;
58
+ isLoading: true;
59
+ } | {
60
+ nodes: TNode[];
61
+ edges: TEdge[];
62
+ isLoading: false;
63
+ }) & {
64
+ onNodesChange: OnNodesChange<TNode>;
65
+ onEdgesChange: OnEdgesChange<TEdge>;
66
+ onConnect: OnConnect;
67
+ }>;
68
+ type UseLiveblocksFlowOptions<TNode extends SerializableNode, TEdge extends SerializableEdge> = {
69
+ /**
70
+ * The initial React Flow nodes and edges.
71
+ *
72
+ * @example
73
+ * ```tsx
74
+ * const { ... } = useLiveblocksFlow({
75
+ * initial: {
76
+ * nodes: [
77
+ * { id: "1", position: { x: 0, y: 0 }, data: { label: "Node 1" } },
78
+ * { id: "2", position: { x: 0, y: 100 }, data: { label: "Node 2" } },
79
+ * ],
80
+ * edges: [
81
+ * { id: "1-2", source: "1", target: "2" },
82
+ * ],
83
+ * },
84
+ * });
85
+ * ```
86
+ *
87
+ * This is equivalent to setting `initialStorage` on `RoomProvider`.
88
+ *
89
+ * @example
90
+ * ```tsx
91
+ * <RoomProvider
92
+ * initialStorage={{
93
+ * flow: createLiveblocksFlow([
94
+ * { id: "1", position: { x: 0, y: 0 }, data: { label: "Node 1" } },
95
+ * { id: "2", position: { x: 0, y: 100 }, data: { label: "Node 2" } },
96
+ * ], [
97
+ * { id: "1-2", source: "1", target: "2" },
98
+ * ]),
99
+ * }}
100
+ * />
101
+ * ```
102
+ */
103
+ initial?: {
104
+ nodes?: TNode[];
105
+ edges?: TEdge[];
106
+ };
107
+ /**
108
+ * The key used to store the React Flow diagram in Liveblocks Storage.
109
+ *
110
+ * Defaults to `"flow"`.
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * const { ... } = useLiveblocksFlow({
115
+ * storageKey: "myDiagram",
116
+ * });
117
+ * ```
118
+ */
119
+ storageKey?: string;
120
+ };
121
+ /**
122
+ * Creates a Liveblocks Storage representation of a React Flow diagram from nodes and edges.
123
+ *
124
+ * @example
125
+ * ```tsx
126
+ * <RoomProvider
127
+ * initialStorage={{
128
+ * flow: createLiveblocksFlow(initialNodes, initialEdges),
129
+ * }}
130
+ * />
131
+ * ```
132
+ */
133
+ declare function createLiveblocksFlow<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge>(nodes?: TNode[], edges?: TEdge[]): LiveblocksFlow<TNode, TEdge>;
134
+ /**
135
+ * Returns a controlled React Flow state backed by Liveblocks Storage.
136
+ *
137
+ * @example
138
+ * ```tsx
139
+ * const { nodes, edges, onNodesChange, onEdgesChange, onConnect, isLoading } = useLiveblocksFlow();
140
+ *
141
+ * if (isLoading) {
142
+ * return <div>Loading…</div>
143
+ * }
144
+ *
145
+ * return <ReactFlow nodes={nodes} edges={edges} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={onConnect} />;
146
+ * ```
147
+ */
148
+ declare function useLiveblocksFlow<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge>(options?: UseLiveblocksFlowOptions<TNode, TEdge>): Resolve<UseLiveblocksFlowResult<TNode, TEdge>>;
149
+
150
+ export { Cursors, LiveblocksEdge, LiveblocksFlow, LiveblocksNode, createLiveblocksFlow, useLiveblocksFlow };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import { detectDupes } from '@liveblocks/core';
2
+ import { PKG_NAME, PKG_VERSION, PKG_FORMAT } from './version.js';
3
+ export { Cursors } from './cursors.js';
4
+ export { createLiveblocksFlow, useLiveblocksFlow } from './flow.js';
5
+
6
+ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport { Cursors } from \"./cursors\";\nexport type { LiveblocksEdge, LiveblocksFlow, LiveblocksNode } from \"./flow\";\nexport { createLiveblocksFlow, useLiveblocksFlow } from \"./flow\";\n"],"names":[],"mappings":";;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var core = require('@liveblocks/core');
4
+ var version = require('./version.cjs');
5
+ var cursors = require('./cursors.cjs');
6
+ var flow = require('./flow.cjs');
7
+
8
+ core.detectDupes(version.PKG_NAME, version.PKG_VERSION, version.PKG_FORMAT);
9
+
10
+ exports.Cursors = cursors.Cursors;
11
+ exports.createLiveblocksFlow = flow.createLiveblocksFlow;
12
+ exports.useLiveblocksFlow = flow.useLiveblocksFlowSuspense;
13
+ //# sourceMappingURL=suspense.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suspense.cjs","sources":["../src/suspense.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport { Cursors } from \"./cursors\";\nexport type { LiveblocksEdge, LiveblocksFlow, LiveblocksNode } from \"./flow\";\nexport {\n createLiveblocksFlow,\n useLiveblocksFlowSuspense as useLiveblocksFlow,\n} from \"./flow\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;"}
@@ -0,0 +1,149 @@
1
+ import * as react from 'react';
2
+ import { ComponentPropsWithoutRef } from 'react';
3
+ import { LiveObject, DistributiveOmit, LsonObject, LiveMap, Resolve, JsonObject } from '@liveblocks/core';
4
+ import { Node, Edge, OnNodesChange, OnEdgesChange, OnConnect } from '@xyflow/react';
5
+
6
+ interface CursorsProps extends ComponentPropsWithoutRef<"div"> {
7
+ /**
8
+ * The key used to store the cursors in users' Presence.
9
+ *
10
+ * Defaults to `"cursor"`.
11
+ */
12
+ presenceKey?: string;
13
+ }
14
+ /**
15
+ * Displays other users' cursors inside a React Flow canvas and stores the
16
+ * current user's cursor in Presence as `{ cursor: { x, y } }`.
17
+ *
18
+ * Cursor coordinates are kept in React Flow canvas space, so panning moves
19
+ * them correctly while zooming only affects their position, not their size.
20
+ */
21
+ declare const Cursors: react.ForwardRefExoticComponent<CursorsProps & react.RefAttributes<HTMLDivElement>>;
22
+
23
+ declare const NODE_LOCAL_KEYS: ["selected", "dragging", "measured", "resizing"];
24
+ declare const EDGE_LOCAL_KEYS: ["selected"];
25
+ type SerializableNode = Node<JsonObject>;
26
+ type SerializableEdge = Edge<JsonObject>;
27
+ /**
28
+ * The Liveblocks Storage representation of a React Flow `Node`.
29
+ *
30
+ * It doesn't include local-only properties.
31
+ * The entire node and its `data` property are both stored as `LiveObject`s.
32
+ */
33
+ type LiveblocksNode<TNode extends SerializableNode = SerializableNode> = LiveObject<DistributiveOmit<TNode, (typeof NODE_LOCAL_KEYS)[number] | "data"> & {
34
+ data: LiveObject<TNode["data"]>;
35
+ } & LsonObject>;
36
+ /**
37
+ * The Liveblocks Storage representation of a React Flow `Edge`.
38
+ *
39
+ * It doesn't include local-only properties.
40
+ * The entire edge and its `data` property are both stored as `LiveObject`s.
41
+ */
42
+ type LiveblocksEdge<TEdge extends SerializableEdge = SerializableEdge> = LiveObject<DistributiveOmit<TEdge, (typeof EDGE_LOCAL_KEYS)[number] | "data"> & {
43
+ data?: LiveObject<NonNullable<TEdge["data"]>>;
44
+ } & LsonObject>;
45
+ /**
46
+ * The Liveblocks Storage representation of a React Flow diagram made of nodes and edges.
47
+ *
48
+ * Nodes and edges are stored as `LiveMap`s keyed by their IDs, enabling
49
+ * fine-grained conflict-free updates from multiple clients simultaneously.
50
+ */
51
+ type LiveblocksFlow<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge> = LiveObject<{
52
+ nodes: LiveMap<string, LiveblocksNode<TNode>>;
53
+ edges: LiveMap<string, LiveblocksEdge<TEdge>>;
54
+ }>;
55
+ type UseLiveblocksFlowResult<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge> = Resolve<({
56
+ nodes: null;
57
+ edges: null;
58
+ isLoading: true;
59
+ } | {
60
+ nodes: TNode[];
61
+ edges: TEdge[];
62
+ isLoading: false;
63
+ }) & {
64
+ onNodesChange: OnNodesChange<TNode>;
65
+ onEdgesChange: OnEdgesChange<TEdge>;
66
+ onConnect: OnConnect;
67
+ }>;
68
+ type LiveblocksFlowSuspenseResult<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge> = Extract<UseLiveblocksFlowResult<TNode, TEdge>, {
69
+ isLoading: false;
70
+ }>;
71
+ type UseLiveblocksFlowOptions<TNode extends SerializableNode, TEdge extends SerializableEdge> = {
72
+ /**
73
+ * The initial React Flow nodes and edges.
74
+ *
75
+ * @example
76
+ * ```tsx
77
+ * const { ... } = useLiveblocksFlow({
78
+ * initial: {
79
+ * nodes: [
80
+ * { id: "1", position: { x: 0, y: 0 }, data: { label: "Node 1" } },
81
+ * { id: "2", position: { x: 0, y: 100 }, data: { label: "Node 2" } },
82
+ * ],
83
+ * edges: [
84
+ * { id: "1-2", source: "1", target: "2" },
85
+ * ],
86
+ * },
87
+ * });
88
+ * ```
89
+ *
90
+ * This is equivalent to setting `initialStorage` on `RoomProvider`.
91
+ *
92
+ * @example
93
+ * ```tsx
94
+ * <RoomProvider
95
+ * initialStorage={{
96
+ * flow: createLiveblocksFlow([
97
+ * { id: "1", position: { x: 0, y: 0 }, data: { label: "Node 1" } },
98
+ * { id: "2", position: { x: 0, y: 100 }, data: { label: "Node 2" } },
99
+ * ], [
100
+ * { id: "1-2", source: "1", target: "2" },
101
+ * ]),
102
+ * }}
103
+ * />
104
+ * ```
105
+ */
106
+ initial?: {
107
+ nodes?: TNode[];
108
+ edges?: TEdge[];
109
+ };
110
+ /**
111
+ * The key used to store the React Flow diagram in Liveblocks Storage.
112
+ *
113
+ * Defaults to `"flow"`.
114
+ *
115
+ * @example
116
+ * ```tsx
117
+ * const { ... } = useLiveblocksFlow({
118
+ * storageKey: "myDiagram",
119
+ * });
120
+ * ```
121
+ */
122
+ storageKey?: string;
123
+ };
124
+ /**
125
+ * Creates a Liveblocks Storage representation of a React Flow diagram from nodes and edges.
126
+ *
127
+ * @example
128
+ * ```tsx
129
+ * <RoomProvider
130
+ * initialStorage={{
131
+ * flow: createLiveblocksFlow(initialNodes, initialEdges),
132
+ * }}
133
+ * />
134
+ * ```
135
+ */
136
+ declare function createLiveblocksFlow<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge>(nodes?: TNode[], edges?: TEdge[]): LiveblocksFlow<TNode, TEdge>;
137
+ /**
138
+ * Returns a controlled React Flow state backed by Liveblocks Storage.
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * const { nodes, edges, onNodesChange, onEdgesChange, onConnect } = useLiveblocksFlow();
143
+ *
144
+ * return <ReactFlow nodes={nodes} edges={edges} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={onConnect} />;
145
+ * ```
146
+ */
147
+ declare function useLiveblocksFlowSuspense<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge>(options?: UseLiveblocksFlowOptions<TNode, TEdge>): Resolve<LiveblocksFlowSuspenseResult<TNode, TEdge>>;
148
+
149
+ export { Cursors, LiveblocksEdge, LiveblocksFlow, LiveblocksNode, createLiveblocksFlow, useLiveblocksFlowSuspense as useLiveblocksFlow };
@@ -0,0 +1,149 @@
1
+ import * as react from 'react';
2
+ import { ComponentPropsWithoutRef } from 'react';
3
+ import { LiveObject, DistributiveOmit, LsonObject, LiveMap, Resolve, JsonObject } from '@liveblocks/core';
4
+ import { Node, Edge, OnNodesChange, OnEdgesChange, OnConnect } from '@xyflow/react';
5
+
6
+ interface CursorsProps extends ComponentPropsWithoutRef<"div"> {
7
+ /**
8
+ * The key used to store the cursors in users' Presence.
9
+ *
10
+ * Defaults to `"cursor"`.
11
+ */
12
+ presenceKey?: string;
13
+ }
14
+ /**
15
+ * Displays other users' cursors inside a React Flow canvas and stores the
16
+ * current user's cursor in Presence as `{ cursor: { x, y } }`.
17
+ *
18
+ * Cursor coordinates are kept in React Flow canvas space, so panning moves
19
+ * them correctly while zooming only affects their position, not their size.
20
+ */
21
+ declare const Cursors: react.ForwardRefExoticComponent<CursorsProps & react.RefAttributes<HTMLDivElement>>;
22
+
23
+ declare const NODE_LOCAL_KEYS: ["selected", "dragging", "measured", "resizing"];
24
+ declare const EDGE_LOCAL_KEYS: ["selected"];
25
+ type SerializableNode = Node<JsonObject>;
26
+ type SerializableEdge = Edge<JsonObject>;
27
+ /**
28
+ * The Liveblocks Storage representation of a React Flow `Node`.
29
+ *
30
+ * It doesn't include local-only properties.
31
+ * The entire node and its `data` property are both stored as `LiveObject`s.
32
+ */
33
+ type LiveblocksNode<TNode extends SerializableNode = SerializableNode> = LiveObject<DistributiveOmit<TNode, (typeof NODE_LOCAL_KEYS)[number] | "data"> & {
34
+ data: LiveObject<TNode["data"]>;
35
+ } & LsonObject>;
36
+ /**
37
+ * The Liveblocks Storage representation of a React Flow `Edge`.
38
+ *
39
+ * It doesn't include local-only properties.
40
+ * The entire edge and its `data` property are both stored as `LiveObject`s.
41
+ */
42
+ type LiveblocksEdge<TEdge extends SerializableEdge = SerializableEdge> = LiveObject<DistributiveOmit<TEdge, (typeof EDGE_LOCAL_KEYS)[number] | "data"> & {
43
+ data?: LiveObject<NonNullable<TEdge["data"]>>;
44
+ } & LsonObject>;
45
+ /**
46
+ * The Liveblocks Storage representation of a React Flow diagram made of nodes and edges.
47
+ *
48
+ * Nodes and edges are stored as `LiveMap`s keyed by their IDs, enabling
49
+ * fine-grained conflict-free updates from multiple clients simultaneously.
50
+ */
51
+ type LiveblocksFlow<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge> = LiveObject<{
52
+ nodes: LiveMap<string, LiveblocksNode<TNode>>;
53
+ edges: LiveMap<string, LiveblocksEdge<TEdge>>;
54
+ }>;
55
+ type UseLiveblocksFlowResult<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge> = Resolve<({
56
+ nodes: null;
57
+ edges: null;
58
+ isLoading: true;
59
+ } | {
60
+ nodes: TNode[];
61
+ edges: TEdge[];
62
+ isLoading: false;
63
+ }) & {
64
+ onNodesChange: OnNodesChange<TNode>;
65
+ onEdgesChange: OnEdgesChange<TEdge>;
66
+ onConnect: OnConnect;
67
+ }>;
68
+ type LiveblocksFlowSuspenseResult<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge> = Extract<UseLiveblocksFlowResult<TNode, TEdge>, {
69
+ isLoading: false;
70
+ }>;
71
+ type UseLiveblocksFlowOptions<TNode extends SerializableNode, TEdge extends SerializableEdge> = {
72
+ /**
73
+ * The initial React Flow nodes and edges.
74
+ *
75
+ * @example
76
+ * ```tsx
77
+ * const { ... } = useLiveblocksFlow({
78
+ * initial: {
79
+ * nodes: [
80
+ * { id: "1", position: { x: 0, y: 0 }, data: { label: "Node 1" } },
81
+ * { id: "2", position: { x: 0, y: 100 }, data: { label: "Node 2" } },
82
+ * ],
83
+ * edges: [
84
+ * { id: "1-2", source: "1", target: "2" },
85
+ * ],
86
+ * },
87
+ * });
88
+ * ```
89
+ *
90
+ * This is equivalent to setting `initialStorage` on `RoomProvider`.
91
+ *
92
+ * @example
93
+ * ```tsx
94
+ * <RoomProvider
95
+ * initialStorage={{
96
+ * flow: createLiveblocksFlow([
97
+ * { id: "1", position: { x: 0, y: 0 }, data: { label: "Node 1" } },
98
+ * { id: "2", position: { x: 0, y: 100 }, data: { label: "Node 2" } },
99
+ * ], [
100
+ * { id: "1-2", source: "1", target: "2" },
101
+ * ]),
102
+ * }}
103
+ * />
104
+ * ```
105
+ */
106
+ initial?: {
107
+ nodes?: TNode[];
108
+ edges?: TEdge[];
109
+ };
110
+ /**
111
+ * The key used to store the React Flow diagram in Liveblocks Storage.
112
+ *
113
+ * Defaults to `"flow"`.
114
+ *
115
+ * @example
116
+ * ```tsx
117
+ * const { ... } = useLiveblocksFlow({
118
+ * storageKey: "myDiagram",
119
+ * });
120
+ * ```
121
+ */
122
+ storageKey?: string;
123
+ };
124
+ /**
125
+ * Creates a Liveblocks Storage representation of a React Flow diagram from nodes and edges.
126
+ *
127
+ * @example
128
+ * ```tsx
129
+ * <RoomProvider
130
+ * initialStorage={{
131
+ * flow: createLiveblocksFlow(initialNodes, initialEdges),
132
+ * }}
133
+ * />
134
+ * ```
135
+ */
136
+ declare function createLiveblocksFlow<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge>(nodes?: TNode[], edges?: TEdge[]): LiveblocksFlow<TNode, TEdge>;
137
+ /**
138
+ * Returns a controlled React Flow state backed by Liveblocks Storage.
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * const { nodes, edges, onNodesChange, onEdgesChange, onConnect } = useLiveblocksFlow();
143
+ *
144
+ * return <ReactFlow nodes={nodes} edges={edges} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={onConnect} />;
145
+ * ```
146
+ */
147
+ declare function useLiveblocksFlowSuspense<TNode extends SerializableNode = SerializableNode, TEdge extends SerializableEdge = SerializableEdge>(options?: UseLiveblocksFlowOptions<TNode, TEdge>): Resolve<LiveblocksFlowSuspenseResult<TNode, TEdge>>;
148
+
149
+ export { Cursors, LiveblocksEdge, LiveblocksFlow, LiveblocksNode, createLiveblocksFlow, useLiveblocksFlowSuspense as useLiveblocksFlow };
@@ -0,0 +1,7 @@
1
+ import { detectDupes } from '@liveblocks/core';
2
+ import { PKG_NAME, PKG_VERSION, PKG_FORMAT } from './version.js';
3
+ export { Cursors } from './cursors.js';
4
+ export { createLiveblocksFlow, useLiveblocksFlowSuspense as useLiveblocksFlow } from './flow.js';
5
+
6
+ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
7
+ //# sourceMappingURL=suspense.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suspense.js","sources":["../src/suspense.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport { Cursors } from \"./cursors\";\nexport type { LiveblocksEdge, LiveblocksFlow, LiveblocksNode } from \"./flow\";\nexport {\n createLiveblocksFlow,\n useLiveblocksFlowSuspense as useLiveblocksFlow,\n} from \"./flow\";\n"],"names":[],"mappings":";;;;;AAIA,WAAY,CAAA,QAAA,EAAU,aAAa,UAAU,CAAA"}
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const PKG_NAME = "@liveblocks/react-flow";
4
+ const PKG_VERSION = typeof "3.16.0-flow1" === "string" && "3.16.0-flow1";
5
+ const PKG_FORMAT = typeof TSUP_FORMAT === "string" && TSUP_FORMAT;
6
+
7
+ exports.PKG_FORMAT = PKG_FORMAT;
8
+ exports.PKG_NAME = PKG_NAME;
9
+ exports.PKG_VERSION = PKG_VERSION;
10
+ //# sourceMappingURL=version.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.cjs","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const TSUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-flow\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof TSUP_FORMAT === \"string\" && TSUP_FORMAT;\n"],"names":[],"mappings":";;AAGO,MAAM,QAAW,GAAA,yBAAA;AACX,MAAA,WAAA,GAAc,OAAO,cAAA,KAAgB,QAAY,IAAA,eAAA;AACjD,MAAA,UAAA,GAAa,OAAO,WAAA,KAAgB,QAAY,IAAA;;;;;;"}
@@ -0,0 +1,6 @@
1
+ const PKG_NAME = "@liveblocks/react-flow";
2
+ const PKG_VERSION = typeof "3.16.0-flow1" === "string" && "3.16.0-flow1";
3
+ const PKG_FORMAT = typeof TSUP_FORMAT === "string" && TSUP_FORMAT;
4
+
5
+ export { PKG_FORMAT, PKG_NAME, PKG_VERSION };
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":["declare const __VERSION__: string;\ndeclare const TSUP_FORMAT: string;\n\nexport const PKG_NAME = \"@liveblocks/react-flow\";\nexport const PKG_VERSION = typeof __VERSION__ === \"string\" && __VERSION__;\nexport const PKG_FORMAT = typeof TSUP_FORMAT === \"string\" && TSUP_FORMAT;\n"],"names":[],"mappings":"AAGO,MAAM,QAAW,GAAA,yBAAA;AACX,MAAA,WAAA,GAAc,OAAO,cAAA,KAAgB,QAAY,IAAA,eAAA;AACjD,MAAA,UAAA,GAAa,OAAO,WAAA,KAAgB,QAAY,IAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,120 @@
1
1
  {
2
2
  "name": "@liveblocks/react-flow",
3
- "version": "0.0.0",
3
+ "version": "3.16.0-flow1",
4
+ "description": "An integration of React Flow to enable collaboration, comments, live cursors, and more with Liveblocks.",
4
5
  "license": "Apache-2.0",
5
- "main": "index.js"
6
+ "author": "Liveblocks Inc.",
7
+ "type": "module",
8
+ "main": "./dist/index.cjs",
9
+ "types": "./dist/index.d.cts",
10
+ "exports": {
11
+ ".": {
12
+ "import": {
13
+ "types": "./dist/index.d.ts",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "require": {
17
+ "types": "./dist/index.d.cts",
18
+ "module": "./dist/index.js",
19
+ "default": "./dist/index.cjs"
20
+ }
21
+ },
22
+ "./styles.css": {
23
+ "types": "./styles.css.d.cts",
24
+ "default": "./styles.css"
25
+ },
26
+ "./suspense": {
27
+ "import": {
28
+ "types": "./dist/suspense.d.ts",
29
+ "default": "./dist/suspense.js"
30
+ },
31
+ "require": {
32
+ "types": "./dist/suspense.d.cts",
33
+ "module": "./dist/suspense.js",
34
+ "default": "./dist/suspense.cjs"
35
+ }
36
+ }
37
+ },
38
+ "files": [
39
+ "dist/**",
40
+ "**/*.css",
41
+ "**/*.css.d.cts",
42
+ "**/*.css.d.ts",
43
+ "**/*.css.map",
44
+ "suspense/**",
45
+ "README.md"
46
+ ],
47
+ "scripts": {
48
+ "dev": "rollup --config rollup.config.js --watch",
49
+ "build": "rollup --config rollup.config.js",
50
+ "start": "npm run dev",
51
+ "format": "(eslint --fix src/ || true) && stylelint --fix src/styles/ && prettier --write src/",
52
+ "lint": "eslint src/ && stylelint src/styles/",
53
+ "test": "npx liveblocks dev -p 1154 -c 'vitest run --coverage'",
54
+ "test:ci": "vitest run",
55
+ "test:watch": "vitest"
56
+ },
57
+ "dependencies": {
58
+ "@liveblocks/client": "3.16.0-flow1",
59
+ "@liveblocks/core": "3.16.0-flow1",
60
+ "@liveblocks/react": "3.16.0-flow1",
61
+ "@liveblocks/react-ui": "3.16.0-flow1"
62
+ },
63
+ "peerDependencies": {
64
+ "@xyflow/react": "^12",
65
+ "react": "^18 || ^19 || ^19.0.0-rc",
66
+ "react-dom": "^18 || ^19 || ^19.0.0-rc"
67
+ },
68
+ "peerDependenciesMeta": {
69
+ "@types/react": {
70
+ "optional": true
71
+ },
72
+ "@types/react-dom": {
73
+ "optional": true
74
+ }
75
+ },
76
+ "devDependencies": {
77
+ "@liveblocks/eslint-config": "*",
78
+ "@liveblocks/rollup-config": "*",
79
+ "@liveblocks/vitest-config": "*",
80
+ "@testing-library/jest-dom": "^6.4.6",
81
+ "@testing-library/react": "^13.1.1",
82
+ "@xyflow/react": "^12.10.1",
83
+ "eslint-plugin-react": "^7.33.2",
84
+ "eslint-plugin-react-hooks": "^4.6.0",
85
+ "stylelint": "^15.10.2",
86
+ "stylelint-config-standard": "^34.0.0",
87
+ "stylelint-order": "^6.0.3",
88
+ "stylelint-plugin-logical-css": "^0.13.2"
89
+ },
90
+ "sideEffects": false,
91
+ "bugs": {
92
+ "url": "https://github.com/liveblocks/liveblocks/issues"
93
+ },
94
+ "repository": {
95
+ "type": "git",
96
+ "url": "git+https://github.com/liveblocks/liveblocks.git",
97
+ "directory": "packages/liveblocks-react-flow"
98
+ },
99
+ "homepage": "https://liveblocks.io",
100
+ "keywords": [
101
+ "xyflow",
102
+ "react-flow",
103
+ "react",
104
+ "comments",
105
+ "threads",
106
+ "liveblocks",
107
+ "real-time",
108
+ "toolkit",
109
+ "multiplayer",
110
+ "websockets",
111
+ "collaboration",
112
+ "collaborative",
113
+ "presence",
114
+ "crdts",
115
+ "synchronize",
116
+ "rooms",
117
+ "documents",
118
+ "conflict resolution"
119
+ ]
6
120
  }
@@ -0,0 +1,12 @@
1
+ .lb-react-flow-cursors {
2
+ position: absolute;
3
+ inset: 0;
4
+
5
+ /**
6
+ * Same z-index as `.react-flow__panel` (panels, `MiniMap`, `Controls`, etc.)
7
+ * https://github.com/xyflow/xyflow/blob/main/packages/system/src/styles/init.css
8
+ */
9
+ z-index: 5;
10
+ overflow: hidden;
11
+ pointer-events: none;
12
+ }
package/styles.css ADDED
@@ -0,0 +1 @@
1
+ .lb-react-flow-cursors{z-index:5;pointer-events:none;position:absolute;inset:0;overflow:hidden}
@@ -0,0 +1 @@
1
+ declare module "@liveblocks/react-flow/styles.css";
@@ -0,0 +1 @@
1
+ declare module "@liveblocks/react-flow/styles.css";
package/styles.css.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["src/styles/src/styles/index.css"],"names":[],"mappings":"AAAA,uBAAA,SAAA,CAAA,mBAAA,CAAA,iBAAA,CAAA,OAAA,CAAA,eAAA","file":"styles.css","sourcesContent":[".lb-react-flow-cursors {\n position: absolute;\n inset: 0;\n\n /**\n * Same z-index as `.react-flow__panel` (panels, `MiniMap`, `Controls`, etc.)\n * https://github.com/xyflow/xyflow/blob/main/packages/system/src/styles/init.css\n */\n z-index: 5;\n overflow: hidden;\n pointer-events: none;\n}\n"]}