@dxos/plugin-explorer 0.8.4-main.2e9d522 → 0.8.4-main.406dc2a
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-6SHZJ6AK.mjs +50 -0
- package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UL5EDJPE.mjs → chunk-2DGFNLRO.mjs} +2 -4
- package/dist/lib/browser/chunk-2DGFNLRO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-OAOY7SHY.mjs → chunk-2MKBRIUT.mjs} +6 -5
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +7 -0
- package/dist/lib/browser/chunk-BZ65T5M3.mjs +79 -0
- package/dist/lib/browser/chunk-BZ65T5M3.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-S5A2EUSJ.mjs → browser/chunk-MOM5KCKC.mjs} +36 -26
- package/dist/lib/browser/{chunk-PVFZFKQ6.mjs.map → chunk-MOM5KCKC.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-J2BBZOSF.mjs → chunk-NXGP6NTP.mjs} +28 -12
- package/dist/lib/browser/chunk-NXGP6NTP.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +25 -19
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-K57C3LIX.mjs +31 -0
- package/dist/lib/browser/intent-resolver-K57C3LIX.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +2 -3
- package/dist/lib/browser/react-surface-OPBND5W3.mjs +35 -0
- package/dist/lib/browser/react-surface-OPBND5W3.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -6
- package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs +51 -0
- package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PPBUWC7F.mjs → chunk-3ODK27PU.mjs} +6 -5
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-4VMSNXYL.mjs → chunk-6JACZE7E.mjs} +28 -12
- package/dist/lib/node-esm/chunk-6JACZE7E.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ES6AOMCY.mjs +80 -0
- package/dist/lib/node-esm/chunk-ES6AOMCY.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PIAXA43R.mjs → chunk-PX6LHR2N.mjs} +2 -4
- package/dist/lib/node-esm/chunk-PX6LHR2N.mjs.map +7 -0
- package/dist/lib/{browser/chunk-PVFZFKQ6.mjs → node-esm/chunk-ZCV4U7LT.mjs} +38 -24
- package/dist/lib/node-esm/{chunk-S5A2EUSJ.mjs.map → chunk-ZCV4U7LT.mjs.map} +3 -3
- package/dist/lib/node-esm/index.mjs +25 -19
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs +32 -0
- package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +2 -3
- package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs +36 -0
- package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -6
- package/dist/types/src/ExplorerPlugin.d.ts +1 -1
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- 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 +2 -2
- 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/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
- package/dist/types/src/components/Chart/Chart.stories.d.ts +8 -4
- package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/src/components/ExplorerContainer.d.ts +2 -2
- 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 +8 -4
- package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts +2 -2
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +13 -4
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +13 -4
- 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 -16
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +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/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +14 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/ExplorerAction.d.ts +23 -0
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -0
- package/dist/types/src/types/Graph.d.ts +33 -0
- package/dist/types/src/types/Graph.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -36
- package/src/ExplorerPlugin.tsx +48 -47
- package/src/capabilities/intent-resolver.ts +10 -8
- package/src/capabilities/react-surface.tsx +9 -5
- package/src/components/Chart/Chart.stories.tsx +9 -7
- package/src/components/Chart/Chart.tsx +1 -1
- package/src/components/ExplorerContainer.tsx +24 -6
- package/src/components/Globe/Globe.stories.tsx +14 -12
- package/src/components/Globe/Globe.tsx +1 -1
- package/src/components/Graph/D3ForceGraph.stories.tsx +30 -17
- package/src/components/Graph/D3ForceGraph.tsx +5 -5
- package/src/components/Graph/ForceGraph.stories.tsx +30 -17
- package/src/components/Graph/ForceGraph.tsx +4 -4
- package/src/components/Graph/testing.ts +2 -2
- package/src/components/Tree/Tree.stories.tsx +28 -22
- package/src/components/Tree/Tree.tsx +3 -3
- package/src/components/Tree/types/tree.test.ts +2 -1
- package/src/components/Tree/types/tree.ts +1 -1
- package/src/hooks/useGraphModel.ts +5 -4
- package/src/meta.ts +1 -3
- package/src/translations.ts +4 -2
- package/src/types/ExplorerAction.ts +29 -0
- package/src/types/Graph.ts +45 -0
- package/src/types/index.ts +2 -2
- package/dist/lib/browser/ExplorerContainer-OGHSHZD5.mjs +0 -37
- package/dist/lib/browser/ExplorerContainer-OGHSHZD5.mjs.map +0 -7
- package/dist/lib/browser/chunk-EF4BFHTI.mjs +0 -38
- package/dist/lib/browser/chunk-EF4BFHTI.mjs.map +0 -7
- package/dist/lib/browser/chunk-J2BBZOSF.mjs.map +0 -7
- package/dist/lib/browser/chunk-OAOY7SHY.mjs.map +0 -7
- package/dist/lib/browser/chunk-UL5EDJPE.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-XH2UO2FM.mjs +0 -24
- package/dist/lib/browser/intent-resolver-XH2UO2FM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-65VQ42HX.mjs +0 -31
- package/dist/lib/browser/react-surface-65VQ42HX.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-6ON5NA2P.mjs +0 -38
- package/dist/lib/node-esm/ExplorerContainer-6ON5NA2P.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4VMSNXYL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PIAXA43R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PPBUWC7F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VKCOKQRG.mjs +0 -39
- package/dist/lib/node-esm/chunk-VKCOKQRG.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-AGBBNA67.mjs +0 -25
- package/dist/lib/node-esm/intent-resolver-AGBBNA67.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-IJIMYAST.mjs +0 -32
- package/dist/lib/node-esm/react-surface-IJIMYAST.mjs.map +0 -7
- package/dist/types/src/types/schema.d.ts +0 -12
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -18
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/types/schema.ts +0 -16
- package/src/types/types.ts +0 -21
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useState } from 'react';
|
|
6
7
|
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
8
|
-
import React, { useEffect, useState } from 'react';
|
|
9
|
-
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
8
|
import { faker } from '@dxos/random';
|
|
12
9
|
import { useClient } from '@dxos/react-client';
|
|
13
10
|
import { type Space } from '@dxos/react-client/echo';
|
|
14
11
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
12
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
13
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
15
14
|
import { DataType } from '@dxos/schema';
|
|
16
15
|
import { type ValueGenerator } from '@dxos/schema/testing';
|
|
17
|
-
import {
|
|
16
|
+
import { render } from '@dxos/storybook-utils';
|
|
17
|
+
|
|
18
|
+
import { useGraphModel } from '../../hooks';
|
|
19
|
+
import { Graph } from '../../types';
|
|
18
20
|
|
|
19
21
|
import { ForceGraph } from './ForceGraph';
|
|
20
22
|
import { generate } from './testing';
|
|
21
|
-
import { useGraphModel } from '../../hooks';
|
|
22
|
-
import { ViewType } from '../../types';
|
|
23
23
|
|
|
24
24
|
const generator = faker as any as ValueGenerator;
|
|
25
25
|
|
|
@@ -28,11 +28,13 @@ faker.seed(1);
|
|
|
28
28
|
const DefaultStory = () => {
|
|
29
29
|
const client = useClient();
|
|
30
30
|
const [space, setSpace] = useState<Space>();
|
|
31
|
-
const [view, setView] = useState<
|
|
32
|
-
|
|
31
|
+
const [view, setView] = useState<DataType.View>();
|
|
32
|
+
|
|
33
|
+
useAsyncEffect(async () => {
|
|
33
34
|
const space = client.spaces.default;
|
|
34
35
|
void generate(space, generator);
|
|
35
|
-
const view =
|
|
36
|
+
const { view } = await Graph.makeView({ client, space, name: 'Test', typename: Graph.Graph.typename });
|
|
37
|
+
space.db.add(view);
|
|
36
38
|
setSpace(space);
|
|
37
39
|
setView(view);
|
|
38
40
|
}, []);
|
|
@@ -45,20 +47,31 @@ const DefaultStory = () => {
|
|
|
45
47
|
return <ForceGraph model={model} />;
|
|
46
48
|
};
|
|
47
49
|
|
|
48
|
-
const meta
|
|
50
|
+
const meta = {
|
|
49
51
|
title: 'plugins/plugin-explorer/ForceGraph',
|
|
50
52
|
component: ForceGraph,
|
|
51
53
|
render: render(DefaultStory),
|
|
52
54
|
decorators: [
|
|
55
|
+
withTheme,
|
|
53
56
|
withClientProvider({
|
|
54
57
|
createSpace: true,
|
|
55
|
-
types: [
|
|
58
|
+
types: [
|
|
59
|
+
Graph.Graph,
|
|
60
|
+
DataType.View,
|
|
61
|
+
DataType.HasRelationship,
|
|
62
|
+
DataType.Organization,
|
|
63
|
+
DataType.Project,
|
|
64
|
+
DataType.Person,
|
|
65
|
+
],
|
|
56
66
|
}),
|
|
57
|
-
withTheme,
|
|
58
|
-
withLayout({ fullscreen: true }),
|
|
59
67
|
],
|
|
60
|
-
|
|
68
|
+
parameters: {
|
|
69
|
+
layout: 'fullscreen',
|
|
70
|
+
},
|
|
71
|
+
} satisfies Meta<typeof ForceGraph>;
|
|
61
72
|
|
|
62
73
|
export default meta;
|
|
63
74
|
|
|
64
|
-
|
|
75
|
+
type Story = StoryObj<typeof meta>;
|
|
76
|
+
|
|
77
|
+
export const Default: Story = {};
|
|
@@ -7,7 +7,7 @@ import NativeForceGraph from 'force-graph';
|
|
|
7
7
|
import React, { type FC, useEffect, useRef, useState } from 'react';
|
|
8
8
|
import { useResizeDetector } from 'react-resize-detector';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { type SearchResult, filterObjectsSync } from '@dxos/plugin-search';
|
|
11
11
|
import { type SpaceGraphModel } from '@dxos/schema';
|
|
12
12
|
|
|
13
13
|
import { GraphAdapter } from './adapter';
|
|
@@ -20,9 +20,9 @@ export type ForceGraphProps = {
|
|
|
20
20
|
export const ForceGraph: FC<ForceGraphProps> = ({ model, match }) => {
|
|
21
21
|
const { ref, width, height } = useResizeDetector({ refreshRate: 200 });
|
|
22
22
|
const rootRef = useRef<HTMLDivElement>(null);
|
|
23
|
-
const forceGraph = useRef<NativeForceGraph>();
|
|
23
|
+
const forceGraph = useRef<NativeForceGraph>(null);
|
|
24
24
|
|
|
25
|
-
const filteredRef = useRef<SearchResult[]>();
|
|
25
|
+
const filteredRef = useRef<SearchResult[]>([]);
|
|
26
26
|
filteredRef.current = filterObjectsSync(model?.objects ?? [], match);
|
|
27
27
|
|
|
28
28
|
const [data, setData] = useState<GraphAdapter>();
|
|
@@ -48,7 +48,7 @@ export const ForceGraph: FC<ForceGraphProps> = ({ model, match }) => {
|
|
|
48
48
|
|
|
49
49
|
return () => {
|
|
50
50
|
forceGraph.current?.pauseAnimation().graphData({ nodes: [], links: [] });
|
|
51
|
-
forceGraph.current =
|
|
51
|
+
forceGraph.current = null;
|
|
52
52
|
};
|
|
53
53
|
}, []);
|
|
54
54
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Space } from '@dxos/client/echo';
|
|
6
|
-
import { Query, Relation
|
|
6
|
+
import { type Obj, Query, Relation } from '@dxos/echo';
|
|
7
7
|
import { DataType } from '@dxos/schema';
|
|
8
|
-
import {
|
|
8
|
+
import { type TypeSpec, type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
9
9
|
import { range } from '@dxos/util';
|
|
10
10
|
|
|
11
11
|
const getObject = (objects: Obj.Any[]) => objects[Math.floor(Math.random() * objects.length)];
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type Meta } from '@storybook/react-vite';
|
|
8
|
-
import React, { type FC, useEffect, useState } from 'react';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useEffect, useState } from 'react';
|
|
9
7
|
|
|
10
8
|
import { faker } from '@dxos/random';
|
|
11
9
|
import { useClient } from '@dxos/react-client';
|
|
12
10
|
import { type ClientRepeatedComponentProps, ClientRepeater } from '@dxos/react-client/testing';
|
|
13
|
-
import {
|
|
11
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
12
|
|
|
15
13
|
import { Tree, type TreeComponentProps } from './Tree';
|
|
16
|
-
import {
|
|
14
|
+
import { Tree as TreeModel, TreeType } from './types';
|
|
17
15
|
|
|
18
16
|
// TODO(burdon): Storybook for Graph/Tree/Plot (generics); incl. GraphModel.
|
|
19
17
|
// TODO(burdon): Type for all Explorer components (Space, Object, Query, etc.) incl.
|
|
20
18
|
|
|
21
19
|
faker.seed(1);
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
type ComponentProps = ClientRepeatedComponentProps & { type?: TreeComponentProps<any>['variant'] };
|
|
22
|
+
|
|
23
|
+
const Component = ({ type }: ComponentProps) => {
|
|
24
24
|
const client = useClient();
|
|
25
25
|
const space = client.spaces.default;
|
|
26
26
|
const [object, setObject] = useState<TreeType>();
|
|
@@ -38,32 +38,38 @@ const Story: FC<ClientRepeatedComponentProps & { type?: TreeComponentProps<any>[
|
|
|
38
38
|
return <Tree space={space} selected={object?.id} variant={type} />;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
const DefaultStory = () => {
|
|
42
|
+
return <ClientRepeater component={Component} types={[TreeType]} createSpace />;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const meta = {
|
|
46
|
+
title: 'plugins/plugin-explorer/Tree',
|
|
47
|
+
component: Tree as any,
|
|
48
|
+
render: DefaultStory,
|
|
49
|
+
decorators: [withTheme],
|
|
50
|
+
parameters: {
|
|
51
|
+
layout: 'fullscreen',
|
|
52
|
+
},
|
|
53
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
54
|
+
|
|
55
|
+
export default meta;
|
|
56
|
+
|
|
57
|
+
type Story = StoryObj<typeof meta>;
|
|
58
|
+
|
|
59
|
+
export const Tidy: Story = {
|
|
42
60
|
args: {
|
|
43
61
|
type: 'tidy',
|
|
44
62
|
},
|
|
45
63
|
};
|
|
46
64
|
|
|
47
|
-
export const Radial = {
|
|
65
|
+
export const Radial: Story = {
|
|
48
66
|
args: {
|
|
49
67
|
type: 'radial',
|
|
50
68
|
},
|
|
51
69
|
};
|
|
52
70
|
|
|
53
|
-
export const Edge = {
|
|
71
|
+
export const Edge: Story = {
|
|
54
72
|
args: {
|
|
55
73
|
type: 'edge',
|
|
56
74
|
},
|
|
57
75
|
};
|
|
58
|
-
|
|
59
|
-
const meta: Meta = {
|
|
60
|
-
title: 'plugins/plugin-explorer/Tree',
|
|
61
|
-
component: Tree,
|
|
62
|
-
render: () => <ClientRepeater component={Story} types={[TreeType]} createSpace />,
|
|
63
|
-
decorators: [withTheme, withLayout({ fullscreen: true })],
|
|
64
|
-
parameters: {
|
|
65
|
-
layout: 'fullscreen',
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export default meta;
|
|
@@ -10,7 +10,7 @@ import { SVG, type SVGContext } from '@dxos/react-ui-graph';
|
|
|
10
10
|
import { SpaceGraphModel } from '@dxos/schema';
|
|
11
11
|
|
|
12
12
|
import { HierarchicalEdgeBundling, RadialTree, TidyTree } from './layout';
|
|
13
|
-
import {
|
|
13
|
+
import { type TreeNode, mapGraphToTreeData } from './types';
|
|
14
14
|
|
|
15
15
|
// TODO(burdon): Create dge bundling graph using d3.hierarchy.
|
|
16
16
|
// https://observablehq.com/@d3/hierarchical-edge-bundling?intent=fork
|
|
@@ -75,8 +75,8 @@ export const Tree = <N,>({ space, selected, variant = 'tidy', onNodeClick }: Tre
|
|
|
75
75
|
const context = useRef<SVGContext>(null);
|
|
76
76
|
|
|
77
77
|
useEffect(() => {
|
|
78
|
-
if (context.current) {
|
|
79
|
-
const { width, height } = context.current.size
|
|
78
|
+
if (context.current?.size) {
|
|
79
|
+
const { width, height } = context.current.size;
|
|
80
80
|
const size = Math.min(width, height);
|
|
81
81
|
const radius = size * 0.4;
|
|
82
82
|
const options = {
|
|
@@ -8,9 +8,10 @@ import { Obj, Ref } from '@dxos/echo';
|
|
|
8
8
|
import { faker } from '@dxos/random';
|
|
9
9
|
import { DataType } from '@dxos/schema';
|
|
10
10
|
|
|
11
|
-
import { type Tree } from './tree';
|
|
12
11
|
import { createTree } from '../testing';
|
|
13
12
|
|
|
13
|
+
import { type Tree } from './tree';
|
|
14
|
+
|
|
14
15
|
faker.seed(0);
|
|
15
16
|
|
|
16
17
|
const print = (tree: Tree) => {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useState } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type Filter, type Space } from '@dxos/client/echo';
|
|
7
|
+
import { type Filter, type Queue, type Space } from '@dxos/client/echo';
|
|
8
8
|
import { SpaceGraphModel, type SpaceGraphModelOptions } from '@dxos/schema';
|
|
9
9
|
|
|
10
10
|
// TODO(burdon): Factor out.
|
|
@@ -12,6 +12,7 @@ export const useGraphModel = (
|
|
|
12
12
|
space: Space | undefined,
|
|
13
13
|
filter?: Filter.Any | undefined,
|
|
14
14
|
options?: SpaceGraphModelOptions,
|
|
15
|
+
queue?: Queue,
|
|
15
16
|
): SpaceGraphModel | undefined => {
|
|
16
17
|
const [model, setModel] = useState<SpaceGraphModel | undefined>(undefined);
|
|
17
18
|
useEffect(() => {
|
|
@@ -22,14 +23,14 @@ export const useGraphModel = (
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
// TODO(burdon): Does this need to be a dependency?
|
|
25
|
-
if (!model) {
|
|
26
|
+
if (!model || model.queue !== queue) {
|
|
26
27
|
const model = new SpaceGraphModel().setFilter(filter).setOptions(options);
|
|
27
|
-
void model.open(space);
|
|
28
|
+
void model.open(space, queue);
|
|
28
29
|
setModel(model);
|
|
29
30
|
} else {
|
|
30
31
|
model.setFilter(filter).setOptions(options);
|
|
31
32
|
}
|
|
32
|
-
}, [space, filter, options]);
|
|
33
|
+
}, [space, filter, options, queue]);
|
|
33
34
|
|
|
34
35
|
return model;
|
|
35
36
|
};
|
package/src/meta.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const EXPLORER_PLUGIN = 'dxos.org/plugin/explorer';
|
|
8
|
-
|
|
9
7
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
8
|
+
id: 'dxos.org/plugin/explorer',
|
|
11
9
|
name: 'Explorer',
|
|
12
10
|
description: 'Install this plugin to view a hypergraph of all objects inside of your Space.',
|
|
13
11
|
icon: 'ph--graph--regular',
|
package/src/translations.ts
CHANGED
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
+
import { translations as componentsTranslations } from '@dxos/react-ui-components';
|
|
6
7
|
|
|
7
8
|
import { meta } from './meta';
|
|
8
|
-
import {
|
|
9
|
+
import { Graph } from './types';
|
|
9
10
|
|
|
10
11
|
export const translations = [
|
|
11
12
|
{
|
|
12
13
|
'en-US': {
|
|
13
|
-
[
|
|
14
|
+
[Graph.Graph.typename]: {
|
|
14
15
|
'typename label': 'Explorer',
|
|
15
16
|
'typename label_zero': 'Explorers',
|
|
16
17
|
'typename label_one': 'Explorer',
|
|
@@ -25,4 +26,5 @@ export const translations = [
|
|
|
25
26
|
},
|
|
26
27
|
},
|
|
27
28
|
},
|
|
29
|
+
...componentsTranslations,
|
|
28
30
|
] as const satisfies Resource[];
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
8
|
+
import { DataType, TypenameAnnotationId } from '@dxos/schema';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../meta';
|
|
11
|
+
|
|
12
|
+
const EXPLORER_ACTION = `${meta.id}/action`;
|
|
13
|
+
|
|
14
|
+
export const GraphProps = Schema.Struct({
|
|
15
|
+
name: Schema.optional(Schema.String),
|
|
16
|
+
typename: Schema.String.annotations({
|
|
17
|
+
[TypenameAnnotationId]: ['used-static', 'dynamic'],
|
|
18
|
+
title: 'Select graph record type',
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export class CreateGraph extends Schema.TaggedClass<CreateGraph>()(`${EXPLORER_ACTION}/create-graph`, {
|
|
23
|
+
input: Schema.Struct({
|
|
24
|
+
space: SpaceSchema,
|
|
25
|
+
}).pipe(Schema.extend(GraphProps)),
|
|
26
|
+
output: Schema.Struct({
|
|
27
|
+
object: DataType.View,
|
|
28
|
+
}),
|
|
29
|
+
}) {}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Filter, Obj, Query, QueryAST, Type } from '@dxos/echo';
|
|
8
|
+
import { LabelAnnotation, ViewAnnotation } from '@dxos/echo/internal';
|
|
9
|
+
import { type CreateViewFromSpaceProps, createViewFromSpace } from '@dxos/schema';
|
|
10
|
+
|
|
11
|
+
export const Graph = Schema.Struct({
|
|
12
|
+
name: Schema.optional(Schema.String),
|
|
13
|
+
query: Schema.Struct({
|
|
14
|
+
raw: Schema.optional(Schema.String),
|
|
15
|
+
ast: QueryAST.Query,
|
|
16
|
+
}).pipe(Schema.mutable),
|
|
17
|
+
}).pipe(
|
|
18
|
+
Type.Obj({
|
|
19
|
+
typename: 'dxos.org/type/Graph',
|
|
20
|
+
version: '0.1.0',
|
|
21
|
+
}),
|
|
22
|
+
LabelAnnotation.set(['name']),
|
|
23
|
+
ViewAnnotation.set(true),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export type Graph = Schema.Schema.Type<typeof Graph>;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Make a graph object.
|
|
30
|
+
*/
|
|
31
|
+
export const make = (
|
|
32
|
+
props: Obj.MakeProps<typeof Graph> = { query: { raw: '', ast: Query.select(Filter.nothing()).ast } },
|
|
33
|
+
) => Obj.make(Graph, props);
|
|
34
|
+
|
|
35
|
+
type MakeViewProps = Omit<CreateViewFromSpaceProps, 'presentation'> & {
|
|
36
|
+
presentation?: Omit<Obj.MakeProps<typeof Graph>, 'name'>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Make a graph as a view of a data set.
|
|
41
|
+
*/
|
|
42
|
+
export const makeView = async ({ presentation, ...props }: MakeViewProps) => {
|
|
43
|
+
const graph = make(presentation);
|
|
44
|
+
return createViewFromSpace({ ...props, presentation: graph });
|
|
45
|
+
};
|
package/src/types/index.ts
CHANGED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useGraphModel
|
|
3
|
-
} from "./chunk-OAOY7SHY.mjs";
|
|
4
|
-
import {
|
|
5
|
-
D3ForceGraph
|
|
6
|
-
} from "./chunk-J2BBZOSF.mjs";
|
|
7
|
-
|
|
8
|
-
// src/components/ExplorerContainer.tsx
|
|
9
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
10
|
-
import React from "react";
|
|
11
|
-
import { useGlobalSearch } from "@dxos/plugin-search";
|
|
12
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
13
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
14
|
-
var ExplorerContainer = ({ role, view }) => {
|
|
15
|
-
var _effect = _useSignals();
|
|
16
|
-
try {
|
|
17
|
-
const space = getSpace(view);
|
|
18
|
-
const model = useGraphModel(space);
|
|
19
|
-
const { match } = useGlobalSearch();
|
|
20
|
-
if (!space || !model) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
return /* @__PURE__ */ React.createElement(StackItem.Content, {
|
|
24
|
-
size: role === "section" ? "square" : "intrinsic"
|
|
25
|
-
}, /* @__PURE__ */ React.createElement(D3ForceGraph, {
|
|
26
|
-
model,
|
|
27
|
-
match
|
|
28
|
-
}));
|
|
29
|
-
} finally {
|
|
30
|
-
_effect.f();
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var ExplorerContainer_default = ExplorerContainer;
|
|
34
|
-
export {
|
|
35
|
-
ExplorerContainer_default as default
|
|
36
|
-
};
|
|
37
|
-
//# sourceMappingURL=ExplorerContainer-OGHSHZD5.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 { D3ForceGraph } from './Graph';\nimport { useGraphModel } from '../hooks';\nimport { type ViewType } from '../types';\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;AAW1B,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
|
-
"names": ["React", "useGlobalSearch", "getSpace", "StackItem", "ExplorerContainer", "role", "view", "space", "getSpace", "model", "useGraphModel", "match", "useGlobalSearch", "StackItem", "Content", "size", "D3ForceGraph"]
|
|
7
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EXPLORER_PLUGIN
|
|
3
|
-
} from "./chunk-UL5EDJPE.mjs";
|
|
4
|
-
|
|
5
|
-
// src/types/schema.ts
|
|
6
|
-
import { Schema } from "effect";
|
|
7
|
-
import { TypedObject } from "@dxos/echo-schema";
|
|
8
|
-
var ViewType = class extends TypedObject({
|
|
9
|
-
typename: "dxos.org/type/ExplorerView",
|
|
10
|
-
version: "0.1.0"
|
|
11
|
-
})({
|
|
12
|
-
name: Schema.optional(Schema.String),
|
|
13
|
-
type: Schema.String
|
|
14
|
-
}) {
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/types/types.ts
|
|
18
|
-
import { Schema as Schema2 } from "effect";
|
|
19
|
-
(function(ExplorerAction2) {
|
|
20
|
-
const EXPLORER_ACTION = `${EXPLORER_PLUGIN}/action`;
|
|
21
|
-
class Create extends Schema2.TaggedClass()(`${EXPLORER_ACTION}/create`, {
|
|
22
|
-
input: Schema2.Struct({
|
|
23
|
-
name: Schema2.optional(Schema2.String)
|
|
24
|
-
}),
|
|
25
|
-
output: Schema2.Struct({
|
|
26
|
-
object: ViewType
|
|
27
|
-
})
|
|
28
|
-
}) {
|
|
29
|
-
}
|
|
30
|
-
ExplorerAction2.Create = Create;
|
|
31
|
-
})(ExplorerAction || (ExplorerAction = {}));
|
|
32
|
-
var ExplorerAction;
|
|
33
|
-
|
|
34
|
-
export {
|
|
35
|
-
ViewType,
|
|
36
|
-
ExplorerAction
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=chunk-EF4BFHTI.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 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 { ViewType } from './schema';\nimport { EXPLORER_PLUGIN } from '../meta';\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;UAKNC,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
|
-
"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
|
-
}
|
|
@@ -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, { 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 SpaceGraphNode, type SpaceGraphModel, type SpaceGraphEdge } 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 { filterObjectsSync, type SearchResult } 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": "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",
|
|
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", "graph", "_nodes", "_links", "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", "undefined", "onEngineStop", "handleZoomToFit", "onNodeClick", "emitParticle", "d3Force", "forceLink", "distance", "strength", "forceManyBody", "warmupTicks", "cooldownTime", "resumeAnimation", "zoomToFit", "React", "div", "className", "onClick"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
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 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): 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) {\n const model = new SpaceGraphModel().setFilter(filter).setOptions(options);\n void model.open(space);\n setModel(model);\n } else {\n model.setFilter(filter).setOptions(options);\n }\n }, [space, filter, options]);\n\n return model;\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,WAAWC,gBAAgB;AAGpC,SAASC,uBAAoD;AAGtD,IAAMC,gBAAgB,CAC3BC,OACAC,QACAC,YAAAA;AAEA,QAAM,CAACC,OAAOC,QAAAA,IAAYC,SAAsCC,MAAAA;AAChEC,YAAU,MAAA;AACR,QAAI,CAACP,OAAO;AACV,WAAKG,OAAOK,MAAAA;AACZJ,eAASE,MAAAA;AACT;IACF;AAGA,QAAI,CAACH,OAAO;AACV,YAAMA,SAAQ,IAAIM,gBAAAA,EAAkBC,UAAUT,MAAAA,EAAQU,WAAWT,OAAAA;AACjE,WAAKC,OAAMS,KAAKZ,KAAAA;AAChBI,eAASD,MAAAA;IACX,OAAO;AACLA,YAAMO,UAAUT,MAAAA,EAAQU,WAAWT,OAAAA;IACrC;EACF,GAAG;IAACF;IAAOC;IAAQC;GAAQ;AAE3B,SAAOC;AACT;",
|
|
6
|
-
"names": ["useEffect", "useState", "SpaceGraphModel", "useGraphModel", "space", "filter", "options", "model", "setModel", "useState", "undefined", "useEffect", "close", "SpaceGraphModel", "setFilter", "setOptions", "open"]
|
|
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';\n\nexport const EXPLORER_PLUGIN = 'dxos.org/plugin/explorer';\n\nexport const meta: PluginMeta = {\n id: EXPLORER_PLUGIN,\n name: 'Explorer',\n description: 'Install this plugin to view a hypergraph of all objects inside of your Space.',\n icon: 'ph--graph--regular',\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": ";AAMO,IAAMA,kBAAkB;AAExB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa;IAAC;;AAChB;",
|
|
6
|
-
"names": ["EXPLORER_PLUGIN", "meta", "id", "name", "description", "icon", "source", "tags", "screenshots"]
|
|
7
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExplorerAction,
|
|
3
|
-
ViewType
|
|
4
|
-
} from "./chunk-EF4BFHTI.mjs";
|
|
5
|
-
import "./chunk-UL5EDJPE.mjs";
|
|
6
|
-
|
|
7
|
-
// src/capabilities/intent-resolver.ts
|
|
8
|
-
import { contributes, Capabilities, createResolver } from "@dxos/app-framework";
|
|
9
|
-
import { Obj } from "@dxos/echo";
|
|
10
|
-
var intent_resolver_default = () => contributes(Capabilities.IntentResolver, createResolver({
|
|
11
|
-
intent: ExplorerAction.Create,
|
|
12
|
-
resolve: ({ name }) => ({
|
|
13
|
-
data: {
|
|
14
|
-
object: Obj.make(ViewType, {
|
|
15
|
-
name,
|
|
16
|
-
type: ""
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
}));
|
|
21
|
-
export {
|
|
22
|
-
intent_resolver_default as default
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=intent-resolver-XH2UO2FM.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 { contributes, Capabilities, createResolver } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\n\nimport { ExplorerAction, ViewType } from '../types';\n\nexport default () =>\n contributes(\n Capabilities.IntentResolver,\n createResolver({\n intent: ExplorerAction.Create,\n resolve: ({ name }) => ({\n data: { object: Obj.make(ViewType, { name, type: '' }) },\n }),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;AAIA,SAASA,aAAaC,cAAcC,sBAAsB;AAC1D,SAASC,WAAW;AAIpB,IAAA,0BAAe,MACbC,YACEC,aAAaC,gBACbC,eAAe;EACbC,QAAQC,eAAeC;EACvBC,SAAS,CAAC,EAAEC,KAAI,OAAQ;IACtBC,MAAM;MAAEC,QAAQC,IAAIC,KAAKC,UAAU;QAAEL;QAAMM,MAAM;MAAG,CAAA;IAAG;EACzD;AACF,CAAA,CAAA;",
|
|
6
|
-
"names": ["contributes", "Capabilities", "createResolver", "Obj", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ExplorerAction", "Create", "resolve", "name", "data", "object", "Obj", "make", "ViewType", "type"]
|
|
7
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExplorerContainer
|
|
3
|
-
} from "./chunk-PVFZFKQ6.mjs";
|
|
4
|
-
import "./chunk-J2BBZOSF.mjs";
|
|
5
|
-
import {
|
|
6
|
-
ViewType
|
|
7
|
-
} from "./chunk-EF4BFHTI.mjs";
|
|
8
|
-
import {
|
|
9
|
-
EXPLORER_PLUGIN
|
|
10
|
-
} from "./chunk-UL5EDJPE.mjs";
|
|
11
|
-
|
|
12
|
-
// src/capabilities/react-surface.tsx
|
|
13
|
-
import React from "react";
|
|
14
|
-
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
15
|
-
import { Obj } from "@dxos/echo";
|
|
16
|
-
var react_surface_default = () => contributes(Capabilities.ReactSurface, createSurface({
|
|
17
|
-
id: `${EXPLORER_PLUGIN}/article`,
|
|
18
|
-
role: [
|
|
19
|
-
"article",
|
|
20
|
-
"section"
|
|
21
|
-
],
|
|
22
|
-
filter: (data) => Obj.instanceOf(ViewType, data.subject),
|
|
23
|
-
component: ({ data, role }) => /* @__PURE__ */ React.createElement(ExplorerContainer, {
|
|
24
|
-
view: data.subject,
|
|
25
|
-
role
|
|
26
|
-
})
|
|
27
|
-
}));
|
|
28
|
-
export {
|
|
29
|
-
react_surface_default as default
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=react-surface-65VQ42HX.mjs.map
|