@dxos/plugin-explorer 0.8.4-main.406dc2a → 0.8.4-main.52d7546f51

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.
Files changed (128) hide show
  1. package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs +45 -0
  2. package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-HIFLWHXR.mjs +83 -0
  4. package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-MOM5KCKC.mjs → chunk-JZSBQYJQ.mjs} +137 -402
  6. package/dist/lib/{node-esm/chunk-ZCV4U7LT.mjs.map → browser/chunk-JZSBQYJQ.mjs.map} +3 -3
  7. package/dist/lib/browser/{chunk-2MKBRIUT.mjs → chunk-KIXHZZ2C.mjs} +8 -4
  8. package/dist/lib/browser/chunk-KIXHZZ2C.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-MGBT2ZFU.mjs +177 -0
  10. package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-2DGFNLRO.mjs → chunk-YNQF4CPY.mjs} +7 -2
  12. package/dist/lib/browser/chunk-YNQF4CPY.mjs.map +7 -0
  13. package/dist/lib/browser/index.mjs +47 -64
  14. package/dist/lib/browser/index.mjs.map +4 -4
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/meta.mjs +1 -1
  17. package/dist/lib/browser/react-surface-TPQAT5EI.mjs +36 -0
  18. package/dist/lib/browser/react-surface-TPQAT5EI.mjs.map +7 -0
  19. package/dist/lib/browser/types/index.mjs +1 -2
  20. package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs +46 -0
  21. package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs.map +7 -0
  22. package/dist/lib/node-esm/chunk-3OE6TBJI.mjs +84 -0
  23. package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +7 -0
  24. package/dist/lib/node-esm/{chunk-3ODK27PU.mjs → chunk-ASRWO2N5.mjs} +8 -4
  25. package/dist/lib/node-esm/chunk-ASRWO2N5.mjs.map +7 -0
  26. package/dist/lib/node-esm/{chunk-PX6LHR2N.mjs → chunk-DK77RB6M.mjs} +7 -2
  27. package/dist/lib/node-esm/chunk-DK77RB6M.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-ZCV4U7LT.mjs → chunk-K5BYG7BW.mjs} +137 -402
  29. package/dist/lib/{browser/chunk-MOM5KCKC.mjs.map → node-esm/chunk-K5BYG7BW.mjs.map} +3 -3
  30. package/dist/lib/node-esm/chunk-YWJBDETV.mjs +179 -0
  31. package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +7 -0
  32. package/dist/lib/node-esm/index.mjs +47 -64
  33. package/dist/lib/node-esm/index.mjs.map +4 -4
  34. package/dist/lib/node-esm/meta.json +1 -1
  35. package/dist/lib/node-esm/meta.mjs +1 -1
  36. package/dist/lib/node-esm/react-surface-CYHGJJDU.mjs +37 -0
  37. package/dist/lib/node-esm/react-surface-CYHGJJDU.mjs.map +7 -0
  38. package/dist/lib/node-esm/types/index.mjs +1 -2
  39. package/dist/types/src/ExplorerPlugin.d.ts +2 -1
  40. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  41. package/dist/types/src/capabilities/index.d.ts +1 -2
  42. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  43. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  44. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  45. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  46. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  47. package/dist/types/src/components/ExplorerContainer.d.ts +4 -6
  48. package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -1
  49. package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
  50. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
  51. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
  52. package/dist/types/src/components/Graph/adapter.d.ts +1 -1
  53. package/dist/types/src/components/Graph/adapter.d.ts.map +1 -1
  54. package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
  55. package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
  56. package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
  57. package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
  58. package/dist/types/src/components/Tree/types/tree.d.ts +17 -15
  59. package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
  60. package/dist/types/src/components/Tree/types/types.d.ts +1 -1
  61. package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
  62. package/dist/types/src/components/index.d.ts +2 -4
  63. package/dist/types/src/components/index.d.ts.map +1 -1
  64. package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
  65. package/dist/types/src/meta.d.ts +2 -2
  66. package/dist/types/src/meta.d.ts.map +1 -1
  67. package/dist/types/src/translations.d.ts +17 -10
  68. package/dist/types/src/translations.d.ts.map +1 -1
  69. package/dist/types/src/types/ExplorerAction.d.ts +1 -18
  70. package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
  71. package/dist/types/src/types/Graph.d.ts +21 -24
  72. package/dist/types/src/types/Graph.d.ts.map +1 -1
  73. package/dist/types/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +53 -47
  75. package/src/ExplorerPlugin.tsx +28 -51
  76. package/src/capabilities/index.ts +1 -4
  77. package/src/capabilities/react-surface/index.ts +7 -0
  78. package/src/capabilities/react-surface/react-surface.tsx +31 -0
  79. package/src/components/Chart/Chart.stories.tsx +2 -2
  80. package/src/components/ExplorerContainer.tsx +11 -13
  81. package/src/components/Globe/Globe.stories.tsx +2 -2
  82. package/src/components/Graph/D3ForceGraph.stories.tsx +20 -14
  83. package/src/components/Graph/D3ForceGraph.tsx +2 -2
  84. package/src/components/Graph/ForceGraph.stories.tsx +20 -14
  85. package/src/components/Graph/adapter.ts +14 -8
  86. package/src/components/Graph/testing.ts +11 -8
  87. package/src/components/Tree/Tree.stories.tsx +3 -2
  88. package/src/components/Tree/Tree.tsx +8 -3
  89. package/src/components/Tree/testing/generator.ts +4 -2
  90. package/src/components/Tree/types/tree.test.ts +5 -3
  91. package/src/components/Tree/types/tree.ts +39 -18
  92. package/src/components/Tree/types/types.ts +1 -1
  93. package/src/components/index.ts +3 -3
  94. package/src/hooks/useGraphModel.ts +6 -3
  95. package/src/meta.ts +8 -3
  96. package/src/translations.ts +3 -1
  97. package/src/types/ExplorerAction.ts +11 -19
  98. package/src/types/Graph.ts +38 -21
  99. package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs +0 -50
  100. package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs.map +0 -7
  101. package/dist/lib/browser/chunk-2DGFNLRO.mjs.map +0 -7
  102. package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
  103. package/dist/lib/browser/chunk-BZ65T5M3.mjs +0 -79
  104. package/dist/lib/browser/chunk-BZ65T5M3.mjs.map +0 -7
  105. package/dist/lib/browser/chunk-NXGP6NTP.mjs +0 -203
  106. package/dist/lib/browser/chunk-NXGP6NTP.mjs.map +0 -7
  107. package/dist/lib/browser/intent-resolver-K57C3LIX.mjs +0 -31
  108. package/dist/lib/browser/intent-resolver-K57C3LIX.mjs.map +0 -7
  109. package/dist/lib/browser/react-surface-OPBND5W3.mjs +0 -35
  110. package/dist/lib/browser/react-surface-OPBND5W3.mjs.map +0 -7
  111. package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs +0 -51
  112. package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs.map +0 -7
  113. package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
  114. package/dist/lib/node-esm/chunk-6JACZE7E.mjs +0 -205
  115. package/dist/lib/node-esm/chunk-6JACZE7E.mjs.map +0 -7
  116. package/dist/lib/node-esm/chunk-ES6AOMCY.mjs +0 -80
  117. package/dist/lib/node-esm/chunk-ES6AOMCY.mjs.map +0 -7
  118. package/dist/lib/node-esm/chunk-PX6LHR2N.mjs.map +0 -7
  119. package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs +0 -32
  120. package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs.map +0 -7
  121. package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs +0 -36
  122. package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs.map +0 -7
  123. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  124. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  125. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  126. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  127. package/src/capabilities/intent-resolver.ts +0 -21
  128. package/src/capabilities/react-surface.tsx +0 -27
