@dxos/plugin-explorer 0.8.4-main.406dc2a → 0.8.4-main.422d1c7879

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 (122) hide show
  1. package/dist/lib/browser/chunk-LSUP47BZ.mjs +24 -0
  2. package/dist/lib/browser/chunk-LSUP47BZ.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +11342 -86
  4. package/dist/lib/browser/index.mjs.map +4 -4
  5. package/dist/lib/browser/meta.json +1 -1
  6. package/dist/lib/browser/meta.mjs +1 -1
  7. package/dist/lib/browser/types/index.mjs +64 -5
  8. package/dist/lib/browser/types/index.mjs.map +4 -4
  9. package/dist/lib/node-esm/{chunk-PX6LHR2N.mjs → chunk-EN3JZNEY.mjs} +8 -3
  10. package/dist/lib/node-esm/chunk-EN3JZNEY.mjs.map +7 -0
  11. package/dist/lib/node-esm/index.mjs +11342 -86
  12. package/dist/lib/node-esm/index.mjs.map +4 -4
  13. package/dist/lib/node-esm/meta.json +1 -1
  14. package/dist/lib/node-esm/meta.mjs +1 -1
  15. package/dist/lib/node-esm/types/index.mjs +64 -5
  16. package/dist/lib/node-esm/types/index.mjs.map +4 -4
  17. package/dist/types/src/ExplorerPlugin.d.ts +2 -1
  18. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  19. package/dist/types/src/capabilities/index.d.ts +2 -2
  20. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  22. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  23. package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
  24. package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
  25. package/dist/types/src/components/Graph/D3ForceGraph.d.ts +6 -5
  26. package/dist/types/src/components/Graph/D3ForceGraph.d.ts.map +1 -1
  27. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts +4 -2
  28. package/dist/types/src/components/Graph/D3ForceGraph.stories.d.ts.map +1 -1
  29. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts +1 -1
  30. package/dist/types/src/components/Graph/ForceGraph.stories.d.ts.map +1 -1
  31. package/dist/types/src/components/Graph/adapter.d.ts +1 -1
  32. package/dist/types/src/components/Graph/adapter.d.ts.map +1 -1
  33. package/dist/types/src/components/Graph/testing.d.ts.map +1 -1
  34. package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
  35. package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
  36. package/dist/types/src/components/Tree/testing/generator.d.ts.map +1 -1
  37. package/dist/types/src/components/Tree/types/tree.d.ts +18 -16
  38. package/dist/types/src/components/Tree/types/tree.d.ts.map +1 -1
  39. package/dist/types/src/components/Tree/types/types.d.ts +1 -1
  40. package/dist/types/src/components/Tree/types/types.d.ts.map +1 -1
  41. package/dist/types/src/components/index.d.ts +0 -4
  42. package/dist/types/src/components/index.d.ts.map +1 -1
  43. package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts +6 -0
  44. package/dist/types/src/containers/ExplorerContainer/ExplorerContainer.d.ts.map +1 -0
  45. package/dist/types/src/containers/ExplorerContainer/index.d.ts +2 -0
  46. package/dist/types/src/containers/ExplorerContainer/index.d.ts.map +1 -0
  47. package/dist/types/src/containers/index.d.ts +3 -0
  48. package/dist/types/src/containers/index.d.ts.map +1 -0
  49. package/dist/types/src/hooks/useGraphModel.d.ts.map +1 -1
  50. package/dist/types/src/meta.d.ts +2 -2
  51. package/dist/types/src/meta.d.ts.map +1 -1
  52. package/dist/types/src/translations.d.ts +31 -22
  53. package/dist/types/src/translations.d.ts.map +1 -1
  54. package/dist/types/src/types/ExplorerAction.d.ts +1 -18
  55. package/dist/types/src/types/ExplorerAction.d.ts.map +1 -1
  56. package/dist/types/src/types/Graph.d.ts +14 -24
  57. package/dist/types/src/types/Graph.d.ts.map +1 -1
  58. package/dist/types/tsconfig.tsbuildinfo +1 -1
  59. package/package.json +59 -55
  60. package/src/ExplorerPlugin.tsx +42 -53
  61. package/src/capabilities/index.ts +2 -3
  62. package/src/capabilities/react-surface.tsx +24 -19
  63. package/src/components/Chart/Chart.stories.tsx +3 -4
  64. package/src/components/Globe/Globe.stories.tsx +3 -4
  65. package/src/components/Graph/D3ForceGraph.stories.tsx +30 -24
  66. package/src/components/Graph/D3ForceGraph.tsx +82 -75
  67. package/src/components/Graph/ForceGraph.stories.tsx +30 -24
  68. package/src/components/Graph/adapter.ts +14 -8
  69. package/src/components/Graph/testing.ts +11 -8
  70. package/src/components/Tree/Tree.stories.tsx +9 -6
  71. package/src/components/Tree/Tree.tsx +8 -3
  72. package/src/components/Tree/testing/generator.ts +4 -2
  73. package/src/components/Tree/types/tree.test.ts +7 -6
  74. package/src/components/Tree/types/tree.ts +41 -20
  75. package/src/components/Tree/types/types.ts +1 -1
  76. package/src/components/index.ts +0 -4
  77. package/src/containers/ExplorerContainer/ExplorerContainer.tsx +53 -0
  78. package/src/containers/ExplorerContainer/index.ts +5 -0
  79. package/src/containers/index.ts +7 -0
  80. package/src/hooks/useGraphModel.ts +17 -10
  81. package/src/meta.ts +9 -4
  82. package/src/translations.ts +15 -12
  83. package/src/types/ExplorerAction.ts +10 -19
  84. package/src/types/Graph.ts +25 -21
  85. package/src/typings.d.ts +8 -0
  86. package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs +0 -50
  87. package/dist/lib/browser/ExplorerContainer-6SHZJ6AK.mjs.map +0 -7
  88. package/dist/lib/browser/chunk-2DGFNLRO.mjs +0 -19
  89. package/dist/lib/browser/chunk-2DGFNLRO.mjs.map +0 -7
  90. package/dist/lib/browser/chunk-2MKBRIUT.mjs +0 -31
  91. package/dist/lib/browser/chunk-2MKBRIUT.mjs.map +0 -7
  92. package/dist/lib/browser/chunk-BZ65T5M3.mjs +0 -79
  93. package/dist/lib/browser/chunk-BZ65T5M3.mjs.map +0 -7
  94. package/dist/lib/browser/chunk-MOM5KCKC.mjs +0 -11341
  95. package/dist/lib/browser/chunk-MOM5KCKC.mjs.map +0 -7
  96. package/dist/lib/browser/chunk-NXGP6NTP.mjs +0 -203
  97. package/dist/lib/browser/chunk-NXGP6NTP.mjs.map +0 -7
  98. package/dist/lib/browser/intent-resolver-K57C3LIX.mjs +0 -31
  99. package/dist/lib/browser/intent-resolver-K57C3LIX.mjs.map +0 -7
  100. package/dist/lib/browser/react-surface-OPBND5W3.mjs +0 -35
  101. package/dist/lib/browser/react-surface-OPBND5W3.mjs.map +0 -7
  102. package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs +0 -51
  103. package/dist/lib/node-esm/ExplorerContainer-FRTDXZI5.mjs.map +0 -7
  104. package/dist/lib/node-esm/chunk-3ODK27PU.mjs +0 -33
  105. package/dist/lib/node-esm/chunk-3ODK27PU.mjs.map +0 -7
  106. package/dist/lib/node-esm/chunk-6JACZE7E.mjs +0 -205
  107. package/dist/lib/node-esm/chunk-6JACZE7E.mjs.map +0 -7
  108. package/dist/lib/node-esm/chunk-ES6AOMCY.mjs +0 -80
  109. package/dist/lib/node-esm/chunk-ES6AOMCY.mjs.map +0 -7
  110. package/dist/lib/node-esm/chunk-PX6LHR2N.mjs.map +0 -7
  111. package/dist/lib/node-esm/chunk-ZCV4U7LT.mjs +0 -11343
  112. package/dist/lib/node-esm/chunk-ZCV4U7LT.mjs.map +0 -7
  113. package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs +0 -32
  114. package/dist/lib/node-esm/intent-resolver-BLPPTTEY.mjs.map +0 -7
  115. package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs +0 -36
  116. package/dist/lib/node-esm/react-surface-HCKQSHKJ.mjs.map +0 -7
  117. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  118. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  119. package/dist/types/src/components/ExplorerContainer.d.ts +0 -9
  120. package/dist/types/src/components/ExplorerContainer.d.ts.map +0 -1
  121. package/src/capabilities/intent-resolver.ts +0 -21
  122. package/src/components/ExplorerContainer.tsx +0 -54
