@dxos/plugin-help 0.7.4 → 0.7.5-labs.071a3e2

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 (78) hide show
  1. package/dist/lib/browser/app-graph-builder-X4XWALX3.mjs +78 -0
  2. package/dist/lib/browser/app-graph-builder-X4XWALX3.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-24E4WRKH.mjs +36 -0
  4. package/dist/lib/browser/chunk-24E4WRKH.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-76XWX6N3.mjs +13 -0
  6. package/dist/lib/browser/chunk-76XWX6N3.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-C7PCVS5K.mjs +361 -0
  8. package/dist/lib/browser/chunk-C7PCVS5K.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-GJTAQWB6.mjs +16 -0
  10. package/dist/lib/browser/chunk-GJTAQWB6.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +74 -503
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/meta.mjs +3 -5
  15. package/dist/lib/browser/react-root-4AV22UGT.mjs +34 -0
  16. package/dist/lib/browser/react-root-4AV22UGT.mjs.map +7 -0
  17. package/dist/lib/browser/react-surface-7S3NUVZH.mjs +36 -0
  18. package/dist/lib/browser/react-surface-7S3NUVZH.mjs.map +7 -0
  19. package/dist/lib/browser/state-SLKOTRHH.mjs +29 -0
  20. package/dist/lib/browser/state-SLKOTRHH.mjs.map +7 -0
  21. package/dist/lib/browser/types.mjs +12 -0
  22. package/dist/lib/browser/types.mjs.map +7 -0
  23. package/dist/types/src/HelpPlugin.d.ts +2 -7
  24. package/dist/types/src/HelpPlugin.d.ts.map +1 -1
  25. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  26. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/capabilities.d.ts +10 -0
  28. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/index.d.ts +185 -0
  30. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/react-root.d.ts +8 -0
  32. package/dist/types/src/capabilities/react-root.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  34. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/state.d.ts +4 -0
  36. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  37. package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts +1 -0
  38. package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts.map +1 -1
  39. package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts +9 -0
  40. package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts.map +1 -0
  41. package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts +10 -0
  42. package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts.map +1 -0
  43. package/dist/types/src/components/WelcomeTour/index.d.ts +2 -0
  44. package/dist/types/src/components/WelcomeTour/index.d.ts.map +1 -0
  45. package/dist/types/src/components/index.d.ts +1 -1
  46. package/dist/types/src/components/index.d.ts.map +1 -1
  47. package/dist/types/src/index.d.ts +4 -5
  48. package/dist/types/src/index.d.ts.map +1 -1
  49. package/dist/types/src/meta.d.ts +1 -5
  50. package/dist/types/src/meta.d.ts.map +1 -1
  51. package/dist/types/src/types.d.ts +15 -6
  52. package/dist/types/src/types.d.ts.map +1 -1
  53. package/dist/types/tsconfig.tsbuildinfo +1 -0
  54. package/package.json +24 -24
  55. package/src/HelpPlugin.tsx +47 -120
  56. package/src/capabilities/app-graph-builder.ts +66 -0
  57. package/src/capabilities/capabilities.ts +13 -0
  58. package/src/capabilities/index.ts +12 -0
  59. package/src/capabilities/react-root.tsx +32 -0
  60. package/src/capabilities/react-surface.tsx +30 -0
  61. package/src/capabilities/state.ts +23 -0
  62. package/src/components/Shortcuts/ShortcutsDialog.tsx +2 -0
  63. package/src/components/{HelpContextProvider/HelpContextProvider.stories.tsx → WelcomeTour/WelcomeTour.stories.tsx} +9 -8
  64. package/src/components/{HelpContextProvider/HelpContextProvider.tsx → WelcomeTour/WelcomeTour.tsx} +10 -16
  65. package/src/components/WelcomeTour/index.ts +5 -0
  66. package/src/components/index.ts +1 -1
  67. package/src/index.ts +4 -9
  68. package/src/meta.ts +1 -6
  69. package/src/types.ts +12 -9
  70. package/dist/lib/browser/chunk-2EMBCGD5.mjs +0 -19
  71. package/dist/lib/browser/chunk-2EMBCGD5.mjs.map +0 -7
  72. package/dist/types/src/components/HelpContextProvider/HelpContextProvider.d.ts +0 -9
  73. package/dist/types/src/components/HelpContextProvider/HelpContextProvider.d.ts.map +0 -1
  74. package/dist/types/src/components/HelpContextProvider/HelpContextProvider.stories.d.ts +0 -10
  75. package/dist/types/src/components/HelpContextProvider/HelpContextProvider.stories.d.ts.map +0 -1
  76. package/dist/types/src/components/HelpContextProvider/index.d.ts +0 -2
  77. package/dist/types/src/components/HelpContextProvider/index.d.ts.map +0 -1
  78. package/src/components/HelpContextProvider/index.ts +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-help",
