@dxos/plugin-explorer 0.8.4-main.1068cf700f → 0.8.4-main.1c7ec43d41

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/{chunk-YNQF4CPY.mjs → chunk-HPIS2WXY.mjs} +2 -2
  2. package/dist/lib/browser/{chunk-YNQF4CPY.mjs.map → chunk-HPIS2WXY.mjs.map} +3 -3
  3. package/dist/lib/browser/{chunk-JZSBQYJQ.mjs → components/index.mjs} +217 -19
  4. package/dist/lib/{node-esm/chunk-K5BYG7BW.mjs.map → browser/components/index.mjs.map} +4 -4
  5. package/dist/lib/browser/{chunk-KIXHZZ2C.mjs → hooks/index.mjs} +18 -13
  6. package/dist/lib/browser/hooks/index.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +4 -92
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/meta.mjs +1 -1
  11. package/dist/lib/browser/types/index.mjs +66 -4
  12. package/dist/lib/browser/types/index.mjs.map +4 -4
  13. package/dist/lib/node-esm/{chunk-DK77RB6M.mjs → chunk-6EUBRHHX.mjs} +2 -2
  14. package/dist/lib/node-esm/{chunk-DK77RB6M.mjs.map → chunk-6EUBRHHX.mjs.map} +3 -3
  15. package/dist/lib/node-esm/{chunk-K5BYG7BW.mjs → components/index.mjs} +216 -19
  16. package/dist/lib/{browser/chunk-JZSBQYJQ.mjs.map → node-esm/components/index.mjs.map} +4 -4
  17. package/dist/lib/node-esm/{chunk-ASRWO2N5.mjs → hooks/index.mjs} +17 -13
  18. package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
  19. package/dist/lib/node-esm/index.mjs +4 -92
  20. package/dist/lib/node-esm/index.mjs.map +4 -4
  21. package/dist/lib/node-esm/meta.json +1 -1
  22. package/dist/lib/node-esm/meta.mjs +1 -1
  23. package/dist/lib/node-esm/types/index.mjs +66 -4
  24. package/dist/lib/node-esm/types/index.mjs.map +4 -4
  25. package/dist/types/data/cities.d.ts +4 -4
  26. package/dist/types/data/cities.d.ts.map +1 -1
  27. package/dist/types/data/countries-110m.d.ts +19 -22
  28. package/dist/types/data/countries-110m.d.ts.map +1 -1
  29. package/dist/types/src/ExplorerPlugin.d.ts +1 -0
  30. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  31. package/dist/types/src/ExplorerPlugin.test.d.ts +2 -0
  32. package/dist/types/src/ExplorerPlugin.test.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/create-object.d.ts +11 -0
  34. package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/index.d.ts +8 -1
  36. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  37. package/dist/types/src/capabilities/react-surface.d.ts +5 -0
  38. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  39. package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
  40. package/dist/types/src/components/Chart/Chart.stories.d.ts +4 -1
  41. package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
  42. package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
  43. package/dist/types/src/components/Globe/Globe.stories.d.ts +5 -2
  44. package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
  45. package/dist/types/src/components/Graph/CanvasForceGraph.d.ts +13 -0
  46. package/dist/types/src/components/Graph/CanvasForceGraph.d.ts.map +1 -0
  47. package/dist/types/src/components/Graph/CanvasForceGraph.stories.d.ts +17 -0
  48. package/dist/types/src/components/Graph/CanvasForceGraph.stories.d.ts.map +1 -0
  49. package/dist/types/src/components/Graph/ForceGraph.d.ts +12 -5
  50. package/dist/types/src/components/Graph/ForceGraph.d.ts.map +1 -1
  51. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +4 -2
  52. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
  53. package/dist/types/src/components/Graph/{adapter.d.ts → graph-adapter.d.ts} +1 -1
  54. package/dist/types/src/components/Graph/graph-adapter.d.ts.map +1 -0
  55. package/dist/types/src/components/Graph/index.d.ts +1 -1
  56. package/dist/types/src/components/Graph/index.d.ts.map +1 -1
  57. package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
  58. package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
  59. package/dist/types/src/components/Tree/Tree.stories.d.ts +5 -1
  60. package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
  61. package/dist/types/src/components/Tree/layout/HierarchicalEdgeBundling.d.ts.map +1 -1
  62. package/dist/types/src/components/Tree/layout/RadialTree.d.ts.map +1 -1
  63. package/dist/types/src/components/Tree/layout/TidyTree.d.ts.map +1 -1
  64. package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
  65. package/dist/types/src/components/Tree/types/tree.d.ts +7 -7
  66. package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
  67. package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
  68. package/dist/types/src/components/index.d.ts +0 -2
  69. package/dist/types/src/components/index.d.ts.map +1 -1
  70. package/dist/types/src/components/plot.d.ts.map +1 -1
  71. package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +6 -0
  72. package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +1 -0
  73. package/dist/types/src/containers/ExplorerContainer/index.d.ts +2 -0
  74. package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +1 -0
  75. package/dist/types/src/containers/index.d.ts +3 -0
  76. package/dist/types/src/containers/index.d.ts.map +1 -0
  77. package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
  78. package/dist/types/src/index.d.ts +2 -3
  79. package/dist/types/src/index.d.ts.map +1 -1
  80. package/dist/types/src/translations.d.ts +28 -26
  81. package/dist/types/src/translations.d.ts.map +1 -1
  82. package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
  83. package/dist/types/src/types/Graph.d.ts +3 -10
  84. package/dist/types/src/types/Graph.d.ts.map +1 -1
  85. package/dist/types/tsconfig.tsbuildinfo +1 -1
  86. package/package.json +67 -47
  87. package/src/ExplorerPlugin.test.ts +26 -0
  88. package/src/ExplorerPlugin.tsx +7 -24
  89. package/src/capabilities/create-object.ts +36 -0
  90. package/src/capabilities/index.ts +4 -1
  91. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +10 -9
  92. package/src/components/Chart/Chart.stories.tsx +15 -22
  93. package/src/components/Globe/Globe.stories.tsx +18 -21
  94. package/src/components/Graph/CanvasForceGraph.stories.tsx +83 -0
  95. package/src/components/Graph/CanvasForceGraph.tsx +124 -0
  96. package/src/components/Graph/ForceGraph.stories.tsx +76 -44
  97. package/src/components/Graph/ForceGraph.tsx +104 -85
  98. package/src/components/Graph/index.ts +1 -1
  99. package/src/components/Tree/Tree.stories.tsx +44 -37
  100. package/src/components/Tree/testing/generator.ts +1 -1
  101. package/src/components/Tree/types/tree.test.ts +3 -4
  102. package/src/components/Tree/types/tree.ts +15 -15
  103. package/src/components/index.ts +0 -4
  104. package/src/{components → containers/ExplorerContainer}/ExplorerContainer.tsx +18 -19
  105. package/src/containers/ExplorerContainer/index.ts +5 -0
  106. package/src/containers/index.ts +7 -0
  107. package/src/hooks/useGraphModel.ts +14 -10
  108. package/src/index.ts +5 -3
  109. package/src/meta.ts +1 -1
  110. package/src/translations.ts +14 -13
  111. package/src/types/ExplorerAction.ts +0 -1
  112. package/src/types/Graph.ts +11 -24
  113. package/src/typings.d.ts +8 -0
  114. package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs +0 -45
  115. package/dist/lib/browser/ExplorerContainer-46BHUF6R.mjs.map +0 -7
  116. package/dist/lib/browser/chunk-HIFLWHXR.mjs +0 -83
  117. package/dist/lib/browser/chunk-HIFLWHXR.mjs.map +0 -7
  118. package/dist/lib/browser/chunk-KIXHZZ2C.mjs.map +0 -7
  119. package/dist/lib/browser/chunk-MGBT2ZFU.mjs +0 -177
  120. package/dist/lib/browser/chunk-MGBT2ZFU.mjs.map +0 -7
  121. package/dist/lib/browser/react-surface-TPQAT5EI.mjs +0 -36
  122. package/dist/lib/browser/react-surface-TPQAT5EI.mjs.map +0 -7
  123. package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs +0 -46
  124. package/dist/lib/node-esm/ExplorerContainer-OZNG47QB.mjs.map +0 -7
  125. package/dist/lib/node-esm/chunk-3OE6TBJI.mjs +0 -84
  126. package/dist/lib/node-esm/chunk-3OE6TBJI.mjs.map +0 -7
  127. package/dist/lib/node-esm/chunk-ASRWO2N5.mjs.map +0 -7
  128. package/dist/lib/node-esm/chunk-YWJBDETV.mjs +0 -179
  129. package/dist/lib/node-esm/chunk-YWJBDETV.mjs.map +0 -7
  130. package/dist/lib/node-esm/react-surface-CYHGJJDU.mjs +0 -37
  131. package/dist/lib/node-esm/react-surface-CYHGJJDU.mjs.map +0 -7
  132. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  133. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  134. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +0 -5
  135. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  136. package/dist/types/src/components/ExplorerContainer.d.ts +0 -7
  137. package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
  138. package/dist/types/src/components/Graph/D3ForceGraph.d.ts +0 -14
  139. package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +0 -1
  140. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +0 -15
  141. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +0 -1
  142. package/dist/types/src/components/Graph/adapter.d.ts.map +0 -1
  143. package/src/capabilities/react-surface/index.ts +0 -7
  144. package/src/components/Graph/D3ForceGraph.stories.tsx +0 -83
  145. package/src/components/Graph/D3ForceGraph.tsx +0 -101
  146. /package/src/components/Graph/{adapter.ts → graph-adapter.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-explorer",
3
- "version": "0.8.4-main.1068cf700f",
3
+ "version": "0.8.4-main.1c7ec43d41",
4
4
  "description": "Braneframe data visualization plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -12,37 +12,55 @@
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": true,
14
14
  "type": "module",
15
+ "imports": {
16
+ "#plugin": "./src/ExplorerPlugin.tsx",
17
+ "#capabilities": "./src/capabilities/index.ts",
18
+ "#components": "./src/components/index.ts",
19
+ "#containers": "./src/containers/index.ts",
20
+ "#hooks": "./src/hooks/index.ts",
21
+ "#meta": "./src/meta.ts",
22
+ "#translations": "./src/translations.ts",
23
+ "#types": "./src/types/index.ts"
24
+ },
15
25
  "exports": {
16
26
  ".": {
27
+ "source": "./src/index.ts",
17
28
  "browser": "./dist/lib/browser/index.mjs",
18
29
  "node": "./dist/lib/node-esm/index.mjs",
19
- "source": "./src/index.ts",
20
30
  "types": "./dist/types/src/index.d.ts"
21
31
  },
22
32
  "./meta": {
33
+ "source": "./src/meta.ts",
23
34
  "browser": "./dist/lib/browser/meta.mjs",
24
35
  "node": "./dist/lib/node-esm/meta.mjs",
25
- "source": "./src/meta.ts",
26
36
  "types": "./dist/types/src/meta.d.ts"
27
37
  },
38
+ "./translations": {
39
+ "source": "./src/translations.ts",
40
+ "types": "./dist/types/src/translations.d.ts",
41
+ "browser": "./dist/lib/browser/translations.mjs",
42
+ "node": "./dist/lib/node-esm/translations.mjs"
43
+ },
44
+ "./components": {
45
+ "source": "./src/components/index.ts",
46
+ "browser": "./dist/lib/browser/components/index.mjs",
47
+ "node": "./dist/lib/node-esm/components/index.mjs",
48
+ "types": "./dist/types/src/components/index.d.ts"
49
+ },
50
+ "./hooks": {
51
+ "source": "./src/hooks/index.ts",
52
+ "browser": "./dist/lib/browser/hooks/index.mjs",
53
+ "node": "./dist/lib/node-esm/hooks/index.mjs",
54
+ "types": "./dist/types/src/hooks/index.d.ts"
55
+ },
28
56
  "./types": {
57
+ "source": "./src/types/index.ts",
29
58
  "browser": "./dist/lib/browser/types/index.mjs",
30
59
  "node": "./dist/lib/node-esm/types/index.mjs",
31
- "source": "./src/types/index.ts",
32
60
  "types": "./dist/types/src/types/index.d.ts"
33
61
  }
34
62
  },
35
63
  "types": "dist/types/src/index.d.ts",
36
- "typesVersions": {
37
- "*": {
38
- "meta": [
39
- "dist/types/src/meta.d.ts"
40
- ],
41
- "types": [
42
- "dist/types/src/types/index.d.ts"
43
- ]
44
- }
45
- },
46
64
  "files": [
47
65
  "dist",
48
66
  "src"
@@ -52,35 +70,35 @@
52
70
  "@effect-atom/atom-react": "^0.5.0",
53
71
  "@observablehq/plot": "^0.6.11",
54
72
  "d3": "^7.9.0",
55
- "effect": "3.19.16",
73
+ "effect": "3.20.0",
56
74
  "force-graph": "^1.49.4",
57
75
  "lodash.defaultsdeep": "^4.6.1",
58
76
  "react-resize-detector": "^11.0.1",
59
77
  "three": "^0.178.0",
60
78
  "topojson-client": "^3.1.0",
61
- "@dxos/app-framework": "0.8.4-main.1068cf700f",
62
- "@dxos/app-toolkit": "0.8.4-main.1068cf700f",
63
- "@dxos/async": "0.8.4-main.1068cf700f",
64
- "@dxos/echo": "0.8.4-main.1068cf700f",
65
- "@dxos/client": "0.8.4-main.1068cf700f",
66
- "@dxos/echo-query": "0.8.4-main.1068cf700f",
67
- "@dxos/log": "0.8.4-main.1068cf700f",
68
- "@dxos/graph": "0.8.4-main.1068cf700f",
69
- "@dxos/invariant": "0.8.4-main.1068cf700f",
70
- "@dxos/plugin-client": "0.8.4-main.1068cf700f",
71
- "@dxos/operation": "0.8.4-main.1068cf700f",
72
- "@dxos/plugin-search": "0.8.4-main.1068cf700f",
73
- "@dxos/plugin-space": "0.8.4-main.1068cf700f",
74
- "@dxos/plugin-graph": "0.8.4-main.1068cf700f",
75
- "@dxos/react-client": "0.8.4-main.1068cf700f",
76
- "@dxos/react-ui-attention": "0.8.4-main.1068cf700f",
77
- "@dxos/react-ui-components": "0.8.4-main.1068cf700f",
78
- "@dxos/react-ui-mosaic": "0.8.4-main.1068cf700f",
79
- "@dxos/react-ui-graph": "0.8.4-main.1068cf700f",
80
- "@dxos/react-ui-stack": "0.8.4-main.1068cf700f",
81
- "@dxos/schema": "0.8.4-main.1068cf700f",
82
- "@dxos/types": "0.8.4-main.1068cf700f",
83
- "@dxos/util": "0.8.4-main.1068cf700f"
79
+ "@dxos/app-framework": "0.8.4-main.1c7ec43d41",
80
+ "@dxos/app-toolkit": "0.8.4-main.1c7ec43d41",
81
+ "@dxos/async": "0.8.4-main.1c7ec43d41",
82
+ "@dxos/echo": "0.8.4-main.1c7ec43d41",
83
+ "@dxos/echo-query": "0.8.4-main.1c7ec43d41",
84
+ "@dxos/compute": "0.8.4-main.1c7ec43d41",
85
+ "@dxos/graph": "0.8.4-main.1c7ec43d41",
86
+ "@dxos/invariant": "0.8.4-main.1c7ec43d41",
87
+ "@dxos/plugin-client": "0.8.4-main.1c7ec43d41",
88
+ "@dxos/log": "0.8.4-main.1c7ec43d41",
89
+ "@dxos/plugin-graph": "0.8.4-main.1c7ec43d41",
90
+ "@dxos/plugin-space": "0.8.4-main.1c7ec43d41",
91
+ "@dxos/plugin-search": "0.8.4-main.1c7ec43d41",
92
+ "@dxos/react-client": "0.8.4-main.1c7ec43d41",
93
+ "@dxos/client": "0.8.4-main.1c7ec43d41",
94
+ "@dxos/react-ui-attention": "0.8.4-main.1c7ec43d41",
95
+ "@dxos/react-ui-components": "0.8.4-main.1c7ec43d41",
96
+ "@dxos/react-ui-graph": "0.8.4-main.1c7ec43d41",
97
+ "@dxos/react-ui-mosaic": "0.8.4-main.1c7ec43d41",
98
+ "@dxos/react-ui-stack": "0.8.4-main.1c7ec43d41",
99
+ "@dxos/schema": "0.8.4-main.1c7ec43d41",
100
+ "@dxos/types": "0.8.4-main.1c7ec43d41",
101
+ "@dxos/util": "0.8.4-main.1c7ec43d41"
84
102
  },
85
103
  "devDependencies": {
86
104
  "@types/d3": "^7.4.3",
@@ -92,19 +110,21 @@
92
110
  "@types/topojson-specification": "^1.0.5",
93
111
  "react": "~19.2.3",
94
112
  "react-dom": "~19.2.3",
95
- "vite": "7.1.9",
96
- "@dxos/echo-generator": "0.8.4-main.1068cf700f",
97
- "@dxos/random": "0.8.4-main.1068cf700f",
98
- "@dxos/react-ui": "0.8.4-main.1068cf700f",
99
- "@dxos/storybook-utils": "0.8.4-main.1068cf700f",
100
- "@dxos/ui-theme": "0.8.4-main.1068cf700f"
113
+ "vite": "^8.0.10",
114
+ "@dxos/echo-generator": "0.8.4-main.1c7ec43d41",
115
+ "@dxos/plugin-preview": "0.8.4-main.1c7ec43d41",
116
+ "@dxos/random": "0.8.4-main.1c7ec43d41",
117
+ "@dxos/ui-theme": "0.8.4-main.1c7ec43d41",
118
+ "@dxos/plugin-testing": "0.8.4-main.1c7ec43d41",
119
+ "@dxos/react-ui": "0.8.4-main.1c7ec43d41",
120
+ "@dxos/storybook-utils": "0.8.4-main.1c7ec43d41"
101
121
  },
102
122
  "peerDependencies": {
103
- "effect": "3.19.16",
123
+ "effect": "3.20.0",
104
124
  "react": "~19.2.3",
105
125
  "react-dom": "~19.2.3",
106
- "@dxos/react-ui": "0.8.4-main.1068cf700f",
107
- "@dxos/ui-theme": "0.8.4-main.1068cf700f"
126
+ "@dxos/react-ui": "0.8.4-main.1c7ec43d41",
127
+ "@dxos/ui-theme": "0.8.4-main.1c7ec43d41"
108
128
  },
109
129
  "publishConfig": {
110
130
  "access": "public"
@@ -0,0 +1,26 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { describe, test } from 'vitest';
6
+
7
+ import { ClientPlugin } from '@dxos/plugin-client';
8
+ import { createComposerTestApp } from '@dxos/plugin-testing/harness';
9
+
10
+ import { ExplorerPlugin } from '#plugin';
11
+
12
+ import { meta } from './meta';
13
+
14
+ const moduleId = (name: string) => `${meta.id}.module.${name}`;
15
+
16
+ describe('ExplorerPlugin', () => {
17
+ test('modules activate on the expected events', async ({ expect }) => {
18
+ await using harness = await createComposerTestApp({
19
+ plugins: [ClientPlugin({}), ExplorerPlugin()],
20
+ });
21
+
22
+ expect(harness.manager.getActive()).toEqual(
23
+ expect.arrayContaining([moduleId('CreateObject'), moduleId('schema'), moduleId('ReactSurface')]),
24
+ );
25
+ });
26
+ });
@@ -2,37 +2,20 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import * as Effect from 'effect/Effect';
6
-
7
5
  import { Plugin } from '@dxos/app-framework';
8
6
  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
7
 
13
- import { ReactSurface } from './capabilities';
14
- import { meta } from './meta';
15
- import { translations } from './translations';
16
- import { ExplorerAction, Graph } from './types';
8
+ import { CreateObject, ReactSurface } from '#capabilities';
9
+ import { meta } from '#meta';
10
+ import { translations } from '#translations';
11
+ import { Graph } from '#types';
17
12
 
18
13
  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
- },
33
- }),
14
+ AppPlugin.addCreateObjectModule({ activate: CreateObject }),
34
15
  AppPlugin.addSchemaModule({ schema: [Graph.Graph] }),