package/package.json CHANGED
@@ -1,104 +1,108 @@
1
1
  {
2
2
  "name": "@dxos/plugin-explorer",
3
- "version": "0.8.4-main.406dc2a",
3
+ "version": "0.8.4-main.422d1c7879",
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",
15
+ "imports": {
16
+ "#capabilities": "./src/capabilities/index.ts",
17
+ "#components": "./src/components/index.ts",
18
+ "#containers": "./src/containers/index.ts",
19
+ "#hooks": "./src/hooks/index.ts",
20
+ "#meta": "./src/meta.ts",
21
+ "#types": "./src/types/index.ts"
22
+ },
11
23
  "exports": {
12
24
  ".": {
13
25
  "source": "./src/index.ts",
14
- "types": "./dist/types/src/index.d.ts",
15
26
  "browser": "./dist/lib/browser/index.mjs",
16
- "node": "./dist/lib/node-esm/index.mjs"
27
+ "node": "./dist/lib/node-esm/index.mjs",
28
+ "types": "./dist/types/src/index.d.ts"
17
29
  },
18
30
  "./meta": {
19
31
  "source": "./src/meta.ts",
20
- "types": "./dist/types/src/meta.d.ts",
21
32
  "browser": "./dist/lib/browser/meta.mjs",
22
- "node": "./dist/lib/node-esm/meta.mjs"
33
+ "node": "./dist/lib/node-esm/meta.mjs",
34
+ "types": "./dist/types/src/meta.d.ts"
23
35
  },
24
36
  "./types": {
25
37
  "source": "./src/types/index.ts",
26
- "types": "./dist/types/src/types/index.d.ts",
27
38
  "browser": "./dist/lib/browser/types/index.mjs",
28
- "node": "./dist/lib/node-esm/types/index.mjs"
39
+ "node": "./dist/lib/node-esm/types/index.mjs",
40
+ "types": "./dist/types/src/types/index.d.ts"
29
41
  }
30
42
  },
31
43
  "types": "dist/types/src/index.d.ts",
32
- "typesVersions": {
33
- "*": {
34
- "meta": [
35
- "dist/types/src/meta.d.ts"
36
- ],
37
- "types": [
38
- "dist/types/src/types/index.d.ts"
39
- ]
40
- }
41
- },
42
44
  "files": [
43
45
  "dist",
44
46
  "src"
45
47
  ],
46
48
  "dependencies": {
47
49
  "3d-force-graph": "^1.76.1",
50
+ "@effect-atom/atom-react": "^0.5.0",
48
51
  "@observablehq/plot": "^0.6.11",
49
- "@preact-signals/safe-react": "^0.9.0",
50
- "@preact/signals-core": "^1.12.1",
51
52
  "d3": "^7.9.0",
52
- "effect": "3.18.3",
53
+ "effect": "3.20.0",
53
54
  "force-graph": "^1.49.4",
54
55
  "lodash.defaultsdeep": "^4.6.1",
55
56
  "react-resize-detector": "^11.0.1",
56
57
  "three": "^0.178.0",
57
58
  "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"
59
+ "@dxos/app-framework": "0.8.4-main.422d1c7879",
60
+ "@dxos/app-toolkit": "0.8.4-main.422d1c7879",
61
+ "@dxos/client": "0.8.4-main.422d1c7879",
62
+ "@dxos/async": "0.8.4-main.422d1c7879",
63
+ "@dxos/echo": "0.8.4-main.422d1c7879",
64
+ "@dxos/echo-query": "0.8.4-main.422d1c7879",
65
+ "@dxos/graph": "0.8.4-main.422d1c7879",
66
+ "@dxos/operation": "0.8.4-main.422d1c7879",
67
+ "@dxos/plugin-client": "0.8.4-main.422d1c7879",
68
+ "@dxos/plugin-graph": "0.8.4-main.422d1c7879",
69
+ "@dxos/plugin-search": "0.8.4-main.422d1c7879",
70
+ "@dxos/invariant": "0.8.4-main.422d1c7879",
71
+ "@dxos/plugin-space": "0.8.4-main.422d1c7879",
72
+ "@dxos/react-client": "0.8.4-main.422d1c7879",
73
+ "@dxos/react-ui-attention": "0.8.4-main.422d1c7879",
74
+ "@dxos/react-ui-components": "0.8.4-main.422d1c7879",
75
+ "@dxos/react-ui-graph": "0.8.4-main.422d1c7879",
76
+ "@dxos/log": "0.8.4-main.422d1c7879",
77
+ "@dxos/schema": "0.8.4-main.422d1c7879",
78
+ "@dxos/react-ui-mosaic": "0.8.4-main.422d1c7879",
79
+ "@dxos/react-ui-stack": "0.8.4-main.422d1c7879",
80
+ "@dxos/types": "0.8.4-main.422d1c7879",
81
+ "@dxos/util": "0.8.4-main.422d1c7879"
78
82
  },
79
83
  "devDependencies": {
80
84
  "@types/d3": "^7.4.3",
81
85
  "@types/d3-hierarchy": "^3.1.6",
82
86
  "@types/lodash.defaultsdeep": "^4.6.6",
83
- "@types/react": "~19.2.2",
84
- "@types/react-dom": "~19.2.1",
87
+ "@types/react": "~19.2.7",
88
+ "@types/react-dom": "~19.2.3",
85
89
  "@types/topojson-client": "^3.1.4",
86
90
  "@types/topojson-specification": "^1.0.5",
87
- "react": "~19.2.0",
88
- "react-dom": "~19.2.0",
89
- "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"
91
+ "react": "~19.2.3",
92
+ "react-dom": "~19.2.3",
93
+ "vite": "^7.1.11",
94
+ "@dxos/random": "0.8.4-main.422d1c7879",
95
+ "@dxos/echo-generator": "0.8.4-main.422d1c7879",
96
+ "@dxos/react-ui": "0.8.4-main.422d1c7879",
97
+ "@dxos/storybook-utils": "0.8.4-main.422d1c7879",
98
+ "@dxos/ui-theme": "0.8.4-main.422d1c7879"
95
99
  },
96
100
  "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"
101
+ "effect": "3.20.0",
102
+ "react": "~19.2.3",
103
+ "react-dom": "~19.2.3",
104
+ "@dxos/react-ui": "0.8.4-main.422d1c7879",
105
+ "@dxos/ui-theme": "0.8.4-main.422d1c7879"
102
106
  },
