@dxos/plugin-explorer 0.8.4-main.1068cf700f → 0.8.4-main.1c7ec43d41
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/browser/{chunk-JZSBQYJQ.mjs → components/index.mjs} +217 -19
- package/dist/lib/{node-esm/chunk-K5BYG7BW.mjs.map → browser/components/index.mjs.map} +4 -4
- package/dist/lib/browser/{chunk-KIXHZZ2C.mjs → hooks/index.mjs} +18 -13
- package/dist/lib/browser/hooks/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +4 -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/node-esm/{chunk-K5BYG7BW.mjs → components/index.mjs} +216 -19
- package/dist/lib/{browser/chunk-JZSBQYJQ.mjs.map → node-esm/components/index.mjs.map} +4 -4
- package/dist/lib/node-esm/{chunk-ASRWO2N5.mjs → hooks/index.mjs} +17 -13
- package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +4 -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/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 +8 -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 +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/CanvasForceGraph.stories.d.ts +17 -0
- 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 +4 -2
- 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/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 +5 -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 +7 -24
- package/src/capabilities/create-object.ts +36 -0
- package/src/capabilities/index.ts +4 -1
- package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +10 -9
- package/src/components/Chart/Chart.stories.tsx +15 -22
- package/src/components/Globe/Globe.stories.tsx +18 -21
- package/src/components/Graph/CanvasForceGraph.stories.tsx +83 -0
- package/src/components/Graph/CanvasForceGraph.tsx +124 -0
- package/src/components/Graph/ForceGraph.stories.tsx +76 -44
- package/src/components/Graph/ForceGraph.tsx +104 -85
- package/src/components/Graph/index.ts +1 -1
- package/src/components/Tree/Tree.stories.tsx +44 -37
- 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/{components → containers/ExplorerContainer}/ExplorerContainer.tsx +18 -19
- package/src/containers/ExplorerContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useGraphModel.ts +14 -10
- 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-46BHUF6R.mjs +0 -45
- package/dist/lib/browser/ExplorerContainer-46BHUF6R.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-KIXHZZ2C.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-TPQAT5EI.mjs +0 -36
- package/dist/lib/browser/react-surface-TPQAT5EI.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs +0 -46
- package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.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-ASRWO2N5.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-CYHGJJDU.mjs +0 -37
- package/dist/lib/node-esm/react-surface-CYHGJJDU.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/dist/types/src/components/Graph/D3ForceGraph.d.ts +0 -14
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +0 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +0 -15
- 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/src/capabilities/react-surface/index.ts +0 -7
- package/src/components/Graph/D3ForceGraph.stories.tsx +0 -83
- package/src/components/Graph/D3ForceGraph.tsx +0 -101
- /package/src/components/Graph/{adapter.ts → graph-adapter.ts} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import "../chunk-HSLMI22Q.mjs";
|
|
2
3
|
|
|
3
4
|
// src/components/Chart/Chart.tsx
|
|
4
5
|
import * as Plot from "@observablehq/plot";
|
|
@@ -10822,11 +10823,211 @@ var Globe = ({ items = [], accessor, projection = "orthographic", options = defa
|
|
|
10822
10823
|
});
|
|
10823
10824
|
};
|
|
10824
10825
|
|
|
10826
|
+
// src/components/Graph/CanvasForceGraph.tsx
|
|
10827
|
+
import { forceLink, forceManyBody } from "d3";
|
|
10828
|
+
import NativeForceGraph from "force-graph";
|
|
10829
|
+
import React3, { useCallback, useEffect as useEffect3, useRef, useState } from "react";
|
|
10830
|
+
import { useResizeDetector as useResizeDetector3 } from "react-resize-detector";
|
|
10831
|
+
import { composable, composableProps } from "@dxos/ui-theme";
|
|
10832
|
+
|
|
10833
|
+
// src/components/Graph/graph-adapter.ts
|
|
10834
|
+
var GraphAdapter = class {
|
|
10835
|
+
graph;
|
|
10836
|
+
_nodes = [];
|
|
10837
|
+
_links = [];
|
|
10838
|
+
constructor(graph) {
|
|
10839
|
+
this.graph = graph;
|
|
10840
|
+
this._nodes = graph.nodes.map((node) => ({
|
|
10841
|
+
id: node.id,
|
|
10842
|
+
type: node.type,
|
|
10843
|
+
data: node.data
|
|
10844
|
+
}));
|
|
10845
|
+
const nodeIds = new Set(this._nodes.map((node) => node.id));
|
|
10846
|
+
this._links = graph.edges.filter((edge) => nodeIds.has(edge.source) && nodeIds.has(edge.target)).map((edge) => ({
|
|
10847
|
+
type: edge.type,
|
|
10848
|
+
source: edge.source,
|
|
10849
|
+
target: edge.target,
|
|
10850
|
+
data: edge.data
|
|
10851
|
+
}));
|
|
10852
|
+
}
|
|
10853
|
+
get nodes() {
|
|
10854
|
+
return this._nodes;
|
|
10855
|
+
}
|
|
10856
|
+
get links() {
|
|
10857
|
+
return this._links;
|
|
10858
|
+
}
|
|
10859
|
+
};
|
|
10860
|
+
|
|
10861
|
+
// src/components/Graph/CanvasForceGraph.tsx
|
|
10862
|
+
var CanvasForceGraph = composable(({ model, match, onClick, ...props }, forwardedRef) => {
|
|
10863
|
+
const { ref: resizeRef, width, height } = useResizeDetector3({
|
|
10864
|
+
refreshRate: 200
|
|
10865
|
+
});
|
|
10866
|
+
const setRef = useCallback((node) => {
|
|
10867
|
+
resizeRef(node);
|
|
10868
|
+
assignRef(forwardedRef, node);
|
|
10869
|
+
}, [
|
|
10870
|
+
resizeRef,
|
|
10871
|
+
forwardedRef
|
|
10872
|
+
]);
|
|
10873
|
+
const rootRef = useRef(null);
|
|
10874
|
+
const forceGraph = useRef(null);
|
|
10875
|
+
const [data, setData] = useState();
|
|
10876
|
+
useEffect3(() => {
|
|
10877
|
+
return model?.subscribe((model2) => setData(new GraphAdapter(model2.graph)));
|
|
10878
|
+
}, [
|
|
10879
|
+
model
|
|
10880
|
+
]);
|
|
10881
|
+
useEffect3(() => {
|
|
10882
|
+
if (rootRef.current) {
|
|
10883
|
+
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);
|
|
10884
|
+
}
|
|
10885
|
+
return () => {
|
|
10886
|
+
forceGraph.current?.pauseAnimation().graphData({
|
|
10887
|
+
nodes: [],
|
|
10888
|
+
links: []
|
|
10889
|
+
});
|
|
10890
|
+
forceGraph.current = null;
|
|
10891
|
+
};
|
|
10892
|
+
}, []);
|
|
10893
|
+
useEffect3(() => {
|
|
10894
|
+
if (!data || !width || !height || !forceGraph.current) {
|
|
10895
|
+
return;
|
|
10896
|
+
}
|
|
10897
|
+
forceGraph.current.pauseAnimation().width(width).height(height).onEngineStop(() => handleZoomToFit()).onNodeClick((node) => {
|
|
10898
|
+
forceGraph.current?.emitParticle(node);
|
|
10899
|
+
}).d3Force("link", forceLink().distance(160).strength(0.5)).d3Force("charge", forceManyBody().strength(-30)).graphData(data).warmupTicks(100).cooldownTime(1e3).resumeAnimation();
|
|
10900
|
+
}, [
|
|
10901
|
+
data,
|
|
10902
|
+
width,
|
|
10903
|
+
height
|
|
10904
|
+
]);
|
|
10905
|
+
const handleZoomToFit = () => {
|
|
10906
|
+
forceGraph.current?.zoomToFit(400, 40);
|
|
10907
|
+
};
|
|
10908
|
+
const handleClick = useCallback((event) => {
|
|
10909
|
+
onClick?.(event);
|
|
10910
|
+
if (!event.defaultPrevented) {
|
|
10911
|
+
handleZoomToFit();
|
|
10912
|
+
}
|
|
10913
|
+
}, [
|
|
10914
|
+
onClick
|
|
10915
|
+
]);
|
|
10916
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
10917
|
+
...composableProps(props, {
|
|
10918
|
+
classNames: "relative grow"
|
|
10919
|
+
}),
|
|
10920
|
+
onClick: handleClick,
|
|
10921
|
+
ref: setRef
|
|
10922
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
10923
|
+
ref: rootRef,
|
|
10924
|
+
className: "absolute inset-0"
|
|
10925
|
+
}));
|
|
10926
|
+
});
|
|
10927
|
+
var assignRef = (ref, value) => {
|
|
10928
|
+
if (typeof ref === "function") {
|
|
10929
|
+
ref(value);
|
|
10930
|
+
} else if (ref) {
|
|
10931
|
+
ref.current = value;
|
|
10932
|
+
}
|
|
10933
|
+
};
|
|
10934
|
+
|
|
10935
|
+
// src/components/Graph/ForceGraph.tsx
|
|
10936
|
+
import { Atom, useAtomValue } from "@effect-atom/atom-react";
|
|
10937
|
+
import React4, { useCallback as useCallback2, useEffect as useEffect4, useMemo, useRef as useRef2, useState as useState2 } from "react";
|
|
10938
|
+
import { Obj } from "@dxos/echo";
|
|
10939
|
+
import { SelectionModel } from "@dxos/graph";
|
|
10940
|
+
import { GraphForceProjector, SVG } from "@dxos/react-ui-graph";
|
|
10941
|
+
import { composable as composable2, composableProps as composableProps2, getHashStyles } from "@dxos/ui-theme";
|
|
10942
|
+
import "@dxos/react-ui-graph/styles/graph.css";
|
|
10943
|
+
var EMPTY_ATOM = Atom.make({
|
|
10944
|
+
nodes: [],
|
|
10945
|
+
edges: []
|
|
10946
|
+
});
|
|
10947
|
+
var ForceGraph = composable2(({ model, selection: selectionProp, grid, drag, onInspect, ...props }, forwardedRef) => {
|
|
10948
|
+
useAtomValue(model?.graphAtom ?? EMPTY_ATOM);
|
|
10949
|
+
const graph = useRef2(null);
|
|
10950
|
+
const selection = useMemo(() => selectionProp ?? new SelectionModel(), [
|
|
10951
|
+
selectionProp
|
|
10952
|
+
]);
|
|
10953
|
+
useEffect4(() => {
|
|
10954
|
+
const unsubscribe = selection.subscribe(() => graph.current?.repaint());
|
|
10955
|
+
return unsubscribe;
|
|
10956
|
+
}, [
|
|
10957
|
+
selection
|
|
10958
|
+
]);
|
|
10959
|
+
const svgRef = useRef2(null);
|
|
10960
|
+
const [projector, setProjector] = useState2();
|
|
10961
|
+
useEffect4(() => {
|
|
10962
|
+
if (svgRef.current) {
|
|
10963
|
+
setProjector(new GraphForceProjector(svgRef.current, {
|
|
10964
|
+
attributes: {
|
|
10965
|
+
// TODO(burdon): Check type (currently assumes Employee property).
|
|
10966
|
+
// Edge shouldn't contribute to force if it's not active.
|
|
10967
|
+
linkForce: (edge) => edge.data?.object?.active !== false
|
|
10968
|
+
},
|
|
10969
|
+
forces: {
|
|
10970
|
+
point: {
|
|
10971
|
+
strength: 0.01
|
|
10972
|
+
}
|
|
10973
|
+
}
|
|
10974
|
+
}));
|
|
10975
|
+
}
|
|
10976
|
+
}, []);
|
|
10977
|
+
const handleSelect = useCallback2((node) => {
|
|
10978
|
+
if (selection.contains(node.id)) {
|
|
10979
|
+
selection.remove(node.id);
|
|
10980
|
+
} else {
|
|
10981
|
+
selection.add(node.id);
|
|
10982
|
+
}
|
|
10983
|
+
}, [
|
|
10984
|
+
selection
|
|
10985
|
+
]);
|
|
10986
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
10987
|
+
...composableProps2(props, {
|
|
10988
|
+
classNames: "dx-container"
|
|
10989
|
+
}),
|
|
10990
|
+
ref: forwardedRef
|
|
10991
|
+
}, /* @__PURE__ */ React4.createElement(SVG.Root, {
|
|
10992
|
+
ref: svgRef
|
|
10993
|
+
}, /* @__PURE__ */ React4.createElement(SVG.Markers, null), grid && /* @__PURE__ */ React4.createElement(SVG.Grid, {
|
|
10994
|
+
axis: true
|
|
10995
|
+
}), /* @__PURE__ */ React4.createElement(SVG.Zoom, {
|
|
10996
|
+
extent: [
|
|
10997
|
+
1 / 2,
|
|
10998
|
+
2
|
|
10999
|
+
]
|
|
11000
|
+
}, /* @__PURE__ */ React4.createElement(SVG.Graph, {
|
|
11001
|
+
drag,
|
|
11002
|
+
ref: graph,
|
|
11003
|
+
model,
|
|
11004
|
+
projector,
|
|
11005
|
+
labels: {
|
|
11006
|
+
text: (node) => node.data?.data.label ?? node.id
|
|
11007
|
+
},
|
|
11008
|
+
attributes: {
|
|
11009
|
+
node: (node) => {
|
|
11010
|
+
const obj = node.data?.data.object;
|
|
11011
|
+
return {
|
|
11012
|
+
data: {
|
|
11013
|
+
color: getHashStyles(obj && Obj.getTypename(obj))?.hue
|
|
11014
|
+
},
|
|
11015
|
+
classes: {
|
|
11016
|
+
"dx-selected": selection.contains(node.id)
|
|
11017
|
+
}
|
|
11018
|
+
};
|
|
11019
|
+
}
|
|
11020
|
+
},
|
|
11021
|
+
onSelect: handleSelect,
|
|
11022
|
+
onInspect
|
|
11023
|
+
}))));
|
|
11024
|
+
});
|
|
11025
|
+
|
|
10825
11026
|
// src/components/Tree/Tree.tsx
|
|
10826
11027
|
import { RegistryContext } from "@effect-atom/atom-react";
|
|
10827
|
-
import
|
|
11028
|
+
import React5, { useContext, useEffect as useEffect5, useRef as useRef3, useState as useState3 } from "react";
|
|
10828
11029
|
import { useAsyncState } from "@dxos/react-ui";
|
|
10829
|
-
import { SVG } from "@dxos/react-ui-graph";
|
|
11030
|
+
import { SVG as SVG2 } from "@dxos/react-ui-graph";
|
|
10830
11031
|
import { SpaceGraphModel } from "@dxos/schema";
|
|
10831
11032
|
|
|
10832
11033
|
// src/components/Tree/layout/HierarchicalEdgeBundling.ts
|
|
@@ -10964,7 +11165,7 @@ var TidyTree_default = TidyTree;
|
|
|
10964
11165
|
|
|
10965
11166
|
// src/components/Tree/types/tree.ts
|
|
10966
11167
|
import * as Schema from "effect/Schema";
|
|
10967
|
-
import { Key, Obj, Type } from "@dxos/echo";
|
|
11168
|
+
import { Key, Obj as Obj2, Ref, Type } from "@dxos/echo";
|
|
10968
11169
|
import { TestSchema } from "@dxos/echo/testing";
|
|
10969
11170
|
import { invariant } from "@dxos/invariant";
|
|
10970
11171
|
var TreeNodeType = Schema.Struct({
|
|
@@ -10974,7 +11175,7 @@ var TreeNodeType = Schema.Struct({
|
|
|
10974
11175
|
key: Schema.String,
|
|
10975
11176
|
value: Schema.Any
|
|
10976
11177
|
})),
|
|
10977
|
-
ref: Schema.optional(
|
|
11178
|
+
ref: Schema.optional(Ref.Ref(TestSchema.Expando))
|
|
10978
11179
|
}).pipe(Schema.mutable);
|
|
10979
11180
|
var TreeType = Schema.Struct({
|
|
10980
11181
|
root: Key.ObjectId,
|
|
@@ -10983,7 +11184,7 @@ var TreeType = Schema.Struct({
|
|
|
10983
11184
|
value: TreeNodeType
|
|
10984
11185
|
}))
|
|
10985
11186
|
}).pipe(Type.object({
|
|
10986
|
-
typename: "dxos.
|
|
11187
|
+
typename: "org.dxos.type.tree",
|
|
10987
11188
|
version: "0.1.0"
|
|
10988
11189
|
}));
|
|
10989
11190
|
|
|
@@ -11020,8 +11221,8 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11020
11221
|
selected,
|
|
11021
11222
|
registry
|
|
11022
11223
|
]);
|
|
11023
|
-
const [tree3, setTree] =
|
|
11024
|
-
|
|
11224
|
+
const [tree3, setTree] = useState3();
|
|
11225
|
+
useEffect5(() => {
|
|
11025
11226
|
return model?.subscribe(() => {
|
|
11026
11227
|
const tree4 = mapGraphToTreeData(model);
|
|
11027
11228
|
setTree(tree4);
|
|
@@ -11029,8 +11230,8 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11029
11230
|
}, [
|
|
11030
11231
|
model
|
|
11031
11232
|
]);
|
|
11032
|
-
const context =
|
|
11033
|
-
|
|
11233
|
+
const context = useRef3(null);
|
|
11234
|
+
useEffect5(() => {
|
|
11034
11235
|
if (context.current?.size) {
|
|
11035
11236
|
const { width, height } = context.current.size;
|
|
11036
11237
|
const size = Math.min(width, height);
|
|
@@ -11056,23 +11257,19 @@ var Tree = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11056
11257
|
context.current,
|
|
11057
11258
|
tree3
|
|
11058
11259
|
]);
|
|
11059
|
-
return /* @__PURE__ */
|
|
11260
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
11060
11261
|
className: "grow",
|
|
11061
11262
|
onClick: () => onNodeClick?.()
|
|
11062
|
-
}, /* @__PURE__ */
|
|
11263
|
+
}, /* @__PURE__ */ React5.createElement(SVG2.Root, {
|
|
11063
11264
|
ref: context
|
|
11064
11265
|
}));
|
|
11065
11266
|
};
|
|
11066
|
-
|
|
11067
|
-
// src/components/index.ts
|
|
11068
|
-
import { lazy } from "react";
|
|
11069
|
-
var ExplorerContainer = lazy(() => import("./ExplorerContainer-OZNG47QB.mjs"));
|
|
11070
|
-
|
|
11071
11267
|
export {
|
|
11268
|
+
CanvasForceGraph,
|
|
11072
11269
|
Chart,
|
|
11270
|
+
ForceGraph,
|
|
11073
11271
|
Globe,
|
|
11074
|
-
defaultTreeLayoutSlots,
|
|
11075
11272
|
Tree,
|
|
11076
|
-
|
|
11273
|
+
defaultTreeLayoutSlots
|
|
11077
11274
|
};
|
|
11078
|
-
//# sourceMappingURL=
|
|
11275
|
+
//# sourceMappingURL=index.mjs.map
|