@dxos/plugin-explorer 0.7.5-main.9d2a38b → 0.7.5-main.c41020f
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-A7UBZ3QP.mjs → ExplorerContainer-GJTCBEM4.mjs} +2 -2
- package/dist/lib/browser/{chunk-Q4MVJ6YE.mjs → chunk-PMHCTMKT.mjs} +3 -3
- package/dist/lib/browser/{chunk-Q4MVJ6YE.mjs.map → chunk-PMHCTMKT.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-D67EYME2.mjs → chunk-QOKAZK4V.mjs} +5 -2
- package/dist/lib/browser/chunk-QOKAZK4V.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DTAFIUA7.mjs → chunk-S3QNIEBS.mjs} +2 -2
- package/dist/lib/browser/{chunk-5GTLMW4Q.mjs → chunk-YQL7YE6N.mjs} +171 -100
- package/dist/lib/browser/chunk-YQL7YE6N.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +24 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-DADUM6T5.mjs → intent-resolver-UJNDAIDZ.mjs} +14 -11
- package/dist/lib/browser/{intent-resolver-DADUM6T5.mjs.map → intent-resolver-UJNDAIDZ.mjs.map} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/{react-surface-FW4Q2UQM.mjs → react-surface-3X2V3VPN.mjs} +5 -5
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node/{ExplorerContainer-ZV2YKOUE.cjs → ExplorerContainer-RJT54IOS.cjs} +6 -6
- package/dist/lib/node/{chunk-34MGVWOY.cjs → chunk-5MTMJYC4.cjs} +8 -5
- package/dist/lib/node/{chunk-34MGVWOY.cjs.map → chunk-5MTMJYC4.cjs.map} +3 -3
- package/dist/lib/node/{chunk-4H2Y5RER.cjs → chunk-VSACDC6F.cjs} +5 -5
- package/dist/lib/node/{chunk-WHMJ2VQ2.cjs → chunk-YH4QYCZH.cjs} +168 -97
- package/dist/lib/node/chunk-YH4QYCZH.cjs.map +7 -0
- package/dist/lib/node/{chunk-SFG2GX7G.cjs → chunk-YUY7P7R2.cjs} +7 -7
- package/dist/lib/node/{chunk-SFG2GX7G.cjs.map → chunk-YUY7P7R2.cjs.map} +1 -1
- package/dist/lib/node/index.cjs +42 -30
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-2V3P4L25.cjs → intent-resolver-XQV24IAA.cjs} +17 -14
- package/dist/lib/node/{intent-resolver-2V3P4L25.cjs.map → intent-resolver-XQV24IAA.cjs.map} +3 -3
- package/dist/lib/node/meta.cjs +3 -3
- package/dist/lib/node/meta.cjs.map +1 -1
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-7J4K5DDX.cjs → react-surface-36YIY7NA.cjs} +11 -11
- package/dist/lib/node/types/index.cjs +4 -4
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{ExplorerContainer-JXY6XN2D.mjs → ExplorerContainer-TM3VIXVK.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-WTGQFG6L.mjs → chunk-3KRWHGBM.mjs} +171 -100
- package/dist/lib/node-esm/chunk-3KRWHGBM.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7NVKKFPI.mjs → chunk-57K7ORAW.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-7NVKKFPI.mjs.map → chunk-57K7ORAW.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-HIMBUOZ3.mjs → chunk-BRJI3QC2.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-ZEM6ZU5V.mjs → chunk-UHJZUVRI.mjs} +5 -2
- package/dist/lib/node-esm/chunk-UHJZUVRI.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +24 -12
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-3BG74H5K.mjs → intent-resolver-RZQ3EEOE.mjs} +14 -11
- package/dist/lib/node-esm/{intent-resolver-3BG74H5K.mjs.map → intent-resolver-RZQ3EEOE.mjs.map} +3 -3
- 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-7ZTSGXJO.mjs → react-surface-YDY7IBMY.mjs} +5 -5
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.d.ts +1 -2
- package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts +1 -2
- package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/src/components/ExplorerContainer.d.ts +1 -2
- package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts +1 -2
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +2 -3
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/Graph.d.ts +2 -0
- package/dist/types/src/components/Graph/Graph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/graph-model.d.ts +16 -10
- package/dist/types/src/components/Graph/graph-model.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts +1 -2
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +13 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +2 -2
- package/package.json +26 -24
- package/src/ExplorerPlugin.tsx +19 -14
- package/src/capabilities/intent-resolver.ts +6 -3
- package/src/components/Graph/Graph.tsx +92 -26
- package/src/components/Graph/graph-model.ts +127 -73
- package/src/components/Tree/Tree.tsx +7 -2
- package/src/meta.ts +2 -1
- package/src/translations.ts +4 -0
- package/src/types/schema.ts +1 -1
- package/dist/lib/browser/chunk-5GTLMW4Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-D67EYME2.mjs.map +0 -7
- package/dist/lib/node/chunk-WHMJ2VQ2.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-WTGQFG6L.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZEM6ZU5V.mjs.map +0 -7
- /package/dist/lib/browser/{ExplorerContainer-A7UBZ3QP.mjs.map → ExplorerContainer-GJTCBEM4.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-DTAFIUA7.mjs.map → chunk-S3QNIEBS.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-FW4Q2UQM.mjs.map → react-surface-3X2V3VPN.mjs.map} +0 -0
- /package/dist/lib/node/{ExplorerContainer-ZV2YKOUE.cjs.map → ExplorerContainer-RJT54IOS.cjs.map} +0 -0
- /package/dist/lib/node/{chunk-4H2Y5RER.cjs.map → chunk-VSACDC6F.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-7J4K5DDX.cjs.map → react-surface-36YIY7NA.cjs.map} +0 -0
- /package/dist/lib/node-esm/{ExplorerContainer-JXY6XN2D.mjs.map → ExplorerContainer-TM3VIXVK.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-HIMBUOZ3.mjs.map → chunk-BRJI3QC2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-7ZTSGXJO.mjs.map → react-surface-YDY7IBMY.mjs.map} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
|
|
3
3
|
// packages/plugins/experimental/plugin-explorer/src/components/Graph/graph-model.ts
|
|
4
|
-
import {
|
|
4
|
+
import { getSchema, getSchemaDXN, AST, ReferenceAnnotationId, SchemaValidator, StoredSchema } from "@dxos/echo-schema";
|
|
5
5
|
import { GraphModel } from "@dxos/gem-spore";
|
|
6
6
|
import { log } from "@dxos/log";
|
|
7
7
|
import { CollectionType } from "@dxos/plugin-space/types";
|
|
8
|
-
import {
|
|
8
|
+
import { Filter } from "@dxos/react-client/echo";
|
|
9
9
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-explorer/src/components/Graph/graph-model.ts";
|
|
10
10
|
var SpaceGraphModel = class extends GraphModel {
|
|
11
11
|
constructor(_options = {}) {
|
|
@@ -22,79 +22,106 @@ var SpaceGraphModel = class extends GraphModel {
|
|
|
22
22
|
get objects() {
|
|
23
23
|
return this._objects ?? [];
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
// TODO(burdon): Alternative diagram types:
|
|
26
|
+
// - https://observablehq.com/@d3/radial-tree/2
|
|
27
|
+
// - https://observablehq.com/@d3/disjoint-force-directed-graph/2
|
|
28
|
+
// - https://observablehq.com/@mbostock/tadpoles
|
|
29
|
+
// - https://observablehq.com/@d3/psr-b1919-21
|
|
30
|
+
// - https://vasturiano.github.io/react-force-graph/example/basic (3D)
|
|
31
|
+
async open(space, objectId) {
|
|
32
|
+
if (!this._schemaSubscription) {
|
|
33
|
+
const schemaaQuery = space.db.schemaRegistry.query({});
|
|
34
|
+
const schemas = await schemaaQuery.run();
|
|
35
|
+
const onSchemaUpdate = ({ results }) => this._schema = results;
|
|
36
|
+
this._schemaSubscription = schemaaQuery.subscribe(onSchemaUpdate);
|
|
37
|
+
onSchemaUpdate({
|
|
38
|
+
results: schemas
|
|
39
|
+
});
|
|
40
|
+
this._objectsSubscription = space.db.query(Filter.not(Filter.or(Filter.schema(StoredSchema), Filter.schema(CollectionType)))).subscribe(({ objects }) => {
|
|
29
41
|
this._objects = objects;
|
|
30
|
-
this._graph.nodes
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
42
|
+
const currentNodes = this._graph.nodes;
|
|
43
|
+
this._graph.nodes = [];
|
|
44
|
+
this._graph.links = [];
|
|
45
|
+
const addSchema = (typename) => {
|
|
46
|
+
const current = currentNodes.find((node) => node.id === typename);
|
|
47
|
+
if (typename) {
|
|
48
|
+
this._graph.nodes.push({
|
|
49
|
+
...current,
|
|
50
|
+
id: typename,
|
|
34
51
|
type: "schema",
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
type: "echo-object",
|
|
41
|
-
id: object.id,
|
|
42
|
-
object
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
this._graph.links = objects.reduce((links, object) => {
|
|
46
|
-
const objectSchema = getSchema(object);
|
|
47
|
-
const typename = getType(object)?.objectId;
|
|
48
|
-
if (objectSchema == null || typename == null) {
|
|
49
|
-
log.info("no schema for object:", {
|
|
50
|
-
id: object.id.slice(0, 8)
|
|
51
|
-
}, {
|
|
52
|
-
F: __dxlog_file,
|
|
53
|
-
L: 72,
|
|
54
|
-
S: this,
|
|
55
|
-
C: (f, a) => f(...a)
|
|
52
|
+
data: {
|
|
53
|
+
typename
|
|
54
|
+
}
|
|
56
55
|
});
|
|
57
|
-
return links;
|
|
58
56
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
type: "schema",
|
|
65
|
-
schema: objectSchema
|
|
66
|
-
});
|
|
67
|
-
}
|
|
57
|
+
};
|
|
58
|
+
space.db.graph.schemaRegistry.schemas.forEach((schema) => {
|
|
59
|
+
const typename = getSchemaDXN(schema)?.toTypename();
|
|
60
|
+
if (typename) {
|
|
61
|
+
addSchema(typename);
|
|
68
62
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
});
|
|
63
|
+
});
|
|
64
|
+
this._schema?.forEach((schema) => {
|
|
65
|
+
const typename = getSchemaDXN(schema)?.toTypename();
|
|
66
|
+
if (typename) {
|
|
67
|
+
addSchema(typename);
|
|
75
68
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
target: ref.id
|
|
91
|
-
});
|
|
69
|
+
});
|
|
70
|
+
this._objects.forEach((object) => {
|
|
71
|
+
const schema = getSchema(object);
|
|
72
|
+
if (schema) {
|
|
73
|
+
const typename = getSchemaDXN(schema)?.toTypename();
|
|
74
|
+
if (typename) {
|
|
75
|
+
const current = currentNodes.find((node) => node.id === object.id);
|
|
76
|
+
this._graph.nodes.push({
|
|
77
|
+
...current,
|
|
78
|
+
id: object.id,
|
|
79
|
+
type: "object",
|
|
80
|
+
data: {
|
|
81
|
+
typename,
|
|
82
|
+
object
|
|
92
83
|
}
|
|
84
|
+
});
|
|
85
|
+
const schemaNode = this._graph.nodes.find((node) => node.type === "schema" && node.data.typename === typename);
|
|
86
|
+
if (schemaNode) {
|
|
87
|
+
this._graph.links.push({
|
|
88
|
+
id: `${object.id}-${schemaNode.id}`,
|
|
89
|
+
source: object.id,
|
|
90
|
+
target: schemaNode.id
|
|
91
|
+
});
|
|
92
|
+
} else {
|
|
93
|
+
log.info("schema node not found", {
|
|
94
|
+
typename
|
|
95
|
+
}, {
|
|
96
|
+
F: __dxlog_file,
|
|
97
|
+
L: 145,
|
|
98
|
+
S: this,
|
|
99
|
+
C: (f, a) => f(...a)
|
|
100
|
+
});
|
|
93
101
|
}
|
|
102
|
+
AST.getPropertySignatures(schema.ast).forEach((prop) => {
|
|
103
|
+
if (!SchemaValidator.hasTypeAnnotation(schema, prop.name.toString(), ReferenceAnnotationId)) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const value = object[String(prop.name)];
|
|
107
|
+
if (value) {
|
|
108
|
+
const refs = Array.isArray(value) ? value : [
|
|
109
|
+
value
|
|
110
|
+
];
|
|
111
|
+
for (const ref of refs) {
|
|
112
|
+
if (objects.findIndex((obj) => obj.id === ref.id) !== -1) {
|
|
113
|
+
this._graph.links.push({
|
|
114
|
+
id: `${object.id}-${String(prop.name)}-${ref.id}`,
|
|
115
|
+
source: object.id,
|
|
116
|
+
target: ref.id
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
94
122
|
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
}, []);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
98
125
|
this.triggerUpdate();
|
|
99
126
|
}, {
|
|
100
127
|
fire: true
|
|
@@ -104,18 +131,19 @@ var SpaceGraphModel = class extends GraphModel {
|
|
|
104
131
|
return this;
|
|
105
132
|
}
|
|
106
133
|
close() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
134
|
+
this._schemaSubscription?.();
|
|
135
|
+
this._schemaSubscription = void 0;
|
|
136
|
+
this._objectsSubscription?.();
|
|
137
|
+
this._objectsSubscription = void 0;
|
|
111
138
|
return this;
|
|
112
139
|
}
|
|
113
140
|
};
|
|
114
141
|
|
|
115
142
|
// packages/plugins/experimental/plugin-explorer/src/components/Tree/Tree.tsx
|
|
116
|
-
import React2, { useEffect as useEffect2,
|
|
117
|
-
import { useResizeDetector } from "react-resize-detector";
|
|
143
|
+
import React2, { useEffect as useEffect2, useState as useState2 } from "react";
|
|
144
|
+
import { useResizeDetector as useResizeDetector2 } from "react-resize-detector";
|
|
118
145
|
import { createSvgContext as createSvgContext2, SVG as SVG2, SVGRoot as SVGRoot2 } from "@dxos/gem-core";
|
|
146
|
+
import { useAsyncState as useAsyncState2 } from "@dxos/react-ui";
|
|
119
147
|
|
|
120
148
|
// packages/plugins/experimental/plugin-explorer/src/components/Tree/layout/HierarchicalEdgeBundling.ts
|
|
121
149
|
import * as d3 from "d3";
|
|
@@ -274,12 +302,15 @@ var mapGraphToTreeData = (model, maxDepth = 8) => {
|
|
|
274
302
|
};
|
|
275
303
|
|
|
276
304
|
// packages/plugins/experimental/plugin-explorer/src/components/Graph/Graph.tsx
|
|
305
|
+
import { forceLink, forceManyBody } from "d3";
|
|
306
|
+
import ForceGraph from "force-graph";
|
|
277
307
|
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
278
|
-
import {
|
|
308
|
+
import { useResizeDetector } from "react-resize-detector";
|
|
309
|
+
import { getTypename } from "@dxos/client/echo";
|
|
279
310
|
import { createSvgContext, defaultGridStyles, Grid, SVG, SVGRoot, Zoom } from "@dxos/gem-core";
|
|
280
311
|
import { defaultStyles, Graph as GraphComponent, GraphForceProjector, Markers } from "@dxos/gem-spore";
|
|
281
312
|
import { filterObjectsSync } from "@dxos/plugin-search";
|
|
282
|
-
import { useThemeContext } from "@dxos/react-ui";
|
|
313
|
+
import { useAsyncState, useThemeContext } from "@dxos/react-ui";
|
|
283
314
|
import { mx } from "@dxos/react-ui-theme";
|
|
284
315
|
import "@dxos/gem-spore/styles";
|
|
285
316
|
var slots = {};
|
|
@@ -295,14 +326,14 @@ var colors = [
|
|
|
295
326
|
"[&>circle]:!fill-teal-300 [&>circle]:!stroke-teal-600",
|
|
296
327
|
"[&>circle]:!fill-indigo-300 [&>circle]:!stroke-indigo-600"
|
|
297
328
|
];
|
|
298
|
-
var Graph = ({ space, match }) => {
|
|
299
|
-
const
|
|
329
|
+
var Graph = ({ space, match, grid, svg }) => {
|
|
330
|
+
const { themeMode } = useThemeContext();
|
|
331
|
+
const [selected, setSelected] = useState();
|
|
332
|
+
const [model] = useAsyncState(async () => space ? new SpaceGraphModel({
|
|
300
333
|
schema: true
|
|
301
334
|
}).open(space) : void 0, [
|
|
302
335
|
space
|
|
303
336
|
]);
|
|
304
|
-
const [selected, setSelected] = useState();
|
|
305
|
-
const { themeMode } = useThemeContext();
|
|
306
337
|
const context = createSvgContext();
|
|
307
338
|
const projector = useMemo(() => new GraphForceProjector(context, {
|
|
308
339
|
forces: {
|
|
@@ -310,15 +341,15 @@ var Graph = ({ space, match }) => {
|
|
|
310
341
|
strength: -100
|
|
311
342
|
},
|
|
312
343
|
link: {
|
|
313
|
-
distance:
|
|
344
|
+
distance: 100
|
|
314
345
|
},
|
|
315
346
|
radial: {
|
|
316
|
-
radius:
|
|
347
|
+
radius: 150,
|
|
317
348
|
strength: 0.05
|
|
318
349
|
}
|
|
319
350
|
},
|
|
320
351
|
attributes: {
|
|
321
|
-
radius: (node) => node.data?.type === "schema" ?
|
|
352
|
+
radius: (node) => node.data?.type === "schema" ? 12 : 8
|
|
322
353
|
}
|
|
323
354
|
}), []);
|
|
324
355
|
const filteredRef = useRef();
|
|
@@ -329,8 +360,49 @@ var Graph = ({ space, match }) => {
|
|
|
329
360
|
match
|
|
330
361
|
]);
|
|
331
362
|
const [colorMap] = useState(/* @__PURE__ */ new Map());
|
|
332
|
-
|
|
333
|
-
|
|
363
|
+
const { ref, width, height } = useResizeDetector();
|
|
364
|
+
const rootRef = useRef(null);
|
|
365
|
+
const forceGraph = useRef();
|
|
366
|
+
useEffect(() => {
|
|
367
|
+
if (rootRef.current) {
|
|
368
|
+
forceGraph.current = new ForceGraph(rootRef.current).nodeRelSize(6).nodeLabel((node) => {
|
|
369
|
+
if (node.type === "schema") {
|
|
370
|
+
return node.data.typename;
|
|
371
|
+
}
|
|
372
|
+
return node.id;
|
|
373
|
+
}).nodeAutoColorBy((node) => node.type === "schema" ? "schema" : node.data.typename).linkColor(() => "rgba(255,255,255,0.25)");
|
|
374
|
+
}
|
|
375
|
+
return () => {
|
|
376
|
+
forceGraph.current?.pauseAnimation().graphData({
|
|
377
|
+
nodes: [],
|
|
378
|
+
links: []
|
|
379
|
+
});
|
|
380
|
+
forceGraph.current = void 0;
|
|
381
|
+
};
|
|
382
|
+
}, []);
|
|
383
|
+
useEffect(() => {
|
|
384
|
+
if (forceGraph.current && width && height && model) {
|
|
385
|
+
forceGraph.current.pauseAnimation().width(width).height(height).onEngineStop(() => {
|
|
386
|
+
forceGraph.current?.zoomToFit(400, 40);
|
|
387
|
+
}).d3Force("link", forceLink().distance(160).strength(0.5)).d3Force("charge", forceManyBody().strength(-30)).warmupTicks(100).graphData(model.graph).resumeAnimation();
|
|
388
|
+
}
|
|
389
|
+
}, [
|
|
390
|
+
model,
|
|
391
|
+
width,
|
|
392
|
+
height
|
|
393
|
+
]);
|
|
394
|
+
const handleZoomToFit = () => {
|
|
395
|
+
forceGraph.current?.zoomToFit(400, 40);
|
|
396
|
+
};
|
|
397
|
+
if (!svg) {
|
|
398
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
399
|
+
ref,
|
|
400
|
+
className: "relative grow",
|
|
401
|
+
onClick: handleZoomToFit
|
|
402
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
403
|
+
ref: rootRef,
|
|
404
|
+
className: "absolute inset-0"
|
|
405
|
+
}));
|
|
334
406
|
}
|
|
335
407
|
if (selected) {
|
|
336
408
|
return /* @__PURE__ */ React.createElement(Tree, {
|
|
@@ -346,7 +418,7 @@ var Graph = ({ space, match }) => {
|
|
|
346
418
|
className: mx(defaultStyles, slots?.root?.className)
|
|
347
419
|
}, /* @__PURE__ */ React.createElement(Markers, {
|
|
348
420
|
arrowSize: 6
|
|
349
|
-
}), /* @__PURE__ */ React.createElement(Grid, {
|
|
421
|
+
}), grid && /* @__PURE__ */ React.createElement(Grid, {
|
|
350
422
|
className: slots?.grid?.className ?? defaultGridStyles(themeMode)
|
|
351
423
|
}), /* @__PURE__ */ React.createElement(Zoom, {
|
|
352
424
|
extent: [
|
|
@@ -371,27 +443,26 @@ var Graph = ({ space, match }) => {
|
|
|
371
443
|
node: (node) => {
|
|
372
444
|
let className;
|
|
373
445
|
if (node.data) {
|
|
374
|
-
const
|
|
375
|
-
if (
|
|
376
|
-
|
|
377
|
-
if (
|
|
378
|
-
className =
|
|
379
|
-
|
|
446
|
+
const { object } = node.data;
|
|
447
|
+
if (object) {
|
|
448
|
+
const typename = getTypename(object);
|
|
449
|
+
if (typename) {
|
|
450
|
+
className = colorMap.get(typename);
|
|
451
|
+
if (!className) {
|
|
452
|
+
className = colors[colorMap.size % colors.length];
|
|
453
|
+
colorMap.set(typename, className);
|
|
454
|
+
}
|
|
380
455
|
}
|
|
381
456
|
}
|
|
382
457
|
}
|
|
383
458
|
const selected2 = filteredRef.current?.some((object) => object.id === node.data?.id);
|
|
459
|
+
const blur = !selected2 && !!filteredRef.current?.length;
|
|
384
460
|
return {
|
|
385
|
-
class: mx(
|
|
386
|
-
className
|
|
387
|
-
] : "[&>text]:!fill-neutral-300" : [
|
|
388
|
-
"[&>text]:!fill-neutral-700",
|
|
389
|
-
className
|
|
390
|
-
])
|
|
461
|
+
class: mx(className, blur && "opacity-70")
|
|
391
462
|
};
|
|
392
463
|
},
|
|
393
464
|
link: () => ({
|
|
394
|
-
class: "[&>path]:!stroke-neutral-300"
|
|
465
|
+
class: "[&>path]:!stroke-neutral-300 dark:[&>path]:!stroke-neutral-700"
|
|
395
466
|
})
|
|
396
467
|
}
|
|
397
468
|
}))));
|
|
@@ -418,7 +489,7 @@ var renderers = /* @__PURE__ */ new Map([
|
|
|
418
489
|
]
|
|
419
490
|
]);
|
|
420
491
|
var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
421
|
-
const model =
|
|
492
|
+
const [model] = useAsyncState2(async () => space ? new SpaceGraphModel().open(space, selected) : void 0, [
|
|
422
493
|
space,
|
|
423
494
|
selected
|
|
424
495
|
]);
|
|
@@ -432,7 +503,7 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
432
503
|
model
|
|
433
504
|
]);
|
|
434
505
|
const context = createSvgContext2();
|
|
435
|
-
const { ref, width = 0, height = 0 } =
|
|
506
|
+
const { ref, width = 0, height = 0 } = useResizeDetector2();
|
|
436
507
|
useEffect2(() => {
|
|
437
508
|
if (width && height) {
|
|
438
509
|
const size = Math.min(width, height);
|
|
@@ -474,4 +545,4 @@ export {
|
|
|
474
545
|
Tree,
|
|
475
546
|
Graph
|
|
476
547
|
};
|
|
477
|
-
//# sourceMappingURL=chunk-
|
|
548
|
+
//# sourceMappingURL=chunk-3KRWHGBM.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/Graph/graph-model.ts", "../../../src/components/Tree/Tree.tsx", "../../../src/components/Tree/layout/HierarchicalEdgeBundling.ts", "../../../src/components/Tree/layout/RadialTree.ts", "../../../src/components/Tree/layout/TidyTree.ts", "../../../src/components/Tree/types.ts", "../../../src/components/Graph/Graph.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type UnsubscribeCallback } from '@dxos/async';\nimport {\n getSchema,\n getSchemaDXN,\n AST,\n type EchoSchema,\n ReferenceAnnotationId,\n SchemaValidator,\n StoredSchema,\n} from '@dxos/echo-schema';\nimport { type GraphData, GraphModel } from '@dxos/gem-spore';\nimport { log } from '@dxos/log';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { Filter, type ReactiveEchoObject, type Space, type Subscription } from '@dxos/react-client/echo';\n\nexport type SpaceGraphModelOptions = {\n schema?: boolean;\n};\n\ntype SchemaGraphNode = {\n id: string;\n type: 'schema';\n data: { typename: string };\n};\n\ntype ObjectGraphNode = {\n id: string;\n type: 'object';\n data: { typename: string; object: ReactiveEchoObject<any> };\n};\n\nexport type EchoGraphNode = SchemaGraphNode | ObjectGraphNode;\n\n/**\n * Converts ECHO objects to a graph.\n */\nexport class SpaceGraphModel extends GraphModel<EchoGraphNode> {\n private readonly _graph: GraphData<EchoGraphNode> = {\n nodes: [],\n links: [],\n };\n\n private _schema?: EchoSchema[];\n private _schemaSubscription?: UnsubscribeCallback;\n private _objects?: ReactiveEchoObject<any>[];\n private _objectsSubscription?: Subscription;\n\n constructor(private readonly _options: SpaceGraphModelOptions = {}) {\n super();\n }\n\n override get graph(): GraphData<EchoGraphNode> {\n return this._graph;\n }\n\n get objects(): ReactiveEchoObject<any>[] {\n return this._objects ?? [];\n }\n\n // TODO(burdon): Alternative diagram types:\n // - https://observablehq.com/@d3/radial-tree/2\n // - https://observablehq.com/@d3/disjoint-force-directed-graph/2\n // - https://observablehq.com/@mbostock/tadpoles\n // - https://observablehq.com/@d3/psr-b1919-21\n // - https://vasturiano.github.io/react-force-graph/example/basic (3D)\n\n async open(space: Space, objectId?: string) {\n // TODO(burdon): Factor out graph builder to lib (use common/graph abstraction).\n if (!this._schemaSubscription) {\n // TODO(burdon): Normalize unsubscribe callbacks and merge handlers.\n // TODO(burdon): Trigger initial subscription update.\n // TODO(burdon): Normalize subscription cb for objects, schema, etc.\n\n const schemaaQuery = space.db.schemaRegistry.query({});\n const schemas = await schemaaQuery.run();\n const onSchemaUpdate = ({ results }: { results: EchoSchema[] }) => (this._schema = results);\n this._schemaSubscription = schemaaQuery.subscribe(onSchemaUpdate);\n onSchemaUpdate({ results: schemas });\n\n this._objectsSubscription = space.db\n // TODO(burdon): ERROR: Cannot mix type and or filters.\n .query(Filter.not(Filter.or(Filter.schema(StoredSchema), Filter.schema(CollectionType))))\n .subscribe(\n ({ objects }) => {\n this._objects = objects;\n\n // Merge with current nodes.\n const currentNodes = this._graph.nodes;\n\n this._graph.nodes = [];\n this._graph.links = [];\n\n const addSchema = (typename: string) => {\n const current = currentNodes.find((node) => node.id === typename);\n if (typename) {\n this._graph.nodes.push({\n ...current,\n id: typename,\n type: 'schema',\n data: { typename },\n });\n }\n };\n\n // Runtime schema.\n space.db.graph.schemaRegistry.schemas.forEach((schema) => {\n const typename = getSchemaDXN(schema)?.toTypename();\n if (typename) {\n addSchema(typename);\n }\n });\n\n // Database Schema.\n this._schema?.forEach((schema) => {\n const typename = getSchemaDXN(schema)?.toTypename();\n if (typename) {\n addSchema(typename);\n }\n });\n\n // Database Objects.\n this._objects.forEach((object) => {\n const schema = getSchema(object);\n if (schema) {\n const typename = getSchemaDXN(schema)?.toTypename();\n if (typename) {\n const current = currentNodes.find((node) => node.id === object.id);\n this._graph.nodes.push({ ...current, id: object.id, type: 'object', data: { typename, object } });\n\n // Link to schema.\n const schemaNode = this._graph.nodes.find(\n (node) => node.type === 'schema' && node.data.typename === typename,\n );\n if (schemaNode) {\n this._graph.links.push({\n id: `${object.id}-${schemaNode.id}`,\n source: object.id,\n target: schemaNode.id,\n });\n } else {\n log.info('schema node not found', { typename });\n }\n\n // Link ot refs.\n // TODO(burdon): This isn't working.\n AST.getPropertySignatures(schema.ast).forEach((prop) => {\n if (!SchemaValidator.hasTypeAnnotation(schema, prop.name.toString(), ReferenceAnnotationId)) {\n return;\n }\n\n const value = object[String(prop.name)];\n if (value) {\n const refs = Array.isArray(value) ? value : [value];\n for (const ref of refs) {\n if (objects.findIndex((obj) => obj.id === ref.id) !== -1) {\n this._graph.links.push({\n id: `${object.id}-${String(prop.name)}-${ref.id}`,\n source: object.id,\n target: ref.id,\n });\n }\n }\n }\n });\n }\n }\n });\n\n this.triggerUpdate();\n },\n { fire: true },\n );\n }\n\n this.setSelected(objectId);\n return this;\n }\n\n close() {\n this._schemaSubscription?.();\n this._schemaSubscription = undefined;\n this._objectsSubscription?.();\n this._objectsSubscription = undefined;\n\n return this;\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useEffect, useState } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type Space } from '@dxos/client/echo';\nimport { createSvgContext, SVG, SVGRoot } from '@dxos/gem-core';\nimport { useAsyncState } from '@dxos/react-ui';\n\nimport { HierarchicalEdgeBundling, RadialTree, TidyTree } from './layout';\nimport { mapGraphToTreeData, type TreeNode } from './types';\nimport { SpaceGraphModel } from '../Graph';\n\n// TODO(burdon): Create dge bundling graph using d3.hierarchy.\n// https://observablehq.com/@d3/hierarchical-edge-bundling?intent=fork\n\ntype Renderer = (svg: SVGSVGElement, data: any, options: any) => void;\n\nexport type LayoutVariant = 'tidy' | 'radial' | 'edge';\n\n// TODO(burdon): Remove slots?\nexport type TreeLayoutSlots = {\n node?: string;\n path?: string;\n text?: string;\n};\n\nexport type TreeOptions = {\n label: (d: any) => string;\n\n slots?: TreeLayoutSlots;\n radius?: number;\n\n width: number;\n height: number;\n margin?: number;\n\n padding?: number;\n // Radius of nodes.\n r?: number;\n};\n\nexport const defaultTreeLayoutSlots: TreeLayoutSlots = {\n node: 'fill-blue-600',\n path: 'fill-none stroke-blue-400 stroke-[0.5px]',\n text: 'stroke-[0.5px] stroke-neutral-700 text-xs', // TODO(burdon): Create box instead of halo.\n};\n\nconst renderers = new Map<LayoutVariant, Renderer>([\n ['tidy', TidyTree],\n ['radial', RadialTree],\n ['edge', HierarchicalEdgeBundling],\n]);\n\nexport type TreeComponentProps<N = unknown> = {\n space: Space;\n selected?: string;\n variant?: LayoutVariant;\n onNodeClick?: (node?: N) => void;\n};\n\n// TODO(burdon): Label accessor.\nexport const Tree = <N,>({ space, selected, variant = 'tidy', onNodeClick }: TreeComponentProps<N>) => {\n const [model] = useAsyncState(\n async () => (space ? new SpaceGraphModel().open(space, selected) : undefined),\n [space, selected],\n );\n\n const [tree, setTree] = useState<TreeNode>();\n useEffect(() => {\n return model?.subscribe(() => {\n const tree = mapGraphToTreeData(model);\n setTree(tree);\n }, true);\n }, [model]);\n\n const context = createSvgContext();\n const { ref, width = 0, height = 0 } = useResizeDetector();\n\n useEffect(() => {\n if (width && height) {\n const size = Math.min(width, height);\n const radius = size * 0.4;\n const options = {\n // TODO(burdon): Type.\n label: (d: any) => d.label ?? d.id,\n width,\n height,\n radius,\n marginLeft: (width - radius * 2) / 2,\n marginRight: (width - radius * 2) / 2,\n marginTop: (height - radius * 2) / 2,\n marginBottom: (height - radius * 2) / 2,\n slots: defaultTreeLayoutSlots,\n };\n\n if (tree) {\n const renderer = renderers.get(variant);\n renderer?.(context.ref.current!, tree, options);\n }\n }\n }, [tree, width, height]);\n\n // TODO(burdon): Provider should expand.\n return (\n <div ref={ref} className='flex grow overflow-hidden' onClick={() => onNodeClick?.()}>\n <SVGRoot context={context}>\n <SVG />\n </SVGRoot>\n </div>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n// Copyright 2022 Observable, Inc.\n//\n\nimport * as d3 from 'd3';\nimport { type HierarchyNode } from 'd3-hierarchy';\n\nimport { type TreeOptions } from '../Tree';\nimport { type TreeNode } from '../types';\n\n// Create hierarchical ID.\n// eslint-disable-next-line unused-imports/no-unused-vars\nconst getId = (node: HierarchyNode<TreeNode>): string =>\n `${node.parent ? getId(node.parent) + '/' : ''}${node.data.id.slice(0, 4)}`;\n\n// https://github.com/d3/d3-hierarchy\n// https://observablehq.com/@d3/hierarchical-edge-bundling?intent=fork\nconst HierarchicalEdgeBundling = (s: SVGSVGElement, data: TreeNode, options: TreeOptions) => {\n const svg = d3.select(s);\n svg.selectAll('*').remove();\n\n const { radius = 600, padding = 100, slots } = options;\n\n // https://d3js.org/d3-hierarchy/hierarchy\n const root = d3.hierarchy(flatten(data));\n // .sort((a, b) => d3.ascending(a.height, b.height) || d3.ascending(getName(a.data), getName(b.data)));\n\n const tree = d3.cluster<TreeNode>().size([2 * Math.PI, radius - padding]);\n const layout = tree(addLinks(root));\n\n // eslint-disable-next-line unused-imports/no-unused-vars\n const node = svg\n .append('g')\n .selectAll()\n .data(layout.leaves())\n .join('g')\n .attr('transform', (d) => `rotate(${d.x * (180 / Math.PI) - 90}) translate(${d.y},0)`)\n .append('text')\n .attr('class', slots?.text ?? '')\n .attr('dy', '0.31em') // TODO(burdon): Based on font size.\n .attr('x', (d) => (d.x < Math.PI ? 6 : -6))\n .attr('text-anchor', (d) => (d.x < Math.PI ? 'start' : 'end'))\n .attr('transform', (d) => (d.x >= Math.PI ? 'rotate(180)' : null))\n // .text((d: any) => d.data.id)\n // .each(function (d: any) {\n // d.text = this;\n // })\n // .on('mouseover', overed)\n // .on('mouseout', outed)\n .call(\n (text) => text.text((d: any) => d.data.id.slice(0, 8)),\n // .text((d: any) => `${getId(d)} [${[(d as any).outgoing?.length ?? 0]}]`),\n );\n\n // https://d3js.org/d3-shape/radial-line\n const line = d3\n .lineRadial()\n .curve(d3.curveBundle.beta(0.85))\n .radius((d: any) => d.y)\n .angle((d: any) => d.x);\n\n // eslint-disable-next-line unused-imports/no-unused-vars\n const links = svg\n .append('g')\n .selectAll()\n .data(layout.leaves().flatMap((leaf: any) => leaf.outgoing))\n .join('path')\n .style('mix-blend-mode', 'multiply')\n .attr('class', slots?.path ?? '')\n .attr('d', ([i, o]) => {\n return line(i.path(o));\n })\n .each(function (d) {\n d.path = this;\n });\n\n // function overed(event: any, d: X) {\n // link.style('mix-blend-mode', null);\n // d3.select(this).attr('font-weight', 'bold');\n // d3.selectAll(d.incoming.map((d) => d.path))\n // .attr('stroke', color.in)\n // .raise();\n // d3.selectAll((d as any).incoming.map(([d]) => d.text))\n // .attr('fill', color.in)\n // .attr('font-weight', 'bold');\n // d3.selectAll(d.outgoing.map((d) => d.path))\n // .attr('stroke', color.out)\n // .raise();\n // d3.selectAll(d.outgoing.map(([, d]) => d.text))\n // .attr('fill', color.out)\n // .attr('font-weight', 'bold');\n // }\n\n // function outed(event: any, d: HierarchyNode<Datum>) {\n // // @ts-ignore\n // d3.select(this).attr('font-weight', null);\n // d3.selectAll(d.incoming.map((d) => d.path)).attr('stroke', null);\n // d3.selectAll(d.incoming.map(([d]) => d.text))\n // .attr('fill', null)\n // .attr('font-weight', null);\n // d3.selectAll(d.outgoing.map((d) => d.path)).attr('stroke', null);\n // d3.selectAll(d.outgoing.map(([, d]) => d.text))\n // .attr('fill', null)\n // .attr('font-weight', null);\n // }\n};\n\n// Monkey-patch with incoming/outgoing nodes.\nconst addLinks = (root: HierarchyNode<TreeNode>) => {\n // Map of nodes indexed by ID.\n const nodes = new Map(root.descendants().map((d) => [d.data.id, d]));\n const parents = root.descendants().reduce((map, d) => {\n if (d.children?.length) {\n map.set(d.data.id, d);\n }\n return map;\n }, new Map<string, HierarchyNode<TreeNode>>());\n\n for (const d of root.leaves()) {\n // (d as any).incoming = [];\n\n const parent = parents.get(d.data.id);\n if (parent) {\n // Skip the first node which is a placeholder created by flatten().\n (d as any).outgoing =\n parent.data.children?.slice(1).map((child) => {\n return [d, nodes.get(child.id)!];\n }) ?? [];\n } else {\n (d as any).outgoing = [];\n }\n }\n\n // for (const d of root.leaves()) {\n // for (const [_, o] of (d as any).outgoing) {\n // o.incoming.push(o);\n // }\n // }\n\n return root;\n};\n\n/**\n * We are using a hierarchy in order to group nodes by parent, but we want the parent\n * nodes to be positioned at the first level along with all descendents.\n * So we add a placeholder for all parents at the head of each group.\n * @param node\n */\nconst flatten = (node: TreeNode) => {\n const clone: TreeNode = {\n id: node.id,\n };\n\n // TODO(burdon): NOTE: Should exclude schema (since requires a tree).\n if (node.children?.length) {\n const children = node.children.map((child) => flatten(child));\n clone.children = [{ id: node.id }, ...children];\n }\n\n return clone;\n};\n\nexport default HierarchicalEdgeBundling;\n", "//\n// Copyright 2023 DXOS.org\n// Copyright 2022 Observable, Inc.\n//\n\nimport * as d3 from 'd3';\n\nimport { type TreeOptions } from '../Tree';\n\n// Released under the ISC license.\n// https://observablehq.com/@d3/radial-tree\n// https://observablehq.com/@d3/tree\nconst RadialTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {\n const svg = d3.select(s);\n svg.selectAll('*').remove();\n\n const {\n label, // given a node d, returns the display name\n radius = 400,\n r = 4, // radius of nodes\n slots,\n } = options;\n\n const arc = 2 * Math.PI;\n\n const root = d3.hierarchy(data);\n\n // Sort the nodes.\n // if (sort) {\n // root.sort(sort);\n // }\n\n // Compute labels and titles.\n const descendants = root.descendants();\n const getLabel = label === null ? null : descendants.map((d) => label(d.data));\n\n // Compute the layout.\n const layout = d3\n .tree()\n .size([arc, radius])\n .separation((a: any, b: any) => (a.parent === b.parent ? 1 : 2) / a.depth);\n layout(root);\n\n // Links.\n svg\n .append('g')\n .selectAll('path')\n .data(root.links())\n .join('path')\n .attr('class', slots?.path ?? '')\n .attr(\n 'd',\n d3\n .linkRadial()\n .angle((d: any) => d.x + Math.PI / 2)\n .radius((d: any) => d.y) as any,\n );\n\n // Nodes.\n const node = svg\n .append('g')\n .selectAll('a')\n .data(root.descendants())\n .join('a')\n // .attr('xlink:href', link == null ? null : (d) => link(d.data, d))\n // .attr('target', link == null ? null : linkTarget)\n .attr('transform', (d: any) => `rotate(${(d.x * 180) / Math.PI}) translate(${d.y},0)`);\n\n node\n .append('circle')\n .attr('class', slots?.node ?? '')\n .attr('r', r);\n\n // if (title != null) {\n // node.append('title').text((d) => title(d.data, d));\n // }\n\n // Text.\n if (getLabel) {\n node\n .append('text')\n .attr('transform', (d: any) => `rotate(${d.x >= Math.PI ? 180 : 0})`)\n .attr('dy', '0.32em')\n // eslint-disable-next-line no-mixed-operators\n .attr('x', (d: any) => (d.x < Math.PI === !d.children ? 6 : -6))\n // eslint-disable-next-line no-mixed-operators\n .attr('text-anchor', (d: any) => (d.x < Math.PI === !d.children ? 'start' : 'end'))\n // .attr('paint-order', 'stroke')\n .attr('class', slots?.text ?? '')\n .text((d, i) => getLabel[i]);\n }\n\n return svg.node();\n};\n\nexport default RadialTree;\n", "//\n// Copyright 2023 DXOS.org\n// Copyright 2021 Observable, Inc.\n//\n\nimport * as d3 from 'd3';\n\nimport { type TreeOptions } from '../Tree';\n\n// Released under the ISC license.\n// https://observablehq.com/@d3/tree\nconst TidyTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {\n const svg = d3.select(s);\n svg.selectAll('*').remove();\n\n const { label, width, height, r = 4, padding = 4, margin = 60, slots } = options;\n\n const root = d3.hierarchy(data);\n\n // Compute labels and titles.\n const descendants = root.descendants();\n const getLabel = label == null ? null : descendants.map((d) => label(d.data));\n\n // Compute the layout.\n const dx = 16;\n const dy = width / (root.height + padding);\n const layout = d3.tree().nodeSize([dx, dy]);\n layout(root);\n\n // Center the tree.\n let x0 = Infinity;\n let x1 = -x0;\n let y0 = Infinity;\n let y1 = -y0;\n root.each((d: any) => {\n if (d.x > x1) {\n x1 = d.x;\n }\n if (d.x < x0) {\n x0 = d.x;\n }\n if (d.y > y1) {\n y1 = d.y;\n }\n if (d.y < y0) {\n y0 = d.y;\n }\n });\n\n // TODO(burdon): Option to expand.\n // NOTE: x and y are flipped.\n const sx = Math.min(2, Math.max(1, (height - margin * 2) / (x1 - x0)));\n const oy = -(width - (y1 - y0)) / 2;\n\n // Links.\n svg\n .append('g')\n .selectAll('path')\n .data(root.links())\n .join('path')\n .attr('class', slots?.path ?? '')\n .attr(\n 'd',\n d3\n .link(d3.curveBumpX)\n .x((d: any) => d.y + oy)\n .y((d: any) => d.x * sx) as any,\n );\n\n // Nodes.\n const node = svg\n .append('g')\n .selectAll('a')\n .data(root.descendants())\n .join('a')\n // .attr('xlink:href', link == null ? null : (d) => link(d.data, d))\n // .attr('target', link == null ? null : linkTarget)\n .attr('transform', (d: any) => `translate(${d.y + oy},${d.x * sx})`);\n\n node\n .append('circle')\n .attr('class', slots?.node ?? '')\n .attr('r', r);\n\n // if (title != null) {\n // node.append('title').text((d) => title(d.data, d));\n // }\n\n if (getLabel) {\n node\n .append('text')\n\n .attr('dy', '0.32em')\n .attr('x', (d) => (d.children ? -6 : 6))\n .attr('text-anchor', (d) => (d.children ? 'end' : 'start'))\n // .attr('paint-order', 'stroke')\n .attr('class', slots?.text ?? '')\n .text((d, i) => getLabel[i]);\n }\n};\n\nexport default TidyTree;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { GraphModel } from '@dxos/gem-spore';\n\nexport type TreeNode = {\n id: string;\n label?: string;\n children?: TreeNode[];\n};\n\nexport const mapGraphToTreeData = <N>(model: GraphModel<N>, maxDepth = 8): TreeNode | undefined => {\n const mapNode = (node: N, depth = 0): TreeNode => {\n const treeNode: TreeNode = {\n id: model.idAccessor(node),\n label: model.idAccessor(node).slice(0, 8),\n };\n\n const links = model.graph.links.filter((link) => link.source === treeNode.id);\n if (depth < maxDepth) {\n treeNode.children = links.map((link) =>\n mapNode(model.graph.nodes.find((node) => model.idAccessor(node) === link.target)!, depth + 1),\n );\n }\n\n return treeNode;\n };\n\n let data: TreeNode | undefined;\n if (model.selected) {\n const node = model.graph.nodes.find((node) => model.idAccessor(node) === model.selected);\n if (node) {\n data = mapNode(node);\n }\n }\n\n return data;\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { forceLink, forceManyBody } from 'd3';\nimport ForceGraph from 'force-graph';\nimport React, { type FC, useEffect, useMemo, useRef, useState } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { getTypename, type ReactiveEchoObject, type Space } from '@dxos/client/echo';\nimport { createSvgContext, defaultGridStyles, Grid, SVG, SVGRoot, Zoom } from '@dxos/gem-core';\nimport {\n defaultStyles,\n Graph as GraphComponent,\n GraphForceProjector,\n type GraphLayoutNode,\n Markers,\n} from '@dxos/gem-spore';\nimport { filterObjectsSync, type SearchResult } from '@dxos/plugin-search';\nimport { useAsyncState, useThemeContext } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\nimport '@dxos/gem-spore/styles';\n\nimport { type EchoGraphNode, SpaceGraphModel } from './graph-model';\nimport { Tree } from '../Tree';\n\ntype Slots = {\n root?: { className?: string };\n grid?: { className?: string };\n};\n\nconst slots: Slots = {};\n\nconst colors = [\n '[&>circle]:!fill-black-300 [&>circle]:!stroke-black-600',\n '[&>circle]:!fill-slate-300 [&>circle]:!stroke-slate-600',\n '[&>circle]:!fill-green-300 [&>circle]:!stroke-green-600',\n '[&>circle]:!fill-sky-300 [&>circle]:!stroke-sky-600',\n '[&>circle]:!fill-cyan-300 [&>circle]:!stroke-cyan-600',\n '[&>circle]:!fill-rose-300 [&>circle]:!stroke-rose-600',\n '[&>circle]:!fill-purple-300 [&>circle]:!stroke-purple-600',\n '[&>circle]:!fill-orange-300 [&>circle]:!stroke-orange-600',\n '[&>circle]:!fill-teal-300 [&>circle]:!stroke-teal-600',\n '[&>circle]:!fill-indigo-300 [&>circle]:!stroke-indigo-600',\n];\n\nexport type GraphProps = {\n space: Space;\n match?: RegExp;\n grid?: boolean;\n svg?: boolean;\n};\n\nexport const Graph: FC<GraphProps> = ({ space, match, grid, svg }) => {\n const { themeMode } = useThemeContext();\n const [selected, setSelected] = useState<string>();\n\n const [model] = useAsyncState(\n async () => (space ? new SpaceGraphModel({ schema: true }).open(space) : undefined),\n [space],\n );\n\n const context = createSvgContext();\n const projector = useMemo(\n () =>\n new GraphForceProjector<EchoGraphNode>(context, {\n forces: {\n manyBody: {\n strength: -100,\n },\n link: {\n distance: 100,\n },\n radial: {\n radius: 150,\n strength: 0.05,\n },\n },\n attributes: {\n radius: (node: GraphLayoutNode<EchoGraphNode>) => (node.data?.type === 'schema' ? 12 : 8),\n },\n }),\n [],\n );\n\n const filteredRef = useRef<SearchResult[]>();\n filteredRef.current = filterObjectsSync(model?.objects ?? [], match);\n useEffect(() => {\n void projector.start();\n }, [match]);\n\n const [colorMap] = useState(new Map<string, string>());\n\n // https://github.com/vasturiano/force-graph\n const { ref, width, height } = useResizeDetector();\n const rootRef = useRef<HTMLDivElement>(null);\n const forceGraph = useRef<ForceGraph>();\n\n useEffect(() => {\n if (rootRef.current) {\n forceGraph.current = new ForceGraph(rootRef.current)\n .nodeRelSize(6)\n .nodeLabel((node: any) => {\n if (node.type === 'schema') {\n return node.data.typename;\n }\n\n return node.id;\n })\n .nodeAutoColorBy((node: any) => (node.type === 'schema' ? 'schema' : node.data.typename))\n .linkColor(() => 'rgba(255,255,255,0.25)');\n }\n\n return () => {\n forceGraph.current?.pauseAnimation().graphData({ nodes: [], links: [] });\n forceGraph.current = undefined;\n };\n }, []);\n\n // Update.\n useEffect(() => {\n if (forceGraph.current && width && height && model) {\n forceGraph.current\n .pauseAnimation()\n .width(width)\n .height(height)\n .onEngineStop(() => {\n forceGraph.current?.zoomToFit(400, 40);\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 // .d3AlphaDecay(0.0228)\n // .d3VelocityDecay(0.4)\n .warmupTicks(100)\n // .cooldownTime(1000)\n\n //\n .graphData(model.graph)\n .resumeAnimation();\n }\n }, [model, width, height]);\n\n const handleZoomToFit = () => {\n forceGraph.current?.zoomToFit(400, 40);\n };\n\n if (!svg) {\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 if (selected) {\n return <Tree space={space} selected={selected} variant='tidy' onNodeClick={() => setSelected(undefined)} />;\n }\n\n return (\n <SVGRoot context={context}>\n <SVG className={mx(defaultStyles, slots?.root?.className)}>\n <Markers arrowSize={6} />\n {grid && <Grid className={slots?.grid?.className ?? defaultGridStyles(themeMode)} />}\n <Zoom extent={[1 / 2, 4]}>\n <GraphComponent\n model={model}\n projector={projector}\n drag\n arrows\n onSelect={(node) => setSelected(node?.data?.id)}\n labels={{\n text: (node: GraphLayoutNode<ReactiveEchoObject<any>>) => {\n if (filteredRef.current?.length && !filteredRef.current.some((object) => object.id === node.data?.id)) {\n return undefined;\n }\n\n // TODO(burdon): Use schema.\n return node.data?.label ?? node.data?.title ?? node.data?.name ?? node.data?.id.slice(0, 8);\n },\n }}\n attributes={{\n node: (node: GraphLayoutNode<ReactiveEchoObject<any>>) => {\n let className: string | undefined;\n if (node.data) {\n const { object } = node.data;\n if (object) {\n const typename = getTypename(object);\n if (typename) {\n className = colorMap.get(typename);\n if (!className) {\n className = colors[colorMap.size % colors.length];\n colorMap.set(typename, className);\n }\n }\n }\n }\n\n const selected = filteredRef.current?.some((object) => object.id === node.data?.id);\n const blur = !selected && !!filteredRef.current?.length;\n return {\n class: mx(className, blur && 'opac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zC;IACF;EACF,GAAG;IAAChB;IAAMS;IAAOC;GAAO;AAGxB,SACE,gBAAAkB,OAAA,cAACC,OAAAA;IAAIrB;IAAUsB,WAAU;IAA4BC,SAAS,MAAMrC,cAAAA;KAClE,gBAAAkC,OAAA,cAACI,UAAAA;IAAQ1B;KACP,gBAAAsB,OAAA,cAACK,MAAAA,IAAAA,CAAAA,CAAAA;AAIT;",
|
|
6
|
+
"names": ["getSchema", "getSchemaDXN", "AST", "ReferenceAnnotationId", "SchemaValidator", "StoredSchema", "GraphModel", "log", "CollectionType", "Filter", "SpaceGraphModel", "constructor", "_options", "_graph", "nodes", "links", "graph", "objects", "_objects", "open", "space", "objectId", "_schemaSubscription", "schemaaQuery", "db", "schemaRegistry", "query", "schemas", "run", "onSchemaUpdate", "results", "_schema", "subscribe", "_objectsSubscription", "not", "or", "schema", "currentNodes", "addSchema", "typename", "current", "find", "node", "id", "push", "type", "data", "forEach", "toTypename", "object", "schemaNode", "source", "target", "info", "getPropertySignatures", "ast", "prop", "hasTypeAnnotation", "name", "toString", "value", "String", "refs", "Array", "isArray", "ref", "findIndex", "obj", "triggerUpdate", "fire", "setSelected", "close", "undefined", "React", "useEffect", "useState", "useResizeDetector", "createSvgContext", "SVG", "SVGRoot", "useAsyncState", "d3", "HierarchicalEdgeBundling", "s", "data", "options", "svg", "select", "selectAll", "remove", "radius", "padding", "slots", "root", "hierarchy", "flatten", "tree", "cluster", "size", "Math", "PI", "layout", "addLinks", "node", "append", "leaves", "join", "attr", "d", "x", "y", "text", "call", "id", "slice", "line", "lineRadial", "curve", "curveBundle", "beta", "angle", "links", "flatMap", "leaf", "outgoing", "style", "path", "i", "o", "each", "nodes", "Map", "descendants", "map", "parents", "reduce", "children", "length", "set", "parent", "get", "child", "clone", "d3", "RadialTree", "s", "data", "options", "svg", "select", "selectAll", "remove", "label", "radius", "r", "slots", "arc", "Math", "PI", "root", "hierarchy", "descendants", "getLabel", "map", "d", "layout", "tree", "size", "separation", "a", "b", "parent", "depth", "append", "links", "join", "attr", "path", "linkRadial", "angle", "x", "y", "node", "children", "text", "i", "d3", "TidyTree", "s", "data", "options", "svg", "select", "selectAll", "remove", "label", "width", "height", "r", "padding", "margin", "slots", "root", "hierarchy", "descendants", "getLabel", "map", "d", "dx", "dy", "layout", "tree", "nodeSize", "x0", "Infinity", "x1", "y0", "y1", "each", "x", "y", "sx", "Math", "min", "max", "oy", "append", "links", "join", "attr", "path", "link", "curveBumpX", "node", "children", "text", "i", "mapGraphToTreeData", "model", "maxDepth", "mapNode", "node", "depth", "treeNode", "id", "idAccessor", "label", "slice", "links", "graph", "filter", "link", "source", "children", "map", "nodes", "find", "target", "data", "selected", "forceLink", "forceManyBody", "ForceGraph", "React", "useEffect", "useMemo", "useRef", "useState", "useResizeDetector", "getTypename", "createSvgContext", "defaultGridStyles", "Grid", "SVG", "SVGRoot", "Zoom", "defaultStyles", "Graph", "GraphComponent", "GraphForceProjector", "Markers", "filterObjectsSync", "useAsyncState", "useThemeContext", "mx", "slots", "colors", "Graph", "space", "match", "grid", "svg", "themeMode", "useThemeContext", "selected", "setSelected", "useState", "model", "useAsyncState", "SpaceGraphModel", "schema", "open", "undefined", "context", "createSvgContext", "projector", "useMemo", "GraphForceProjector", "forces", "manyBody", "strength", "link", "distance", "radial", "radius", "attributes", "node", "data", "type", "filteredRef", "useRef", "current", "filterObjectsSync", "objects", "useEffect", "start", "colorMap", "Map", "ref", "width", "height", "useResizeDetector", "rootRef", "forceGraph", "ForceGraph", "nodeRelSize", "nodeLabel", "typename", "id", "nodeAutoColorBy", "linkColor", "pauseAnimation", "graphData", "nodes", "links", "onEngineStop", "zoomToFit", "d3Force", "forceLink", "forceManyBody", "warmupTicks", "graph", "resumeAnimation", "handleZoomToFit", "div", "className", "onClick", "Tree", "variant", "onNodeClick", "SVGRoot", "SVG", "mx", "defaultStyles", "root", "Markers", "arrowSize", "Grid", "defaultGridStyles", "Zoom", "extent", "GraphComponent", "drag", "arrows", "onSelect", "labels", "text", "length", "some", "object", "label", "title", "name", "slice", "getTypename", "get", "size", "set", "blur", "class", "defaultTreeLayoutSlots", "node", "path", "text", "renderers", "Map", "TidyTree", "RadialTree", "HierarchicalEdgeBundling", "Tree", "space", "selected", "variant", "onNodeClick", "model", "useAsyncState", "SpaceGraphModel", "open", "undefined", "tree", "setTree", "useState", "useEffect", "subscribe", "mapGraphToTreeData", "context", "createSvgContext", "ref", "width", "height", "useResizeDetector", "size", "Math", "min", "radius", "options", "label", "d", "id", "marginLeft", "marginRight", "marginTop", "marginBottom", "slots", "renderer", "get", "current", "React", "div", "className", "onClick", "SVGRoot", "SVG"]
|
|
7
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
EXPLORER_PLUGIN
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UHJZUVRI.mjs";
|
|
5
5
|
|
|
6
6
|
// packages/plugins/experimental/plugin-explorer/src/types/schema.ts
|
|
7
7
|
import { S, TypedObject } from "@dxos/echo-schema";
|
|
8
8
|
var ViewType = class extends TypedObject({
|
|
9
|
-
typename: "dxos.org/type/
|
|
9
|
+
typename: "dxos.org/type/ExplorerView",
|
|
10
10
|
version: "0.1.0"
|
|
11
11
|
})({
|
|
12
12
|
name: S.optional(S.String),
|
|
@@ -35,4 +35,4 @@ export {
|
|
|
35
35
|
ViewType,
|
|
36
36
|
ExplorerAction
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-57K7ORAW.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\n// TODO(burdon): Clashes with sdk/view.\nexport class ViewType extends TypedObject({\n typename: 'dxos.org/type/
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\n// TODO(burdon): Clashes with sdk/view.\nexport class ViewType extends TypedObject({\n typename: 'dxos.org/type/ExplorerView',\n version: '0.1.0',\n})({\n name: S.optional(S.String),\n type: S.String,\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { S } from '@dxos/echo-schema';\n\nimport { ViewType } from './schema';\nimport { EXPLORER_PLUGIN } from '../meta';\n\nexport namespace ExplorerAction {\n const EXPLORER_ACTION = `${EXPLORER_PLUGIN}/action`;\n\n export class Create extends S.TaggedClass<Create>()(`${EXPLORER_ACTION}/create`, {\n input: S.Struct({\n name: S.optional(S.String),\n }),\n output: S.Struct({\n object: ViewType,\n }),\n }) {}\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;AAIA,SAASA,GAAGC,mBAAmB;AAGxB,IAAMC,WAAN,cAAuBC,YAAY;EACxCC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,MAAMC,EAAEC,SAASD,EAAEE,MAAM;EACzBC,MAAMH,EAAEE;AACV,CAAA,EAAA;AAAI;;;ACTJ,SAASE,KAAAA,UAAS;;UAKDC,iBAAAA;AACf,QAAMC,kBAAkB,GAAGC,eAAAA;EAEpB,MAAMC,eAAeC,GAAEC,YAAW,EAAW,GAAGJ,eAAAA,WAA0B;IAC/EK,OAAOF,GAAEG,OAAO;MACdC,MAAMJ,GAAEK,SAASL,GAAEM,MAAM;IAC3B,CAAA;IACAC,QAAQP,GAAEG,OAAO;MACfK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;kBAPSV,SAAAA;AAQf,GAXiBH,mBAAAA,iBAAAA,CAAAA,EAAAA;",
|
|
6
6
|
"names": ["S", "TypedObject", "ViewType", "TypedObject", "typename", "version", "name", "S", "optional", "String", "type", "S", "ExplorerAction", "EXPLORER_ACTION", "EXPLORER_PLUGIN", "Create", "S", "TaggedClass", "input", "Struct", "name", "optional", "String", "output", "object", "ViewType"]
|
|
7
7
|
}
|
|
@@ -10824,11 +10824,11 @@ var Globe = ({ items = [], accessor, projection = "orthographic", options = defa
|
|
|
10824
10824
|
|
|
10825
10825
|
// packages/plugins/experimental/plugin-explorer/src/components/index.ts
|
|
10826
10826
|
import { lazy } from "react";
|
|
10827
|
-
var ExplorerContainer = lazy(() => import("./ExplorerContainer-
|
|
10827
|
+
var ExplorerContainer = lazy(() => import("./ExplorerContainer-TM3VIXVK.mjs"));
|
|
10828
10828
|
|
|
10829
10829
|
export {
|
|
10830
10830
|
Chart,
|
|
10831
10831
|
Globe,
|
|
10832
10832
|
ExplorerContainer
|
|
10833
10833
|
};
|
|
10834
|
-
//# sourceMappingURL=chunk-
|
|
10834
|
+
//# sourceMappingURL=chunk-BRJI3QC2.mjs.map
|
|
@@ -5,11 +5,14 @@ var EXPLORER_PLUGIN = "dxos.org/plugin/explorer";
|
|
|
5
5
|
var meta = {
|
|
6
6
|
id: EXPLORER_PLUGIN,
|
|
7
7
|
name: "Explorer",
|
|
8
|
-
description: "
|
|
8
|
+
description: "Install this plugin to view a hypergraph of all objects inside of your Space.",
|
|
9
9
|
icon: "ph--graph--regular",
|
|
10
10
|
source: "https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-explorer",
|
|
11
11
|
tags: [
|
|
12
12
|
"experimental"
|
|
13
|
+
],
|
|
14
|
+
screenshots: [
|
|
15
|
+
"https://dxos.network/plugin-details-explorer-dark.png"
|
|
13
16
|
]
|
|
14
17
|
};
|
|
15
18
|
|
|
@@ -17,4 +20,4 @@ export {
|
|
|
17
20
|
EXPLORER_PLUGIN,
|
|
18
21
|
meta
|
|
19
22
|
};
|
|
20
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-UHJZUVRI.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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';\n\nexport const EXPLORER_PLUGIN = 'dxos.org/plugin/explorer';\n\nexport const meta = {\n id: EXPLORER_PLUGIN,\n name: 'Explorer',\n description: 'Install this plugin to view a hypergraph of all objects inside of your Space.',\n icon: 'ph--graph--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-explorer',\n tags: ['experimental'],\n screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";;;AAMO,IAAMA,kBAAkB;AAExB,IAAMC,OAAO;EAClBC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
|
|
6
|
+
"names": ["EXPLORER_PLUGIN", "meta", "id", "name", "description", "icon", "source", "tags", "screenshots"]
|
|
7
|
+
}
|