103
107
  "publishConfig": {
104
108
  "access": "public"
@@ -2,60 +2,49 @@
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';
6
+ import * as Option from 'effect/Option';
7
+
8
+ import { Plugin } from '@dxos/app-framework';
9
+ import { AppPlugin } from '@dxos/app-toolkit';
10
+ import { Annotation, Type } from '@dxos/echo';
11
+ import { Operation } from '@dxos/operation';
12
+ import { SpaceOperation } from '@dxos/plugin-space/operations';
13
+ import { type CreateObject } from '@dxos/plugin-space/types';
14
+ import { ViewModel } from '@dxos/schema';
15
+
16
+ import { ReactSurface } from '#capabilities';
17
+ import { meta } from '#meta';
18
+ import { ExplorerAction, Graph } from '#types';
9
19
 
10
- import { IntentResolver, ReactSurface } from './capabilities';
11
- import { meta } from './meta';
12
20
  import { translations } from './translations';
13
- import { ExplorerAction, Graph } from './types';
14
21
 
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,
22
+ export const ExplorerPlugin = Plugin.define(meta).pipe(
23
+ AppPlugin.addMetadataModule({
24
+ metadata: {
25
+ id: Type.getTypename(Graph.Graph),
26
+ metadata: {
27
+ icon: Annotation.IconAnnotation.get(Graph.Graph).pipe(Option.getOrThrow).icon,
28
+ iconHue: Annotation.IconAnnotation.get(Graph.Graph).pipe(Option.getOrThrow).hue ?? 'white',
29
+ inputSchema: ExplorerAction.GraphProps,
30
+ createObject: ((props, options) =>
31
+ Effect.gen(function* () {
32
+ const object = yield* Effect.promise(async () => {
33
+ const { view } = await ViewModel.makeFromDatabase({ db: options.db, typename: props.typename });
34
+ return Graph.make({ name: props.name, view });
35
+ });
36
+ return yield* Operation.invoke(SpaceOperation.AddObject, {
37
+ object,
38
+ target: options.target,
39
+ hidden: true,
40
+ targetNodeId: options.targetNodeId,
41
+ });
42
+ })) satisfies CreateObject,
43
+ },
44
+ },
60
45
  }),
61
- ]);
46
+ AppPlugin.addSchemaModule({ schema: [Graph.Graph] }),
47
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
48
+ AppPlugin.addTranslationsModule({ translations }),
49
+ Plugin.make,
50
+ );
@@ -2,7 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
5
+ import { Capability } from '@dxos/app-framework';
6
6
 