35
16
  AppPlugin.addSurfaceModule({ activate: ReactSurface }),
36
17
  AppPlugin.addTranslationsModule({ translations }),
37
18
  Plugin.make,
38
19
  );
20
+
21
+ export default ExplorerPlugin;
@@ -0,0 +1,36 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { Operation } from '@dxos/compute';
9
+ import { Type } from '@dxos/echo';
10
+ import { SpaceOperation } from '@dxos/plugin-space/operations';
11
+ import { SpaceCapabilities } from '@dxos/plugin-space/types';
12
+ import { ViewModel } from '@dxos/schema';
13
+
14
+ import { ExplorerAction, Graph } from '#types';
15
+
16
+ export default Capability.makeModule(
17
+ Effect.fnUntraced(function* () {
18
+ return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
19
+ id: Type.getTypename(Graph.Graph),
20
+ inputSchema: ExplorerAction.GraphProps,
21
+ createObject: (props, options) =>
22
+ Effect.gen(function* () {
23
+ const object = yield* Effect.promise(async () => {
24
+ const { view } = await ViewModel.makeFromDatabase({ db: options.db, typename: props.typename });
25
+ return Graph.make({ name: props.name, view });
26
+ });
27
+ return yield* Operation.invoke(SpaceOperation.AddObject, {
28
+ object,
29
+ target: options.target,
30
+ hidden: true,
31
+ targetNodeId: options.targetNodeId,
32
+ });
33
+ }),
34
+ });
35
+ }),
36
+ );
@@ -2,4 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './react-surface';
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
8
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -7,23 +7,24 @@ import React from 'react';
7
7
 
