@dxos/plugin-help 0.8.4-main.b97322e → 0.8.4-main.bc674ce
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-DX3VXARQ.mjs +79 -0
- package/dist/lib/browser/app-graph-builder-DX3VXARQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-IM2QVQOH.mjs +16 -0
- package/dist/lib/browser/chunk-IM2QVQOH.mjs.map +7 -0
- package/dist/lib/browser/chunk-TS66J4C6.mjs +58 -0
- package/dist/lib/browser/chunk-TS66J4C6.mjs.map +7 -0
- package/dist/lib/browser/chunk-W5XAZM46.mjs +360 -0
- package/dist/lib/browser/chunk-W5XAZM46.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +58 -57
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -3
- package/dist/lib/browser/react-root-SZRF6EXG.mjs +43 -0
- package/dist/lib/browser/react-root-SZRF6EXG.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-SATVEWS5.mjs → react-surface-DWNTJBVM.mjs} +15 -14
- package/dist/lib/browser/react-surface-DWNTJBVM.mjs.map +7 -0
- package/dist/lib/browser/state-VRPLKT3F.mjs +27 -0
- package/dist/lib/browser/state-VRPLKT3F.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +8 -6
- package/dist/types/src/HelpPlugin.d.ts +2 -1
- package/dist/types/src/HelpPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +2 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
- package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts +10 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +11 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +13 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- 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/ShortcutsHints.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/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +21 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +17 -13
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +42 -34
- package/src/HelpPlugin.tsx +19 -47
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +61 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +5 -8
- package/src/capabilities/operation-resolver/index.ts +5 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +23 -0
- package/src/capabilities/react-root/index.ts +7 -0
- package/src/capabilities/react-root/react-root.tsx +36 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +34 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +27 -0
- package/src/components/Shortcuts/ShortcutsDialog.tsx +7 -9
- package/src/components/Shortcuts/ShortcutsHints.tsx +14 -6
- package/src/components/Shortcuts/ShortcutsList.tsx +4 -3
- package/src/components/Shortcuts/ShortcutsSection.tsx +1 -1
- package/src/components/Shortcuts/styles.ts +1 -1
- package/src/components/Tooltip/Tooltip.tsx +1 -2
- package/src/components/WelcomeTour/WelcomeTour.stories.tsx +18 -12
- package/src/components/WelcomeTour/WelcomeTour.tsx +16 -19
- package/src/index.ts +1 -1
- package/src/meta.ts +8 -6
- package/src/types/capabilities.ts +24 -0
- package/src/types/index.ts +1 -0
- package/src/types/schema.ts +12 -8
- package/dist/lib/browser/app-graph-builder-BYCMEBNG.mjs +0 -79
- 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 +0 -34
- 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 +0 -409
- package/dist/lib/browser/chunk-MNETJXKS.mjs.map +0 -7
- package/dist/lib/browser/react-root-W6ZDEGBU.mjs +0 -34
- 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 +0 -29
- package/dist/lib/browser/state-FWUZG6NL.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -10
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts +0 -8
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -4
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -76
- package/src/capabilities/capabilities.ts +0 -13
- package/src/capabilities/react-root.tsx +0 -32
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/state.ts +0 -23
package/package.json
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-help",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.bc674ce",
|
|
4
4
|
"description": "Help plugin.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
11
15
|
"exports": {
|
|
12
16
|
".": {
|
|
17
|
+
"source": "./src/index.ts",
|
|
13
18
|
"types": "./dist/types/src/index.d.ts",
|
|
14
19
|
"browser": "./dist/lib/browser/index.mjs"
|
|
15
20
|
},
|
|
16
21
|
"./meta": {
|
|
22
|
+
"source": "./src/meta.ts",
|
|
17
23
|
"types": "./dist/types/src/meta.d.ts",
|
|
18
24
|
"browser": "./dist/lib/browser/meta.mjs"
|
|
19
25
|
},
|
|
20
26
|
"./types": {
|
|
27
|
+
"source": "./src/types/index.ts",
|
|
21
28
|
"types": "./dist/types/src/types/index.d.ts",
|
|
22
29
|
"browser": "./dist/lib/browser/types/index.mjs"
|
|
23
30
|
}
|
|
@@ -38,46 +45,47 @@
|
|
|
38
45
|
"src"
|
|
39
46
|
],
|
|
40
47
|
"dependencies": {
|
|
41
|
-
"@
|
|
42
|
-
"@
|
|
48
|
+
"@effect-atom/atom": "^0.4.13",
|
|
49
|
+
"@fluentui/react-tabster": "9.26.11",
|
|
43
50
|
"react-joyride": "^2.7.2",
|
|
44
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
45
|
-
"@dxos/app-graph": "0.8.4-main.
|
|
46
|
-
"@dxos/debug": "0.8.4-main.
|
|
47
|
-
"@dxos/echo
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/plugin-
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/react-client": "0.8.4-main.
|
|
51
|
+
"@dxos/app-framework": "0.8.4-main.bc674ce",
|
|
52
|
+
"@dxos/app-graph": "0.8.4-main.bc674ce",
|
|
53
|
+
"@dxos/debug": "0.8.4-main.bc674ce",
|
|
54
|
+
"@dxos/echo": "0.8.4-main.bc674ce",
|
|
55
|
+
"@dxos/effect": "0.8.4-main.bc674ce",
|
|
56
|
+
"@dxos/plugin-client": "0.8.4-main.bc674ce",
|
|
57
|
+
"@dxos/operation": "0.8.4-main.bc674ce",
|
|
58
|
+
"@dxos/plugin-graph": "0.8.4-main.bc674ce",
|
|
59
|
+
"@dxos/keyboard": "0.8.4-main.bc674ce",
|
|
60
|
+
"@dxos/plugin-space": "0.8.4-main.bc674ce",
|
|
61
|
+
"@dxos/util": "0.8.4-main.bc674ce",
|
|
62
|
+
"@dxos/react-client": "0.8.4-main.bc674ce"
|
|
56
63
|
},
|
|
57
64
|
"devDependencies": {
|
|
58
|
-
"@effect-
|
|
59
|
-
"@effect/platform": "0.
|
|
60
|
-
"@types/react": "~
|
|
61
|
-
"@types/react-dom": "~
|
|
62
|
-
"effect": "3.
|
|
63
|
-
"react": "~
|
|
64
|
-
"react-dom": "~
|
|
65
|
+
"@effect-atom/atom-react": "^0.4.6",
|
|
66
|
+
"@effect/platform": "0.93.6",
|
|
67
|
+
"@types/react": "~19.2.7",
|
|
68
|
+
"@types/react-dom": "~19.2.3",
|
|
69
|
+
"effect": "3.19.11",
|
|
70
|
+
"react": "~19.2.3",
|
|
71
|
+
"react-dom": "~19.2.3",
|
|
65
72
|
"react-floater": "0.7.9",
|
|
66
73
|
"type-fest": "4.10.1",
|
|
67
|
-
"vite": "
|
|
68
|
-
"@dxos/random": "0.8.4-main.
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
-
"@dxos/
|
|
74
|
+
"vite": "7.1.9",
|
|
75
|
+
"@dxos/random": "0.8.4-main.bc674ce",
|
|
76
|
+
"@dxos/storybook-utils": "0.8.4-main.bc674ce",
|
|
77
|
+
"@dxos/plugin-testing": "0.8.4-main.bc674ce",
|
|
78
|
+
"@dxos/react-ui": "0.8.4-main.bc674ce",
|
|
79
|
+
"@dxos/ui-theme": "0.8.4-main.bc674ce"
|
|
72
80
|
},
|
|
73
81
|
"peerDependencies": {
|
|
74
|
-
"@effect-
|
|
75
|
-
"@effect/platform": "
|
|
76
|
-
"effect": "
|
|
77
|
-
"react": "~
|
|
78
|
-
"react-dom": "~
|
|
79
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
80
|
-
"@dxos/
|
|
82
|
+
"@effect-atom/atom-react": "^0.4.6",
|
|
83
|
+
"@effect/platform": "0.93.6",
|
|
84
|
+
"effect": "3.19.11",
|
|
85
|
+
"react": "~19.2.3",
|
|
86
|
+
"react-dom": "~19.2.3",
|
|
87
|
+
"@dxos/react-ui": "0.8.4-main.bc674ce",
|
|
88
|
+
"@dxos/ui-theme": "0.8.4-main.bc674ce"
|
|
81
89
|
},
|
|
82
90
|
"publishConfig": {
|
|
83
91
|
"access": "public"
|
package/src/HelpPlugin.tsx
CHANGED
|
@@ -2,56 +2,28 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Common, Plugin } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
import { AppGraphBuilder, HelpState, ReactRoot, ReactSurface } from './capabilities';
|
|
8
|
-
import { HelpCapabilities } from './capabilities/capabilities';
|
|
7
|
+
import { AppGraphBuilder, HelpState, OperationResolver, ReactRoot, ReactSurface } from './capabilities';
|
|
9
8
|
import { meta } from './meta';
|
|
10
9
|
import { translations } from './translations';
|
|
11
|
-
import { type Step
|
|
10
|
+
import { type Step } from './types';
|
|
12
11
|
|
|
13
12
|
export type HelpPluginOptions = { steps?: Step[] };
|
|
14
13
|
|
|
15
|
-
export const HelpPlugin = (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}),
|
|
32
|
-
defineModule({
|
|
33
|
-
id: `${meta.id}/module/react-surface`,
|
|
34
|
-
activatesOn: Events.SetupReactSurface,
|
|
35
|
-
activate: ReactSurface,
|
|
36
|
-
}),
|
|
37
|
-
defineModule({
|
|
38
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
39
|
-
activatesOn: Events.SetupIntentResolver,
|
|
40
|
-
activate: (context) =>
|
|
41
|
-
contributes(
|
|
42
|
-
Capabilities.IntentResolver,
|
|
43
|
-
createResolver({
|
|
44
|
-
intent: HelpAction.Start,
|
|
45
|
-
resolve: () => {
|
|
46
|
-
const state = context.getCapability(HelpCapabilities.MutableState);
|
|
47
|
-
state.running = true;
|
|
48
|
-
},
|
|
49
|
-
}),
|
|
50
|
-
),
|
|
51
|
-
}),
|
|
52
|
-
defineModule({
|
|
53
|
-
id: `${meta.id}/module/app-graph-builder`,
|
|
54
|
-
activatesOn: Events.SetupAppGraph,
|
|
55
|
-
activate: AppGraphBuilder,
|
|
56
|
-
}),
|
|
57
|
-
]);
|
|
14
|
+
export const HelpPlugin = Plugin.define<HelpPluginOptions>(meta).pipe(
|
|
15
|
+
Plugin.addModule({
|
|
16
|
+
activatesOn: Common.ActivationEvent.Startup,
|
|
17
|
+
activate: HelpState,
|
|
18
|
+
}),
|
|
19
|
+
Common.Plugin.addTranslationsModule({ translations }),
|
|
20
|
+
Plugin.addModule(({ steps = [] }) => ({
|
|
21
|
+
id: 'react-root',
|
|
22
|
+
activatesOn: Common.ActivationEvent.Startup,
|
|
23
|
+
activate: () => ReactRoot(steps),
|
|
24
|
+
})),
|
|
25
|
+
Common.Plugin.addSurfaceModule({ activate: ReactSurface }),
|
|
26
|
+
Common.Plugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
27
|
+
Common.Plugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
28
|
+
Plugin.make,
|
|
29
|
+
);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { GraphBuilder, NodeMatcher } from '@dxos/app-graph';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { SHORTCUTS_DIALOG } from '../../components';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
|
+
import { HelpCapabilities, HelpOperation } from '../../types';
|
|
14
|
+
|
|
15
|
+
export default Capability.makeModule(
|
|
16
|
+
Effect.fnUntraced(function* () {
|
|
17
|
+
const extensions = yield* GraphBuilder.createExtension({
|
|
18
|
+
id: meta.id,
|
|
19
|
+
match: NodeMatcher.whenRoot,
|
|
20
|
+
actions: () =>
|
|
21
|
+
Effect.succeed([
|
|
22
|
+
{
|
|
23
|
+
id: HelpOperation.Start.meta.key,
|
|
24
|
+
data: Effect.fnUntraced(function* () {
|
|
25
|
+
yield* Common.Capability.updateAtomValue(HelpCapabilities.State, (s) => ({ ...s, showHints: true }));
|
|
26
|
+
yield* Operation.invoke(HelpOperation.Start);
|
|
27
|
+
}),
|
|
28
|
+
properties: {
|
|
29
|
+
label: ['open help tour', { ns: meta.id }],
|
|
30
|
+
icon: 'ph--info--regular',
|
|
31
|
+
keyBinding: {
|
|
32
|
+
macos: 'shift+meta+/',
|
|
33
|
+
windows: 'shift+ctrl+/',
|
|
34
|
+
linux: 'shift+ctrl+?',
|
|
35
|
+
},
|
|
36
|
+
testId: 'helpPlugin.openHelp',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: `${meta.id}/open-shortcuts`,
|
|
41
|
+
data: Effect.fnUntraced(function* () {
|
|
42
|
+
yield* Common.Capability.updateAtomValue(HelpCapabilities.State, (s) => ({ ...s, showHints: true }));
|
|
43
|
+
yield* Operation.invoke(Common.LayoutOperation.UpdateDialog, {
|
|
44
|
+
subject: SHORTCUTS_DIALOG,
|
|
45
|
+
blockAlign: 'center',
|
|
46
|
+
});
|
|
47
|
+
}),
|
|
48
|
+
properties: {
|
|
49
|
+
label: ['open shortcuts label', { ns: meta.id }],
|
|
50
|
+
icon: 'ph--keyboard--regular',
|
|
51
|
+
keyBinding: {
|
|
52
|
+
macos: 'meta+ctrl+/',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
]),
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
@@ -2,11 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export const HelpState = lazy(() => import('./state'));
|
|
11
|
-
|
|
12
|
-
export * from './capabilities';
|
|
5
|
+
export * from './app-graph-builder';
|
|
6
|
+
export * from './operation-resolver';
|
|
7
|
+
export * from './react-root';
|
|
8
|
+
export * from './react-surface';
|
|
9
|
+
export * from './state';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
8
|
+
import { OperationResolver } from '@dxos/operation';
|
|
9
|
+
|
|
10
|
+
import { HelpCapabilities, HelpOperation } from '../../types';
|
|
11
|
+
|
|
12
|
+
export default Capability.makeModule(
|
|
13
|
+
Effect.fnUntraced(function* () {
|
|
14
|
+
return Capability.contributes(Common.Capability.OperationResolver, [
|
|
15
|
+
OperationResolver.make({
|
|
16
|
+
operation: HelpOperation.Start,
|
|
17
|
+
handler: Effect.fnUntraced(function* () {
|
|
18
|
+
yield* Common.Capability.updateAtomValue(HelpCapabilities.State, (state) => ({ ...state, running: true }));
|
|
19
|
+
}),
|
|
20
|
+
}),
|
|
21
|
+
]);
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
import { useAtomCapabilityState } from '@dxos/app-framework/react';
|
|
10
|
+
|
|
11
|
+
import { WelcomeTour } from '../../components';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
|
+
import { HelpCapabilities, type Step } from '../../types';
|
|
14
|
+
|
|
15
|
+
export default Capability.makeModule(
|
|
16
|
+
Effect.fnUntraced(function* (steps?: Step[]) {
|
|
17
|
+
return Capability.contributes(Common.Capability.ReactRoot, {
|
|
18
|
+
id: meta.id,
|
|
19
|
+
root: () => {
|
|
20
|
+
const [state, updateState] = useAtomCapabilityState(HelpCapabilities.State);
|
|
21
|
+
return (
|
|
22
|
+
<WelcomeTour
|
|
23
|
+
steps={steps ?? []}
|
|
24
|
+
running={state.running}
|
|
25
|
+
onRunningChanged={(newState) => {
|
|
26
|
+
updateState((s) => ({ ...s, running: newState }));
|
|
27
|
+
if (!newState) {
|
|
28
|
+
updateState((s) => ({ ...s, showHints: false }));
|
|
29
|
+
}
|
|
30
|
+
}}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
}),
|
|
36
|
+
);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { Capability, Common } from '@dxos/app-framework';
|
|
9
|
+
|
|
10
|
+
import { SHORTCUTS_DIALOG, ShortcutsDialogContent, ShortcutsHints, ShortcutsList } from '../../components';
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(() =>
|
|
14
|
+
Effect.succeed(
|
|
15
|
+
Capability.contributes(Common.Capability.ReactSurface, [
|
|
16
|
+
Common.createSurface({
|
|
17
|
+
id: `${meta.id}/hints`,
|
|
18
|
+
role: 'hints',
|
|
19
|
+
component: () => <ShortcutsHints />,
|
|
20
|
+
}),
|
|
21
|
+
Common.createSurface({
|
|
22
|
+
id: `${meta.id}/keyshortcuts`,
|
|
23
|
+
role: 'keyshortcuts',
|
|
24
|
+
component: () => <ShortcutsList />,
|
|
25
|
+
}),
|
|
26
|
+
Common.createSurface({
|
|
27
|
+
id: SHORTCUTS_DIALOG,
|
|
28
|
+
role: 'dialog',
|
|
29
|
+
filter: (data): data is { component: string } => data.component === SHORTCUTS_DIALOG,
|
|
30
|
+
component: () => <ShortcutsDialogContent />,
|
|
31
|
+
}),
|
|
32
|
+
]),
|
|
33
|
+
),
|
|
34
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { createKvsStore } from '@dxos/effect';
|
|
9
|
+
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
|
+
import { HelpCapabilities } from '../../types';
|
|
12
|
+
|
|
13
|
+
export default Capability.makeModule(() =>
|
|
14
|
+
Effect.sync(() => {
|
|
15
|
+
const stateAtom = createKvsStore({
|
|
16
|
+
key: meta.id,
|
|
17
|
+
schema: HelpCapabilities.StateSchema,
|
|
18
|
+
defaultValue: () => ({
|
|
19
|
+
running: false,
|
|
20
|
+
showHints: true,
|
|
21
|
+
showWelcome: true,
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return Capability.contributes(HelpCapabilities.State, stateAtom);
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
@@ -4,25 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Dialog, IconButton, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
|
|
9
|
+
import { meta } from '../../meta';
|
|
8
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
|
-
<Dialog.Content
|
|
19
|
+
<Dialog.Content>
|
|
19
20
|
<div role='none' className='flex justify-between mbe-1 pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5'>
|
|
20
21
|
<Dialog.Title>{t('shortcuts dialog title')}</Dialog.Title>
|
|
21
|
-
|
|
22
22
|
<Dialog.Close asChild>
|
|
23
|
-
<
|
|
24
|
-
<Icon icon='ph--x--bold' size={3} />
|
|
25
|
-
</Button>
|
|
23
|
+
<IconButton icon='ph--x--bold' iconOnly size={3} label='Close' variant='ghost' autoFocus />
|
|
26
24
|
</Dialog.Close>
|
|
27
25
|
</div>
|
|
28
26
|
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { type KeyBinding, Keyboard } from '@dxos/keyboard';
|
|
8
|
-
import {
|
|
8
|
+
import { IconButton, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { osTranslations } from '@dxos/ui-theme';
|
|
9
10
|
|
|
10
11
|
import { Key } from './Key';
|
|
11
12
|
|
|
12
13
|
const Shortcut = ({ binding }: { binding: KeyBinding }) => {
|
|
13
|
-
const { t } = useTranslation(
|
|
14
|
+
const { t } = useTranslation(osTranslations);
|
|
14
15
|
return (
|
|
15
16
|
<div role='none' className='flex items-center gap-2 whitespace-nowrap'>
|
|
16
17
|
<Key binding={binding.shortcut} />
|
|
@@ -26,14 +27,21 @@ export const ShortcutsHints = ({ onClose }: { onClose?: () => void }) => {
|
|
|
26
27
|
const hints = bindings.filter((binding) => defaults.includes(binding.shortcut));
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
|
-
<div role='none' className='flex overflow-hidden
|
|
30
|
+
<div role='none' className='flex overflow-hidden pli-2 gap-4'>
|
|
30
31
|
{hints.map((binding) => (
|
|
31
32
|
<Shortcut key={binding.shortcut} binding={binding} />
|
|
32
33
|
))}
|
|
33
34
|
{onClose && (
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
<IconButton
|
|
36
|
+
icon='ph--x--regular'
|
|
37
|
+
size={4}
|
|
38
|
+
label='Close'
|
|
39
|
+
iconOnly
|
|
40
|
+
noTooltip
|
|
41
|
+
variant='ghost'
|
|
42
|
+
classNames='p-0 cursor-pointer'
|
|
43
|
+
onClick={onClose}
|
|
44
|
+
/>
|
|
37
45
|
)}
|
|
38
46
|
</div>
|
|
39
47
|
);
|
|
@@ -6,13 +6,14 @@ import React, { Fragment } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Keyboard } from '@dxos/keyboard';
|
|
8
8
|
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { mx } from '@dxos/
|
|
9
|
+
import { mx } from '@dxos/ui-theme';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../../meta';
|
|
10
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';
|
|
@@ -67,7 +67,6 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
67
67
|
iconOnly
|
|
68
68
|
label={backProps['aria-label']}
|
|
69
69
|
onClick={backProps.onClick}
|
|
70
|
-
size={5}
|
|
71
70
|
variant='primary'
|
|
72
71
|
data-testid='helpPlugin.tooltip.back'
|
|
73
72
|
/>
|
|
@@ -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 { StorybookPlugin } from '@dxos/plugin-testing';
|
|
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()));
|
|
@@ -22,8 +23,8 @@ const App = () => {
|
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
return (
|
|
25
|
-
<div className='flex flex-col
|
|
26
|
-
<div className='flex items-center gap-2
|
|
26
|
+
<div className='flex flex-col bs-full p-4 space-y-8'>
|
|
27
|
+
<div className='flex items-center gap-2 plb-2'>
|
|
27
28
|
<Button data-joyride='basic/1' onClick={() => start()}>
|
|
28
29
|
Start
|
|
29
30
|
</Button>
|
|
@@ -31,7 +32,7 @@ const App = () => {
|
|
|
31
32
|
<div>{String(running)}</div>
|
|
32
33
|
</div>
|
|
33
34
|
<div>
|
|
34
|
-
<ul className='p-2 border border-
|
|
35
|
+
<ul className='p-2 border border-primary-500 rounded-md' data-joyride='basic/2'>
|
|
35
36
|
{items.map((item, i) => (
|
|
36
37
|
<li key={i} className='flex items-center gap-2'>
|
|
37
38
|
<Icon icon='ph--circle--regular' />
|
|
@@ -40,13 +41,13 @@ const App = () => {
|
|
|
40
41
|
))}
|
|
41
42
|
</ul>
|
|
42
43
|
</div>
|
|
43
|
-
<div className='flex items-center gap-2
|
|
44
|
+
<div className='flex items-center gap-2 plb-2'>
|
|
44
45
|
<Button data-joyride='basic/3' onClick={handleAdd}>
|
|
45
46
|
Add
|
|
46
47
|
</Button>
|
|
47
48
|
</div>
|
|
48
49
|
<div className='flex grow' />
|
|
49
|
-
<div className='flex items-center
|
|
50
|
+
<div className='flex items-center plb-2'>
|
|
50
51
|
<div className='grow' />
|
|
51
52
|
<Icon icon='ph--circle--regular' data-joyride='basic/4' />
|
|
52
53
|
<Icon icon='ph--circle--regular' />
|
|
@@ -103,11 +104,16 @@ 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
|
-
decorators: [
|
|
111
|
-
|
|
111
|
+
decorators: [
|
|
112
|
+
withTheme,
|
|
113
|
+
withPluginManager({
|
|
114
|
+
plugins: [StorybookPlugin({})],
|
|
115
|
+
}),
|
|
116
|
+
],
|
|
117
|
+
} satisfies Meta<typeof WelcomeTour>;
|
|
112
118
|
|
|
113
119
|
export default meta;
|