@dxos/plugin-navtree 0.8.4-main.dedc0f3 → 0.8.4-main.ead640a

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 (89) hide show
  1. package/dist/lib/browser/{app-graph-builder-6JDBQ25U.mjs → app-graph-builder-YAPMENYT.mjs} +10 -9
  2. package/dist/lib/browser/app-graph-builder-YAPMENYT.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-ZKVY35IG.mjs → chunk-IMFXKPSB.mjs} +115 -102
  4. package/dist/lib/browser/chunk-IMFXKPSB.mjs.map +7 -0
  5. package/dist/lib/browser/{chunk-WCARAZ7J.mjs → chunk-LPAREX6J.mjs} +4 -4
  6. package/dist/lib/browser/chunk-LPAREX6J.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-ZENLR72O.mjs +14 -0
  8. package/dist/lib/browser/chunk-ZENLR72O.mjs.map +7 -0
  9. package/dist/lib/browser/index.mjs +5 -7
  10. package/dist/lib/browser/index.mjs.map +3 -3
  11. package/dist/lib/browser/{intent-resolver-N35ZIHFD.mjs → intent-resolver-TCQXGF6U.mjs} +6 -6
  12. package/dist/lib/browser/intent-resolver-TCQXGF6U.mjs.map +7 -0
  13. package/dist/lib/browser/{keyboard-HMTMA33N.mjs → keyboard-AHSAWKXA.mjs} +4 -4
  14. package/dist/lib/browser/{keyboard-HMTMA33N.mjs.map → keyboard-AHSAWKXA.mjs.map} +1 -1
  15. package/dist/lib/browser/meta.json +1 -1
  16. package/dist/lib/browser/{react-surface-5PZ4XJT7.mjs → react-surface-AH2TP73M.mjs} +10 -10
  17. package/dist/lib/browser/react-surface-AH2TP73M.mjs.map +7 -0
  18. package/dist/lib/browser/{state-P5DGL7KS.mjs → state-2Q623V7U.mjs} +7 -7
  19. package/dist/lib/browser/state-2Q623V7U.mjs.map +7 -0
  20. package/dist/types/src/NavTreePlugin.d.ts +1 -1
  21. package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
  22. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  24. package/dist/types/src/capabilities/index.d.ts +12 -9
  25. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  26. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  27. package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
  28. package/dist/types/src/components/NavTree/NavTree.stories.d.ts +1 -2
  29. package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
  30. package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
  31. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
  32. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +1 -2
  33. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
  34. package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +1 -1
  35. package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
  36. package/dist/types/src/components/Sidebar/L0Menu.d.ts +2 -0
  37. package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
  38. package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
  39. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
  40. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +1 -2
  41. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
  42. package/dist/types/src/events.d.ts.map +1 -1
  43. package/dist/types/src/experimental/Tree.d.ts +1 -2
  44. package/dist/types/src/experimental/Tree.d.ts.map +1 -1
  45. package/dist/types/src/experimental/Tree.stories.d.ts +2 -3
  46. package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
  47. package/dist/types/src/meta.d.ts +2 -3
  48. package/dist/types/src/meta.d.ts.map +1 -1
  49. package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
  50. package/dist/types/src/testing/generator.d.ts +1 -1
  51. package/dist/types/src/testing/generator.d.ts.map +1 -1
  52. package/dist/types/src/types.d.ts +4 -3
  53. package/dist/types/src/types.d.ts.map +1 -1
  54. package/dist/types/tsconfig.tsbuildinfo +1 -1
  55. package/package.json +47 -47
  56. package/src/NavTreePlugin.tsx +70 -71
  57. package/src/capabilities/app-graph-builder.ts +6 -5
  58. package/src/capabilities/capabilities.ts +2 -2
  59. package/src/capabilities/intent-resolver.ts +1 -1
  60. package/src/capabilities/react-surface.tsx +4 -4
  61. package/src/capabilities/state.ts +2 -2
  62. package/src/components/CommandsDialog/CommandsDialog.tsx +3 -3
  63. package/src/components/CommandsDialog/CommandsTrigger.tsx +2 -2
  64. package/src/components/NavTree/NavTree.stories.tsx +61 -47
  65. package/src/components/NavTree/NavTree.tsx +4 -0
  66. package/src/components/NavTreeContainer.tsx +13 -6
  67. package/src/components/NavTreeDocumentTitle.tsx +2 -2
  68. package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +2 -4
  69. package/src/components/NavTreeItem/NavTreeItemAction.tsx +5 -4
  70. package/src/components/NavTreeItem/NavTreeItemColumns.tsx +27 -21
  71. package/src/components/Sidebar/L0Menu.tsx +50 -49
  72. package/src/components/Sidebar/L1Panel.tsx +7 -8
  73. package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +3 -4
  74. package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +20 -12
  75. package/src/events.ts +2 -2
  76. package/src/experimental/Tree.stories.tsx +24 -28
  77. package/src/experimental/Tree.tsx +5 -22
  78. package/src/meta.ts +5 -7
  79. package/src/testing/app-graph-builder.ts +9 -8
  80. package/src/testing/generator.ts +2 -2
  81. package/src/types.ts +4 -3
  82. package/dist/lib/browser/app-graph-builder-6JDBQ25U.mjs.map +0 -7
  83. package/dist/lib/browser/chunk-ERDGQTH5.mjs +0 -16
  84. package/dist/lib/browser/chunk-ERDGQTH5.mjs.map +0 -7
  85. package/dist/lib/browser/chunk-WCARAZ7J.mjs.map +0 -7
  86. package/dist/lib/browser/chunk-ZKVY35IG.mjs.map +0 -7
  87. package/dist/lib/browser/intent-resolver-N35ZIHFD.mjs.map +0 -7
  88. package/dist/lib/browser/react-surface-5PZ4XJT7.mjs.map +0 -7
  89. package/dist/lib/browser/state-P5DGL7KS.mjs.map +0 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-navtree",