package/package.json CHANGED
@@ -1,31 +1,35 @@
1
1
  {
2
2
  "name": "@dxos/plugin-explorer",
3
- "version": "0.8.4-main.406dc2a",
3
+ "version": "0.8.4-main.52d7546f51",
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,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.18.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.406dc2a",
59
- "@dxos/client": "0.8.4-main.406dc2a",
60
- "@dxos/async": "0.8.4-main.406dc2a",
61
- "@dxos/echo": "0.8.4-main.406dc2a",
62
- "@dxos/echo-query": "0.8.4-main.406dc2a",
63
- "@dxos/graph": "0.8.4-main.406dc2a",
64
- "@dxos/invariant": "0.8.4-main.406dc2a",
65
- "@dxos/live-object": "0.8.4-main.406dc2a",
66
- "@dxos/log": "0.8.4-main.406dc2a",
67
- "@dxos/plugin-client": "0.8.4-main.406dc2a",
68
- "@dxos/plugin-graph": "0.8.4-main.406dc2a",
69
- "@dxos/plugin-search": "0.8.4-main.406dc2a",
70
- "@dxos/react-client": "0.8.4-main.406dc2a",
71
- "@dxos/plugin-space": "0.8.4-main.406dc2a",
72
- "@dxos/react-ui-attention": "0.8.4-main.406dc2a",
73
- "@dxos/react-ui-components": "0.8.4-main.406dc2a",
74
- "@dxos/react-ui-graph": "0.8.4-main.406dc2a",
75
- "@dxos/react-ui-stack": "0.8.4-main.406dc2a",
76
- "@dxos/schema": "0.8.4-main.406dc2a",
77
- "@dxos/util": "0.8.4-main.406dc2a"
61
+ "@dxos/app-framework": "0.8.4-main.52d7546f51",
62
+ "@dxos/async": "0.8.4-main.52d7546f51",
63
+ "@dxos/client": "0.8.4-main.52d7546f51",
64
+ "@dxos/echo-query": "0.8.4-main.52d7546f51",
65
+ "@dxos/app-toolkit": "0.8.4-main.52d7546f51",
66
+ "@dxos/echo": "0.8.4-main.52d7546f51",
67
+ "@dxos/invariant": "0.8.4-main.52d7546f51",
68
+ "@dxos/graph": "0.8.4-main.52d7546f51",
69
+ "@dxos/log": "0.8.4-main.52d7546f51",
70
+ "@dxos/operation": "0.8.4-main.52d7546f51",
71
+ "@dxos/plugin-client": "0.8.4-main.52d7546f51",
72
+ "@dxos/plugin-search": "0.8.4-main.52d7546f51",
73
+ "@dxos/plugin-graph": "0.8.4-main.52d7546f51",
74
+ "@dxos/plugin-space": "0.8.4-main.52d7546f51",
75
+ "@dxos/react-ui-attention": "0.8.4-main.52d7546f51",
76
+ "@dxos/react-ui-components": "0.8.4-main.52d7546f51",
77
+ "@dxos/react-client": "0.8.4-main.52d7546f51",
78
+ "@dxos/react-ui-graph": "0.8.4-main.52d7546f51",
79
+ "@dxos/react-ui-mosaic": "0.8.4-main.52d7546f51",
80
+ "@dxos/schema": "0.8.4-main.52d7546f51",
81
+ "@dxos/react-ui-stack": "0.8.4-main.52d7546f51",
82
+ "@dxos/types": "0.8.4-main.52d7546f51",
83
+ "@dxos/util": "0.8.4-main.52d7546f51"
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.2",
84
- "@types/react-dom": "~19.2.1",
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.0",
88
- "react-dom": "~19.2.0",
93
+ "react": "~19.2.3",
94
+ "react-dom": "~19.2.3",
89
95
  "vite": "7.1.9",
90
- "@dxos/react-ui": "0.8.4-main.406dc2a",
91
- "@dxos/random": "0.8.4-main.406dc2a",
92
- "@dxos/echo-generator": "0.8.4-main.406dc2a",
93
- "@dxos/react-ui-theme": "0.8.4-main.406dc2a",
94
- "@dxos/storybook-utils": "0.8.4-main.406dc2a"
96
+ "@dxos/echo-generator": "0.8.4-main.52d7546f51",
97
+ "@dxos/random": "0.8.4-main.52d7546f51",
98
+ "@dxos/react-ui": "0.8.4-main.52d7546f51",
99
+ "@dxos/ui-theme": "0.8.4-main.52d7546f51",
100
+ "@dxos/storybook-utils": "0.8.4-main.52d7546f51"
95
101
  },
