@dxos/plugin-explorer 0.8.4-main.7ace549 → 0.8.4-main.937b3ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/ExplorerContainer-BFAWRIAJ.mjs +45 -0
- package/dist/lib/browser/ExplorerContainer-BFAWRIAJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ARBGXQFH.mjs → chunk-AGZAGILW.mjs} +135 -148
- package/dist/lib/{node-esm/chunk-NPIP4VEH.mjs.map → browser/chunk-AGZAGILW.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-2MKBRIUT.mjs → chunk-BZMTFAP3.mjs} +8 -5
- package/dist/lib/browser/chunk-BZMTFAP3.mjs.map +7 -0
- package/dist/lib/browser/{chunk-P6FFFVPM.mjs → chunk-DXORXPUJ.mjs} +35 -52
- package/dist/lib/browser/chunk-DXORXPUJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs +177 -0
- package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UBHZGWZQ.mjs → chunk-YNQF4CPY.mjs} +1 -1
- package/dist/lib/browser/chunk-YNQF4CPY.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +42 -54
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/react-surface-24INQLMB.mjs +35 -0
- package/dist/lib/browser/react-surface-24INQLMB.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +1 -2
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs +46 -0
- package/dist/lib/node-esm/ExplorerContainer-YQ2KKBVS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UXZM5VJB.mjs → chunk-DK77RB6M.mjs} +1 -1
- package/dist/lib/node-esm/chunk-DK77RB6M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-3ODK27PU.mjs → chunk-IPIGIQHX.mjs} +8 -5
- package/dist/lib/node-esm/chunk-IPIGIQHX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NPIP4VEH.mjs → chunk-QLMTN2XI.mjs} +135 -148
- package/dist/lib/{browser/chunk-ARBGXQFH.mjs.map → node-esm/chunk-QLMTN2XI.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-4BY2XZET.mjs → chunk-UCH3WYRD.mjs} +35 -52
- package/dist/lib/node-esm/chunk-UCH3WYRD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs +179 -0
- package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +42 -54
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/meta.mjs +1 -1
- package/dist/lib/node-esm/{react-surface-7AAV7GBG.mjs → react-surface-F465WXH7.mjs} +14 -13
- package/dist/lib/node-esm/react-surface-F465WXH7.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +1 -2
- package/dist/types/src/ExplorerPlugin.d.ts +2 -1
- package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/ExplorerContainer.d.ts +3 -5
- package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
- package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
- package/dist/types/src/components/Graph/adapter.d.ts +1 -1
- package/dist/types/src/components/Graph/adapter.d.ts.map +1 -1
- package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
- package/dist/types/src/components/Tree/types/tree.d.ts +16 -14
- 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/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 +4 -5
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/ExplorerAction.d.ts +0 -17
- package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
- package/dist/types/src/types/Graph.d.ts +16 -18
- package/dist/types/src/types/Graph.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +52 -48
- package/src/ExplorerPlugin.tsx +26 -40
- package/src/capabilities/index.ts +1 -4
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +30 -0
- package/src/components/Chart/Chart.stories.tsx +2 -2
- package/src/components/ExplorerContainer.tsx +6 -8
- package/src/components/Globe/Globe.stories.tsx +2 -2
- package/src/components/Graph/D3ForceGraph.stories.tsx +6 -3
- package/src/components/Graph/D3ForceGraph.tsx +2 -2
- package/src/components/Graph/ForceGraph.stories.tsx +6 -3
- package/src/components/Graph/adapter.ts +14 -8
- package/src/components/Graph/testing.ts +6 -3
- package/src/components/Tree/Tree.stories.tsx +3 -2
- package/src/components/Tree/Tree.tsx +8 -3
- package/src/components/Tree/testing/generator.ts +4 -2
- package/src/components/Tree/types/tree.test.ts +3 -1
- package/src/components/Tree/types/tree.ts +39 -18
- package/src/components/Tree/types/types.ts +1 -1
- package/src/hooks/useGraphModel.ts +6 -4
- package/src/meta.ts +2 -2
- package/src/types/ExplorerAction.ts +0 -16
- package/src/types/Graph.ts +3 -4
- package/dist/lib/browser/ExplorerContainer-NOLLVUTE.mjs +0 -50
- package/dist/lib/browser/ExplorerContainer-NOLLVUTE.mjs.map +0 -7
- package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
- package/dist/lib/browser/chunk-6BVXZQPP.mjs +0 -188
- package/dist/lib/browser/chunk-6BVXZQPP.mjs.map +0 -7
- package/dist/lib/browser/chunk-P6FFFVPM.mjs.map +0 -7
- package/dist/lib/browser/chunk-UBHZGWZQ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-EWB3H5KH.mjs +0 -35
- package/dist/lib/browser/intent-resolver-EWB3H5KH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BY2DYCTH.mjs +0 -34
- package/dist/lib/browser/react-surface-BY2DYCTH.mjs.map +0 -7
- package/dist/lib/node-esm/ExplorerContainer-N3S5KSUX.mjs +0 -51
- package/dist/lib/node-esm/ExplorerContainer-N3S5KSUX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4BY2XZET.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CRSVAZNA.mjs +0 -190
- package/dist/lib/node-esm/chunk-CRSVAZNA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UXZM5VJB.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-SH6PW7VF.mjs +0 -36
- package/dist/lib/node-esm/intent-resolver-SH6PW7VF.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-7AAV7GBG.mjs.map +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -23
- package/src/capabilities/react-surface.tsx +0 -26
package/package.json
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-explorer",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.937b3ca",
|
|
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,
|
|
10
14
|
"type": "module",
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
13
|
-
"source": "./src/index.ts",
|
|
14
|
-
"types": "./dist/types/src/index.d.ts",
|
|
15
17
|
"browser": "./dist/lib/browser/index.mjs",
|
|
16
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
18
|
+
"node": "./dist/lib/node-esm/index.mjs",
|
|
19
|
+
"source": "./src/index.ts",
|
|
20
|
+
"types": "./dist/types/src/index.d.ts"
|
|
17
21
|
},
|
|
18
22
|
"./meta": {
|
|
19
|
-
"source": "./src/meta.ts",
|
|
20
|
-
"types": "./dist/types/src/meta.d.ts",
|
|
21
23
|
"browser": "./dist/lib/browser/meta.mjs",
|
|
22
|
-
"node": "./dist/lib/node-esm/meta.mjs"
|
|
24
|
+
"node": "./dist/lib/node-esm/meta.mjs",
|
|
25
|
+
"source": "./src/meta.ts",
|
|
26
|
+
"types": "./dist/types/src/meta.d.ts"
|
|
23
27
|
},
|
|
24
28
|
"./types": {
|
|
25
|
-
"source": "./src/types/index.ts",
|
|
26
|
-
"types": "./dist/types/src/types/index.d.ts",
|
|
27
29
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
28
|
-
"node": "./dist/lib/node-esm/types/index.mjs"
|
|
30
|
+
"node": "./dist/lib/node-esm/types/index.mjs",
|
|
31
|
+
"source": "./src/types/index.ts",
|
|
32
|
+
"types": "./dist/types/src/types/index.d.ts"
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -45,61 +49,61 @@
|
|
|
45
49
|
],
|
|
46
50
|
"dependencies": {
|
|
47
51
|
"3d-force-graph": "^1.76.1",
|
|
52
|
+
"@effect-atom/atom-react": "^0.4.6",
|
|
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.11",
|
|
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/
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/echo": "0.8.4-main.
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/
|
|
64
|
-
"@dxos/
|
|
65
|
-
"@dxos/
|
|
66
|
-
"@dxos/plugin-client": "0.8.4-main.
|
|
67
|
-
"@dxos/plugin-
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/plugin-space": "0.8.4-main.
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
72
|
-
"@dxos/react-ui-components": "0.8.4-main.
|
|
73
|
-
"@dxos/react-ui-graph": "0.8.4-main.
|
|
74
|
-
"@dxos/react-ui-attention": "0.8.4-main.
|
|
75
|
-
"@dxos/react-ui-
|
|
76
|
-
"@dxos/schema": "0.8.4-main.
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
61
|
+
"@dxos/client": "0.8.4-main.937b3ca",
|
|
62
|
+
"@dxos/app-framework": "0.8.4-main.937b3ca",
|
|
63
|
+
"@dxos/echo": "0.8.4-main.937b3ca",
|
|
64
|
+
"@dxos/echo-query": "0.8.4-main.937b3ca",
|
|
65
|
+
"@dxos/graph": "0.8.4-main.937b3ca",
|
|
66
|
+
"@dxos/async": "0.8.4-main.937b3ca",
|
|
67
|
+
"@dxos/log": "0.8.4-main.937b3ca",
|
|
68
|
+
"@dxos/invariant": "0.8.4-main.937b3ca",
|
|
69
|
+
"@dxos/plugin-client": "0.8.4-main.937b3ca",
|
|
70
|
+
"@dxos/plugin-search": "0.8.4-main.937b3ca",
|
|
71
|
+
"@dxos/plugin-graph": "0.8.4-main.937b3ca",
|
|
72
|
+
"@dxos/plugin-space": "0.8.4-main.937b3ca",
|
|
73
|
+
"@dxos/operation": "0.8.4-main.937b3ca",
|
|
74
|
+
"@dxos/react-client": "0.8.4-main.937b3ca",
|
|
75
|
+
"@dxos/react-ui-components": "0.8.4-main.937b3ca",
|
|
76
|
+
"@dxos/react-ui-graph": "0.8.4-main.937b3ca",
|
|
77
|
+
"@dxos/react-ui-attention": "0.8.4-main.937b3ca",
|
|
78
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.937b3ca",
|
|
79
|
+
"@dxos/schema": "0.8.4-main.937b3ca",
|
|
80
|
+
"@dxos/react-ui-stack": "0.8.4-main.937b3ca",
|
|
81
|
+
"@dxos/util": "0.8.4-main.937b3ca",
|
|
82
|
+
"@dxos/types": "0.8.4-main.937b3ca"
|
|
79
83
|
},
|
|
80
84
|
"devDependencies": {
|
|
81
85
|
"@types/d3": "^7.4.3",
|
|
82
86
|
"@types/d3-hierarchy": "^3.1.6",
|
|
83
87
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
84
|
-
"@types/react": "~19.2.
|
|
85
|
-
"@types/react-dom": "~19.2.
|
|
88
|
+
"@types/react": "~19.2.7",
|
|
89
|
+
"@types/react-dom": "~19.2.3",
|
|
86
90
|
"@types/topojson-client": "^3.1.4",
|
|
87
91
|
"@types/topojson-specification": "^1.0.5",
|
|
88
|
-
"react": "~19.2.
|
|
89
|
-
"react-dom": "~19.2.
|
|
92
|
+
"react": "~19.2.3",
|
|
93
|
+
"react-dom": "~19.2.3",
|
|
90
94
|
"vite": "7.1.9",
|
|
91
|
-
"@dxos/
|
|
92
|
-
"@dxos/
|
|
93
|
-
"@dxos/
|
|
94
|
-
"@dxos/
|
|
95
|
-
"@dxos/
|
|
95
|
+
"@dxos/random": "0.8.4-main.937b3ca",
|
|
96
|
+
"@dxos/react-ui": "0.8.4-main.937b3ca",
|
|
97
|
+
"@dxos/echo-generator": "0.8.4-main.937b3ca",
|
|
98
|
+
"@dxos/storybook-utils": "0.8.4-main.937b3ca",
|
|
99
|
+
"@dxos/ui-theme": "0.8.4-main.937b3ca"
|
|
96
100
|
},
|
|
97
101
|
"peerDependencies": {
|
|
98
|
-
"effect": "
|
|
99
|
-
"react": "
|
|
100
|
-
"react-dom": "
|
|
101
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
102
|
-
"@dxos/
|
|
102
|
+
"effect": "3.19.11",
|
|
103
|
+
"react": "~19.2.3",
|
|
104
|
+
"react-dom": "~19.2.3",
|
|
105
|
+
"@dxos/react-ui": "0.8.4-main.937b3ca",
|
|
106
|
+
"@dxos/ui-theme": "0.8.4-main.937b3ca"
|
|
103
107
|
},
|
|
104
108
|
"publishConfig": {
|
|
105
109
|
"access": "public"
|
package/src/ExplorerPlugin.tsx
CHANGED
|
@@ -2,50 +2,36 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Common, Plugin } from '@dxos/app-framework';
|
|
6
8
|
import { Type } from '@dxos/echo';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
+
import { type CreateObject } from '@dxos/plugin-space/types';
|
|
10
|
+
import { View } from '@dxos/schema';
|
|
9
11
|
|
|
10
|
-
import {
|
|
12
|
+
import { ReactSurface } from './capabilities';
|
|
11
13
|
import { meta } from './meta';
|
|
12
14
|
import { translations } from './translations';
|
|
13
15
|
import { ExplorerAction, Graph } from './types';
|
|
14
16
|
|
|
15
|
-
export const ExplorerPlugin =
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
createObjectIntent: ((props, options) =>
|
|
32
|
-
createIntent(ExplorerAction.CreateGraph, { ...props, space: options.space })) satisfies CreateObjectIntent,
|
|
33
|
-
},
|
|
34
|
-
}),
|
|
35
|
-
}),
|
|
36
|
-
defineModule({
|
|
37
|
-
id: `${meta.id}/module/schema`,
|
|
38
|
-
activatesOn: ClientEvents.SetupSchema,
|
|
39
|
-
activate: () => contributes(ClientCapabilities.Schema, [Graph.Graph]),
|
|
40
|
-
}),
|
|
41
|
-
defineModule({
|
|
42
|
-
id: `${meta.id}/module/react-surface`,
|
|
43
|
-
activatesOn: Events.SetupReactSurface,
|
|
44
|
-
activate: ReactSurface,
|
|
45
|
-
}),
|
|
46
|
-
defineModule({
|
|
47
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
48
|
-
activatesOn: Events.SetupIntentResolver,
|
|
49
|
-
activate: IntentResolver,
|
|
17
|
+
export const ExplorerPlugin = Plugin.define(meta).pipe(
|
|
18
|
+
Common.Plugin.addTranslationsModule({ translations }),
|
|
19
|
+
Common.Plugin.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 View.makeFromDatabase({ db, typename: props.typename });
|
|
29
|
+
return Graph.make({ name: props.name, view });
|
|
30
|
+
})) satisfies CreateObject,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
50
33
|
}),
|
|
51
|
-
])
|
|
34
|
+
Common.Plugin.addSchemaModule({ schema: [Graph.Graph] }),
|
|
35
|
+
Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
|
|
36
|
+
Plugin.make,
|
|
37
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { type View } from '@dxos/schema';
|
|
11
|
+
|
|
12
|
+
import { ExplorerContainer } from '../../components';
|
|
13
|
+
import { meta } from '../../meta';
|
|
14
|
+
import { Graph } from '../../types';
|
|
15
|
+
|
|
16
|
+
export default Capability.makeModule(() =>
|
|
17
|
+
Effect.succeed(
|
|
18
|
+
Capability.contributes(
|
|
19
|
+
Common.Capability.ReactSurface,
|
|
20
|
+
Common.createSurface({
|
|
21
|
+
id: `${meta.id}/article`,
|
|
22
|
+
role: ['article', 'section'],
|
|
23
|
+
filter: (data): data is { subject: View.View } => Obj.instanceOf(Graph.Graph, data.subject),
|
|
24
|
+
component: ({ data, role }) => {
|
|
25
|
+
return <ExplorerContainer role={role} subject={data.subject} />;
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
),
|
|
30
|
+
);
|
|
@@ -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
|
|
|
@@ -34,7 +34,7 @@ export const Default = () => <ClientRepeater component={Story} />;
|
|
|
34
34
|
const meta = {
|
|
35
35
|
title: 'plugins/plugin-explorer/Chart',
|
|
36
36
|
component: Chart,
|
|
37
|
-
decorators: [withTheme],
|
|
37
|
+
decorators: [withTheme, withLayout()],
|
|
38
38
|
parameters: {
|
|
39
39
|
layout: 'fullscreen',
|
|
40
40
|
},
|
|
@@ -4,25 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type SurfaceComponentProps } from '@dxos/app-framework/react';
|
|
7
8
|
import { type Filter } from '@dxos/echo';
|
|
8
9
|
import { QueryBuilder } from '@dxos/echo-query';
|
|
9
10
|
import { useGlobalSearch } from '@dxos/plugin-search';
|
|
10
11
|
import { getSpace } from '@dxos/react-client/echo';
|
|
11
12
|
import { Toolbar } from '@dxos/react-ui';
|
|
12
13
|
import { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';
|
|
13
|
-
import {
|
|
14
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
14
15
|
import { type View } from '@dxos/schema';
|
|
15
16
|
|
|
16
17
|
import { useGraphModel } from '../hooks';
|
|
17
18
|
|
|
18
19
|
import { D3ForceGraph } from './Graph';
|
|
19
20
|
|
|
20
|
-
type ExplorerContainerProps =
|
|
21
|
-
role: string;
|
|
22
|
-
view: View.View;
|
|
23
|
-
};
|
|
21
|
+
export type ExplorerContainerProps = SurfaceComponentProps<View.View>;
|
|
24
22
|
|
|
25
|
-
const ExplorerContainer = ({ role, view }: ExplorerContainerProps) => {
|
|
23
|
+
const ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {
|
|
26
24
|
const space = getSpace(view);
|
|
27
25
|
const [filter, setFilter] = useState<Filter.Any>();
|
|
28
26
|
const model = useGraphModel(space, filter);
|
|
@@ -40,14 +38,14 @@ const ExplorerContainer = ({ role, view }: ExplorerContainerProps) => {
|
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
return (
|
|
43
|
-
<
|
|
41
|
+
<Layout.Main role={role} toolbar={showToolbar}>
|
|
44
42
|
{showToolbar && (
|
|
45
43
|
<Toolbar.Root>
|
|
46
44
|
<QueryEditor db={space.db} onChange={handleChange} />
|
|
47
45
|
</Toolbar.Root>
|
|
48
46
|
)}
|
|
49
47
|
<D3ForceGraph model={model} match={match} />
|
|
50
|
-
</
|
|
48
|
+
</Layout.Main>
|
|
51
49
|
);
|
|
52
50
|
};
|
|
53
51
|
|
|
@@ -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';
|
|
@@ -81,7 +81,7 @@ const ExtendedStory = () => {
|
|
|
81
81
|
|
|
82
82
|
const meta = {
|
|
83
83
|
title: 'plugins/plugin-explorer/Globe',
|
|
84
|
-
decorators: [withTheme],
|
|
84
|
+
decorators: [withTheme, withLayout()],
|
|
85
85
|
parameters: {
|
|
86
86
|
layout: 'fullscreen',
|
|
87
87
|
},
|
|
@@ -11,9 +11,10 @@ import { useClient } from '@dxos/react-client';
|
|
|
11
11
|
import { type Space } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
14
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
15
|
import { View } from '@dxos/schema';
|
|
16
16
|
import { type ValueGenerator } from '@dxos/schema/testing';
|
|
17
|
+
import { withRegistry } from '@dxos/storybook-utils';
|
|
17
18
|
import { render } from '@dxos/storybook-utils';
|
|
18
19
|
import { HasRelationship, Organization, Person, Project } from '@dxos/types';
|
|
19
20
|
|
|
@@ -35,12 +36,12 @@ const DefaultStory = () => {
|
|
|
35
36
|
useAsyncEffect(async () => {
|
|
36
37
|
const space = client.spaces.default;
|
|
37
38
|
void generate(space, generator);
|
|
38
|
-
const { view } = await View.
|
|
39
|
+
const { view } = await View.makeFromDatabase({ db: space.db, typename: Type.getTypename(Graph.Graph) });
|
|
39
40
|
const graph = Graph.make({ name: 'Test', view });
|
|
40
41
|
space.db.add(graph);
|
|
41
42
|
setSpace(space);
|
|
42
43
|
setGraph(graph);
|
|
43
|
-
}, []);
|
|
44
|
+
}, [client]);
|
|
44
45
|
|
|
45
46
|
const model = useGraphModel(space);
|
|
46
47
|
if (!model || !space || !graph) {
|
|
@@ -55,7 +56,9 @@ const meta = {
|
|
|
55
56
|
component: D3ForceGraph,
|
|
56
57
|
render: render(DefaultStory),
|
|
57
58
|
decorators: [
|
|
59
|
+
withRegistry,
|
|
58
60
|
withTheme,
|
|
61
|
+
withLayout(),
|
|
59
62
|
withClientProvider({
|
|
60
63
|
createSpace: true,
|
|
61
64
|
types: [
|
|
@@ -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
|
|
|
@@ -52,7 +52,7 @@ export const D3ForceGraph = ({ classNames, model, selection: _selection, grid, .
|
|
|
52
52
|
|
|
53
53
|
const graph = useRef<GraphController>(null);
|
|
54
54
|
const selection = useMemo(() => _selection ?? new SelectionModel(), [_selection]);
|
|
55
|
-
useEffect(() => graph.current?.repaint(), [selection
|
|
55
|
+
useEffect(() => selection.subscribe(() => graph.current?.repaint()), [selection]);
|
|
56
56
|
|
|
57
57
|
const handleSelect = useCallback<NonNullable<GraphProps['onSelect']>>(
|
|
58
58
|
(node) => {
|
|
@@ -11,9 +11,10 @@ import { useClient } from '@dxos/react-client';
|
|
|
11
11
|
import { type Space } from '@dxos/react-client/echo';
|
|
12
12
|
import { withClientProvider } from '@dxos/react-client/testing';
|
|
13
13
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
14
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
15
|
import { View } from '@dxos/schema';
|
|
16
16
|
import { type ValueGenerator } from '@dxos/schema/testing';
|
|
17
|
+
import { withRegistry } from '@dxos/storybook-utils';
|
|
17
18
|
import { render } from '@dxos/storybook-utils';
|
|
18
19
|
import { HasRelationship, Organization, Person, Project } from '@dxos/types';
|
|
19
20
|
|
|
@@ -35,12 +36,12 @@ const DefaultStory = () => {
|
|
|
35
36
|
useAsyncEffect(async () => {
|
|
36
37
|
const space = client.spaces.default;
|
|
37
38
|
void generate(space, generator);
|
|
38
|
-
const { view } = await View.
|
|
39
|
+
const { view } = await View.makeFromDatabase({ db: space.db, typename: Type.getTypename(Graph.Graph) });
|
|
39
40
|
const graph = Graph.make({ name: 'Test', view });
|
|
40
41
|
space.db.add(graph);
|
|
41
42
|
setSpace(space);
|
|
42
43
|
setGraph(graph);
|
|
43
|
-
}, []);
|
|
44
|
+
}, [client]);
|
|
44
45
|
|
|
45
46
|
const model = useGraphModel(space);
|
|
46
47
|
if (!model || !space || !graph) {
|
|
@@ -55,7 +56,9 @@ const meta = {
|
|
|
55
56
|
component: ForceGraph,
|
|
56
57
|
render: render(DefaultStory),
|
|
57
58
|
decorators: [
|
|
59
|
+
withRegistry,
|
|
58
60
|
withTheme,
|
|
61
|
+
withLayout(),
|
|
59
62
|
withClientProvider({
|
|
60
63
|
createSpace: true,
|
|
61
64
|
types: [
|
|
@@ -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() {
|
|
@@ -8,7 +8,7 @@ import { type TypeSpec, type ValueGenerator, createObjectFactory } from '@dxos/s
|
|
|
8
8
|
import { HasRelationship, Organization, Person, Project } 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
14
|
{ type: Organization.Organization, count: 5 },
|
|
@@ -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,7 +41,7 @@ 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);
|
|
@@ -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';
|
|
@@ -46,7 +47,7 @@ const meta = {
|
|
|
46
47
|
title: 'plugins/plugin-explorer/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
|
},
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import { RegistryContext } from '@effect-atom/atom-react';
|
|
6
|
+
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
6
7
|
|
|
7
8
|
import { type Space } from '@dxos/client/echo';
|
|
8
9
|
import { useAsyncState } from '@dxos/react-ui';
|
|
@@ -62,7 +63,11 @@ export type TreeComponentProps<N = unknown> = {
|
|
|
62
63
|
|
|
63
64
|
// TODO(burdon): Label accessor.
|
|
64
65
|
export const Tree = <N,>({ space, selected, variant = 'tidy', onNodeClick }: TreeComponentProps<N>) => {
|
|
65
|
-
const
|
|
66
|
+
const registry = useContext(RegistryContext);
|
|
67
|
+
const [model] = useAsyncState(
|
|
68
|
+
async () => (space ? new SpaceGraphModel(registry).open(space.db) : undefined),
|
|
69
|
+
[space, selected, registry],
|
|
70
|
+
);
|
|
66
71
|
|
|
67
72
|
const [tree, setTree] = useState<TreeNode>();
|
|
68
73
|
useEffect(() => {
|
|
@@ -100,7 +105,7 @@ export const Tree = <N,>({ space, selected, variant = 'tidy', onNodeClick }: Tre
|
|
|
100
105
|
}, [context.current, tree]);
|
|
101
106
|
|
|
102
107
|
return (
|
|
103
|
-
<div onClick={() => onNodeClick?.()}>
|
|
108
|
+
<div className='grow' onClick={() => onNodeClick?.()}>
|
|
104
109
|
<SVG.Root ref={context} />
|
|
105
110
|
</div>
|
|
106
111
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Key } from '@dxos/echo';
|
|
5
|
+
import { Key, Obj } from '@dxos/echo';
|
|
6
6
|
import { range } from '@dxos/util';
|
|
7
7
|
|
|
8
8
|
import { Tree, type TreeNodeType } from '../types';
|
|
@@ -16,7 +16,9 @@ const random = (min: number, max: number) => Math.floor(Math.random() * (max - m
|
|
|
16
16
|
*/
|
|
17
17
|
export const createTree = (spec: NumberOrNumberArray[] = [], createText?: () => string): Tree => {
|
|
18
18
|
const tree = new Tree();
|
|
19
|
-
tree.
|
|
19
|
+
Obj.change(tree.tree, () => {
|
|
20
|
+
tree.root.data = { text: 'root' };
|
|
21
|
+
});
|
|
20
22
|
|
|
21
23
|
const createNodes = (parent: TreeNodeType, spec: NumberOrNumberArray = 0): TreeNodeType[] => {
|
|
22
24
|
const count = Array.isArray(spec) ? random(spec[0], spec[1]) : spec;
|