@dxos/plugin-explorer 0.8.4-main.3eb6e50203 → 0.8.4-main.4a85c3132b
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-46BHUF6R.mjs → ExplorerContainer-4RB2TY3G.mjs} +16 -13
- package/dist/lib/browser/ExplorerContainer-4RB2TY3G.mjs.map +7 -0
- package/dist/lib/browser/{chunk-HIFLWHXR.mjs → chunk-4NFGHCGO.mjs} +4 -3
- package/dist/lib/browser/chunk-4NFGHCGO.mjs.map +7 -0
- package/dist/lib/{node-esm/chunk-K5BYG7BW.mjs → browser/chunk-6AZY4CDH.mjs} +217 -17
- package/dist/lib/browser/{chunk-JZSBQYJQ.mjs.map → chunk-6AZY4CDH.mjs.map} +4 -4
- package/dist/lib/browser/index.mjs +9 -15
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-TPQAT5EI.mjs → react-surface-KAHVDMFX.mjs} +8 -6
- package/dist/lib/browser/react-surface-KAHVDMFX.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node-esm/{ExplorerContainer-OZNG47QB.mjs → ExplorerContainer-LCG425I7.mjs} +16 -13
- package/dist/lib/node-esm/ExplorerContainer-LCG425I7.mjs.map +7 -0
- package/dist/lib/{browser/chunk-JZSBQYJQ.mjs → node-esm/chunk-DOXAIJEC.mjs} +219 -15
- package/dist/lib/node-esm/{chunk-K5BYG7BW.mjs.map → chunk-DOXAIJEC.mjs.map} +4 -4
- package/dist/lib/node-esm/{chunk-3OE6TBJI.mjs → chunk-V42OFY7B.mjs} +4 -3
- package/dist/lib/node-esm/chunk-V42OFY7B.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +9 -15
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-CYHGJJDU.mjs → react-surface-7XILIUI4.mjs} +8 -6
- package/dist/lib/node-esm/react-surface-7XILIUI4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts +3 -3
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +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/Tree/types/tree.d.ts +3 -3
- package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +6 -0
- package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +1 -0
- package/dist/types/src/containers/ExplorerContainer/index.d.ts +3 -0
- package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/types/Graph.d.ts +3 -3
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +35 -35
- package/src/ExplorerPlugin.tsx +2 -2
- package/src/capabilities/react-surface/react-surface.tsx +2 -2
- package/src/components/Chart/Chart.stories.tsx +1 -1
- package/src/components/Globe/Globe.stories.tsx +1 -1
- package/src/components/Graph/D3ForceGraph.stories.tsx +4 -3
- package/src/components/Graph/D3ForceGraph.tsx +6 -5
- package/src/components/Graph/ForceGraph.stories.tsx +4 -3
- package/src/components/Tree/Tree.stories.tsx +1 -1
- package/src/components/Tree/types/tree.ts +2 -2
- package/src/components/index.ts +0 -4
- package/src/{components → containers/ExplorerContainer}/ExplorerContainer.tsx +15 -14
- package/src/containers/ExplorerContainer/index.ts +7 -0
- package/src/containers/index.ts +7 -0
- package/src/types/Graph.ts +3 -2
- package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs.map +0 -7
- package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +0 -7
- package/dist/lib/browser/chunk-KIXHZZ2C.mjs +0 -35
- package/dist/lib/browser/chunk-KIXHZZ2C.mjs.map +0 -7
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs +0 -177
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-TPQAT5EI.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ASRWO2N5.mjs +0 -37
- package/dist/lib/node-esm/chunk-ASRWO2N5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs +0 -179
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-CYHGJJDU.mjs.map +0 -7
- package/dist/types/src/components/ExplorerContainer.d.ts +0 -7
- package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-explorer",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.4a85c3132b",
|
|
4
4
|
"description": "Braneframe data visualization plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
+
"source": "./src/index.ts",
|
|
17
18
|
"browser": "./dist/lib/browser/index.mjs",
|
|
18
19
|
"node": "./dist/lib/node-esm/index.mjs",
|
|
19
|
-
"source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/src/index.d.ts"
|
|
21
21
|
},
|
|
22
22
|
"./meta": {
|
|
23
|
+
"source": "./src/meta.ts",
|
|
23
24
|
"browser": "./dist/lib/browser/meta.mjs",
|
|
24
25
|
"node": "./dist/lib/node-esm/meta.mjs",
|
|
25
|
-
"source": "./src/meta.ts",
|
|
26
26
|
"types": "./dist/types/src/meta.d.ts"
|
|
27
27
|
},
|
|
28
28
|
"./types": {
|
|
29
|
+
"source": "./src/types/index.ts",
|
|
29
30
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
30
31
|
"node": "./dist/lib/node-esm/types/index.mjs",
|
|
31
|
-
"source": "./src/types/index.ts",
|
|
32
32
|
"types": "./dist/types/src/types/index.d.ts"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
@@ -58,29 +58,29 @@
|
|
|
58
58
|
"react-resize-detector": "^11.0.1",
|
|
59
59
|
"three": "^0.178.0",
|
|
60
60
|
"topojson-client": "^3.1.0",
|
|
61
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
62
|
-
"@dxos/async": "0.8.4-main.
|
|
63
|
-
"@dxos/client": "0.8.4-main.
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/echo-query": "0.8.4-main.
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/graph": "0.8.4-main.
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/operation": "0.8.4-main.
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/plugin-
|
|
72
|
-
"@dxos/plugin-
|
|
73
|
-
"@dxos/plugin-
|
|
74
|
-
"@dxos/react-
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/react-ui-
|
|
77
|
-
"@dxos/react-ui-
|
|
78
|
-
"@dxos/react-ui-
|
|
79
|
-
"@dxos/react-
|
|
80
|
-
"@dxos/schema": "0.8.4-main.
|
|
81
|
-
"@dxos/
|
|
82
|
-
"@dxos/
|
|
83
|
-
"@dxos/util": "0.8.4-main.
|
|
61
|
+
"@dxos/app-framework": "0.8.4-main.4a85c3132b",
|
|
62
|
+
"@dxos/async": "0.8.4-main.4a85c3132b",
|
|
63
|
+
"@dxos/client": "0.8.4-main.4a85c3132b",
|
|
64
|
+
"@dxos/app-toolkit": "0.8.4-main.4a85c3132b",
|
|
65
|
+
"@dxos/echo-query": "0.8.4-main.4a85c3132b",
|
|
66
|
+
"@dxos/echo": "0.8.4-main.4a85c3132b",
|
|
67
|
+
"@dxos/graph": "0.8.4-main.4a85c3132b",
|
|
68
|
+
"@dxos/invariant": "0.8.4-main.4a85c3132b",
|
|
69
|
+
"@dxos/operation": "0.8.4-main.4a85c3132b",
|
|
70
|
+
"@dxos/log": "0.8.4-main.4a85c3132b",
|
|
71
|
+
"@dxos/plugin-client": "0.8.4-main.4a85c3132b",
|
|
72
|
+
"@dxos/plugin-search": "0.8.4-main.4a85c3132b",
|
|
73
|
+
"@dxos/plugin-graph": "0.8.4-main.4a85c3132b",
|
|
74
|
+
"@dxos/react-client": "0.8.4-main.4a85c3132b",
|
|
75
|
+
"@dxos/plugin-space": "0.8.4-main.4a85c3132b",
|
|
76
|
+
"@dxos/react-ui-attention": "0.8.4-main.4a85c3132b",
|
|
77
|
+
"@dxos/react-ui-components": "0.8.4-main.4a85c3132b",
|
|
78
|
+
"@dxos/react-ui-graph": "0.8.4-main.4a85c3132b",
|
|
79
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.4a85c3132b",
|
|
80
|
+
"@dxos/schema": "0.8.4-main.4a85c3132b",
|
|
81
|
+
"@dxos/react-ui-stack": "0.8.4-main.4a85c3132b",
|
|
82
|
+
"@dxos/types": "0.8.4-main.4a85c3132b",
|
|
83
|
+
"@dxos/util": "0.8.4-main.4a85c3132b"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@types/d3": "^7.4.3",
|
|
@@ -92,19 +92,19 @@
|
|
|
92
92
|
"@types/topojson-specification": "^1.0.5",
|
|
93
93
|
"react": "~19.2.3",
|
|
94
94
|
"react-dom": "~19.2.3",
|
|
95
|
-
"vite": "7.1.
|
|
96
|
-
"@dxos/
|
|
97
|
-
"@dxos/
|
|
98
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
99
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
100
|
-
"@dxos/echo-generator": "0.8.4-main.
|
|
95
|
+
"vite": "^7.1.11",
|
|
96
|
+
"@dxos/random": "0.8.4-main.4a85c3132b",
|
|
97
|
+
"@dxos/react-ui": "0.8.4-main.4a85c3132b",
|
|
98
|
+
"@dxos/storybook-utils": "0.8.4-main.4a85c3132b",
|
|
99
|
+
"@dxos/ui-theme": "0.8.4-main.4a85c3132b",
|
|
100
|
+
"@dxos/echo-generator": "0.8.4-main.4a85c3132b"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
103
|
"effect": "3.19.16",
|
|
104
104
|
"react": "~19.2.3",
|
|
105
105
|
"react-dom": "~19.2.3",
|
|
106
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
107
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
106
|
+
"@dxos/ui-theme": "0.8.4-main.4a85c3132b",
|
|
107
|
+
"@dxos/react-ui": "0.8.4-main.4a85c3132b"
|
|
108
108
|
},
|
|
109
109
|
"publishConfig": {
|
|
110
110
|
"access": "public"
|
package/src/ExplorerPlugin.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { Plugin } from '@dxos/app-framework';
|
|
|
8
8
|
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
9
|
import { Type } from '@dxos/echo';
|
|
10
10
|
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
11
|
-
import {
|
|
11
|
+
import { ViewModel } from '@dxos/schema';
|
|
12
12
|
|
|
13
13
|
import { ReactSurface } from './capabilities';
|
|
14
14
|
import { meta } from './meta';
|
|
@@ -25,7 +25,7 @@ export const ExplorerPlugin = Plugin.define(meta).pipe(
|
|
|
25
25
|
inputSchema: ExplorerAction.GraphProps,
|
|
26
26
|
createObject: ((props, { db }) =>
|
|
27
27
|
Effect.promise(async () => {
|
|
28
|
-
const { view } = await
|
|
28
|
+
const { view } = await ViewModel.makeFromDatabase({ db, typename: props.typename });
|
|
29
29
|
return Graph.make({ name: props.name, view });
|
|
30
30
|
})) satisfies CreateObject,
|
|
31
31
|
},
|
|
@@ -8,9 +8,9 @@ import React from 'react';
|
|
|
8
8
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
import { Surface } from '@dxos/app-framework/ui';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { type View } from '@dxos/
|
|
11
|
+
import { type View } from '@dxos/echo';
|
|
12
12
|
|
|
13
|
-
import { ExplorerContainer } from '../../
|
|
13
|
+
import { ExplorerContainer } from '../../containers';
|
|
14
14
|
import { meta } from '../../meta';
|
|
15
15
|
import { Graph } from '../../types';
|
|
16
16
|
|
|
@@ -32,7 +32,7 @@ const Story = () => {
|
|
|
32
32
|
export const Default = () => <ClientRepeater component={Story} />;
|
|
33
33
|
|
|
34
34
|
const meta = {
|
|
35
|
-
title: 'plugins/plugin-explorer/Chart',
|
|
35
|
+
title: 'plugins/plugin-explorer/components/Chart',
|
|
36
36
|
component: Chart,
|
|
37
37
|
decorators: [withTheme(), withLayout()],
|
|
38
38
|
parameters: {
|
|
@@ -6,13 +6,14 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Type } from '@dxos/echo';
|
|
9
|
+
import { View } from '@dxos/echo';
|
|
9
10
|
import { faker } from '@dxos/random';
|
|
10
11
|
import { useClient } from '@dxos/react-client';
|
|
11
12
|
import { type Space } from '@dxos/react-client/echo';
|
|
12
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
14
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
14
15
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
|
-
import {
|
|
16
|
+
import { ViewModel } from '@dxos/schema';
|
|
16
17
|
import { type ValueGenerator } from '@dxos/schema/testing';
|
|
17
18
|
import { withRegistry } from '@dxos/storybook-utils';
|
|
18
19
|
import { render } from '@dxos/storybook-utils';
|
|
@@ -36,7 +37,7 @@ const DefaultStory = () => {
|
|
|
36
37
|
useAsyncEffect(async () => {
|
|
37
38
|
const space = client.spaces.default;
|
|
38
39
|
void generate(space, generator);
|
|
39
|
-
const { view } = await
|
|
40
|
+
const { view } = await ViewModel.makeFromDatabase({ db: space.db, typename: Type.getTypename(Graph.Graph) });
|
|
40
41
|
const graph = Graph.make({ name: 'Test', view });
|
|
41
42
|
space.db.add(graph);
|
|
42
43
|
setSpace(space);
|
|
@@ -52,7 +53,7 @@ const DefaultStory = () => {
|
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
const meta = {
|
|
55
|
-
title: 'plugins/plugin-explorer/D3ForceGraph',
|
|
56
|
+
title: 'plugins/plugin-explorer/components/D3ForceGraph',
|
|
56
57
|
component: D3ForceGraph,
|
|
57
58
|
render: render(DefaultStory),
|
|
58
59
|
decorators: [
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
|
+
import React, { type ComponentPropsWithoutRef, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Obj } from '@dxos/echo';
|
|
8
8
|
import { SelectionModel } from '@dxos/graph';
|
|
@@ -26,10 +26,11 @@ export type D3ForceGraphProps = ThemedClassName<
|
|
|
26
26
|
match?: RegExp;
|
|
27
27
|
selection?: SelectionModel;
|
|
28
28
|
grid?: boolean;
|
|
29
|
-
} & Pick<GraphProps, 'drag'>
|
|
29
|
+
} & Pick<GraphProps, 'drag'> &
|
|
30
|
+
ComponentPropsWithoutRef<'div'>
|
|
30
31
|
>;
|
|
31
32
|
|
|
32
|
-
export const D3ForceGraph = ({ classNames, model, selection: _selection, grid, ...props }: D3ForceGraphProps) => {
|
|
33
|
+
export const D3ForceGraph = ({ classNames, model, selection: _selection, grid, drag, ...props }: D3ForceGraphProps) => {
|
|
33
34
|
const context = useRef<SVGContext>(null);
|
|
34
35
|
const projector = useMemo<GraphForceProjector | undefined>(() => {
|
|
35
36
|
if (context.current) {
|
|
@@ -66,12 +67,12 @@ export const D3ForceGraph = ({ classNames, model, selection: _selection, grid, .
|
|
|
66
67
|
);
|
|
67
68
|
|
|
68
69
|
return (
|
|
69
|
-
<SVG.Root ref={context} classNames={classNames}>
|
|
70
|
+
<SVG.Root ref={context} classNames={classNames} {...props}>
|
|
70
71
|
<SVG.Markers />
|
|
71
72
|
{grid && <SVG.Grid axis />}
|
|
72
73
|
<SVG.Zoom extent={[1 / 2, 2]}>
|
|
73
74
|
<SVG.Graph<SpaceGraphNode, SpaceGraphEdge>
|
|
74
|
-
{
|
|
75
|
+
drag={drag}
|
|
75
76
|
ref={graph}
|
|
76
77
|
model={model}
|
|
77
78
|
projector={projector}
|
|
@@ -6,13 +6,14 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { Type } from '@dxos/echo';
|
|
9
|
+
import { View } from '@dxos/echo';
|
|
9
10
|
import { faker } from '@dxos/random';
|
|
10
11
|
import { useClient } from '@dxos/react-client';
|
|
11
12
|
import { type Space } from '@dxos/react-client/echo';
|
|
12
13
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
14
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
14
15
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
|
-
import {
|
|
16
|
+
import { ViewModel } from '@dxos/schema';
|
|
16
17
|
import { type ValueGenerator } from '@dxos/schema/testing';
|
|
17
18
|
import { withRegistry } from '@dxos/storybook-utils';
|
|
18
19
|
import { render } from '@dxos/storybook-utils';
|
|
@@ -36,7 +37,7 @@ const DefaultStory = () => {
|
|
|
36
37
|
useAsyncEffect(async () => {
|
|
37
38
|
const space = client.spaces.default;
|
|
38
39
|
void generate(space, generator);
|
|
39
|
-
const { view } = await
|
|
40
|
+
const { view } = await ViewModel.makeFromDatabase({ db: space.db, typename: Type.getTypename(Graph.Graph) });
|
|
40
41
|
const graph = Graph.make({ name: 'Test', view });
|
|
41
42
|
space.db.add(graph);
|
|
42
43
|
setSpace(space);
|
|
@@ -52,7 +53,7 @@ const DefaultStory = () => {
|
|
|
52
53
|
};
|
|
53
54
|
|
|
54
55
|
const meta = {
|
|
55
|
-
title: 'plugins/plugin-explorer/ForceGraph',
|
|
56
|
+
title: 'plugins/plugin-explorer/components/ForceGraph',
|
|
56
57
|
component: ForceGraph,
|
|
57
58
|
render: render(DefaultStory),
|
|
58
59
|
decorators: [
|
|
@@ -44,7 +44,7 @@ const DefaultStory = () => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
const meta = {
|
|
47
|
-
title: 'plugins/plugin-explorer/Tree',
|
|
47
|
+
title: 'plugins/plugin-explorer/components/Tree',
|
|
48
48
|
component: Tree as any,
|
|
49
49
|
render: DefaultStory,
|
|
50
50
|
decorators: [withRegistry, withTheme(), withLayout()],
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import { Key, Obj, Type } from '@dxos/echo';
|
|
7
|
+
import { Key, Obj, Ref, Type } from '@dxos/echo';
|
|
8
8
|
import { TestSchema } from '@dxos/echo/testing';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ export const TreeNodeType = Schema.Struct({
|
|
|
14
14
|
id: Key.ObjectId,
|
|
15
15
|
children: Schema.mutable(Schema.Array(Key.ObjectId)),
|
|
16
16
|
data: Schema.mutable(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
|
17
|
-
ref: Schema.optional(
|
|
17
|
+
ref: Schema.optional(Ref.Ref(TestSchema.Expando)),
|
|
18
18
|
}).pipe(Schema.mutable);
|
|
19
19
|
|
|
20
20
|
export interface TreeNodeType extends Schema.Schema.Type<typeof TreeNodeType> {}
|
package/src/components/index.ts
CHANGED
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type ComponentType, lazy } from 'react';
|
|
6
|
-
|
|
7
5
|
export * from './Chart';
|
|
8
6
|
export * from './Globe';
|
|
9
7
|
export * from './Graph';
|
|
10
8
|
export * from './Tree';
|
|
11
|
-
|
|
12
|
-
export const ExplorerContainer: ComponentType<any> = lazy(() => import('./ExplorerContainer'));
|
|
@@ -6,20 +6,19 @@ import React, { useCallback, useMemo, useState } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
|
|
8
8
|
import { type Filter } from '@dxos/echo';
|
|
9
|
+
import { type View } from '@dxos/echo';
|
|
9
10
|
import { QueryBuilder } from '@dxos/echo-query';
|
|
10
11
|
import { useGlobalSearch } from '@dxos/plugin-search';
|
|
11
12
|
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
12
|
-
import {
|
|
13
|
+
import { Panel, Toolbar } from '@dxos/react-ui';
|
|
13
14
|
import { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';
|
|
14
|
-
import { type View } from '@dxos/schema';
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import { D3ForceGraph } from './Graph';
|
|
16
|
+
import { D3ForceGraph } from '../../components';
|
|
17
|
+
import { useGraphModel } from '../../hooks';
|
|
19
18
|
|
|
20
19
|
export type ExplorerContainerProps = SurfaceComponentProps<View.View>;
|
|
21
20
|
|
|
22
|
-
const ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {
|
|
21
|
+
export const ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {
|
|
23
22
|
useObject(view);
|
|
24
23
|
const space = view && getSpace(view);
|
|
25
24
|
const [filter, setFilter] = useState<Filter.Any>();
|
|
@@ -38,15 +37,17 @@ const ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {
|
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
return (
|
|
41
|
-
<
|
|
40
|
+
<Panel.Root role={role}>
|
|
42
41
|
{showToolbar && (
|
|
43
|
-
<Toolbar
|
|
44
|
-
<
|
|
45
|
-
|
|
42
|
+
<Panel.Toolbar asChild>
|
|
43
|
+
<Toolbar.Root>
|
|
44
|
+
<QueryEditor db={space.db} onChange={handleChange} />
|
|
45
|
+
</Toolbar.Root>
|
|
46
|
+
</Panel.Toolbar>
|
|
46
47
|
)}
|
|
47
|
-
<
|
|
48
|
-
|
|
48
|
+
<Panel.Content asChild>
|
|
49
|
+
<D3ForceGraph model={model} match={match} />
|
|
50
|
+
</Panel.Content>
|
|
51
|
+
</Panel.Root>
|
|
49
52
|
);
|
|
50
53
|
};
|
|
51
|
-
|
|
52
|
-
export default ExplorerContainer;
|
package/src/types/Graph.ts
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';
|
|
8
|
+
import { View } from '@dxos/echo';
|
|
8
9
|
import { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
-
import {
|
|
10
|
+
import { ViewAnnotation } from '@dxos/schema';
|
|
10
11
|
|
|
11
12
|
const GraphSchema = Schema.Struct({
|
|
12
13
|
name: Schema.optional(Schema.String),
|
|
13
14
|
|
|
14
|
-
view:
|
|
15
|
+
view: Ref.Ref(View.View).pipe(FormInputAnnotation.set(false)),
|
|
15
16
|
|
|
16
17
|
query: Schema.Struct({
|
|
17
18
|
raw: Schema.optional(Schema.String),
|
|
@@ -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, { useCallback, useMemo, useState } from 'react';\n\nimport { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';\nimport { type Filter } from '@dxos/echo';\nimport { QueryBuilder } from '@dxos/echo-query';\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace, useObject } from '@dxos/react-client/echo';\nimport { Layout, Toolbar } from '@dxos/react-ui';\nimport { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';\nimport { type View } from '@dxos/schema';\n\nimport { useGraphModel } from '../hooks';\n\nimport { D3ForceGraph } from './Graph';\n\nexport type ExplorerContainerProps = SurfaceComponentProps<View.View>;\n\nconst ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {\n useObject(view);\n const space = view && getSpace(view);\n const [filter, setFilter] = useState<Filter.Any>();\n const model = useGraphModel(space, filter);\n const { match } = useGlobalSearch();\n\n const builder = useMemo(() => new QueryBuilder(), []);\n const handleChange = useCallback<NonNullable<QueryEditorProps['onChange']>>((value) => {\n setFilter(builder.build(value).filter);\n }, []);\n\n const showToolbar = role === 'article';\n\n if (!space || !model) {\n return null;\n }\n\n return (\n <Layout.Main role={role} toolbar={showToolbar}>\n {showToolbar && (\n <Toolbar.Root>\n <QueryEditor db={space.db} onChange={handleChange} />\n </Toolbar.Root>\n )}\n <D3ForceGraph model={model} match={match} />\n </Layout.Main>\n );\n};\n\nexport default ExplorerContainer;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;AAIA,OAAOA,SAASC,aAAaC,SAASC,gBAAgB;AAItD,SAASC,oBAAoB;AAC7B,SAASC,uBAAuB;AAChC,SAASC,UAAUC,iBAAiB;AACpC,SAASC,QAAQC,eAAe;AAChC,SAASC,mBAA0C;AASnD,IAAMC,oBAAoB,CAAC,EAAEC,MAAMC,SAASC,KAAI,MAA0B;AACxEC,YAAUD,IAAAA;AACV,QAAME,QAAQF,QAAQG,SAASH,IAAAA;AAC/B,QAAM,CAACI,QAAQC,SAAAA,IAAaC,SAAAA;AAC5B,QAAMC,QAAQC,cAAcN,OAAOE,MAAAA;AACnC,QAAM,EAAEK,MAAK,IAAKC,gBAAAA;AAElB,QAAMC,UAAUC,QAAQ,MAAM,IAAIC,aAAAA,GAAgB,CAAA,CAAE;AACpD,QAAMC,eAAeC,YAAuD,CAACC,UAAAA;AAC3EX,cAAUM,QAAQM,MAAMD,KAAAA,EAAOZ,MAAM;EACvC,GAAG,CAAA,CAAE;AAEL,QAAMc,cAAcpB,SAAS;AAE7B,MAAI,CAACI,SAAS,CAACK,OAAO;AACpB,WAAO;EACT;AAEA,SACE,sBAAA,cAACY,OAAOC,MAAI;IAACtB;IAAYuB,SAASH;KAC/BA,eACC,sBAAA,cAACI,QAAQC,MAAI,MACX,sBAAA,cAACC,aAAAA;IAAYC,IAAIvB,MAAMuB;IAAIC,UAAUZ;OAGzC,sBAAA,cAACa,cAAAA;IAAapB;IAAcE;;AAGlC;AAEA,IAAA,4BAAeZ;",
|
|
6
|
-
"names": ["React", "useCallback", "useMemo", "useState", "QueryBuilder", "useGlobalSearch", "getSpace", "useObject", "Layout", "Toolbar", "QueryEditor", "ExplorerContainer", "role", "subject", "view", "useObject", "space", "getSpace", "filter", "setFilter", "useState", "model", "useGraphModel", "match", "useGlobalSearch", "builder", "useMemo", "QueryBuilder", "handleChange", "useCallback", "value", "build", "showToolbar", "Layout", "Main", "toolbar", "Toolbar", "Root", "QueryEditor", "db", "onChange", "D3ForceGraph"]
|
|
7
|
-
}
|
|
@@ -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 { TypeInputOptionsAnnotation } from '@dxos/plugin-space/types';\n\nexport const GraphProps = Schema.Struct({\n name: Schema.optional(Schema.String),\n // TODO(wittjosiah): This should be a query input instead.\n typename: Schema.String.pipe(\n Schema.annotations({ title: 'Select type' }),\n TypeInputOptionsAnnotation.set({\n location: ['database', 'runtime'],\n kind: ['user'],\n registered: ['registered'],\n }),\n Schema.optional,\n ),\n});\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Filter, Obj, Query, QueryAST, Ref, Type } from '@dxos/echo';\nimport { FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';\nimport { View, ViewAnnotation } from '@dxos/schema';\n\nconst GraphSchema = Schema.Struct({\n name: Schema.optional(Schema.String),\n\n view: Type.Ref(View.View).pipe(FormInputAnnotation.set(false)),\n\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }).pipe(FormInputAnnotation.set(false)),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Graph',\n version: '0.2.0',\n }),\n LabelAnnotation.set(['name']),\n ViewAnnotation.set(true),\n);\nexport interface Graph extends Schema.Schema.Type<typeof GraphSchema> {}\nexport const Graph: Type.Obj<Graph> = GraphSchema as any;\n\ntype MakeProps = Omit<Partial<Obj.MakeProps<typeof Graph>>, 'view'> & {\n view: View.View;\n};\n\n/**\n * Make a graph as a view of a data set.\n */\nexport const make = ({\n name,\n query = { raw: '', ast: Query.select(Filter.nothing()).ast },\n view,\n}: MakeProps): Graph => {\n return Obj.make(Graph, { name, view: Ref.make(view), query });\n};\n\n//\n// V1\n//\n\nexport const GraphV1 = Schema.Struct({\n name: Schema.optional(Schema.String),\n query: Schema.Struct({\n raw: Schema.optional(Schema.String),\n ast: QueryAST.Query,\n }),\n}).pipe(\n Type.object({\n typename: 'dxos.org/type/Graph',\n version: '0.1.0',\n }),\n LabelAnnotation.set(['name']),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kCAAkC;AAEpC,IAAMC,aAAoBC,cAAO;EACtCC,MAAaC,gBAAgBC,aAAM;;EAEnCC,UAAiBD,cAAOE,KACfC,mBAAY;IAAEC,OAAO;EAAc,CAAA,GAC1CC,2BAA2BC,IAAI;IAC7BC,UAAU;MAAC;MAAY;;IACvBC,MAAM;MAAC;;IACPC,YAAY;MAAC;;EACf,CAAA,GACOV,eAAQ;AAEnB,CAAA;;;ACpBA;;;;;;AAIA,YAAYW,aAAY;AAExB,SAASC,QAAQC,KAAKC,OAAOC,UAAUC,KAAKC,YAAY;AACxD,SAASC,qBAAqBC,uBAAuB;AACrD,SAASC,MAAMC,sBAAsB;AAErC,IAAMC,cAAqBC,eAAO;EAChCC,MAAaC,iBAAgBC,cAAM;EAEnCC,MAAMC,KAAKC,IAAIC,KAAKA,IAAI,EAAEC,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;EAEvDC,OAAcX,eAAO;IACnBY,KAAYV,iBAAgBC,cAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA,EAAGP,KAAKC,oBAAoBC,IAAI,KAAA,CAAA;AAClC,CAAA,EAAGF,KACDH,KAAKW,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBT,IAAI;EAAC;CAAO,GAC5BU,eAAeV,IAAI,IAAA,CAAA;AAGd,IAAMW,QAAyBtB;AAS/B,IAAMuB,OAAO,CAAC,EACnBrB,MACAU,QAAQ;EAAEC,KAAK;EAAIC,KAAKE,MAAMQ,OAAOC,OAAOC,QAAO,CAAA,EAAIZ;AAAI,GAC3DT,KAAI,MACM;AACV,SAAOsB,IAAIJ,KAAKD,OAAO;IAAEpB;IAAMG,MAAME,IAAIgB,KAAKlB,IAAAA;IAAOO;EAAM,CAAA;AAC7D;AAMO,IAAMgB,UAAiB3B,eAAO;EACnCC,MAAaC,iBAAgBC,cAAM;EACnCQ,OAAcX,eAAO;IACnBY,KAAYV,iBAAgBC,cAAM;IAClCU,KAAKC,SAASC;EAChB,CAAA;AACF,CAAA,EAAGP,KACDH,KAAKW,OAAO;EACVC,UAAU;EACVC,SAAS;AACX,CAAA,GACAC,gBAAgBT,IAAI;EAAC;CAAO,CAAA;",
|
|
6
|
-
"names": ["Schema", "TypeInputOptionsAnnotation", "GraphProps", "Struct", "name", "optional", "String", "typename", "pipe", "annotations", "title", "TypeInputOptionsAnnotation", "set", "location", "kind", "registered", "Schema", "Filter", "Obj", "Query", "QueryAST", "Ref", "Type", "FormInputAnnotation", "LabelAnnotation", "View", "ViewAnnotation", "GraphSchema", "Struct", "name", "optional", "String", "view", "Type", "Ref", "View", "pipe", "FormInputAnnotation", "set", "query", "raw", "ast", "QueryAST", "Query", "object", "typename", "version", "LabelAnnotation", "ViewAnnotation", "Graph", "make", "select", "Filter", "nothing", "Obj", "GraphV1"]
|
|
7
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// src/hooks/useGraphModel.ts
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { Capabilities } from "@dxos/app-framework";
|
|
4
|
-
import { useCapability } from "@dxos/app-framework/ui";
|
|
5
|
-
import { SpaceGraphModel } from "@dxos/schema";
|
|
6
|
-
var useGraphModel = (space, filter, options, queue) => {
|
|
7
|
-
const registry = useCapability(Capabilities.AtomRegistry);
|
|
8
|
-
const [model, setModel] = useState(void 0);
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
if (!space) {
|
|
11
|
-
void model?.close();
|
|
12
|
-
setModel(void 0);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
if (!model || model.queue !== queue) {
|
|
16
|
-
const model2 = new SpaceGraphModel(registry).setFilter(filter).setOptions(options);
|
|
17
|
-
void model2.open(space.db, queue);
|
|
18
|
-
setModel(model2);
|
|
19
|
-
} else {
|
|
20
|
-
model.setFilter(filter).setOptions(options);
|
|
21
|
-
}
|
|
22
|
-
}, [
|
|
23
|
-
space,
|
|
24
|
-
filter,
|
|
25
|
-
options,
|
|
26
|
-
queue,
|
|
27
|
-
registry
|
|
28
|
-
]);
|
|
29
|
-
return model;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export {
|
|
33
|
-
useGraphModel
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=chunk-KIXHZZ2C.mjs.map
|
|
@@ -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 { Capabilities } from '@dxos/app-framework';\nimport { useCapability } from '@dxos/app-framework/ui';\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 registry = useCapability(Capabilities.AtomRegistry);\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(registry).setFilter(filter).setOptions(options);\n void model.open(space.db, queue);\n setModel(model);\n } else {\n model.setFilter(filter).setOptions(options);\n }\n }, [space, filter, options, queue, registry]);\n\n return model;\n};\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,WAAWC,gBAAgB;AAEpC,SAASC,oBAAoB;AAC7B,SAASC,qBAAqB;AAE9B,SAASC,uBAAoD;AAGtD,IAAMC,gBAAgB,CAC3BC,OACAC,QACAC,SACAC,UAAAA;AAEA,QAAMC,WAAWC,cAAcC,aAAaC,YAAY;AACxD,QAAM,CAACC,OAAOC,QAAAA,IAAYC,SAAsCC,MAAAA;AAChEC,YAAU,MAAA;AACR,QAAI,CAACZ,OAAO;AACV,WAAKQ,OAAOK,MAAAA;AACZJ,eAASE,MAAAA;AACT;IACF;AAGA,QAAI,CAACH,SAASA,MAAML,UAAUA,OAAO;AACnC,YAAMK,SAAQ,IAAIM,gBAAgBV,QAAAA,EAAUW,UAAUd,MAAAA,EAAQe,WAAWd,OAAAA;AACzE,WAAKM,OAAMS,KAAKjB,MAAMkB,IAAIf,KAAAA;AAC1BM,eAASD,MAAAA;IACX,OAAO;AACLA,YAAMO,UAAUd,MAAAA,EAAQe,WAAWd,OAAAA;IACrC;EACF,GAAG;IAACF;IAAOC;IAAQC;IAASC;IAAOC;GAAS;AAE5C,SAAOI;AACT;",
|
|
6
|
-
"names": ["useEffect", "useState", "Capabilities", "useCapability", "SpaceGraphModel", "useGraphModel", "space", "filter", "options", "queue", "registry", "useCapability", "Capabilities", "AtomRegistry", "model", "setModel", "useState", "undefined", "useEffect", "close", "SpaceGraphModel", "setFilter", "setOptions", "open", "db"]
|
|
7
|
-
}
|