96
102
  "peerDependencies": {
97
- "effect": "^3.13.3",
98
- "react": "^19.0.0",
99
- "react-dom": "^19.0.0",
100
- "@dxos/react-ui": "0.8.4-main.406dc2a",
101
- "@dxos/react-ui-theme": "0.8.4-main.406dc2a"
103
+ "effect": "3.19.16",
104
+ "react": "~19.2.3",
105
+ "react-dom": "~19.2.3",
106
+ "@dxos/react-ui": "0.8.4-main.52d7546f51",
107
+ "@dxos/ui-theme": "0.8.4-main.52d7546f51"
102
108
  },
103
109
  "publishConfig": {
104
110
  "access": "public"
@@ -2,60 +2,37 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, createIntent, defineModule, definePlugin } from '@dxos/app-framework';
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 { IntentResolver, ReactSurface } from './capabilities';
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 { View } from '@dxos/schema';
12
+
13
+ import { ReactSurface } from './capabilities';
11
14
  import { meta } from './meta';
12
15
  import { translations } from './translations';
13
16
  import { ExplorerAction, Graph } from './types';
14
17
 
15
- export const ExplorerPlugin = definePlugin(meta, () => [
16
- defineModule({
17
- id: `${meta.id}/module/translations`,
18
- activatesOn: Events.SetupTranslations,
19
- activate: () => contributes(Capabilities.Translations, translations),
20
- }),
21
- defineModule({
22
- id: `${meta.id}/module/metadata`,
23
- activatesOn: Events.SetupMetadata,
24
- activate: () =>
25
- contributes(Capabilities.Metadata, {
26
- id: Graph.Graph.typename,
27
- metadata: {
28
- icon: 'ph--graph--regular',
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: Graph.Graph,
40
- formSchema: ExplorerAction.GraphProps,
41
- hidden: true,
42
- getIntent: (props, options) => createIntent(ExplorerAction.CreateGraph, { ...props, space: options.space }),
43
- }),
44
- ),
45
- }),
46
- defineModule({
47
- id: `${meta.id}/module/schema`,
48
- activatesOn: ClientEvents.SetupSchema,
49
- activate: () => contributes(ClientCapabilities.Schema, [Graph.Graph]),
50
- }),
51
- defineModule({
52
- id: `${meta.id}/module/react-surface`,
53
- activatesOn: Events.SetupReactSurface,
54
- activate: ReactSurface,
55
- }),
56
- defineModule({
57
- id: `${meta.id}/module/intent-resolver`,
58
- activatesOn: Events.SetupIntentResolver,
59
- 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 View.makeFromDatabase({ db, typename: props.typename });
29
+ return Graph.make({ name: props.name, view });
30
+ })) satisfies CreateObject,
31
+ },
32
+ },
60
33
  }),
