@dxos/plugin-explorer 0.8.4-main.66e292d → 0.8.4-main.69d29f4
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/dist/lib/browser/ExplorerContainer-BFAWRIAJ.mjs +45 -0
- package/dist/lib/browser/ExplorerContainer-BFAWRIAJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ARBGXQFH.mjs → chunk-AGZAGILW.mjs} +135 -148
- package/dist/lib/{node-esm/chunk-NPIP4VEH.mjs.map → browser/chunk-AGZAGILW.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-2MKBRIUT.mjs → chunk-BZMTFAP3.mjs} +8 -5
- package/dist/lib/browser/chunk-BZMTFAP3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-P6FFFVPM.mjs → chunk-HIFLWHXR.mjs} +35 -52
- package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +7 -0
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs +177 -0
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UBHZGWZQ.mjs → chunk-YNQF4CPY.mjs} +1 -1
- package/dist/lib/browser/chunk-YNQF4CPY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +42 -54
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/react-surface-RWVHQL3J.mjs +35 -0
- package/dist/lib/browser/react-surface-RWVHQL3J.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -2
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs +46 -0
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4BY2XZET.mjs → chunk-3OE6TBJI.mjs} +35 -52
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UXZM5VJB.mjs → chunk-DK77RB6M.mjs} +1 -1
- package/dist/lib/node-esm/chunk-DK77RB6M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3ODK27PU.mjs → chunk-IPIGIQHX.mjs} +8 -5
- package/dist/lib/node-esm/chunk-IPIGIQHX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NPIP4VEH.mjs → chunk-QLMTN2XI.mjs} +135 -148
- package/dist/lib/{browser/chunk-ARBGXQFH.mjs.map → node-esm/chunk-QLMTN2XI.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs +179 -0
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +42 -54
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/{react-surface-7AAV7GBG.mjs → react-surface-3REUS7KW.mjs} +14 -13
- package/dist/lib/node-esm/react-surface-3REUS7KW.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -2
- package/dist/types/src/ExplorerPlugin.d.ts +2 -1
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/ExplorerContainer.d.ts +3 -5
- package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/adapter.d.ts +1 -1
- package/dist/types/src/components/Graph/adapter.d.ts.map +1 -1
- package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +16 -14
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +4 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/ExplorerAction.d.ts +0 -17
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
- package/dist/types/src/types/Graph.d.ts +16 -18
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +52 -48
- package/src/ExplorerPlugin.tsx +26 -40
- package/src/capabilities/index.ts +1 -4
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +30 -0
- package/src/components/Chart/Chart.stories.tsx +2 -2
- package/src/components/ExplorerContainer.tsx +6 -8
- package/src/components/Globe/Globe.stories.tsx +2 -2
- package/src/components/Graph/D3ForceGraph.stories.tsx +6 -3
- package/src/components/Graph/D3ForceGraph.tsx +2 -2
- package/src/components/Graph/ForceGraph.stories.tsx +6 -3
- package/src/components/Graph/adapter.ts +14 -8
- package/src/components/Graph/testing.ts +6 -3
- package/src/components/Tree/Tree.stories.tsx +3 -2
- package/src/components/Tree/Tree.tsx +8 -3
- package/src/components/Tree/testing/generator.ts +4 -2
- package/src/components/Tree/types/tree.test.ts +3 -1
- package/src/components/Tree/types/tree.ts +39 -18
- package/src/components/Tree/types/types.ts +1 -1
- package/src/hooks/useGraphModel.ts +6 -4
- package/src/meta.ts +2 -2
- package/src/types/ExplorerAction.ts +0 -16
- package/src/types/Graph.ts +5 -6
- package/dist/lib/browser/ExplorerContainer-NOLLVUTE.mjs +0 -50
- package/dist/lib/browser/ExplorerContainer-NOLLVUTE.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
- package/dist/lib/browser/chunk-6BVXZQPP.mjs +0 -188
- package/dist/lib/browser/chunk-6BVXZQPP.mjs.map +0 -7
- package/dist/lib/browser/chunk-P6FFFVPM.mjs.map +0 -7
- package/dist/lib/browser/chunk-UBHZGWZQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-EWB3H5KH.mjs +0 -35
- package/dist/lib/browser/intent-resolver-EWB3H5KH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BY2DYCTH.mjs +0 -34
- package/dist/lib/browser/react-surface-BY2DYCTH.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-N3S5KSUX.mjs +0 -51
- package/dist/lib/node-esm/ExplorerContainer-N3S5KSUX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4BY2XZET.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CRSVAZNA.mjs +0 -190
- package/dist/lib/node-esm/chunk-CRSVAZNA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UXZM5VJB.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-SH6PW7VF.mjs +0 -36
- package/dist/lib/node-esm/intent-resolver-SH6PW7VF.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7AAV7GBG.mjs.map +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -23
- package/src/capabilities/react-surface.tsx +0 -26
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Key, Obj, Type } from '@dxos/echo';
|
|
8
|
+
import { TestSchema } from '@dxos/echo/testing';
|
|
8
9
|
import { invariant } from '@dxos/invariant';
|
|
9
10
|
|
|
10
11
|
// TODO(burdon): Reconcile with @dxos/graph (i.e., common types).
|
|
@@ -13,7 +14,7 @@ export const TreeNodeType = Schema.Struct({
|
|
|
13
14
|
id: Key.ObjectId,
|
|
14
15
|
children: Schema.mutable(Schema.Array(Key.ObjectId)),
|
|
15
16
|
data: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
16
|
-
ref: Schema.optional(Type.Ref(
|
|
17
|
+
ref: Schema.optional(Type.Ref(TestSchema.Expando)),
|
|
17
18
|
}).pipe(Schema.mutable);
|
|
18
19
|
|
|
19
20
|
export interface TreeNodeType extends Schema.Schema.Type<typeof TreeNodeType> {}
|
|
@@ -22,7 +23,7 @@ export const TreeType = Schema.Struct({
|
|
|
22
23
|
root: Key.ObjectId,
|
|
23
24
|
nodes: Schema.mutable(Schema.Record({ key: Key.ObjectId, value: TreeNodeType })),
|
|
24
25
|
}).pipe(
|
|
25
|
-
Type.
|
|
26
|
+
Type.object({
|
|
26
27
|
typename: 'dxos.org/type/Tree',
|
|
27
28
|
version: '0.1.0',
|
|
28
29
|
}),
|
|
@@ -184,9 +185,11 @@ export class Tree {
|
|
|
184
185
|
clear(): void {
|
|
185
186
|
const root = this._tree.nodes[this._tree.root];
|
|
186
187
|
root.children.length = 0;
|
|
187
|
-
this._tree
|
|
188
|
-
|
|
189
|
-
|
|
188
|
+
Obj.change(this._tree, (t) => {
|
|
189
|
+
t.nodes = {
|
|
190
|
+
[root.id]: root,
|
|
191
|
+
};
|
|
192
|
+
});
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
/**
|
|
@@ -198,8 +201,11 @@ export class Tree {
|
|
|
198
201
|
node = { id, children: [], data: { text: '' } }; // TODO(burdon): Generic.
|
|
199
202
|
}
|
|
200
203
|
|
|
201
|
-
|
|
202
|
-
|
|
204
|
+
const nodeToAdd = node;
|
|
205
|
+
Obj.change(this._tree, (t) => {
|
|
206
|
+
t.nodes[nodeToAdd.id] = nodeToAdd;
|
|
207
|
+
parent.children.splice(index ?? parent.children.length, 0, nodeToAdd.id);
|
|
208
|
+
});
|
|
203
209
|
return node;
|
|
204
210
|
}
|
|
205
211
|
|
|
@@ -212,10 +218,14 @@ export class Tree {
|
|
|
212
218
|
return undefined;
|
|
213
219
|
}
|
|
214
220
|
|
|
215
|
-
|
|
221
|
+
Obj.change(this._tree, (t) => {
|
|
222
|
+
delete t.nodes[node.id];
|
|
223
|
+
});
|
|
216
224
|
const idx = parent.children.findIndex((child) => child === id);
|
|
217
225
|
if (idx !== -1) {
|
|
218
|
-
|
|
226
|
+
Obj.change(this._tree, () => {
|
|
227
|
+
parent.children.splice(idx, 1);
|
|
228
|
+
});
|
|
219
229
|
}
|
|
220
230
|
|
|
221
231
|
return node;
|
|
@@ -232,8 +242,10 @@ export class Tree {
|
|
|
232
242
|
}
|
|
233
243
|
|
|
234
244
|
const child = node.children[from];
|
|
235
|
-
|
|
236
|
-
|
|
245
|
+
Obj.change(this._tree, () => {
|
|
246
|
+
node.children.splice(from, 1);
|
|
247
|
+
node.children.splice(to, 0, child);
|
|
248
|
+
});
|
|
237
249
|
return this.getNode(child);
|
|
238
250
|
}
|
|
239
251
|
|
|
@@ -252,8 +264,10 @@ export class Tree {
|
|
|
252
264
|
}
|
|
253
265
|
|
|
254
266
|
const previous = this.getNode(parent.children[idx - 1]);
|
|
255
|
-
|
|
256
|
-
|
|
267
|
+
Obj.change(this._tree, () => {
|
|
268
|
+
parent.children.splice(idx, 1);
|
|
269
|
+
previous.children.push(node.id);
|
|
270
|
+
});
|
|
257
271
|
}
|
|
258
272
|
|
|
259
273
|
/**
|
|
@@ -270,16 +284,23 @@ export class Tree {
|
|
|
270
284
|
return;
|
|
271
285
|
}
|
|
272
286
|
|
|
273
|
-
// Remove node from parent.
|
|
287
|
+
// Remove node from parent and get following siblings.
|
|
274
288
|
const nodeIdx = parent.children.findIndex((id) => id === node.id);
|
|
275
|
-
|
|
276
|
-
|
|
289
|
+
let rest: Key.ObjectId[] = [];
|
|
290
|
+
Obj.change(this._tree, () => {
|
|
291
|
+
const removed = parent.children.splice(nodeIdx, parent.children.length - nodeIdx);
|
|
292
|
+
rest = removed.slice(1); // Skip the node itself.
|
|
293
|
+
});
|
|
277
294
|
|
|
278
295
|
// Add to ancestor.
|
|
279
296
|
const parentIdx = this.getChildNodes(ancestor).findIndex((n) => n.id === parent.id);
|
|
280
|
-
|
|
297
|
+
Obj.change(this._tree, () => {
|
|
298
|
+
ancestor.children.splice(parentIdx + 1, 0, node.id);
|
|
299
|
+
});
|
|
281
300
|
|
|
282
301
|
// Transplant following siblings to current node.
|
|
283
|
-
|
|
302
|
+
Obj.change(this._tree, () => {
|
|
303
|
+
node.children.push(...rest);
|
|
304
|
+
});
|
|
284
305
|
}
|
|
285
306
|
}
|
|
@@ -10,7 +10,7 @@ export type TreeNode = {
|
|
|
10
10
|
children?: TreeNode[];
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
export const mapGraphToTreeData = (model: GraphModel, maxDepth = 8): TreeNode | undefined => {
|
|
13
|
+
export const mapGraphToTreeData = (model: GraphModel.GraphModel, maxDepth = 8): TreeNode | undefined => {
|
|
14
14
|
// TODO(burdon): Convert to common/graph.
|
|
15
15
|
// const mapNode = (node: N, depth = 0): TreeNode => {
|
|
16
16
|
// const treeNode: TreeNode = {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import { useContext, useEffect, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
import { type Filter, type Queue, type Space } from '@dxos/client/echo';
|
|
8
9
|
import { SpaceGraphModel, type SpaceGraphModelOptions } from '@dxos/schema';
|
|
@@ -14,6 +15,7 @@ export const useGraphModel = (
|
|
|
14
15
|
options?: SpaceGraphModelOptions,
|
|
15
16
|
queue?: Queue,
|
|
16
17
|
): SpaceGraphModel | undefined => {
|
|
18
|
+
const registry = useContext(RegistryContext);
|
|
17
19
|
const [model, setModel] = useState<SpaceGraphModel | undefined>(undefined);
|
|
18
20
|
useEffect(() => {
|
|
19
21
|
if (!space) {
|
|
@@ -24,13 +26,13 @@ export const useGraphModel = (
|
|
|
24
26
|
|
|
25
27
|
// TODO(burdon): Does this need to be a dependency?
|
|
26
28
|
if (!model || model.queue !== queue) {
|
|
27
|
-
const model = new SpaceGraphModel().setFilter(filter).setOptions(options);
|
|
28
|
-
void model.open(space, queue);
|
|
29
|
+
const model = new SpaceGraphModel(registry).setFilter(filter).setOptions(options);
|
|
30
|
+
void model.open(space.db, queue);
|
|
29
31
|
setModel(model);
|
|
30
32
|
} else {
|
|
31
33
|
model.setFilter(filter).setOptions(options);
|
|
32
34
|
}
|
|
33
|
-
}, [space, filter, options, queue]);
|
|
35
|
+
}, [space, filter, options, queue, registry]);
|
|
34
36
|
|
|
35
37
|
return model;
|
|
36
38
|
};
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
6
|
import { trim } from '@dxos/util';
|
|
7
7
|
|
|
8
|
-
export const meta:
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
9
|
id: 'dxos.org/plugin/explorer',
|
|
10
10
|
name: 'Explorer',
|
|
11
11
|
description: trim`
|
|
@@ -5,13 +5,6 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';
|
|
8
|
-
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
9
|
-
|
|
10
|
-
import { meta } from '../meta';
|
|
11
|
-
|
|
12
|
-
import * as Graph from './Graph';
|
|
13
|
-
|
|
14
|
-
const EXPLORER_ACTION = `${meta.id}/action`;
|
|
15
8
|
|
|
16
9
|
export const GraphProps = Schema.Struct({
|
|
17
10
|
name: Schema.optional(Schema.String),
|
|
@@ -26,12 +19,3 @@ export const GraphProps = Schema.Struct({
|
|
|
26
19
|
Schema.optional,
|
|
27
20
|
),
|
|
28
21
|
});
|
|
29
|
-
|
|
30
|
-
export class CreateGraph extends Schema.TaggedClass<CreateGraph>()(`${EXPLORER_ACTION}/create-graph`, {
|
|
31
|
-
input: Schema.Struct({
|
|
32
|
-
space: SpaceSchema,
|
|
33
|
-
}).pipe(Schema.extend(GraphProps)),
|
|
34
|
-
output: Schema.Struct({
|
|
35
|
-
object: Graph.Graph,
|
|
36
|
-
}),
|
|
37
|
-
}) {}
|
package/src/types/Graph.ts
CHANGED
|
@@ -16,9 +16,9 @@ const GraphSchema = Schema.Struct({
|
|
|
16
16
|
query: Schema.Struct({
|
|
17
17
|
raw: Schema.optional(Schema.String),
|
|
18
18
|
ast: QueryAST.Query,
|
|
19
|
-
}).pipe(
|
|
19
|
+
}).pipe(FormInputAnnotation.set(false)),
|
|
20
20
|
}).pipe(
|
|
21
|
-
Type.
|
|
21
|
+
Type.object({
|
|
22
22
|
typename: 'dxos.org/type/Graph',
|
|
23
23
|
version: '0.2.0',
|
|
24
24
|
}),
|
|
@@ -26,8 +26,7 @@ const GraphSchema = Schema.Struct({
|
|
|
26
26
|
ViewAnnotation.set(true),
|
|
27
27
|
);
|
|
28
28
|
export interface Graph extends Schema.Schema.Type<typeof GraphSchema> {}
|
|
29
|
-
export
|
|
30
|
-
export const Graph: Schema.Schema<Graph, GraphEncoded> = GraphSchema;
|
|
29
|
+
export const Graph: Type.Obj<Graph> = GraphSchema as any;
|
|
31
30
|
|
|
32
31
|
type MakeProps = Omit<Partial<Obj.MakeProps<typeof Graph>>, 'view'> & {
|
|
33
32
|
view: View.View;
|
|
@@ -53,9 +52,9 @@ export const GraphV1 = Schema.Struct({
|
|
|
53
52
|
query: Schema.Struct({
|
|
54
53
|
raw: Schema.optional(Schema.String),
|
|
55
54
|
ast: QueryAST.Query,
|
|
56
|
-
})
|
|
55
|
+
}),
|
|
57
56
|
}).pipe(
|
|
58
|
-
Type.
|
|
57
|
+
Type.object({
|
|
59
58
|
typename: 'dxos.org/type/Graph',
|
|
60
59
|
version: '0.1.0',
|
|
61
60
|
}),
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useGraphModel
|
|
3
|
-
} from "./chunk-2MKBRIUT.mjs";
|
|
4
|
-
import {
|
|
5
|
-
D3ForceGraph
|
|
6
|
-
} from "./chunk-6BVXZQPP.mjs";
|
|
7
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
8
|
-
|
|
9
|
-
// src/components/ExplorerContainer.tsx
|
|
10
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
11
|
-
import React, { useCallback, useMemo, useState } from "react";
|
|
12
|
-
import { QueryBuilder } from "@dxos/echo-query";
|
|
13
|
-
import { useGlobalSearch } from "@dxos/plugin-search";
|
|
14
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
15
|
-
import { Toolbar } from "@dxos/react-ui";
|
|
16
|
-
import { QueryEditor } from "@dxos/react-ui-components";
|
|
17
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
18
|
-
var ExplorerContainer = ({ role, view }) => {
|
|
19
|
-
var _effect = _useSignals();
|
|
20
|
-
try {
|
|
21
|
-
const space = getSpace(view);
|
|
22
|
-
const [filter, setFilter] = useState();
|
|
23
|
-
const model = useGraphModel(space, filter);
|
|
24
|
-
const { match } = useGlobalSearch();
|
|
25
|
-
const builder = useMemo(() => new QueryBuilder(), []);
|
|
26
|
-
const handleChange = useCallback((value) => {
|
|
27
|
-
setFilter(builder.build(value).filter);
|
|
28
|
-
}, []);
|
|
29
|
-
const showToolbar = role === "article";
|
|
30
|
-
if (!space || !model) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
34
|
-
toolbar: showToolbar
|
|
35
|
-
}, showToolbar && /* @__PURE__ */ React.createElement(Toolbar.Root, null, /* @__PURE__ */ React.createElement(QueryEditor, {
|
|
36
|
-
db: space.db,
|
|
37
|
-
onChange: handleChange
|
|
38
|
-
})), /* @__PURE__ */ React.createElement(D3ForceGraph, {
|
|
39
|
-
model,
|
|
40
|
-
match
|
|
41
|
-
}));
|
|
42
|
-
} finally {
|
|
43
|
-
_effect.f();
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
var ExplorerContainer_default = ExplorerContainer;
|
|
47
|
-
export {
|
|
48
|
-
ExplorerContainer_default as default
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=ExplorerContainer-NOLLVUTE.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/ExplorerContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback, useMemo, useState } from 'react';\n\nimport { type Filter } from '@dxos/echo';\nimport { QueryBuilder } from '@dxos/echo-query';\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Toolbar } from '@dxos/react-ui';\nimport { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';\nimport { StackItem } from '@dxos/react-ui-stack';\nimport { type View } from '@dxos/schema';\n\nimport { useGraphModel } from '../hooks';\n\nimport { D3ForceGraph } from './Graph';\n\ntype ExplorerContainerProps = {\n role: string;\n view: View.View;\n};\n\nconst ExplorerContainer = ({ role, view }: ExplorerContainerProps) => {\n const space = getSpace(view);\n const [filter, setFilter] = useState<Filter.Any>();\n const model = useGraphModel(space, filter);\n const { match } = useGlobalSearch();\n\n const builder = useMemo(() => new QueryBuilder(), []);\n const handleChange = useCallback<NonNullable<QueryEditorProps['onChange']>>((value) => {\n setFilter(builder.build(value).filter);\n }, []);\n\n const showToolbar = role === 'article';\n\n if (!space || !model) {\n return null;\n }\n\n return (\n <StackItem.Content toolbar={showToolbar}>\n {showToolbar && (\n <Toolbar.Root>\n <QueryEditor db={space.db} onChange={handleChange} />\n </Toolbar.Root>\n )}\n <D3ForceGraph model={model} match={match} />\n </StackItem.Content>\n );\n};\n\nexport default ExplorerContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;AAIA,OAAOA,SAASC,aAAaC,SAASC,gBAAgB;AAGtD,SAASC,oBAAoB;AAC7B,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AACzB,SAASC,eAAe;AACxB,SAASC,mBAA0C;AACnD,SAASC,iBAAiB;AAY1B,IAAMC,oBAAoB,CAAC,EAAEC,MAAMC,KAAI,MAA0B;;;AAC/D,UAAMC,QAAQC,SAASF,IAAAA;AACvB,UAAM,CAACG,QAAQC,SAAAA,IAAaC,SAAAA;AAC5B,UAAMC,QAAQC,cAAcN,OAAOE,MAAAA;AACnC,UAAM,EAAEK,MAAK,IAAKC,gBAAAA;AAElB,UAAMC,UAAUC,QAAQ,MAAM,IAAIC,aAAAA,GAAgB,CAAA,CAAE;AACpD,UAAMC,eAAeC,YAAuD,CAACC,UAAAA;AAC3EX,gBAAUM,QAAQM,MAAMD,KAAAA,EAAOZ,MAAM;IACvC,GAAG,CAAA,CAAE;AAEL,UAAMc,cAAclB,SAAS;AAE7B,QAAI,CAACE,SAAS,CAACK,OAAO;AACpB,aAAO;IACT;AAEA,WACE,sBAAA,cAACY,UAAUC,SAAO;MAACC,SAASH;OACzBA,eACC,sBAAA,cAACI,QAAQC,MAAI,MACX,sBAAA,cAACC,aAAAA;MAAYC,IAAIvB,MAAMuB;MAAIC,UAAUZ;SAGzC,sBAAA,cAACa,cAAAA;MAAapB;MAAcE;;;;;AAGlC;AAEA,IAAA,4BAAeV;",
|
|
6
|
-
"names": ["React", "useCallback", "useMemo", "useState", "QueryBuilder", "useGlobalSearch", "getSpace", "Toolbar", "QueryEditor", "StackItem", "ExplorerContainer", "role", "view", "space", "getSpace", "filter", "setFilter", "useState", "model", "useGraphModel", "match", "useGlobalSearch", "builder", "useMemo", "QueryBuilder", "handleChange", "useCallback", "value", "build", "showToolbar", "StackItem", "Content", "toolbar", "Toolbar", "Root", "QueryEditor", "db", "onChange", "D3ForceGraph"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useGraphModel.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Filter, type Queue, type Space } from '@dxos/client/echo';\nimport { SpaceGraphModel, type SpaceGraphModelOptions } from '@dxos/schema';\n\n// TODO(burdon): Factor out.\nexport const useGraphModel = (\n space: Space | undefined,\n filter?: Filter.Any | undefined,\n options?: SpaceGraphModelOptions,\n queue?: Queue,\n): SpaceGraphModel | undefined => {\n const [model, setModel] = useState<SpaceGraphModel | undefined>(undefined);\n useEffect(() => {\n if (!space) {\n void model?.close();\n setModel(undefined);\n return;\n }\n\n // TODO(burdon): Does this need to be a dependency?\n if (!model || model.queue !== queue) {\n const model = new SpaceGraphModel().setFilter(filter).setOptions(options);\n void model.open(space, queue);\n setModel(model);\n } else {\n model.setFilter(filter).setOptions(options);\n }\n }, [space, filter, options, queue]);\n\n return model;\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,WAAWC,gBAAgB;AAGpC,SAASC,uBAAoD;AAGtD,IAAMC,gBAAgB,CAC3BC,OACAC,QACAC,SACAC,UAAAA;AAEA,QAAM,CAACC,OAAOC,QAAAA,IAAYC,SAAsCC,MAAAA;AAChEC,YAAU,MAAA;AACR,QAAI,CAACR,OAAO;AACV,WAAKI,OAAOK,MAAAA;AACZJ,eAASE,MAAAA;AACT;IACF;AAGA,QAAI,CAACH,SAASA,MAAMD,UAAUA,OAAO;AACnC,YAAMC,SAAQ,IAAIM,gBAAAA,EAAkBC,UAAUV,MAAAA,EAAQW,WAAWV,OAAAA;AACjE,WAAKE,OAAMS,KAAKb,OAAOG,KAAAA;AACvBE,eAASD,MAAAA;IACX,OAAO;AACLA,YAAMO,UAAUV,MAAAA,EAAQW,WAAWV,OAAAA;IACrC;EACF,GAAG;IAACF;IAAOC;IAAQC;IAASC;GAAM;AAElC,SAAOC;AACT;",
|
|
6
|
-
"names": ["useEffect", "useState", "SpaceGraphModel", "useGraphModel", "space", "filter", "options", "queue", "model", "setModel", "useState", "undefined", "useEffect", "close", "SpaceGraphModel", "setFilter", "setOptions", "open"]
|
|
7
|
-
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
// src/components/Graph/D3ForceGraph.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
4
|
-
import { Obj } from "@dxos/echo";
|
|
5
|
-
import { SelectionModel } from "@dxos/graph";
|
|
6
|
-
import { GraphForceProjector, SVG } from "@dxos/react-ui-graph";
|
|
7
|
-
import { getHashStyles } from "@dxos/react-ui-theme";
|
|
8
|
-
import "@dxos/react-ui-graph/styles/graph.css";
|
|
9
|
-
var D3ForceGraph = ({ classNames, model, selection: _selection, grid, ...props }) => {
|
|
10
|
-
var _effect = _useSignals();
|
|
11
|
-
try {
|
|
12
|
-
const context = useRef(null);
|
|
13
|
-
const projector = useMemo(() => {
|
|
14
|
-
if (context.current) {
|
|
15
|
-
return new GraphForceProjector(context.current, {
|
|
16
|
-
attributes: {
|
|
17
|
-
linkForce: (edge) => {
|
|
18
|
-
return edge.data?.object?.active !== false;
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
forces: {
|
|
22
|
-
point: {
|
|
23
|
-
strength: 0.01
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}, [
|
|
29
|
-
context.current
|
|
30
|
-
]);
|
|
31
|
-
const graph = useRef(null);
|
|
32
|
-
const selection = useMemo(() => _selection ?? new SelectionModel(), [
|
|
33
|
-
_selection
|
|
34
|
-
]);
|
|
35
|
-
useEffect(() => graph.current?.repaint(), [
|
|
36
|
-
selection.selected.value
|
|
37
|
-
]);
|
|
38
|
-
const handleSelect = useCallback((node) => {
|
|
39
|
-
if (selection.contains(node.id)) {
|
|
40
|
-
selection.remove(node.id);
|
|
41
|
-
} else {
|
|
42
|
-
selection.add(node.id);
|
|
43
|
-
}
|
|
44
|
-
}, [
|
|
45
|
-
selection
|
|
46
|
-
]);
|
|
47
|
-
return /* @__PURE__ */ React.createElement(SVG.Root, {
|
|
48
|
-
ref: context,
|
|
49
|
-
classNames
|
|
50
|
-
}, /* @__PURE__ */ React.createElement(SVG.Markers, null), grid && /* @__PURE__ */ React.createElement(SVG.Grid, {
|
|
51
|
-
axis: true
|
|
52
|
-
}), /* @__PURE__ */ React.createElement(SVG.Zoom, {
|
|
53
|
-
extent: [
|
|
54
|
-
1 / 2,
|
|
55
|
-
2
|
|
56
|
-
]
|
|
57
|
-
}, /* @__PURE__ */ React.createElement(SVG.Graph, {
|
|
58
|
-
...props,
|
|
59
|
-
ref: graph,
|
|
60
|
-
model,
|
|
61
|
-
projector,
|
|
62
|
-
labels: {
|
|
63
|
-
text: (node) => {
|
|
64
|
-
return node.data?.data.label ?? node.id;
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
attributes: {
|
|
68
|
-
node: (node) => {
|
|
69
|
-
const obj = node.data?.data.object;
|
|
70
|
-
return {
|
|
71
|
-
data: {
|
|
72
|
-
color: getHashStyles(obj && Obj.getTypename(obj))?.hue
|
|
73
|
-
},
|
|
74
|
-
classes: {
|
|
75
|
-
"dx-selected": selection.contains(node.id)
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
onSelect: handleSelect
|
|
81
|
-
})));
|
|
82
|
-
} finally {
|
|
83
|
-
_effect.f();
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
// src/components/Graph/ForceGraph.tsx
|
|
88
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
89
|
-
import { forceLink, forceManyBody } from "d3";
|
|
90
|
-
import NativeForceGraph from "force-graph";
|
|
91
|
-
import React2, { useEffect as useEffect2, useRef as useRef2, useState } from "react";
|
|
92
|
-
import { useResizeDetector } from "react-resize-detector";
|
|
93
|
-
import { filterObjectsSync } from "@dxos/plugin-search";
|
|
94
|
-
|
|
95
|
-
// src/components/Graph/adapter.ts
|
|
96
|
-
var GraphAdapter = class {
|
|
97
|
-
graph;
|
|
98
|
-
_nodes = [];
|
|
99
|
-
_links = [];
|
|
100
|
-
constructor(graph) {
|
|
101
|
-
this.graph = graph;
|
|
102
|
-
this._nodes = graph.nodes.map((node) => ({
|
|
103
|
-
id: node.id,
|
|
104
|
-
type: node.type,
|
|
105
|
-
data: node.data
|
|
106
|
-
}));
|
|
107
|
-
this._links = graph.edges.map((edge) => ({
|
|
108
|
-
type: edge.type,
|
|
109
|
-
source: edge.source,
|
|
110
|
-
target: edge.target,
|
|
111
|
-
data: edge.data
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
get nodes() {
|
|
115
|
-
return this._nodes;
|
|
116
|
-
}
|
|
117
|
-
get links() {
|
|
118
|
-
return this._links;
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// src/components/Graph/ForceGraph.tsx
|
|
123
|
-
var ForceGraph = ({ model, match }) => {
|
|
124
|
-
var _effect = _useSignals2();
|
|
125
|
-
try {
|
|
126
|
-
const { ref, width, height } = useResizeDetector({
|
|
127
|
-
refreshRate: 200
|
|
128
|
-
});
|
|
129
|
-
const rootRef = useRef2(null);
|
|
130
|
-
const forceGraph = useRef2(null);
|
|
131
|
-
const filteredRef = useRef2([]);
|
|
132
|
-
filteredRef.current = filterObjectsSync(model?.objects ?? [], match);
|
|
133
|
-
const [data, setData] = useState();
|
|
134
|
-
useEffect2(() => {
|
|
135
|
-
return model?.subscribe((model2) => {
|
|
136
|
-
setData(new GraphAdapter(model2.graph));
|
|
137
|
-
});
|
|
138
|
-
}, [
|
|
139
|
-
model
|
|
140
|
-
]);
|
|
141
|
-
useEffect2(() => {
|
|
142
|
-
if (rootRef.current) {
|
|
143
|
-
forceGraph.current = new NativeForceGraph(rootRef.current).nodeRelSize(6).nodeLabel((node) => node.type === "schema" ? node.data.typename : node.data.label ?? node.id).nodeAutoColorBy((node) => node.type === "schema" ? "schema" : node.data.typename).linkAutoColorBy((link) => link.type);
|
|
144
|
-
}
|
|
145
|
-
return () => {
|
|
146
|
-
forceGraph.current?.pauseAnimation().graphData({
|
|
147
|
-
nodes: [],
|
|
148
|
-
links: []
|
|
149
|
-
});
|
|
150
|
-
forceGraph.current = null;
|
|
151
|
-
};
|
|
152
|
-
}, []);
|
|
153
|
-
useEffect2(() => {
|
|
154
|
-
if (!data || !width || !height || !forceGraph.current) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
forceGraph.current.pauseAnimation().width(width).height(height).onEngineStop(() => {
|
|
158
|
-
handleZoomToFit();
|
|
159
|
-
}).onNodeClick((node) => {
|
|
160
|
-
forceGraph.current?.emitParticle(node);
|
|
161
|
-
}).d3Force("link", forceLink().distance(160).strength(0.5)).d3Force("charge", forceManyBody().strength(-30)).graphData(data).warmupTicks(100).cooldownTime(1e3).resumeAnimation();
|
|
162
|
-
}, [
|
|
163
|
-
data,
|
|
164
|
-
width,
|
|
165
|
-
height,
|
|
166
|
-
forceGraph.current
|
|
167
|
-
]);
|
|
168
|
-
const handleZoomToFit = () => {
|
|
169
|
-
forceGraph.current?.zoomToFit(400, 40);
|
|
170
|
-
};
|
|
171
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
172
|
-
ref,
|
|
173
|
-
className: "relative grow",
|
|
174
|
-
onClick: handleZoomToFit
|
|
175
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
176
|
-
ref: rootRef,
|
|
177
|
-
className: "absolute inset-0"
|
|
178
|
-
}));
|
|
179
|
-
} finally {
|
|
180
|
-
_effect.f();
|
|
181
|
-
}
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export {
|
|
185
|
-
D3ForceGraph,
|
|
186
|
-
ForceGraph
|
|
187
|
-
};
|
|
188
|
-
//# sourceMappingURL=chunk-6BVXZQPP.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/Graph/D3ForceGraph.tsx", "../../../src/components/Graph/ForceGraph.tsx", "../../../src/components/Graph/adapter.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { SelectionModel } from '@dxos/graph';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport {\n type GraphController,\n GraphForceProjector,\n type GraphLayoutNode,\n type GraphProps,\n SVG,\n type SVGContext,\n} from '@dxos/react-ui-graph';\nimport { getHashStyles } from '@dxos/react-ui-theme';\nimport { type SpaceGraphEdge, type SpaceGraphModel, type SpaceGraphNode } from '@dxos/schema';\n\nimport '@dxos/react-ui-graph/styles/graph.css';\n\nexport type D3ForceGraphProps = ThemedClassName<\n {\n model?: SpaceGraphModel;\n match?: RegExp;\n selection?: SelectionModel;\n grid?: boolean;\n } & Pick<GraphProps, 'drag'>\n>;\n\nexport const D3ForceGraph = ({ classNames, model, selection: _selection, grid, ...props }: D3ForceGraphProps) => {\n const context = useRef<SVGContext>(null);\n const projector = useMemo<GraphForceProjector | undefined>(() => {\n if (context.current) {\n return new GraphForceProjector(context.current, {\n attributes: {\n linkForce: (edge) => {\n // TODO(burdon): Check type (currently assumes Employee property).\n // Edge shouldn't contribute to force if it's not active.\n return edge.data?.object?.active !== false;\n },\n },\n forces: {\n point: {\n strength: 0.01,\n },\n },\n });\n }\n }, [context.current]);\n\n const graph = useRef<GraphController>(null);\n const selection = useMemo(() => _selection ?? new SelectionModel(), [_selection]);\n useEffect(() => graph.current?.repaint(), [selection.selected.value]);\n\n const handleSelect = useCallback<NonNullable<GraphProps['onSelect']>>(\n (node) => {\n if (selection.contains(node.id)) {\n selection.remove(node.id);\n } else {\n selection.add(node.id);\n }\n },\n [selection],\n );\n\n return (\n <SVG.Root ref={context} classNames={classNames}>\n <SVG.Markers />\n {grid && <SVG.Grid axis />}\n <SVG.Zoom extent={[1 / 2, 2]}>\n <SVG.Graph<SpaceGraphNode, SpaceGraphEdge>\n {...props}\n ref={graph}\n model={model}\n projector={projector}\n labels={{\n text: (node) => {\n return node.data?.data.label ?? node.id;\n },\n }}\n attributes={{\n node: (node: GraphLayoutNode<SpaceGraphNode>) => {\n const obj = node.data?.data.object;\n return {\n data: {\n color: getHashStyles(obj && Obj.getTypename(obj))?.hue,\n },\n classes: {\n 'dx-selected': selection.contains(node.id),\n },\n };\n },\n }}\n onSelect={handleSelect}\n />\n </SVG.Zoom>\n </SVG.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { forceLink, forceManyBody } from 'd3';\nimport NativeForceGraph from 'force-graph';\nimport React, { type FC, useEffect, useRef, useState } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type SearchResult, filterObjectsSync } from '@dxos/plugin-search';\nimport { type SpaceGraphModel } from '@dxos/schema';\n\nimport { GraphAdapter } from './adapter';\n\nexport type ForceGraphProps = {\n model?: SpaceGraphModel;\n match?: RegExp;\n};\n\nexport const ForceGraph: FC<ForceGraphProps> = ({ model, match }) => {\n const { ref, width, height } = useResizeDetector({ refreshRate: 200 });\n const rootRef = useRef<HTMLDivElement>(null);\n const forceGraph = useRef<NativeForceGraph>(null);\n\n const filteredRef = useRef<SearchResult[]>([]);\n filteredRef.current = filterObjectsSync(model?.objects ?? [], match);\n\n const [data, setData] = useState<GraphAdapter>();\n useEffect(() => {\n return model?.subscribe((model) => {\n setData(new GraphAdapter(model.graph));\n });\n }, [model]);\n\n useEffect(() => {\n if (rootRef.current) {\n // https://github.com/vasturiano/force-graph\n // https://github.com/vasturiano/3d-force-graph\n forceGraph.current = new NativeForceGraph(rootRef.current)\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#node-styling\n .nodeRelSize(6)\n .nodeLabel((node: any) => (node.type === 'schema' ? node.data.typename : (node.data.label ?? node.id)))\n .nodeAutoColorBy((node: any) => (node.type === 'schema' ? 'schema' : node.data.typename))\n\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#link-styling\n .linkAutoColorBy((link: any) => link.type);\n }\n\n return () => {\n forceGraph.current?.pauseAnimation().graphData({ nodes: [], links: [] });\n forceGraph.current = null;\n };\n }, []);\n\n useEffect(() => {\n if (!data || !width || !height || !forceGraph.current) {\n return;\n }\n\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#container-layout\n forceGraph.current\n .pauseAnimation()\n .width(width)\n .height(height)\n .onEngineStop(() => {\n handleZoomToFit();\n })\n .onNodeClick((node: any) => {\n forceGraph.current?.emitParticle(node);\n })\n\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#force-engine-d3-force-configuration\n // .d3Force('center', forceCenter().strength(0.9))\n .d3Force('link', forceLink().distance(160).strength(0.5))\n .d3Force('charge', forceManyBody().strength(-30))\n\n .graphData(data)\n .warmupTicks(100)\n .cooldownTime(1_000)\n .resumeAnimation();\n }, [data, width, height, forceGraph.current]);\n\n const handleZoomToFit = () => {\n forceGraph.current?.zoomToFit(400, 40);\n };\n\n return (\n <div ref={ref} className='relative grow' onClick={handleZoomToFit}>\n <div ref={rootRef} className='absolute inset-0' />\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Graph } from '@dxos/graph';\n\nexport type GraphNode = {\n id?: string;\n};\n\nexport type GraphLink = {\n source?: string;\n target?: string;\n};\n\nexport type GraphData = {\n nodes: GraphNode[];\n links: GraphLink[];\n};\n\n/**\n * Map common graph to force-graph format.\n */\nexport class GraphAdapter implements GraphData {\n private readonly _nodes: GraphNode[] = [];\n private readonly _links: GraphLink[] = [];\n\n constructor(private readonly graph: Graph) {\n this._nodes = graph.nodes.map((node) => ({\n id: node.id,\n type: node.type,\n data: node.data,\n }));\n\n this._links = graph.edges.map((edge) => ({\n type: edge.type,\n source: edge.source,\n target: edge.target,\n data: edge.data,\n }));\n }\n\n get nodes() {\n return this._nodes;\n }\n\n get links() {\n return this._links;\n }\n}\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["React", "useCallback", "useEffect", "useMemo", "useRef", "Obj", "SelectionModel", "GraphForceProjector", "SVG", "getHashStyles", "D3ForceGraph", "classNames", "model", "selection", "_selection", "grid", "props", "context", "useRef", "projector", "useMemo", "current", "GraphForceProjector", "attributes", "linkForce", "edge", "data", "object", "active", "forces", "point", "strength", "graph", "SelectionModel", "useEffect", "repaint", "selected", "value", "handleSelect", "useCallback", "node", "contains", "id", "remove", "add", "SVG", "Root", "ref", "Markers", "Grid", "axis", "Zoom", "extent", "Graph", "labels", "text", "label", "obj", "color", "getHashStyles", "Obj", "getTypename", "hue", "classes", "onSelect", "forceLink", "forceManyBody", "NativeForceGraph", "React", "useEffect", "useRef", "useState", "useResizeDetector", "filterObjectsSync", "GraphAdapter", "_nodes", "_links", "graph", "nodes", "map", "node", "id", "type", "data", "edges", "edge", "source", "target", "links", "ForceGraph", "model", "match", "ref", "width", "height", "useResizeDetector", "refreshRate", "rootRef", "useRef", "forceGraph", "filteredRef", "current", "filterObjectsSync", "objects", "data", "setData", "useState", "useEffect", "subscribe", "GraphAdapter", "graph", "NativeForceGraph", "nodeRelSize", "nodeLabel", "node", "type", "typename", "label", "id", "nodeAutoColorBy", "linkAutoColorBy", "link", "pauseAnimation", "graphData", "nodes", "links", "onEngineStop", "handleZoomToFit", "onNodeClick", "emitParticle", "d3Force", "forceLink", "distance", "strength", "forceManyBody", "warmupTicks", "cooldownTime", "resumeAnimation", "zoomToFit", "React", "div", "className", "onClick"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/ExplorerAction.ts", "../../../src/types/Graph.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';\nimport { SpaceSchema } from '@dxos/react-client/echo';\n\nimport { meta } from '../meta';\n\nimport * as Graph from './Graph';\n\nconst EXPLORER_ACTION = `${meta.id}/action`;\n\nexport const GraphProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): This should be a query input instead.\n typename: Schema.String.pipe(\n Schema.annotations({ title: 'Select type' }),\n TypeInputOptionsAnnotation.set({\n location: ['database', 'runtime'],\n kind: ['user'],\n registered: ['registered'],\n }),\n Schema.optional,\n ),\n});\n\nexport class CreateGraph extends Schema.TaggedClass<CreateGraph>()(`${EXPLORER_ACTION}/create-graph`, {\n input: Schema.Struct({\n space: SpaceSchema,\n }).pipe(Schema.extend(GraphProps)),\n output: Schema.Struct({\n object: Graph.Graph,\n }),\n}) {}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { View, ViewAnnotation } from '@dxos/schema';\n\nconst GraphSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n\n view: Type.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(Schema.mutable, FormInputAnnotation.set(false)),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Graph',\n version: '0.2.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n);\nexport interface Graph extends Schema.Schema.Type<typeof GraphSchema> {}\nexport interface GraphEncoded extends Schema.Schema.Encoded<typeof GraphSchema> {}\nexport const Graph: Schema.Schema<Graph, GraphEncoded> = GraphSchema;\n\ntype MakeProps = Omit<Partial<Obj.MakeProps<typeof Graph>>, 'view'> & {\n view: View.View;\n};\n\n/**\n * Make a graph as a view of a data set.\n */\nexport const make = ({\n name,\n query = { raw: '', ast: Query.select(Filter.nothing()).ast },\n view,\n}: MakeProps): Graph => {\n return Obj.make(Graph, { name, view: Ref.make(view), query });\n};\n\n//\n// V1\n//\n\nexport const GraphV1 = Schema.Struct({\n name: Schema.optional(Schema.String),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(Schema.mutable),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Graph',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAAA;;;;;AAIA,YAAYA,aAAY;AAExB,SAASC,kCAAkC;AAC3C,SAASC,mBAAmB;;;ACP5B;;;;;;AAIA,YAAYC,YAAY;AAExB,SAASC,QAAQC,KAAKC,OAAOC,UAAUC,KAAKC,YAAY;AACxD,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,MAAMC,sBAAsB;AAErC,IAAMC,cAAqBC,cAAO;EAChCC,MAAaC,gBAAgBC,aAAM;EAEnCC,MAAMC,KAAKC,IAAIC,KAAKA,IAAI,EAAEC,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;EAEvDC,OAAcX,cAAO;IACnBY,KAAYV,gBAAgBC,aAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAYQ,gBAASP,oBAAoBC,IAAI,KAAA,CAAA;AAClD,CAAA,EAAGF,KACDH,KAAKY,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBV,IAAI;EAAC;CAAO,GAC5BW,eAAeX,IAAI,IAAA,CAAA;AAId,IAAMY,QAA4CvB;AASlD,IAAMwB,OAAO,CAAC,EACnBtB,MACAU,QAAQ;EAAEC,KAAK;EAAIC,KAAKE,MAAMS,OAAOC,OAAOC,QAAO,CAAA,EAAIb;AAAI,GAC3DT,KAAI,MACM;AACV,SAAOa,IAAIM,KAAKD,OAAO;IAAErB;IAAMG,MAAME,IAAIiB,KAAKnB,IAAAA;IAAOO;EAAM,CAAA;AAC7D;AAMO,IAAMgB,UAAiB3B,cAAO;EACnCC,MAAaC,gBAAgBC,aAAM;EACnCQ,OAAcX,cAAO;IACnBY,KAAYV,gBAAgBC,aAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAYQ,cAAO;AACxB,CAAA,EAAGR,KACDH,KAAKY,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBV,IAAI;EAAC;CAAO,CAAA;;;ADhD9B,IAAMkB,kBAAkB,GAAGC,KAAKC,EAAE;AAE3B,IAAMC,aAAoBC,eAAO;EACtCC,MAAaC,iBAAgBC,cAAM;;EAEnCC,UAAiBD,eAAOE,KACfC,oBAAY;IAAEC,OAAO;EAAc,CAAA,GAC1CC,2BAA2BC,IAAI;IAC7BC,UAAU;MAAC;MAAY;;IACvBC,MAAM;MAAC;;IACPC,YAAY;MAAC;;EACf,CAAA,GACOV,gBAAQ;AAEnB,CAAA;AAEO,IAAMW,cAAN,cAAiCC,oBAAW,EAAgB,GAAGlB,eAAAA,iBAAgC;EACpGmB,OAAcf,eAAO;IACnBgB,OAAOC;EACT,CAAA,EAAGZ,KAAYa,eAAOnB,UAAAA,CAAAA;EACtBoB,QAAenB,eAAO;IACpBoB,QAAcC;EAChB,CAAA;AACF,CAAA,EAAA;AAAI;",
|
|
6
|
-
"names": ["Schema", "TypeInputOptionsAnnotation", "SpaceSchema", "Schema", "Filter", "Obj", "Query", "QueryAST", "Ref", "Type", "FormInputAnnotation", "LabelAnnotation", "View", "ViewAnnotation", "GraphSchema", "Struct", "name", "optional", "String", "view", "Type", "Ref", "View", "pipe", "FormInputAnnotation", "set", "query", "raw", "ast", "QueryAST", "Query", "mutable", "Obj", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Graph", "make", "select", "Filter", "nothing", "GraphV1", "EXPLORER_ACTION", "meta", "id", "GraphProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind", "registered", "CreateGraph", "TaggedClass", "input", "space", "SpaceSchema", "extend", "output", "object", "Graph"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/explorer',\n name: 'Explorer',\n description: trim`\n Interactive hypergraph visualization that reveals relationships between objects in your workspace.\n Navigate complex data structures and discover connections through a dynamic network view.\n `,\n icon: 'ph--graph--regular',\n iconHue: 'green',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n tags: ['labs'],\n screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],\n};\n"],
|
|
5
|
-
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "tags", "screenshots"]
|
|
7
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExplorerAction_exports,
|
|
3
|
-
Graph_exports
|
|
4
|
-
} from "./chunk-P6FFFVPM.mjs";
|
|
5
|
-
import "./chunk-UBHZGWZQ.mjs";
|
|
6
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
7
|
-
|
|
8
|
-
// src/capabilities/intent-resolver.ts
|
|
9
|
-
import { Capabilities, contributes, createResolver } from "@dxos/app-framework";
|
|
10
|
-
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
11
|
-
import { View } from "@dxos/schema";
|
|
12
|
-
var intent_resolver_default = ((context) => contributes(Capabilities.IntentResolver, createResolver({
|
|
13
|
-
intent: ExplorerAction_exports.CreateGraph,
|
|
14
|
-
resolve: async ({ space, name, typename }) => {
|
|
15
|
-
const client = context.getCapability(ClientCapabilities.Client);
|
|
16
|
-
const { view } = await View.makeFromSpace({
|
|
17
|
-
client,
|
|
18
|
-
space,
|
|
19
|
-
typename
|
|
20
|
-
});
|
|
21
|
-
const graph = Graph_exports.make({
|
|
22
|
-
name,
|
|
23
|
-
view
|
|
24
|
-
});
|
|
25
|
-
return {
|
|
26
|
-
data: {
|
|
27
|
-
object: graph
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
})));
|
|
32
|
-
export {
|
|
33
|
-
intent_resolver_default as default
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=intent-resolver-EWB3H5KH.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, type PluginContext, contributes, createResolver } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { View } from '@dxos/schema';\n\nimport { ExplorerAction, Graph } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: ExplorerAction.CreateGraph,\n resolve: async ({ space, name, typename }) => {\n const client = context.getCapability(ClientCapabilities.Client);\n const { view } = await View.makeFromSpace({ client, space, typename });\n const graph = Graph.make({ name, view });\n return { data: { object: graph } };\n },\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,SAASA,cAAkCC,aAAaC,sBAAsB;AAC9E,SAASC,0BAA0B;AACnC,SAASC,YAAY;AAIrB,IAAA,2BAAe,CAACC,YACdC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,uBAAeC;EACvBC,SAAS,OAAO,EAAEC,OAAOC,MAAMC,SAAQ,MAAE;AACvC,UAAMC,SAASZ,QAAQa,cAAcC,mBAAmBC,MAAM;AAC9D,UAAM,EAAEC,KAAI,IAAK,MAAMC,KAAKC,cAAc;MAAEN;MAAQH;MAAOE;IAAS,CAAA;AACpE,UAAMQ,QAAQC,cAAMC,KAAK;MAAEX;MAAMM;IAAK,CAAA;AACtC,WAAO;MAAEM,MAAM;QAAEC,QAAQJ;MAAM;IAAE;EACnC;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "createResolver", "ClientCapabilities", "View", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ExplorerAction", "CreateGraph", "resolve", "space", "name", "typename", "client", "getCapability", "ClientCapabilities", "Client", "view", "View", "makeFromSpace", "graph", "Graph", "make", "data", "object"]
|
|
7
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExplorerContainer
|
|
3
|
-
} from "./chunk-ARBGXQFH.mjs";
|
|
4
|
-
import "./chunk-6BVXZQPP.mjs";
|
|
5
|
-
import {
|
|
6
|
-
Graph_exports
|
|
7
|
-
} from "./chunk-P6FFFVPM.mjs";
|
|
8
|
-
import {
|
|
9
|
-
meta
|
|
10
|
-
} from "./chunk-UBHZGWZQ.mjs";
|
|
11
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
12
|
-
|
|
13
|
-
// src/capabilities/react-surface.tsx
|
|
14
|
-
import React from "react";
|
|
15
|
-
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
16
|
-
import { Obj } from "@dxos/echo";
|
|
17
|
-
var react_surface_default = (() => contributes(Capabilities.ReactSurface, createSurface({
|
|
18
|
-
id: `${meta.id}/article`,
|
|
19
|
-
role: [
|
|
20
|
-
"article",
|
|
21
|
-
"section"
|
|
22
|
-
],
|
|
23
|
-
filter: (data) => Obj.instanceOf(Graph_exports.Graph, data.subject),
|
|
24
|
-
component: ({ data, role }) => {
|
|
25
|
-
return /* @__PURE__ */ React.createElement(ExplorerContainer, {
|
|
26
|
-
view: data.subject,
|
|
27
|
-
role
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
})));
|
|
31
|
-
export {
|
|
32
|
-
react_surface_default as default
|
|
33
|
-
};
|
|
34
|
-
//# sourceMappingURL=react-surface-BY2DYCTH.mjs.map
|