@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.
Files changed (146) hide show
  1. package/dist/lib/browser/ExplorerContainer-4RB2TY3G.mjs +48 -0
  2. package/dist/lib/browser/ExplorerContainer-4RB2TY3G.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-4NFGHCGO.mjs +84 -0
  4. package/dist/lib/browser/chunk-4NFGHCGO.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-UCDNCIRV.mjs → chunk-6AZY4CDH.mjs} +343 -406
  6. package/dist/lib/{node-esm/chunk-WHKUQG5M.mjs.map → browser/chunk-6AZY4CDH.mjs.map} +4 -4
  7. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  8. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  9. package/dist/lib/browser/{chunk-2DGFNLRO.mjs → chunk-YNQF4CPY.mjs} +7 -2
  10. package/dist/lib/browser/chunk-YNQF4CPY.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +51 -68
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/meta.mjs +2 -1
  15. package/dist/lib/browser/react-surface-KAHVDMFX.mjs +38 -0
  16. package/dist/lib/browser/react-surface-KAHVDMFX.mjs.map +7 -0
  17. package/dist/lib/browser/types/index.mjs +6 -6
  18. package/dist/lib/node-esm/ExplorerContainer-LCG425I7.mjs +49 -0
  19. package/dist/lib/node-esm/ExplorerContainer-LCG425I7.mjs.map +7 -0
  20. package/dist/lib/node-esm/{chunk-PX6LHR2N.mjs → chunk-DK77RB6M.mjs} +7 -2
  21. package/dist/lib/node-esm/chunk-DK77RB6M.mjs.map +7 -0
  22. package/dist/lib/node-esm/{chunk-WHKUQG5M.mjs → chunk-DOXAIJEC.mjs} +343 -406
  23. package/dist/lib/{browser/chunk-UCDNCIRV.mjs.map → node-esm/chunk-DOXAIJEC.mjs.map} +4 -4
  24. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  25. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  26. package/dist/lib/node-esm/chunk-V42OFY7B.mjs +85 -0
  27. package/dist/lib/node-esm/chunk-V42OFY7B.mjs.map +7 -0
  28. package/dist/lib/node-esm/index.mjs +51 -68
  29. package/dist/lib/node-esm/index.mjs.map +4 -4
  30. package/dist/lib/node-esm/meta.json +1 -1
  31. package/dist/lib/node-esm/meta.mjs +2 -1
  32. package/dist/lib/node-esm/react-surface-7XILIUI4.mjs +39 -0
  33. package/dist/lib/node-esm/react-surface-7XILIUI4.mjs.map +7 -0
  34. package/dist/lib/node-esm/types/index.mjs +6 -6
  35. package/dist/types/src/ExplorerPlugin.d.ts +2 -1
  36. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  37. package/dist/types/src/capabilities/index.d.ts +1 -2
  38. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  39. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  40. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  41. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  42. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  43. package/dist/types/src/components/Graph/D3ForceGraph.d.ts +3 -3
  44. package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
  45. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +1 -1
  46. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
  47. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
  48. package/dist/types/src/components/Graph/adapter.d.ts +1 -1
  49. package/dist/types/src/components/Graph/adapter.d.ts.map +1 -1
  50. package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
  51. package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
  52. package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
  54. package/dist/types/src/components/Tree/types/tree.d.ts +18 -16
  55. package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
  56. package/dist/types/src/components/Tree/types/types.d.ts +1 -1
  57. package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
  58. package/dist/types/src/components/index.d.ts +0 -4
  59. package/dist/types/src/components/index.d.ts.map +1 -1
  60. package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +6 -0
  61. package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +1 -0
  62. package/dist/types/src/containers/ExplorerContainer/index.d.ts +3 -0
  63. package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +1 -0
  64. package/dist/types/src/containers/index.d.ts +3 -0
  65. package/dist/types/src/containers/index.d.ts.map +1 -0
  66. package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
  67. package/dist/types/src/meta.d.ts +2 -2
  68. package/dist/types/src/meta.d.ts.map +1 -1
  69. package/dist/types/src/translations.d.ts +17 -10
  70. package/dist/types/src/translations.d.ts.map +1 -1
  71. package/dist/types/src/types/ExplorerAction.d.ts +6 -0
  72. package/dist/types/src/types/ExplorerAction.d.ts.map +1 -0
  73. package/dist/types/src/types/Graph.d.ts +30 -0
  74. package/dist/types/src/types/Graph.d.ts.map +1 -0
  75. package/dist/types/src/types/index.d.ts +2 -2
  76. package/dist/types/src/types/index.d.ts.map +1 -1
  77. package/dist/types/tsconfig.tsbuildinfo +1 -1
  78. package/package.json +51 -45
  79. package/src/ExplorerPlugin.tsx +29 -50
  80. package/src/capabilities/index.ts +1 -4
  81. package/src/capabilities/react-surface/index.ts +7 -0
  82. package/src/capabilities/react-surface/react-surface.tsx +31 -0
  83. package/src/components/Chart/Chart.stories.tsx +3 -3
  84. package/src/components/Globe/Globe.stories.tsx +3 -3
  85. package/src/components/Graph/D3ForceGraph.stories.tsx +30 -14
  86. package/src/components/Graph/D3ForceGraph.tsx +8 -7
  87. package/src/components/Graph/ForceGraph.stories.tsx +30 -14
  88. package/src/components/Graph/adapter.ts +14 -8
  89. package/src/components/Graph/testing.ts +11 -8
  90. package/src/components/Tree/Tree.stories.tsx +4 -3
  91. package/src/components/Tree/Tree.tsx +8 -3
  92. package/src/components/Tree/testing/generator.ts +4 -2
  93. package/src/components/Tree/types/tree.test.ts +5 -3
  94. package/src/components/Tree/types/tree.ts +40 -19
  95. package/src/components/Tree/types/types.ts +1 -1
  96. package/src/components/index.ts +0 -4
  97. package/src/containers/ExplorerContainer/ExplorerContainer.tsx +53 -0
  98. package/src/containers/ExplorerContainer/index.ts +7 -0
  99. package/src/containers/index.ts +7 -0
  100. package/src/hooks/useGraphModel.ts +6 -3
  101. package/src/meta.ts +8 -3
  102. package/src/translations.ts +4 -2
  103. package/src/types/ExplorerAction.ts +21 -0
  104. package/src/types/Graph.ts +63 -0
  105. package/src/types/index.ts +2 -2
  106. package/dist/lib/browser/ExplorerContainer-S66JDOAF.mjs +0 -49
  107. package/dist/lib/browser/ExplorerContainer-S66JDOAF.mjs.map +0 -7
  108. package/dist/lib/browser/chunk-2DGFNLRO.mjs.map +0 -7
  109. package/dist/lib/browser/chunk-2MKBRIUT.mjs +0 -31
  110. package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
  111. package/dist/lib/browser/chunk-4ETQJYX4.mjs +0 -38
  112. package/dist/lib/browser/chunk-4ETQJYX4.mjs.map +0 -7
  113. package/dist/lib/browser/chunk-NXGP6NTP.mjs +0 -203
  114. package/dist/lib/browser/chunk-NXGP6NTP.mjs.map +0 -7
  115. package/dist/lib/browser/intent-resolver-OXJJ3PII.mjs +0 -24
  116. package/dist/lib/browser/intent-resolver-OXJJ3PII.mjs.map +0 -7
  117. package/dist/lib/browser/react-surface-C4EC6ZDZ.mjs +0 -31
  118. package/dist/lib/browser/react-surface-C4EC6ZDZ.mjs.map +0 -7
  119. package/dist/lib/node-esm/ExplorerContainer-GIJN67DO.mjs +0 -50
  120. package/dist/lib/node-esm/ExplorerContainer-GIJN67DO.mjs.map +0 -7
  121. package/dist/lib/node-esm/chunk-3ODK27PU.mjs +0 -33
  122. package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
  123. package/dist/lib/node-esm/chunk-6JACZE7E.mjs +0 -205
  124. package/dist/lib/node-esm/chunk-6JACZE7E.mjs.map +0 -7
  125. package/dist/lib/node-esm/chunk-AGHU3KVI.mjs +0 -39
  126. package/dist/lib/node-esm/chunk-AGHU3KVI.mjs.map +0 -7
  127. package/dist/lib/node-esm/chunk-PX6LHR2N.mjs.map +0 -7
  128. package/dist/lib/node-esm/intent-resolver-GVM36TJX.mjs +0 -25
  129. package/dist/lib/node-esm/intent-resolver-GVM36TJX.mjs.map +0 -7
  130. package/dist/lib/node-esm/react-surface-YGGLTBF3.mjs +0 -32
  131. package/dist/lib/node-esm/react-surface-YGGLTBF3.mjs.map +0 -7
  132. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  133. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  134. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  135. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  136. package/dist/types/src/components/ExplorerContainer.d.ts +0 -9
  137. package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
  138. package/dist/types/src/types/schema.d.ts +0 -12
  139. package/dist/types/src/types/schema.d.ts.map +0 -1
  140. package/dist/types/src/types/types.d.ts +0 -18
  141. package/dist/types/src/types/types.d.ts.map +0 -1
  142. package/src/capabilities/intent-resolver.ts +0 -19
  143. package/src/capabilities/react-surface.tsx +0 -23
  144. package/src/components/ExplorerContainer.tsx +0 -50
  145. package/src/types/schema.ts +0 -16
  146. 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.c4373fc",
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.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.c4373fc",
59
- "@dxos/async": "0.8.4-main.c4373fc",
60
- "@dxos/echo": "0.8.4-main.c4373fc",
61
- "@dxos/echo-query": "0.8.4-main.c4373fc",
62
- "@dxos/client": "0.8.4-main.c4373fc",
63
- "@dxos/graph": "0.8.4-main.c4373fc",
64
- "@dxos/invariant": "0.8.4-main.c4373fc",
65
- "@dxos/live-object": "0.8.4-main.c4373fc",
66
- "@dxos/log": "0.8.4-main.c4373fc",
67
- "@dxos/plugin-graph": "0.8.4-main.c4373fc",
68
- "@dxos/plugin-search": "0.8.4-main.c4373fc",
69
- "@dxos/plugin-client": "0.8.4-main.c4373fc",
70
- "@dxos/react-client": "0.8.4-main.c4373fc",
71
- "@dxos/plugin-space": "0.8.4-main.c4373fc",
72
- "@dxos/react-ui-attention": "0.8.4-main.c4373fc",
73
- "@dxos/react-ui-graph": "0.8.4-main.c4373fc",
74
- "@dxos/react-ui-components": "0.8.4-main.c4373fc",
75
- "@dxos/schema": "0.8.4-main.c4373fc",
76
- "@dxos/util": "0.8.4-main.c4373fc",
77
- "@dxos/react-ui-stack": "0.8.4-main.c4373fc"
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.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",
89
- "vite": "7.1.9",
90
- "@dxos/echo-generator": "0.8.4-main.c4373fc",
91
- "@dxos/random": "0.8.4-main.c4373fc",
92
- "@dxos/react-ui": "0.8.4-main.c4373fc",
93
- "@dxos/react-ui-theme": "0.8.4-main.c4373fc",
94
- "@dxos/storybook-utils": "0.8.4-main.c4373fc"
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": "^3.13.3",
98
- "react": "^19.0.0",
99
- "react-dom": "^19.0.0",
100
- "@dxos/react-ui": "0.8.4-main.c4373fc",
101
- "@dxos/react-ui-theme": "0.8.4-main.c4373fc"
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"
@@ -2,58 +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 { 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, ViewType } from './types';
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: ViewType.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: 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
+ );
@@ -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/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, { useEffect, useState } from 'react';
6
+ import React, { useState } from 'react';
7
7
 
