@dxos/plugin-explorer 0.7.5-main.499c70c → 0.7.5-main.6a330ac

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 (132) hide show
  1. package/dist/lib/browser/ExplorerContainer-THLT3CQZ.mjs +28 -0
  2. package/dist/lib/browser/ExplorerContainer-THLT3CQZ.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-SW3H4TIK.mjs → chunk-PMHCTMKT.mjs} +3 -3
  4. package/dist/lib/browser/chunk-PMHCTMKT.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-KG3BEHW5.mjs → chunk-QOKAZK4V.mjs} +7 -4
  6. package/dist/lib/browser/chunk-QOKAZK4V.mjs.map +7 -0
  7. package/dist/lib/browser/{chunk-5GTLMW4Q.mjs → chunk-TDUEJNAN.mjs} +21 -22
  8. package/dist/lib/browser/chunk-TDUEJNAN.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-YN4YVXVL.mjs +10832 -0
  10. package/dist/lib/browser/chunk-YN4YVXVL.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +73 -10890
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/intent-resolver-UJNDAIDZ.mjs +24 -0
  14. package/dist/lib/browser/intent-resolver-UJNDAIDZ.mjs.map +7 -0
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/meta.mjs +3 -3
  17. package/dist/lib/browser/react-surface-UMUN6CTH.mjs +30 -0
  18. package/dist/lib/browser/react-surface-UMUN6CTH.mjs.map +7 -0
  19. package/dist/lib/browser/types/index.mjs +2 -2
  20. package/dist/lib/node/{ExplorerArticle-SRBBSKFY.cjs → ExplorerContainer-EJPGD4WR.cjs} +13 -12
  21. package/dist/lib/node/ExplorerContainer-EJPGD4WR.cjs.map +7 -0
  22. package/dist/lib/node/{chunk-N6DCTBDJ.cjs → chunk-5MTMJYC4.cjs} +11 -8
  23. package/dist/lib/node/chunk-5MTMJYC4.cjs.map +7 -0
  24. package/dist/lib/node/chunk-H5CHI722.cjs +10854 -0
  25. package/dist/lib/node/chunk-H5CHI722.cjs.map +7 -0
  26. package/dist/lib/node/{chunk-WHMJ2VQ2.cjs → chunk-QASZ24JS.cjs} +23 -24
  27. package/dist/lib/node/chunk-QASZ24JS.cjs.map +7 -0
  28. package/dist/lib/node/{chunk-PYKEM3BW.cjs → chunk-YUY7P7R2.cjs} +7 -7
  29. package/dist/lib/node/chunk-YUY7P7R2.cjs.map +7 -0
  30. package/dist/lib/node/index.cjs +72 -10876
  31. package/dist/lib/node/index.cjs.map +4 -4
  32. package/dist/lib/node/intent-resolver-XQV24IAA.cjs +39 -0
  33. package/dist/lib/node/intent-resolver-XQV24IAA.cjs.map +7 -0
  34. package/dist/lib/node/meta.cjs +5 -4
  35. package/dist/lib/node/meta.cjs.map +1 -1
  36. package/dist/lib/node/meta.json +1 -1
  37. package/dist/lib/node/{ExplorerMain-OP7Y6MBK.cjs → react-surface-UVMGNAA6.cjs} +22 -29
  38. package/dist/lib/node/react-surface-UVMGNAA6.cjs.map +7 -0
  39. package/dist/lib/node/types/index.cjs +4 -4
  40. package/dist/lib/node/types/index.cjs.map +1 -1
  41. package/dist/lib/node-esm/{ExplorerArticle-OSHCNX4V.mjs → ExplorerContainer-MEZP34AY.mjs} +10 -9
  42. package/dist/lib/node-esm/ExplorerContainer-MEZP34AY.mjs.map +7 -0
  43. package/dist/lib/node-esm/{chunk-WTGQFG6L.mjs → chunk-45DTVHHL.mjs} +21 -22
  44. package/dist/lib/node-esm/chunk-45DTVHHL.mjs.map +7 -0
  45. package/dist/lib/node-esm/{chunk-JWVKJ4I5.mjs → chunk-57K7ORAW.mjs} +3 -3
  46. package/dist/lib/node-esm/chunk-57K7ORAW.mjs.map +7 -0
  47. package/dist/lib/node-esm/chunk-JYW3CDBT.mjs +10834 -0
  48. package/dist/lib/node-esm/chunk-JYW3CDBT.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-UTMD4Q5R.mjs → chunk-UHJZUVRI.mjs} +7 -4
  50. package/dist/lib/node-esm/chunk-UHJZUVRI.mjs.map +7 -0
  51. package/dist/lib/node-esm/index.mjs +73 -10890
  52. package/dist/lib/node-esm/index.mjs.map +4 -4
  53. package/dist/lib/node-esm/intent-resolver-RZQ3EEOE.mjs +25 -0
  54. package/dist/lib/node-esm/intent-resolver-RZQ3EEOE.mjs.map +7 -0
  55. package/dist/lib/node-esm/meta.json +1 -1
  56. package/dist/lib/node-esm/meta.mjs +3 -3
  57. package/dist/lib/node-esm/react-surface-5BTZOU3H.mjs +31 -0
  58. package/dist/lib/node-esm/react-surface-5BTZOU3H.mjs.map +7 -0
  59. package/dist/lib/node-esm/types/index.mjs +2 -2
  60. package/dist/types/src/ExplorerPlugin.d.ts +1 -3
  61. package/dist/types/src/ExplorerPlugin.d.ts.map +1 -1
  62. package/dist/types/src/capabilities/index.d.ts +3 -0
  63. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  64. package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
  65. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
  66. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  67. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  68. package/dist/types/src/components/Chart/Chart.d.ts +1 -2
  69. package/dist/types/src/components/Chart/Chart.d.ts.map +1 -1
  70. package/dist/types/src/components/Chart/Chart.stories.d.ts +1 -2
  71. package/dist/types/src/components/Chart/Chart.stories.d.ts.map +1 -1
  72. package/dist/types/src/components/ExplorerContainer.d.ts +7 -0
  73. package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -0
  74. package/dist/types/src/components/Globe/Globe.d.ts +1 -2
  75. package/dist/types/src/components/Globe/Globe.d.ts.map +1 -1
  76. package/dist/types/src/components/Globe/Globe.stories.d.ts +2 -3
  77. package/dist/types/src/components/Globe/Globe.stories.d.ts.map +1 -1
  78. package/dist/types/src/components/Graph/Graph.d.ts +1 -0
  79. package/dist/types/src/components/Graph/Graph.d.ts.map +1 -1
  80. package/dist/types/src/components/Graph/graph-model.d.ts +6 -6
  81. package/dist/types/src/components/Graph/graph-model.d.ts.map +1 -1
  82. package/dist/types/src/components/Tree/Tree.d.ts +1 -2
  83. package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
  84. package/dist/types/src/components/index.d.ts +3 -5
  85. package/dist/types/src/components/index.d.ts.map +1 -1
  86. package/dist/types/src/index.d.ts +1 -2
  87. package/dist/types/src/index.d.ts.map +1 -1
  88. package/dist/types/src/meta.d.ts +2 -2
  89. package/dist/types/src/meta.d.ts.map +1 -1
  90. package/dist/types/src/translations.d.ts +13 -0
  91. package/dist/types/src/translations.d.ts.map +1 -1
  92. package/dist/types/src/types/schema.d.ts +2 -2
  93. package/dist/types/src/types/types.d.ts +0 -3
  94. package/dist/types/src/types/types.d.ts.map +1 -1
  95. package/dist/types/tsconfig.tsbuildinfo +1 -1
  96. package/package.json +25 -31
  97. package/src/ExplorerPlugin.tsx +50 -39
  98. package/src/capabilities/index.ts +8 -0
  99. package/src/capabilities/intent-resolver.ts +19 -0
  100. package/src/capabilities/react-surface.tsx +22 -0
  101. package/src/components/{ExplorerArticle.tsx → ExplorerContainer.tsx} +5 -4
  102. package/src/components/Graph/Graph.tsx +19 -20
  103. package/src/components/Graph/graph-model.ts +13 -9
  104. package/src/components/index.ts +1 -2
  105. package/src/index.ts +1 -4
  106. package/src/meta.ts +3 -2
  107. package/src/translations.ts +4 -0
  108. package/src/types/schema.ts +1 -1
  109. package/src/types/types.ts +0 -13
  110. package/dist/lib/browser/ExplorerArticle-4F2ZO5QW.mjs +0 -27
  111. package/dist/lib/browser/ExplorerArticle-4F2ZO5QW.mjs.map +0 -7
  112. package/dist/lib/browser/ExplorerMain-2X2GH7RE.mjs +0 -33
  113. package/dist/lib/browser/ExplorerMain-2X2GH7RE.mjs.map +0 -7
  114. package/dist/lib/browser/chunk-5GTLMW4Q.mjs.map +0 -7
  115. package/dist/lib/browser/chunk-KG3BEHW5.mjs.map +0 -7
  116. package/dist/lib/browser/chunk-SW3H4TIK.mjs.map +0 -7
  117. package/dist/lib/node/ExplorerArticle-SRBBSKFY.cjs.map +0 -7
  118. package/dist/lib/node/ExplorerMain-OP7Y6MBK.cjs.map +0 -7
  119. package/dist/lib/node/chunk-N6DCTBDJ.cjs.map +0 -7
  120. package/dist/lib/node/chunk-PYKEM3BW.cjs.map +0 -7
  121. package/dist/lib/node/chunk-WHMJ2VQ2.cjs.map +0 -7
  122. package/dist/lib/node-esm/ExplorerArticle-OSHCNX4V.mjs.map +0 -7
  123. package/dist/lib/node-esm/ExplorerMain-RQCVOCX7.mjs +0 -34
  124. package/dist/lib/node-esm/ExplorerMain-RQCVOCX7.mjs.map +0 -7
  125. package/dist/lib/node-esm/chunk-JWVKJ4I5.mjs.map +0 -7
  126. package/dist/lib/node-esm/chunk-UTMD4Q5R.mjs.map +0 -7
  127. package/dist/lib/node-esm/chunk-WTGQFG6L.mjs.map +0 -7
  128. package/dist/types/src/components/ExplorerArticle.d.ts +0 -7
  129. package/dist/types/src/components/ExplorerArticle.d.ts.map +0 -1
  130. package/dist/types/src/components/ExplorerMain.d.ts +0 -7
  131. package/dist/types/src/components/ExplorerMain.d.ts.map +0 -1
  132. package/src/components/ExplorerMain.tsx +0 -34