8
8
  import { Capabilities, Capability } from '@dxos/app-framework';
9
9
  import { Surface } from '@dxos/app-framework/ui';
10
- import { Obj } from '@dxos/echo';
11
- import { type View } from '@dxos/schema';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
12
11
 
13
- import { ExplorerContainer } from '../../components';
14
- import { meta } from '../../meta';
15
- import { Graph } from '../../types';
12
+ import { ExplorerContainer } from '#containers';
13
+ import { Graph } from '#types';
16
14
 
17
15
  export default Capability.makeModule(() =>
18
16
  Effect.succeed(
19
17
  Capability.contributes(
20
18
  Capabilities.ReactSurface,
21
19
  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),
20
+ id: 'article',
21
+ // TODO(wittjosiah): Split into multiple surfaces if this filter proves too strict for non-article roles.
22
+ filter: AppSurface.oneOf(
23
+ AppSurface.object(AppSurface.Article, Graph.Graph),
24
+ AppSurface.object(AppSurface.Section, Graph.Graph),
25
+ ),
25
26
  component: ({ data, role }) => {
26
- return <ExplorerContainer role={role} subject={data.subject} />;
27
+ return <ExplorerContainer role={role} subject={data.subject} attendableId={data.attendableId} />;
27
28
  },
28
29
  }),