8
- import { Obj } from '@dxos/echo';
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 { withTheme } from '@dxos/react-ui/testing';
14
- import { DataType } from '@dxos/schema';
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 { ViewType } from '../../types';
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 [view, setView] = useState<ViewType>();
32
- useEffect(() => {
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 = space.db.add(Obj.make(ViewType, { name: '', type: '' }));
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
- setView(view);
38
- }, []);
44
+ setGraph(graph);
45
+ }, [client]);
39
46
 
40
47
  const model = useGraphModel(space);
41
- if (!model || !space || !view) {
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
- withTheme,
60
+ withRegistry,
61
+ withTheme(),
62
+ withLayout(),
54
63
  withClientProvider({
55
64
  createSpace: true,
56
- types: [ViewType, DataType.Organization, DataType.Project, DataType.Person, DataType.HasRelationship],
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.selected.value]);
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
- {...props}
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, { useEffect, useState } from 'react';
6
+ import React, { useState } from 'react';
7
7
 
8
- import { Obj } from '@dxos/echo';
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 { withTheme } from '@dxos/react-ui/testing';
14
- import { DataType } from '@dxos/schema';
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 { ViewType } from '../../types';
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 [view, setView] = useState<ViewType>();
32
- useEffect(() => {
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 = space.db.add(Obj.make(ViewType, { name: '', type: '' }));
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
- setView(view);
38
- }, []);
44
+ setGraph(graph);
45
+ }, [client]);
39
46
 
40
47
  const model = useGraphModel(space);
41
- if (!model || !space || !view) {
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
- withTheme,
60
+ withRegistry,
61
+ withTheme(),
62
+ withLayout(),
54
63
  withClientProvider({
55
64
  createSpace: true,
56
- types: [ViewType, DataType.HasRelationship, DataType.Organization, DataType.Project, DataType.Person],
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
- 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';
@@ -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
  },