@dxos/plugin-explorer 0.7.4 → 0.7.5-labs.5f04cf6

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 (127) hide show
  1. package/dist/lib/browser/ExplorerContainer-A7UBZ3QP.mjs +28 -0
  2. package/dist/lib/browser/ExplorerContainer-A7UBZ3QP.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-HIJQV4QE.mjs → chunk-5GTLMW4Q.mjs} +3 -3
  4. package/dist/lib/browser/chunk-5GTLMW4Q.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-KG3BEHW5.mjs → chunk-D67EYME2.mjs} +3 -3
  6. package/dist/lib/browser/chunk-D67EYME2.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-DTAFIUA7.mjs +10832 -0
  8. package/dist/lib/browser/chunk-DTAFIUA7.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-QB4SM36D.mjs +37 -0
  10. package/dist/lib/browser/chunk-QB4SM36D.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +61 -10958
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/intent-resolver-UK4B5CXA.mjs +21 -0
  14. package/dist/lib/browser/intent-resolver-UK4B5CXA.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-FPU2HQOW.mjs +30 -0
  18. package/dist/lib/browser/react-surface-FPU2HQOW.mjs.map +7 -0
  19. package/dist/lib/browser/types/index.mjs +2 -2
  20. package/dist/lib/node/{ExplorerArticle-LQ454R2T.cjs → ExplorerContainer-ZV2YKOUE.cjs} +13 -12
  21. package/dist/lib/node/ExplorerContainer-ZV2YKOUE.cjs.map +7 -0
  22. package/dist/lib/node/{chunk-N6DCTBDJ.cjs → chunk-34MGVWOY.cjs} +7 -7
  23. package/dist/lib/node/chunk-34MGVWOY.cjs.map +7 -0
  24. package/dist/lib/node/chunk-4H2Y5RER.cjs +10854 -0
  25. package/dist/lib/node/chunk-4H2Y5RER.cjs.map +7 -0
  26. package/dist/lib/node/{chunk-IVCQS2Z3.cjs → chunk-WHMJ2VQ2.cjs} +5 -5
  27. package/dist/lib/node/chunk-WHMJ2VQ2.cjs.map +7 -0
  28. package/dist/lib/node/{chunk-VEJSCGZU.cjs → chunk-WY65LACR.cjs} +18 -8
  29. package/dist/lib/node/chunk-WY65LACR.cjs.map +7 -0
  30. package/dist/lib/node/index.cjs +59 -10943
  31. package/dist/lib/node/index.cjs.map +4 -4
  32. package/dist/lib/node/intent-resolver-Z4JGARBP.cjs +36 -0
  33. package/dist/lib/node/intent-resolver-Z4JGARBP.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-AVJLNOT4.cjs → react-surface-RFDCK44R.cjs} +22 -29
  38. package/dist/lib/node/react-surface-RFDCK44R.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-IOA2RNC5.mjs → ExplorerContainer-JXY6XN2D.mjs} +10 -9
  42. package/dist/lib/node-esm/ExplorerContainer-JXY6XN2D.mjs.map +7 -0
  43. package/dist/lib/node-esm/chunk-3NVZEYZY.mjs +38 -0
  44. package/dist/lib/node-esm/chunk-3NVZEYZY.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-HIMBUOZ3.mjs +10834 -0
  46. package/dist/lib/node-esm/chunk-HIMBUOZ3.mjs.map +7 -0
  47. package/dist/lib/node-esm/{chunk-2KCTAIJN.mjs → chunk-WTGQFG6L.mjs} +3 -3
  48. package/dist/lib/node-esm/chunk-WTGQFG6L.mjs.map +7 -0
  49. package/dist/lib/node-esm/{chunk-UTMD4Q5R.mjs → chunk-ZEM6ZU5V.mjs} +3 -3
  50. package/dist/lib/node-esm/chunk-ZEM6ZU5V.mjs.map +7 -0
  51. package/dist/lib/node-esm/index.mjs +61 -10958
  52. package/dist/lib/node-esm/index.mjs.map +4 -4
  53. package/dist/lib/node-esm/intent-resolver-PW5ZUI4X.mjs +22 -0
  54. package/dist/lib/node-esm/intent-resolver-PW5ZUI4X.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-3D7UXAMI.mjs +31 -0
  58. package/dist/lib/node-esm/react-surface-3D7UXAMI.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/ExplorerContainer.d.ts +8 -0
  69. package/dist/types/src/components/ExplorerContainer.d.ts.map +1 -0
  70. package/dist/types/src/components/Graph/graph-model.d.ts.map +1 -1
  71. package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
  72. package/dist/types/src/components/index.d.ts +2 -4
  73. package/dist/types/src/components/index.d.ts.map +1 -1
  74. package/dist/types/src/index.d.ts +1 -2
  75. package/dist/types/src/index.d.ts.map +1 -1
  76. package/dist/types/src/meta.d.ts +1 -2
  77. package/dist/types/src/meta.d.ts.map +1 -1
  78. package/dist/types/src/types/index.d.ts +1 -1
  79. package/dist/types/src/types/index.d.ts.map +1 -1
  80. package/dist/types/src/types/schema.d.ts +12 -0
  81. package/dist/types/src/types/schema.d.ts.map +1 -0
  82. package/dist/types/src/types/types.d.ts +16 -5
  83. package/dist/types/src/types/types.d.ts.map +1 -1
  84. package/dist/types/tsconfig.tsbuildinfo +1 -0
  85. package/package.json +24 -31
  86. package/src/ExplorerPlugin.tsx +46 -91
  87. package/src/capabilities/index.ts +8 -0
  88. package/src/capabilities/intent-resolver.ts +16 -0
  89. package/src/capabilities/react-surface.tsx +22 -0
  90. package/src/components/{ExplorerArticle.tsx → ExplorerContainer.tsx} +5 -4
  91. package/src/components/Graph/Graph.stories.tsx +5 -5
  92. package/src/components/Graph/graph-model.ts +2 -2
  93. package/src/components/Tree/Tree.stories.tsx +23 -21
  94. package/src/components/index.ts +1 -2
  95. package/src/index.ts +1 -4
  96. package/src/meta.ts +1 -1
  97. package/src/types/index.ts +1 -1
  98. package/src/types/schema.ts +14 -0
  99. package/src/types/types.ts +12 -18
  100. package/dist/lib/browser/ExplorerArticle-KSRCIPOE.mjs +0 -27
  101. package/dist/lib/browser/ExplorerArticle-KSRCIPOE.mjs.map +0 -7
  102. package/dist/lib/browser/ExplorerMain-GZAQIZZN.mjs +0 -33
  103. package/dist/lib/browser/ExplorerMain-GZAQIZZN.mjs.map +0 -7
  104. package/dist/lib/browser/chunk-EAKI45DO.mjs +0 -27
  105. package/dist/lib/browser/chunk-EAKI45DO.mjs.map +0 -7
  106. package/dist/lib/browser/chunk-HIJQV4QE.mjs.map +0 -7
  107. package/dist/lib/browser/chunk-KG3BEHW5.mjs.map +0 -7
  108. package/dist/lib/node/ExplorerArticle-LQ454R2T.cjs.map +0 -7
  109. package/dist/lib/node/ExplorerMain-AVJLNOT4.cjs.map +0 -7
  110. package/dist/lib/node/chunk-IVCQS2Z3.cjs.map +0 -7
  111. package/dist/lib/node/chunk-N6DCTBDJ.cjs.map +0 -7
  112. package/dist/lib/node/chunk-VEJSCGZU.cjs.map +0 -7
  113. package/dist/lib/node-esm/ExplorerArticle-IOA2RNC5.mjs.map +0 -7
  114. package/dist/lib/node-esm/ExplorerMain-ECYATOPW.mjs +0 -34
  115. package/dist/lib/node-esm/ExplorerMain-ECYATOPW.mjs.map +0 -7
  116. package/dist/lib/node-esm/chunk-2KCTAIJN.mjs.map +0 -7
  117. package/dist/lib/node-esm/chunk-ATSNCSBK.mjs +0 -28
  118. package/dist/lib/node-esm/chunk-ATSNCSBK.mjs.map +0 -7
  119. package/dist/lib/node-esm/chunk-UTMD4Q5R.mjs.map +0 -7
  120. package/dist/types/src/components/ExplorerArticle.d.ts +0 -7
  121. package/dist/types/src/components/ExplorerArticle.d.ts.map +0 -1
  122. package/dist/types/src/components/ExplorerMain.d.ts +0 -7
  123. package/dist/types/src/components/ExplorerMain.d.ts.map +0 -1
  124. package/dist/types/src/types/view.d.ts +0 -14
  125. package/dist/types/src/types/view.d.ts.map +0 -1
  126. package/src/components/ExplorerMain.tsx +0 -34
  127. package/src/types/view.ts +0 -11