29
30
  ),
@@ -2,42 +2,35 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type Meta } from '@storybook/react-vite';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React from 'react';
7
7
 
8
- import { ClientRepeater } from '@dxos/react-client/testing';
9
8
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
10
9
 
11
10
  import CitiesData from '../../../data/cities.js';
12
-
13
11
  import { Chart } from './Chart';
14
12
 
15
- // TODO(burdon): Generate data with geo lat/lng.
16
- // TODO(burdon): How to provide geo service via agent?
17
-
18
- const Story = () => {
19
- if (!CitiesData) {
20
- return null;
21
- }
22
-
23
- const items = CitiesData.features.map((feature: any) => ({
24
- x: feature.geometry.coordinates[0],
25
- y: feature.geometry.coordinates[1],
26
- }));
13
+ const items = CitiesData.features.map((feature: any) => ({
14
+ x: feature.geometry.coordinates[0],
15
+ y: feature.geometry.coordinates[1],
16
+ }));
27
17
 
28
- return <Chart items={items} accessor={(obj) => ({ x: obj.x, y: obj.y })} options={{ stroke: 'blue' }} />;
29
- };
30
-
31
- // TODO(burdon): Change to decorator.
32
- export const Default = () => <ClientRepeater component={Story} />;
18
+ const DefaultStory = () => (
19
+ <Chart items={items} accessor={(obj) => ({ x: obj.x, y: obj.y })} options={{ stroke: 'blue' }} />
20
+ );
33
21
 
