@dxos/plugin-explorer 0.8.4-main.74a063c4e0 → 0.8.4-main.765dc60934
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/LICENSE +102 -5
- package/dist/lib/neutral/ExplorerArticle-EW2MBCRK.mjs +141 -0
- package/dist/lib/neutral/ExplorerArticle-EW2MBCRK.mjs.map +7 -0
- package/dist/lib/neutral/ExplorerPlugin.mjs +10 -0
- package/dist/lib/neutral/capabilities/index.mjs +11 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/{browser/types/index.mjs → neutral/chunk-7SPMPHRS.mjs} +10 -8
- package/dist/lib/neutral/chunk-7SPMPHRS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GRJXLL4Z.mjs +25 -0
- package/dist/lib/neutral/chunk-GRJXLL4Z.mjs.map +7 -0
- package/dist/lib/{browser/chunk-LSUP47BZ.mjs → neutral/chunk-HPIS2WXY.mjs} +1 -1
- package/dist/lib/{browser/chunk-LSUP47BZ.mjs.map → neutral/chunk-HPIS2WXY.mjs.map} +2 -2
- package/dist/lib/{browser → neutral/components}/index.mjs +661 -417
- package/dist/lib/{node-esm → neutral/components}/index.mjs.map +4 -4
- package/dist/lib/neutral/containers/index.mjs +9 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-object-F6TKVAGV.mjs +39 -0
- package/dist/lib/neutral/create-object-F6TKVAGV.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +45 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +14 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/meta.mjs +1 -1
- package/dist/lib/neutral/plugin.mjs +12 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-APBW2VQG.mjs +26 -0
- package/dist/lib/neutral/react-surface-APBW2VQG.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +8 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +33 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +10 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/data/cities.d.ts +4 -4
- package/dist/types/data/cities.d.ts.map +1 -1
- package/dist/types/data/countries-110m.d.ts +19 -22
- package/dist/types/data/countries-110m.d.ts.map +1 -1
- package/dist/types/src/ExplorerPlugin.d.ts +1 -0
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/ExplorerPlugin.test.d.ts +2 -0
- package/dist/types/src/ExplorerPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +6 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts +4 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
- package/dist/types/src/components/Globe/Globe.stories.d.ts +5 -2
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/CanvasForceGraph.d.ts +13 -0
- package/dist/types/src/components/Graph/CanvasForceGraph.d.ts.map +1 -0
- package/dist/types/src/components/Graph/{D3ForceGraph.stories.d.ts → CanvasForceGraph.stories.d.ts} +3 -7
- package/dist/types/src/components/Graph/CanvasForceGraph.stories.d.ts.map +1 -0
- package/dist/types/src/components/Graph/ForceGraph.d.ts +12 -5
- package/dist/types/src/components/Graph/ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +3 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/{adapter.d.ts → graph-adapter.d.ts} +1 -1
- package/dist/types/src/components/Graph/graph-adapter.d.ts.map +1 -0
- package/dist/types/src/components/Graph/index.d.ts +1 -1
- package/dist/types/src/components/Graph/index.d.ts.map +1 -1
- package/dist/types/src/components/Tree/EdgeBundling.stories.d.ts +21 -0
- package/dist/types/src/components/Tree/EdgeBundling.stories.d.ts.map +1 -0
- package/dist/types/src/components/Tree/Tree.d.ts +20 -23
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts +5 -12
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/index.d.ts +3 -0
- package/dist/types/src/components/Tree/index.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts +35 -2
- package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/RadialTree.d.ts +35 -2
- package/dist/types/src/components/Tree/layout/RadialTree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/TidyTree.d.ts +24 -2
- package/dist/types/src/components/Tree/layout/TidyTree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/hierarchy.d.ts +17 -0
- package/dist/types/src/components/Tree/layout/hierarchy.d.ts.map +1 -0
- package/dist/types/src/components/Tree/layout/index.d.ts +5 -4
- package/dist/types/src/components/Tree/layout/index.d.ts.map +1 -1
- package/dist/types/src/components/Tree/layout/slots.d.ts +7 -0
- package/dist/types/src/components/Tree/layout/slots.d.ts.map +1 -0
- package/dist/types/src/components/Tree/layout/useContainerSize.d.ts +15 -0
- package/dist/types/src/components/Tree/layout/useContainerSize.d.ts.map +1 -0
- package/dist/types/src/components/Tree/space-graph-adapter.d.ts +32 -0
- package/dist/types/src/components/Tree/space-graph-adapter.d.ts.map +1 -0
- package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing/index.d.ts +1 -0
- package/dist/types/src/components/Tree/testing/index.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing/relations.d.ts +47 -0
- package/dist/types/src/components/Tree/testing/relations.d.ts.map +1 -0
- package/dist/types/src/components/Tree/types/tree.d.ts +6 -6
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts +14 -4
- package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
- package/dist/types/src/components/plot.d.ts.map +1 -1
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts +8 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts +24 -0
- package/dist/types/src/containers/ExplorerArticle/ExplorerArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerArticle/index.d.ts +2 -0
- package/dist/types/src/containers/ExplorerArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphModel.d.ts +2 -2
- package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +2 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +17 -17
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Graph.d.ts +3 -4
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +100 -62
- package/src/ExplorerPlugin.test.ts +26 -0
- package/src/ExplorerPlugin.tsx +6 -35
- package/src/capabilities/create-object.ts +36 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/react-surface.tsx +6 -4
- package/src/components/Chart/Chart.stories.tsx +14 -20
- package/src/components/Globe/Globe.stories.tsx +17 -19
- package/src/components/Graph/CanvasForceGraph.stories.tsx +83 -0
- package/src/components/Graph/CanvasForceGraph.tsx +124 -0
- package/src/components/Graph/ForceGraph.stories.tsx +69 -37
- package/src/components/Graph/ForceGraph.tsx +104 -85
- package/src/components/Graph/index.ts +1 -1
- package/src/components/Tree/EdgeBundling.stories.tsx +144 -0
- package/src/components/Tree/Tree.stories.tsx +17 -38
- package/src/components/Tree/Tree.tsx +69 -100
- package/src/components/Tree/index.ts +3 -0
- package/src/components/Tree/layout/HierarchicalEdgeBundling.tsx +277 -0
- package/src/components/Tree/layout/RadialTree.tsx +237 -0
- package/src/components/Tree/layout/TidyTree.tsx +246 -0
- package/src/components/Tree/layout/hierarchy.ts +32 -0
- package/src/components/Tree/layout/index.ts +5 -5
- package/src/components/Tree/layout/slots.ts +19 -0
- package/src/components/Tree/layout/useContainerSize.ts +43 -0
- package/src/components/Tree/space-graph-adapter.ts +96 -0
- package/src/components/Tree/testing/generator.ts +1 -1
- package/src/components/Tree/testing/index.ts +1 -0
- package/src/components/Tree/testing/relations.ts +182 -0
- package/src/components/Tree/types/tree.test.ts +1 -1
- package/src/components/Tree/types/tree.ts +9 -9
- package/src/components/Tree/types/types.ts +38 -29
- package/src/containers/ExplorerArticle/ExplorerArticle.stories.tsx +119 -0
- package/src/containers/ExplorerArticle/ExplorerArticle.tsx +153 -0
- package/src/containers/ExplorerArticle/index.ts +5 -0
- package/src/containers/index.ts +1 -1
- package/src/hooks/useGraphModel.ts +10 -6
- package/src/index.ts +1 -4
- package/src/plugin.ts +9 -0
- package/src/testing.ts +7 -0
- package/src/translations.ts +1 -1
- package/src/types/ExplorerAction.ts +1 -1
- package/src/types/Graph.ts +2 -3
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/types/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EN3JZNEY.mjs +0 -26
- package/dist/lib/node-esm/chunk-EN3JZNEY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/index.mjs +0 -11375
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/meta.mjs +0 -9
- package/dist/lib/node-esm/types/index.mjs +0 -71
- package/dist/lib/node-esm/types/index.mjs.map +0 -7
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts +0 -19
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +0 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +0 -1
- package/dist/types/src/components/Graph/adapter.d.ts.map +0 -1
- package/dist/types/src/components/Graph/testing.d.ts +0 -14
- package/dist/types/src/components/Graph/testing.d.ts.map +0 -1
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +0 -6
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +0 -1
- package/dist/types/src/containers/ExplorerContainer/index.d.ts +0 -2
- package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +0 -1
- package/src/components/Graph/D3ForceGraph.stories.tsx +0 -83
- package/src/components/Graph/D3ForceGraph.tsx +0 -108
- package/src/components/Graph/testing.ts +0 -58
- package/src/components/Tree/layout/HierarchicalEdgeBundling.ts +0 -162
- package/src/components/Tree/layout/RadialTree.ts +0 -94
- package/src/components/Tree/layout/TidyTree.ts +0 -101
- package/src/containers/ExplorerContainer/ExplorerContainer.tsx +0 -53
- package/src/containers/ExplorerContainer/index.ts +0 -5
- /package/dist/lib/{browser/chunk-J5LGTIGS.mjs.map → neutral/ExplorerPlugin.mjs.map} +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser/meta.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm → neutral}/meta.mjs.map +0 -0
- /package/src/components/Graph/{adapter.ts → graph-adapter.ts} +0 -0
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
// Copyright 2022 Observable, Inc.
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
import { hierarchy, linkRadial, select, tree } from 'd3';
|
|
7
|
-
|
|
8
|
-
import { type TreeOptions } from '../Tree';
|
|
9
|
-
|
|
10
|
-
// Released under the ISC license.
|
|
11
|
-
// https://observablehq.com/@d3/radial-tree
|
|
12
|
-
// https://observablehq.com/@d3/tree
|
|
13
|
-
const RadialTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
14
|
-
const svg = select(s);
|
|
15
|
-
svg.selectAll('*').remove();
|
|
16
|
-
|
|
17
|
-
const {
|
|
18
|
-
label, // given a node d, returns the display name
|
|
19
|
-
radius = 400,
|
|
20
|
-
r = 4, // radius of nodes
|
|
21
|
-
slots,
|
|
22
|
-
} = options;
|
|
23
|
-
|
|
24
|
-
const arc = 2 * Math.PI;
|
|
25
|
-
|
|
26
|
-
const root = hierarchy(data);
|
|
27
|
-
|
|
28
|
-
// Sort the nodes.
|
|
29
|
-
// if (sort) {
|
|
30
|
-
// root.sort(sort);
|
|
31
|
-
// }
|
|
32
|
-
|
|
33
|
-
// Compute labels and titles.
|
|
34
|
-
const descendants = root.descendants();
|
|
35
|
-
const getLabel = label === null ? null : descendants.map((d) => label(d.data));
|
|
36
|
-
|
|
37
|
-
// Compute the layout.
|
|
38
|
-
const layout = tree()
|
|
39
|
-
.size([arc, radius])
|
|
40
|
-
.separation((a: any, b: any) => (a.parent === b.parent ? 1 : 2) / a.depth);
|
|
41
|
-
layout(root);
|
|
42
|
-
|
|
43
|
-
// Links.
|
|
44
|
-
svg
|
|
45
|
-
.append('g')
|
|
46
|
-
.selectAll('path')
|
|
47
|
-
.data(root.links())
|
|
48
|
-
.join('path')
|
|
49
|
-
.attr('class', slots?.path ?? '')
|
|
50
|
-
.attr(
|
|
51
|
-
'd',
|
|
52
|
-
linkRadial()
|
|
53
|
-
.angle((d: any) => d.x + Math.PI / 2)
|
|
54
|
-
.radius((d: any) => d.y) as any,
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
// Nodes.
|
|
58
|
-
const node = svg
|
|
59
|
-
.append('g')
|
|
60
|
-
.selectAll('a')
|
|
61
|
-
.data(root.descendants())
|
|
62
|
-
.join('a')
|
|
63
|
-
// .attr('xlink:href', link == null ? null : (d) => link(d.data, d))
|
|
64
|
-
// .attr('target', link == null ? null : linkTarget)
|
|
65
|
-
.attr('transform', (d: any) => `rotate(${(d.x * 180) / Math.PI}) translate(${d.y},0)`);
|
|
66
|
-
|
|
67
|
-
node
|
|
68
|
-
.append('circle')
|
|
69
|
-
.attr('class', slots?.node ?? '')
|
|
70
|
-
.attr('r', r);
|
|
71
|
-
|
|
72
|
-
// if (title != null) {
|
|
73
|
-
// node.append('title').text((d) => title(d.data, d));
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
// Text.
|
|
77
|
-
if (getLabel) {
|
|
78
|
-
node
|
|
79
|
-
.append('text')
|
|
80
|
-
.attr('transform', (d: any) => `rotate(${d.x >= Math.PI ? 180 : 0})`)
|
|
81
|
-
.attr('dy', '0.32em')
|
|
82
|
-
// eslint-disable-next-line no-mixed-operators
|
|
83
|
-
.attr('x', (d: any) => (d.x < Math.PI === !d.children ? 6 : -6))
|
|
84
|
-
// eslint-disable-next-line no-mixed-operators
|
|
85
|
-
.attr('text-anchor', (d: any) => (d.x < Math.PI === !d.children ? 'start' : 'end'))
|
|
86
|
-
// .attr('paint-order', 'stroke')
|
|
87
|
-
.attr('class', slots?.text ?? '')
|
|
88
|
-
.text((d, i) => getLabel[i]);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return svg.node();
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export default RadialTree;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
// Copyright 2021 Observable, Inc.
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
import { curveBumpX, hierarchy, link, select, tree } from 'd3';
|
|
7
|
-
|
|
8
|
-
import { type TreeOptions } from '../Tree';
|
|
9
|
-
|
|
10
|
-
// Released under the ISC license.
|
|
11
|
-
// https://observablehq.com/@d3/tree
|
|
12
|
-
const TidyTree = (s: SVGSVGElement, data: any, options: TreeOptions) => {
|
|
13
|
-
const svg = select(s);
|
|
14
|
-
svg.selectAll('*').remove();
|
|
15
|
-
|
|
16
|
-
const { label, width, height, r = 4, padding = 4, margin = 60, slots } = options;
|
|
17
|
-
|
|
18
|
-
const root = hierarchy(data);
|
|
19
|
-
|
|
20
|
-
// Compute labels and titles.
|
|
21
|
-
const descendants = root.descendants();
|
|
22
|
-
const getLabel = label == null ? null : descendants.map((d) => label(d.data));
|
|
23
|
-
|
|
24
|
-
// Compute the layout.
|
|
25
|
-
const dx = 16;
|
|
26
|
-
const dy = width / (root.height + padding);
|
|
27
|
-
const layout = tree().nodeSize([dx, dy]);
|
|
28
|
-
layout(root);
|
|
29
|
-
|
|
30
|
-
// Center the tree.
|
|
31
|
-
let x0 = Infinity;
|
|
32
|
-
let x1 = -x0;
|
|
33
|
-
let y0 = Infinity;
|
|
34
|
-
let y1 = -y0;
|
|
35
|
-
root.each((d: any) => {
|
|
36
|
-
if (d.x > x1) {
|
|
37
|
-
x1 = d.x;
|
|
38
|
-
}
|
|
39
|
-
if (d.x < x0) {
|
|
40
|
-
x0 = d.x;
|
|
41
|
-
}
|
|
42
|
-
if (d.y > y1) {
|
|
43
|
-
y1 = d.y;
|
|
44
|
-
}
|
|
45
|
-
if (d.y < y0) {
|
|
46
|
-
y0 = d.y;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// TODO(burdon): Option to expand.
|
|
51
|
-
// NOTE: x and y are flipped.
|
|
52
|
-
const sx = Math.min(2, Math.max(1, (height - margin * 2) / (x1 - x0)));
|
|
53
|
-
const oy = -(width - (y1 - y0)) / 2;
|
|
54
|
-
|
|
55
|
-
// Links.
|
|
56
|
-
svg
|
|
57
|
-
.append('g')
|
|
58
|
-
.selectAll('path')
|
|
59
|
-
.data(root.links())
|
|
60
|
-
.join('path')
|
|
61
|
-
.attr('class', slots?.path ?? '')
|
|
62
|
-
.attr(
|
|
63
|
-
'd',
|
|
64
|
-
link(curveBumpX)
|
|
65
|
-
.x((d: any) => d.y + oy)
|
|
66
|
-
.y((d: any) => d.x * sx) as any,
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
// Nodes.
|
|
70
|
-
const node = svg
|
|
71
|
-
.append('g')
|
|
72
|
-
.selectAll('a')
|
|
73
|
-
.data(root.descendants())
|
|
74
|
-
.join('a')
|
|
75
|
-
// .attr('xlink:href', link == null ? null : (d) => link(d.data, d))
|
|
76
|
-
// .attr('target', link == null ? null : linkTarget)
|
|
77
|
-
.attr('transform', (d: any) => `translate(${d.y + oy},${d.x * sx})`);
|
|
78
|
-
|
|
79
|
-
node
|
|
80
|
-
.append('circle')
|
|
81
|
-
.attr('class', slots?.node ?? '')
|
|
82
|
-
.attr('r', r);
|
|
83
|
-
|
|
84
|
-
// if (title != null) {
|
|
85
|
-
// node.append('title').text((d) => title(d.data, d));
|
|
86
|
-
// }
|
|
87
|
-
|
|
88
|
-
if (getLabel) {
|
|
89
|
-
node
|
|
90
|
-
.append('text')
|
|
91
|
-
|
|
92
|
-
.attr('dy', '0.32em')
|
|
93
|
-
.attr('x', (d) => (d.children ? -6 : 6))
|
|
94
|
-
.attr('text-anchor', (d) => (d.children ? 'end' : 'start'))
|
|
95
|
-
// .attr('paint-order', 'stroke')
|
|
96
|
-
.attr('class', slots?.text ?? '')
|
|
97
|
-
.text((d, i) => getLabel[i]);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
export default TidyTree;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
-
import { type Filter } from '@dxos/echo';
|
|
9
|
-
import { type View } from '@dxos/echo';
|
|
10
|
-
import { QueryBuilder } from '@dxos/echo-query';
|
|
11
|
-
import { useGlobalSearch } from '@dxos/plugin-search';
|
|
12
|
-
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
13
|
-
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
14
|
-
import { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';
|
|
15
|
-
|
|
16
|
-
import { D3ForceGraph } from '#components';
|
|
17
|
-
import { useGraphModel } from '#hooks';
|
|
18
|
-
|
|
19
|
-
export type ExplorerContainerProps = AppSurface.ObjectArticleProps<View.View>;
|
|
20
|
-
|
|
21
|
-
export const ExplorerContainer = ({ role, subject: view, attendableId: _attendableId }: ExplorerContainerProps) => {
|
|
22
|
-
useObject(view);
|
|
23
|
-
const space = view && getSpace(view);
|
|
24
|
-
const [filter, setFilter] = useState<Filter.Any>();
|
|
25
|
-
const model = useGraphModel(space, filter);
|
|
26
|
-
const { match } = useGlobalSearch();
|
|
27
|
-
|
|
28
|
-
const builder = useMemo(() => new QueryBuilder(), []);
|
|
29
|
-
const handleChange = useCallback<NonNullable<QueryEditorProps['onChange']>>((value) => {
|
|
30
|
-
setFilter(builder.build(value).filter);
|
|
31
|
-
}, []);
|
|
32
|
-
|
|
33
|
-
const showToolbar = role === 'article';
|
|
34
|
-
|
|
35
|
-
if (!space || !model) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return (
|
|
40
|
-
<Panel.Root role={role}>
|
|
41
|
-
{showToolbar && (
|
|
42
|
-
<Panel.Toolbar asChild>
|
|
43
|
-
<Toolbar.Root>
|
|
44
|
-
<QueryEditor db={space.db} onChange={handleChange} />
|
|
45
|
-
</Toolbar.Root>
|
|
46
|
-
</Panel.Toolbar>
|
|
47
|
-
)}
|
|
48
|
-
<Panel.Content asChild>
|
|
49
|
-
<D3ForceGraph model={model} match={match} />
|
|
50
|
-
</Panel.Content>
|
|
51
|
-
</Panel.Root>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|