package/package.json CHANGED
@@ -1,23 +1,19 @@
1
1
  {
2
2
  "name": "@dxos/plugin-explorer",
3
- "version": "0.7.5-main.499c70c",
3
+ "version": "0.7.5-main.6a330ac",
4
4
  "description": "Braneframe data visualization plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
7
  "license": "MIT",
8
8
  "author": "DXOS.org",
9
9
  "sideEffects": true,
10
+ "type": "module",
10
11
  "exports": {
11
12
  ".": {
12
13
  "types": "./dist/types/src/index.d.ts",
13
14
  "browser": "./dist/lib/browser/index.mjs",
14
15
  "node": "./dist/lib/node-esm/index.mjs"
15
16
  },
16
- "./meta": {
17
- "types": "./dist/types/src/meta.d.ts",
18
- "browser": "./dist/lib/browser/meta.mjs",
19
- "node": "./dist/lib/node-esm/meta.mjs"
20
- },
21
17
  "./types": {
22
18
  "types": "./dist/types/src/types/index.d.ts",
23
19
  "browser": "./dist/lib/browser/types/index.mjs",
@@ -27,9 +23,6 @@
27
23
  "types": "dist/types/src/index.d.ts",
28
24
  "typesVersions": {
29
25
  "*": {
30
- "meta": [
31
- "dist/types/src/meta.d.ts"
32
- ],
33
26
  "types": [
34
27
  "dist/types/src/types/index.d.ts"
35
28
  ]
@@ -48,20 +41,21 @@
48
41
  "lodash.get": "^4.4.2",
49
42
  "react-resize-detector": "^11.0.1",
50
43
  "topojson-client": "^3.1.0",
51
- "@dxos/app-framework": "0.7.5-main.499c70c",
52
- "@dxos/async": "0.7.5-main.499c70c",
53
- "@dxos/echo-schema": "0.7.5-main.499c70c",
54
- "@dxos/client": "0.7.5-main.499c70c",
55
- "@dxos/gem-core": "0.7.5-main.499c70c",
56
- "@dxos/gem-spore": "0.7.5-main.499c70c",
57
- "@dxos/log": "0.7.5-main.499c70c",
58
- "@dxos/live-object": "0.7.5-main.499c70c",
59
- "@dxos/plugin-graph": "0.7.5-main.499c70c",
60
- "@dxos/plugin-client": "0.7.5-main.499c70c",
61
- "@dxos/plugin-search": "0.7.5-main.499c70c",
62
- "@dxos/plugin-space": "0.7.5-main.499c70c",
63
- "@dxos/util": "0.7.5-main.499c70c",
64
- "@dxos/react-client": "0.7.5-main.499c70c"
44
+ "@dxos/app-framework": "0.7.5-main.6a330ac",
45
+ "@dxos/async": "0.7.5-main.6a330ac",
46
+ "@dxos/gem-core": "0.7.5-main.6a330ac",
47
+ "@dxos/gem-spore": "0.7.5-main.6a330ac",
48
+ "@dxos/echo-schema": "0.7.5-main.6a330ac",
49
+ "@dxos/live-object": "0.7.5-main.6a330ac",
50
+ "@dxos/client": "0.7.5-main.6a330ac",
51
+ "@dxos/log": "0.7.5-main.6a330ac",
52
+ "@dxos/plugin-client": "0.7.5-main.6a330ac",
53
+ "@dxos/plugin-graph": "0.7.5-main.6a330ac",
54
+ "@dxos/plugin-search": "0.7.5-main.6a330ac",
55
+ "@dxos/plugin-space": "0.7.5-main.6a330ac",
56
+ "@dxos/react-client": "0.7.5-main.6a330ac",
57
+ "@dxos/util": "0.7.5-main.6a330ac",
58
+ "@dxos/react-ui-stack": "0.7.5-main.6a330ac"
65
59
  },
66
60
  "devDependencies": {
67
61
  "@phosphor-icons/react": "^2.1.5",
@@ -76,19 +70,19 @@
76
70
  "react": "~18.2.0",
77
71
  "react-dom": "~18.2.0",
78
72
  "vite": "5.4.7",
79
- "@dxos/echo-generator": "0.7.5-main.499c70c",
80
- "@dxos/plugin-outliner": "0.7.5-main.499c70c",
81
- "@dxos/random": "0.7.5-main.499c70c",
82
- "@dxos/react-ui": "0.7.5-main.499c70c",
83
- "@dxos/react-ui-theme": "0.7.5-main.499c70c",
84
- "@dxos/storybook-utils": "0.7.5-main.499c70c"
73
+ "@dxos/echo-generator": "0.7.5-main.6a330ac",
74
+ "@dxos/react-ui-theme": "0.7.5-main.6a330ac",
75
+ "@dxos/random": "0.7.5-main.6a330ac",
76
+ "@dxos/plugin-outliner": "0.7.5-main.6a330ac",
77
+ "@dxos/react-ui": "0.7.5-main.6a330ac",
78
+ "@dxos/storybook-utils": "0.7.5-main.6a330ac"
85
79
  },
86
80
  "peerDependencies": {
87
81
  "@phosphor-icons/react": "^2.1.5",
88
82
  "react": "~18.2.0",
89
83
  "react-dom": "~18.2.0",
90
- "@dxos/react-ui": "0.7.5-main.499c70c",
91
- "@dxos/react-ui-theme": "0.7.5-main.499c70c"
84
+ "@dxos/react-ui-theme": "0.7.5-main.6a330ac",
85
+ "@dxos/react-ui": "0.7.5-main.6a330ac"
92
86
  },
93
87
  "publishConfig": {
94
88
  "access": "public"
@@ -2,49 +2,60 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } 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';
6
9
 
7
- import { createIntent, createResolver, createSurface, type PluginDefinition } from '@dxos/app-framework';
8
- import { create } from '@dxos/react-client/echo';
9
-
10
- import { ExplorerArticle } from './components';
11
- import meta, { EXPLORER_PLUGIN } from './meta';
10
+ import { IntentResolver, ReactSurface } from './capabilities';
11
+ import { EXPLORER_PLUGIN, meta } from './meta';
12
12
  import translations from './translations';
13
- import { ViewType } from './types';
14
- import { ExplorerAction, type ExplorerPluginProvides } from './types';
13
+ import { ViewType, ExplorerAction } from './types';
15
14
 
16
- export const ExplorerPlugin = (): PluginDefinition<ExplorerPluginProvides> => {
17
- return {
18
- meta,
19
- provides: {
20
- metadata: {
21
- records: {
22
- [ViewType.typename]: {
23
- createObject: (props: { name?: string }) => createIntent(ExplorerAction.Create, props),
15
+ export const ExplorerPlugin = () =>
16
+ definePlugin(meta, [
17
+ defineModule({
18
+ id: `${meta.id}/module/translations`,
19
+ activatesOn: Events.SetupTranslations,
20
+ activate: () => contributes(Capabilities.Translations, translations),
21
+ }),
22
+ defineModule({
23
+ id: `${meta.id}/module/metadata`,
24
+ activatesOn: Events.SetupMetadata,
25
+ activate: () =>
26
+ contributes(Capabilities.Metadata, {
27
+ id: ViewType.typename,
28
+ metadata: {
24
29
  placeholder: ['object title placeholder', { ns: EXPLORER_PLUGIN }],
25
30
  icon: 'ph--graph--regular',
26
31
  },
27
- },
28
- },
29
- translations,
30
- echo: {
31
- schema: [ViewType],
32
- },
33
- surface: {
34
- definitions: () =>
35
- createSurface({
36
- id: `${EXPLORER_PLUGIN}/article`,
37
- role: 'article',
38
- filter: (data): data is { subject: ViewType } => data.subject instanceof ViewType,
39
- component: ({ data }) => <ExplorerArticle view={data.subject} />,
32
+ }),
33
+ }),
34
+ defineModule({
35
+ id: `${meta.id}/module/object-form`,
36
+ activatesOn: ClientEvents.SetupSchema,
37
+ activate: () =>
38
+ contributes(
39
+ SpaceCapabilities.ObjectForm,
40
+ defineObjectForm({
41
+ objectSchema: ViewType,
42
+ getIntent: () => createIntent(ExplorerAction.Create),
40
43
  }),
41
- },
42
- intent: {
43
- resolvers: () =>
44
- createResolver(ExplorerAction.Create, ({ name }) => ({
45
- data: { object: create(ViewType, { name, type: '' }) },
46
- })),
47
- },
48
- },
49
- };
50
- };
44
+ ),
45
+ }),
46
+ defineModule({
47
+ id: `${meta.id}/module/schema`,
48
+ activatesOn: ClientEvents.SetupSchema,
49
+ activate: () => contributes(ClientCapabilities.Schema, [ViewType]),
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,
60
+ }),
61
+ ]);
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
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'));
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { contributes, Capabilities, createResolver } from '@dxos/app-framework';
6
+ import { create } from '@dxos/live-object';
7
+
8
+ import { ExplorerAction, ViewType } from '../types';
9
+
10
+ export default () =>
11
+ contributes(
12
+ Capabilities.IntentResolver,
13
+ createResolver({
14
+ intent: ExplorerAction.Create,
15
+ resolve: ({ name }) => ({
16
+ data: { object: create(ViewType, { name, type: '' }) },
17
+ }),
18
+ }),
19
+ );
@@ -0,0 +1,22 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
+
9
+ import { ExplorerContainer } from '../components';
10
+ import { EXPLORER_PLUGIN } from '../meta';
11
+ import { ViewType } from '../types';
12
+
13
+ export default () =>
14
+ contributes(
15
+ Capabilities.ReactSurface,
16
+ createSurface({
17
+ id: `${EXPLORER_PLUGIN}/article`,
18
+ role: ['article', 'section'],
19
+ filter: (data): data is { subject: ViewType } => data.subject instanceof ViewType,
20
+ component: ({ data, role }) => <ExplorerContainer view={data.subject} role={role} />,
21
+ }),
22
+ );
@@ -6,11 +6,12 @@ import React from 'react';
6
6
 
7
7
  import { useGlobalSearch } from '@dxos/plugin-search';
8
8
  import { getSpace } from '@dxos/react-client/echo';
9
+ import { StackItem } from '@dxos/react-ui-stack';
9
10
 
10
11
  import { Graph } from './Graph';
11
12
  import { type ViewType } from '../types';
12
13
 
13
- const ExplorerArticle = ({ view }: { view: ViewType }) => {
14
+ const ExplorerContainer = ({ view, role }: { view: ViewType; role: string }) => {
14
15
  const space = getSpace(view);
15
16
  const { match } = useGlobalSearch();
16
17
 
@@ -19,10 +20,10 @@ const ExplorerArticle = ({ view }: { view: ViewType }) => {
19
20
  }
20
21
 
21
22
  return (
22
- <div role='none' className='row-span-2 overflow-auto'>
23
+ <StackItem.Content toolbar={false} size={role === 'section' ? 'square' : 'intrinsic'}>
23
24
  <Graph space={space} match={match} />
24
- </div>
25
+ </StackItem.Content>
25
26
  );
26
27
  };
27
28
 
28
- export default ExplorerArticle;
29
+ export default ExplorerContainer;
@@ -4,7 +4,7 @@
4
4
 
5
5
  import React, { type FC, useEffect, useMemo, useRef, useState } from 'react';
6
6
 
7
- import { type ReactiveEchoObject, type Space, getType } from '@dxos/client/echo';
7
+ import { getTypename, type ReactiveEchoObject, type Space } from '@dxos/client/echo';
8
8
  import { createSvgContext, defaultGridStyles, Grid, SVG, SVGRoot, Zoom } from '@dxos/gem-core';
9
9
  import {
10
10
  defaultStyles,
@@ -45,9 +45,10 @@ const colors = [
45
45
  export type GraphProps = {
46
46
  space: Space;
47
47
  match?: RegExp;
48
+ grid?: boolean;
48
49
  };
49
50
 
50
- export const Graph: FC<GraphProps> = ({ space, match }) => {
51
+ export const Graph: FC<GraphProps> = ({ space, match, grid }) => {
51
52
  const model = useMemo(() => (space ? new SpaceGraphModel({ schema: true }).open(space) : undefined), [space]);
52
53
  const [selected, setSelected] = useState<string>();
53
54
  const { themeMode } = useThemeContext();
@@ -61,15 +62,15 @@ export const Graph: FC<GraphProps> = ({ space, match }) => {
61
62
  strength: -100,
62
63
  },
63
64
  link: {
64
- distance: 180,
65
+ distance: 120,
65
66
  },
66
67
  radial: {
67
- radius: 200,
68
+ radius: 150,
68
69
  strength: 0.05,
69
70
  },
70
71
  },
71
72
  attributes: {
72
- radius: (node: GraphLayoutNode<EchoGraphNode>) => (node.data?.type === 'schema' ? 24 : 12),
73
+ radius: (node: GraphLayoutNode<EchoGraphNode>) => (node.data?.type === 'schema' ? 12 : 8),
73
74
  },
74
75
  }),
75
76
  [],
@@ -95,7 +96,7 @@ export const Graph: FC<GraphProps> = ({ space, match }) => {
95
96
  <SVGRoot context={context}>
96
97
  <SVG className={mx(defaultStyles, slots?.root?.className)}>
97
98
  <Markers arrowSize={6} />
98
- <Grid className={slots?.grid?.className ?? defaultGridStyles(themeMode)} />
99
+ {grid && <Grid className={slots?.grid?.className ?? defaultGridStyles(themeMode)} />}
99
100
  <Zoom extent={[1 / 2, 4]}>
100
101
  <GraphComponent
101
102
  model={model}
@@ -117,29 +118,27 @@ export const Graph: FC<GraphProps> = ({ space, match }) => {
117
118
  node: (node: GraphLayoutNode<ReactiveEchoObject<any>>) => {
118
119
  let className: string | undefined;
119
120
  if (node.data) {
120
- const typename = getType(node.data)?.objectId;
121
- if (typename) {
122
- className = colorMap.get(typename);
123
- if (!className) {
124
- className = colors[colorMap.size % colors.length];
125
- colorMap.set(typename, className);
121
+ const { object } = node.data;
122
+ if (object) {
123
+ const typename = getTypename(object);
124
+ if (typename) {
125
+ className = colorMap.get(typename);
126
+ if (!className) {
127
+ className = colors[colorMap.size % colors.length];
128
+ colorMap.set(typename, className);
129
+ }
126
130
  }
127
131
  }
128
132
  }
129
133
 
130
134
  const selected = filteredRef.current?.some((object) => object.id === node.data?.id);
135
+ const blur = !selected && !!filteredRef.current?.length;
131
136
  return {
132
- class: mx(
133
- filteredRef.current?.length
134
- ? selected
135
- ? [className]
136
- : '[&>text]:!fill-neutral-300'
137
- : ['[&>text]:!fill-neutral-700', className],
138
- ),
137
+ class: mx(className, blur && 'opacity-70'),
139
138
  };
140
139
  },
141
140
  link: () => ({
142
- class: '[&>path]:!stroke-neutral-300',
141
+ class: '[&>path]:!stroke-neutral-300 dark:[&>path]:!stroke-neutral-700',
143
142
  }),
144
143
  }}
145
144
  />
@@ -12,20 +12,20 @@ export type SpaceGraphModelOptions = {
12
12
  schema?: boolean;
13
13
  };
14
14
 
15
- export type EchoGraphNode = SchemaGraphNode | EchoObjectGraphNode;
16
-
17
- type EchoObjectGraphNode = {
18
- id: string;
19
- type: 'echo-object';
20
- object: ReactiveEchoObject<any>;
21
- };
22
-
23
15
  type SchemaGraphNode = {
24
16
  id: string;
25
17
  type: 'schema';
26
18
  schema: S.Schema<any>;
27
19
  };
28
20
 
21
+ type ObjectGraphNode = {
22
+ id: string;
23
+ type: 'object';
24
+ object: ReactiveEchoObject<any>;
25
+ };
26
+
27
+ export type EchoGraphNode = SchemaGraphNode | ObjectGraphNode;
28
+
29
29
  /**
30
30
  * Converts ECHO objects to a graph.
31
31
  */
@@ -58,13 +58,17 @@ export class SpaceGraphModel extends GraphModel<EchoGraphNode> {
58
58
  this._subscription = query.subscribe(
59
59
  ({ objects }) => {
60
60
  this._objects = objects;
61
+
62
+ // TODO(burdon): Normalize schema.
61
63
  this._graph.nodes = objects.map((object) => {
62
64
  if (object instanceof StoredSchema) {
63
65
  const effectSchema = space.db.schemaRegistry.getSchemaById(object.id)!;
64
66
  return { type: 'schema', id: object.id, schema: effectSchema.schema };
65
67
  }
66
- return { type: 'echo-object', id: object.id, object };
68
+
69
+ return { type: 'object', id: object.id, object };
67
70
  });
71
+
68
72
  this._graph.links = objects.reduce<GraphLink[]>((links, object) => {
69
73
  const objectSchema = getSchema(object);
70
74
  const typename = getType(object)?.objectId;
@@ -4,8 +4,7 @@
4
4
 
5
5
  import { lazy } from 'react';
6
6
 
7
- export const ExplorerMain = lazy(() => import('./ExplorerMain'));
8
- export const ExplorerArticle = lazy(() => import('./ExplorerArticle'));
7
+ export const ExplorerContainer = lazy(() => import('./ExplorerContainer'));
9
8
 
10
9
  export * from './Chart';
11
10
  export * from './Globe';
package/src/index.ts CHANGED
@@ -2,11 +2,8 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { ExplorerPlugin } from './ExplorerPlugin';
6
-
7
- export default ExplorerPlugin;
8
-
9
5
  // TODO(burdon): Factor out.
10
6
  export * from './components';
11
7
 
12
8
  export * from './ExplorerPlugin';
9
+ export * from './meta';
package/src/meta.ts CHANGED
@@ -6,11 +6,12 @@ import { type PluginMeta } from '@dxos/app-framework';
6
6
 
7
7
  export const EXPLORER_PLUGIN = 'dxos.org/plugin/explorer';
8
8
 
9
- export default {
9
+ export const meta = {
10
10
  id: EXPLORER_PLUGIN,
11
11
  name: 'Explorer',
12
- description: 'Explore the ECHO hypergraph.',
12
+ description: 'Install this plugin to view a hypergraph of all objects inside of your Space.',
13
13
  icon: 'ph--graph--regular',
14
14
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/experimental/plugin-explorer',
15
15
  tags: ['experimental'],
16
+ screenshots: ['https://dxos.network/plugin-details-explorer-dark.png'],
16
17
  } satisfies PluginMeta;
@@ -3,10 +3,14 @@
3
3
  //
4
4
 
5
5
  import { EXPLORER_PLUGIN } from './meta';
6
+ import { ViewType } from './types';
6
7
 
7
8
  export default [
8
9
  {
9
10
  'en-US': {
11
+ [ViewType.typename]: {
12
+ 'typename label': 'Explorer',
13
+ },
10
14
  [EXPLORER_PLUGIN]: {
11
15
  'plugin name': 'Explorer',
12
16
  'object title label': 'Title',
@@ -6,7 +6,7 @@ import { S, TypedObject } from '@dxos/echo-schema';
6
6
 
7
7
  // TODO(burdon): Clashes with sdk/view.
8
8
  export class ViewType extends TypedObject({
9
- typename: 'dxos.org/type/View',
9
+ typename: 'dxos.org/type/ExplorerView',
10
10
  version: '0.1.0',
11
11
  })({
12
12
  name: S.optional(S.String),
@@ -2,14 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import type {
6
- IntentResolverProvides,
7
- MetadataRecordsProvides,
8
- SurfaceProvides,
9
- TranslationsProvides,
10
- } from '@dxos/app-framework';
11
5
  import { S } from '@dxos/echo-schema';
12
- import { type SchemaProvides } from '@dxos/plugin-space';
13
6
 
14
7
  import { ViewType } from './schema';
15
8
  import { EXPLORER_PLUGIN } from '../meta';
@@ -26,9 +19,3 @@ export namespace ExplorerAction {
26
19
  }),
27
20
  }) {}
28
21
  }
29
-
30
- export type ExplorerPluginProvides = SurfaceProvides &
31
- IntentResolverProvides &
32
- MetadataRecordsProvides &
33
- TranslationsProvides &
34
- SchemaProvides;
@@ -1,27 +0,0 @@
1
- import {
2
- Graph
3
- } from "./chunk-5GTLMW4Q.mjs";
4
-
5
- // packages/plugins/experimental/plugin-explorer/src/components/ExplorerArticle.tsx
6
- import React from "react";
7
- import { useGlobalSearch } from "@dxos/plugin-search";
8
- import { getSpace } from "@dxos/react-client/echo";
9
- var ExplorerArticle = ({ view }) => {
10
- const space = getSpace(view);
11
- const { match } = useGlobalSearch();
12
- if (!space) {
13
- return null;
14
- }
15
- return /* @__PURE__ */ React.createElement("div", {
16
- role: "none",
17
- className: "row-span-2 overflow-auto"
18
- }, /* @__PURE__ */ React.createElement(Graph, {
19
- space,
20
- match
21
- }));
22
- };
23
- var ExplorerArticle_default = ExplorerArticle;
24
- export {
25
- ExplorerArticle_default as default
26
- };
27
- //# sourceMappingURL=ExplorerArticle-4F2ZO5QW.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/ExplorerArticle.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace } from '@dxos/react-client/echo';\n\nimport { Graph } from './Graph';\nimport { type ViewType } from '../types';\n\nconst ExplorerArticle = ({ view }: { view: ViewType }) => {\n const space = getSpace(view);\n const { match } = useGlobalSearch();\n\n if (!space) {\n return null;\n }\n\n return (\n <div role='none' className='row-span-2 overflow-auto'>\n <Graph space={space} match={match} />\n </div>\n );\n};\n\nexport default ExplorerArticle;\n"],
5
- "mappings": ";;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AAKzB,IAAMC,kBAAkB,CAAC,EAAEC,KAAI,MAAsB;AACnD,QAAMC,QAAQC,SAASF,IAAAA;AACvB,QAAM,EAAEG,MAAK,IAAKC,gBAAAA;AAElB,MAAI,CAACH,OAAO;AACV,WAAO;EACT;AAEA,SACE,sBAAA,cAACI,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,sBAAA,cAACC,OAAAA;IAAMP;IAAcE;;AAG3B;AAEA,IAAA,0BAAeJ;",
6
- "names": ["React", "useGlobalSearch", "getSpace", "ExplorerArticle", "view", "space", "getSpace", "match", "useGlobalSearch", "div", "role", "className", "Graph"]
7
- }
@@ -1,33 +0,0 @@
1
- import {
2
- Graph
3
- } from "./chunk-5GTLMW4Q.mjs";
4
-
5
- // packages/plugins/experimental/plugin-explorer/src/components/ExplorerMain.tsx
6
- import React from "react";
7
- import { useGlobalSearch } from "@dxos/plugin-search";
8
- import { getSpace } from "@dxos/react-client/echo";
9
- import { Main } from "@dxos/react-ui";
10
- import { baseSurface, topbarBlockPaddingStart, fixedInsetFlexLayout, bottombarBlockPaddingEnd } from "@dxos/react-ui-theme";
11
- var ExplorerMain = ({ view }) => {
12
- const space = getSpace(view);
13
- const { match } = useGlobalSearch();
14
- if (!space) {
15
- return null;
16
- }
17
- return /* @__PURE__ */ React.createElement(Main.Content, {
18
- classNames: [
19
- baseSurface,
20
- fixedInsetFlexLayout,
21
- topbarBlockPaddingStart,
22
- bottombarBlockPaddingEnd
23
- ]
24
- }, /* @__PURE__ */ React.createElement(Graph, {
25
- space,
26
- match
27
- }));
28
- };
29
- var ExplorerMain_default = ExplorerMain;
30
- export {
31
- ExplorerMain_default as default
32
- };
33
- //# sourceMappingURL=ExplorerMain-2X2GH7RE.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/ExplorerMain.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useGlobalSearch } from '@dxos/plugin-search';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { Main } from '@dxos/react-ui';\nimport {\n baseSurface,\n topbarBlockPaddingStart,\n fixedInsetFlexLayout,\n bottombarBlockPaddingEnd,\n} from '@dxos/react-ui-theme';\n\nimport { Graph } from './Graph';\nimport { type ViewType } from '../types';\n\nconst ExplorerMain = ({ view }: { view: ViewType }) => {\n const space = getSpace(view);\n const { match } = useGlobalSearch();\n if (!space) {\n return null;\n }\n\n return (\n <Main.Content classNames={[baseSurface, fixedInsetFlexLayout, topbarBlockPaddingStart, bottombarBlockPaddingEnd]}>\n <Graph space={space} match={match} />\n </Main.Content>\n );\n};\n\nexport default ExplorerMain;\n"],
5
- "mappings": ";;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,uBAAuB;AAChC,SAASC,gBAAgB;AACzB,SAASC,YAAY;AACrB,SACEC,aACAC,yBACAC,sBACAC,gCACK;AAKP,IAAMC,eAAe,CAAC,EAAEC,KAAI,MAAsB;AAChD,QAAMC,QAAQC,SAASF,IAAAA;AACvB,QAAM,EAAEG,MAAK,IAAKC,gBAAAA;AAClB,MAAI,CAACH,OAAO;AACV,WAAO;EACT;AAEA,SACE,sBAAA,cAACI,KAAKC,SAAO;IAACC,YAAY;MAACC;MAAaC;MAAsBC;MAAyBC;;KACrF,sBAAA,cAACC,OAAAA;IAAMX;IAAcE;;AAG3B;AAEA,IAAA,uBAAeJ;",
6
- "names": ["React", "useGlobalSearch", "getSpace", "Main", "baseSurface", "topbarBlockPaddingStart", "fixedInsetFlexLayout", "bottombarBlockPaddingEnd", "ExplorerMain", "view", "space", "getSpace", "match", "useGlobalSearch", "Main", "Content", "classNames", "baseSurface", "fixedInsetFlexLayout", "topbarBlockPaddingStart", "bottombarBlockPaddingEnd", "Graph"]
7
- }