34
22
  const meta = {
35
- title: 'plugins/plugin-explorer/Chart',
23
+ title: 'plugins/plugin-explorer/components/Chart',
36
24
  component: Chart,
37
- decorators: [withTheme(), withLayout()],
25
+ render: DefaultStory,
26
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
38
27
  parameters: {
39
28
  layout: 'fullscreen',
40
29
  },
41
30
  } satisfies Meta<typeof Chart>;
42
31
 
43
32
  export default meta;
33
+
34
+ type Story = StoryObj<typeof meta>;
35
+
36
+ export const Default: Story = {};
@@ -3,31 +3,27 @@
3
3
  //
4
4
 
5
5
  import { dot, geo, graticule, plot, sphere } from '@observablehq/plot';
6
- import { type Meta } from '@storybook/react-vite';
6
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
7
7
  import { geoCircle } from 'd3';
8
8
  import React, { useEffect } from 'react';
9
9
  import { useResizeDetector } from 'react-resize-detector';
10
10
  import { feature } from 'topojson-client';
11
11
 
12
- import { ClientRepeater } from '@dxos/react-client/testing';
13
12
  import { withLayout, withTheme } from '@dxos/react-ui/testing';
14
13
 
15
14
  import CitiesData from '../../../data/cities.js';
16
15
  import CountriesData from '../../../data/countries-110m.js';