61
- ]);
34
+ AppPlugin.addSchemaModule({ schema: [Graph.Graph] }),
35
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
36
+ AppPlugin.addTranslationsModule({ translations }),
37
+ Plugin.make,
38
+ );
@@ -2,7 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
6
-
7
- export const IntentResolver = lazy(() => import('./intent-resolver'));
8
- export const ReactSurface = lazy(() => import('./react-surface'));
5
+ export * from './react-surface';
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -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/schema';
12
+
13
+ import { ExplorerContainer } from '../../components';
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
 
@@ -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,33 +4,31 @@
4
4
 
5
5
  import React, { useCallback, useMemo, useState } from 'react';
6
6
 
7
+ import { type SurfaceComponentProps } from '@dxos/app-toolkit/ui';
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
- import { getSpace } from '@dxos/react-client/echo';
11
- import { Toolbar } from '@dxos/react-ui';
11
+ import { getSpace, useObject } from '@dxos/react-client/echo';
12
+ import { Layout, Toolbar } from '@dxos/react-ui';
12
13
  import { QueryEditor, type QueryEditorProps } from '@dxos/react-ui-components';
13
- import { StackItem } from '@dxos/react-ui-stack';
14
- import { type DataType } from '@dxos/schema';
14
+ import { type View } from '@dxos/schema';
15
15
 
16
16
  import { useGraphModel } from '../hooks';
17
17
 
18
18
  import { D3ForceGraph } from './Graph';
19
19
 