7
- export const IntentResolver = lazy(() => import('./intent-resolver'));
8
- export const ReactSurface = lazy(() => import('./react-surface'));
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -2,26 +2,31 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import * as Effect from 'effect/Effect';
5
6
  import React from 'react';
6
7
 
7
- import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
- import { Obj } from '@dxos/echo';
9
- import { DataType } from '@dxos/schema';
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
10
+ import { AppSurface } from '@dxos/app-toolkit/ui';
10
11
 
11
- import { ExplorerContainer } from '../components';
12
- import { meta } from '../meta';
13
- import { Graph } from '../types';
12
+ import { ExplorerContainer } from '#containers';
13
+ import { Graph } from '#types';
14
14
 
15
- export default () =>
16
- contributes(
17
- Capabilities.ReactSurface,
18
- createSurface({
19
- id: `${meta.id}/article`,
20
- role: ['article', 'section'],
21
- filter: (data): data is { subject: DataType.View } =>
22
- Obj.instanceOf(DataType.View, data.subject) && Obj.instanceOf(Graph.Graph, data.subject.presentation.target),
23
- component: ({ data, role }) => {
24
- return <ExplorerContainer view={data.subject} role={role} />;
25
- },
26
- }),
27
- );
15
+ export default Capability.makeModule(() =>
16
+ Effect.succeed(
17
+ Capability.contributes(
18
+ Capabilities.ReactSurface,
19
+ Surface.create({
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
+ ),
26
+ component: ({ data, role }) => {
27
+ return <ExplorerContainer role={role} subject={data.subject} attendableId={data.attendableId} />;
28
+ },
29
+ }),
30
+ ),
31
+ ),
32
+ );
@@ -6,10 +6,9 @@ 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
-
13
12
  import { Chart } from './Chart';