3
- "version": "0.8.4-main.dedc0f3",
3
+ "version": "0.8.4-main.ead640a",
4
4
  "description": "DXOS Surface plugin for a tree view visualization of the graph.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -27,62 +27,62 @@
27
27
  "@atlaskit/pragmatic-drag-and-drop": "^1.4.0",
28
28
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.3",
29
29
  "@preact-signals/safe-react": "^0.9.0",
30
- "@preact/signals-core": "^1.9.0",
30
+ "@preact/signals-core": "^1.12.1",
31
31
  "@radix-ui/react-dismissable-layer": "1.1.5",
32
32
  "@radix-ui/react-use-controllable-state": "1.1.0",
33
33
  "date-fns": "^3.3.1",
34
- "effect": "3.17.7",
35
- "@dxos/app-framework": "0.8.4-main.dedc0f3",
36
- "@dxos/async": "0.8.4-main.dedc0f3",
37
- "@dxos/app-graph": "0.8.4-main.dedc0f3",
38
- "@dxos/debug": "0.8.4-main.dedc0f3",
39
- "@dxos/echo-schema": "0.8.4-main.dedc0f3",
40
- "@dxos/echo": "0.8.4-main.dedc0f3",
41
- "@dxos/invariant": "0.8.4-main.dedc0f3",
42
- "@dxos/keyboard": "0.8.4-main.dedc0f3",
43
- "@dxos/local-storage": "0.8.4-main.dedc0f3",
44
- "@dxos/log": "0.8.4-main.dedc0f3",
45
- "@dxos/live-object": "0.8.4-main.dedc0f3",
46
- "@dxos/plugin-deck": "0.8.4-main.dedc0f3",
47
- "@dxos/plugin-graph": "0.8.4-main.dedc0f3",
48
- "@dxos/protocols": "0.8.4-main.dedc0f3",
49
- "@dxos/plugin-observability": "0.8.4-main.dedc0f3",
50
- "@dxos/react-client": "0.8.4-main.dedc0f3",
51
- "@dxos/react-ui-attention": "0.8.4-main.dedc0f3",
52
- "@dxos/react-ui-list": "0.8.4-main.dedc0f3",
53
- "@dxos/react-ui-searchlist": "0.8.4-main.dedc0f3",
54
- "@dxos/react-ui-menu": "0.8.4-main.dedc0f3",
55
- "@dxos/react-ui-stack": "0.8.4-main.dedc0f3",
56
- "@dxos/react-ui-tabs": "0.8.4-main.dedc0f3",
57
- "@dxos/util": "0.8.4-main.dedc0f3"
34
+ "@dxos/app-framework": "0.8.4-main.ead640a",
35
+ "@dxos/app-graph": "0.8.4-main.ead640a",
36
+ "@dxos/async": "0.8.4-main.ead640a",
37
+ "@dxos/debug": "0.8.4-main.ead640a",
38
+ "@dxos/echo": "0.8.4-main.ead640a",
39
+ "@dxos/keyboard": "0.8.4-main.ead640a",
40
+ "@dxos/invariant": "0.8.4-main.ead640a",
41
+ "@dxos/lit-ui": "0.8.4-main.ead640a",
42
+ "@dxos/live-object": "0.8.4-main.ead640a",
43
+ "@dxos/local-storage": "0.8.4-main.ead640a",
44
+ "@dxos/log": "0.8.4-main.ead640a",
45
+ "@dxos/plugin-deck": "0.8.4-main.ead640a",
46
+ "@dxos/plugin-observability": "0.8.4-main.ead640a",
47
+ "@dxos/plugin-graph": "0.8.4-main.ead640a",
48
+ "@dxos/protocols": "0.8.4-main.ead640a",
49
+ "@dxos/react-client": "0.8.4-main.ead640a",
50
+ "@dxos/react-ui-attention": "0.8.4-main.ead640a",
51
+ "@dxos/react-ui-list": "0.8.4-main.ead640a",
52
+ "@dxos/react-ui-menu": "0.8.4-main.ead640a",
53
+ "@dxos/react-ui-stack": "0.8.4-main.ead640a",
54
+ "@dxos/react-ui-searchlist": "0.8.4-main.ead640a",
55
+ "@dxos/react-ui-tabs": "0.8.4-main.ead640a",
56
+ "@dxos/util": "0.8.4-main.ead640a"
58
57
  },
