@dxos/plugin-explorer 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446
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-6U4GS62Q.mjs → ExplorerContainer-HL532ODG.mjs} +2 -2
- package/dist/lib/browser/{chunk-JL7ZGOFE.mjs → chunk-B2DMPSP5.mjs} +18 -18
- package/dist/lib/browser/{chunk-JL7ZGOFE.mjs.map → chunk-B2DMPSP5.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-HKQSZX7S.mjs → chunk-QLQLPZNI.mjs} +9 -10
- package/dist/lib/browser/chunk-QLQLPZNI.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QRPUL5AH.mjs → chunk-SBLNE7FL.mjs} +5 -6
- package/dist/lib/browser/chunk-SBLNE7FL.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -5
- package/dist/lib/browser/{intent-resolver-7JF4DU2C.mjs → intent-resolver-NHHRWTOP.mjs} +4 -4
- package/dist/lib/browser/intent-resolver-NHHRWTOP.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-JLE6GLG6.mjs → react-surface-N7TC6BMF.mjs} +4 -4
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{ExplorerContainer-4RMWCWRX.cjs → ExplorerContainer-73AHSBAG.cjs} +6 -6
- package/dist/lib/node/{chunk-R4TOGRPE.cjs → chunk-HCDBN6NN.cjs} +22 -22
- package/dist/lib/node/{chunk-R4TOGRPE.cjs.map → chunk-HCDBN6NN.cjs.map} +3 -3
- package/dist/lib/node/{chunk-4ZUNNUQD.cjs → chunk-OIHH6TVE.cjs} +7 -8
- package/dist/lib/node/chunk-OIHH6TVE.cjs.map +7 -0
- package/dist/lib/node/{chunk-6R5P3UVS.cjs → chunk-YLL7H7CZ.cjs} +11 -12
- package/dist/lib/node/chunk-YLL7H7CZ.cjs.map +7 -0
- package/dist/lib/node/index.cjs +17 -17
- package/dist/lib/node/{intent-resolver-VDAHQEE7.cjs → intent-resolver-EEOTX3OZ.cjs} +7 -7
- package/dist/lib/node/intent-resolver-EEOTX3OZ.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-F66QYWDR.cjs → react-surface-WD4G2NRS.cjs} +9 -9
- package/dist/lib/node/types/index.cjs +3 -3
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{ExplorerContainer-3GOCCL7Q.mjs → ExplorerContainer-NMI55PYM.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-MUHCE377.mjs → chunk-PZOORWFE.mjs} +18 -18
- package/dist/lib/node-esm/{chunk-MUHCE377.mjs.map → chunk-PZOORWFE.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-QOJSLABX.mjs → chunk-QZH2GDN5.mjs} +9 -10
- package/dist/lib/node-esm/chunk-QZH2GDN5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-BJZBPCC3.mjs → chunk-SZRRNWYT.mjs} +5 -6
- package/dist/lib/node-esm/chunk-SZRRNWYT.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -5
- package/dist/lib/node-esm/{intent-resolver-XWRVHP6H.mjs → intent-resolver-PTFKXAT4.mjs} +4 -4
- package/dist/lib/node-esm/intent-resolver-PTFKXAT4.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-4ZT5BQP6.mjs → react-surface-J5SW7VF2.mjs} +4 -4
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
- package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Graph/graph-model.d.ts +3 -3
- package/dist/types/src/components/Graph/graph-model.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/RadialTree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/TidyTree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types.d.ts.map +1 -1
- package/dist/types/src/components/plot.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +8 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +6 -6
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +6 -6
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -27
- package/src/capabilities/intent-resolver.ts +2 -2
- package/src/components/Globe/Globe.stories.tsx +13 -13
- package/src/components/Graph/Graph.stories.tsx +2 -2
- package/src/components/Graph/graph-model.ts +7 -8
- package/src/components/Tree/layout/HierarchicalEdgeBundling.ts +19 -17
- package/src/components/Tree/layout/RadialTree.ts +7 -5
- package/src/components/Tree/layout/TidyTree.ts +6 -5
- package/src/types/schema.ts +3 -5
- package/src/types/types.ts +5 -5
- package/dist/lib/browser/chunk-HKQSZX7S.mjs.map +0 -7
- package/dist/lib/browser/chunk-QRPUL5AH.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-7JF4DU2C.mjs.map +0 -7
- package/dist/lib/node/chunk-4ZUNNUQD.cjs.map +0 -7
- package/dist/lib/node/chunk-6R5P3UVS.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-VDAHQEE7.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-BJZBPCC3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QOJSLABX.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-XWRVHP6H.mjs.map +0 -7
- /package/dist/lib/browser/{ExplorerContainer-6U4GS62Q.mjs.map → ExplorerContainer-HL532ODG.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-JLE6GLG6.mjs.map → react-surface-N7TC6BMF.mjs.map} +0 -0
- /package/dist/lib/node/{ExplorerContainer-4RMWCWRX.cjs.map → ExplorerContainer-73AHSBAG.cjs.map} +0 -0
- /package/dist/lib/node/{react-surface-F66QYWDR.cjs.map → react-surface-WD4G2NRS.cjs.map} +0 -0
- /package/dist/lib/node-esm/{ExplorerContainer-3GOCCL7Q.mjs.map → ExplorerContainer-NMI55PYM.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-surface-4ZT5BQP6.mjs.map → react-surface-J5SW7VF2.mjs.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-explorer",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-staging.7ac8446",
|
|
4
4
|
"description": "Braneframe data visualization plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -37,28 +37,26 @@
|
|
|
37
37
|
"@observablehq/plot": "^0.6.11",
|
|
38
38
|
"@preact/signals-core": "^1.6.0",
|
|
39
39
|
"d3": "^7.9.0",
|
|
40
|
-
"effect": "^3.13.3",
|
|
41
40
|
"force-graph": "^1.49.4",
|
|
42
41
|
"lodash.defaultsdeep": "^4.6.1",
|
|
43
42
|
"lodash.get": "^4.4.2",
|
|
44
43
|
"react-resize-detector": "^11.0.1",
|
|
45
44
|
"topojson-client": "^3.1.0",
|
|
46
|
-
"@dxos/app-framework": "0.8.2-
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/echo": "0.8.2-
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/plugin-
|
|
56
|
-
"@dxos/plugin-
|
|
57
|
-
"@dxos/plugin-
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/react-
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/util": "0.8.2-main.fbd8ed0"
|
|
45
|
+
"@dxos/app-framework": "0.8.2-staging.7ac8446",
|
|
46
|
+
"@dxos/client": "0.8.2-staging.7ac8446",
|
|
47
|
+
"@dxos/async": "0.8.2-staging.7ac8446",
|
|
48
|
+
"@dxos/echo-schema": "0.8.2-staging.7ac8446",
|
|
49
|
+
"@dxos/gem-spore": "0.8.2-staging.7ac8446",
|
|
50
|
+
"@dxos/live-object": "0.8.2-staging.7ac8446",
|
|
51
|
+
"@dxos/gem-core": "0.8.2-staging.7ac8446",
|
|
52
|
+
"@dxos/log": "0.8.2-staging.7ac8446",
|
|
53
|
+
"@dxos/plugin-graph": "0.8.2-staging.7ac8446",
|
|
54
|
+
"@dxos/plugin-search": "0.8.2-staging.7ac8446",
|
|
55
|
+
"@dxos/plugin-space": "0.8.2-staging.7ac8446",
|
|
56
|
+
"@dxos/plugin-client": "0.8.2-staging.7ac8446",
|
|
57
|
+
"@dxos/react-client": "0.8.2-staging.7ac8446",
|
|
58
|
+
"@dxos/react-ui-stack": "0.8.2-staging.7ac8446",
|
|
59
|
+
"@dxos/util": "0.8.2-staging.7ac8446"
|
|
62
60
|
},
|
|
63
61
|
"devDependencies": {
|
|
64
62
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -73,20 +71,19 @@
|
|
|
73
71
|
"react": "~18.2.0",
|
|
74
72
|
"react-dom": "~18.2.0",
|
|
75
73
|
"vite": "5.4.7",
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/
|
|
81
|
-
"@dxos/react-ui-theme": "0.8.2-
|
|
74
|
+
"@dxos/echo-generator": "0.8.2-staging.7ac8446",
|
|
75
|
+
"@dxos/random": "0.8.2-staging.7ac8446",
|
|
76
|
+
"@dxos/plugin-outliner": "0.8.2-staging.7ac8446",
|
|
77
|
+
"@dxos/storybook-utils": "0.8.2-staging.7ac8446",
|
|
78
|
+
"@dxos/react-ui": "0.8.2-staging.7ac8446",
|
|
79
|
+
"@dxos/react-ui-theme": "0.8.2-staging.7ac8446"
|
|
82
80
|
},
|
|
83
81
|
"peerDependencies": {
|
|
84
82
|
"@phosphor-icons/react": "^2.1.5",
|
|
85
|
-
"effect": "^3.13.3",
|
|
86
83
|
"react": "~18.2.0",
|
|
87
84
|
"react-dom": "~18.2.0",
|
|
88
|
-
"@dxos/react-ui
|
|
89
|
-
"@dxos/react-ui": "0.8.2-
|
|
85
|
+
"@dxos/react-ui": "0.8.2-staging.7ac8446",
|
|
86
|
+
"@dxos/react-ui-theme": "0.8.2-staging.7ac8446"
|
|
90
87
|
},
|
|
91
88
|
"publishConfig": {
|
|
92
89
|
"access": "public"
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { contributes, Capabilities, createResolver } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
6
|
+
import { create } from '@dxos/live-object';
|
|
7
7
|
|
|
8
8
|
import { ExplorerAction, ViewType } from '../types';
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ export default () =>
|
|
|
13
13
|
createResolver({
|
|
14
14
|
intent: ExplorerAction.Create,
|
|
15
15
|
resolve: ({ name }) => ({
|
|
16
|
-
data: { object:
|
|
16
|
+
data: { object: create(ViewType, { name, type: '' }) },
|
|
17
17
|
}),
|
|
18
18
|
}),
|
|
19
19
|
);
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
-
import
|
|
7
|
+
import * as Plot from '@observablehq/plot';
|
|
8
8
|
import { type Meta } from '@storybook/react';
|
|
9
|
-
import
|
|
9
|
+
import * as d3 from 'd3';
|
|
10
10
|
import React, { useEffect } from 'react';
|
|
11
11
|
import { useResizeDetector } from 'react-resize-detector';
|
|
12
|
-
import
|
|
12
|
+
import * as topojson from 'topojson-client';
|
|
13
13
|
|
|
14
14
|
import { ClientRepeater } from '@dxos/react-client/testing';
|
|
15
15
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
@@ -37,18 +37,18 @@ const ExtendedStory = () => {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
const land = feature(CountriesData as any, CountriesData.objects.land as any);
|
|
40
|
+
const land = topojson.feature(CountriesData as any, CountriesData.objects.land as any);
|
|
41
41
|
const items = CitiesData.features.map((feature: any) => ({
|
|
42
42
|
lat: feature.geometry.coordinates[0],
|
|
43
43
|
lng: feature.geometry.coordinates[1],
|
|
44
44
|
}));
|
|
45
45
|
|
|
46
46
|
const city = items[0];
|
|
47
|
-
const circle = geoCircle().center([city.lat, city.lng]).radius(16)();
|
|
47
|
+
const circle = d3.geoCircle().center([city.lat, city.lng]).radius(16)();
|
|
48
48
|
|
|
49
49
|
// https://observablehq.com/plot/marks/geo
|
|
50
50
|
// https://observablehq.com/@observablehq/plot-earthquake-globe?intent=fork
|
|
51
|
-
const
|
|
51
|
+
const plot = Plot.plot({
|
|
52
52
|
// https://observablehq.com/plot/features/projections
|
|
53
53
|
projection: { type: 'orthographic', rotate: [-city.lat + 30, -30] },
|
|
54
54
|
// projection: { type: 'equirectangular', rotate: [-140, -30] },
|
|
@@ -58,11 +58,11 @@ const ExtendedStory = () => {
|
|
|
58
58
|
background: 'transparent',
|
|
59
59
|
},
|
|
60
60
|
marks: [
|
|
61
|
-
sphere({ fill: 'lightblue', fillOpacity: 0.5 }),
|
|
62
|
-
geo(land, { fill: 'green', fillOpacity: 0.3 }),
|
|
63
|
-
graticule(),
|
|
64
|
-
geo(circle, { stroke: 'black', fill: 'darkblue', fillOpacity: 0.1, strokeWidth: 2 }),
|
|
65
|
-
dot(items, {
|
|
61
|
+
Plot.sphere({ fill: 'lightblue', fillOpacity: 0.5 }),
|
|
62
|
+
Plot.geo(land, { fill: 'green', fillOpacity: 0.3 }),
|
|
63
|
+
Plot.graticule(),
|
|
64
|
+
Plot.geo(circle, { stroke: 'black', fill: 'darkblue', fillOpacity: 0.1, strokeWidth: 2 }),
|
|
65
|
+
Plot.dot(items, {
|
|
66
66
|
x: 'lat',
|
|
67
67
|
y: 'lng',
|
|
68
68
|
r: 6,
|
|
@@ -73,8 +73,8 @@ const ExtendedStory = () => {
|
|
|
73
73
|
],
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
containerRef.current!.append(
|
|
77
|
-
return () =>
|
|
76
|
+
containerRef.current!.append(plot);
|
|
77
|
+
return () => plot?.remove();
|
|
78
78
|
}, [width, height]);
|
|
79
79
|
|
|
80
80
|
return <div ref={containerRef} className='grow p-8' />;
|
|
@@ -10,7 +10,7 @@ import React, { useEffect, useState } from 'react';
|
|
|
10
10
|
import { createSpaceObjectGenerator, TestSchemaType } from '@dxos/echo-generator';
|
|
11
11
|
import { faker } from '@dxos/random';
|
|
12
12
|
import { useClient } from '@dxos/react-client';
|
|
13
|
-
import {
|
|
13
|
+
import { create } from '@dxos/react-client/echo';
|
|
14
14
|
import { type Space } from '@dxos/react-client/echo';
|
|
15
15
|
import { ClientRepeater } from '@dxos/react-client/testing';
|
|
16
16
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
@@ -35,7 +35,7 @@ const Story = () => {
|
|
|
35
35
|
});
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
const view = space.db.add(
|
|
38
|
+
const view = space.db.add(create(ViewType, { name: '', type: '' }));
|
|
39
39
|
setSpace(space);
|
|
40
40
|
setView(view);
|
|
41
41
|
}, []);
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { SchemaAST } from 'effect';
|
|
6
|
-
|
|
7
5
|
import { type CleanupFn } from '@dxos/async';
|
|
8
6
|
import {
|
|
9
7
|
getSchema,
|
|
10
8
|
getSchemaDXN,
|
|
9
|
+
AST,
|
|
11
10
|
type EchoSchema,
|
|
12
11
|
ReferenceAnnotationId,
|
|
13
12
|
SchemaValidator,
|
|
@@ -16,7 +15,7 @@ import {
|
|
|
16
15
|
import { type GraphData, GraphModel } from '@dxos/gem-spore';
|
|
17
16
|
import { log } from '@dxos/log';
|
|
18
17
|
import { CollectionType } from '@dxos/plugin-space/types';
|
|
19
|
-
import { Filter, type
|
|
18
|
+
import { Filter, type ReactiveEchoObject, type Space } from '@dxos/react-client/echo';
|
|
20
19
|
|
|
21
20
|
export type SpaceGraphModelOptions = {
|
|
22
21
|
schema?: boolean;
|
|
@@ -33,7 +32,7 @@ type SchemaGraphNode = {
|
|
|
33
32
|
type ObjectGraphNode = {
|
|
34
33
|
id: string;
|
|
35
34
|
type: 'object';
|
|
36
|
-
data: { typename: string; object:
|
|
35
|
+
data: { typename: string; object: ReactiveEchoObject<any> };
|
|
37
36
|
};
|
|
38
37
|
|
|
39
38
|
export type EchoGraphNode = SchemaGraphNode | ObjectGraphNode;
|
|
@@ -49,7 +48,7 @@ export class SpaceGraphModel extends GraphModel<EchoGraphNode> {
|
|
|
49
48
|
|
|
50
49
|
private _schema?: EchoSchema[];
|
|
51
50
|
private _schemaSubscription?: CleanupFn;
|
|
52
|
-
private _objects?:
|
|
51
|
+
private _objects?: ReactiveEchoObject<any>[];
|
|
53
52
|
private _objectsSubscription?: CleanupFn;
|
|
54
53
|
|
|
55
54
|
constructor(private readonly _options: SpaceGraphModelOptions = {}) {
|
|
@@ -60,7 +59,7 @@ export class SpaceGraphModel extends GraphModel<EchoGraphNode> {
|
|
|
60
59
|
return this._graph;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
get objects():
|
|
62
|
+
get objects(): ReactiveEchoObject<any>[] {
|
|
64
63
|
return this._objects ?? [];
|
|
65
64
|
}
|
|
66
65
|
|
|
@@ -86,7 +85,7 @@ export class SpaceGraphModel extends GraphModel<EchoGraphNode> {
|
|
|
86
85
|
|
|
87
86
|
this._objectsSubscription = space.db
|
|
88
87
|
// TODO(burdon): ERROR: Cannot mix type and or filters.
|
|
89
|
-
.query(Filter.not(Filter.or(Filter.
|
|
88
|
+
.query(Filter.not(Filter.or(Filter.schema(StoredSchema), Filter.schema(CollectionType))))
|
|
90
89
|
.subscribe(
|
|
91
90
|
({ objects }) => {
|
|
92
91
|
this._objects = objects;
|
|
@@ -150,7 +149,7 @@ export class SpaceGraphModel extends GraphModel<EchoGraphNode> {
|
|
|
150
149
|
|
|
151
150
|
// Link ot refs.
|
|
152
151
|
// TODO(burdon): This isn't working.
|
|
153
|
-
|
|
152
|
+
AST.getPropertySignatures(schema.ast).forEach((prop) => {
|
|
154
153
|
if (!SchemaValidator.hasTypeAnnotation(schema, prop.name.toString(), ReferenceAnnotationId)) {
|
|
155
154
|
return;
|
|
156
155
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright 2022 Observable, Inc.
|
|
4
4
|
//
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as d3 from 'd3';
|
|
7
7
|
import { type HierarchyNode } from 'd3-hierarchy';
|
|
8
8
|
|
|
9
9
|
import { type TreeOptions } from '../Tree';
|
|
@@ -17,16 +17,16 @@ const getId = (node: HierarchyNode<TreeNode>): string =>
|
|
|
17
17
|
// https://github.com/d3/d3-hierarchy
|
|
18
18
|
// https://observablehq.com/@d3/hierarchical-edge-bundling?intent=fork
|
|
19
19
|
const HierarchicalEdgeBundling = (s: SVGSVGElement, data: TreeNode, options: TreeOptions) => {
|
|
20
|
-
const svg = select(s);
|
|
20
|
+
const svg = d3.select(s);
|
|
21
21
|
svg.selectAll('*').remove();
|
|
22
22
|
|
|
23
23
|
const { radius = 600, padding = 100, slots } = options;
|
|
24
24
|
|
|
25
25
|
// https://d3js.org/d3-hierarchy/hierarchy
|
|
26
|
-
const root = hierarchy(flatten(data));
|
|
27
|
-
// .sort((a, b) => ascending(a.height, b.height) || ascending(getName(a.data), getName(b.data)));
|
|
26
|
+
const root = d3.hierarchy(flatten(data));
|
|
27
|
+
// .sort((a, b) => d3.ascending(a.height, b.height) || d3.ascending(getName(a.data), getName(b.data)));
|
|
28
28
|
|
|
29
|
-
const tree = cluster<TreeNode>().size([2 * Math.PI, radius - padding]);
|
|
29
|
+
const tree = d3.cluster<TreeNode>().size([2 * Math.PI, radius - padding]);
|
|
30
30
|
const layout = tree(addLinks(root));
|
|
31
31
|
|
|
32
32
|
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
@@ -54,8 +54,9 @@ const HierarchicalEdgeBundling = (s: SVGSVGElement, data: TreeNode, options: Tre
|
|
|
54
54
|
);
|
|
55
55
|
|
|
56
56
|
// https://d3js.org/d3-shape/radial-line
|
|
57
|
-
const line =
|
|
58
|
-
.
|
|
57
|
+
const line = d3
|
|
58
|
+
.lineRadial()
|
|
59
|
+
.curve(d3.curveBundle.beta(0.85))
|
|
59
60
|
.radius((d: any) => d.y)
|
|
60
61
|
.angle((d: any) => d.x);
|
|
61
62
|
|
|
@@ -76,30 +77,30 @@ const HierarchicalEdgeBundling = (s: SVGSVGElement, data: TreeNode, options: Tre
|
|
|
76
77
|
|
|
77
78
|
// function overed(event: any, d: X) {
|
|
78
79
|
// link.style('mix-blend-mode', null);
|
|
79
|
-
// select(this).attr('font-weight', 'bold');
|
|
80
|
-
// selectAll(d.incoming.map((d) => d.path))
|
|
80
|
+
// d3.select(this).attr('font-weight', 'bold');
|
|
81
|
+
// d3.selectAll(d.incoming.map((d) => d.path))
|
|
81
82
|
// .attr('stroke', color.in)
|
|
82
83
|
// .raise();
|
|
83
|
-
// selectAll((d as any).incoming.map(([d]) => d.text))
|
|
84
|
+
// d3.selectAll((d as any).incoming.map(([d]) => d.text))
|
|
84
85
|
// .attr('fill', color.in)
|
|
85
86
|
// .attr('font-weight', 'bold');
|
|
86
|
-
// selectAll(d.outgoing.map((d) => d.path))
|
|
87
|
+
// d3.selectAll(d.outgoing.map((d) => d.path))
|
|
87
88
|
// .attr('stroke', color.out)
|
|
88
89
|
// .raise();
|
|
89
|
-
// selectAll(d.outgoing.map(([, d]) => d.text))
|
|
90
|
+
// d3.selectAll(d.outgoing.map(([, d]) => d.text))
|
|
90
91
|
// .attr('fill', color.out)
|
|
91
92
|
// .attr('font-weight', 'bold');
|
|
92
93
|
// }
|
|
93
94
|
|
|
94
95
|
// function outed(event: any, d: HierarchyNode<Datum>) {
|
|
95
96
|
// // @ts-ignore
|
|
96
|
-
// select(this).attr('font-weight', null);
|
|
97
|
-
// selectAll(d.incoming.map((d) => d.path)).attr('stroke', null);
|
|
98
|
-
// selectAll(d.incoming.map(([d]) => d.text))
|
|
97
|
+
// d3.select(this).attr('font-weight', null);
|
|
98
|
+
// d3.selectAll(d.incoming.map((d) => d.path)).attr('stroke', null);
|
|
99
|
+
// d3.selectAll(d.incoming.map(([d]) => d.text))
|
|
99
100
|
// .attr('fill', null)
|
|
100
101
|
// .attr('font-weight', null);
|
|
101
|
-
// selectAll(d.outgoing.map((d) => d.path)).attr('stroke', null);
|
|
102
|
-
// selectAll(d.outgoing.map(([, d]) => d.text))
|
|
102
|
+
// d3.selectAll(d.outgoing.map((d) => d.path)).attr('stroke', null);
|
|
103
|
+
// d3.selectAll(d.outgoing.map(([, d]) => d.text))
|
|
103
104
|
// .attr('fill', null)
|
|
104
105
|
// .attr('font-weight', null);
|
|
105
106
|
// }
|
|
@@ -118,6 +119,7 @@ const addLinks = (root: HierarchyNode<TreeNode>) => {
|
|
|
118
119
|
|
|
119
120
|
for (const d of root.leaves()) {
|
|
120
121
|
// (d as any).incoming = [];
|
|
122
|
+
|
|
121
123
|
const parent = parents.get(d.data.id);
|
|
122
124
|
if (parent) {
|
|
123
125
|
// Skip the first node which is a placeholder created by flatten().
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright 2022 Observable, Inc.
|
|
4
4
|
//
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as d3 from 'd3';
|
|
7
7
|
|
|
8
8
|
import { type TreeOptions } from '../Tree';
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ import { type TreeOptions } from '../Tree';
|
|
|
11
11
|
// https://observablehq.com/@d3/radial-tree
|
|
12
12
|
// https://observablehq.com/@d3/tree
|
|
13
13
|
const RadialTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
14
|
-
const svg = select(s);
|
|
14
|
+
const svg = d3.select(s);
|
|
15
15
|
svg.selectAll('*').remove();
|
|
16
16
|
|
|
17
17
|
const {
|
|
@@ -23,7 +23,7 @@ const RadialTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
|
23
23
|
|
|
24
24
|
const arc = 2 * Math.PI;
|
|
25
25
|
|
|
26
|
-
const root = hierarchy(data);
|
|
26
|
+
const root = d3.hierarchy(data);
|
|
27
27
|
|
|
28
28
|
// Sort the nodes.
|
|
29
29
|
// if (sort) {
|
|
@@ -35,7 +35,8 @@ const RadialTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
|
35
35
|
const getLabel = label === null ? null : descendants.map((d) => label(d.data));
|
|
36
36
|
|
|
37
37
|
// Compute the layout.
|
|
38
|
-
const layout =
|
|
38
|
+
const layout = d3
|
|
39
|
+
.tree()
|
|
39
40
|
.size([arc, radius])
|
|
40
41
|
.separation((a: any, b: any) => (a.parent === b.parent ? 1 : 2) / a.depth);
|
|
41
42
|
layout(root);
|
|
@@ -49,7 +50,8 @@ const RadialTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
|
49
50
|
.attr('class', slots?.path ?? '')
|
|
50
51
|
.attr(
|
|
51
52
|
'd',
|
|
52
|
-
|
|
53
|
+
d3
|
|
54
|
+
.linkRadial()
|
|
53
55
|
.angle((d: any) => d.x + Math.PI / 2)
|
|
54
56
|
.radius((d: any) => d.y) as any,
|
|
55
57
|
);
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
// Copyright 2021 Observable, Inc.
|
|
4
4
|
//
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import * as d3 from 'd3';
|
|
7
7
|
|
|
8
8
|
import { type TreeOptions } from '../Tree';
|
|
9
9
|
|
|
10
10
|
// Released under the ISC license.
|
|
11
11
|
// https://observablehq.com/@d3/tree
|
|
12
12
|
const TidyTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
13
|
-
const svg = select(s);
|
|
13
|
+
const svg = d3.select(s);
|
|
14
14
|
svg.selectAll('*').remove();
|
|
15
15
|
|
|
16
16
|
const { label, width, height, r = 4, padding = 4, margin = 60, slots } = options;
|
|
17
17
|
|
|
18
|
-
const root = hierarchy(data);
|
|
18
|
+
const root = d3.hierarchy(data);
|
|
19
19
|
|
|
20
20
|
// Compute labels and titles.
|
|
21
21
|
const descendants = root.descendants();
|
|
@@ -24,7 +24,7 @@ const TidyTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
|
24
24
|
// Compute the layout.
|
|
25
25
|
const dx = 16;
|
|
26
26
|
const dy = width / (root.height + padding);
|
|
27
|
-
const layout = tree().nodeSize([dx, dy]);
|
|
27
|
+
const layout = d3.tree().nodeSize([dx, dy]);
|
|
28
28
|
layout(root);
|
|
29
29
|
|
|
30
30
|
// Center the tree.
|
|
@@ -61,7 +61,8 @@ const TidyTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
|
61
61
|
.attr('class', slots?.path ?? '')
|
|
62
62
|
.attr(
|
|
63
63
|
'd',
|
|
64
|
-
|
|
64
|
+
d3
|
|
65
|
+
.link(d3.curveBumpX)
|
|
65
66
|
.x((d: any) => d.y + oy)
|
|
66
67
|
.y((d: any) => d.x * sx) as any,
|
|
67
68
|
);
|
package/src/types/schema.ts
CHANGED
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import { TypedObject } from '@dxos/echo-schema';
|
|
5
|
+
import { S, TypedObject } from '@dxos/echo-schema';
|
|
8
6
|
|
|
9
7
|
// TODO(burdon): Clashes with sdk/view.
|
|
10
8
|
export class ViewType extends TypedObject({
|
|
11
9
|
typename: 'dxos.org/type/ExplorerView',
|
|
12
10
|
version: '0.1.0',
|
|
13
11
|
})({
|
|
14
|
-
name:
|
|
15
|
-
type:
|
|
12
|
+
name: S.optional(S.String),
|
|
13
|
+
type: S.String,
|
|
16
14
|
}) {}
|
package/src/types/types.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { S } from '@dxos/echo-schema';
|
|
6
6
|
|
|
7
7
|
import { ViewType } from './schema';
|
|
8
8
|
import { EXPLORER_PLUGIN } from '../meta';
|
|
@@ -10,11 +10,11 @@ import { EXPLORER_PLUGIN } from '../meta';
|
|
|
10
10
|
export namespace ExplorerAction {
|
|
11
11
|
const EXPLORER_ACTION = `${EXPLORER_PLUGIN}/action`;
|
|
12
12
|
|
|
13
|
-
export class Create extends
|
|
14
|
-
input:
|
|
15
|
-
name:
|
|
13
|
+
export class Create extends S.TaggedClass<Create>()(`${EXPLORER_ACTION}/create`, {
|
|
14
|
+
input: S.Struct({
|
|
15
|
+
name: S.optional(S.String),
|
|
16
16
|
}),
|
|
17
|
-
output:
|
|
17
|
+
output: S.Struct({
|
|
18
18
|
object: ViewType,
|
|
19
19
|
}),
|
|
20
20
|
}) {}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { 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: Schema.optional(Schema.String),\n type: Schema.String,\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\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 Schema.TaggedClass<Create>()(`${EXPLORER_ACTION}/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: ViewType,\n }),\n }) {}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,cAAc;AAEvB,SAASC,mBAAmB;AAGrB,IAAMC,WAAN,cAAuBC,YAAY;EACxCC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,MAAMC,OAAOC,SAASD,OAAOE,MAAM;EACnCC,MAAMH,OAAOE;AACf,CAAA,EAAA;AAAI;;;ACXJ,SAASE,UAAAA,eAAc;;UAKNC,iBAAAA;AACf,QAAMC,kBAAkB,GAAGC,eAAAA;EAEpB,MAAMC,eAAeC,QAAOC,YAAW,EAAW,GAAGJ,eAAAA,WAA0B;IACpFK,OAAOF,QAAOG,OAAO;MACnBC,MAAMJ,QAAOK,SAASL,QAAOM,MAAM;IACrC,CAAA;IACAC,QAAQP,QAAOG,OAAO;MACpBK,QAAQC;IACV,CAAA;EACF,CAAA,EAAA;EAAI;kBAPSV,SAAAA;AAQf,GAXiBH,mBAAAA,iBAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["Schema", "TypedObject", "ViewType", "TypedObject", "typename", "version", "name", "Schema", "optional", "String", "type", "Schema", "ExplorerAction", "EXPLORER_ACTION", "EXPLORER_PLUGIN", "Create", "Schema", "TaggedClass", "input", "Struct", "name", "optional", "String", "output", "object", "ViewType"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/Graph/graph-model.ts", "../../../src/components/Graph/Graph.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { SchemaAST } from 'effect';\n\nimport { type CleanupFn } from '@dxos/async';\nimport {\n getSchema,\n getSchemaDXN,\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 AnyLiveObject, type Space } from '@dxos/react-client/echo';\n\nexport type SpaceGraphModelOptions = {\n schema?: boolean;\n};\n\n// TODO(burdon): Convert to common/graph.\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: AnyLiveObject<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?: CleanupFn;\n private _objects?: AnyLiveObject<any>[];\n private _objectsSubscription?: CleanupFn;\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(): AnyLiveObject<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.type(StoredSchema), Filter.type(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)?.typename;\n if (typename) {\n addSchema(typename);\n }\n });\n\n // Database Schema.\n this._schema?.forEach((schema) => {\n const typename = getSchemaDXN(schema)?.typename;\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)?.typename;\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 SchemaAST.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 { forceLink, forceManyBody } from 'd3';\nimport ForceGraph from 'force-graph';\nimport React, { type FC, useEffect, useRef } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type Space } from '@dxos/client/echo';\nimport { filterObjectsSync, type SearchResult } from '@dxos/plugin-search';\nimport { useAsyncState } from '@dxos/react-ui';\n\nimport { SpaceGraphModel } from './graph-model';\n\nexport type GraphProps = {\n space: Space;\n match?: RegExp;\n};\n\nexport const Graph: FC<GraphProps> = ({ space, match }) => {\n const { ref, width, height } = useResizeDetector({ refreshRate: 200 });\n const rootRef = useRef<HTMLDivElement>(null);\n const forceGraph = useRef<ForceGraph>();\n\n const [model] = useAsyncState(\n async () => (space ? new SpaceGraphModel({ schema: true }).open(space) : undefined),\n [space],\n );\n\n const filteredRef = useRef<SearchResult[]>();\n filteredRef.current = filterObjectsSync(model?.objects ?? [], match);\n\n useEffect(() => {\n if (rootRef.current) {\n // https://github.com/vasturiano/force-graph\n // https://github.com/vasturiano/3d-force-graph\n forceGraph.current = new 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 useEffect(() => {\n if (forceGraph.current && width && height && model) {\n forceGraph.current\n .pauseAnimation()\n .width(width)\n .height(height)\n .onEngineStop(() => {\n handleZoomToFit();\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\n .graphData(model.graph)\n .warmupTicks(100)\n .cooldownTime(1000)\n .resumeAnimation();\n }\n }, [model, width, height]);\n\n const handleZoomToFit = () => {\n forceGraph.current?.zoomToFit(400, 40);\n };\n\n return (\n <div ref={ref} className='relative grow' onClick={handleZoomToFit}>\n <div ref={rootRef} className='absolute inset-0' />\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,iBAAiB;AAG1B,SACEC,WACAC,cAEAC,uBACAC,iBACAC,oBACK;AACP,SAAyBC,kBAAkB;AAC3C,SAASC,WAAW;AACpB,SAASC,sBAAsB;AAC/B,SAASC,cAA8C;;AAyBhD,IAAMC,kBAAN,cAA8BJ,WAAAA;EAWnCK,YAA6BC,WAAmC,CAAC,GAAG;AAClE,UAAK;SADsBA,WAAAA;SAVZC,SAAmC;MAClDC,OAAO,CAAA;MACPC,OAAO,CAAA;IACT;EASA;EAEA,IAAaC,QAAkC;AAC7C,WAAO,KAAKH;EACd;EAEA,IAAII,UAAgC;AAClC,WAAO,KAAKC,YAAY,CAAA;EAC1B;;;;;;;EASA,MAAMC,KAAKC,OAAcC,UAAmB;AAE1C,QAAI,CAAC,KAAKC,qBAAqB;AAK7B,YAAMC,eAAeH,MAAMI,GAAGC,eAAeC,MAAM,CAAC,CAAA;AACpD,YAAMC,UAAU,MAAMJ,aAAaK,IAAG;AACtC,YAA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AO,CAAA;MAAG,CAAA;AACtEzB,iBAAWQ,UAAUF;IACvB;EACF,GAAG,CAAA,CAAE;AAELK,YAAU,MAAA;AACR,QAAIX,WAAWQ,WAAWd,SAASC,UAAUM,OAAO;AAClDD,iBAAWQ,QACRc,eAAc,EACd5B,MAAMA,KAAAA,EACNC,OAAOA,MAAAA,EACP+B,aAAa,MAAA;AACZC,wBAAAA;MACF,CAAA,EAICC,QAAQ,QAAQC,UAAAA,EAAYC,SAAS,GAAA,EAAKC,SAAS,GAAA,CAAA,EACnDH,QAAQ,UAAUI,cAAAA,EAAgBD,SAAS,GAAC,CAAA,EAI5CR,UAAUtB,MAAMgC,KAAK,EACrBC,YAAY,GAAA,EACZC,aAAa,GAAA,EACbC,gBAAe;IACpB;EACF,GAAG;IAACnC;IAAOP;IAAOC;GAAO;AAEzB,QAAMgC,kBAAkB,MAAA;AACtB3B,eAAWQ,SAAS6B,UAAU,KAAK,EAAA;EACrC;AAEA,SACE,sBAAA,cAACC,OAAAA;IAAI7C;IAAU8C,WAAU;IAAgBC,SAASb;KAChD,sBAAA,cAACW,OAAAA;IAAI7C,KAAKK;IAASyC,WAAU;;AAGnC;",
|
|
6
|
-
"names": ["SchemaAST", "getSchema", "getSchemaDXN", "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", "type", "currentNodes", "addSchema", "typename", "current", "find", "node", "id", "push", "data", "forEach", "schema", "object", "schemaNode", "source", "target", "info", "getPropertySignatures", "ast", "prop", "hasTypeAnnotation", "name", "toString", "value", "String", "refs", "Array", "isArray", "ref", "findIndex", "obj", "triggerUpdate", "fire", "setSelected", "close", "undefined", "forceLink", "forceManyBody", "ForceGraph", "React", "useEffect", "useRef", "useResizeDetector", "filterObjectsSync", "useAsyncState", "Graph", "space", "match", "ref", "width", "height", "useResizeDetector", "refreshRate", "rootRef", "useRef", "forceGraph", "model", "useAsyncState", "SpaceGraphModel", "schema", "open", "undefined", "filteredRef", "current", "filterObjectsSync", "objects", "useEffect", "ForceGraph", "nodeRelSize", "nodeLabel", "node", "type", "data", "typename", "id", "nodeAutoColorBy", "linkColor", "pauseAnimation", "graphData", "nodes", "links", "onEngineStop", "handleZoomToFit", "d3Force", "forceLink", "distance", "strength", "forceManyBody", "graph", "warmupTicks", "cooldownTime", "resumeAnimation", "zoomToFit", "div", "className", "onClick"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, Capabilities, createResolver } from '@dxos/app-framework';\nimport { live } from '@dxos/live-object';\n\nimport { ExplorerAction, ViewType } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: ExplorerAction.Create,\n resolve: ({ name }) => ({\n data: { object: live(ViewType, { name, type: '' }) },\n }),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAIA,SAASA,aAAaC,cAAcC,sBAAsB;AAC1D,SAASC,YAAY;AAIrB,IAAA,0BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,eAAeC;EACvBC,SAAS,CAAC,EAAEC,KAAI,OAAQ;IACtBC,MAAM;MAAEC,QAAQC,KAAKC,UAAU;QAAEJ;QAAMK,MAAM;MAAG,CAAA;IAAG;EACrD;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["contributes", "Capabilities", "createResolver", "live", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ExplorerAction", "Create", "resolve", "name", "data", "object", "live", "ViewType", "type"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/Graph/graph-model.ts", "../../../src/components/Graph/Graph.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { SchemaAST } from 'effect';\n\nimport { type CleanupFn } from '@dxos/async';\nimport {\n getSchema,\n getSchemaDXN,\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 AnyLiveObject, type Space } from '@dxos/react-client/echo';\n\nexport type SpaceGraphModelOptions = {\n schema?: boolean;\n};\n\n// TODO(burdon): Convert to common/graph.\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: AnyLiveObject<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?: CleanupFn;\n private _objects?: AnyLiveObject<any>[];\n private _objectsSubscription?: CleanupFn;\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(): AnyLiveObject<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.type(StoredSchema), Filter.type(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)?.typename;\n if (typename) {\n addSchema(typename);\n }\n });\n\n // Database Schema.\n this._schema?.forEach((schema) => {\n const typename = getSchemaDXN(schema)?.typename;\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)?.typename;\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 SchemaAST.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 { forceLink, forceManyBody } from 'd3';\nimport ForceGraph from 'force-graph';\nimport React, { type FC, useEffect, useRef } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type Space } from '@dxos/client/echo';\nimport { filterObjectsSync, type SearchResult } from '@dxos/plugin-search';\nimport { useAsyncState } from '@dxos/react-ui';\n\nimport { SpaceGraphModel } from './graph-model';\n\nexport type GraphProps = {\n space: Space;\n match?: RegExp;\n};\n\nexport const Graph: FC<GraphProps> = ({ space, match }) => {\n const { ref, width, height } = useResizeDetector({ refreshRate: 200 });\n const rootRef = useRef<HTMLDivElement>(null);\n const forceGraph = useRef<ForceGraph>();\n\n const [model] = useAsyncState(\n async () => (space ? new SpaceGraphModel({ schema: true }).open(space) : undefined),\n [space],\n );\n\n const filteredRef = useRef<SearchResult[]>();\n filteredRef.current = filterObjectsSync(model?.objects ?? [], match);\n\n useEffect(() => {\n if (rootRef.current) {\n // https://github.com/vasturiano/force-graph\n // https://github.com/vasturiano/3d-force-graph\n forceGraph.current = new 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 useEffect(() => {\n if (forceGraph.current && width && height && model) {\n forceGraph.current\n .pauseAnimation()\n .width(width)\n .height(height)\n .onEngineStop(() => {\n handleZoomToFit();\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\n .graphData(model.graph)\n .warmupTicks(100)\n .cooldownTime(1000)\n .resumeAnimation();\n }\n }, [model, width, height]);\n\n const handleZoomToFit = () => {\n forceGraph.current?.zoomToFit(400, 40);\n };\n\n return (\n <div ref={ref} className='relative grow' onClick={handleZoomToFit}>\n <div ref={rootRef} className='absolute inset-0' />\n </div>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAA0B;AAG1B,yBAOO;AACP,uBAA2C;AAC3C,iBAAoB;AACpB,mBAA+B;AAC/B,kBAAuD;ACdvD,gBAAyC;AACzC,yBAAuB;AACvB,mBAAkD;AAClD,mCAAkC;AAGlC,2BAAqD;AACrD,sBAA8B;;ADgCvB,IAAMA,kBAAN,cAA8BC,4BAAAA;EAWnCC,YAA6BC,WAAmC,CAAC,GAAG;AAClE,UAAK;SADsBA,WAAAA;SAVZC,SAAmC;MAClDC,OAAO,CAAA;MACPC,OAAO,CAAA;IACT;EASA;EAEA,IAAaC,QAAkC;AAC7C,WAAO,KAAKH;EACd;EAEA,IAAII,UAAgC;AAClC,WAAO,KAAKC,Y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AAO,MAAA;AACLV,iBAAW9C,SAASyD,eAAAA,EAAiBC,UAAU;QAAEvF,OAAO,CAAA;QAAIC,OAAO,CAAA;MAAG,CAAA;AACtE0E,iBAAW9C,UAAUqC;IACvB;EACF,GAAG,CAAA,CAAE;AAELc,8BAAU,MAAA;AACR,QAAIL,WAAW9C,WAAWwC,SAASC,UAAUM,OAAO;AAClDD,iBAAW9C,QACRyD,eAAc,EACdjB,MAAMA,KAAAA,EACNC,OAAOA,MAAAA,EACPkB,aAAa,MAAA;AACZC,wBAAAA;MACF,CAAA,EAICC,QAAQ,YAAQC,qBAAAA,EAAYC,SAAS,GAAA,EAAKC,SAAS,GAAA,CAAA,EACnDH,QAAQ,cAAUI,yBAAAA,EAAgBD,SAAS,GAAC,CAAA,EAI5CN,UAAUX,MAAM1E,KAAK,EACrB6F,YAAY,GAAA,EACZC,aAAa,GAAA,EACbC,gBAAe;IACpB;EACF,GAAG;IAACrB;IAAOP;IAAOC;GAAO;AAEzB,QAAMmB,kBAAkB,MAAA;AACtBd,eAAW9C,SAASqE,UAAU,KAAK,EAAA;EACrC;AAEA,SACE,6BAAAC,QAAA,cAACC,OAAAA;IAAIzC;IAAU0C,WAAU;IAAgBC,SAASb;KAChD,6BAAAU,QAAA,cAACC,OAAAA;IAAIzC,KAAKc;IAAS4B,WAAU;;AAGnC;",
|
|
6
|
-
"names": ["SpaceGraphModel", "GraphModel", "constructor", "_options", "_graph", "nodes", "links", "graph", "objects", "_objects", "open", "space", "objectId", "_schemaSubscription", "schemaaQuery", "db", "schemaRegistry", "query", "schemas", "run", "onSchemaUpdate", "results", "_schema", "subscribe", "_objectsSubscription", "Filter", "not", "or", "type", "StoredSchema", "CollectionType", "currentNodes", "addSchema", "typename", "current", "find", "node", "id", "push", "data", "forEach", "schema", "getSchemaDXN", "object", "getSchema", "schemaNode", "source", "target", "log", "info", "SchemaAST", "getPropertySignatures", "ast", "prop", "SchemaValidator", "hasTypeAnnotation", "name", "toString", "ReferenceAnnotationId", "value", "String", "refs", "Array", "isArray", "ref", "findIndex", "obj", "triggerUpdate", "fire", "setSelected", "close", "undefined", "Graph", "match", "width", "height", "useResizeDetector", "refreshRate", "rootRef", "useRef", "forceGraph", "model", "useAsyncState", "filteredRef", "filterObjectsSync", "useEffect", "ForceGraph", "nodeRelSize", "nodeLabel", "nodeAutoColorBy", "linkColor", "pauseAnimation", "graphData", "onEngineStop", "handleZoomToFit", "d3Force", "forceLink", "distance", "strength", "forceManyBody", "warmupTicks", "cooldownTime", "resumeAnimation", "zoomToFit", "React", "div", "className", "onClick"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema } from 'effect';\n\nimport { 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: Schema.optional(Schema.String),\n type: Schema.String,\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\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 Schema.TaggedClass<Create>()(`${EXPLORER_ACTION}/create`, {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n }),\n output: Schema.Struct({\n object: ViewType,\n }),\n }) {}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,oBAAuB;AAEvB,yBAA4B;ACF5B,IAAAA,iBAAuB;ADKhB,IAAMC,WAAN,kBAAuBC,gCAAY;EACxCC,UAAU;EACVC,SAAS;AACX,CAAA,EAAG;EACDC,MAAMC,qBAAOC,SAASD,qBAAOE,MAAM;EACnCC,MAAMH,qBAAOE;AACf,CAAA,EAAA;AAAI;;UCNaE,iBAAAA;AACf,QAAMC,kBAAkB,GAAGC,qCAAAA;EAEpB,MAAMC,eAAeP,eAAAA,OAAOQ,YAAW,EAAW,GAAGH,eAAAA,WAA0B;IACpFI,OAAOT,eAAAA,OAAOU,OAAO;MACnBX,MAAMC,eAAAA,OAAOC,SAASD,eAAAA,OAAOE,MAAM;IACrC,CAAA;IACAS,QAAQX,eAAAA,OAAOU,OAAO;MACpBE,QAAQjB;IACV,CAAA;EACF,CAAA,EAAA;EAAI;kBAPSY,SAAAA;AAQf,GAXiBH,mBAAAA,iBAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["import_effect", "ViewType", "TypedObject", "typename", "version", "name", "Schema", "optional", "String", "type", "ExplorerAction", "EXPLORER_ACTION", "EXPLORER_PLUGIN", "Create", "TaggedClass", "input", "Struct", "output", "object"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { contributes, Capabilities, createResolver } from '@dxos/app-framework';\nimport { live } from '@dxos/live-object';\n\nimport { ExplorerAction, ViewType } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: ExplorerAction.Create,\n resolve: ({ name }) => ({\n data: { object: live(ViewType, { name, type: '' }) },\n }),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAA0D;AAC1D,yBAAqB;AAIrB,IAAA,0BAAe,UACbA,kCACEC,kCAAaC,oBACbC,qCAAe;EACbC,QAAQC,qCAAeC;EACvBC,SAAS,CAAC,EAAEC,KAAI,OAAQ;IACtBC,MAAM;MAAEC,YAAQC,yBAAKC,gCAAU;QAAEJ;QAAMK,MAAM;MAAG,CAAA;IAAG;EACrD;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ExplorerAction", "Create", "resolve", "name", "data", "object", "live", "ViewType", "type"]
|
|
7
|
-
}
|