@dxos/plugin-explorer 0.6.12 → 0.6.13-main.548ca8d

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.
Files changed (60) hide show
  1. package/dist/lib/browser/{ExplorerArticle-2LF7QANN.mjs → ExplorerArticle-5SNS2WNJ.mjs} +2 -2
  2. package/dist/lib/browser/{ExplorerMain-K6Z6UVZR.mjs → ExplorerMain-ZEXQSLWN.mjs} +2 -2
  3. package/dist/lib/browser/chunk-NIYKOKPC.mjs +17 -0
  4. package/dist/lib/browser/chunk-NIYKOKPC.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-JIDPF2GF.mjs → chunk-OUWTEFDV.mjs} +2 -2
  6. package/dist/lib/browser/{chunk-XKITKIPQ.mjs → chunk-WNQNMDOO.mjs} +2 -2
  7. package/dist/lib/browser/{chunk-XKITKIPQ.mjs.map → chunk-WNQNMDOO.mjs.map} +3 -3
  8. package/dist/lib/browser/index.mjs +7 -10
  9. package/dist/lib/browser/index.mjs.map +3 -3
  10. package/dist/lib/browser/meta.json +1 -1
  11. package/dist/lib/browser/meta.mjs +1 -1
  12. package/dist/lib/browser/types/index.mjs +2 -2
  13. package/dist/lib/node/{ExplorerArticle-PQEEN244.cjs → ExplorerArticle-QWLRFTJ3.cjs} +6 -6
  14. package/dist/lib/node/{ExplorerMain-IGUMYIAN.cjs → ExplorerMain-YHTGV7H5.cjs} +6 -6
  15. package/dist/lib/node/{chunk-K4PB5A4K.cjs → chunk-B3DD7UMY.cjs} +4 -4
  16. package/dist/lib/node/{chunk-K4PB5A4K.cjs.map → chunk-B3DD7UMY.cjs.map} +1 -1
  17. package/dist/lib/node/{chunk-HYXFS3AG.cjs → chunk-XPJ3TJZY.cjs} +6 -6
  18. package/dist/lib/node/{chunk-UJZYAOD2.cjs → chunk-XSC6U7EH.cjs} +7 -21
  19. package/dist/lib/node/chunk-XSC6U7EH.cjs.map +7 -0
  20. package/dist/lib/node/index.cjs +33 -36
  21. package/dist/lib/node/index.cjs.map +3 -3
  22. package/dist/lib/node/meta.cjs +3 -3
  23. package/dist/lib/node/meta.cjs.map +1 -1
  24. package/dist/lib/node/meta.json +1 -1
  25. package/dist/lib/node/types/index.cjs +4 -4
  26. package/dist/lib/node/types/index.cjs.map +1 -1
  27. package/dist/lib/node-esm/ExplorerArticle-5NBIKSBJ.mjs +28 -0
  28. package/dist/lib/node-esm/ExplorerArticle-5NBIKSBJ.mjs.map +7 -0
  29. package/dist/lib/node-esm/ExplorerMain-2M5RWFU4.mjs +34 -0
  30. package/dist/lib/node-esm/ExplorerMain-2M5RWFU4.mjs.map +7 -0
  31. package/dist/lib/node-esm/chunk-BMZO4IJU.mjs +28 -0
  32. package/dist/lib/node-esm/chunk-BMZO4IJU.mjs.map +7 -0
  33. package/dist/lib/node-esm/chunk-T6BPVYCJ.mjs +476 -0
  34. package/dist/lib/node-esm/chunk-T6BPVYCJ.mjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-W2DSGFVW.mjs +19 -0
  36. package/dist/lib/node-esm/chunk-W2DSGFVW.mjs.map +7 -0
  37. package/dist/lib/node-esm/index.mjs +10995 -0
  38. package/dist/lib/node-esm/index.mjs.map +7 -0
  39. package/dist/lib/node-esm/meta.json +1 -0
  40. package/dist/lib/node-esm/meta.mjs +10 -0
  41. package/dist/lib/node-esm/meta.mjs.map +7 -0
  42. package/dist/lib/node-esm/types/index.mjs +11 -0
  43. package/dist/lib/node-esm/types/index.mjs.map +7 -0
  44. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  45. package/dist/types/src/meta.d.ts +4 -9
  46. package/dist/types/src/meta.d.ts.map +1 -1
  47. package/package.json +33 -29
  48. package/src/ExplorerPlugin.tsx +2 -5
  49. package/src/components/Graph/graph-model.ts +1 -1
  50. package/src/meta.ts +15 -0
  51. package/dist/lib/browser/chunk-TL6ADY3P.mjs +0 -21
  52. package/dist/lib/browser/chunk-TL6ADY3P.mjs.map +0 -7
  53. package/dist/lib/node/chunk-UJZYAOD2.cjs.map +0 -7
  54. package/src/meta.tsx +0 -19
  55. /package/dist/lib/browser/{ExplorerArticle-2LF7QANN.mjs.map → ExplorerArticle-5SNS2WNJ.mjs.map} +0 -0
  56. /package/dist/lib/browser/{ExplorerMain-K6Z6UVZR.mjs.map → ExplorerMain-ZEXQSLWN.mjs.map} +0 -0
  57. /package/dist/lib/browser/{chunk-JIDPF2GF.mjs.map → chunk-OUWTEFDV.mjs.map} +0 -0
  58. /package/dist/lib/node/{ExplorerArticle-PQEEN244.cjs.map → ExplorerArticle-QWLRFTJ3.cjs.map} +0 -0
  59. /package/dist/lib/node/{ExplorerMain-IGUMYIAN.cjs.map → ExplorerMain-YHTGV7H5.cjs.map} +0 -0
  60. /package/dist/lib/node/{chunk-HYXFS3AG.cjs.map → chunk-XPJ3TJZY.cjs.map} +0 -0
