@dxos/plugin-explorer 0.8.4-main.9735255 → 0.8.4-main.abd8ff62ef
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/{chunk-YNQF4CPY.mjs → chunk-HPIS2WXY.mjs} +2 -2
- package/dist/lib/browser/{chunk-YNQF4CPY.mjs.map → chunk-HPIS2WXY.mjs.map} +3 -3
- package/dist/lib/{node-esm/chunk-QLMTN2XI.mjs → browser/components/index.mjs} +196 -20
- package/dist/lib/{node-esm/chunk-QLMTN2XI.mjs.map → browser/components/index.mjs.map} +4 -4
- package/dist/lib/browser/hooks/index.mjs +40 -0
- package/dist/lib/browser/hooks/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +5 -92
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/types/index.mjs +66 -4
- package/dist/lib/browser/types/index.mjs.map +4 -4
- package/dist/lib/node-esm/{chunk-DK77RB6M.mjs → chunk-6EUBRHHX.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-DK77RB6M.mjs.map → chunk-6EUBRHHX.mjs.map} +3 -3
- package/dist/lib/{browser/chunk-AGZAGILW.mjs → node-esm/components/index.mjs} +198 -19
- package/dist/lib/{browser/chunk-AGZAGILW.mjs.map → node-esm/components/index.mjs.map} +4 -4
- package/dist/lib/node-esm/hooks/index.mjs +41 -0
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +5 -92
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/types/index.mjs +66 -4
- package/dist/lib/node-esm/types/index.mjs.map +4 -4
- 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/index.d.ts +2 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/Chart/Chart.d.ts.map +1 -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.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts +6 -5
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +4 -2
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/adapter.d.ts.map +1 -1
- package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/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/testing/generator.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +7 -7
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/plot.d.ts.map +1 -1
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +6 -0
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerContainer/index.d.ts +2 -0
- package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +28 -26
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
- package/dist/types/src/types/Graph.d.ts +3 -10
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +67 -47
- package/src/ExplorerPlugin.test.ts +26 -0
- package/src/ExplorerPlugin.tsx +31 -17
- package/src/capabilities/index.ts +3 -1
- package/src/capabilities/react-surface.tsx +32 -0
- package/src/components/Chart/Chart.stories.tsx +2 -3
- package/src/components/Globe/Globe.stories.tsx +2 -3
- package/src/components/Graph/D3ForceGraph.stories.tsx +16 -16
- package/src/components/Graph/D3ForceGraph.tsx +82 -75
- package/src/components/Graph/ForceGraph.stories.tsx +16 -16
- package/src/components/Graph/testing.ts +2 -2
- package/src/components/Tree/Tree.stories.tsx +7 -5
- package/src/components/Tree/testing/generator.ts +1 -1
- package/src/components/Tree/types/tree.test.ts +3 -4
- package/src/components/Tree/types/tree.ts +15 -15
- package/src/components/index.ts +0 -4
- package/src/containers/ExplorerContainer/ExplorerContainer.tsx +53 -0
- package/src/containers/ExplorerContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useGraphModel.ts +18 -13
- package/src/index.ts +5 -3
- package/src/meta.ts +1 -1
- package/src/translations.ts +14 -13
- package/src/types/ExplorerAction.ts +0 -1
- package/src/types/Graph.ts +11 -24
- package/src/typings.d.ts +8 -0
- package/dist/lib/browser/ExplorerContainer-BFAWRIAJ.mjs +0 -45
- package/dist/lib/browser/ExplorerContainer-BFAWRIAJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-BZMTFAP3.mjs +0 -34
- package/dist/lib/browser/chunk-BZMTFAP3.mjs.map +0 -7
- package/dist/lib/browser/chunk-HIFLWHXR.mjs +0 -83
- package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +0 -7
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs +0 -177
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-RWVHQL3J.mjs +0 -35
- package/dist/lib/browser/react-surface-RWVHQL3J.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs +0 -46
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs +0 -84
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IPIGIQHX.mjs +0 -36
- package/dist/lib/node-esm/chunk-IPIGIQHX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs +0 -179
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-3REUS7KW.mjs +0 -36
- package/dist/lib/node-esm/react-surface-3REUS7KW.mjs.map +0 -7
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/components/ExplorerContainer.d.ts +0 -7
- package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -30
- package/src/components/ExplorerContainer.tsx +0 -52
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/meta.ts
|
|
2
2
|
import { trim } from "@dxos/util";
|
|
3
3
|
var meta = {
|
|
4
|
-
id: "dxos.
|
|
4
|
+
id: "org.dxos.plugin.explorer",
|
|
5
5
|
name: "Explorer",
|
|
6
6
|
description: trim`
|
|
7
7
|
Interactive hypergraph visualization that reveals relationships between objects in your workspace.
|
|
@@ -21,4 +21,4 @@ var meta = {
|
|
|
21
21
|
export {
|
|
22
22
|
meta
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-HPIS2WXY.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.
|
|
5
|
-
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.explorer',\n name: 'Explorer',\n description: trim`\n Interactive hypergraph visualization that reveals relationships between objects in your workspace.\n Navigate complex data structures and discover connections through a dynamic network view.\n `,\n icon: 'ph--graph--regular',\n iconHue: 'green',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-explorer',\n tags: ['labs'],\n screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],\n};\n"],
|
|
5
|
+
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaJ;;;;EAIbK,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "icon", "iconHue", "source", "tags", "screenshots"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
2
2
|
|
|
3
3
|
// src/components/Chart/Chart.tsx
|
|
4
4
|
import * as Plot from "@observablehq/plot";
|
|
@@ -10822,11 +10822,191 @@ var Globe = ({ items = [], accessor, projection = "orthographic", options = defa
|
|
|
10822
10822
|
});
|
|
10823
10823
|
};
|
|
10824
10824
|
|
|
10825
|
+
// src/components/Graph/D3ForceGraph.tsx
|
|
10826
|
+
import { Atom, useAtomValue } from "@effect-atom/atom-react";
|
|
10827
|
+
import React3, { useCallback, useEffect as useEffect3, useMemo, useRef } from "react";
|
|
10828
|
+
import { Obj } from "@dxos/echo";
|
|
10829
|
+
import { SelectionModel } from "@dxos/graph";
|
|
10830
|
+
import { GraphForceProjector, SVG } from "@dxos/react-ui-graph";
|
|
10831
|
+
import { composable, composableProps, getHashStyles } from "@dxos/ui-theme";
|
|
10832
|
+
import "@dxos/react-ui-graph/styles/graph.css";
|
|
10833
|
+
var EMPTY_ATOM = Atom.make({
|
|
10834
|
+
nodes: [],
|
|
10835
|
+
edges: []
|
|
10836
|
+
});
|
|
10837
|
+
var D3ForceGraph = composable(({ model, selection: _selection, grid, drag, ...props }, forwardedRef) => {
|
|
10838
|
+
useAtomValue(model?.graphAtom ?? EMPTY_ATOM);
|
|
10839
|
+
const svgRef = useRef(null);
|
|
10840
|
+
const projector = useMemo(() => {
|
|
10841
|
+
if (svgRef.current) {
|
|
10842
|
+
return new GraphForceProjector(svgRef.current, {
|
|
10843
|
+
attributes: {
|
|
10844
|
+
linkForce: (edge) => {
|
|
10845
|
+
return edge.data?.object?.active !== false;
|
|
10846
|
+
}
|
|
10847
|
+
},
|
|
10848
|
+
forces: {
|
|
10849
|
+
point: {
|
|
10850
|
+
strength: 0.01
|
|
10851
|
+
}
|
|
10852
|
+
}
|
|
10853
|
+
});
|
|
10854
|
+
}
|
|
10855
|
+
}, []);
|
|
10856
|
+
const graph = useRef(null);
|
|
10857
|
+
const selection = useMemo(() => _selection ?? new SelectionModel(), [
|
|
10858
|
+
_selection
|
|
10859
|
+
]);
|
|
10860
|
+
useEffect3(() => selection.subscribe(() => graph.current?.repaint()), [
|
|
10861
|
+
selection
|
|
10862
|
+
]);
|
|
10863
|
+
const handleSelect = useCallback((node) => {
|
|
10864
|
+
if (selection.contains(node.id)) {
|
|
10865
|
+
selection.remove(node.id);
|
|
10866
|
+
} else {
|
|
10867
|
+
selection.add(node.id);
|
|
10868
|
+
}
|
|
10869
|
+
}, [
|
|
10870
|
+
selection
|
|
10871
|
+
]);
|
|
10872
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
10873
|
+
...composableProps(props, {
|
|
10874
|
+
classNames: "dx-container"
|
|
10875
|
+
}),
|
|
10876
|
+
ref: forwardedRef
|
|
10877
|
+
}, /* @__PURE__ */ React3.createElement(SVG.Root, {
|
|
10878
|
+
ref: svgRef
|
|
10879
|
+
}, /* @__PURE__ */ React3.createElement(SVG.Markers, null), grid && /* @__PURE__ */ React3.createElement(SVG.Grid, {
|
|
10880
|
+
axis: true
|
|
10881
|
+
}), /* @__PURE__ */ React3.createElement(SVG.Zoom, {
|
|
10882
|
+
extent: [
|
|
10883
|
+
1 / 2,
|
|
10884
|
+
2
|
|
10885
|
+
]
|
|
10886
|
+
}, /* @__PURE__ */ React3.createElement(SVG.Graph, {
|
|
10887
|
+
drag,
|
|
10888
|
+
ref: graph,
|
|
10889
|
+
model,
|
|
10890
|
+
projector,
|
|
10891
|
+
labels: {
|
|
10892
|
+
text: (node) => {
|
|
10893
|
+
return node.data?.data.label ?? node.id;
|
|
10894
|
+
}
|
|
10895
|
+
},
|
|
10896
|
+
attributes: {
|
|
10897
|
+
node: (node) => {
|
|
10898
|
+
const obj = node.data?.data.object;
|
|
10899
|
+
return {
|
|
10900
|
+
data: {
|
|
10901
|
+
color: getHashStyles(obj && Obj.getTypename(obj))?.hue
|
|
10902
|
+
},
|
|
10903
|
+
classes: {
|
|
10904
|
+
"dx-selected": selection.contains(node.id)
|
|
10905
|
+
}
|
|
10906
|
+
};
|
|
10907
|
+
}
|
|
10908
|
+
},
|
|
10909
|
+
onSelect: handleSelect
|
|
10910
|
+
}))));
|
|
10911
|
+
});
|
|
10912
|
+
|
|
10913
|
+
// src/components/Graph/ForceGraph.tsx
|
|
10914
|
+
import { forceLink, forceManyBody } from "d3";
|
|
10915
|
+
import NativeForceGraph from "force-graph";
|
|
10916
|
+
import React4, { useEffect as useEffect4, useRef as useRef2, useState } from "react";
|
|
10917
|
+
import { useResizeDetector as useResizeDetector3 } from "react-resize-detector";
|
|
10918
|
+
import { filterObjectsSync } from "@dxos/plugin-search";
|
|
10919
|
+
|
|
10920
|
+
// src/components/Graph/adapter.ts
|
|
10921
|
+
var GraphAdapter = class {
|
|
10922
|
+
graph;
|
|
10923
|
+
_nodes = [];
|
|
10924
|
+
_links = [];
|
|
10925
|
+
constructor(graph) {
|
|
10926
|
+
this.graph = graph;
|
|
10927
|
+
this._nodes = graph.nodes.map((node) => ({
|
|
10928
|
+
id: node.id,
|
|
10929
|
+
type: node.type,
|
|
10930
|
+
data: node.data
|
|
10931
|
+
}));
|
|
10932
|
+
const nodeIds = new Set(this._nodes.map((node) => node.id));
|
|
10933
|
+
this._links = graph.edges.filter((edge) => nodeIds.has(edge.source) && nodeIds.has(edge.target)).map((edge) => ({
|
|
10934
|
+
type: edge.type,
|
|
10935
|
+
source: edge.source,
|
|
10936
|
+
target: edge.target,
|
|
10937
|
+
data: edge.data
|
|
10938
|
+
}));
|
|
10939
|
+
}
|
|
10940
|
+
get nodes() {
|
|
10941
|
+
return this._nodes;
|
|
10942
|
+
}
|
|
10943
|
+
get links() {
|
|
10944
|
+
return this._links;
|
|
10945
|
+
}
|
|
10946
|
+
};
|
|
10947
|
+
|
|
10948
|
+
// src/components/Graph/ForceGraph.tsx
|
|
10949
|
+
var ForceGraph = ({ model, match }) => {
|
|
10950
|
+
const { ref, width, height } = useResizeDetector3({
|
|
10951
|
+
refreshRate: 200
|
|
10952
|
+
});
|
|
10953
|
+
const rootRef = useRef2(null);
|
|
10954
|
+
const forceGraph = useRef2(null);
|
|
10955
|
+
const filteredRef = useRef2([]);
|
|
10956
|
+
filteredRef.current = filterObjectsSync(model?.objects ?? [], match);
|
|
10957
|
+
const [data, setData] = useState();
|
|
10958
|
+
useEffect4(() => {
|
|
10959
|
+
return model?.subscribe((model2) => {
|
|
10960
|
+
setData(new GraphAdapter(model2.graph));
|
|
10961
|
+
});
|
|
10962
|
+
}, [
|
|
10963
|
+
model
|
|
10964
|
+
]);
|
|
10965
|
+
useEffect4(() => {
|
|
10966
|
+
if (rootRef.current) {
|
|
10967
|
+
forceGraph.current = new NativeForceGraph(rootRef.current).nodeRelSize(6).nodeLabel((node) => node.type === "schema" ? node.data.typename : node.data.label ?? node.id).nodeAutoColorBy((node) => node.type === "schema" ? "schema" : node.data.typename).linkAutoColorBy((link2) => link2.type);
|
|
10968
|
+
}
|
|
10969
|
+
return () => {
|
|
10970
|
+
forceGraph.current?.pauseAnimation().graphData({
|
|
10971
|
+
nodes: [],
|
|
10972
|
+
links: []
|
|
10973
|
+
});
|
|
10974
|
+
forceGraph.current = null;
|
|
10975
|
+
};
|
|
10976
|
+
}, []);
|
|
10977
|
+
useEffect4(() => {
|
|
10978
|
+
if (!data || !width || !height || !forceGraph.current) {
|
|
10979
|
+
return;
|
|
10980
|
+
}
|
|
10981
|
+
forceGraph.current.pauseAnimation().width(width).height(height).onEngineStop(() => {
|
|
10982
|
+
handleZoomToFit();
|
|
10983
|
+
}).onNodeClick((node) => {
|
|
10984
|
+
forceGraph.current?.emitParticle(node);
|
|
10985
|
+
}).d3Force("link", forceLink().distance(160).strength(0.5)).d3Force("charge", forceManyBody().strength(-30)).graphData(data).warmupTicks(100).cooldownTime(1e3).resumeAnimation();
|
|
10986
|
+
}, [
|
|
10987
|
+
data,
|
|
10988
|
+
width,
|
|
10989
|
+
height,
|
|
10990
|
+
forceGraph.current
|
|
10991
|
+
]);
|
|
10992
|
+
const handleZoomToFit = () => {
|
|
10993
|
+
forceGraph.current?.zoomToFit(400, 40);
|
|
10994
|
+
};
|
|
10995
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
10996
|
+
ref,
|
|
10997
|
+
className: "relative grow",
|
|
10998
|
+
onClick: handleZoomToFit
|
|
10999
|
+
}, /* @__PURE__ */ React4.createElement("div", {
|
|
11000
|
+
ref: rootRef,
|
|
11001
|
+
className: "absolute inset-0"
|
|
11002
|
+
}));
|
|
11003
|
+
};
|
|
11004
|
+
|
|
10825
11005
|
// src/components/Tree/Tree.tsx
|
|
10826
11006
|
import { RegistryContext } from "@effect-atom/atom-react";
|
|
10827
|
-
import
|
|
11007
|
+
import React5, { useContext, useEffect as useEffect5, useRef as useRef3, useState as useState2 } from "react";
|
|
10828
11008
|
import { useAsyncState } from "@dxos/react-ui";
|
|
10829
|
-
import { SVG } from "@dxos/react-ui-graph";
|
|
11009
|
+
import { SVG as SVG2 } from "@dxos/react-ui-graph";
|
|
10830
11010
|
import { SpaceGraphModel } from "@dxos/schema";
|
|
10831
11011
|
|
|
10832
11012
|
// src/components/Tree/layout/HierarchicalEdgeBundling.ts
|
|
@@ -10964,7 +11144,7 @@ var TidyTree_default = TidyTree;
|
|
|
10964
11144
|
|
|
10965
11145
|
// src/components/Tree/types/tree.ts
|
|
10966
11146
|
import * as Schema from "effect/Schema";
|
|
10967
|
-
import { Key, Obj, Type } from "@dxos/echo";
|
|
11147
|
+
import { Key, Obj as Obj2, Ref, Type } from "@dxos/echo";
|
|
10968
11148
|
import { TestSchema } from "@dxos/echo/testing";
|
|
10969
11149
|
import { invariant } from "@dxos/invariant";
|
|
10970
11150
|
var TreeNodeType = Schema.Struct({
|
|
@@ -10974,7 +11154,7 @@ var TreeNodeType = Schema.Struct({
|
|
|
10974
11154
|
key: Schema.String,
|
|
10975
11155
|
value: Schema.Any
|
|
10976
11156
|
})),
|
|
10977
|
-
ref: Schema.optional(
|
|
11157
|
+
ref: Schema.optional(Ref.Ref(TestSchema.Expando))
|
|
10978
11158
|
}).pipe(Schema.mutable);
|
|
10979
11159
|
var TreeType = Schema.Struct({
|
|
10980
11160
|
root: Key.ObjectId,
|
|
@@ -10983,7 +11163,7 @@ var TreeType = Schema.Struct({
|
|
|
10983
11163
|
value: TreeNodeType
|
|
10984
11164
|
}))
|
|
10985
11165
|
}).pipe(Type.object({
|
|
10986
|
-
typename: "dxos.
|
|
11166
|
+
typename: "org.dxos.type.tree",
|
|
10987
11167
|
version: "0.1.0"
|
|
10988
11168
|
}));
|
|
10989
11169
|
|
|
@@ -11020,8 +11200,8 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11020
11200
|
selected,
|
|
11021
11201
|
registry
|
|
11022
11202
|
]);
|
|
11023
|
-
const [tree3, setTree] =
|
|
11024
|
-
|
|
11203
|
+
const [tree3, setTree] = useState2();
|
|
11204
|
+
useEffect5(() => {
|
|
11025
11205
|
return model?.subscribe(() => {
|
|
11026
11206
|
const tree4 = mapGraphToTreeData(model);
|
|
11027
11207
|
setTree(tree4);
|
|
@@ -11029,8 +11209,8 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11029
11209
|
}, [
|
|
11030
11210
|
model
|
|
11031
11211
|
]);
|
|
11032
|
-
const context =
|
|
11033
|
-
|
|
11212
|
+
const context = useRef3(null);
|
|
11213
|
+
useEffect5(() => {
|
|
11034
11214
|
if (context.current?.size) {
|
|
11035
11215
|
const { width, height } = context.current.size;
|
|
11036
11216
|
const size = Math.min(width, height);
|
|
@@ -11056,23 +11236,19 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11056
11236
|
context.current,
|
|
11057
11237
|
tree3
|
|
11058
11238
|
]);
|
|
11059
|
-
return /* @__PURE__ */
|
|
11239
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
11060
11240
|
className: "grow",
|
|
11061
11241
|
onClick: () => onNodeClick?.()
|
|
11062
|
-
}, /* @__PURE__ */
|
|
11242
|
+
}, /* @__PURE__ */ React5.createElement(SVG2.Root, {
|
|
11063
11243
|
ref: context
|
|
11064
11244
|
}));
|
|
11065
11245
|
};
|
|
11066
|
-
|
|
11067
|
-
// src/components/index.ts
|
|
11068
|
-
import { lazy } from "react";
|
|
11069
|
-
var ExplorerContainer = lazy(() => import("./ExplorerContainer-YQ2KKBVS.mjs"));
|
|
11070
|
-
|
|
11071
11246
|
export {
|
|
11072
11247
|
Chart,
|
|
11248
|
+
D3ForceGraph,
|
|
11249
|
+
ForceGraph,
|
|
11073
11250
|
Globe,
|
|
11074
|
-
defaultTreeLayoutSlots,
|
|
11075
11251
|
Tree,
|
|
11076
|
-
|
|
11252
|
+
defaultTreeLayoutSlots
|
|
11077
11253
|
};
|
|
11078
|
-
//# sourceMappingURL=
|
|
11254
|
+
//# sourceMappingURL=index.mjs.map
|