20
- type ExplorerContainerProps = {
21
- role: string;
22
- view: DataType.View;
23
- };
20
+ export type ExplorerContainerProps = SurfaceComponentProps<View.View>;
24
21
 
25
- const ExplorerContainer = ({ role, view }: ExplorerContainerProps) => {
26
- const space = getSpace(view);
22
+ const ExplorerContainer = ({ role, subject: view }: ExplorerContainerProps) => {
23
+ useObject(view);
24
+ const space = view && getSpace(view);
27
25
  const [filter, setFilter] = useState<Filter.Any>();
28
26
  const model = useGraphModel(space, filter);
29
27
  const { match } = useGlobalSearch();
30
28
 
31
29
  const builder = useMemo(() => new QueryBuilder(), []);
32
30
  const handleChange = useCallback<NonNullable<QueryEditorProps['onChange']>>((value) => {
33
- setFilter(builder.build(value));
31
+ setFilter(builder.build(value).filter);
34
32
  }, []);
35
33
 
36
34
  const showToolbar = role === 'article';
@@ -40,14 +38,14 @@ const ExplorerContainer = ({ role, view }: ExplorerContainerProps) => {
40
38
  }
41
39
 
42
40
  return (
43
- <StackItem.Content toolbar={showToolbar}>
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
- </StackItem.Content>
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
  },
@@ -5,15 +5,18 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useState } from 'react';
7
7
 
8
+ import { Type } from '@dxos/echo';
8
9
  import { faker } from '@dxos/random';
9
10
  import { useClient } from '@dxos/react-client';
10
11
  import { type Space } from '@dxos/react-client/echo';
11
12
  import { withClientProvider } from '@dxos/react-client/testing';
12
13
  import { useAsyncEffect } from '@dxos/react-ui';
13
- import { withTheme } from '@dxos/react-ui/testing';
14
- import { DataType } from '@dxos/schema';
14
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
15
+ import { View } from '@dxos/schema';
15
16
  import { type ValueGenerator } from '@dxos/schema/testing';
17
+ import { withRegistry } from '@dxos/storybook-utils';
16
18
  import { render } from '@dxos/storybook-utils';
19
+ import { HasRelationship, Organization, Person, Pipeline } from '@dxos/types';
17
20
 
18
21
  import { useGraphModel } from '../../hooks';
19
22
  import { Graph } from '../../types';
@@ -28,19 +31,20 @@ faker.seed(1);
28
31
  const DefaultStory = () => {
29
32
  const client = useClient();
30
33
  const [space, setSpace] = useState<Space>();
31
- const [view, setView] = useState<DataType.View>();
34
+ const [graph, setGraph] = useState<Graph.Graph>();
32
35
 
33
36
  useAsyncEffect(async () => {
34
37
  const space = client.spaces.default;
35
38
  void generate(space, generator);
36
- const { view } = await Graph.makeView({ client, space, name: 'Test', typename: Graph.Graph.typename });
37
- space.db.add(view);
39
+ const { view } = await View.makeFromDatabase({ db: space.db, typename: Type.getTypename(Graph.Graph) });
40
+ const graph = Graph.make({ name: 'Test', view });
41
+ space.db.add(graph);
38
42
  setSpace(space);
39
- setView(view);
40
- }, []);
43
+ setGraph(graph);
44
+ }, [client]);
41
45
 
42
46
  const model = useGraphModel(space);
43
- if (!model || !space || !view) {
47
+ if (!model || !space || !graph) {
44
48
  return null;
45
49
  }
46
50
 
@@ -52,16 +56,18 @@ const meta = {
52
56
  component: D3ForceGraph,
53
57
  render: render(DefaultStory),
54
58
  decorators: [
55
- withTheme,
59
+ withRegistry,
60
+ withTheme(),
61
+ withLayout(),
56
62
  withClientProvider({
57
63
  createSpace: true,
58
64
  types: [
59
65
  Graph.Graph,
60
- DataType.View,
61
- DataType.Organization,
62
- DataType.Project,
63
- DataType.Person,
64
- DataType.HasRelationship,
66
+ View.View,
67
+ Organization.Organization,
68
+ Pipeline.Pipeline,
69
+ Person.Person,
70
+ HasRelationship.HasRelationship,
65
71
  ],
66
72
  }),
67
73
  ],
@@ -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.selected.value]);
55
+ useEffect(() => selection.subscribe(() => graph.current?.repaint()), [selection]);
56
56
 