3
- "version": "0.7.4",
3
+ "version": "0.7.5-labs.071a3e2",
4
4
  "description": "Help plugin.",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -12,16 +12,16 @@
12
12
  "types": "./dist/types/src/index.d.ts",
13
13
  "browser": "./dist/lib/browser/index.mjs"
14
14
  },
15
- "./meta": {
16
- "types": "./dist/types/src/meta.d.ts",
17
- "browser": "./dist/lib/browser/meta.mjs"
15
+ "./types": {
16
+ "types": "./dist/types/src/types.d.ts",
17
+ "browser": "./dist/lib/browser/types.mjs"
18
18
  }
19
19
  },
20
20
  "types": "dist/types/src/index.d.ts",
21
21
  "typesVersions": {
22
22
  "*": {
23
- "meta": [
24
- "dist/types/src/meta.d.ts"
23
+ "types": [
24
+ "dist/types/src/types.d.ts"
25
25
  ]
26
26
  }
27
27
  },
@@ -30,20 +30,20 @@
30
30
  "src"
31
31
  ],
32
32
  "dependencies": {
33
- "@fluentui/react-tabster": "^9.19.0",
33
+ "@fluentui/react-tabster": "9.23.3",
34
34
  "lodash.get": "^4.4.2",
35
35
  "react-joyride": "^2.7.2",
36
- "@dxos/app-framework": "0.7.4",
37
- "@dxos/debug": "0.7.4",
38
- "@dxos/app-graph": "0.7.4",
39
- "@dxos/echo-schema": "0.7.4",
40
- "@dxos/keyboard": "0.7.4",
41
- "@dxos/live-object": "0.7.4",
42
- "@dxos/local-storage": "0.7.4",
43
- "@dxos/plugin-graph": "0.7.4",
44
- "@dxos/plugin-client": "0.7.4",
45
- "@dxos/plugin-space": "0.7.4",
46
- "@dxos/react-client": "0.7.4"
36
+ "@dxos/app-framework": "0.7.5-labs.071a3e2",
37
+ "@dxos/debug": "0.7.5-labs.071a3e2",
38
+ "@dxos/app-graph": "0.7.5-labs.071a3e2",
39
+ "@dxos/keyboard": "0.7.5-labs.071a3e2",
40
+ "@dxos/echo-schema": "0.7.5-labs.071a3e2",
41
+ "@dxos/live-object": "0.7.5-labs.071a3e2",
42
+ "@dxos/local-storage": "0.7.5-labs.071a3e2",
43
+ "@dxos/plugin-client": "0.7.5-labs.071a3e2",
44
+ "@dxos/plugin-graph": "0.7.5-labs.071a3e2",
45
+ "@dxos/plugin-space": "0.7.5-labs.071a3e2",
46
+ "@dxos/react-client": "0.7.5-labs.071a3e2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@phosphor-icons/react": "^2.1.5",
@@ -55,17 +55,17 @@
55
55
  "react-floater": "0.7.9",
56
56
  "type-fest": "4.10.1",
57
57
  "vite": "5.4.7",
58
- "@dxos/random": "0.7.4",
59
- "@dxos/react-ui": "0.7.4",
60
- "@dxos/react-ui-theme": "0.7.4",
61
- "@dxos/storybook-utils": "0.7.4"
58
+ "@dxos/random": "0.7.5-labs.071a3e2",
59
+ "@dxos/react-ui": "0.7.5-labs.071a3e2",
60
+ "@dxos/react-ui-theme": "0.7.5-labs.071a3e2",
61
+ "@dxos/storybook-utils": "0.7.5-labs.071a3e2"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@phosphor-icons/react": "^2.1.5",
65
65
  "react": "~18.2.0",
66
66
  "react-dom": "~18.2.0",
67
- "@dxos/react-ui": "0.7.4",
68
- "@dxos/react-ui-theme": "0.7.4"
67
+ "@dxos/react-ui": "0.7.5-labs.071a3e2",
68
+ "@dxos/react-ui-theme": "0.7.5-labs.071a3e2"
69
69
  },