@@ -0,0 +1,476 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // packages/plugins/experimental/plugin-explorer/src/components/Graph/graph-model.ts
4
+ import { AST, getSchema, getType, DynamicSchema, ReferenceAnnotationId, SchemaValidator, StoredSchema } from "@dxos/echo-schema";
5
+ import { GraphModel } from "@dxos/gem-spore";
6
+ import { log } from "@dxos/log";
7
+ import { CollectionType } from "@dxos/plugin-space/types";
8
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/experimental/plugin-explorer/src/components/Graph/graph-model.ts";
9
+ var SpaceGraphModel = class extends GraphModel {
10
+ constructor(_options = {}) {
11
+ super();
12
+ this._options = _options;
13
+ this._graph = {
14
+ nodes: [],
15
+ links: []
16
+ };
17
+ }
18
+ get graph() {
19
+ return this._graph;
20
+ }
21
+ get objects() {
22
+ return this._objects ?? [];
23
+ }
24
+ open(space, objectId) {
25
+ if (!this._subscription) {
26
+ const query = space.db.query((object) => !(object instanceof CollectionType));
27
+ this._subscription = query.subscribe(({ objects }) => {
28
+ this._objects = objects;
29
+ this._graph.nodes = objects.map((object) => {
30
+ if (object instanceof StoredSchema) {
31
+ const effectSchema = space.db.schema.getSchemaById(object.id);
32
+ return {
33
+ type: "schema",
34
+ id: object.id,
35
+ schema: effectSchema.schema
36
+ };
37
+ }
38
+ return {
39
+ type: "echo-object",
40
+ id: object.id,
41
+ object
42
+ };
43
+ });
44
+ this._graph.links = objects.reduce((links, object) => {
45
+ const objectSchema = getSchema(object);
46
+ const typename = getType(object)?.objectId;
47
+ if (objectSchema == null || typename == null) {
48
+ log.info("no schema for object:", {
49
+ id: object.id.slice(0, 8)
50
+ }, {
51
+ F: __dxlog_file,
52
+ L: 81,
53
+ S: this,
54
+ C: (f, a) => f(...a)
55
+ });
56
+ return links;
57
+ }
58
+ if (!(objectSchema instanceof DynamicSchema)) {
59
+ const idx = objects.findIndex((obj) => obj.id === typename);
60
+ if (idx === -1) {
61
+ this._graph.nodes.push({
62
+ id: typename,
63
+ type: "schema",
64
+ schema: objectSchema
65
+ });
66
+ }
67
+ }
68
+ if (this._options.schema) {
69
+ links.push({
70
+ id: `${object.id}-${typename}`,
71
+ source: object.id,
72
+ target: typename
73
+ });
74
+ }
75
+ AST.getPropertySignatures(objectSchema.ast).forEach((prop) => {
76
+ if (!SchemaValidator.hasTypeAnnotation(objectSchema, prop.name.toString(), ReferenceAnnotationId)) {
77
+ return;
78
+ }
79
+ const value = object[String(prop.name)];
80
+ if (value) {
81
+ const refs = Array.isArray(value) ? value : [
82
+ value
83
+ ];
84
+ for (const ref of refs) {
85
+ if (objects.findIndex((obj) => obj.id === ref.id) !== -1) {
86
+ links.push({
87
+ id: `${object.id}-${String(prop.name)}-${ref.id}`,
88
+ source: object.id,
89
+ target: ref.id
90
+ });
91
+ }
92
+ }
93
+ }
94
+ });
95
+ return links;
96
+ }, []);
97
+ this.triggerUpdate();
98
+ }, {
99
+ fire: true
100
+ });
101
+ }
102
+ this.setSelected(objectId);
103
+ return this;
104
+ }
105
+ close() {
106
+ if (this._subscription) {
107
+ this._subscription();
108
+ this._subscription = void 0;
109
+ }
110
+ return this;
111
+ }
112
+ };
113
+
114
+ // packages/plugins/experimental/plugin-explorer/src/components/Tree/Tree.tsx
115
+ import React2, { useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
116
+ import { useResizeDetector } from "react-resize-detector";
117
+ import { createSvgContext as createSvgContext2, SVG as SVG2, SVGRoot as SVGRoot2 } from "@dxos/gem-core";
118
+
119
+ // packages/plugins/experimental/plugin-explorer/src/components/Tree/layout/HierarchicalEdgeBundling.ts
120
+ import * as d3 from "d3";
121
+ var HierarchicalEdgeBundling = (s, data, options) => {
122
+ const svg = d3.select(s);
123
+ svg.selectAll("*").remove();
124
+ const { radius = 600, padding = 100, slots: slots2 } = options;
125
+ const root = d3.hierarchy(flatten(data));
126
+ const tree3 = d3.cluster().size([
127
+ 2 * Math.PI,
128
+ radius - padding
129
+ ]);
130
+ const layout = tree3(addLinks(root));
131
+ const node = svg.append("g").selectAll().data(layout.leaves()).join("g").attr("transform", (d) => `rotate(${d.x * (180 / Math.PI) - 90}) translate(${d.y},0)`).append("text").attr("class", slots2?.text ?? "").attr("dy", "0.31em").attr("x", (d) => d.x < Math.PI ? 6 : -6).attr("text-anchor", (d) => d.x < Math.PI ? "start" : "end").attr("transform", (d) => d.x >= Math.PI ? "rotate(180)" : null).call((text) => text.text((d) => d.data.id.slice(0, 8)));
132
+ const line = d3.lineRadial().curve(d3.curveBundle.beta(0.85)).radius((d) => d.y).angle((d) => d.x);
133
+ const links = svg.append("g").selectAll().data(layout.leaves().flatMap((leaf) => leaf.outgoing)).join("path").style("mix-blend-mode", "multiply").attr("class", slots2?.path ?? "").attr("d", ([i, o]) => {
134
+ return line(i.path(o));
135
+ }).each(function(d) {
136
+ d.path = this;
137
+ });
138
+ };
139
+ var addLinks = (root) => {
140
+ const nodes = new Map(root.descendants().map((d) => [
141
+ d.data.id,
142
+ d
143
+ ]));
144
+ const parents = root.descendants().reduce((map, d) => {
145
+ if (d.children?.length) {
146
+ map.set(d.data.id, d);
147
+ }
148
+ return map;
149
+ }, /* @__PURE__ */ new Map());
150
+ for (const d of root.leaves()) {
151
+ const parent = parents.get(d.data.id);
152
+ if (parent) {
153
+ d.outgoing = parent.data.children?.slice(1).map((child) => {
154
+ return [
155
+ d,
156
+ nodes.get(child.id)
157
+ ];
158
+ }) ?? [];
159
+ } else {
160
+ d.outgoing = [];
161
+ }
162
+ }
163
+ return root;
164
+ };
165
+ var flatten = (node) => {
166
+ const clone = {
167
+ id: node.id
168
+ };
169
+ if (node.children?.length) {
170
+ const children = node.children.map((child) => flatten(child));
171
+ clone.children = [
172
+ {
173
+ id: node.id
174
+ },
175
+ ...children
176
+ ];
177
+ }
178
+ return clone;
179
+ };
180
+ var HierarchicalEdgeBundling_default = HierarchicalEdgeBundling;
181
+
182
+ // packages/plugins/experimental/plugin-explorer/src/components/Tree/layout/RadialTree.ts
183
+ import * as d32 from "d3";
184
+ var RadialTree = (s, data, options) => {
185
+ const svg = d32.select(s);
186
+ svg.selectAll("*").remove();
187
+ const { label, radius = 400, r = 4, slots: slots2 } = options;
188
+ const arc = 2 * Math.PI;
189
+ const root = d32.hierarchy(data);
190
+ const descendants = root.descendants();
191
+ const getLabel = label === null ? null : descendants.map((d) => label(d.data));
192
+ const layout = d32.tree().size([
193
+ arc,
194
+ radius
195
+ ]).separation((a, b) => (a.parent === b.parent ? 1 : 2) / a.depth);
196
+ layout(root);
197
+ svg.append("g").selectAll("path").data(root.links()).join("path").attr("class", slots2?.path ?? "").attr("d", d32.linkRadial().angle((d) => d.x + Math.PI / 2).radius((d) => d.y));
198
+ const node = svg.append("g").selectAll("a").data(root.descendants()).join("a").attr("transform", (d) => `rotate(${d.x * 180 / Math.PI}) translate(${d.y},0)`);
199
+ node.append("circle").attr("class", slots2?.node ?? "").attr("r", r);
200
+ if (getLabel) {
201
+ node.append("text").attr("transform", (d) => `rotate(${d.x >= Math.PI ? 180 : 0})`).attr("dy", "0.32em").attr("x", (d) => d.x < Math.PI === !d.children ? 6 : -6).attr("text-anchor", (d) => d.x < Math.PI === !d.children ? "start" : "end").attr("class", slots2?.text ?? "").text((d, i) => getLabel[i]);
202
+ }
203
+ return svg.node();
204
+ };
205
+ var RadialTree_default = RadialTree;
206
+
207
+ // packages/plugins/experimental/plugin-explorer/src/components/Tree/layout/TidyTree.ts
208
+ import * as d33 from "d3";
209
+ var TidyTree = (s, data, options) => {
210
+ const svg = d33.select(s);
211
+ svg.selectAll("*").remove();
212
+ const { label, width, height, r = 4, padding = 4, margin = 60, slots: slots2 } = options;
213
+ const root = d33.hierarchy(data);
214
+ const descendants = root.descendants();
215
+ const getLabel = label == null ? null : descendants.map((d) => label(d.data));
216
+ const dx = 16;
217
+ const dy = width / (root.height + padding);
218
+ const layout = d33.tree().nodeSize([
219
+ dx,
220
+ dy
221
+ ]);
222
+ layout(root);
223
+ let x0 = Infinity;
224
+ let x1 = -x0;
225
+ let y0 = Infinity;
226
+ let y1 = -y0;
227
+ root.each((d) => {
228
+ if (d.x > x1) {
229
+ x1 = d.x;
230
+ }
231
+ if (d.x < x0) {
232
+ x0 = d.x;
233
+ }
234
+ if (d.y > y1) {
235
+ y1 = d.y;
236
+ }
237
+ if (d.y < y0) {
238
+ y0 = d.y;
239
+ }
240
+ });
241
+ const sx = Math.min(2, Math.max(1, (height - margin * 2) / (x1 - x0)));
242
+ const oy = -(width - (y1 - y0)) / 2;
243
+ svg.append("g").selectAll("path").data(root.links()).join("path").attr("class", slots2?.path ?? "").attr("d", d33.link(d33.curveBumpX).x((d) => d.y + oy).y((d) => d.x * sx));
244
+ const node = svg.append("g").selectAll("a").data(root.descendants()).join("a").attr("transform", (d) => `translate(${d.y + oy},${d.x * sx})`);
245
+ node.append("circle").attr("class", slots2?.node ?? "").attr("r", r);
246
+ if (getLabel) {
247
+ node.append("text").attr("dy", "0.32em").attr("x", (d) => d.children ? -6 : 6).attr("text-anchor", (d) => d.children ? "end" : "start").attr("class", slots2?.text ?? "").text((d, i) => getLabel[i]);
248
+ }
249
+ };
250
+ var TidyTree_default = TidyTree;
251
+
252
+ // packages/plugins/experimental/plugin-explorer/src/components/Tree/types.ts
253
+ var mapGraphToTreeData = (model, maxDepth = 8) => {
254
+ const mapNode = (node, depth = 0) => {
255
+ const treeNode = {
256
+ id: model.idAccessor(node),
257
+ label: model.idAccessor(node).slice(0, 8)
258
+ };
259
+ const links = model.graph.links.filter((link2) => link2.source === treeNode.id);
260
+ if (depth < maxDepth) {
261
+ treeNode.children = links.map((link2) => mapNode(model.graph.nodes.find((node2) => model.idAccessor(node2) === link2.target), depth + 1));
262
+ }
263
+ return treeNode;
264
+ };
265
+ let data;
266
+ if (model.selected) {
267
+ const node = model.graph.nodes.find((node2) => model.idAccessor(node2) === model.selected);
268
+ if (node) {
269
+ data = mapNode(node);
270
+ }
271
+ }
272
+ return data;
273
+ };
274
+
275
+ // packages/plugins/experimental/plugin-explorer/src/components/Graph/Graph.tsx
276
+ import React, { useEffect, useMemo, useRef, useState } from "react";
277
+ import { getType as getType2 } from "@dxos/echo-schema";
278
+ import { createSvgContext, defaultGridStyles, Grid, SVG, SVGRoot, Zoom } from "@dxos/gem-core";
279
+ import { defaultStyles, Graph as GraphComponent, GraphForceProjector, Markers } from "@dxos/gem-spore";
280
+ import { filterObjectsSync } from "@dxos/plugin-search";
281
+ import { useThemeContext } from "@dxos/react-ui";
282
+ import { mx } from "@dxos/react-ui-theme";
283
+ import "@dxos/gem-spore/styles";
284
+ var slots = {};
285
+ var colors = [
286
+ "[&>circle]:!fill-black-300 [&>circle]:!stroke-black-600",
287
+ "[&>circle]:!fill-slate-300 [&>circle]:!stroke-slate-600",
288
+ "[&>circle]:!fill-green-300 [&>circle]:!stroke-green-600",
289
+ "[&>circle]:!fill-sky-300 [&>circle]:!stroke-sky-600",
290
+ "[&>circle]:!fill-cyan-300 [&>circle]:!stroke-cyan-600",
291
+ "[&>circle]:!fill-rose-300 [&>circle]:!stroke-rose-600",
292
+ "[&>circle]:!fill-purple-300 [&>circle]:!stroke-purple-600",
293
+ "[&>circle]:!fill-orange-300 [&>circle]:!stroke-orange-600",
294
+ "[&>circle]:!fill-teal-300 [&>circle]:!stroke-teal-600",
295
+ "[&>circle]:!fill-indigo-300 [&>circle]:!stroke-indigo-600"
296
+ ];
297
+ var Graph = ({ space, match }) => {
298
+ const model = useMemo(() => space ? new SpaceGraphModel({
299
+ schema: true
300
+ }).open(space) : void 0, [
301
+ space
302
+ ]);
303
+ const [selected, setSelected] = useState();
304
+ const { themeMode } = useThemeContext();
305
+ const context = createSvgContext();
306
+ const projector = useMemo(() => new GraphForceProjector(context, {
307
+ forces: {
308
+ manyBody: {
309
+ strength: -100
310
+ },
311
+ link: {
312
+ distance: 180
313
+ },
314
+ radial: {
315
+ radius: 200,
316
+ strength: 0.05
317
+ }
318
+ },
319
+ attributes: {
320
+ radius: (node) => node.data?.type === "schema" ? 24 : 12
321
+ }
322
+ }), []);
323
+ const filteredRef = useRef();
324
+ filteredRef.current = filterObjectsSync(model?.objects ?? [], match);
325
+ useEffect(() => {
326
+ void projector.start();
327
+ }, [
328
+ match
329
+ ]);
330
+ const [colorMap] = useState(/* @__PURE__ */ new Map());
331
+ if (!model) {
332
+ return null;
333
+ }
334
+ if (selected) {
335
+ return /* @__PURE__ */ React.createElement(Tree, {
336
+ space,
337
+ selected,
338
+ variant: "tidy",
339
+ onNodeClick: () => setSelected(void 0)
340
+ });
341
+ }
342
+ return /* @__PURE__ */ React.createElement(SVGRoot, {
343
+ context
344
+ }, /* @__PURE__ */ React.createElement(SVG, {
345
+ className: mx(defaultStyles, slots?.root?.className)
346
+ }, /* @__PURE__ */ React.createElement(Markers, {
347
+ arrowSize: 6
348
+ }), /* @__PURE__ */ React.createElement(Grid, {
349
+ className: slots?.grid?.className ?? defaultGridStyles(themeMode)
350
+ }), /* @__PURE__ */ React.createElement(Zoom, {
351
+ extent: [
352
+ 1 / 2,
353
+ 4
354
+ ]
355
+ }, /* @__PURE__ */ React.createElement(GraphComponent, {
356
+ model,
357
+ projector,
358
+ drag: true,
359
+ arrows: true,
360
+ onSelect: (node) => setSelected(node?.data?.id),
361
+ labels: {
362
+ text: (node) => {
363
+ if (filteredRef.current?.length && !filteredRef.current.some((object) => object.id === node.data?.id)) {
364
+ return void 0;
365
+ }
366
+ return node.data?.label ?? node.data?.title ?? node.data?.name ?? node.data?.id.slice(0, 8);
367
+ }
368
+ },
369
+ attributes: {
370
+ node: (node) => {
371
+ let className;
372
+ if (node.data) {
373
+ const typename = getType2(node.data)?.objectId;
374
+ if (typename) {
375
+ className = colorMap.get(typename);
376
+ if (!className) {
377
+ className = colors[colorMap.size % colors.length];
378
+ colorMap.set(typename, className);
379
+ }
380
+ }
381
+ }
382
+ const selected2 = filteredRef.current?.some((object) => object.id === node.data?.id);
383
+ return {
384
+ class: mx(filteredRef.current?.length ? selected2 ? [
385
+ className
386
+ ] : "[&>text]:!fill-neutral-300" : [
387
+ "[&>text]:!fill-neutral-700",
388
+ className
389
+ ])
390
+ };
391
+ },
392
+ link: () => ({
393
+ class: "[&>path]:!stroke-neutral-300"
394
+ })
395
+ }
396
+ }))));
397
+ };
398
+
399
+ // packages/plugins/experimental/plugin-explorer/src/components/Tree/Tree.tsx
400
+ var defaultTreeLayoutSlots = {
401
+ node: "fill-blue-600",
402
+ path: "fill-none stroke-blue-400 stroke-[0.5px]",
403
+ text: "stroke-[0.5px] stroke-neutral-700 text-xs"
404
+ };
405
+ var renderers = /* @__PURE__ */ new Map([
406
+ [
407
+ "tidy",
408
+ TidyTree_default
409
+ ],
410
+ [
411
+ "radial",
412
+ RadialTree_default
413
+ ],
414
+ [
415
+ "edge",
416
+ HierarchicalEdgeBundling_default
417
+ ]
418
+ ]);
419
+ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
420
+ const model = useMemo2(() => space ? new SpaceGraphModel().open(space, selected) : void 0, [
421
+ space,
422
+ selected
423
+ ]);
424
+ const [tree3, setTree] = useState2();
425
+ useEffect2(() => {
426
+ return model?.subscribe(() => {
427
+ const tree4 = mapGraphToTreeData(model);
428
+ setTree(tree4);
429
+ }, true);
430
+ }, [
431
+ model
432
+ ]);
433
+ const context = createSvgContext2();
434
+ const { ref, width = 0, height = 0 } = useResizeDetector();
435
+ useEffect2(() => {
436
+ if (width && height) {
437
+ const size = Math.min(width, height);
438
+ const radius = size * 0.4;
439
+ const options = {
440
+ // TODO(burdon): Type.
441
+ label: (d) => d.label ?? d.id,
442
+ width,
443
+ height,
444
+ radius,
445
+ marginLeft: (width - radius * 2) / 2,
446
+ marginRight: (width - radius * 2) / 2,
447
+ marginTop: (height - radius * 2) / 2,
448
+ marginBottom: (height - radius * 2) / 2,
449
+ slots: defaultTreeLayoutSlots
450
+ };
451
+ if (tree3) {
452
+ const renderer = renderers.get(variant);
453
+ renderer?.(context.ref.current, tree3, options);
454
+ }
455
+ }
456
+ }, [
457
+ tree3,
458
+ width,
459
+ height
460
+ ]);
461
+ return /* @__PURE__ */ React2.createElement("div", {
462
+ ref,
463
+ className: "flex grow overflow-hidden",
464
+ onClick: () => onNodeClick?.()
465
+ }, /* @__PURE__ */ React2.createElement(SVGRoot2, {
466
+ context
467
+ }, /* @__PURE__ */ React2.createElement(SVG2, null)));
468
+ };
469
+
470
+ export {
471
+ SpaceGraphModel,
472
+ defaultTreeLayoutSlots,
473
+ Tree,
474
+ Graph
475
+ };
476
+ //# sourceMappingURL=chunk-T6BPVYCJ.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 {\n AST,\n getSchema,\n getType,\n DynamicSchema,\n ReferenceAnnotationId,\n type S,\n SchemaValidator,\n StoredSchema,\n} from '@dxos/echo-schema';\nimport { type GraphData, type GraphLink, GraphModel } from '@dxos/gem-spore';\nimport { log } from '@dxos/log';\nimport { CollectionType } from '@dxos/plugin-space/types';\nimport { type EchoReactiveObject, type Space, type Subscription } from '@dxos/react-client/echo';\n\nexport type SpaceGraphModelOptions = {\n schema?: boolean;\n};\n\nexport type EchoGraphNode = SchemaGraphNode | EchoObjectGraphNode;\n\ntype EchoObjectGraphNode = {\n id: string;\n type: 'echo-object';\n object: EchoReactiveObject<any>;\n};\n\ntype SchemaGraphNode = {\n id: string;\n type: 'schema';\n schema: S.Schema<any>;\n};\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 _subscription?: Subscription;\n private _objects?: EchoReactiveObject<any>[];\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(): EchoReactiveObject<any>[] {\n return this._objects ?? [];\n }\n\n open(space: Space, objectId?: string) {\n if (!this._subscription) {\n // TODO(burdon): Filter.\n const query = space.db.query((object: EchoReactiveObject<any>) => !(object instanceof CollectionType));\n\n this._subscription = query.subscribe(\n ({ objects }) => {\n this._objects = objects;\n this._graph.nodes = objects.map((object) => {\n if (object instanceof StoredSchema) {\n const effectSchema = space.db.schema.getSchemaById(object.id)!;\n return { type: 'schema', id: object.id, schema: effectSchema.schema };\n }\n return { type: 'echo-object', id: object.id, object };\n });\n this._graph.links = objects.reduce<GraphLink[]>((links, object) => {\n const objectSchema = getSchema(object);\n const typename = getType(object)?.objectId;\n if (objectSchema == null || typename == null) {\n log.info('no schema for object:', { id: object.id.slice(0, 8) });\n return links;\n }\n\n if (!(objectSchema instanceof DynamicSchema)) {\n const idx = objects.findIndex((obj) => obj.id === typename);\n if (idx === -1) {\n this._graph.nodes.push({\n id: typename,\n type: 'schema',\n schema: objectSchema,\n });\n }\n }\n\n // Link to schema.\n if (this._options.schema) {\n links.push({\n id: `${object.id}-${typename}`,\n source: object.id,\n target: typename,\n });\n }\n\n // Parse schema to follow referenced objects.\n AST.getPropertySignatures(objectSchema.ast).forEach((prop) => {\n if (!SchemaValidator.hasTypeAnnotation(objectSchema, prop.name.toString(), ReferenceAnnotationId)) {\n return;\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 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 return links;\n }, []);\n\n this.triggerUpdate();\n },\n { fire: true },\n );\n }\n\n this.setSelected(objectId);\n return this;\n }\n\n close() {\n if (this._subscription) {\n this._subscription();\n this._subscription = undefined;\n }\n\n return this;\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { useEffect, useMemo, 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';\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 = useMemo(() => (space ? new SpaceGraphModel().open(space, selected) : undefined), [space, selected]);\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 React, { type FC, useEffect, useMemo, useRef, useState } from 'react';\n\nimport { type Space } from '@dxos/client/echo';\nimport { type EchoReactiveObject, getType } from '@dxos/echo-schema';\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 { useThemeContext } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\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};\n\nexport const Graph: FC<GraphProps> = ({ space, match }) => {\n const model = useMemo(() => (space ? new SpaceGraphModel({ schema: true }).open(space) : undefined), [space]);\n const [selected, setSelected] = useState<string>();\n const { themeMode } = useThemeContext();\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: 180,\n },\n radial: {\n radius: 200,\n strength: 0.05,\n },\n },\n attributes: {\n radius: (node: GraphLayoutNode<EchoGraphNode>) => (node.data?.type === 'schema' ? 24 : 12),\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 if (!model) {\n return null;\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 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<EchoReactiveObject<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<EchoReactiveObject<any>>) => {\n let className: string | undefined;\n if (node.data) {\n const typename = getType(node.data)?.objectId;\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 const selected = filteredRef.current?.some((object) => object.id === node.data?.id);\n return {\n class: mx(\n filteredRef.current?.length\n ? selected\n ? [className]\n : '[&>text]:!fill-neutral-300'\n : ['[&>text]:!fill-neutral-700', className],\n ),\n };\n },\n link: () => ({\n class: '[&>path]:!stroke-neutral-300',\n }),\n }}\n />\n </Zoom>\n </SVG>\n </SVGRoot>\n );\n};\n"],
5
+ "mappings": ";;;AAIA,SACEA,KACAC,WACAC,SACAC,eACAC,uBAEAC,iBACAC,oBACK;AACP,SAAyCC,kBAAkB;AAC3D,SAASC,WAAW;AACpB,SAASC,sBAAsB;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B;IAAUsB,WAAU;IAA4BC,SAAS,MAAMrC,cAAAA;KAClE,gBAAAkC,OAAA,cAACI,UAAAA;IAAQ1B;KACP,gBAAAsB,OAAA,cAACK,MAAAA,IAAAA,CAAAA,CAAAA;AAIT;",
6
+ "names": ["AST", "getSchema", "getType", "DynamicSchema", "ReferenceAnnotationId", "SchemaValidator", "StoredSchema", "GraphModel", "log", "CollectionType", "SpaceGraphModel", "constructor", "_options", "_graph", "nodes", "links", "graph", "objects", "_objects", "open", "space", "objectId", "_subscription", "query", "db", "object", "subscribe", "map", "effectSchema", "schema", "getSchemaById", "id", "type", "reduce", "objectSchema", "typename", "info", "slice", "idx", "findIndex", "obj", "push", "source", "target", "getPropertySignatures", "ast", "forEach", "prop", "hasTypeAnnotation", "name", "toString", "value", "String", "refs", "Array", "isArray", "ref", "triggerUpdate", "fire", "setSelected", "close", "undefined", "React", "useEffect", "useMemo", "useState", "useResizeDetector", "createSvgContext", "SVG", "SVGRoot", "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", "React", "useEffect", "useMemo", "useRef", "useState", "getType", "createSvgContext", "defaultGridStyles", "Grid", "SVG", "SVGRoot", "Zoom", "defaultStyles", "Graph", "GraphComponent", "GraphForceProjector", "Markers", "filterObjectsSync", "useThemeContext", "mx", "slots", "colors", "Graph", "space", "match", "model", "useMemo", "SpaceGraphModel", "schema", "open", "undefined", "selected", "setSelected", "useState", "themeMode", "useThemeContext", "context", "createSvgContext", "projector", "GraphForceProjector", "forces", "manyBody", "strength", "link", "distance", "radial", "radius", "attributes", "node", "data", "type", "filteredRef", "useRef", "current", "filterObjectsSync", "objects", "useEffect", "start", "colorMap", "Map", "Tree", "variant", "onNodeClick", "SVGRoot", "SVG", "className", "mx", "defaultStyles", "root", "Markers", "arrowSize", "Grid", "grid", "defaultGridStyles", "Zoom", "extent", "GraphComponent", "drag", "arrows", "onSelect", "id", "labels", "text", "length", "some", "object", "label", "title", "name", "slice", "typename", "getType", "objectId", "get", "size", "set", "class", "defaultTreeLayoutSlots", "node", "path", "text", "renderers", "Map", "TidyTree", "RadialTree", "HierarchicalEdgeBundling", "Tree", "space", "selected", "variant", "onNodeClick", "model", "useMemo", "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
+ }
@@ -0,0 +1,19 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+
3
+ // packages/plugins/experimental/plugin-explorer/src/meta.ts
4
+ var EXPLORER_PLUGIN = "dxos.org/plugin/explorer";
5
+ var meta_default = {
6
+ id: EXPLORER_PLUGIN,
7
+ name: "Explorer",
8
+ description: "Explore the ECHO hypergraph.",
9
+ tags: [
10
+ "experimental"
11
+ ],
12
+ icon: "ph--graph--regular"
13
+ };
14
+
15
+ export {
16
+ EXPLORER_PLUGIN,
17
+ meta_default
18
+ };
19
+ //# sourceMappingURL=chunk-W2DSGFVW.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 default {\n id: EXPLORER_PLUGIN,\n name: 'Explorer',\n description: 'Explore the ECHO hypergraph.',\n tags: ['experimental'],\n icon: 'ph--graph--regular',\n} satisfies PluginMeta;\n"],
5
+ "mappings": ";;;AAMO,IAAMA,kBAAkB;AAE/B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;EACNC,aAAa;EACbC,MAAM;IAAC;;EACPC,MAAM;AACR;",
6
+ "names": ["EXPLORER_PLUGIN", "id", "name", "description", "tags", "icon"]
7
+ }