17
-
18
16
  import { Globe } from './Globe';
19
17
 
20
18
  // TODO(burdon): Generate data with geo lat/lng.
21
19
  // TODO(burdon): How to provide geo service via agent?
22
20
 
23
- const DefaultStory = () => {
24
- const items = CitiesData.features.map((feature: any) => ({
25
- lat: feature.geometry.coordinates[0],
26
- lng: feature.geometry.coordinates[1],
27
- }));
21
+ const items = CitiesData.features.map((feature: any) => ({
22
+ lat: feature.geometry.coordinates[0],
23
+ lng: feature.geometry.coordinates[1],
24
+ }));
28
25
 
29
- return <Globe items={items} />;
30
- };
26
+ const DefaultStory = () => <Globe items={items} />;
31
27
 
32
28
  const ExtendedStory = () => {
33
29
  const { ref: containerRef, width = 0, height = 0 } = useResizeDetector({ refreshRate: 200 });
@@ -37,11 +33,6 @@ const ExtendedStory = () => {
37
33
  }
38
34
 
39
35
  const land = feature(CountriesData as any, CountriesData.objects.land as any);
40
- const items = CitiesData.features.map((feature: any) => ({
41
- lat: feature.geometry.coordinates[0],
42
- lng: feature.geometry.coordinates[1],
43
- }));
44
-
45
36
  const city = items[0];
46
37
  const circle = geoCircle().center([city.lat, city.lng]).radius(16)();
47
38
 
@@ -50,7 +41,6 @@ const ExtendedStory = () => {
50
41
  const drawing = plot({
51
42
  // https://observablehq.com/plot/features/projections
52
43
  projection: { type: 'orthographic', rotate: [-city.lat + 30, -30] },
53
- // projection: { type: 'equirectangular', rotate: [-140, -30] },
54
44
  width,
55
45
  height,
56
46
  style: {
@@ -80,15 +70,22 @@ const ExtendedStory = () => {
80
70
  };
81
71
 
82
72
  const meta = {
83
- title: 'plugins/plugin-explorer/Globe',
84
- decorators: [withTheme(), withLayout()],
73
+ title: 'plugins/plugin-explorer/components/Globe',
74
+ component: Globe,
75
+ decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
85
76
  parameters: {
86
77
  layout: 'fullscreen',
87
78
  },
88
- } satisfies Meta;
79
+ } satisfies Meta<typeof Globe>;
89
80
 
90
81
  export default meta;
91
82
 
92
- export const Default = () => <ClientRepeater component={DefaultStory} createSpace />;
83
+ type Story = StoryObj<typeof meta>;
93
84
 
94
- export const Extended = () => <ClientRepeater component={ExtendedStory} createSpace />;
85
+ export const Default: Story = {
86
+ render: DefaultStory,
87
+ };
88
+
89
+ export const Extended: Story = {
90
+ render: ExtendedStory,
91
+ };
@@ -0,0 +1,83 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import * as Effect from 'effect/Effect';
7
+ import React from 'react';
8
+
9
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
+ import { Type, View } from '@dxos/echo';
11
+ import { ClientPlugin } from '@dxos/plugin-client';
12
+ import { initializeIdentity } from '@dxos/plugin-client/testing';
13
+ import { corePlugins } from '@dxos/plugin-testing';
14
+ import { random } from '@dxos/random';
15
+ import { useSpaces } from '@dxos/react-client/echo';
16
+ import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
17
+ import { ViewModel } from '@dxos/schema';
18
+ import { type ValueGenerator } from '@dxos/schema/testing';
19
+ import { HasRelationship, Organization, Person, Pipeline } from '@dxos/types';
20
+
21
+ import { useGraphModel } from '#hooks';
22
+ import { Graph } from '#types';
23
+
24
+ import { CanvasForceGraph } from './CanvasForceGraph';
25
+ import { generate } from './testing';
26
+
27
+ const generator = random as any as ValueGenerator;
28
+
29
+ random.seed(1);
30
+
31
+ const DefaultStory = () => {
32
+ const [space] = useSpaces();
33
+ const model = useGraphModel(space);
34
+ if (!space || !model) {
35
+ return <Loading data={{ space: !!space, model: !!model }} />;
36
+ }
37
+
38
+ return <CanvasForceGraph model={model} />;
39
+ };
40
+
41
+ const meta = {
42
+ title: 'plugins/plugin-explorer/components/CanvasForceGraph',
43
+ component: CanvasForceGraph,
44
+ render: DefaultStory,
45
+ decorators: [
46
+ withTheme(),
47
+ withLayout({ layout: 'fullscreen' }),
48
+ withPluginManager({
49
+ plugins: [
50
+ ...corePlugins(),
51
+ ClientPlugin({
52
+ types: [
53
+ Graph.Graph,
54
+ View.View,
55
+ HasRelationship.HasRelationship,
56
+ Organization.Organization,
57
+ Pipeline.Pipeline,
58
+ Person.Person,
59
+ ],
60
+ onClientInitialized: ({ client }) =>
61
+ Effect.gen(function* () {
62
+ const { personalSpace } = yield* initializeIdentity(client);
63
+ yield* Effect.promise(() => generate(personalSpace, generator));
64
+ const { view } = yield* Effect.promise(() =>
65
+ ViewModel.makeFromDatabase({ db: personalSpace.db, typename: Type.getTypename(Graph.Graph) }),
66
+ );
67
+ personalSpace.db.add(Graph.make({ name: 'Test', view }));
68
+ yield* Effect.promise(() => personalSpace.db.flush({ indexes: true }));
69
+ }),
70
+ }),
71
+ ],
72
+ }),
73
+ ],
74
+ parameters: {
75
+ layout: 'fullscreen',
76
+ },
77
+ } satisfies Meta<typeof CanvasForceGraph>;
78
+
79
+ export default meta;
80
+
81
+ type Story = StoryObj<typeof meta>;
82
+
83
+ export const Default: Story = {};