59
58
  "devDependencies": {
60
- "@effect-rx/rx-react": "0.38.0",
61
- "@effect/platform": "0.90.2",
62
- "@types/react": "~18.2.0",
63
- "@types/react-dom": "~18.2.0",
64
- "react": "~18.2.0",
65
- "react-dom": "~18.2.0",
66
- "vite": "7.1.1",
67
- "@dxos/echo-signals": "0.8.4-main.dedc0f3",
68
- "@dxos/plugin-space": "0.8.4-main.dedc0f3",
69
- "@dxos/plugin-attention": "0.8.4-main.dedc0f3",
70
- "@dxos/plugin-client": "0.8.4-main.dedc0f3",
71
- "@dxos/plugin-theme": "0.8.4-main.dedc0f3",
72
- "@dxos/random": "0.8.4-main.dedc0f3",
73
- "@dxos/plugin-storybook-layout": "0.8.4-main.dedc0f3",
74
- "@dxos/react-ui": "0.8.4-main.dedc0f3",
75
- "@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
76
- "@dxos/storybook-utils": "0.8.4-main.dedc0f3"
59
+ "@effect-rx/rx-react": "0.42.4",
60
+ "@effect/platform": "0.92.1",
61
+ "@types/react": "~19.2.2",
62
+ "@types/react-dom": "~19.2.1",
63
+ "effect": "3.18.3",
64
+ "react": "~19.2.0",
65
+ "react-dom": "~19.2.0",
66
+ "vite": "7.1.9",
67
+ "@dxos/echo-signals": "0.8.4-main.ead640a",
68
+ "@dxos/plugin-attention": "0.8.4-main.ead640a",
69
+ "@dxos/plugin-client": "0.8.4-main.ead640a",
70
+ "@dxos/plugin-space": "0.8.4-main.ead640a",
71
+ "@dxos/plugin-storybook-layout": "0.8.4-main.ead640a",
72
+ "@dxos/random": "0.8.4-main.ead640a",
73
+ "@dxos/plugin-theme": "0.8.4-main.ead640a",
74
+ "@dxos/react-ui": "0.8.4-main.ead640a",
75
+ "@dxos/react-ui-theme": "0.8.4-main.ead640a",
76
+ "@dxos/storybook-utils": "0.8.4-main.ead640a"
77
77
  },
78
78
  "peerDependencies": {
79
79
  "@effect-rx/rx-react": "^0.34.1",
80
80
  "@effect/platform": "^0.80.12",
81
81
  "effect": "^3.13.3",
82
- "react": "~18.2.0",
83
- "react-dom": "~18.2.0",
84
- "@dxos/react-ui": "0.8.4-main.dedc0f3",
85
- "@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
82
+ "react": "^19.0.0",
83
+ "react-dom": "^19.0.0",
84
+ "@dxos/react-ui": "0.8.4-main.ead640a",
85
+ "@dxos/react-ui-theme": "0.8.4-main.ead640a"
86
86
  },
