@dxos/plugin-help 0.8.4-main.b97322e → 0.8.4-main.c4373fc
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.
- package/dist/lib/browser/{app-graph-builder-BYCMEBNG.mjs → app-graph-builder-OBX2JPME.mjs} +16 -15
- package/dist/lib/browser/app-graph-builder-OBX2JPME.mjs.map +7 -0
- package/dist/lib/browser/{chunk-J2SJSGSX.mjs → chunk-2OGXA47I.mjs} +3 -3
- package/dist/lib/browser/chunk-2OGXA47I.mjs.map +7 -0
- package/dist/lib/browser/{chunk-MNETJXKS.mjs → chunk-2X6D7RV7.mjs} +18 -20
- package/dist/lib/browser/chunk-2X6D7RV7.mjs.map +7 -0
- package/dist/lib/browser/chunk-3WYHGOGD.mjs +16 -0
- package/dist/lib/browser/chunk-3WYHGOGD.mjs.map +7 -0
- package/dist/lib/browser/chunk-HUJHLAHD.mjs +11 -0
- package/dist/lib/browser/chunk-HUJHLAHD.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +10 -12
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -3
- package/dist/lib/browser/{react-root-W6ZDEGBU.mjs → react-root-TXBGER6K.mjs} +9 -9
- package/dist/lib/browser/react-root-TXBGER6K.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-SATVEWS5.mjs → react-surface-B6YRCLU3.mjs} +9 -9
- package/dist/lib/browser/react-surface-B6YRCLU3.mjs.map +7 -0
- package/dist/lib/browser/{state-FWUZG6NL.mjs → state-Y7EYMGFM.mjs} +7 -7
- package/dist/lib/browser/state-Y7EYMGFM.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/types/src/HelpPlugin.d.ts +1 -1
- package/dist/types/src/HelpPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +5 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root.d.ts +2 -2
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsList.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts.map +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts +9 -4
- package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +1 -1
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +32 -29
- package/src/HelpPlugin.tsx +45 -47
- package/src/capabilities/app-graph-builder.ts +11 -9
- package/src/capabilities/capabilities.ts +3 -3
- package/src/capabilities/react-root.tsx +4 -3
- package/src/capabilities/react-surface.tsx +3 -3
- package/src/capabilities/state.ts +3 -2
- package/src/components/Shortcuts/ShortcutsDialog.tsx +4 -3
- package/src/components/Shortcuts/ShortcutsList.tsx +3 -2
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/components/WelcomeTour/WelcomeTour.stories.tsx +9 -7
- package/src/components/WelcomeTour/WelcomeTour.tsx +15 -18
- package/src/meta.ts +1 -4
- package/src/types/schema.ts +1 -1
- package/dist/lib/browser/app-graph-builder-BYCMEBNG.mjs.map +0 -7
- package/dist/lib/browser/chunk-3Y4CMOZP.mjs +0 -13
- package/dist/lib/browser/chunk-3Y4CMOZP.mjs.map +0 -7
- package/dist/lib/browser/chunk-J2SJSGSX.mjs.map +0 -7
- package/dist/lib/browser/chunk-LDRUZNSN.mjs +0 -16
- package/dist/lib/browser/chunk-LDRUZNSN.mjs.map +0 -7
- package/dist/lib/browser/chunk-MNETJXKS.mjs.map +0 -7
- package/dist/lib/browser/react-root-W6ZDEGBU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-SATVEWS5.mjs.map +0 -7
- package/dist/lib/browser/state-FWUZG6NL.mjs.map +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-help",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.c4373fc",
|
|
4
4
|
"description": "Help plugin.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,14 +10,17 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs"
|
|
15
16
|
},
|
|
16
17
|
"./meta": {
|
|
18
|
+
"source": "./src/meta.ts",
|
|
17
19
|
"types": "./dist/types/src/meta.d.ts",
|
|
18
20
|
"browser": "./dist/lib/browser/meta.mjs"
|
|
19
21
|
},
|
|
20
22
|
"./types": {
|
|
23
|
+
"source": "./src/types/index.ts",
|
|
21
24
|
"types": "./dist/types/src/types/index.d.ts",
|
|
22
25
|
"browser": "./dist/lib/browser/types/index.mjs"
|
|
23
26
|
}
|
|
@@ -41,43 +44,43 @@
|
|
|
41
44
|
"@fluentui/react-tabster": "^9.24.2",
|
|
42
45
|
"@preact-signals/safe-react": "^0.9.0",
|
|
43
46
|
"react-joyride": "^2.7.2",
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/app-
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/echo
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/plugin-
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/plugin-
|
|
55
|
-
"@dxos/react-client": "0.8.4-main.b97322e"
|
|
47
|
+
"@dxos/debug": "0.8.4-main.c4373fc",
|
|
48
|
+
"@dxos/app-framework": "0.8.4-main.c4373fc",
|
|
49
|
+
"@dxos/app-graph": "0.8.4-main.c4373fc",
|
|
50
|
+
"@dxos/echo": "0.8.4-main.c4373fc",
|
|
51
|
+
"@dxos/keyboard": "0.8.4-main.c4373fc",
|
|
52
|
+
"@dxos/live-object": "0.8.4-main.c4373fc",
|
|
53
|
+
"@dxos/local-storage": "0.8.4-main.c4373fc",
|
|
54
|
+
"@dxos/plugin-client": "0.8.4-main.c4373fc",
|
|
55
|
+
"@dxos/plugin-space": "0.8.4-main.c4373fc",
|
|
56
|
+
"@dxos/react-client": "0.8.4-main.c4373fc",
|
|
57
|
+
"@dxos/plugin-graph": "0.8.4-main.c4373fc"
|
|
56
58
|
},
|
|
57
59
|
"devDependencies": {
|
|
58
|
-
"@effect-rx/rx-react": "0.
|
|
59
|
-
"@effect/platform": "0.
|
|
60
|
-
"@types/react": "~
|
|
61
|
-
"@types/react-dom": "~
|
|
62
|
-
"effect": "3.
|
|
63
|
-
"react": "~
|
|
64
|
-
"react-dom": "~
|
|
60
|
+
"@effect-rx/rx-react": "0.42.4",
|
|
61
|
+
"@effect/platform": "0.92.1",
|
|
62
|
+
"@types/react": "~19.2.2",
|
|
63
|
+
"@types/react-dom": "~19.2.1",
|
|
64
|
+
"effect": "3.18.3",
|
|
65
|
+
"react": "~19.2.0",
|
|
66
|
+
"react-dom": "~19.2.0",
|
|
65
67
|
"react-floater": "0.7.9",
|
|
66
68
|
"type-fest": "4.10.1",
|
|
67
|
-
"vite": "
|
|
68
|
-
"@dxos/
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
71
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
69
|
+
"vite": "7.1.9",
|
|
70
|
+
"@dxos/plugin-storybook-layout": "0.8.4-main.c4373fc",
|
|
71
|
+
"@dxos/random": "0.8.4-main.c4373fc",
|
|
72
|
+
"@dxos/react-ui-theme": "0.8.4-main.c4373fc",
|
|
73
|
+
"@dxos/storybook-utils": "0.8.4-main.c4373fc",
|
|
74
|
+
"@dxos/react-ui": "0.8.4-main.c4373fc"
|
|
72
75
|
},
|
|
73
76
|
"peerDependencies": {
|
|
74
77
|
"@effect-rx/rx-react": "^0.34.1",
|
|
75
78
|
"@effect/platform": "^0.80.12",
|
|
76
79
|
"effect": "^3.13.3",
|
|
77
|
-
"react": "
|
|
78
|
-
"react-dom": "
|
|
79
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
80
|
-
"@dxos/react-ui-theme": "0.8.4-main.
|
|
80
|
+
"react": "^19.0.0",
|
|
81
|
+
"react-dom": "^19.0.0",
|
|
82
|
+
"@dxos/react-ui": "0.8.4-main.c4373fc",
|
|
83
|
+
"@dxos/react-ui-theme": "0.8.4-main.c4373fc"
|
|
81
84
|
},
|
|
82
85
|
"publishConfig": {
|
|
83
86
|
"access": "public"
|
package/src/HelpPlugin.tsx
CHANGED
|
@@ -2,56 +2,54 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capabilities, Events, contributes, createResolver, defineModule, definePlugin } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
import { AppGraphBuilder, HelpState, ReactRoot, ReactSurface } from './capabilities';
|
|
8
|
-
import { HelpCapabilities } from './capabilities/capabilities';
|
|
7
|
+
import { AppGraphBuilder, HelpCapabilities, HelpState, ReactRoot, ReactSurface } from './capabilities';
|
|
9
8
|
import { meta } from './meta';
|
|
10
9
|
import { translations } from './translations';
|
|
11
|
-
import { type Step
|
|
10
|
+
import { HelpAction, type Step } from './types';
|
|
12
11
|
|
|
13
12
|
export type HelpPluginOptions = { steps?: Step[] };
|
|
14
13
|
|
|
15
|
-
export const HelpPlugin = ({ steps = [] }
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]);
|
|
14
|
+
export const HelpPlugin = definePlugin<HelpPluginOptions>(meta, ({ steps = [] }) => [
|
|
15
|
+
defineModule({
|
|
16
|
+
id: `${meta.id}/module/state`,
|
|
17
|
+
activatesOn: Events.Startup,
|
|
18
|
+
activate: HelpState,
|
|
19
|
+
}),
|
|
20
|
+
defineModule({
|
|
21
|
+
id: `${meta.id}/module/translations`,
|
|
22
|
+
activatesOn: Events.SetupTranslations,
|
|
23
|
+
activate: () => contributes(Capabilities.Translations, translations),
|
|
24
|
+
}),
|
|
25
|
+
defineModule({
|
|
26
|
+
id: `${meta.id}/module/react-root`,
|
|
27
|
+
activatesOn: Events.Startup,
|
|
28
|
+
activate: () => ReactRoot(steps),
|
|
29
|
+
}),
|
|
30
|
+
defineModule({
|
|
31
|
+
id: `${meta.id}/module/react-surface`,
|
|
32
|
+
activatesOn: Events.SetupReactSurface,
|
|
33
|
+
activate: ReactSurface,
|
|
34
|
+
}),
|
|
35
|
+
defineModule({
|
|
36
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
37
|
+
activatesOn: Events.SetupIntentResolver,
|
|
38
|
+
activate: (context) =>
|
|
39
|
+
contributes(
|
|
40
|
+
Capabilities.IntentResolver,
|
|
41
|
+
createResolver({
|
|
42
|
+
intent: HelpAction.Start,
|
|
43
|
+
resolve: () => {
|
|
44
|
+
const state = context.getCapability(HelpCapabilities.MutableState);
|
|
45
|
+
state.running = true;
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
),
|
|
49
|
+
}),
|
|
50
|
+
defineModule({
|
|
51
|
+
id: `${meta.id}/module/app-graph-builder`,
|
|
52
|
+
activatesOn: Events.SetupAppGraph,
|
|
53
|
+
activate: AppGraphBuilder,
|
|
54
|
+
}),
|
|
55
|
+
]);
|
|
@@ -3,24 +3,26 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Function from 'effect/Function';
|
|
7
|
+
import * as Option from 'effect/Option';
|
|
7
8
|
|
|
8
|
-
import { Capabilities,
|
|
9
|
+
import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
9
10
|
import { createExtension } from '@dxos/app-graph';
|
|
10
11
|
|
|
11
|
-
import { HelpCapabilities } from './capabilities';
|
|
12
12
|
import { SHORTCUTS_DIALOG } from '../components';
|
|
13
|
-
import {
|
|
13
|
+
import { meta } from '../meta';
|
|
14
14
|
import { HelpAction } from '../types';
|
|
15
15
|
|
|
16
|
+
import { HelpCapabilities } from './capabilities';
|
|
17
|
+
|
|
16
18
|
export default (context: PluginContext) =>
|
|
17
19
|
contributes(
|
|
18
20
|
Capabilities.AppGraphBuilder,
|
|
19
21
|
createExtension({
|
|
20
|
-
id:
|
|
22
|
+
id: meta.id,
|
|
21
23
|
actions: (node) =>
|
|
22
24
|
Rx.make((get) =>
|
|
23
|
-
pipe(
|
|
25
|
+
Function.pipe(
|
|
24
26
|
get(node),
|
|
25
27
|
Option.flatMap((node) => (node.id === 'root' ? Option.some(node) : Option.none())),
|
|
26
28
|
Option.map(() => [
|
|
@@ -33,7 +35,7 @@ export default (context: PluginContext) =>
|
|
|
33
35
|
await dispatch(createIntent(HelpAction.Start));
|
|
34
36
|
},
|
|
35
37
|
properties: {
|
|
36
|
-
label: ['open help tour', { ns:
|
|
38
|
+
label: ['open help tour', { ns: meta.id }],
|
|
37
39
|
icon: 'ph--info--regular',
|
|
38
40
|
keyBinding: {
|
|
39
41
|
macos: 'shift+meta+/',
|
|
@@ -45,7 +47,7 @@ export default (context: PluginContext) =>
|
|
|
45
47
|
},
|
|
46
48
|
},
|
|
47
49
|
{
|
|
48
|
-
id:
|
|
50
|
+
id: `${meta.id}/open-shortcuts`,
|
|
49
51
|
data: async () => {
|
|
50
52
|
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
51
53
|
const state = context.getCapability(HelpCapabilities.MutableState);
|
|
@@ -61,7 +63,7 @@ export default (context: PluginContext) =>
|
|
|
61
63
|
);
|
|
62
64
|
},
|
|
63
65
|
properties: {
|
|
64
|
-
label: ['open shortcuts label', { ns:
|
|
66
|
+
label: ['open shortcuts label', { ns: meta.id }],
|
|
65
67
|
icon: 'ph--keyboard--regular',
|
|
66
68
|
keyBinding: {
|
|
67
69
|
macos: 'meta+ctrl+/',
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import { defineCapability } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { meta } from '../meta';
|
|
8
8
|
|
|
9
9
|
export namespace HelpCapabilities {
|
|
10
10
|
export type State = { running: boolean; showHints: boolean; showWelcome: boolean };
|
|
11
|
-
export const State = defineCapability<Readonly<State>>(`${
|
|
12
|
-
export const MutableState = defineCapability<State>(`${
|
|
11
|
+
export const State = defineCapability<Readonly<State>>(`${meta.id}/capability/state`);
|
|
12
|
+
export const MutableState = defineCapability<State>(`${meta.id}/capability/state`);
|
|
13
13
|
}
|
|
@@ -6,14 +6,15 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
|
|
8
8
|
|
|
9
|
-
import { HelpCapabilities } from './capabilities';
|
|
10
9
|
import { WelcomeTour } from '../components';
|
|
11
|
-
import {
|
|
10
|
+
import { meta } from '../meta';
|
|
12
11
|
import { type Step } from '../types';
|
|
13
12
|
|
|
13
|
+
import { HelpCapabilities } from './capabilities';
|
|
14
|
+
|
|
14
15
|
export default (steps: Step[]) =>
|
|
15
16
|
contributes(Capabilities.ReactRoot, {
|
|
16
|
-
id:
|
|
17
|
+
id: meta.id,
|
|
17
18
|
root: () => {
|
|
18
19
|
const state = useCapability(HelpCapabilities.MutableState);
|
|
19
20
|
return (
|
|
@@ -7,17 +7,17 @@ import React from 'react';
|
|
|
7
7
|
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
8
|
|
|
9
9
|
import { SHORTCUTS_DIALOG, ShortcutsDialogContent, ShortcutsHints, ShortcutsList } from '../components';
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../meta';
|
|
11
11
|
|
|
12
12
|
export default () =>
|
|
13
13
|
contributes(Capabilities.ReactSurface, [
|
|
14
14
|
createSurface({
|
|
15
|
-
id: `${
|
|
15
|
+
id: `${meta.id}/hints`,
|
|
16
16
|
role: 'hints',
|
|
17
17
|
component: () => <ShortcutsHints />,
|
|
18
18
|
}),
|
|
19
19
|
createSurface({
|
|
20
|
-
id: `${
|
|
20
|
+
id: `${meta.id}/keyshortcuts`,
|
|
21
21
|
role: 'keyshortcuts',
|
|
22
22
|
component: () => <ShortcutsList />,
|
|
23
23
|
}),
|
|
@@ -5,11 +5,12 @@
|
|
|
5
5
|
import { contributes } from '@dxos/app-framework';
|
|
6
6
|
import { LocalStorageStore } from '@dxos/local-storage';
|
|
7
7
|
|
|
8
|
+
import { meta } from '../meta';
|
|
9
|
+
|
|
8
10
|
import { HelpCapabilities } from './capabilities';
|
|
9
|
-
import { HELP_PLUGIN } from '../meta';
|
|
10
11
|
|
|
11
12
|
export default () => {
|
|
12
|
-
const state = new LocalStorageStore<HelpCapabilities.State>(
|
|
13
|
+
const state = new LocalStorageStore<HelpCapabilities.State>(meta.id, {
|
|
13
14
|
running: false,
|
|
14
15
|
showHints: true,
|
|
15
16
|
showWelcome: true,
|
|
@@ -6,13 +6,14 @@ import React from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Button, Dialog, Icon, useTranslation } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
+
import { meta } from '../../meta';
|
|
10
|
+
|
|
9
11
|
import { ShortcutsList } from './ShortcutsList';
|
|
10
|
-
import { HELP_PLUGIN } from '../../meta';
|
|
11
12
|
|
|
12
|
-
export const SHORTCUTS_DIALOG = `${
|
|
13
|
+
export const SHORTCUTS_DIALOG = `${meta.id}/ShortcutsDialog`;
|
|
13
14
|
|
|
14
15
|
export const ShortcutsDialogContent = () => {
|
|
15
|
-
const { t } = useTranslation(
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
16
17
|
|
|
17
18
|
return (
|
|
18
19
|
<Dialog.Content classNames='p-0 bs-content max-bs-full md:max-is-[25rem] overflow-hidden'>
|
|
@@ -8,11 +8,12 @@ import { Keyboard } from '@dxos/keyboard';
|
|
|
8
8
|
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { mx } from '@dxos/react-ui-theme';
|
|
10
10
|
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
|
|
11
13
|
import { Key } from './Key';
|
|
12
|
-
import { HELP_PLUGIN } from '../../meta';
|
|
13
14
|
|
|
14
15
|
export const ShortcutsList = () => {
|
|
15
|
-
const { t } = useTranslation(
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
16
17
|
const bindings = Keyboard.singleton.getBindings();
|
|
17
18
|
|
|
18
19
|
// TODO(burdon): Get shortcuts from TextEditor.
|
|
@@ -7,7 +7,7 @@ import React, { forwardRef } from 'react';
|
|
|
7
7
|
// TODO(thure): This needed to be imported in the package.json specifically to pacify TS2742. See if this is resolved with typescript@5.5.x.
|
|
8
8
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
9
9
|
import _floater from 'react-floater';
|
|
10
|
-
import { type
|
|
10
|
+
import { type Props, type TooltipRenderProps } from 'react-joyride';
|
|
11
11
|
// TODO(thure): This needed to be imported in the package.json specifically to pacify TS2742. See if this is resolved with typescript@5.5.x.
|
|
12
12
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
13
13
|
import _typefest from 'type-fest';
|
|
@@ -2,18 +2,19 @@
|
|
|
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
6
|
import React, { useState } from 'react';
|
|
9
7
|
|
|
8
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
+
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
10
10
|
import { faker } from '@dxos/random';
|
|
11
11
|
import { Button, Icon } from '@dxos/react-ui';
|
|
12
|
-
import { withTheme } from '@dxos/
|
|
12
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
13
|
|
|
14
|
-
import { WelcomeTour, type WelcomeTourProps } from './WelcomeTour';
|
|
15
14
|
import { useHelp } from '../../hooks';
|
|
16
15
|
|
|
16
|
+
import { WelcomeTour, type WelcomeTourProps } from './WelcomeTour';
|
|
17
|
+
|
|
17
18
|
const App = () => {
|
|
18
19
|
const { running, start } = useHelp();
|
|
19
20
|
const [items, setItems] = useState(() => Array.from({ length: 5 }).map(() => faker.lorem.sentence()));
|
|
@@ -103,11 +104,12 @@ export const Default: StoryObj<typeof WelcomeTour> = {
|
|
|
103
104
|
/**
|
|
104
105
|
* IMPORTANT: Run in separate tab.
|
|
105
106
|
*/
|
|
106
|
-
const meta
|
|
107
|
+
const meta = {
|
|
107
108
|
title: 'plugins/plugin-help/WelcomeTour',
|
|
108
109
|
component: WelcomeTour,
|
|
109
110
|
render: DefaultStory,
|
|
110
|
-
|
|
111
|
-
}
|
|
111
|
+
// TODO(wittjosiah): Try to write story which does not depend on plugin manager.
|
|
112
|
+
decorators: [withTheme, withPluginManager({ plugins: [StorybookLayoutPlugin({})] })],
|
|
113
|
+
} satisfies Meta<typeof WelcomeTour>;
|
|
112
114
|
|
|
113
115
|
export default meta;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useState
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
6
|
import Joyride, { ACTIONS, EVENTS } from 'react-joyride';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { useLayout, usePluginManager } from '@dxos/app-framework';
|
|
9
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
9
10
|
|
|
10
|
-
import { type Step
|
|
11
|
-
import {
|
|
11
|
+
import { HelpContext, type Step } from '../../types';
|
|
12
|
+
import { Tooltip, floaterProps } from '../Tooltip';
|
|
12
13
|
|
|
13
14
|
const addStepClass = (target: string | HTMLElement) => {
|
|
14
15
|
const element = typeof target === 'string' ? document.querySelector(target) : target;
|
|
@@ -93,20 +94,16 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
|
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
return () => clearTimeout(timeout);
|
|
97
|
+
useAsyncEffect(async () => {
|
|
98
|
+
if (runningProp) {
|
|
99
|
+
// This handles the case when the target is not yet in the document.
|
|
100
|
+
// If the target is not in the document, when the joyride is turned on, it will not show the tooltip.
|
|
101
|
+
await waitForTarget(steps[stepIndex]);
|
|
102
|
+
setStepIndex(0);
|
|
103
|
+
setRunning(true);
|
|
104
|
+
} else if (typeof runningProp !== 'undefined') {
|
|
105
|
+
setRunning(false);
|
|
106
|
+
}
|
|
110
107
|
}, [runningProp]);
|
|
111
108
|
|
|
112
109
|
// https://docs.react-joyride.com/callback
|
package/src/meta.ts
CHANGED
|
@@ -4,11 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
// TODO(burdon): Rename Guide? Help?
|
|
8
|
-
export const HELP_PLUGIN = 'dxos.org/plugin/help';
|
|
9
|
-
|
|
10
7
|
export const meta: PluginMeta = {
|
|
11
|
-
id:
|
|
8
|
+
id: 'dxos.org/plugin/help',
|
|
12
9
|
name: 'Help',
|
|
13
10
|
icon: 'ph--info--regular',
|
|
14
11
|
};
|
package/src/types/schema.ts
CHANGED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport { Option, pipe } from 'effect';\n\nimport { Capabilities, contributes, createIntent, LayoutAction, type PluginContext } from '@dxos/app-framework';\nimport { createExtension } from '@dxos/app-graph';\n\nimport { HelpCapabilities } from './capabilities';\nimport { SHORTCUTS_DIALOG } from '../components';\nimport { HELP_PLUGIN } from '../meta';\nimport { HelpAction } from '../types';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: HELP_PLUGIN,\n actions: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id === 'root' ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: HelpAction.Start._tag,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n const state = context.getCapability(HelpCapabilities.MutableState);\n state.showHints = true;\n await dispatch(createIntent(HelpAction.Start));\n },\n properties: {\n label: ['open help tour', { ns: HELP_PLUGIN }],\n icon: 'ph--info--regular',\n keyBinding: {\n macos: 'shift+meta+/',\n // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.\n windows: 'shift+ctrl+/',\n linux: 'shift+ctrl+?',\n },\n testId: 'helpPlugin.openHelp',\n },\n },\n {\n id: 'dxos.org/plugin/help/open-shortcuts',\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n const state = context.getCapability(HelpCapabilities.MutableState);\n state.showHints = true;\n await dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: SHORTCUTS_DIALOG,\n options: {\n blockAlign: 'center',\n },\n }),\n );\n },\n properties: {\n label: ['open shortcuts label', { ns: HELP_PLUGIN }],\n icon: 'ph--keyboard--regular',\n keyBinding: {\n macos: 'meta+ctrl+/',\n },\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAIA,SAASA,UAAU;AACnB,SAASC,QAAQC,YAAY;AAE7B,SAASC,cAAcC,aAAaC,cAAcC,oBAAwC;AAC1F,SAASC,uBAAuB;AAOhC,IAAA,4BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC;EACJC,SAAS,CAACC,SACRC,GAAGC,KAAK,CAACC,QACPC,KACED,IAAIH,IAAAA,GACJK,OAAOC,QAAQ,CAACN,UAAUA,MAAKH,OAAO,SAASQ,OAAOE,KAAKP,KAAAA,IAAQK,OAAOG,KAAI,CAAA,GAC9EH,OAAOI,IAAI,MAAM;IACf;MACEZ,IAAIa,WAAWC,MAAMC;MACrBC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKvB,QAAQwB,cAActB,aAAauB,gBAAgB;AACzF,cAAMC,QAAQ1B,QAAQwB,cAAcG,iBAAiBC,YAAY;AACjEF,cAAMG,YAAY;AAClB,cAAMN,SAASO,aAAaZ,WAAWC,KAAK,CAAA;MAC9C;MACAY,YAAY;QACVC,OAAO;UAAC;UAAkB;YAAEC,IAAI3B;UAAY;;QAC5C4B,MAAM;QACNC,YAAY;UACVC,OAAO;;UAEPC,SAAS;UACTC,OAAO;QACT;QACAC,QAAQ;MACV;IACF;IACA;MACElC,IAAI;MACJgB,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKvB,QAAQwB,cAActB,aAAauB,gBAAgB;AACzF,cAAMC,QAAQ1B,QAAQwB,cAAcG,iBAAiBC,YAAY;AACjEF,cAAMG,YAAY;AAClB,cAAMN,SACJO,aAAaU,aAAaC,cAAc;UACtCC,MAAM;UACNC,SAASC;UACTC,SAAS;YACPC,YAAY;UACd;QACF,CAAA,CAAA;MAEJ;MACAf,YAAY;QACVC,OAAO;UAAC;UAAwB;YAAEC,IAAI3B;UAAY;;QAClD4B,MAAM;QACNC,YAAY;UACVC,OAAO;QACT;MACF;IACF;GACD,GACDvB,OAAOkC,UAAU,MAAM,CAAA,CAAE,CAAA,CAAA;AAGjC,CAAA,CAAA;",
|
|
6
|
-
"names": ["Rx", "Option", "pipe", "Capabilities", "contributes", "createIntent", "LayoutAction", "createExtension", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "HELP_PLUGIN", "actions", "node", "Rx", "make", "get", "pipe", "Option", "flatMap", "some", "none", "map", "HelpAction", "Start", "_tag", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "state", "HelpCapabilities", "MutableState", "showHints", "createIntent", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "linux", "testId", "LayoutAction", "UpdateDialog", "part", "subject", "SHORTCUTS_DIALOG", "options", "blockAlign", "getOrElse"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\n// TODO(burdon): Rename Guide? Help?\nexport const HELP_PLUGIN = 'dxos.org/plugin/help';\n\nexport const meta: PluginMeta = {\n id: HELP_PLUGIN,\n name: 'Help',\n icon: 'ph--info--regular',\n};\n"],
|
|
5
|
-
"mappings": ";AAOO,IAAMA,cAAc;AAEpB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;AACR;",
|
|
6
|
-
"names": ["HELP_PLUGIN", "meta", "id", "name", "icon"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/schema.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema } from 'effect';\nimport { type Context, createContext } from 'react';\nimport { type Step as BaseStep } from 'react-joyride';\n\nimport { type PluginContext } from '@dxos/app-framework';\n\nimport { meta } from '../meta';\n\nexport type Step = BaseStep & {\n before?: (context: PluginContext) => void;\n};\n\nexport type HelpContextType = {\n running: boolean;\n steps: Step[];\n setSteps: (steps: Step[]) => void;\n setIndex: (index: number) => void;\n start: () => void;\n stop: () => void;\n};\n\nexport const HelpContext: Context<HelpContextType> = createContext<HelpContextType>({\n running: false,\n steps: [],\n setSteps: () => {},\n setIndex: () => {},\n start: () => {},\n stop: () => {},\n});\n\nexport namespace HelpAction {\n export class Start extends Schema.TaggedClass<Start>()(`${meta.id}/action/start`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,cAAc;AACvB,SAAuBC,qBAAqB;AAoBrC,IAAMC,cAAwCC,cAA+B;EAClFC,SAAS;EACTC,OAAO,CAAA;EACPC,UAAU,MAAA;EAAO;EACjBC,UAAU,MAAA;EAAO;EACjBC,OAAO,MAAA;EAAO;EACdC,MAAM,MAAA;EAAO;AACf,CAAA;UAEiBC,aAAAA;EACR,MAAMC,cAAcC,OAAOC,YAAW,EAAU,GAAGC,KAAKC,EAAE,iBAAiB;IAChFC,OAAOJ,OAAOK;IACdC,QAAQN,OAAOK;EACjB,CAAA,EAAA;EAAI;cAHSN,QAAAA;AAIf,GALiBD,eAAAA,aAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["Schema", "createContext", "HelpContext", "createContext", "running", "steps", "setSteps", "setIndex", "start", "stop", "HelpAction", "Start", "Schema", "TaggedClass", "meta", "id", "input", "Void", "output"]
|
|
7
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HELP_PLUGIN
|
|
3
|
-
} from "./chunk-3Y4CMOZP.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/capabilities.ts
|
|
6
|
-
import { defineCapability } from "@dxos/app-framework";
|
|
7
|
-
(function(HelpCapabilities2) {
|
|
8
|
-
HelpCapabilities2.State = defineCapability(`${HELP_PLUGIN}/capability/state`);
|
|
9
|
-
HelpCapabilities2.MutableState = defineCapability(`${HELP_PLUGIN}/capability/state`);
|
|
10
|
-
})(HelpCapabilities || (HelpCapabilities = {}));
|
|
11
|
-
var HelpCapabilities;
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
HelpCapabilities
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-LDRUZNSN.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\n\nimport { HELP_PLUGIN } from '../meta';\n\nexport namespace HelpCapabilities {\n export type State = { running: boolean; showHints: boolean; showWelcome: boolean };\n export const State = defineCapability<Readonly<State>>(`${HELP_PLUGIN}/capability/state`);\n export const MutableState = defineCapability<State>(`${HELP_PLUGIN}/capability/state`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,wBAAwB;UAIhBC,mBAAAA;oBAEFC,QAAQC,iBAAkC,GAAGC,WAAAA,mBAA8B;oBAC3EC,eAAeF,iBAAwB,GAAGC,WAAAA,mBAA8B;AACvF,GAJiBH,qBAAAA,mBAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["defineCapability", "HelpCapabilities", "State", "defineCapability", "HELP_PLUGIN", "MutableState"]
|
|
7
|
-
}
|