57
57
  const handleSelect = useCallback<NonNullable<GraphProps['onSelect']>>(
58
58
  (node) => {
@@ -5,15 +5,18 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useState } from 'react';
7
7
 
8
+ import { Type } from '@dxos/echo';
8
9
  import { faker } from '@dxos/random';
9
10
  import { useClient } from '@dxos/react-client';
10
11
  import { type Space } from '@dxos/react-client/echo';
11
12
  import { withClientProvider } from '@dxos/react-client/testing';
12
13
  import { useAsyncEffect } from '@dxos/react-ui';
13
- import { withTheme } from '@dxos/react-ui/testing';
14
- import { DataType } from '@dxos/schema';
14
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
15
+ import { View } from '@dxos/schema';
15
16
  import { type ValueGenerator } from '@dxos/schema/testing';
17
+ import { withRegistry } from '@dxos/storybook-utils';
16
18
  import { render } from '@dxos/storybook-utils';
19
+ import { HasRelationship, Organization, Person, Pipeline } from '@dxos/types';
17
20
 
18
21
  import { useGraphModel } from '../../hooks';
19
22
  import { Graph } from '../../types';
@@ -28,19 +31,20 @@ faker.seed(1);
28
31
  const DefaultStory = () => {
29
32
  const client = useClient();
30
33
  const [space, setSpace] = useState<Space>();
31
- const [view, setView] = useState<DataType.View>();
34
+ const [graph, setGraph] = useState<Graph.Graph>();
32
35
 
33
36
  useAsyncEffect(async () => {
34
37
  const space = client.spaces.default;
35
38
  void generate(space, generator);
36
- const { view } = await Graph.makeView({ client, space, name: 'Test', typename: Graph.Graph.typename });
37
- space.db.add(view);
39
+ const { view } = await View.makeFromDatabase({ db: space.db, typename: Type.getTypename(Graph.Graph) });
40
+ const graph = Graph.make({ name: 'Test', view });
41
+ space.db.add(graph);
38
42
  setSpace(space);
39
- setView(view);
40
- }, []);
43
+ setGraph(graph);
44
+ }, [client]);
41
45
 
42
46
  const model = useGraphModel(space);
43
- if (!model || !space || !view) {
47
+ if (!model || !space || !graph) {
44
48
  return null;
45
49
  }
46
50
 
@@ -52,16 +56,18 @@ const meta = {
52
56
  component: ForceGraph,
53
57
  render: render(DefaultStory),
54
58
  decorators: [
55
- withTheme,
59
+ withRegistry,
60
+ withTheme(),
61
+ withLayout(),
56
62
  withClientProvider({
57
63
  createSpace: true,
58
64
  types: [
59
65
  Graph.Graph,
60
- DataType.View,
61
- DataType.HasRelationship,
62
- DataType.Organization,
63
- DataType.Project,
64
- DataType.Person,
66
+ View.View,
67
+ HasRelationship.HasRelationship,
68
+ Organization.Organization,
69
+ Pipeline.Pipeline,
70
+ Person.Person,
65
71
  ],
66
72
  }),
67
73
  ],
@@ -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
- this._links = graph.edges.map((edge) => ({
36
- type: edge.type,
37
- source: edge.source,
38
- target: edge.target,
39
- data: edge.data,
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.Any[]) => objects[Math.floor(Math.random() * objects.length)];
11
+ const getObject = (objects: Obj.Unknown[]) => objects[Math.floor(Math.random() * objects.length)];
12
12
 
13
13
  const defaultTypes: TypeSpec[] = [
14
- { type: DataType.Organization, count: 5 },
15
- { type: DataType.Project, count: 5 },
16
- { type: DataType.Person, count: 10 },
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'] = { kind: 'friend', count: 10 };
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 { objects: contacts } = await space.db.query(Query.type(DataType.Person)).run();
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(DataType.HasRelationship, {
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';
@@ -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
  },