87
87
  "publishConfig": {
88
88
  "access": "public"
@@ -20,76 +20,75 @@ import { NavTreeEvents } from './events';
20
20
  import { meta } from './meta';
21
21
  import { translations } from './translations';
22
22
 
23
- export const NavTreePlugin = () =>
24
- definePlugin(meta, [
25
- defineModule({
26
- id: `${meta.id}/module/state`,
27
- activatesOn: Events.LayoutReady,
28
- activatesAfter: [NavTreeEvents.StateReady],
29
- activate: State,
30
- }),
31
- defineModule({
32
- id: `${meta.id}/module/translations`,
33
- activatesOn: Events.SetupTranslations,
34
- activate: () => contributes(Capabilities.Translations, translations),
35
- }),
36
- defineModule({
37
- id: `${meta.id}/module/metadata`,
38
- activatesOn: Events.SetupMetadata,
39
- activate: () =>
40
- contributes(Capabilities.Metadata, {
41
- id: NODE_TYPE,
42
- metadata: {
43
- parse: ({ item }: TreeData, type: string) => {
44
- switch (type) {
45
- case 'node':
46
- return item;
47
- case 'object':
48
- return item.data;
49
- case 'view-object':
50
- return { id: `${item.id}-view`, object: item.data };
51
- }
52
- },
23
+ export const NavTreePlugin = definePlugin(meta, () => [
24
+ defineModule({
25
+ id: `${meta.id}/module/state`,
26
+ activatesOn: Events.LayoutReady,
27
+ activatesAfter: [NavTreeEvents.StateReady],
28
+ activate: State,
29
+ }),
30
+ defineModule({
31
+ id: `${meta.id}/module/translations`,
32
+ activatesOn: Events.SetupTranslations,
33
+ activate: () => contributes(Capabilities.Translations, translations),
34
+ }),
35
+ defineModule({
36
+ id: `${meta.id}/module/metadata`,
37
+ activatesOn: Events.SetupMetadata,
38
+ activate: () =>
39
+ contributes(Capabilities.Metadata, {
40
+ id: NODE_TYPE,
41
+ metadata: {
42
+ parse: ({ item }: TreeData, type: string) => {
43
+ switch (type) {
44
+ case 'node':
45
+ return item;
46
+ case 'object':
47
+ return item.data;
48
+ case 'view-object':
49
+ return { id: `${item.id}-view`, object: item.data };
50
+ }
53
51
  },
54
- }),
55
- }),
56
- defineModule({
57
- id: `${meta.id}/module/expose`,
58
- activatesOn: allOf(Events.DispatcherReady, Events.AppGraphReady, Events.LayoutReady, NavTreeEvents.StateReady),
59
- activate: async (context) => {
60
- const layout = context.getCapability(Capabilities.Layout);
61
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
62
- const { graph } = context.getCapability(Capabilities.AppGraph);
63
- if (dispatch && layout.active.length === 1) {
64
- // TODO(wittjosiah): This should really be fired once the navtree renders for the first time.
65
- // That is the point at which the graph is expanded and the path should be available.
66
- void graph
67
- .waitForPath({ target: layout.active[0] }, { timeout: 30_000 })
68
- .then(() => dispatch(createIntent(LayoutAction.Expose, { part: 'navigation', subject: layout.active[0] })))
69
- .catch(() => {});
70
- }
52
+ },
53
+ }),
54
+ }),
55
+ defineModule({
56
+ id: `${meta.id}/module/expose`,
57
+ activatesOn: allOf(Events.DispatcherReady, Events.AppGraphReady, Events.LayoutReady, NavTreeEvents.StateReady),
58
+ activate: async (context) => {
59
+ const layout = context.getCapability(Capabilities.Layout);
60
+ const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
61
+ const { graph } = context.getCapability(Capabilities.AppGraph);
62
+ if (dispatch && layout.active.length === 1) {
63
+ // TODO(wittjosiah): This should really be fired once the navtree renders for the first time.
64
+ // That is the point at which the graph is expanded and the path should be available.
65
+ void graph
66
+ .waitForPath({ target: layout.active[0] }, { timeout: 30_000 })
67
+ .then(() => dispatch(createIntent(LayoutAction.Expose, { part: 'navigation', subject: layout.active[0] })))
68
+ .catch(() => {});
69
+ }
71
70
 
72
- return [];
73
- },
74
- }),
75
- defineModule({
76
- id: `${meta.id}/module/keyboard`,
77
- activatesOn: Events.AppGraphReady,
78
- activate: Keyboard,
79
- }),
80
- defineModule({
81
- id: `${meta.id}/module/react-surface`,
82
- activatesOn: Events.SetupReactSurface,
83
- activate: ReactSurface,
84
- }),
85
- defineModule({
86
- id: `${meta.id}/module/intent-resolver`,
87
- activatesOn: Events.SetupIntentResolver,
88
- activate: IntentResolver,
89
- }),
90
- defineModule({
91
- id: `${meta.id}/module/app-graph-builder`,
92
- activatesOn: Events.SetupAppGraph,
93
- activate: AppGraphBuilder,
94
- }),
95
- ]);
71
+ return [];
72
+ },
73
+ }),
74
+ defineModule({
75
+ id: `${meta.id}/module/keyboard`,
76
+ activatesOn: Events.AppGraphReady,
77
+ activate: Keyboard,
78
+ }),
79
+ defineModule({
80
+ id: `${meta.id}/module/react-surface`,
81
+ activatesOn: Events.SetupReactSurface,
82
+ activate: ReactSurface,
83
+ }),
84
+ defineModule({
85
+ id: `${meta.id}/module/intent-resolver`,
86
+ activatesOn: Events.SetupIntentResolver,
87
+ activate: IntentResolver,
88
+ }),
89
+ defineModule({
90
+ id: `${meta.id}/module/app-graph-builder`,
91
+ activatesOn: Events.SetupAppGraph,
92
+ activate: AppGraphBuilder,
93
+ }),
94
+ ]);
@@ -3,21 +3,22 @@
3
3
  //
4
4
 
5
5
  import { Rx } from '@effect-rx/rx-react';
6
- import { Option, pipe } from 'effect';
6
+ import * as Function from 'effect/Function';
7
+ import * as Option from 'effect/Option';
7
8
 
8
9
  import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
9
10
  import { ROOT_ID, createExtension } from '@dxos/plugin-graph';
10
11
 
11
- import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
12
+ import { COMMANDS_DIALOG, meta } from '../meta';
12
13
 
13
14
  export default (context: PluginContext) =>
14
15
  contributes(
15
16
  Capabilities.AppGraphBuilder,
16
17
  createExtension({
17
- id: NAVTREE_PLUGIN,
18
+ id: meta.id,
18
19
  actions: (node) =>
19
20
  Rx.make((get) =>
20
- pipe(
21
+ Function.pipe(
21
22
  get(node),
22
23
  Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
23
24
  Option.map(() => [
@@ -36,7 +37,7 @@ export default (context: PluginContext) =>
36
37
  );
37
38
  },
38
39
  properties: {
39
- label: ['open commands label', { ns: NAVTREE_PLUGIN }],
40
+ label: ['open commands label', { ns: meta.id }],
40
41
  icon: 'ph--magnifying-glass--regular',
41
42
  keyBinding: {
42
43
  macos: 'meta+k',
@@ -5,7 +5,7 @@
5
5
  import { defineCapability } from '@dxos/app-framework';
6
6
  import { type Live } from '@dxos/live-object';
7
7
 
8
- import { NAVTREE_PLUGIN } from '../meta';
8
+ import { meta } from '../meta';
9
9
  import { type NavTreeItemGraphNode } from '../types';
10
10
 
11
11
  export namespace NavTreeCapabilities {
@@ -16,5 +16,5 @@ export namespace NavTreeCapabilities {
16
16
  isOpen: (path: string[], item: NavTreeItemGraphNode) => boolean;
17
17
  isCurrent: (path: string[], item: NavTreeItemGraphNode) => boolean;
18
18
  isAlternateTree: (path: string[], item: NavTreeItemGraphNode) => boolean;
19
- }>(`${NAVTREE_PLUGIN}/capability/state`);
19
+ }>(`${meta.id}/capability/state`);
20
20
  }
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Schema } from 'effect';
5
+ import * as Schema from 'effect/Schema';
6
6
 
7
7
  import { Capabilities, LayoutAction, type PluginContext, contributes, createResolver } from '@dxos/app-framework';
8
8
  import { log } from '@dxos/log';
@@ -8,7 +8,7 @@ import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
8
8
  import { isGraphNode } from '@dxos/plugin-graph';
9
9
 
10
10
  import { CommandsDialogContent, CommandsTrigger, NavTreeContainer, NavTreeDocumentTitle } from '../components';
11
- import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../meta';
11
+ import { COMMANDS_DIALOG, meta } from '../meta';
12
12
 
13
13
  export default () =>
14
14
  contributes(Capabilities.ReactSurface, [
@@ -19,7 +19,7 @@ export default () =>
19
19
  component: ({ data }) => <CommandsDialogContent {...data.props} />,
20
20
  }),
21
21
  createSurface({
22
- id: `${NAVTREE_PLUGIN}/navigation`,
22
+ id: `${meta.id}/navigation`,
23
23
  role: 'navigation',
24
24
  filter: (data): data is { popoverAnchorId?: string; topbar: boolean; current: string } =>
25
25
  typeof data.current === 'string',
@@ -32,12 +32,12 @@ export default () =>
32
32
  ),
33
33
  }),
34
34
  createSurface({
35
- id: `${NAVTREE_PLUGIN}/document-title`,
35
+ id: `${meta.id}/document-title`,
36
36
  role: 'document-title',
37
37
  component: ({ data }) => <NavTreeDocumentTitle node={isGraphNode(data.subject) ? data.subject : undefined} />,
38
38
  }),
39
39
  createSurface({
40
- id: `${NAVTREE_PLUGIN}/search-input`,
40
+ id: `${meta.id}/search-input`,
41
41
  role: 'search-input',
42
42
  position: 'fallback',
43
43
  component: () => <CommandsTrigger />,
@@ -9,11 +9,11 @@ import { type Live } from '@dxos/echo';
9
9
  import { live } from '@dxos/live-object';
10
10
  import { Path } from '@dxos/react-ui-list';
11
11
 
12
- import { NAVTREE_PLUGIN } from '../meta';
12
+ import { meta } from '../meta';
13
13
 
14
14
  import { NavTreeCapabilities } from './capabilities';
15
15
 
16
- const KEY = `${NAVTREE_PLUGIN}/state/v1`;
16
+ const KEY = `${meta.id}/state/v1`;
17
17
 
18
18
  const getInitialState = () => {
19
19
  const stringified = localStorage.getItem(KEY);
@@ -19,11 +19,11 @@ import {
19
19
  import { descriptionText, mx } from '@dxos/react-ui-theme';
20
20
  import { getHostPlatform } from '@dxos/util';
21
21
 
22
- import { KEY_BINDING, NAVTREE_PLUGIN } from '../../meta';
22
+ import { KEY_BINDING, meta } from '../../meta';
23
23
 
24
24
  // TODO(wittjosiah): This probably deserves its own plugin but for now it lives here w/ other navigation UI.
25
25
  export const CommandsDialogContent = ({ selected: initial }: { selected?: string }) => {
26
- const { t } = useTranslation(NAVTREE_PLUGIN);
26
+ const { t } = useTranslation(meta.id);
27
27
  const [selected, setSelected] = useState<string | undefined>(initial);
28
28
  const { dispatchPromise: dispatch } = useIntentDispatcher();
29
29
  const { graph } = useAppGraph();
@@ -63,7 +63,7 @@ export const CommandsDialogContent = ({ selected: initial }: { selected?: string
63
63
 
64
64
  return (
65
65
  <Dialog.Content classNames={cardDialogContent}>
66
- <Dialog.Title classNames={cardDialogHeader}>{t('commands dialog title', { ns: NAVTREE_PLUGIN })}</Dialog.Title>
66
+ <Dialog.Title classNames={cardDialogHeader}>{t('commands dialog title', { ns: meta.id })}</Dialog.Title>
67
67
 
68
68
  {/* TODO(burdon): BUG: Overscrolls container. */}
69
69
  <SearchList.Root label={t('command list input placeholder')} classNames={cardDialogSearchListRoot}>
@@ -7,12 +7,12 @@ import React from 'react';
7
7
  import { LayoutAction, createIntent, useIntentDispatcher } from '@dxos/app-framework';
8
8
  import { Button, Icon, useTranslation } from '@dxos/react-ui';
9
9
 
10
- import { COMMANDS_DIALOG, NAVTREE_PLUGIN } from '../../meta';
10
+ import { COMMANDS_DIALOG, meta } from '../../meta';
11
11
 
12
12
  // TODO(thure): Refactor to be handled by a more appropriate plugin.
13
13
  export const CommandsTrigger = () => {
14
14
  const { dispatchPromise: dispatch } = useIntentDispatcher();
15
- const { t } = useTranslation(NAVTREE_PLUGIN);
15
+ const { t } = useTranslation(meta.id);
16
16
  return (
17
17
  <Button
18
18
  classNames='m-1 pli-1 lg:pli-2'
@@ -2,11 +2,10 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
8
- import { Schema } from 'effect';
9
- import React from 'react';
6
+ import * as Schema from 'effect/Schema';
7
+ import React, { type KeyboardEvent, useCallback, useRef } from 'react';
8
+ import { expect, userEvent, within } from 'storybook/test';
10
9
 
11
10
  import {
12
11
  Capabilities,
@@ -21,17 +20,15 @@ import {
21
20
  import { withPluginManager } from '@dxos/app-framework/testing';
22
21
  import { live } from '@dxos/live-object';
23
22
  import { AttentionPlugin } from '@dxos/plugin-attention';
24
- import { ClientPlugin } from '@dxos/plugin-client';
25
23
  import { GraphPlugin } from '@dxos/plugin-graph';
26
- import { SpacePlugin } from '@dxos/plugin-space';
27
24
  import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
28
25
  import { ThemePlugin } from '@dxos/plugin-theme';
29
26
  import { faker } from '@dxos/random';
30
27
  import { IconButton, Input, Main, Toolbar } from '@dxos/react-ui';
28
+ import { withTheme } from '@dxos/react-ui/testing';
31
29
  import { useAttention, useAttentionAttributes } from '@dxos/react-ui-attention';
32
30
  import { Stack, StackItem } from '@dxos/react-ui-stack';
33
31
  import { defaultTx, mx } from '@dxos/react-ui-theme';
34
- import { withLayout } from '@dxos/storybook-utils';
35
32
 
36
33
  import { NavTreePlugin } from '../../NavTreePlugin';
37
34
  import { storybookGraphBuilders } from '../../testing';
@@ -68,6 +65,15 @@ const StoryPlankHeading = ({ attendableId }: { attendableId: string }) => {
68
65
 
69
66
  const StoryPlank = ({ attendableId }: { attendableId: string }) => {
70
67
  const attentionAttrs = useAttentionAttributes(attendableId);
68
+ const rootElement = useRef<HTMLDivElement | null>(null);
69
+
70
+ // NOTE(thure): This is the same workaround as in Plank, but that component is out of scope for this story.
71
+ // TODO(thure): Tabster’s focus group should handle moving focus to Main, but something is blocking it.
72
+ const handleKeyDown = useCallback((event: KeyboardEvent) => {
73
+ if (event.target === event.currentTarget && event.key === 'Escape') {
74
+ rootElement.current?.closest('main')?.focus();
75
+ }
76
+ }, []);
71
77
 
72
78
  return (
73
79
  <StackItem.Root
@@ -75,6 +81,8 @@ const StoryPlank = ({ attendableId }: { attendableId: string }) => {
75
81
  {...attentionAttrs}
76
82
  classNames='bg-baseSurface border-ie border-separator'
77
83
  size={30}
84
+ onKeyDown={handleKeyDown}
85
+ ref={rootElement}
78
86
  >
79
87
  <StoryPlankHeading attendableId={attendableId} />
80
88
  <StackItem.Content toolbar>
@@ -121,15 +129,16 @@ const meta = {
121
129
  component: NavTreeContainer,
122
130
  render: DefaultStory,
123
131
  decorators: [
132
+ withTheme,
124
133
  withPluginManager({
125
134
  plugins: [
126
135
  ThemePlugin({ tx: defaultTx }),
127
- StorybookLayoutPlugin({ initialState: { sidebarState: 'expanded' } }),
128
136
  GraphPlugin(),
129
137
  IntentPlugin(),
130
138
  SettingsPlugin(),
131
139
  AttentionPlugin(),
132
140
  NavTreePlugin(),
141
+ StorybookLayoutPlugin({ initialState: { sidebarState: 'expanded' } }),
133
142
  ],
134
143
  capabilities: (context) => [
135
144
  contributes(StoryState, live({ tab: 'space-0' })),
@@ -147,9 +156,9 @@ const meta = {
147
156
  ]),
148
157
  ],
149
158
  }),
150
- withLayout({ fullscreen: true }),
151
159
  ],
152
160
  parameters: {
161
+ layout: 'fullscreen',
153
162
  translations,
154
163
  },
155
164
  } satisfies Meta<typeof NavTreeContainer>;
@@ -158,43 +167,48 @@ export default meta;
158
167
 
159
168
  type Story = StoryObj<typeof NavTreeContainer>;
160
169
 
161
- export const Default: Story = {};
170
+ export const Default: Story = {
171
+ play: async ({ canvasElement }) => {
172
+ const canvas = within(canvasElement);
162
173
 
163
- // TODO(wittjosiah): Deduplicate plugins/capabilities with default story.
164
- export const WithClient: Story = {
165
- decorators: [
166
- withPluginManager({
167
- plugins: [
168
- ThemePlugin({ tx: defaultTx }),
169
- GraphPlugin(),
170
- IntentPlugin(),
171
- SettingsPlugin(),
172
- AttentionPlugin(),
173
- NavTreePlugin(),
174
- ClientPlugin({
175
- onClientInitialized: async ({ client }) => {
176
- await client.halo.createIdentity();
177
- },
178
- }),
179
- SpacePlugin(),
180
- // Needs to be last so that the dialog and popovers have access to all contexts.
181
- StorybookLayoutPlugin({ initialState: { sidebarState: 'expanded' } }),
182
- ],
183
- capabilities: (context) => [
184
- contributes(StoryState, live({ tab: 'space-0' })),
185
- contributes(Capabilities.IntentResolver, [
186
- createResolver({
187
- intent: LayoutAction.UpdateLayout,
188
- filter: (data): data is Schema.Schema.Type<typeof LayoutAction.SwitchWorkspace.fields.input> =>
189
- Schema.is(LayoutAction.SwitchWorkspace.fields.input)(data),
190
- resolve: ({ subject }) => {
191
- const state = context.getCapability(StoryState);
192
- state.tab = subject;
193
- },
194
- }),
195
- ]),
196
- ],
197
- }),
198
- withLayout({ fullscreen: true }),
199
- ],
174
+ // Find the element with treegrid role and click on its parent
175
+ const treegridElement = await canvas.findByRole('treegrid');
176
+ const treegridParent = treegridElement.parentElement;
177
+ if (treegridParent) {
178
+ await userEvent.click(treegridParent);
179
+ }
180
+
181
+ // Press Escape
182
+ await userEvent.keyboard('{Escape}');
183
+
184
+ // Confirm that focus is on an element with attribute data-main-landmark="0"
185
+ await expect(document.activeElement).toHaveAttribute('data-main-landmark', '0');
186
+
187
+ // Press Tab
188
+ await userEvent.keyboard('{Tab}');
189
+
190
+ // Confirm that focus is now on an element with data-main-landmark="1"
191
+ await expect(document.activeElement).toHaveAttribute('data-main-landmark', '1');
192
+
193
+ // Press Tab
194
+ await userEvent.keyboard('{Tab}');
195
+
196
+ // Confirm that focus is now on an element with data-main-landmark="0"
197
+ await expect(document.activeElement).toHaveAttribute('data-main-landmark', '0');
198
+
199
+ // Press Shift-Tab
200
+ await userEvent.keyboard('{Shift>}{Tab}{/Shift}');
201
+
202
+ // Press Enter
203
+ await userEvent.keyboard('{Enter}');
204
+
205
+ // Confirm that focus is now on an element with data-attendable-id="space-0:object-0"
206
+ await expect(document.activeElement).toHaveAttribute('data-attendable-id', 'space-0:object-0');
207
+
208
+ // Press Escape
209
+ await userEvent.keyboard('{Escape}');
210
+
211
+ // Confirm that focus is now on an element with data-main-landmark="1"
212
+ await expect(document.activeElement).toHaveAttribute('data-main-landmark', '1');
213
+ },
200
214
  };
@@ -47,6 +47,10 @@ export const NavTree = ({ id, root, ...props }: NavTreeProps) => {
47
47
  const path = useMemo(() => [id], [id]);
48
48
 
49
49
  return (
50
+ // TODO(thure): `Tabs.Root` forces all items that should be able to receive focus to use `Tabs.Tab(Primitive)` since
51
+ // it uses RovingFocus and doesn’t support moving focus to an item that is not a tab. Assess whether this situation
52
+ // should change including whether it should motivate a change in the design/taxonomy, or if this means this should
53
+ // not use `react-ui-tabs` at all.
50
54
  <Tabs.Root value={tab} orientation='vertical' verticalVariant='stateless' classNames='relative'>
51
55
  <L0Menu
52
56
  menuActions={topLevelActions}