@dxos/plugin-explorer 0.8.3 → 0.8.4-main.1da679c
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-DXL34I3F.mjs → ExplorerContainer-7MTDS2TQ.mjs} +4 -4
- package/dist/lib/browser/{ExplorerContainer-DXL34I3F.mjs.map → ExplorerContainer-7MTDS2TQ.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-SLB2F5AO.mjs → chunk-2MKBRIUT.mjs} +7 -6
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-Z5BGAHLD.mjs → chunk-3YITRGGW.mjs} +27 -11
- package/dist/lib/browser/{chunk-Z5BGAHLD.mjs.map → chunk-3YITRGGW.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-73YTQHOT.mjs → chunk-CZZ3DDR7.mjs} +4 -4
- package/dist/lib/browser/{chunk-73YTQHOT.mjs.map → chunk-CZZ3DDR7.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-OBAFAA5V.mjs → chunk-UL5EDJPE.mjs} +2 -2
- package/dist/lib/browser/{chunk-JRKQNHS6.mjs → chunk-VNOGW2JS.mjs} +49 -37
- package/dist/lib/browser/{chunk-JRKQNHS6.mjs.map → chunk-VNOGW2JS.mjs.map} +3 -3
- package/dist/lib/browser/index.mjs +19 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-RGPYMKAU.mjs +24 -0
- package/dist/lib/browser/{intent-resolver-JZKYVFQJ.mjs.map → intent-resolver-RGPYMKAU.mjs.map} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/{react-surface-IAEP2GBT.mjs → react-surface-6MSROCJS.mjs} +8 -8
- package/dist/lib/browser/{react-surface-IAEP2GBT.mjs.map → react-surface-6MSROCJS.mjs.map} +1 -1
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/node-esm/{ExplorerContainer-MFE7PXF4.mjs → ExplorerContainer-OBSRVHZZ.mjs} +4 -4
- package/dist/lib/node-esm/{ExplorerContainer-MFE7PXF4.mjs.map → ExplorerContainer-OBSRVHZZ.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-VSORIAHH.mjs → chunk-3ODK27PU.mjs} +7 -6
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-N6VEANUZ.mjs → chunk-4GWDNZ4Z.mjs} +4 -4
- package/dist/lib/node-esm/{chunk-N6VEANUZ.mjs.map → chunk-4GWDNZ4Z.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-AE7VHUJM.mjs → chunk-GFYXDQQV.mjs} +27 -11
- package/dist/lib/node-esm/{chunk-AE7VHUJM.mjs.map → chunk-GFYXDQQV.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-IUFYOE44.mjs → chunk-ODMJ7DPA.mjs} +49 -37
- package/dist/lib/node-esm/{chunk-IUFYOE44.mjs.map → chunk-ODMJ7DPA.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-3CMBLK6W.mjs → chunk-PIAXA43R.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +19 -18
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-7G6ZKM6E.mjs → intent-resolver-LTIB6F2Q.mjs} +7 -7
- package/dist/lib/node-esm/{intent-resolver-7G6ZKM6E.mjs.map → intent-resolver-LTIB6F2Q.mjs.map} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/{react-surface-XBH3WZDL.mjs → react-surface-ZEM4IXFU.mjs} +8 -8
- package/dist/lib/node-esm/{react-surface-XBH3WZDL.mjs.map → react-surface-ZEM4IXFU.mjs.map} +1 -1
- package/dist/lib/node-esm/types/index.mjs +2 -2
- package/dist/types/src/capabilities/index.d.ts +2 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts +5 -3
- package/dist/types/src/components/Chart/Chart.stories.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/Globe/Globe.stories.d.ts +5 -3
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +17 -3
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +10 -3
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/testing.d.ts +1 -1
- package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts +13 -15
- package/dist/types/src/components/Tree/Tree.stories.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/translations.d.ts +16 -23
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +41 -31
- package/src/ExplorerPlugin.tsx +3 -3
- package/src/capabilities/intent-resolver.ts +1 -1
- package/src/components/Chart/Chart.stories.tsx +5 -4
- package/src/components/Chart/Chart.tsx +1 -1
- package/src/components/ExplorerContainer.tsx +2 -1
- package/src/components/Globe/Globe.stories.tsx +10 -9
- package/src/components/Globe/Globe.tsx +1 -1
- package/src/components/Graph/D3ForceGraph.stories.tsx +10 -7
- package/src/components/Graph/D3ForceGraph.tsx +1 -1
- package/src/components/Graph/ForceGraph.stories.tsx +10 -7
- package/src/components/Graph/ForceGraph.tsx +2 -2
- package/src/components/Graph/testing.ts +2 -2
- package/src/components/Tree/Tree.stories.tsx +27 -19
- package/src/components/Tree/Tree.tsx +1 -1
- package/src/components/Tree/types/tree.test.ts +4 -3
- package/src/hooks/useGraphModel.ts +5 -4
- package/src/translations.ts +8 -6
- package/src/types/types.ts +2 -1
- package/dist/lib/browser/chunk-SLB2F5AO.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-JZKYVFQJ.mjs +0 -24
- package/dist/lib/node/ExplorerContainer-VUXH55VV.cjs +0 -61
- package/dist/lib/node/ExplorerContainer-VUXH55VV.cjs.map +0 -7
- package/dist/lib/node/chunk-4T4LCT5R.cjs +0 -52
- package/dist/lib/node/chunk-4T4LCT5R.cjs.map +0 -7
- package/dist/lib/node/chunk-BCDVG2CH.cjs +0 -44
- package/dist/lib/node/chunk-BCDVG2CH.cjs.map +0 -7
- package/dist/lib/node/chunk-MLRYW4WQ.cjs +0 -56
- package/dist/lib/node/chunk-MLRYW4WQ.cjs.map +0 -7
- package/dist/lib/node/chunk-SVU4VMYX.cjs +0 -11339
- package/dist/lib/node/chunk-SVU4VMYX.cjs.map +0 -7
- package/dist/lib/node/chunk-TY543HPV.cjs +0 -214
- package/dist/lib/node/chunk-TY543HPV.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -130
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-G2MFNIXA.cjs +0 -39
- package/dist/lib/node/intent-resolver-G2MFNIXA.cjs.map +0 -7
- package/dist/lib/node/meta.cjs +0 -31
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-UJD5RGRZ.cjs +0 -53
- package/dist/lib/node/react-surface-UJD5RGRZ.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -32
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-VSORIAHH.mjs.map +0 -7
- /package/dist/lib/browser/{chunk-OBAFAA5V.mjs.map → chunk-UL5EDJPE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-3CMBLK6W.mjs.map → chunk-PIAXA43R.mjs.map} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useGraphModel
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2MKBRIUT.mjs";
|
|
4
4
|
import {
|
|
5
5
|
D3ForceGraph
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3YITRGGW.mjs";
|
|
7
7
|
|
|
8
|
-
//
|
|
8
|
+
// src/components/ExplorerContainer.tsx
|
|
9
9
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
10
10
|
import React from "react";
|
|
11
11
|
import { useGlobalSearch } from "@dxos/plugin-search";
|
|
@@ -34,4 +34,4 @@ var ExplorerContainer_default = ExplorerContainer;
|
|
|
34
34
|
export {
|
|
35
35
|
ExplorerContainer_default as default
|
|
36
36
|
};
|
|
37
|
-
//# sourceMappingURL=ExplorerContainer-
|
|
37
|
+
//# sourceMappingURL=ExplorerContainer-7MTDS2TQ.mjs.map
|
package/dist/lib/browser/{ExplorerContainer-DXL34I3F.mjs.map → ExplorerContainer-7MTDS2TQ.mjs.map}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/ExplorerContainer.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { StackItem } from '@dxos/react-ui-stack';\n\nimport { useGraphModel } from '../hooks';\nimport { type ViewType } from '../types';\n\nimport { D3ForceGraph } from './Graph';\n\ntype ExplorerContainerProps = {\n role: string;\n view: ViewType;\n};\n\nconst ExplorerContainer = ({ role, view }: ExplorerContainerProps) => {\n const space = getSpace(view);\n const model = useGraphModel(space);\n const { match } = useGlobalSearch();\n\n if (!space || !model) {\n return null;\n }\n\n return (\n <StackItem.Content size={role === 'section' ? 'square' : 'intrinsic'}>\n <D3ForceGraph model={model} match={match} />\n </StackItem.Content>\n );\n};\n\nexport default ExplorerContainer;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AACzB,SAASC,iBAAiB;AAY1B,IAAMC,oBAAoB,CAAC,EAAEC,MAAMC,KAAI,MAA0B;;;AAC/D,UAAMC,QAAQC,SAASF,IAAAA;AACvB,UAAMG,QAAQC,cAAcH,KAAAA;AAC5B,UAAM,EAAEI,MAAK,IAAKC,gBAAAA;AAElB,QAAI,CAACL,SAAS,CAACE,OAAO;AACpB,aAAO;IACT;AAEA,WACE,sBAAA,cAACI,UAAUC,SAAO;MAACC,MAAMV,SAAS,YAAY,WAAW;OACvD,sBAAA,cAACW,cAAAA;MAAaP;MAAcE;;;;;AAGlC;AAEA,IAAA,4BAAeP;",
|
|
6
6
|
"names": ["React", "useGlobalSearch", "getSpace", "StackItem", "ExplorerContainer", "role", "view", "space", "getSpace", "model", "useGraphModel", "match", "useGlobalSearch", "StackItem", "Content", "size", "D3ForceGraph"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/hooks/useGraphModel.ts
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { SpaceGraphModel } from "@dxos/schema";
|
|
4
|
-
var useGraphModel = (space, filter, options) => {
|
|
4
|
+
var useGraphModel = (space, filter, options, queue) => {
|
|
5
5
|
const [model, setModel] = useState(void 0);
|
|
6
6
|
useEffect(() => {
|
|
7
7
|
if (!space) {
|
|
@@ -9,9 +9,9 @@ var useGraphModel = (space, filter, options) => {
|
|
|
9
9
|
setModel(void 0);
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
if (!model) {
|
|
12
|
+
if (!model || model.queue !== queue) {
|
|
13
13
|
const model2 = new SpaceGraphModel().setFilter(filter).setOptions(options);
|
|
14
|
-
void model2.open(space);
|
|
14
|
+
void model2.open(space, queue);
|
|
15
15
|
setModel(model2);
|
|
16
16
|
} else {
|
|
17
17
|
model.setFilter(filter).setOptions(options);
|
|
@@ -19,7 +19,8 @@ var useGraphModel = (space, filter, options) => {
|
|
|
19
19
|
}, [
|
|
20
20
|
space,
|
|
21
21
|
filter,
|
|
22
|
-
options
|
|
22
|
+
options,
|
|
23
|
+
queue
|
|
23
24
|
]);
|
|
24
25
|
return model;
|
|
25
26
|
};
|
|
@@ -27,4 +28,4 @@ var useGraphModel = (space, filter, options) => {
|
|
|
27
28
|
export {
|
|
28
29
|
useGraphModel
|
|
29
30
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
31
|
+
//# sourceMappingURL=chunk-2MKBRIUT.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useGraphModel.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { type Filter, type Queue, type Space } from '@dxos/client/echo';\nimport { SpaceGraphModel, type SpaceGraphModelOptions } from '@dxos/schema';\n\n// TODO(burdon): Factor out.\nexport const useGraphModel = (\n space: Space | undefined,\n filter?: Filter.Any | undefined,\n options?: SpaceGraphModelOptions,\n queue?: Queue,\n): SpaceGraphModel | undefined => {\n const [model, setModel] = useState<SpaceGraphModel | undefined>(undefined);\n useEffect(() => {\n if (!space) {\n void model?.close();\n setModel(undefined);\n return;\n }\n\n // TODO(burdon): Does this need to be a dependency?\n if (!model || model.queue !== queue) {\n const model = new SpaceGraphModel().setFilter(filter).setOptions(options);\n void model.open(space, queue);\n setModel(model);\n } else {\n model.setFilter(filter).setOptions(options);\n }\n }, [space, filter, options, queue]);\n\n return model;\n};\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,WAAWC,gBAAgB;AAGpC,SAASC,uBAAoD;AAGtD,IAAMC,gBAAgB,CAC3BC,OACAC,QACAC,SACAC,UAAAA;AAEA,QAAM,CAACC,OAAOC,QAAAA,IAAYC,SAAsCC,MAAAA;AAChEC,YAAU,MAAA;AACR,QAAI,CAACR,OAAO;AACV,WAAKI,OAAOK,MAAAA;AACZJ,eAASE,MAAAA;AACT;IACF;AAGA,QAAI,CAACH,SAASA,MAAMD,UAAUA,OAAO;AACnC,YAAMC,SAAQ,IAAIM,gBAAAA,EAAkBC,UAAUV,MAAAA,EAAQW,WAAWV,OAAAA;AACjE,WAAKE,OAAMS,KAAKb,OAAOG,KAAAA;AACvBE,eAASD,MAAAA;IACX,OAAO;AACLA,YAAMO,UAAUV,MAAAA,EAAQW,WAAWV,OAAAA;IACrC;EACF,GAAG;IAACF;IAAOC;IAAQC;IAASC;GAAM;AAElC,SAAOC;AACT;",
|
|
6
|
+
"names": ["useEffect", "useState", "SpaceGraphModel", "useGraphModel", "space", "filter", "options", "queue", "model", "setModel", "useState", "undefined", "useEffect", "close", "SpaceGraphModel", "setFilter", "setOptions", "open"]
|
|
7
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/components/Graph/D3ForceGraph.tsx
|
|
2
2
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
4
4
|
import { Obj } from "@dxos/echo";
|
|
@@ -84,7 +84,7 @@ var D3ForceGraph = ({ classNames, model, selection: _selection, grid, ...props }
|
|
|
84
84
|
}
|
|
85
85
|
};
|
|
86
86
|
|
|
87
|
-
//
|
|
87
|
+
// src/components/Graph/ForceGraph.tsx
|
|
88
88
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
89
89
|
import { forceLink, forceManyBody } from "d3";
|
|
90
90
|
import NativeForceGraph from "force-graph";
|
|
@@ -92,9 +92,31 @@ import React2, { useEffect as useEffect2, useRef as useRef2, useState } from "re
|
|
|
92
92
|
import { useResizeDetector } from "react-resize-detector";
|
|
93
93
|
import { filterObjectsSync } from "@dxos/plugin-search";
|
|
94
94
|
|
|
95
|
-
//
|
|
95
|
+
// src/components/Graph/adapter.ts
|
|
96
|
+
function _define_property(obj, key, value) {
|
|
97
|
+
if (key in obj) {
|
|
98
|
+
Object.defineProperty(obj, key, {
|
|
99
|
+
value,
|
|
100
|
+
enumerable: true,
|
|
101
|
+
configurable: true,
|
|
102
|
+
writable: true
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
obj[key] = value;
|
|
106
|
+
}
|
|
107
|
+
return obj;
|
|
108
|
+
}
|
|
96
109
|
var GraphAdapter = class {
|
|
110
|
+
get nodes() {
|
|
111
|
+
return this._nodes;
|
|
112
|
+
}
|
|
113
|
+
get links() {
|
|
114
|
+
return this._links;
|
|
115
|
+
}
|
|
97
116
|
constructor(graph) {
|
|
117
|
+
_define_property(this, "graph", void 0);
|
|
118
|
+
_define_property(this, "_nodes", void 0);
|
|
119
|
+
_define_property(this, "_links", void 0);
|
|
98
120
|
this.graph = graph;
|
|
99
121
|
this._nodes = [];
|
|
100
122
|
this._links = [];
|
|
@@ -110,15 +132,9 @@ var GraphAdapter = class {
|
|
|
110
132
|
data: edge.data
|
|
111
133
|
}));
|
|
112
134
|
}
|
|
113
|
-
get nodes() {
|
|
114
|
-
return this._nodes;
|
|
115
|
-
}
|
|
116
|
-
get links() {
|
|
117
|
-
return this._links;
|
|
118
|
-
}
|
|
119
135
|
};
|
|
120
136
|
|
|
121
|
-
//
|
|
137
|
+
// src/components/Graph/ForceGraph.tsx
|
|
122
138
|
var ForceGraph = ({ model, match }) => {
|
|
123
139
|
var _effect = _useSignals2();
|
|
124
140
|
try {
|
|
@@ -184,4 +200,4 @@ export {
|
|
|
184
200
|
D3ForceGraph,
|
|
185
201
|
ForceGraph
|
|
186
202
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
203
|
+
//# sourceMappingURL=chunk-3YITRGGW.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/Graph/D3ForceGraph.tsx", "../../../src/components/Graph/ForceGraph.tsx", "../../../src/components/Graph/adapter.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { SelectionModel } from '@dxos/graph';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport {\n type GraphController,\n GraphForceProjector,\n type GraphLayoutNode,\n type GraphProps,\n SVG,\n type SVGContext,\n} from '@dxos/react-ui-graph';\nimport { getHashColor } from '@dxos/react-ui-theme';\nimport { type
|
|
5
|
-
"mappings": ";;AAIA,OAAOA,SAAkBC,aAAaC,WAAWC,SAASC,cAAc;AAExE,SAASC,WAAW;AACpB,SAASC,sBAAsB;AAE/B,SAEEC,qBAGAC,WAEK;AACP,SAASC,oBAAoB;AAG7B,OAAO;AAWA,IAAMC,eAAsC,CAAC,EAAEC,YAAYC,OAAOC,WAAWC,YAAYC,MAAM,GAAGC,MAAAA,MAAO;;;AAC9G,UAAMC,UAAUC,OAAmB,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YAAYJ,GAAAA,CAAAA,GAAOC;YACpD;YACAI,SAAS;cACP,eAAejD,UAAU4B,SAASD,KAAKE,EAAE;YAC3C;UACF;QACF;MACF;MACAqB,UAAUzB;;;;;AAKpB;;;;AChGA,SAAS0B,WAAWC,qBAAqB;AACzC,OAAOC,sBAAsB;AAC7B,OAAOC,UAAkBC,aAAAA,YAAWC,UAAAA,SAAQC,gBAAgB;AAC5D,SAASC,yBAAyB;AAElC,
|
|
6
|
-
"names": ["React", "useCallback", "useEffect", "useMemo", "useRef", "Obj", "SelectionModel", "GraphForceProjector", "SVG", "getHashColor", "D3ForceGraph", "classNames", "model", "selection", "_selection", "grid", "props", "context", "useRef", "projector", "useMemo", "current", "GraphForceProjector", "attributes", "linkForce", "edge", "data", "object", "active", "forces", "point", "strength", "graph", "SelectionModel", "useEffect", "repaint", "selected", "value", "handleSelect", "useCallback", "node", "contains", "id", "remove", "add", "SVG", "Root", "ref", "Markers", "Grid", "axis", "Zoom", "extent", "Graph", "labels", "text", "label", "obj", "color", "getHashColor", "Obj", "getTypename", "classes", "onSelect", "forceLink", "forceManyBody", "NativeForceGraph", "React", "useEffect", "useRef", "useState", "useResizeDetector", "filterObjectsSync", "GraphAdapter", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { type FC, useCallback, useEffect, useMemo, useRef } from 'react';\n\nimport { Obj } from '@dxos/echo';\nimport { SelectionModel } from '@dxos/graph';\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport {\n type GraphController,\n GraphForceProjector,\n type GraphLayoutNode,\n type GraphProps,\n SVG,\n type SVGContext,\n} from '@dxos/react-ui-graph';\nimport { getHashColor } from '@dxos/react-ui-theme';\nimport { type SpaceGraphEdge, type SpaceGraphModel, type SpaceGraphNode } from '@dxos/schema';\n\nimport '@dxos/react-ui-graph/styles/graph.css';\n\nexport type D3ForceGraphProps = ThemedClassName<\n {\n model?: SpaceGraphModel;\n match?: RegExp;\n selection?: SelectionModel;\n grid?: boolean;\n } & Pick<GraphProps, 'drag'>\n>;\n\nexport const D3ForceGraph: FC<D3ForceGraphProps> = ({ classNames, model, selection: _selection, grid, ...props }) => {\n const context = useRef<SVGContext>(null);\n const projector = useMemo<GraphForceProjector | undefined>(() => {\n if (context.current) {\n return new GraphForceProjector(context.current, {\n attributes: {\n linkForce: (edge) => {\n // TODO(burdon): Check type (currently assumes Employee property).\n // Edge shouldn't contribute to force if it's not active.\n return edge.data?.object?.active !== false;\n },\n },\n forces: {\n point: {\n strength: 0.01,\n },\n },\n });\n }\n }, [context.current]);\n\n const graph = useRef<GraphController>(null);\n const selection = useMemo(() => _selection ?? new SelectionModel(), [_selection]);\n useEffect(() => graph.current?.repaint(), [selection.selected.value]);\n\n const handleSelect = useCallback<NonNullable<GraphProps['onSelect']>>(\n (node) => {\n if (selection.contains(node.id)) {\n selection.remove(node.id);\n } else {\n selection.add(node.id);\n }\n },\n [selection],\n );\n\n return (\n <SVG.Root ref={context} classNames={classNames}>\n <SVG.Markers />\n {grid && <SVG.Grid axis />}\n <SVG.Zoom extent={[1 / 2, 2]}>\n <SVG.Graph<SpaceGraphNode, SpaceGraphEdge>\n {...props}\n ref={graph}\n model={model}\n projector={projector}\n labels={{\n text: (node) => {\n return node.data?.data.label ?? node.id;\n },\n }}\n attributes={{\n node: (node: GraphLayoutNode<SpaceGraphNode>) => {\n const obj = node.data?.data.object;\n return {\n data: {\n color: getHashColor(obj && Obj.getTypename(obj))?.color,\n },\n classes: {\n 'dx-selected': selection.contains(node.id),\n },\n };\n },\n }}\n onSelect={handleSelect}\n />\n </SVG.Zoom>\n </SVG.Root>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { forceLink, forceManyBody } from 'd3';\nimport NativeForceGraph from 'force-graph';\nimport React, { type FC, useEffect, useRef, useState } from 'react';\nimport { useResizeDetector } from 'react-resize-detector';\n\nimport { type SearchResult, filterObjectsSync } from '@dxos/plugin-search';\nimport { type SpaceGraphModel } from '@dxos/schema';\n\nimport { GraphAdapter } from './adapter';\n\nexport type ForceGraphProps = {\n model?: SpaceGraphModel;\n match?: RegExp;\n};\n\nexport const ForceGraph: FC<ForceGraphProps> = ({ model, match }) => {\n const { ref, width, height } = useResizeDetector({ refreshRate: 200 });\n const rootRef = useRef<HTMLDivElement>(null);\n const forceGraph = useRef<NativeForceGraph>();\n\n const filteredRef = useRef<SearchResult[]>();\n filteredRef.current = filterObjectsSync(model?.objects ?? [], match);\n\n const [data, setData] = useState<GraphAdapter>();\n useEffect(() => {\n return model?.subscribe((model) => {\n setData(new GraphAdapter(model.graph));\n });\n }, [model]);\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 NativeForceGraph(rootRef.current)\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#node-styling\n .nodeRelSize(6)\n .nodeLabel((node: any) => (node.type === 'schema' ? node.data.typename : (node.data.label ?? node.id)))\n .nodeAutoColorBy((node: any) => (node.type === 'schema' ? 'schema' : node.data.typename))\n\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#link-styling\n .linkAutoColorBy((link: any) => link.type);\n }\n\n return () => {\n forceGraph.current?.pauseAnimation().graphData({ nodes: [], links: [] });\n forceGraph.current = undefined;\n };\n }, []);\n\n useEffect(() => {\n if (!data || !width || !height || !forceGraph.current) {\n return;\n }\n\n // https://github.com/vasturiano/force-graph?tab=readme-ov-file#container-layout\n forceGraph.current\n .pauseAnimation()\n .width(width)\n .height(height)\n .onEngineStop(() => {\n handleZoomToFit();\n })\n .onNodeClick((node: any) => {\n forceGraph.current?.emitParticle(node);\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\n .graphData(data)\n .warmupTicks(100)\n .cooldownTime(1_000)\n .resumeAnimation();\n }, [data, width, height, forceGraph.current]);\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", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Graph } from '@dxos/graph';\n\nexport type GraphNode = {\n id?: string;\n};\n\nexport type GraphLink = {\n source?: string;\n target?: string;\n};\n\nexport type GraphData = {\n nodes: GraphNode[];\n links: GraphLink[];\n};\n\n/**\n * Map common graph to force-graph format.\n */\nexport class GraphAdapter implements GraphData {\n private readonly _nodes: GraphNode[] = [];\n private readonly _links: GraphLink[] = [];\n\n constructor(private readonly graph: Graph) {\n this._nodes = graph.nodes.map((node) => ({\n id: node.id,\n type: node.type,\n data: node.data,\n }));\n\n this._links = graph.edges.map((edge) => ({\n type: edge.type,\n source: edge.source,\n target: edge.target,\n data: edge.data,\n }));\n }\n\n get nodes() {\n return this._nodes;\n }\n\n get links() {\n return this._links;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;AAIA,OAAOA,SAAkBC,aAAaC,WAAWC,SAASC,cAAc;AAExE,SAASC,WAAW;AACpB,SAASC,sBAAsB;AAE/B,SAEEC,qBAGAC,WAEK;AACP,SAASC,oBAAoB;AAG7B,OAAO;AAWA,IAAMC,eAAsC,CAAC,EAAEC,YAAYC,OAAOC,WAAWC,YAAYC,MAAM,GAAGC,MAAAA,MAAO;;;AAC9G,UAAMC,UAAUC,OAAmB,IAAA;AACnC,UAAMC,YAAYC,QAAyC,MAAA;AACzD,UAAIH,QAAQI,SAAS;AACnB,eAAO,IAAIC,oBAAoBL,QAAQI,SAAS;UAC9CE,YAAY;YACVC,WAAW,CAACC,SAAAA;AAGV,qBAAOA,KAAKC,MAAMC,QAAQC,WAAW;YACvC;UACF;UACAC,QAAQ;YACNC,OAAO;cACLC,UAAU;YACZ;UACF;QACF,CAAA;MACF;IACF,GAAG;MAACd,QAAQI;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AS,WAAWD,KAAKV,KAAKY,WAAYF,KAAKV,KAAKa,SAASH,KAAKI,EAAE,EACnGC,gBAAgB,CAACL,SAAeA,KAAKC,SAAS,WAAW,WAAWD,KAAKV,KAAKY,QAAQ,EAGtFI,gBAAgB,CAACC,SAAcA,KAAKN,IAAI;MAC7C;AAEA,aAAO,MAAA;AACLhB,mBAAWE,SAASqB,eAAAA,EAAiBC,UAAU;UAAEC,OAAO,CAAA;UAAIC,OAAO,CAAA;QAAG,CAAA;AACtE1B,mBAAWE,UAAUyB;MACvB;IACF,GAAG,CAAA,CAAE;AAELnB,IAAAA,WAAU,MAAA;AACR,UAAI,CAACH,QAAQ,CAACX,SAAS,CAACC,UAAU,CAACK,WAAWE,SAAS;AACrD;MACF;AAGAF,iBAAWE,QACRqB,eAAc,EACd7B,MAAMA,KAAAA,EACNC,OAAOA,MAAAA,EACPiC,aAAa,MAAA;AACZC,wBAAAA;MACF,CAAA,EACCC,YAAY,CAACf,SAAAA;AACZf,mBAAWE,SAAS6B,aAAahB,IAAAA;MACnC,CAAA,EAICiB,QAAQ,QAAQC,UAAAA,EAAYC,SAAS,GAAA,EAAKC,SAAS,GAAA,CAAA,EACnDH,QAAQ,UAAUI,cAAAA,EAAgBD,SAAS,GAAC,CAAA,EAE5CX,UAAUnB,IAAAA,EACVgC,YAAY,GAAA,EACZC,aAAa,GAAA,EACbC,gBAAe;IACpB,GAAG;MAAClC;MAAMX;MAAOC;MAAQK,WAAWE;KAAQ;AAE5C,UAAM2B,kBAAkB,MAAA;AACtB7B,iBAAWE,SAASsC,UAAU,KAAK,EAAA;IACrC;AAEA,WACE,gBAAAC,OAAA,cAACC,OAAAA;MAAIjD;MAAUkD,WAAU;MAAgBC,SAASf;OAChD,gBAAAY,OAAA,cAACC,OAAAA;MAAIjD,KAAKK;MAAS6C,WAAU;;;;;AAGnC;",
|
|
6
|
+
"names": ["React", "useCallback", "useEffect", "useMemo", "useRef", "Obj", "SelectionModel", "GraphForceProjector", "SVG", "getHashColor", "D3ForceGraph", "classNames", "model", "selection", "_selection", "grid", "props", "context", "useRef", "projector", "useMemo", "current", "GraphForceProjector", "attributes", "linkForce", "edge", "data", "object", "active", "forces", "point", "strength", "graph", "SelectionModel", "useEffect", "repaint", "selected", "value", "handleSelect", "useCallback", "node", "contains", "id", "remove", "add", "SVG", "Root", "ref", "Markers", "Grid", "axis", "Zoom", "extent", "Graph", "labels", "text", "label", "obj", "color", "getHashColor", "Obj", "getTypename", "classes", "onSelect", "forceLink", "forceManyBody", "NativeForceGraph", "React", "useEffect", "useRef", "useState", "useResizeDetector", "filterObjectsSync", "GraphAdapter", "nodes", "_nodes", "links", "_links", "graph", "map", "node", "id", "type", "data", "edges", "edge", "source", "target", "ForceGraph", "model", "match", "ref", "width", "height", "useResizeDetector", "refreshRate", "rootRef", "useRef", "forceGraph", "filteredRef", "current", "filterObjectsSync", "objects", "data", "setData", "useState", "useEffect", "subscribe", "GraphAdapter", "graph", "NativeForceGraph", "nodeRelSize", "nodeLabel", "node", "type", "typename", "label", "id", "nodeAutoColorBy", "linkAutoColorBy", "link", "pauseAnimation", "graphData", "nodes", "links", "undefined", "onEngineStop", "handleZoomToFit", "onNodeClick", "emitParticle", "d3Force", "forceLink", "distance", "strength", "forceManyBody", "warmupTicks", "cooldownTime", "resumeAnimation", "zoomToFit", "React", "div", "className", "onClick"]
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EXPLORER_PLUGIN
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-UL5EDJPE.mjs";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// src/types/schema.ts
|
|
6
6
|
import { Schema } from "effect";
|
|
7
7
|
import { TypedObject } from "@dxos/echo-schema";
|
|
8
8
|
var ViewType = class extends TypedObject({
|
|
@@ -14,7 +14,7 @@ var ViewType = class extends TypedObject({
|
|
|
14
14
|
}) {
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
//
|
|
17
|
+
// src/types/types.ts
|
|
18
18
|
import { Schema as Schema2 } from "effect";
|
|
19
19
|
(function(ExplorerAction2) {
|
|
20
20
|
const EXPLORER_ACTION = `${EXPLORER_PLUGIN}/action`;
|
|
@@ -35,4 +35,4 @@ export {
|
|
|
35
35
|
ViewType,
|
|
36
36
|
ExplorerAction
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=chunk-
|
|
38
|
+
//# sourceMappingURL=chunk-CZZ3DDR7.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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 {
|
|
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;
|
|
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 { EXPLORER_PLUGIN } from '../meta';\n\nimport { ViewType } from './schema';\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;UAMNC,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
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
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/meta.ts
|
|
2
2
|
var EXPLORER_PLUGIN = "dxos.org/plugin/explorer";
|
|
3
3
|
var meta = {
|
|
4
4
|
id: EXPLORER_PLUGIN,
|
|
@@ -18,4 +18,4 @@ export {
|
|
|
18
18
|
EXPLORER_PLUGIN,
|
|
19
19
|
meta
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-UL5EDJPE.mjs.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/components/Chart/Chart.tsx
|
|
2
2
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
3
|
import * as Plot from "@observablehq/plot";
|
|
4
4
|
import React, { useEffect } from "react";
|
|
5
5
|
import { useResizeDetector } from "react-resize-detector";
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// src/components/plot.ts
|
|
8
8
|
var createAdapter = (prop, accessor) => accessor ? {
|
|
9
9
|
transform: (values) => values.map((value) => accessor(value)[prop])
|
|
10
10
|
} : prop;
|
|
11
11
|
|
|
12
|
-
//
|
|
12
|
+
// src/components/Chart/Chart.tsx
|
|
13
13
|
var defaultOptions = {
|
|
14
14
|
r: 4,
|
|
15
15
|
stroke: "gray",
|
|
@@ -58,14 +58,14 @@ var Chart = ({ items = [], accessor, options = defaultOptions }) => {
|
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
//
|
|
61
|
+
// src/components/Globe/Globe.tsx
|
|
62
62
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
63
63
|
import * as Plot2 from "@observablehq/plot";
|
|
64
64
|
import React2, { useEffect as useEffect2 } from "react";
|
|
65
65
|
import { useResizeDetector as useResizeDetector2 } from "react-resize-detector";
|
|
66
66
|
import * as topojson from "topojson-client";
|
|
67
67
|
|
|
68
|
-
//
|
|
68
|
+
// data/countries-110m.js
|
|
69
69
|
var countries_110m_default = {
|
|
70
70
|
type: "Topology",
|
|
71
71
|
objects: {
|
|
@@ -10767,7 +10767,7 @@ var countries_110m_default = {
|
|
|
10767
10767
|
}
|
|
10768
10768
|
};
|
|
10769
10769
|
|
|
10770
|
-
//
|
|
10770
|
+
// src/components/Globe/Globe.tsx
|
|
10771
10771
|
var defaultOptions2 = {
|
|
10772
10772
|
r: 4,
|
|
10773
10773
|
fill: "#003300"
|
|
@@ -10832,14 +10832,14 @@ var Globe = ({ items = [], accessor, projection = "orthographic", options = defa
|
|
|
10832
10832
|
}
|
|
10833
10833
|
};
|
|
10834
10834
|
|
|
10835
|
-
//
|
|
10835
|
+
// src/components/Tree/Tree.tsx
|
|
10836
10836
|
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
10837
10837
|
import React3, { useEffect as useEffect3, useRef, useState } from "react";
|
|
10838
10838
|
import { useAsyncState } from "@dxos/react-ui";
|
|
10839
10839
|
import { SVG } from "@dxos/react-ui-graph";
|
|
10840
10840
|
import { SpaceGraphModel } from "@dxos/schema";
|
|
10841
10841
|
|
|
10842
|
-
//
|
|
10842
|
+
// src/components/Tree/layout/HierarchicalEdgeBundling.ts
|
|
10843
10843
|
import { cluster, curveBundle, hierarchy, lineRadial, select } from "d3";
|
|
10844
10844
|
var HierarchicalEdgeBundling = (s, data, options) => {
|
|
10845
10845
|
const svg = select(s);
|
|
@@ -10902,7 +10902,7 @@ var flatten = (node) => {
|
|
|
10902
10902
|
};
|
|
10903
10903
|
var HierarchicalEdgeBundling_default = HierarchicalEdgeBundling;
|
|
10904
10904
|
|
|
10905
|
-
//
|
|
10905
|
+
// src/components/Tree/layout/RadialTree.ts
|
|
10906
10906
|
import { hierarchy as hierarchy2, linkRadial, select as select2, tree } from "d3";
|
|
10907
10907
|
var RadialTree = (s, data, options) => {
|
|
10908
10908
|
const svg = select2(s);
|
|
@@ -10927,7 +10927,7 @@ var RadialTree = (s, data, options) => {
|
|
|
10927
10927
|
};
|
|
10928
10928
|
var RadialTree_default = RadialTree;
|
|
10929
10929
|
|
|
10930
|
-
//
|
|
10930
|
+
// src/components/Tree/layout/TidyTree.ts
|
|
10931
10931
|
import { curveBumpX, hierarchy as hierarchy3, link, select as select3, tree as tree2 } from "d3";
|
|
10932
10932
|
var TidyTree = (s, data, options) => {
|
|
10933
10933
|
const svg = select3(s);
|
|
@@ -10972,11 +10972,24 @@ var TidyTree = (s, data, options) => {
|
|
|
10972
10972
|
};
|
|
10973
10973
|
var TidyTree_default = TidyTree;
|
|
10974
10974
|
|
|
10975
|
-
//
|
|
10975
|
+
// src/components/Tree/types/tree.ts
|
|
10976
10976
|
import { Schema } from "effect";
|
|
10977
10977
|
import { Key, Obj, Type } from "@dxos/echo";
|
|
10978
10978
|
import { invariant } from "@dxos/invariant";
|
|
10979
|
-
|
|
10979
|
+
function _define_property(obj, key, value) {
|
|
10980
|
+
if (key in obj) {
|
|
10981
|
+
Object.defineProperty(obj, key, {
|
|
10982
|
+
value,
|
|
10983
|
+
enumerable: true,
|
|
10984
|
+
configurable: true,
|
|
10985
|
+
writable: true
|
|
10986
|
+
});
|
|
10987
|
+
} else {
|
|
10988
|
+
obj[key] = value;
|
|
10989
|
+
}
|
|
10990
|
+
return obj;
|
|
10991
|
+
}
|
|
10992
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-explorer/src/components/Tree/types/tree.ts";
|
|
10980
10993
|
var TreeNodeType = Schema.Struct({
|
|
10981
10994
|
id: Key.ObjectId,
|
|
10982
10995
|
children: Schema.mutable(Schema.Array(Key.ObjectId)),
|
|
@@ -10997,26 +11010,6 @@ var TreeType = Schema.Struct({
|
|
|
10997
11010
|
version: "0.1.0"
|
|
10998
11011
|
}));
|
|
10999
11012
|
var Tree = class _Tree {
|
|
11000
|
-
static {
|
|
11001
|
-
this.create = () => {
|
|
11002
|
-
const id = Key.ObjectId.random();
|
|
11003
|
-
return Obj.make(TreeType, {
|
|
11004
|
-
root: id,
|
|
11005
|
-
nodes: {
|
|
11006
|
-
[id]: {
|
|
11007
|
-
id,
|
|
11008
|
-
children: [],
|
|
11009
|
-
data: {
|
|
11010
|
-
text: ""
|
|
11011
|
-
}
|
|
11012
|
-
}
|
|
11013
|
-
}
|
|
11014
|
-
});
|
|
11015
|
-
};
|
|
11016
|
-
}
|
|
11017
|
-
constructor(tree3) {
|
|
11018
|
-
this._tree = tree3 ?? _Tree.create();
|
|
11019
|
-
}
|
|
11020
11013
|
get tree() {
|
|
11021
11014
|
return this._tree;
|
|
11022
11015
|
}
|
|
@@ -11234,15 +11227,34 @@ var Tree = class _Tree {
|
|
|
11234
11227
|
ancestor.children.splice(parentIdx + 1, 0, node.id);
|
|
11235
11228
|
node.children.push(...rest);
|
|
11236
11229
|
}
|
|
11230
|
+
constructor(tree3) {
|
|
11231
|
+
_define_property(this, "_tree", void 0);
|
|
11232
|
+
this._tree = tree3 ?? _Tree.create();
|
|
11233
|
+
}
|
|
11237
11234
|
};
|
|
11235
|
+
_define_property(Tree, "create", () => {
|
|
11236
|
+
const id = Key.ObjectId.random();
|
|
11237
|
+
return Obj.make(TreeType, {
|
|
11238
|
+
root: id,
|
|
11239
|
+
nodes: {
|
|
11240
|
+
[id]: {
|
|
11241
|
+
id,
|
|
11242
|
+
children: [],
|
|
11243
|
+
data: {
|
|
11244
|
+
text: ""
|
|
11245
|
+
}
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
});
|
|
11249
|
+
});
|
|
11238
11250
|
|
|
11239
|
-
//
|
|
11251
|
+
// src/components/Tree/types/types.ts
|
|
11240
11252
|
var mapGraphToTreeData = (model, maxDepth = 8) => {
|
|
11241
11253
|
let data;
|
|
11242
11254
|
return data;
|
|
11243
11255
|
};
|
|
11244
11256
|
|
|
11245
|
-
//
|
|
11257
|
+
// src/components/Tree/Tree.tsx
|
|
11246
11258
|
var defaultTreeLayoutSlots = {
|
|
11247
11259
|
node: "fill-blue-600",
|
|
11248
11260
|
path: "fill-none stroke-blue-400 stroke-[0.5px]",
|
|
@@ -11315,9 +11327,9 @@ var Tree2 = ({ space, selected, variant = "tidy", onNodeClick }) => {
|
|
|
11315
11327
|
}
|
|
11316
11328
|
};
|
|
11317
11329
|
|
|
11318
|
-
//
|
|
11330
|
+
// src/components/index.ts
|
|
11319
11331
|
import { lazy } from "react";
|
|
11320
|
-
var ExplorerContainer = lazy(() => import("./ExplorerContainer-
|
|
11332
|
+
var ExplorerContainer = lazy(() => import("./ExplorerContainer-7MTDS2TQ.mjs"));
|
|
11321
11333
|
|
|
11322
11334
|
export {
|
|
11323
11335
|
Chart,
|
|
@@ -11326,4 +11338,4 @@ export {
|
|
|
11326
11338
|
Tree2 as Tree,
|
|
11327
11339
|
ExplorerContainer
|
|
11328
11340
|
};
|
|
11329
|
-
//# sourceMappingURL=chunk-
|
|
11341
|
+
//# sourceMappingURL=chunk-VNOGW2JS.mjs.map
|