70
70
  "publishConfig": {
71
71
  "access": "public"
@@ -2,129 +2,56 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React from 'react';
5
+ import { createResolver, defineModule, definePlugin, Events, contributes, Capabilities } from '@dxos/app-framework';
6
6
 
7
- import { resolvePlugin, type PluginDefinition, parseIntentPlugin, LayoutAction } from '@dxos/app-framework';
8
- import { createExtension, type Node } from '@dxos/app-graph';
9
- import { create } from '@dxos/live-object';
10
- import { LocalStorageStore } from '@dxos/local-storage';
11
-
12
- import { HelpContextProvider, ShortcutsDialogContent, ShortcutsHints, ShortcutsList } from './components';
13
- import meta, { HelpAction, HELP_PLUGIN } from './meta';
7
+ import { AppGraphBuilder, HelpState, ReactRoot, ReactSurface } from './capabilities';
8
+ import { HelpCapabilities } from './capabilities/capabilities';
9
+ import { meta } from './meta';
14
10
  import translations from './translations';
15
- import { type Step, type HelpPluginProvides } from './types';
16
-
17
- export type HelpSettingsProps = { showHints?: boolean; showWelcome?: boolean };
11
+ import { type Step, HelpAction } from './types';
18
12
 
19
13
  export type HelpPluginOptions = { steps?: Step[] };
20
14
 
21
- export const HelpPlugin = ({ steps = [] }: HelpPluginOptions): PluginDefinition<HelpPluginProvides> => {
22
- const settings = new LocalStorageStore<HelpSettingsProps>(HELP_PLUGIN, { showHints: true, showWelcome: true });
23
- const state = create<{ running: boolean }>({ running: false });
24
- return {
25
- meta,
26
- ready: async () => {
27
- settings
28
- .prop({ key: 'showHints', type: LocalStorageStore.bool({ allowUndefined: true }) })
29
- .prop({ key: 'showWelcome', type: LocalStorageStore.bool({ allowUndefined: true }) });
30
- },
31
- provides: {
32
- context: ({ children }) => {
33
- return (
34
- <HelpContextProvider
35
- steps={steps}
36
- running={state.running}
37
- onRunningChanged={(newState) => {
38
- state.running = newState;
39
- if (!newState) {
40
- settings.values.showHints = false;
41
- }
42
- }}
43
- >
44
- {children}
45
- </HelpContextProvider>
46
- );
47
- },
48
- translations,
49
- graph: {
50
- builder: (plugins) => {
51
- const intentPlugin = resolvePlugin(plugins, parseIntentPlugin)!;
52
-
53
- return createExtension({
54
- id: HELP_PLUGIN,
55
- filter: (node): node is Node<null> => node.id === 'root',
56
- actions: () => [
57
- {
58
- id: HelpAction.START,
59
- data: async () => {
60
- settings.values.showHints = true;
61
- await intentPlugin?.provides.intent.dispatch({
62
- plugin: HELP_PLUGIN,
63
- action: HelpAction.START,
64
- });
65
- },
66
- properties: {
67
- label: ['open help tour', { ns: HELP_PLUGIN }],
68
- icon: 'ph--info--regular',
69
- keyBinding: {
70
- macos: 'shift+meta+/',
71
- // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
72
- windows: 'shift+ctrl+/',
73
- linux: 'shift+ctrl+?',
74
- },
75
- testId: 'helpPlugin.openHelp',
76
- },
77
- },
78
- {
79
- id: 'dxos.org/plugin/help/open-shortcuts',
80
- data: async () => {
81
- settings.values.showHints = true;
82
- await intentPlugin?.provides.intent.dispatch({
83
- action: LayoutAction.SET_LAYOUT,
84
- data: {
85
- element: 'dialog',
86
- component: `${HELP_PLUGIN}/Shortcuts`,
87
- },
88
- });
89
- },
90
- properties: {
91
- label: ['open shortcuts label', { ns: HELP_PLUGIN }],
92
- icon: 'ph--keyboard--regular',
93
- keyBinding: {
94
- macos: 'meta+ctrl+/',
95
- },
96
- },
97
- },
98
- ],
99
- });
100
- },
101
- },
102
- surface: {
103
- component: ({ data, role }) => {
104
- switch (role) {
105
- case 'hints':
106
- return <ShortcutsHints />;
107
- case 'keyshortcuts':
108
- return <ShortcutsList />;
109
- }
110
-
111
- switch (data.component) {
112
- case `${HELP_PLUGIN}/Shortcuts`:
113
- return <ShortcutsDialogContent />;
114
- }
115
-
116
- return null;
117
- },
118
- },
119
- intent: {
120
- resolver: async (intent) => {
121
- switch (intent.action) {
122
- case HelpAction.START:
15
+ export const HelpPlugin = ({ steps = [] }: HelpPluginOptions) =>
16
+ definePlugin(meta, [
17
+ defineModule({
18
+ id: `${meta.id}/module/state`,
19
+ activatesOn: Events.Startup,
20
+ activate: HelpState,
21
+ }),
22
+ defineModule({
23
+ id: `${meta.id}/module/translations`,
24
+ activatesOn: Events.SetupTranslations,
25
+ activate: () => contributes(Capabilities.Translations, translations),
26
+ }),
27
+ defineModule({
28
+ id: `${meta.id}/module/react-root`,
29
+ activatesOn: Events.Startup,
30
+ activate: () => ReactRoot(steps),
31
+ }),
32
+ defineModule({
33
+ id: `${meta.id}/module/react-surface`,
34
+ activatesOn: Events.SetupSurfaces,
35
+ activate: ReactSurface,
36
+ }),
37
+ defineModule({
38
+ id: `${meta.id}/module/intent-resolver`,
39
+ activatesOn: Events.SetupIntents,
40
+ activate: (context) =>
41
+ contributes(
42
+ Capabilities.IntentResolver,
43
+ createResolver({
44
+ intent: HelpAction.Start,
45
+ resolve: () => {
46
+ const state = context.requestCapability(HelpCapabilities.MutableState);
123
47
  state.running = true;
124
- break;
125
- }
126
- },
127
- },
128
- },
129
- };
130
- };
48
+ },
49
+ }),
50
+ ),
51
+ }),
52
+ defineModule({
53
+ id: `${meta.id}/module/app-graph-builder`,
54
+ activatesOn: Events.SetupAppGraph,
55
+ activate: AppGraphBuilder,
56
+ }),
57
+ ]);
@@ -0,0 +1,66 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capabilities, contributes, createIntent, LayoutAction, type PluginsContext } from '@dxos/app-framework';
6
+ import { createExtension, type Node } from '@dxos/app-graph';
7
+
8
+ import { HelpCapabilities } from './capabilities';
9
+ import { SHORTCUTS_DIALOG } from '../components';
10
+ import { HELP_PLUGIN } from '../meta';
11
+ import { HelpAction } from '../types';
12
+
13
+ export default (context: PluginsContext) =>
14
+ contributes(
15
+ Capabilities.AppGraphBuilder,
16
+ createExtension({
17
+ id: HELP_PLUGIN,
18
+ filter: (node): node is Node<null> => node.id === 'root',
19
+ actions: () => [
20
+ {
21
+ id: HelpAction.Start._tag,
22
+ data: async () => {
23
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
24
+ const state = context.requestCapability(HelpCapabilities.MutableState);
25
+ state.showHints = true;
26
+ await dispatch(createIntent(HelpAction.Start));
27
+ },
28
+ properties: {
29
+ label: ['open help tour', { ns: HELP_PLUGIN }],
30
+ icon: 'ph--info--regular',
31
+ keyBinding: {
32
+ macos: 'shift+meta+/',
33
+ // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
34
+ windows: 'shift+ctrl+/',
35
+ linux: 'shift+ctrl+?',
36
+ },
37
+ testId: 'helpPlugin.openHelp',
38
+ },
39
+ },
40
+ {
41
+ id: 'dxos.org/plugin/help/open-shortcuts',
42
+ data: async () => {
43
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
44
+ const state = context.requestCapability(HelpCapabilities.MutableState);
45
+ state.showHints = true;
46
+ await dispatch(
47
+ createIntent(LayoutAction.UpdateDialog, {
48
+ part: 'dialog',
49
+ subject: SHORTCUTS_DIALOG,
50
+ options: {
51
+ blockAlign: 'center',
52
+ },
53
+ }),
54
+ );
55
+ },
56
+ properties: {
57
+ label: ['open shortcuts label', { ns: HELP_PLUGIN }],
58
+ icon: 'ph--keyboard--regular',
59
+ keyBinding: {
60
+ macos: 'meta+ctrl+/',
61
+ },
62
+ },
63
+ },
64
+ ],
65
+ }),
66
+ );
@@ -0,0 +1,13 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { defineCapability } from '@dxos/app-framework';
6
+
7
+ import { HELP_PLUGIN } from '../meta';
8
+
9
+ export namespace HelpCapabilities {
10
+ export type State = { running: boolean; showHints: boolean; showWelcome: boolean };
11
+ export const State = defineCapability<Readonly<State>>(`${HELP_PLUGIN}/capability/state`);
12
+ export const MutableState = defineCapability<State>(`${HELP_PLUGIN}/capability/state`);
13
+ }
@@ -0,0 +1,12 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { lazy } from '@dxos/app-framework';
6
+
7
+ export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
8
+ export const ReactRoot = lazy(() => import('./react-root'));
9
+ export const ReactSurface = lazy(() => import('./react-surface'));
10
+ export const HelpState = lazy(() => import('./state'));
11
+
12
+ export * from './capabilities';
@@ -0,0 +1,32 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
8
+
9
+ import { HelpCapabilities } from './capabilities';
10
+ import { WelcomeTour } from '../components';
11
+ import { HELP_PLUGIN } from '../meta';
12
+ import { type Step } from '../types';
13
+
14
+ export default (steps: Step[]) =>
15
+ contributes(Capabilities.ReactRoot, {
16
+ id: HELP_PLUGIN,
17
+ root: () => {
18
+ const state = useCapability(HelpCapabilities.MutableState);
19
+ return (
20
+ <WelcomeTour
21
+ steps={steps}
22
+ running={state.running}
23
+ onRunningChanged={(newState) => {
24
+ state.running = newState;
25
+ if (!newState) {
26
+ state.showHints = false;
27
+ }
28
+ }}
29
+ />
30
+ );
31
+ },
32
+ });
@@ -0,0 +1,30 @@
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 { SHORTCUTS_DIALOG, ShortcutsDialogContent, ShortcutsHints, ShortcutsList } from '../components';
10
+ import { HELP_PLUGIN } from '../meta';
11
+
12
+ export default () =>
13
+ contributes(Capabilities.ReactSurface, [
14
+ createSurface({
15
+ id: `${HELP_PLUGIN}/hints`,
16
+ role: 'hints',
17
+ component: () => <ShortcutsHints />,
18
+ }),
19
+ createSurface({
20
+ id: `${HELP_PLUGIN}/keyshortcuts`,
21
+ role: 'keyshortcuts',
22
+ component: () => <ShortcutsList />,
23
+ }),
24
+ createSurface({
25
+ id: SHORTCUTS_DIALOG,
26
+ role: 'dialog',
27
+ filter: (data): data is any => data.component === SHORTCUTS_DIALOG,
28
+ component: () => <ShortcutsDialogContent />,
29
+ }),
30
+ ]);
@@ -0,0 +1,23 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { contributes } from '@dxos/app-framework';
6
+ import { LocalStorageStore } from '@dxos/local-storage';
7
+
8
+ import { HelpCapabilities } from './capabilities';
9
+ import { HELP_PLUGIN } from '../meta';
10
+
11
+ export default () => {
12
+ const state = new LocalStorageStore<HelpCapabilities.State>(HELP_PLUGIN, {
13
+ running: false,
14
+ showHints: true,
15
+ showWelcome: true,
16
+ });
17
+
18
+ state
19
+ .prop({ key: 'showHints', type: LocalStorageStore.bool() })
20
+ .prop({ key: 'showWelcome', type: LocalStorageStore.bool() });
21
+
22
+ return contributes(HelpCapabilities.State, state.values);
23
+ };
@@ -9,6 +9,8 @@ import { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';
9
9
  import { ShortcutsList } from './ShortcutsList';
10
10
  import { HELP_PLUGIN } from '../../meta';
11
11
 
12
+ export const SHORTCUTS_DIALOG = `${HELP_PLUGIN}/ShortcutsDialog`;
13
+
12
14
  export const ShortcutsDialogContent = () => {
13
15
  const { t } = useTranslation(HELP_PLUGIN);
14
16
 
@@ -12,7 +12,7 @@ import { faker } from '@dxos/random';
12
12
  import { Button } from '@dxos/react-ui';
13
13
  import { withTheme } from '@dxos/storybook-utils';
14
14
 
15
- import { HelpContextProvider, type HelpContextProviderProps } from './HelpContextProvider';
15
+ import { WelcomeTour, type WelcomeTourProps } from './WelcomeTour';
16
16
  import { useHelp } from '../../hooks';
17
17
 
18
18
  const App = () => {
@@ -57,18 +57,19 @@ const App = () => {
57
57
  );
58
58
  };
59
59
 
60
- const DefaultStory = ({ steps = [] }: HelpContextProviderProps) => (
61
- <HelpContextProvider steps={steps}>
60
+ const DefaultStory = ({ steps = [] }: WelcomeTourProps) => (
61
+ <>
62
+ <WelcomeTour steps={steps} />
62
63
  <div className='fixed inset-0 overflow-hidden'>
63
64
  <App />
64
65
  </div>
65
- </HelpContextProvider>
66
+ </>
66
67
  );
67
68
 
68
69
  // TODO(burdon): Tour should prompt user to create a Stack -- and respond to it being created.
69
70
  // Use beacon to simulate click.
70
71
 
71
- export const Default: StoryObj<typeof HelpContextProvider> = {
72
+ export const Default: StoryObj<typeof WelcomeTour> = {
72
73
  args: {
73
74
  // https://docs.react-joyride.com/step#options
74
75
  steps: [
@@ -103,9 +104,9 @@ export const Default: StoryObj<typeof HelpContextProvider> = {
103
104
  /**
104
105
  * IMPORTANT: Run in separate tab.
105
106
  */
106
- const meta: Meta<typeof HelpContextProvider> = {
107
- title: 'plugins/plugin-help/Joyride',
108
- component: HelpContextProvider,
107
+ const meta: Meta<typeof WelcomeTour> = {
108
+ title: 'plugins/plugin-help/WelcomeTour',
109
+ component: WelcomeTour,
109
110
  render: DefaultStory,
110
111
  decorators: [withTheme],
111
112
  };
@@ -2,10 +2,10 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { type PropsWithChildren, useState, useEffect } from 'react';
5
+ import React, { useState, useEffect } from 'react';
6
6
  import Joyride, { ACTIONS, EVENTS } from 'react-joyride';
7
7
 
8
- import { usePlugins, resolvePlugin, parseLayoutPlugin } from '@dxos/app-framework';
8
+ import { usePluginManager, useLayout } from '@dxos/app-framework';
9
9
 
10
10
  import { type Step, HelpContext } from '../../types';
11
11
  import { floaterProps, Tooltip } from '../Tooltip';
@@ -57,30 +57,25 @@ const waitForTarget = async (step: Step) => {
57
57
  }
58
58
  };
59
59
 
60
- export type HelpContextProviderProps = PropsWithChildren<{
60
+ export type WelcomeTourProps = {
61
61
  steps: Step[];
62
62
  running?: boolean;
63
63
  onRunningChanged?: (state: boolean) => any;
64
- }>;
65
-
66
- export const HelpContextProvider = ({
67
- children,
68
- steps: initialSteps,
69
- running: runningProp,
70
- onRunningChanged,
71
- }: HelpContextProviderProps) => {
72
- const { plugins } = usePlugins();
73
- const layoutPlugin = resolvePlugin(plugins, parseLayoutPlugin);
64
+ };
65
+
66
+ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunningChanged }: WelcomeTourProps) => {
67
+ const manager = usePluginManager();
68
+ const layout = useLayout();
74
69
  const [running, setRunning] = useState(!!runningProp && !!getTarget(initialSteps[0]));
75
70
  const [stepIndex, _setStepIndex] = useState(0);
76
71
  const [steps, setSteps] = useState(initialSteps);
77
72
 
78
- const paused = layoutPlugin?.provides.layout.dialogOpen;
73
+ const paused = layout.dialogOpen;
79
74
 
80
75
  const setStepIndex = (index: number) => {
81
76
  if (runningProp) {
82
77
  const step = steps[index];
83
- step?.before?.({ plugins, step });
78
+ step?.before?.(manager.context);
84
79
  }
85
80
  _setStepIndex(index);
86
81
  };
@@ -170,7 +165,6 @@ export const HelpContextProvider = ({
170
165
  floaterProps={floaterProps}
171
166
  tooltipComponent={Tooltip}
172
167
  />
173
- {children}
174
168
  </HelpContext.Provider>
175
169
  );
176
170
  };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export * from './WelcomeTour';
@@ -2,6 +2,6 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './HelpContextProvider';
6
5
  export * from './Shortcuts';
7
6
  export * from './Tooltip';
7
+ export * from './WelcomeTour';
package/src/index.ts CHANGED
@@ -2,14 +2,9 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { HelpPlugin } from './HelpPlugin';
6
- import { type Step } from './types';
7
-
8
- export type { Step };
9
-
5
+ export { HelpCapabilities } from './capabilities';
10
6
  export * from './components';
11
- export * from './hooks';
12
-
7
+ export * from './meta';
13
8
  export * from './HelpPlugin';
14
-
15
- export default HelpPlugin;
9
+ export * from './hooks';
10
+ export * from './types';
package/src/meta.ts CHANGED
@@ -7,13 +7,8 @@ import { type PluginMeta } from '@dxos/app-framework';
7
7
  // TODO(burdon): Rename Guide? Help?
8
8
  export const HELP_PLUGIN = 'dxos.org/plugin/help';
9
9
 
10
- export default {
10
+ export const meta = {
11
11
  id: HELP_PLUGIN,
12
12
  name: 'Help',
13
13
  icon: 'ph--info--regular',
14
14
  } satisfies PluginMeta;
15
-
16
- const HELP_ACTION = `${HELP_PLUGIN}/action`;
17
- export enum HelpAction {
18
- START = `${HELP_ACTION}/start`,
19
- }
package/src/types.ts CHANGED
@@ -5,16 +5,13 @@
5
5
  import { type Context, createContext } from 'react';
6
6
  import { type Step as BaseStep } from 'react-joyride';
7
7
 
8
- import {
9
- type Plugin,
10
- type GraphBuilderProvides,
11
- type IntentResolverProvides,
12
- type SurfaceProvides,
13
- type TranslationsProvides,
14
- } from '@dxos/app-framework';
8
+ import { type PluginsContext } from '@dxos/app-framework';
9
+ import { S } from '@dxos/echo-schema';
10
+
11
+ import { HELP_PLUGIN } from './meta';
15
12
 
16
13
  export type Step = BaseStep & {
17
- before?: (context: { plugins: Plugin[]; step: Step }) => void;
14
+ before?: (context: PluginsContext) => void;
18
15
  };
19
16
 
20
17
  export type HelpContextType = {
@@ -35,4 +32,10 @@ export const HelpContext: Context<HelpContextType> = createContext<HelpContextTy
35
32
  stop: () => {},
36
33
  });
37
34
 
38
- export type HelpPluginProvides = GraphBuilderProvides & IntentResolverProvides & SurfaceProvides & TranslationsProvides;
35
+ export const HELP_ACTION = `${HELP_PLUGIN}/action`;
36
+ export namespace HelpAction {
37
+ export class Start extends S.TaggedClass<Start>()(`${HELP_ACTION}/start`, {
38
+ input: S.Void,
39
+ output: S.Void,
40
+ }) {}
41
+ }