@dxos/plugin-explorer 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-BFAWRIAJ.mjs +45 -0
- package/dist/lib/browser/ExplorerContainer-BFAWRIAJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-CRN65FY3.mjs → chunk-AGZAGILW.mjs} +135 -148
- package/dist/lib/{node-esm/chunk-RSZFBKZM.mjs.map → browser/chunk-AGZAGILW.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-2MKBRIUT.mjs → chunk-BZMTFAP3.mjs} +8 -5
- package/dist/lib/browser/chunk-BZMTFAP3.mjs.map +7 -0
- package/dist/lib/browser/chunk-HIFLWHXR.mjs +83 -0
- package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +7 -0
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs +177 -0
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UBHZGWZQ.mjs → chunk-YNQF4CPY.mjs} +1 -1
- package/dist/lib/browser/chunk-YNQF4CPY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +46 -65
- 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/react-surface-RWVHQL3J.mjs +35 -0
- package/dist/lib/browser/react-surface-RWVHQL3J.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -2
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs +46 -0
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs +84 -0
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UXZM5VJB.mjs → chunk-DK77RB6M.mjs} +1 -1
- package/dist/lib/node-esm/chunk-DK77RB6M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3ODK27PU.mjs → chunk-IPIGIQHX.mjs} +8 -5
- package/dist/lib/node-esm/chunk-IPIGIQHX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RSZFBKZM.mjs → chunk-QLMTN2XI.mjs} +135 -148
- package/dist/lib/{browser/chunk-CRN65FY3.mjs.map → node-esm/chunk-QLMTN2XI.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs +179 -0
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +46 -65
- 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/react-surface-3REUS7KW.mjs +36 -0
- package/dist/lib/node-esm/react-surface-3REUS7KW.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -2
- package/dist/types/src/ExplorerPlugin.d.ts +2 -1
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/ExplorerContainer.d.ts +4 -6
- package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/adapter.d.ts +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/testing/generator.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +17 -15
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts +1 -1
- package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -4
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +17 -10
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/ExplorerAction.d.ts +1 -18
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
- package/dist/types/src/types/Graph.d.ts +21 -24
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +52 -47
- package/src/ExplorerPlugin.tsx +27 -52
- package/src/capabilities/index.ts +1 -4
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +30 -0
- package/src/components/Chart/Chart.stories.tsx +2 -2
- package/src/components/ExplorerContainer.tsx +7 -9
- package/src/components/Globe/Globe.stories.tsx +2 -2
- package/src/components/Graph/D3ForceGraph.stories.tsx +19 -13
- package/src/components/Graph/D3ForceGraph.tsx +2 -2
- package/src/components/Graph/ForceGraph.stories.tsx +19 -13
- package/src/components/Graph/adapter.ts +14 -8
- package/src/components/Graph/testing.ts +11 -8
- package/src/components/Tree/Tree.stories.tsx +3 -2
- package/src/components/Tree/Tree.tsx +8 -3
- package/src/components/Tree/testing/generator.ts +4 -2
- package/src/components/Tree/types/tree.test.ts +5 -3
- package/src/components/Tree/types/tree.ts +39 -18
- package/src/components/Tree/types/types.ts +1 -1
- package/src/components/index.ts +3 -3
- package/src/hooks/useGraphModel.ts +6 -4
- package/src/meta.ts +2 -2
- package/src/translations.ts +3 -1
- package/src/types/ExplorerAction.ts +11 -19
- package/src/types/Graph.ts +38 -21
- package/dist/lib/browser/ExplorerContainer-L5RVUJRL.mjs +0 -50
- package/dist/lib/browser/ExplorerContainer-L5RVUJRL.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
- package/dist/lib/browser/chunk-6BVXZQPP.mjs +0 -188
- package/dist/lib/browser/chunk-6BVXZQPP.mjs.map +0 -7
- package/dist/lib/browser/chunk-BGNRYZUN.mjs +0 -79
- package/dist/lib/browser/chunk-BGNRYZUN.mjs.map +0 -7
- package/dist/lib/browser/chunk-UBHZGWZQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-FX5H52QN.mjs +0 -31
- package/dist/lib/browser/intent-resolver-FX5H52QN.mjs.map +0 -7
- package/dist/lib/browser/react-surface-VS3ZFL2Y.mjs +0 -35
- package/dist/lib/browser/react-surface-VS3ZFL2Y.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-BBLPHH7K.mjs +0 -51
- package/dist/lib/node-esm/ExplorerContainer-BBLPHH7K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CRSVAZNA.mjs +0 -190
- package/dist/lib/node-esm/chunk-CRSVAZNA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TQESRBUJ.mjs +0 -80
- package/dist/lib/node-esm/chunk-TQESRBUJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UXZM5VJB.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-RGBBXXYM.mjs +0 -32
- package/dist/lib/node-esm/intent-resolver-RGBBXXYM.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-SXPT2T37.mjs +0 -36
- package/dist/lib/node-esm/react-surface-SXPT2T37.mjs.map +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -21
- package/src/capabilities/react-surface.tsx +0 -27
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// src/components/Graph/D3ForceGraph.tsx
|
|
4
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
5
|
-
import React, { useCallback, useEffect, useMemo, useRef } from "react";
|
|
6
|
-
import { Obj } from "@dxos/echo";
|
|
7
|
-
import { SelectionModel } from "@dxos/graph";
|
|
8
|
-
import { GraphForceProjector, SVG } from "@dxos/react-ui-graph";
|
|
9
|
-
import { getHashStyles } from "@dxos/react-ui-theme";
|
|
10
|
-
import "@dxos/react-ui-graph/styles/graph.css";
|
|
11
|
-
var D3ForceGraph = ({ classNames, model, selection: _selection, grid, ...props }) => {
|
|
12
|
-
var _effect = _useSignals();
|
|
13
|
-
try {
|
|
14
|
-
const context = useRef(null);
|
|
15
|
-
const projector = useMemo(() => {
|
|
16
|
-
if (context.current) {
|
|
17
|
-
return new GraphForceProjector(context.current, {
|
|
18
|
-
attributes: {
|
|
19
|
-
linkForce: (edge) => {
|
|
20
|
-
return edge.data?.object?.active !== false;
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
forces: {
|
|
24
|
-
point: {
|
|
25
|
-
strength: 0.01
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}, [
|
|
31
|
-
context.current
|
|
32
|
-
]);
|
|
33
|
-
const graph = useRef(null);
|
|
34
|
-
const selection = useMemo(() => _selection ?? new SelectionModel(), [
|
|
35
|
-
_selection
|
|
36
|
-
]);
|
|
37
|
-
useEffect(() => graph.current?.repaint(), [
|
|
38
|
-
selection.selected.value
|
|
39
|
-
]);
|
|
40
|
-
const handleSelect = useCallback((node) => {
|
|
41
|
-
if (selection.contains(node.id)) {
|
|
42
|
-
selection.remove(node.id);
|
|
43
|
-
} else {
|
|
44
|
-
selection.add(node.id);
|
|
45
|
-
}
|
|
46
|
-
}, [
|
|
47
|
-
selection
|
|
48
|
-
]);
|
|
49
|
-
return /* @__PURE__ */ React.createElement(SVG.Root, {
|
|
50
|
-
ref: context,
|
|
51
|
-
classNames
|
|
52
|
-
}, /* @__PURE__ */ React.createElement(SVG.Markers, null), grid && /* @__PURE__ */ React.createElement(SVG.Grid, {
|
|
53
|
-
axis: true
|
|
54
|
-
}), /* @__PURE__ */ React.createElement(SVG.Zoom, {
|
|
55
|
-
extent: [
|
|
56
|
-
1 / 2,
|
|
57
|
-
2
|
|
58
|
-
]
|
|
59
|
-
}, /* @__PURE__ */ React.createElement(SVG.Graph, {
|
|
60
|
-
...props,
|
|
61
|
-
ref: graph,
|
|
62
|
-
model,
|
|
63
|
-
projector,
|
|
64
|
-
labels: {
|
|
65
|
-
text: (node) => {
|
|
66
|
-
return node.data?.data.label ?? node.id;
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
attributes: {
|
|
70
|
-
node: (node) => {
|
|
71
|
-
const obj = node.data?.data.object;
|
|
72
|
-
return {
|
|
73
|
-
data: {
|
|
74
|
-
color: getHashStyles(obj && Obj.getTypename(obj))?.hue
|
|
75
|
-
},
|
|
76
|
-
classes: {
|
|
77
|
-
"dx-selected": selection.contains(node.id)
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
onSelect: handleSelect
|
|
83
|
-
})));
|
|
84
|
-
} finally {
|
|
85
|
-
_effect.f();
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// src/components/Graph/ForceGraph.tsx
|
|
90
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
91
|
-
import { forceLink, forceManyBody } from "d3";
|
|
92
|
-
import NativeForceGraph from "force-graph";
|
|
93
|
-
import React2, { useEffect as useEffect2, useRef as useRef2, useState } from "react";
|
|
94
|
-
import { useResizeDetector } from "react-resize-detector";
|
|
95
|
-
import { filterObjectsSync } from "@dxos/plugin-search";
|
|
96
|
-
|
|
97
|
-
// src/components/Graph/adapter.ts
|
|
98
|
-
var GraphAdapter = class {
|
|
99
|
-
graph;
|
|
100
|
-
_nodes = [];
|
|
101
|
-
_links = [];
|
|
102
|
-
constructor(graph) {
|
|
103
|
-
this.graph = graph;
|
|
104
|
-
this._nodes = graph.nodes.map((node) => ({
|
|
105
|
-
id: node.id,
|
|
106
|
-
type: node.type,
|
|
107
|
-
data: node.data
|
|
108
|
-
}));
|
|
109
|
-
this._links = graph.edges.map((edge) => ({
|
|
110
|
-
type: edge.type,
|
|
111
|
-
source: edge.source,
|
|
112
|
-
target: edge.target,
|
|
113
|
-
data: edge.data
|
|
114
|
-
}));
|
|
115
|
-
}
|
|
116
|
-
get nodes() {
|
|
117
|
-
return this._nodes;
|
|
118
|
-
}
|
|
119
|
-
get links() {
|
|
120
|
-
return this._links;
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
// src/components/Graph/ForceGraph.tsx
|
|
125
|
-
var ForceGraph = ({ model, match }) => {
|
|
126
|
-
var _effect = _useSignals2();
|
|
127
|
-
try {
|
|
128
|
-
const { ref, width, height } = useResizeDetector({
|
|
129
|
-
refreshRate: 200
|
|
130
|
-
});
|
|
131
|
-
const rootRef = useRef2(null);
|
|
132
|
-
const forceGraph = useRef2(null);
|
|
133
|
-
const filteredRef = useRef2([]);
|
|
134
|
-
filteredRef.current = filterObjectsSync(model?.objects ?? [], match);
|
|
135
|
-
const [data, setData] = useState();
|
|
136
|
-
useEffect2(() => {
|
|
137
|
-
return model?.subscribe((model2) => {
|
|
138
|
-
setData(new GraphAdapter(model2.graph));
|
|
139
|
-
});
|
|
140
|
-
}, [
|
|
141
|
-
model
|
|
142
|
-
]);
|
|
143
|
-
useEffect2(() => {
|
|
144
|
-
if (rootRef.current) {
|
|
145
|
-
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((link) => link.type);
|
|
146
|
-
}
|
|
147
|
-
return () => {
|
|
148
|
-
forceGraph.current?.pauseAnimation().graphData({
|
|
149
|
-
nodes: [],
|
|
150
|
-
links: []
|
|
151
|
-
});
|
|
152
|
-
forceGraph.current = null;
|
|
153
|
-
};
|
|
154
|
-
}, []);
|
|
155
|
-
useEffect2(() => {
|
|
156
|
-
if (!data || !width || !height || !forceGraph.current) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
forceGraph.current.pauseAnimation().width(width).height(height).onEngineStop(() => {
|
|
160
|
-
handleZoomToFit();
|
|
161
|
-
}).onNodeClick((node) => {
|
|
162
|
-
forceGraph.current?.emitParticle(node);
|
|
163
|
-
}).d3Force("link", forceLink().distance(160).strength(0.5)).d3Force("charge", forceManyBody().strength(-30)).graphData(data).warmupTicks(100).cooldownTime(1e3).resumeAnimation();
|
|
164
|
-
}, [
|
|
165
|
-
data,
|
|
166
|
-
width,
|
|
167
|
-
height,
|
|
168
|
-
forceGraph.current
|
|
169
|
-
]);
|
|
170
|
-
const handleZoomToFit = () => {
|
|
171
|
-
forceGraph.current?.zoomToFit(400, 40);
|
|
172
|
-
};
|
|
173
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
174
|
-
ref,
|
|
175
|
-
className: "relative grow",
|
|
176
|
-
onClick: handleZoomToFit
|
|
177
|
-
}, /* @__PURE__ */ React2.createElement("div", {
|
|
178
|
-
ref: rootRef,
|
|
179
|
-
className: "absolute inset-0"
|
|
180
|
-
}));
|
|
181
|
-
} finally {
|
|
182
|
-
_effect.f();
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
export {
|
|
187
|
-
D3ForceGraph,
|
|
188
|
-
ForceGraph
|
|
189
|
-
};
|
|
190
|
-
//# sourceMappingURL=chunk-CRSVAZNA.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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, { 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 { getHashStyles } 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 = ({ classNames, model, selection: _selection, grid, ...props }: D3ForceGraphProps) => {\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: getHashStyles(obj && Obj.getTypename(obj))?.hue,\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>(null);\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 = null;\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": "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",
|
|
6
|
-
"names": ["React", "useCallback", "useEffect", "useMemo", "useRef", "Obj", "SelectionModel", "GraphForceProjector", "SVG", "getHashStyles", "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", "getHashStyles", "Obj", "getTypename", "hue", "classes", "onSelect", "forceLink", "forceManyBody", "NativeForceGraph", "React", "useEffect", "useRef", "useState", "useResizeDetector", "filterObjectsSync", "GraphAdapter", "_nodes", "_links", "graph", "nodes", "map", "node", "id", "type", "data", "edges", "edge", "source", "target", "links", "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", "onEngineStop", "handleZoomToFit", "onNodeClick", "emitParticle", "d3Force", "forceLink", "distance", "strength", "forceManyBody", "warmupTicks", "cooldownTime", "resumeAnimation", "zoomToFit", "React", "div", "className", "onClick"]
|
|
7
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
meta
|
|
4
|
-
} from "./chunk-UXZM5VJB.mjs";
|
|
5
|
-
import {
|
|
6
|
-
__export
|
|
7
|
-
} from "./chunk-HSLMI22Q.mjs";
|
|
8
|
-
|
|
9
|
-
// src/types/ExplorerAction.ts
|
|
10
|
-
var ExplorerAction_exports = {};
|
|
11
|
-
__export(ExplorerAction_exports, {
|
|
12
|
-
CreateGraph: () => CreateGraph,
|
|
13
|
-
GraphProps: () => GraphProps
|
|
14
|
-
});
|
|
15
|
-
import * as Schema from "effect/Schema";
|
|
16
|
-
import { SpaceSchema } from "@dxos/react-client/echo";
|
|
17
|
-
import { DataType, TypenameAnnotationId } from "@dxos/schema";
|
|
18
|
-
var EXPLORER_ACTION = `${meta.id}/action`;
|
|
19
|
-
var GraphProps = Schema.Struct({
|
|
20
|
-
name: Schema.optional(Schema.String),
|
|
21
|
-
typename: Schema.String.annotations({
|
|
22
|
-
[TypenameAnnotationId]: [
|
|
23
|
-
"used-static",
|
|
24
|
-
"dynamic"
|
|
25
|
-
],
|
|
26
|
-
title: "Select graph record type"
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
var CreateGraph = class extends Schema.TaggedClass()(`${EXPLORER_ACTION}/create-graph`, {
|
|
30
|
-
input: Schema.Struct({
|
|
31
|
-
space: SpaceSchema
|
|
32
|
-
}).pipe(Schema.extend(GraphProps)),
|
|
33
|
-
output: Schema.Struct({
|
|
34
|
-
object: DataType.View
|
|
35
|
-
})
|
|
36
|
-
}) {
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
// src/types/Graph.ts
|
|
40
|
-
var Graph_exports = {};
|
|
41
|
-
__export(Graph_exports, {
|
|
42
|
-
Graph: () => Graph,
|
|
43
|
-
make: () => make,
|
|
44
|
-
makeView: () => makeView
|
|
45
|
-
});
|
|
46
|
-
import * as Schema2 from "effect/Schema";
|
|
47
|
-
import { Filter, Obj, Query, QueryAST, Type } from "@dxos/echo";
|
|
48
|
-
import { LabelAnnotation, ViewAnnotation } from "@dxos/echo/internal";
|
|
49
|
-
import { createViewFromSpace } from "@dxos/schema";
|
|
50
|
-
var Graph = Schema2.Struct({
|
|
51
|
-
name: Schema2.optional(Schema2.String),
|
|
52
|
-
query: Schema2.Struct({
|
|
53
|
-
raw: Schema2.optional(Schema2.String),
|
|
54
|
-
ast: QueryAST.Query
|
|
55
|
-
}).pipe(Schema2.mutable)
|
|
56
|
-
}).pipe(Type.Obj({
|
|
57
|
-
typename: "dxos.org/type/Graph",
|
|
58
|
-
version: "0.1.0"
|
|
59
|
-
}), LabelAnnotation.set([
|
|
60
|
-
"name"
|
|
61
|
-
]), ViewAnnotation.set(true));
|
|
62
|
-
var make = (props = {
|
|
63
|
-
query: {
|
|
64
|
-
raw: "",
|
|
65
|
-
ast: Query.select(Filter.nothing()).ast
|
|
66
|
-
}
|
|
67
|
-
}) => Obj.make(Graph, props);
|
|
68
|
-
var makeView = async ({ presentation, ...props }) => {
|
|
69
|
-
const graph = make(presentation);
|
|
70
|
-
return createViewFromSpace({
|
|
71
|
-
...props,
|
|
72
|
-
presentation: graph
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
ExplorerAction_exports,
|
|
78
|
-
Graph_exports
|
|
79
|
-
};
|
|
80
|
-
//# sourceMappingURL=chunk-TQESRBUJ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/ExplorerAction.ts", "../../../src/types/Graph.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { SpaceSchema } from '@dxos/react-client/echo';\nimport { DataType, TypenameAnnotationId } from '@dxos/schema';\n\nimport { meta } from '../meta';\n\nconst EXPLORER_ACTION = `${meta.id}/action`;\n\nexport const GraphProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n typename: Schema.String.annotations({\n [TypenameAnnotationId]: ['used-static', 'dynamic'],\n title: 'Select graph record type',\n }),\n});\n\nexport class CreateGraph extends Schema.TaggedClass<CreateGraph>()(`${EXPLORER_ACTION}/create-graph`, {\n input: Schema.Struct({\n space: SpaceSchema,\n }).pipe(Schema.extend(GraphProps)),\n output: Schema.Struct({\n object: DataType.View,\n }),\n}) {}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Filter, Obj, Query, QueryAST, Type } from '@dxos/echo';\nimport { LabelAnnotation, ViewAnnotation } from '@dxos/echo/internal';\nimport { type CreateViewFromSpaceProps, createViewFromSpace } from '@dxos/schema';\n\nexport const Graph = Schema.Struct({\n name: Schema.optional(Schema.String),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(Schema.mutable),\n}).pipe(\n Type.Obj({\n typename: 'dxos.org/type/Graph',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n);\n\nexport type Graph = Schema.Schema.Type<typeof Graph>;\n\n/**\n * Make a graph object.\n */\nexport const make = (\n props: Obj.MakeProps<typeof Graph> = { query: { raw: '', ast: Query.select(Filter.nothing()).ast } },\n) => Obj.make(Graph, props);\n\ntype MakeViewProps = Omit<CreateViewFromSpaceProps, 'presentation'> & {\n presentation?: Omit<Obj.MakeProps<typeof Graph>, 'name'>;\n};\n\n/**\n * Make a graph as a view of a data set.\n */\nexport const makeView = async ({ presentation, ...props }: MakeViewProps) => {\n const graph = make(presentation);\n return createViewFromSpace({ ...props, presentation: graph });\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAAA;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,mBAAmB;AAC5B,SAASC,UAAUC,4BAA4B;AAI/C,IAAMC,kBAAkB,GAAGC,KAAKC,EAAE;AAE3B,IAAMC,aAAoBC,cAAO;EACtCC,MAAaC,gBAAgBC,aAAM;EACnCC,UAAiBD,cAAOE,YAAY;IAClC,CAACC,oBAAAA,GAAuB;MAAC;MAAe;;IACxCC,OAAO;EACT,CAAA;AACF,CAAA;AAEO,IAAMC,cAAN,cAAiCC,mBAAW,EAAgB,GAAGb,eAAAA,iBAAgC;EACpGc,OAAcV,cAAO;IACnBW,OAAOC;EACT,CAAA,EAAGC,KAAYC,cAAOf,UAAAA,CAAAA;EACtBgB,QAAef,cAAO;IACpBgB,QAAQC,SAASC;EACnB,CAAA;AACF,CAAA,EAAA;AAAI;;;AC5BJ;;;;;;AAIA,YAAYC,aAAY;AAExB,SAASC,QAAQC,KAAKC,OAAOC,UAAUC,YAAY;AACnD,SAASC,iBAAiBC,sBAAsB;AAChD,SAAwCC,2BAA2B;AAE5D,IAAMC,QAAeC,eAAO;EACjCC,MAAaC,iBAAgBC,cAAM;EACnCC,OAAcJ,eAAO;IACnBK,KAAYH,iBAAgBC,cAAM;IAClCG,KAAKC,SAASC;EAChB,CAAA,EAAGC,KAAYC,eAAO;AACxB,CAAA,EAAGD,KACDE,KAAKC,IAAI;EACPC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBC,IAAI;EAAC;CAAO,GAC5BC,eAAeD,IAAI,IAAA,CAAA;AAQd,IAAME,OAAO,CAClBC,QAAqC;EAAEf,OAAO;IAAEC,KAAK;IAAIC,KAAKE,MAAMY,OAAOC,OAAOC,QAAO,CAAA,EAAIhB;EAAI;AAAE,MAChGM,IAAIM,KAAKnB,OAAOoB,KAAAA;AASd,IAAMI,WAAW,OAAO,EAAEC,cAAc,GAAGL,MAAAA,MAAsB;AACtE,QAAMM,QAAQP,KAAKM,YAAAA;AACnB,SAAOE,oBAAoB;IAAE,GAAGP;IAAOK,cAAcC;EAAM,CAAA;AAC7D;",
|
|
6
|
-
"names": ["Schema", "SpaceSchema", "DataType", "TypenameAnnotationId", "EXPLORER_ACTION", "meta", "id", "GraphProps", "Struct", "name", "optional", "String", "typename", "annotations", "TypenameAnnotationId", "title", "CreateGraph", "TaggedClass", "input", "space", "SpaceSchema", "pipe", "extend", "output", "object", "DataType", "View", "Schema", "Filter", "Obj", "Query", "QueryAST", "Type", "LabelAnnotation", "ViewAnnotation", "createViewFromSpace", "Graph", "Struct", "name", "optional", "String", "query", "raw", "ast", "QueryAST", "Query", "pipe", "mutable", "Type", "Obj", "typename", "version", "LabelAnnotation", "set", "ViewAnnotation", "make", "props", "select", "Filter", "nothing", "makeView", "presentation", "graph", "createViewFromSpace"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/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,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
|
|
6
|
-
"names": ["trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "tags", "screenshots"]
|
|
7
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
ExplorerAction_exports,
|
|
4
|
-
Graph_exports
|
|
5
|
-
} from "./chunk-TQESRBUJ.mjs";
|
|
6
|
-
import "./chunk-UXZM5VJB.mjs";
|
|
7
|
-
import "./chunk-HSLMI22Q.mjs";
|
|
8
|
-
|
|
9
|
-
// src/capabilities/intent-resolver.ts
|
|
10
|
-
import { Capabilities, contributes, createResolver } from "@dxos/app-framework";
|
|
11
|
-
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
12
|
-
var intent_resolver_default = ((context) => contributes(Capabilities.IntentResolver, createResolver({
|
|
13
|
-
intent: ExplorerAction_exports.CreateGraph,
|
|
14
|
-
resolve: async ({ space, name, typename }) => {
|
|
15
|
-
const client = context.getCapability(ClientCapabilities.Client);
|
|
16
|
-
const { view } = await Graph_exports.makeView({
|
|
17
|
-
client,
|
|
18
|
-
space,
|
|
19
|
-
name,
|
|
20
|
-
typename
|
|
21
|
-
});
|
|
22
|
-
return {
|
|
23
|
-
data: {
|
|
24
|
-
object: view
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
})));
|
|
29
|
-
export {
|
|
30
|
-
intent_resolver_default as default
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=intent-resolver-RGBBXXYM.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/intent-resolver.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, type PluginContext, contributes, createResolver } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\n\nimport { ExplorerAction, Graph } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: ExplorerAction.CreateGraph,\n resolve: async ({ space, name, typename }) => {\n const client = context.getCapability(ClientCapabilities.Client);\n const { view } = await Graph.makeView({ client, space, name, typename });\n return { data: { object: view } };\n },\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,SAASA,cAAkCC,aAAaC,sBAAsB;AAC9E,SAASC,0BAA0B;AAInC,IAAA,2BAAe,CAACC,YACdC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,uBAAeC;EACvBC,SAAS,OAAO,EAAEC,OAAOC,MAAMC,SAAQ,MAAE;AACvC,UAAMC,SAASZ,QAAQa,cAAcC,mBAAmBC,MAAM;AAC9D,UAAM,EAAEC,KAAI,IAAK,MAAMC,cAAMC,SAAS;MAAEN;MAAQH;MAAOC;MAAMC;IAAS,CAAA;AACtE,WAAO;MAAEQ,MAAM;QAAEC,QAAQJ;MAAK;IAAE;EAClC;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "createResolver", "ClientCapabilities", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ExplorerAction", "CreateGraph", "resolve", "space", "name", "typename", "client", "getCapability", "ClientCapabilities", "Client", "view", "Graph", "makeView", "data", "object"]
|
|
7
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
ExplorerContainer
|
|
4
|
-
} from "./chunk-RSZFBKZM.mjs";
|
|
5
|
-
import "./chunk-CRSVAZNA.mjs";
|
|
6
|
-
import {
|
|
7
|
-
Graph_exports
|
|
8
|
-
} from "./chunk-TQESRBUJ.mjs";
|
|
9
|
-
import {
|
|
10
|
-
meta
|
|
11
|
-
} from "./chunk-UXZM5VJB.mjs";
|
|
12
|
-
import "./chunk-HSLMI22Q.mjs";
|
|
13
|
-
|
|
14
|
-
// src/capabilities/react-surface.tsx
|
|
15
|
-
import React from "react";
|
|
16
|
-
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
17
|
-
import { Obj } from "@dxos/echo";
|
|
18
|
-
import { DataType } from "@dxos/schema";
|
|
19
|
-
var react_surface_default = (() => contributes(Capabilities.ReactSurface, createSurface({
|
|
20
|
-
id: `${meta.id}/article`,
|
|
21
|
-
role: [
|
|
22
|
-
"article",
|
|
23
|
-
"section"
|
|
24
|
-
],
|
|
25
|
-
filter: (data) => Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(Graph_exports.Graph, data.subject.presentation.target),
|
|
26
|
-
component: ({ data, role }) => {
|
|
27
|
-
return /* @__PURE__ */ React.createElement(ExplorerContainer, {
|
|
28
|
-
view: data.subject,
|
|
29
|
-
role
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
})));
|
|
33
|
-
export {
|
|
34
|
-
react_surface_default as default
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=react-surface-SXPT2T37.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { DataType } from '@dxos/schema';\n\nimport { ExplorerContainer } from '../components';\nimport { meta } from '../meta';\nimport { Graph } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.ReactSurface,\n createSurface({\n id: `${meta.id}/article`,\n role: ['article', 'section'],\n filter: (data): data is { subject: DataType.View } =>\n Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(Graph.Graph, data.subject.presentation.target),\n component: ({ data, role }) => {\n return <ExplorerContainer view={data.subject} role={role} />;\n },\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;AACpB,SAASC,gBAAgB;AAMzB,IAAA,yBAAe,MACbC,YACEC,aAAaC,cACbC,cAAc;EACZC,IAAI,GAAGC,KAAKD,EAAE;EACdE,MAAM;IAAC;IAAW;;EAClBC,QAAQ,CAACC,SACPC,IAAIC,WAAWC,SAASC,MAAMJ,KAAKK,OAAO,KAAKJ,IAAIC,WAAWI,cAAMA,OAAON,KAAKK,QAAQE,aAAaC,MAAM;EAC7GC,WAAW,CAAC,EAAET,MAAMF,KAAI,MAAE;AACxB,WAAO,sBAAA,cAACY,mBAAAA;MAAkBC,MAAMX,KAAKK;MAASP;;EAChD;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["React", "Capabilities", "contributes", "createSurface", "Obj", "DataType", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "DataType", "View", "subject", "Graph", "presentation", "target", "component", "ExplorerContainer", "view"]
|
|
7
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Capabilities, type PluginContext } from '@dxos/app-framework';
|
|
2
|
-
declare const _default: (context: PluginContext) => import("@dxos/app-framework").Capability<import("@dxos/app-framework").InterfaceDef<Capabilities.IntentResolver>>;
|
|
3
|
-
export default _default;
|
|
4
|
-
//# sourceMappingURL=intent-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAA+B,MAAM,qBAAqB,CAAC;yBAKpF,SAAS,aAAa;AAAtC,wBAWI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;;AAQ/E,wBAYI"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities, type PluginContext, contributes, createResolver } from '@dxos/app-framework';
|
|
6
|
-
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
7
|
-
|
|
8
|
-
import { ExplorerAction, Graph } from '../types';
|
|
9
|
-
|
|
10
|
-
export default (context: PluginContext) =>
|
|
11
|
-
contributes(
|
|
12
|
-
Capabilities.IntentResolver,
|
|
13
|
-
createResolver({
|
|
14
|
-
intent: ExplorerAction.CreateGraph,
|
|
15
|
-
resolve: async ({ space, name, typename }) => {
|
|
16
|
-
const client = context.getCapability(ClientCapabilities.Client);
|
|
17
|
-
const { view } = await Graph.makeView({ client, space, name, typename });
|
|
18
|
-
return { data: { object: view } };
|
|
19
|
-
},
|
|
20
|
-
}),
|
|
21
|
-
);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import { Obj } from '@dxos/echo';
|
|
9
|
-
import { DataType } from '@dxos/schema';
|
|
10
|
-
|
|
11
|
-
import { ExplorerContainer } from '../components';
|
|
12
|
-
import { meta } from '../meta';
|
|
13
|
-
import { Graph } from '../types';
|
|
14
|
-
|
|
15
|
-
export default () =>
|
|
16
|
-
contributes(
|
|
17
|
-
Capabilities.ReactSurface,
|
|
18
|
-
createSurface({
|
|
19
|
-
id: `${meta.id}/article`,
|
|
20
|
-
role: ['article', 'section'],
|
|
21
|
-
filter: (data): data is { subject: DataType.View } =>
|
|
22
|
-
Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(Graph.Graph, data.subject.presentation.target),
|
|
23
|
-
component: ({ data, role }) => {
|
|
24
|
-
return <ExplorerContainer view={data.subject} role={role} />;
|
|
25
|
-
},
|
|
26
|
-
}),
|
|
27
|
-
);
|