@liveblocks/react-flow 3.16.0-flow1 → 3.16.0-flow2
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/README.md +51 -0
- package/dist/constants.cjs +33 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.js +29 -0
- package/dist/constants.js.map +1 -0
- package/dist/cursors.cjs +27 -18
- package/dist/cursors.cjs.map +1 -1
- package/dist/cursors.js +29 -20
- package/dist/cursors.js.map +1 -1
- package/dist/flow.cjs +174 -237
- package/dist/flow.cjs.map +1 -1
- package/dist/flow.js +179 -240
- package/dist/flow.js.map +1 -1
- package/dist/helpers.cjs +35 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.js +30 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +158 -91
- package/dist/index.d.ts +158 -91
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -18
- package/dist/suspense.cjs +0 -13
- package/dist/suspense.cjs.map +0 -1
- package/dist/suspense.d.cts +0 -149
- package/dist/suspense.d.ts +0 -149
- package/dist/suspense.js +0 -7
- package/dist/suspense.js.map +0 -1
- package/suspense/README.md +0 -5
- package/suspense/package.json +0 -4
package/dist/suspense.d.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
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 };
|
package/dist/suspense.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
package/dist/suspense.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/suspense/README.md
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
What is this directory? It exists solely to support subpath imports for node10.
|
|
2
|
-
|
|
3
|
-
While we're not interested in supporting this long-past EOL version 10 of Node,
|
|
4
|
-
we add this to acknowledge the reality that many TypeScript projects out there
|
|
5
|
-
are still using `--moduleResolution node`.
|
package/suspense/package.json
DELETED