14
13
 
15
14
  // TODO(burdon): Generate data with geo lat/lng.
@@ -32,9 +31,9 @@ const Story = () => {
32
31
  export const Default = () => <ClientRepeater component={Story} />;
33
32
 
34
33
  const meta = {
35
- title: 'plugins/plugin-explorer/Chart',
34
+ title: 'plugins/plugin-explorer/components/Chart',
36
35
  component: Chart,
37
- decorators: [withTheme],
36
+ decorators: [withTheme(), withLayout()],
38
37
  parameters: {
39
38
  layout: 'fullscreen',
40
39
  },
@@ -10,11 +10,10 @@ 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';
17
-
18
17
  import { Globe } from './Globe';
19
18
 
20
19
  // TODO(burdon): Generate data with geo lat/lng.
@@ -80,8 +79,8 @@ const ExtendedStory = () => {
80
79
  };
81
80
 
82
81
  const meta = {
83
- title: 'plugins/plugin-explorer/Globe',
84
- decorators: [withTheme],
82
+ title: 'plugins/plugin-explorer/components/Globe',
83
+ decorators: [withTheme(), withLayout()],
85
84
  parameters: {
86
85
  layout: 'fullscreen',
87
86
  },
@@ -5,63 +5,69 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React, { useState } from 'react';
7
7
 
8
- import { faker } from '@dxos/random';
8
+ import { Type } from '@dxos/echo';
9
+ import { View } from '@dxos/echo';
10
+ import { random } from '@dxos/random';
9
11
  import { useClient } from '@dxos/react-client';
10
12
  import { type Space } from '@dxos/react-client/echo';
11
13
  import { withClientProvider } from '@dxos/react-client/testing';
12
14
  import { useAsyncEffect } from '@dxos/react-ui';
13
- import { withTheme } from '@dxos/react-ui/testing';
14
- import { DataType } from '@dxos/schema';
15
+ import { Loading, withLayout, withTheme } from '@dxos/react-ui/testing';
16
+ import { ViewModel } from '@dxos/schema';
15
17
  import { type ValueGenerator } from '@dxos/schema/testing';
16
- import { render } from '@dxos/storybook-utils';
18
+ import { withRegistry } from '@dxos/storybook-utils';
19
+ import { HasRelationship, Organization, Person, Pipeline } from '@dxos/types';
17
20
 
18
- import { useGraphModel } from '../../hooks';
19
- import { Graph } from '../../types';
21
+ import { useGraphModel } from '#hooks';
22
+ import { Graph } from '#types';
20
23
 
21
24
  import { D3ForceGraph } from './D3ForceGraph';
22
25
  import { generate } from './testing';
23
26
 
24
- const generator = faker as any as ValueGenerator;
27
+ const generator = random as any as ValueGenerator;
25
28
 
26
- faker.seed(1);
29
+ random.seed(1);
27
30
 
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
- const space = client.spaces.default;
37
+ const space = client.spaces.get()[0];
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 ViewModel.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) {
44
- return null;
47
+ if (!model || !space || !graph) {
48
+ return <Loading data={{ model: !!model, space: !!space, graph: !!graph }} />;
45
49
  }
46
50
 
47
51
  return <D3ForceGraph model={model} />;
48
52
  };
49
53
 
50
54
  const meta = {
51
- title: 'plugins/plugin-explorer/D3ForceGraph',
55
+ title: 'plugins/plugin-explorer/components/D3ForceGraph',
52
56
  component: D3ForceGraph,
53
- render: render(DefaultStory),
57
+ 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
  ],