@@ -2,100 +2,55 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import {
6
+ Capabilities,
7
+ contributes,
8
+ createIntent,
9
+ defineModule,
10
+ definePlugin,
11
+ Events,
12
+ oneOf,
13
+ } from '@dxos/app-framework';
14
+ import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
6
15
 
7
- import { NavigationAction, parseIntentPlugin, resolvePlugin, type PluginDefinition } from '@dxos/app-framework';
8
- import { parseClientPlugin } from '@dxos/plugin-client';
9
- import { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';
10
- import { SpaceAction } from '@dxos/plugin-space';
11
- import { create } from '@dxos/react-client/echo';
12
-
13
- import { ExplorerArticle, ExplorerMain } from './components';
14
- import meta, { EXPLORER_PLUGIN } from './meta';
16
+ import { IntentResolver, ReactSurface } from './capabilities';
17
+ import { EXPLORER_PLUGIN, meta } from './meta';
15
18
  import translations from './translations';
16
- import { ViewType } from './types';
17
- import { ExplorerAction, type ExplorerPluginProvides } from './types';
19
+ import { ViewType, ExplorerAction } from './types';
18
20
 
19
- export const ExplorerPlugin = (): PluginDefinition<ExplorerPluginProvides> => {
20
- return {
21
- meta,
22
- provides: {
23
- metadata: {
24
- records: {
25
- [ViewType.typename]: {
26
- createObject: ExplorerAction.CREATE,
21
+ export const ExplorerPlugin = () =>
22
+ definePlugin(meta, [
23
+ defineModule({
24
+ id: `${meta.id}/module/translations`,
25
+ activatesOn: Events.SetupTranslations,
26
+ activate: () => contributes(Capabilities.Translations, translations),
27
+ }),
28
+ defineModule({
29
+ id: `${meta.id}/module/metadata`,
30
+ activatesOn: oneOf(Events.Startup, Events.SetupAppGraph),
31
+ activate: () =>
32
+ contributes(Capabilities.Metadata, {
33
+ id: ViewType.typename,
34
+ metadata: {
35
+ createObject: (props: { name?: string }) => createIntent(ExplorerAction.Create, props),
27
36
  placeholder: ['object title placeholder', { ns: EXPLORER_PLUGIN }],
28
37
  icon: 'ph--graph--regular',
29
38
  },
30
- },
31
- },
32
- translations,
33
- echo: {
34
- schema: [ViewType],
35
- },
36
- graph: {
37
- builder: (plugins) => {
38
- const client = resolvePlugin(plugins, parseClientPlugin)?.provides.client;
39
- const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;
40
- if (!client || !dispatch) {
41
- return [];
42
- }
43
-
44
- return createExtension({
45
- id: ExplorerAction.CREATE,
46
- filter: (node): node is ActionGroup => isActionGroup(node) && node.id.startsWith(SpaceAction.ADD_OBJECT),
47
- actions: ({ node }) => {
48
- const id = node.id.split('/').at(-1);
49
- const [spaceId, objectId] = id?.split(':') ?? [];
50
- const space = client.spaces.get().find((space) => space.id === spaceId);
51
- const object = objectId && space?.db.getObjectById(objectId);
52
- const target = objectId ? object : space;
53
- if (!target) {
54
- return;
55
- }
56
-
57
- return [
58
- {
59
- id: `${EXPLORER_PLUGIN}/create/${node.id}`,
60
- data: async () => {
61
- await dispatch([
62
- { plugin: EXPLORER_PLUGIN, action: ExplorerAction.CREATE },
63
- { action: SpaceAction.ADD_OBJECT, data: { target } },
64
- { action: NavigationAction.OPEN },
65
- ]);
66
- },
67
- properties: {
68
- label: ['create object label', { ns: EXPLORER_PLUGIN }],
69
- icon: 'ph--graph--regular',
70
- testId: 'explorerPlugin.createObject',
71
- },
72
- },
73
- ];
74
- },
75
- });
76
- },
77
- },
78
- surface: {
79
- component: ({ data, role }) => {
80
- switch (role) {
81
- case 'main':
82
- return data.active instanceof ViewType ? <ExplorerMain view={data.active} /> : null;
83
- case 'article':
84
- return data.object instanceof ViewType ? <ExplorerArticle view={data.object} /> : null;
85
- default:
86
- return null;
87
- }
88
- },
89
- },
90
- intent: {
91
- resolver: (intent) => {
92
- switch (intent.action) {
93
- case ExplorerAction.CREATE: {
94
- return { data: create(ViewType, { name: '', type: '' }) };
95
- }
96
- }
97
- },
98
- },
99
- },
100
- };
101
- };
39
+ }),
40
+ }),
41
+ defineModule({
42
+ id: `${meta.id}/module/schema`,
43
+ activatesOn: ClientEvents.SetupClient,
44
+ activate: () => contributes(ClientCapabilities.Schema, [ViewType]),
45
+ }),
46
+ defineModule({
47
+ id: `${meta.id}/module/react-surface`,
48
+ activatesOn: Events.Startup,
49
+ activate: ReactSurface,
50
+ }),
51
+ defineModule({
52
+ id: `${meta.id}/module/intent-resolver`,
53
+ activatesOn: Events.SetupIntents,
54
+ activate: IntentResolver,
55
+ }),
56
+ ]);
@@ -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,16 @@
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(ExplorerAction.Create, ({ name }) => ({
14
+ data: { object: create(ViewType, { name, type: '' }) },
15
+ })),
16
+ );
@@ -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;
@@ -27,13 +27,13 @@ const Story = () => {
27
27
  useEffect(() => {
28
28
  const space = client.spaces.default;
29
29
  const generator = createSpaceObjectGenerator(space);
30
- generator.addSchemas();
31
- void generator
32
- .createObjects({
30
+ queueMicrotask(async () => {
31
+ await generator.addSchemas();
32
+ await generator.createObjects({
33
33
  [TestSchemaType.organization]: 20,
34
34
  [TestSchemaType.contact]: 50,
35
- })
36
- .catch(() => {});
35
+ });
36
+ });
37
37
 
38
38
  const view = space.db.add(create(ViewType, { name: '', type: '' }));
39
39
  setSpace(space);
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { AST, MutableSchema, ReferenceAnnotationId, type S, SchemaValidator, StoredSchema } from '@dxos/echo-schema';
5
+ import { AST, EchoSchema, ReferenceAnnotationId, type S, SchemaValidator, StoredSchema } from '@dxos/echo-schema';
6
6
  import { type GraphData, type GraphLink, GraphModel } from '@dxos/gem-spore';
7
7
  import { log } from '@dxos/log';
8
8
  import { CollectionType } from '@dxos/plugin-space/types';
@@ -73,7 +73,7 @@ export class SpaceGraphModel extends GraphModel<EchoGraphNode> {
73
73
  return links;
74
74
  }
75
75
 
76
- if (!(objectSchema instanceof MutableSchema)) {
76
+ if (!(objectSchema instanceof EchoSchema)) {
77
77
  const idx = objects.findIndex((obj) => obj.id === typename);
78
78
  if (idx === -1) {
79
79
  this._graph.nodes.push({
@@ -7,7 +7,7 @@ import '@dxos-theme';
7
7
  import { type Meta } from '@storybook/react';
8
8
  import React, { type FC, useEffect, useState } from 'react';
9
9
 
10
- import { create } from '@dxos/live-object';
10
+ import { create, makeRef } from '@dxos/live-object';
11
11
  import { TreeItemType, TreeType } from '@dxos/plugin-outliner/types';
12
12
  import { faker } from '@dxos/random';
13
13
  import { useClient } from '@dxos/react-client';
@@ -24,7 +24,7 @@ import { Tree, type TreeComponentProps } from './Tree';
24
24
  faker.seed(1);
25
25
 
26
26
  const makeTreeItems = <T extends number>(count: T, items: TreeItemType[] = []) => {
27
- return range(count, () => create(TreeItemType, { content: '', items }));
27
+ return range(count, () => create(TreeItemType, { content: '', items: items.map((item) => makeRef(item)) }));
28
28
  };
29
29
 
30
30
  const Story: FC<ClientRepeatedComponentProps & { type?: TreeComponentProps<any>['variant'] }> = ({ type }) => {
@@ -34,27 +34,29 @@ const Story: FC<ClientRepeatedComponentProps & { type?: TreeComponentProps<any>[
34
34
  useEffect(() => {
35
35
  setTimeout(() => {
36
36
  const tree = create(TreeType, {
37
- root: makeTreeItems(1, [
38
- ...makeTreeItems(7),
39
- ...makeTreeItems(1, [
40
- ...makeTreeItems(1),
37
+ root: makeRef(
38
+ makeTreeItems(1, [
39
+ ...makeTreeItems(7),
41
40
  ...makeTreeItems(1, [
42
- ...makeTreeItems(3),
43
- ...makeTreeItems(1, makeTreeItems(2)),
44
- ...makeTreeItems(2),
45
- ...makeTreeItems(1, makeTreeItems(2)),
46
- ...makeTreeItems(2),
41
+ ...makeTreeItems(1),
42
+ ...makeTreeItems(1, [
43
+ ...makeTreeItems(3),
44
+ ...makeTreeItems(1, makeTreeItems(2)),
45
+ ...makeTreeItems(2),
46
+ ...makeTreeItems(1, makeTreeItems(2)),
47
+ ...makeTreeItems(2),
48
+ ]),
49
+ ...makeTreeItems(1),
47
50
  ]),
48
- ...makeTreeItems(1),
49
- ]),
50
- ...makeTreeItems(2),
51
- ...makeTreeItems(1, [
52
- ...makeTreeItems(1),
53
- ...makeTreeItems(1, [...makeTreeItems(2), ...makeTreeItems(1, makeTreeItems(2))]),
54
- ...makeTreeItems(1),
55
- ]),
56
- ...makeTreeItems(2),
57
- ])[0],
51
+ ...makeTreeItems(2),
52
+ ...makeTreeItems(1, [
53
+ ...makeTreeItems(1),
54
+ ...makeTreeItems(1, [...makeTreeItems(2), ...makeTreeItems(1, makeTreeItems(2))]),
55
+ ...makeTreeItems(1),
56
+ ]),
57
+ ...makeTreeItems(2),
58
+ ])[0],
59
+ ),
58
60
  });
59
61
 
60
62
  space.db.add(tree);
@@ -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,7 +6,7 @@ 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
12
  description: 'Explore the ECHO hypergraph.',
@@ -2,5 +2,5 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- export * from './view';
5
+ export * from './schema';
6
6
  export * from './types';
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { S, TypedObject } from '@dxos/echo-schema';
6
+
7
+ // TODO(burdon): Clashes with sdk/view.
8
+ export class ViewType extends TypedObject({
9
+ typename: 'dxos.org/type/ExplorerView',
10
+ version: '0.1.0',
11
+ })({
12
+ name: S.optional(S.String),
13
+ type: S.String,
14
+ }) {}
@@ -2,26 +2,20 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import type {
6
- GraphBuilderProvides,
7
- IntentResolverProvides,
8
- MetadataRecordsProvides,
9
- SurfaceProvides,
10
- TranslationsProvides,
11
- } from '@dxos/app-framework';
12
- import { type SchemaProvides } from '@dxos/plugin-space';
5
+ import { S } from '@dxos/echo-schema';
13
6
 
7
+ import { ViewType } from './schema';
14
8
  import { EXPLORER_PLUGIN } from '../meta';
15
9
 
16
- const EXPLORER_ACTION = `${EXPLORER_PLUGIN}/action`;
10
+ export namespace ExplorerAction {
11
+ const EXPLORER_ACTION = `${EXPLORER_PLUGIN}/action`;
17
12
 
18
- export enum ExplorerAction {
19
- CREATE = `${EXPLORER_ACTION}/create`,
13
+ export class Create extends S.TaggedClass<Create>()(`${EXPLORER_ACTION}/create`, {
14
+ input: S.Struct({
15
+ name: S.optional(S.String),
16
+ }),
17
+ output: S.Struct({
18
+ object: ViewType,
19
+ }),
20
+ }) {}
20
21
  }
21
-
22
- export type ExplorerPluginProvides = SurfaceProvides &
23
- IntentResolverProvides &
24
- GraphBuilderProvides &
25
- MetadataRecordsProvides &
26
- TranslationsProvides &
27
- SchemaProvides;
@@ -1,27 +0,0 @@
1
- import {
2
- Graph
3
- } from "./chunk-HIJQV4QE.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-KSRCIPOE.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-HIJQV4QE.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-GZAQIZZN.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
- }
@@ -1,27 +0,0 @@
1
- import {
2
- EXPLORER_PLUGIN
3
- } from "./chunk-KG3BEHW5.mjs";
4
-
5
- // packages/plugins/experimental/plugin-explorer/src/types/view.ts
6
- import { S, TypedObject } from "@dxos/echo-schema";
7
- var ViewType = class extends TypedObject({
8
- typename: "dxos.org/type/View",
9
- version: "0.1.0"
10
- })({
11
- name: S.optional(S.String),
12
- type: S.String
13
- }) {
14
- };
15
-
16
- // packages/plugins/experimental/plugin-explorer/src/types/types.ts
17
- var EXPLORER_ACTION = `${EXPLORER_PLUGIN}/action`;
18
- var ExplorerAction;
19
- (function(ExplorerAction2) {
20
- ExplorerAction2[ExplorerAction2["CREATE"] = `${EXPLORER_ACTION}/create`] = "CREATE";
21
- })(ExplorerAction || (ExplorerAction = {}));
22
-
23
- export {
24
- ViewType,
25
- ExplorerAction
26
- };
27
- //# sourceMappingURL=chunk-EAKI45DO.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/types/view.ts", "../../../src/types/types.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { S, TypedObject } from '@dxos/echo-schema';\n\n// TODO(burdon): Standardize views?\nexport class ViewType extends TypedObject({ typename: 'dxos.org/type/View', version: '0.1.0' })({\n name: S.optional(S.String),\n type: S.String,\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type {\n GraphBuilderProvides,\n IntentResolverProvides,\n MetadataRecordsProvides,\n SurfaceProvides,\n TranslationsProvides,\n} from '@dxos/app-framework';\nimport { type SchemaProvides } from '@dxos/plugin-space';\n\nimport { EXPLORER_PLUGIN } from '../meta';\n\nconst EXPLORER_ACTION = `${EXPLORER_PLUGIN}/action`;\n\nexport enum ExplorerAction {\n CREATE = `${EXPLORER_ACTION}/create`,\n}\n\nexport type ExplorerPluginProvides = SurfaceProvides &\n IntentResolverProvides &\n GraphBuilderProvides &\n MetadataRecordsProvides &\n TranslationsProvides &\n SchemaProvides;\n"],
5
- "mappings": ";;;;;AAIA,SAASA,GAAGC,mBAAmB;AAGxB,IAAMC,WAAN,cAAuBC,YAAY;EAAEC,UAAU;EAAsBC,SAAS;AAAQ,CAAA,EAAG;EAC9FC,MAAMC,EAAEC,SAASD,EAAEE,MAAM;EACzBC,MAAMH,EAAEE;AACV,CAAA,EAAA;AAAI;;;ACKJ,IAAME,kBAAkB,GAAGC,eAAAA;;UAEfC,iBAAAA;8CACD,GAAGF,eAAAA,SAAwB,IAAA;GAD1BE,mBAAAA,iBAAAA,CAAAA,EAAAA;",
6
- "names": ["S", "TypedObject", "ViewType", "TypedObject", "typename", "version", "name", "S", "optional", "String", "type", "EXPLORER_ACTION", "EXPLORER_PLUGIN", "ExplorerAction"]
7
- }