@dxos/plugin-explorer 0.8.4-main.c4373fc → 0.8.4-main.c85a9c8dae
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-4RB2TY3G.mjs +48 -0
- package/dist/lib/browser/ExplorerContainer-4RB2TY3G.mjs.map +7 -0
- package/dist/lib/browser/chunk-4NFGHCGO.mjs +84 -0
- package/dist/lib/browser/chunk-4NFGHCGO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UCDNCIRV.mjs → chunk-6AZY4CDH.mjs} +343 -406
- package/dist/lib/{node-esm/chunk-WHKUQG5M.mjs.map → browser/chunk-6AZY4CDH.mjs.map} +4 -4
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2DGFNLRO.mjs → chunk-YNQF4CPY.mjs} +7 -2
- package/dist/lib/browser/chunk-YNQF4CPY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +51 -68
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +2 -1
- package/dist/lib/browser/react-surface-KAHVDMFX.mjs +38 -0
- package/dist/lib/browser/react-surface-KAHVDMFX.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +6 -6
- package/dist/lib/node-esm/ExplorerContainer-LCG425I7.mjs +49 -0
- package/dist/lib/node-esm/ExplorerContainer-LCG425I7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PX6LHR2N.mjs → chunk-DK77RB6M.mjs} +7 -2
- package/dist/lib/node-esm/chunk-DK77RB6M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-WHKUQG5M.mjs → chunk-DOXAIJEC.mjs} +343 -406
- package/dist/lib/{browser/chunk-UCDNCIRV.mjs.map → node-esm/chunk-DOXAIJEC.mjs.map} +4 -4
- 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-V42OFY7B.mjs +85 -0
- package/dist/lib/node-esm/chunk-V42OFY7B.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +51 -68
- 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 +2 -1
- package/dist/lib/node-esm/react-surface-7XILIUI4.mjs +39 -0
- package/dist/lib/node-esm/react-surface-7XILIUI4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +6 -6
- 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/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/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 +18 -16
- 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 +0 -4
- 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/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 +6 -0
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -0
- package/dist/types/src/types/Graph.d.ts +30 -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 +51 -45
- package/src/ExplorerPlugin.tsx +29 -50
- package/src/capabilities/index.ts +1 -4
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +31 -0
- package/src/components/Chart/Chart.stories.tsx +3 -3
- package/src/components/Globe/Globe.stories.tsx +3 -3
- package/src/components/Graph/D3ForceGraph.stories.tsx +30 -14
- package/src/components/Graph/D3ForceGraph.tsx +8 -7
- package/src/components/Graph/ForceGraph.stories.tsx +30 -14
- package/src/components/Graph/adapter.ts +14 -8
- package/src/components/Graph/testing.ts +11 -8
- package/src/components/Tree/Tree.stories.tsx +4 -3
- 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 +40 -19
- package/src/components/Tree/types/types.ts +1 -1
- package/src/components/index.ts +0 -4
- package/src/containers/ExplorerContainer/ExplorerContainer.tsx +53 -0
- package/src/containers/ExplorerContainer/index.ts +7 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useGraphModel.ts +6 -3
- package/src/meta.ts +8 -3
- package/src/translations.ts +4 -2
- package/src/types/ExplorerAction.ts +21 -0
- package/src/types/Graph.ts +63 -0
- package/src/types/index.ts +2 -2
- package/dist/lib/browser/ExplorerContainer-S66JDOAF.mjs +0 -49
- package/dist/lib/browser/ExplorerContainer-S66JDOAF.mjs.map +0 -7
- package/dist/lib/browser/chunk-2DGFNLRO.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MKBRIUT.mjs +0 -31
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
- package/dist/lib/browser/chunk-4ETQJYX4.mjs +0 -38
- package/dist/lib/browser/chunk-4ETQJYX4.mjs.map +0 -7
- package/dist/lib/browser/chunk-NXGP6NTP.mjs +0 -203
- package/dist/lib/browser/chunk-NXGP6NTP.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-OXJJ3PII.mjs +0 -24
- package/dist/lib/browser/intent-resolver-OXJJ3PII.mjs.map +0 -7
- package/dist/lib/browser/react-surface-C4EC6ZDZ.mjs +0 -31
- package/dist/lib/browser/react-surface-C4EC6ZDZ.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-GIJN67DO.mjs +0 -50
- package/dist/lib/node-esm/ExplorerContainer-GIJN67DO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs +0 -33
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JACZE7E.mjs +0 -205
- package/dist/lib/node-esm/chunk-6JACZE7E.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-AGHU3KVI.mjs +0 -39
- package/dist/lib/node-esm/chunk-AGHU3KVI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PX6LHR2N.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-GVM36TJX.mjs +0 -25
- package/dist/lib/node-esm/intent-resolver-GVM36TJX.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-YGGLTBF3.mjs +0 -32
- package/dist/lib/node-esm/react-surface-YGGLTBF3.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/dist/types/src/components/ExplorerContainer.d.ts +0 -9
- package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
- 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/capabilities/intent-resolver.ts +0 -19
- package/src/capabilities/react-surface.tsx +0 -23
- package/src/components/ExplorerContainer.tsx +0 -50
- package/src/types/schema.ts +0 -16
- package/src/types/types.ts +0 -22
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-explorer",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.c85a9c8dae",
|
|
4
4
|
"description": "Braneframe data visualization plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
@@ -11,21 +15,21 @@
|
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
13
17
|
"source": "./src/index.ts",
|
|
14
|
-
"types": "./dist/types/src/index.d.ts",
|
|
15
18
|
"browser": "./dist/lib/browser/index.mjs",
|
|
16
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
19
|
+
"node": "./dist/lib/node-esm/index.mjs",
|
|
20
|
+
"types": "./dist/types/src/index.d.ts"
|
|
17
21
|
},
|
|
18
22
|
"./meta": {
|
|
19
23
|
"source": "./src/meta.ts",
|
|
20
|
-
"types": "./dist/types/src/meta.d.ts",
|
|
21
24
|
"browser": "./dist/lib/browser/meta.mjs",
|
|
22
|
-
"node": "./dist/lib/node-esm/meta.mjs"
|
|
25
|
+
"node": "./dist/lib/node-esm/meta.mjs",
|
|
26
|
+
"types": "./dist/types/src/meta.d.ts"
|
|
23
27
|
},
|
|
24
28
|
"./types": {
|
|
25
29
|
"source": "./src/types/index.ts",
|
|
26
|
-
"types": "./dist/types/src/types/index.d.ts",
|
|
27
30
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
28
|
-
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
31
|
+
"node": "./dist/lib/node-esm/types/index.mjs",
|
|
32
|
+
"types": "./dist/types/src/types/index.d.ts"
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -45,60 +49,62 @@
|
|
|
45
49
|
],
|
|
46
50
|
"dependencies": {
|
|
47
51
|
"3d-force-graph": "^1.76.1",
|
|
52
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
48
53
|
"@observablehq/plot": "^0.6.11",
|
|
49
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
50
|
-
"@preact/signals-core": "^1.12.1",
|
|
51
54
|
"d3": "^7.9.0",
|
|
52
|
-
"effect": "3.
|
|
55
|
+
"effect": "3.19.16",
|
|
53
56
|
"force-graph": "^1.49.4",
|
|
54
57
|
"lodash.defaultsdeep": "^4.6.1",
|
|
55
58
|
"react-resize-detector": "^11.0.1",
|
|
56
59
|
"three": "^0.178.0",
|
|
57
60
|
"topojson-client": "^3.1.0",
|
|
58
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
59
|
-
"@dxos/async": "0.8.4-main.
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/plugin-
|
|
69
|
-
"@dxos/plugin-
|
|
70
|
-
"@dxos/react-client": "0.8.4-main.
|
|
71
|
-
"@dxos/plugin-
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/react-ui-
|
|
74
|
-
"@dxos/react-ui-components": "0.8.4-main.
|
|
75
|
-
"@dxos/
|
|
76
|
-
"@dxos/
|
|
77
|
-
"@dxos/
|
|
61
|
+
"@dxos/app-framework": "0.8.4-main.c85a9c8dae",
|
|
62
|
+
"@dxos/async": "0.8.4-main.c85a9c8dae",
|
|
63
|
+
"@dxos/app-toolkit": "0.8.4-main.c85a9c8dae",
|
|
64
|
+
"@dxos/client": "0.8.4-main.c85a9c8dae",
|
|
65
|
+
"@dxos/echo": "0.8.4-main.c85a9c8dae",
|
|
66
|
+
"@dxos/echo-query": "0.8.4-main.c85a9c8dae",
|
|
67
|
+
"@dxos/graph": "0.8.4-main.c85a9c8dae",
|
|
68
|
+
"@dxos/operation": "0.8.4-main.c85a9c8dae",
|
|
69
|
+
"@dxos/invariant": "0.8.4-main.c85a9c8dae",
|
|
70
|
+
"@dxos/log": "0.8.4-main.c85a9c8dae",
|
|
71
|
+
"@dxos/plugin-client": "0.8.4-main.c85a9c8dae",
|
|
72
|
+
"@dxos/plugin-graph": "0.8.4-main.c85a9c8dae",
|
|
73
|
+
"@dxos/react-client": "0.8.4-main.c85a9c8dae",
|
|
74
|
+
"@dxos/plugin-search": "0.8.4-main.c85a9c8dae",
|
|
75
|
+
"@dxos/plugin-space": "0.8.4-main.c85a9c8dae",
|
|
76
|
+
"@dxos/react-ui-attention": "0.8.4-main.c85a9c8dae",
|
|
77
|
+
"@dxos/react-ui-components": "0.8.4-main.c85a9c8dae",
|
|
78
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.c85a9c8dae",
|
|
79
|
+
"@dxos/react-ui-graph": "0.8.4-main.c85a9c8dae",
|
|
80
|
+
"@dxos/schema": "0.8.4-main.c85a9c8dae",
|
|
81
|
+
"@dxos/react-ui-stack": "0.8.4-main.c85a9c8dae",
|
|
82
|
+
"@dxos/types": "0.8.4-main.c85a9c8dae",
|
|
83
|
+
"@dxos/util": "0.8.4-main.c85a9c8dae"
|
|
78
84
|
},
|
|
79
85
|
"devDependencies": {
|
|
80
86
|
"@types/d3": "^7.4.3",
|
|
81
87
|
"@types/d3-hierarchy": "^3.1.6",
|
|
82
88
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
83
|
-
"@types/react": "~19.2.
|
|
84
|
-
"@types/react-dom": "~19.2.
|
|
89
|
+
"@types/react": "~19.2.7",
|
|
90
|
+
"@types/react-dom": "~19.2.3",
|
|
85
91
|
"@types/topojson-client": "^3.1.4",
|
|
86
92
|
"@types/topojson-specification": "^1.0.5",
|
|
87
|
-
"react": "~19.2.
|
|
88
|
-
"react-dom": "~19.2.
|
|
89
|
-
"vite": "7.1.
|
|
90
|
-
"@dxos/
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/
|
|
93
|
-
"@dxos/
|
|
94
|
-
"@dxos/
|
|
93
|
+
"react": "~19.2.3",
|
|
94
|
+
"react-dom": "~19.2.3",
|
|
95
|
+
"vite": "^7.1.11",
|
|
96
|
+
"@dxos/react-ui": "0.8.4-main.c85a9c8dae",
|
|
97
|
+
"@dxos/storybook-utils": "0.8.4-main.c85a9c8dae",
|
|
98
|
+
"@dxos/random": "0.8.4-main.c85a9c8dae",
|
|
99
|
+
"@dxos/echo-generator": "0.8.4-main.c85a9c8dae",
|
|
100
|
+
"@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
|
|
95
101
|
},
|
|
96
102
|
"peerDependencies": {
|
|
97
|
-
"effect": "
|
|
98
|
-
"react": "
|
|
99
|
-
"react-dom": "
|
|
100
|
-
"@dxos/
|
|
101
|
-
"@dxos/react-ui
|
|
103
|
+
"effect": "3.19.16",
|
|
104
|
+
"react": "~19.2.3",
|
|
105
|
+
"react-dom": "~19.2.3",
|
|
106
|
+
"@dxos/ui-theme": "0.8.4-main.c85a9c8dae",
|
|
107
|
+
"@dxos/react-ui": "0.8.4-main.c85a9c8dae"
|
|
102
108
|
},
|
|
103
109
|
"publishConfig": {
|
|
104
110
|
"access": "public"
|
package/src/ExplorerPlugin.tsx
CHANGED
|
@@ -2,58 +2,37 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
7
|
-
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
8
|
-
import { defineObjectForm } from '@dxos/plugin-space/types';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
9
6
|
|
|
10
|
-
import {
|
|
7
|
+
import { Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
|
+
import { Type } from '@dxos/echo';
|
|
10
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
11
|
+
import { ViewModel } from '@dxos/schema';
|
|
12
|
+
|
|
13
|
+
import { ReactSurface } from './capabilities';
|
|
11
14
|
import { meta } from './meta';
|
|
12
15
|
import { translations } from './translations';
|
|
13
|
-
import { ExplorerAction,
|
|
16
|
+
import { ExplorerAction, Graph } from './types';
|
|
14
17
|
|
|
15
|
-
export const ExplorerPlugin =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
}),
|
|
32
|
-
defineModule({
|
|
33
|
-
id: `${meta.id}/module/object-form`,
|
|
34
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
35
|
-
activate: () =>
|
|
36
|
-
contributes(
|
|
37
|
-
SpaceCapabilities.ObjectForm,
|
|
38
|
-
defineObjectForm({
|
|
39
|
-
objectSchema: ViewType,
|
|
40
|
-
getIntent: () => createIntent(ExplorerAction.Create),
|
|
41
|
-
}),
|
|
42
|
-
),
|
|
43
|
-
}),
|
|
44
|
-
defineModule({
|
|
45
|
-
id: `${meta.id}/module/schema`,
|
|
46
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
47
|
-
activate: () => contributes(ClientCapabilities.Schema, [ViewType]),
|
|
48
|
-
}),
|
|
49
|
-
defineModule({
|
|
50
|
-
id: `${meta.id}/module/react-surface`,
|
|
51
|
-
activatesOn: Events.SetupReactSurface,
|
|
52
|
-
activate: ReactSurface,
|
|
53
|
-
}),
|
|
54
|
-
defineModule({
|
|
55
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
56
|
-
activatesOn: Events.SetupIntentResolver,
|
|
57
|
-
activate: IntentResolver,
|
|
18
|
+
export const ExplorerPlugin = Plugin.define(meta).pipe(
|
|
19
|
+
AppPlugin.addMetadataModule({
|
|
20
|
+
metadata: {
|
|
21
|
+
id: Type.getTypename(Graph.Graph),
|
|
22
|
+
metadata: {
|
|
23
|
+
icon: 'ph--graph--regular',
|
|
24
|
+
iconHue: 'green',
|
|
25
|
+
inputSchema: ExplorerAction.GraphProps,
|
|
26
|
+
createObject: ((props, { db }) =>
|
|
27
|
+
Effect.promise(async () => {
|
|
28
|
+
const { view } = await ViewModel.makeFromDatabase({ db, typename: props.typename });
|
|
29
|
+
return Graph.make({ name: props.name, view });
|
|
30
|
+
})) satisfies CreateObject,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
58
33
|
}),
|
|
59
|
-
])
|
|
34
|
+
AppPlugin.addSchemaModule({ schema: [Graph.Graph] }),
|
|
35
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
36
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
37
|
+
Plugin.make,
|
|
38
|
+
);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { type View } from '@dxos/echo';
|
|
12
|
+
|
|
13
|
+
import { ExplorerContainer } from '../../containers';
|
|
14
|
+
import { meta } from '../../meta';
|
|
15
|
+
import { Graph } from '../../types';
|
|
16
|
+
|
|
17
|
+
export default Capability.makeModule(() =>
|
|
18
|
+
Effect.succeed(
|
|
19
|
+
Capability.contributes(
|
|
20
|
+
Capabilities.ReactSurface,
|
|
21
|
+
Surface.create({
|
|
22
|
+
id: `${meta.id}/article`,
|
|
23
|
+
role: ['article', 'section'],
|
|
24
|
+
filter: (data): data is { subject: View.View } => Obj.instanceOf(Graph.Graph, data.subject),
|
|
25
|
+
component: ({ data, role }) => {
|
|
26
|
+
return <ExplorerContainer role={role} subject={data.subject} />;
|
|
27
|
+
},
|
|
28
|
+
}),
|
|
29
|
+
),
|
|
30
|
+
),
|
|
31
|
+
);
|
|
@@ -6,7 +6,7 @@ import { type Meta } from '@storybook/react-vite';
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
8
|
import { ClientRepeater } from '@dxos/react-client/testing';
|
|
9
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
10
10
|
|
|
11
11
|
import CitiesData from '../../../data/cities.js';
|
|
12
12
|
|
|
@@ -32,9 +32,9 @@ 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
|
-
decorators: [withTheme],
|
|
37
|
+
decorators: [withTheme(), withLayout()],
|
|
38
38
|
parameters: {
|
|
39
39
|
layout: 'fullscreen',
|
|
40
40
|
},
|
|
@@ -10,7 +10,7 @@ import { useResizeDetector } from 'react-resize-detector';
|
|
|
10
10
|
import { feature } from 'topojson-client';
|
|
11
11
|
|
|
12
12
|
import { ClientRepeater } from '@dxos/react-client/testing';
|
|
13
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
14
14
|
|
|
15
15
|
import CitiesData from '../../../data/cities.js';
|
|
16
16
|
import CountriesData from '../../../data/countries-110m.js';
|
|
@@ -80,8 +80,8 @@ const ExtendedStory = () => {
|
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
const meta = {
|
|
83
|
-
title: 'plugins/plugin-explorer/Globe',
|
|
84
|
-
decorators: [withTheme],
|
|
83
|
+
title: 'plugins/plugin-explorer/components/Globe',
|
|
84
|
+
decorators: [withTheme(), withLayout()],
|
|
85
85
|
parameters: {
|
|
86
86
|
layout: 'fullscreen',
|
|
87
87
|
},
|
|
@@ -3,20 +3,24 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React, {
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
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
|
-
import {
|
|
14
|
-
import {
|
|
14
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
15
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
|
+
import { ViewModel } from '@dxos/schema';
|
|
15
17
|
import { type ValueGenerator } from '@dxos/schema/testing';
|
|
18
|
+
import { withRegistry } from '@dxos/storybook-utils';
|
|
16
19
|
import { render } from '@dxos/storybook-utils';
|
|
20
|
+
import { HasRelationship, Organization, Person, Pipeline } from '@dxos/types';
|
|
17
21
|
|
|
18
22
|
import { useGraphModel } from '../../hooks';
|
|
19
|
-
import {
|
|
23
|
+
import { Graph } from '../../types';
|
|
20
24
|
|
|
21
25
|
import { D3ForceGraph } from './D3ForceGraph';
|
|
22
26
|
import { generate } from './testing';
|
|
@@ -28,17 +32,20 @@ faker.seed(1);
|
|
|
28
32
|
const DefaultStory = () => {
|
|
29
33
|
const client = useClient();
|
|
30
34
|
const [space, setSpace] = useState<Space>();
|
|
31
|
-
const [
|
|
32
|
-
|
|
35
|
+
const [graph, setGraph] = useState<Graph.Graph>();
|
|
36
|
+
|
|
37
|
+
useAsyncEffect(async () => {
|
|
33
38
|
const space = client.spaces.default;
|
|
34
39
|
void generate(space, generator);
|
|
35
|
-
const view =
|
|
40
|
+
const { view } = await ViewModel.makeFromDatabase({ db: space.db, typename: Type.getTypename(Graph.Graph) });
|
|
41
|
+
const graph = Graph.make({ name: 'Test', view });
|
|
42
|
+
space.db.add(graph);
|
|
36
43
|
setSpace(space);
|
|
37
|
-
|
|
38
|
-
}, []);
|
|
44
|
+
setGraph(graph);
|
|
45
|
+
}, [client]);
|
|
39
46
|
|
|
40
47
|
const model = useGraphModel(space);
|
|
41
|
-
if (!model || !space || !
|
|
48
|
+
if (!model || !space || !graph) {
|
|
42
49
|
return null;
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -46,14 +53,23 @@ const DefaultStory = () => {
|
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
const meta = {
|
|
49
|
-
title: 'plugins/plugin-explorer/D3ForceGraph',
|
|
56
|
+
title: 'plugins/plugin-explorer/components/D3ForceGraph',
|
|
50
57
|
component: D3ForceGraph,
|
|
51
58
|
render: render(DefaultStory),
|
|
52
59
|
decorators: [
|
|
53
|
-
|
|
60
|
+
withRegistry,
|
|
61
|
+
withTheme(),
|
|
62
|
+
withLayout(),
|
|
54
63
|
withClientProvider({
|
|
55
64
|
createSpace: true,
|
|
56
|
-
types: [
|
|
65
|
+
types: [
|
|
66
|
+
Graph.Graph,
|
|
67
|
+
View.View,
|
|
68
|
+
Organization.Organization,
|
|
69
|
+
Pipeline.Pipeline,
|
|
70
|
+
Person.Person,
|
|
71
|
+
HasRelationship.HasRelationship,
|
|
72
|
+
],
|
|
57
73
|
}),
|
|
58
74
|
],
|
|
59
75
|
parameters: {
|
|
@@ -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';
|
|
@@ -15,8 +15,8 @@ import {
|
|
|
15
15
|
SVG,
|
|
16
16
|
type SVGContext,
|
|
17
17
|
} from '@dxos/react-ui-graph';
|
|
18
|
-
import { getHashStyles } from '@dxos/react-ui-theme';
|
|
19
18
|
import { type SpaceGraphEdge, type SpaceGraphModel, type SpaceGraphNode } from '@dxos/schema';
|
|
19
|
+
import { getHashStyles } from '@dxos/ui-theme';
|
|
20
20
|
|
|
21
21
|
import '@dxos/react-ui-graph/styles/graph.css';
|
|
22
22
|
|
|
@@ -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) {
|
|
@@ -52,7 +53,7 @@ export const D3ForceGraph = ({ classNames, model, selection: _selection, grid, .
|
|
|
52
53
|
|
|
53
54
|
const graph = useRef<GraphController>(null);
|
|
54
55
|
const selection = useMemo(() => _selection ?? new SelectionModel(), [_selection]);
|
|
55
|
-
useEffect(() => graph.current?.repaint(), [selection
|
|
56
|
+
useEffect(() => selection.subscribe(() => graph.current?.repaint()), [selection]);
|
|
56
57
|
|
|
57
58
|
const handleSelect = useCallback<NonNullable<GraphProps['onSelect']>>(
|
|
58
59
|
(node) => {
|
|
@@ -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}
|
|
@@ -3,20 +3,24 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
-
import React, {
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
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
|
-
import {
|
|
14
|
-
import {
|
|
14
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
15
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
|
+
import { ViewModel } from '@dxos/schema';
|
|
15
17
|
import { type ValueGenerator } from '@dxos/schema/testing';
|
|
18
|
+
import { withRegistry } from '@dxos/storybook-utils';
|
|
16
19
|
import { render } from '@dxos/storybook-utils';
|
|
20
|
+
import { HasRelationship, Organization, Person, Pipeline } from '@dxos/types';
|
|
17
21
|
|
|
18
22
|
import { useGraphModel } from '../../hooks';
|
|
19
|
-
import {
|
|
23
|
+
import { Graph } from '../../types';
|
|
20
24
|
|
|
21
25
|
import { ForceGraph } from './ForceGraph';
|
|
22
26
|
import { generate } from './testing';
|
|
@@ -28,17 +32,20 @@ faker.seed(1);
|
|
|
28
32
|
const DefaultStory = () => {
|
|
29
33
|
const client = useClient();
|
|
30
34
|
const [space, setSpace] = useState<Space>();
|
|
31
|
-
const [
|
|
32
|
-
|
|
35
|
+
const [graph, setGraph] = useState<Graph.Graph>();
|
|
36
|
+
|
|
37
|
+
useAsyncEffect(async () => {
|
|
33
38
|
const space = client.spaces.default;
|
|
34
39
|
void generate(space, generator);
|
|
35
|
-
const view =
|
|
40
|
+
const { view } = await ViewModel.makeFromDatabase({ db: space.db, typename: Type.getTypename(Graph.Graph) });
|
|
41
|
+
const graph = Graph.make({ name: 'Test', view });
|
|
42
|
+
space.db.add(graph);
|
|
36
43
|
setSpace(space);
|
|
37
|
-
|
|
38
|
-
}, []);
|
|
44
|
+
setGraph(graph);
|
|
45
|
+
}, [client]);
|
|
39
46
|
|
|
40
47
|
const model = useGraphModel(space);
|
|
41
|
-
if (!model || !space || !
|
|
48
|
+
if (!model || !space || !graph) {
|
|
42
49
|
return null;
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -46,14 +53,23 @@ const DefaultStory = () => {
|
|
|
46
53
|
};
|
|
47
54
|
|
|
48
55
|
const meta = {
|
|
49
|
-
title: 'plugins/plugin-explorer/ForceGraph',
|
|
56
|
+
title: 'plugins/plugin-explorer/components/ForceGraph',
|
|
50
57
|
component: ForceGraph,
|
|
51
58
|
render: render(DefaultStory),
|
|
52
59
|
decorators: [
|
|
53
|
-
|
|
60
|
+
withRegistry,
|
|
61
|
+
withTheme(),
|
|
62
|
+
withLayout(),
|
|
54
63
|
withClientProvider({
|
|
55
64
|
createSpace: true,
|
|
56
|
-
types: [
|
|
65
|
+
types: [
|
|
66
|
+
Graph.Graph,
|
|
67
|
+
View.View,
|
|
68
|
+
HasRelationship.HasRelationship,
|
|
69
|
+
Organization.Organization,
|
|
70
|
+
Pipeline.Pipeline,
|
|
71
|
+
Person.Person,
|
|
72
|
+
],
|
|
57
73
|
}),
|
|
58
74
|
],
|
|
59
75
|
parameters: {
|
|
@@ -25,19 +25,25 @@ export class GraphAdapter implements GraphData {
|
|
|
25
25
|
private readonly _nodes: GraphNode[] = [];
|
|
26
26
|
private readonly _links: GraphLink[] = [];
|
|
27
27
|
|
|
28
|
-
constructor(private readonly graph: Graph) {
|
|
29
|
-
this._nodes = graph.nodes.map((node) => ({
|
|
28
|
+
constructor(private readonly graph: Graph.Any) {
|
|
29
|
+
this._nodes = graph.nodes.map((node: Graph.Node.Any) => ({
|
|
30
30
|
id: node.id,
|
|
31
31
|
type: node.type,
|
|
32
32
|
data: node.data,
|
|
33
33
|
}));
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
// Build a set of node IDs for efficient lookup.
|
|
36
|
+
const nodeIds = new Set(this._nodes.map((node) => node.id));
|
|
37
|
+
|
|
38
|
+
// Filter out edges where source or target node doesn't exist.
|
|
39
|
+
this._links = graph.edges
|
|
40
|
+
.filter((edge: Graph.Edge.Any) => nodeIds.has(edge.source) && nodeIds.has(edge.target))
|
|
41
|
+
.map((edge: Graph.Edge.Any) => ({
|
|
42
|
+
type: edge.type,
|
|
43
|
+
source: edge.source,
|
|
44
|
+
target: edge.target,
|
|
45
|
+
data: edge.data,
|
|
46
|
+
}));
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
get nodes() {
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Space } from '@dxos/client/echo';
|
|
6
6
|
import { type Obj, Query, Relation } from '@dxos/echo';
|
|
7
|
-
import { DataType } from '@dxos/schema';
|
|
8
7
|
import { type TypeSpec, type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
8
|
+
import { HasRelationship, Organization, Person, Pipeline } from '@dxos/types';
|
|
9
9
|
import { range } from '@dxos/util';
|
|
10
10
|
|
|
11
|
-
const getObject = (objects: Obj.
|
|
11
|
+
const getObject = (objects: Obj.Unknown[]) => objects[Math.floor(Math.random() * objects.length)];
|
|
12
12
|
|
|
13
13
|
const defaultTypes: TypeSpec[] = [
|
|
14
|
-
{ type:
|
|
15
|
-
{ type:
|
|
16
|
-
{ type:
|
|
14
|
+
{ type: Organization.Organization, count: 5 },
|
|
15
|
+
{ type: Pipeline.Pipeline, count: 5 },
|
|
16
|
+
{ type: Person.Person, count: 10 },
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
export type GenerateOptions = {
|
|
@@ -24,7 +24,10 @@ export type GenerateOptions = {
|
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
const defaultRelations: GenerateOptions['relations'] = {
|
|
27
|
+
const defaultRelations: GenerateOptions['relations'] = {
|
|
28
|
+
kind: 'friend',
|
|
29
|
+
count: 10,
|
|
30
|
+
};
|
|
28
31
|
|
|
29
32
|
/**
|
|
30
33
|
* @deprecated Use @dxos/schema.
|
|
@@ -38,13 +41,13 @@ export const generate = async (
|
|
|
38
41
|
await createObjects(spec);
|
|
39
42
|
|
|
40
43
|
// Add relations between objects.
|
|
41
|
-
const
|
|
44
|
+
const contacts = await space.db.query(Query.type(Person.Person)).run();
|
|
42
45
|
for (const _ of range(relations.count)) {
|
|
43
46
|
const source = getObject(contacts);
|
|
44
47
|
const target = getObject(contacts);
|
|
45
48
|
if (source.id !== target.id) {
|
|
46
49
|
space.db.add(
|
|
47
|
-
Relation.make(
|
|
50
|
+
Relation.make(HasRelationship.HasRelationship, {
|
|
48
51
|
[Relation.Source]: source,
|
|
49
52
|
[Relation.Target]: target,
|
|
50
53
|
kind: relations.kind,
|
|
@@ -8,7 +8,8 @@ import React, { useEffect, useState } from 'react';
|
|
|
8
8
|
import { faker } from '@dxos/random';
|
|
9
9
|
import { useClient } from '@dxos/react-client';
|
|
10
10
|
import { type ClientRepeatedComponentProps, ClientRepeater } from '@dxos/react-client/testing';
|
|
11
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
12
|
+
import { withRegistry } from '@dxos/storybook-utils';
|
|
12
13
|
|
|
13
14
|
import { Tree, type TreeComponentProps } from './Tree';
|
|
14
15
|
import { Tree as TreeModel, TreeType } from './types';
|
|
@@ -43,10 +44,10 @@ const DefaultStory = () => {
|
|
|
43
44
|
};
|
|
44
45
|
|
|
45
46
|
const meta = {
|
|
46
|
-
title: 'plugins/plugin-explorer/Tree',
|
|
47
|
+
title: 'plugins/plugin-explorer/components/Tree',
|
|
47
48
|
component: Tree as any,
|
|
48
49
|
render: DefaultStory,
|
|
49
|
-
decorators: [withTheme],
|
|
50
|
+
decorators: [withRegistry, withTheme(), withLayout()],
|
|
50
51
|
parameters: {
|
|
51
52
|
layout: 'fullscreen',
|
|
52
53
|
},
|