@dxos/plugin-help 0.8.4-main.f5c0578 → 0.8.4-main.fcc0d83b33
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/chunk-53QC3FTJ.mjs +34 -0
- package/dist/lib/browser/chunk-53QC3FTJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-RWK34XL5.mjs +31 -0
- package/dist/lib/browser/chunk-RWK34XL5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +347 -83
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +13 -5
- package/dist/lib/browser/meta.mjs.map +4 -4
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/start-JQ2LLVCT.mjs +23 -0
- package/dist/lib/browser/start-JQ2LLVCT.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +20 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -4
- package/dist/types/src/HelpPlugin.d.ts +3 -2
- package/dist/types/src/HelpPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +16 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts +5 -3
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +11 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/Key.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsHints.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsSection.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/index.d.ts +0 -1
- package/dist/types/src/components/Shortcuts/index.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts +9 -9
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts +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/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts +3 -0
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.d.ts +25 -0
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsDialogContent/index.d.ts +2 -0
- package/dist/types/src/containers/ShortcutsDialogContent/index.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsHints/ShortcutsHints.d.ts +2 -0
- package/dist/types/src/containers/ShortcutsHints/ShortcutsHints.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsHints/index.d.ts +2 -0
- package/dist/types/src/containers/ShortcutsHints/index.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsList/ShortcutsList.d.ts +2 -0
- package/dist/types/src/containers/ShortcutsList/ShortcutsList.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsList/index.d.ts +2 -0
- package/dist/types/src/containers/ShortcutsList/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useHelp.d.ts +1 -1
- package/dist/types/src/hooks/useHelp.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- 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/operations/definitions.d.ts +4 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/start.d.ts +5 -0
- package/dist/types/src/operations/start.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +5 -6
- package/dist/types/src/translations.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 +2 -14
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -44
- package/src/HelpPlugin.tsx +22 -49
- package/src/capabilities/app-graph-builder.ts +53 -67
- package/src/capabilities/index.ts +10 -7
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-root.tsx +28 -25
- package/src/capabilities/react-surface.tsx +28 -22
- package/src/capabilities/state.ts +19 -16
- package/src/components/Shortcuts/ShortcutsHints.tsx +13 -5
- package/src/components/Shortcuts/ShortcutsList.tsx +5 -5
- package/src/components/Shortcuts/ShortcutsSection.tsx +1 -3
- package/src/components/Shortcuts/index.ts +0 -1
- package/src/components/Shortcuts/styles.ts +3 -3
- package/src/components/Tooltip/Tooltip.tsx +4 -5
- package/src/components/WelcomeTour/WelcomeTour.stories.tsx +21 -16
- package/src/components/WelcomeTour/WelcomeTour.tsx +18 -18
- package/src/constants.ts +7 -0
- package/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.tsx +39 -0
- package/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.tsx +28 -0
- package/src/containers/ShortcutsDialogContent/index.ts +5 -0
- package/src/containers/ShortcutsHints/ShortcutsHints.tsx +5 -0
- package/src/containers/ShortcutsHints/index.ts +5 -0
- package/src/containers/ShortcutsList/ShortcutsList.tsx +5 -0
- package/src/containers/ShortcutsList/index.ts +5 -0
- package/src/containers/index.ts +9 -0
- package/src/hooks/useHelp.tsx +1 -1
- package/src/index.ts +2 -3
- package/src/meta.ts +8 -6
- package/src/operations/definitions.ts +19 -0
- package/src/operations/index.ts +9 -0
- package/src/operations/start.ts +21 -0
- package/src/translations.ts +5 -5
- package/src/types/capabilities.ts +24 -0
- package/src/types/index.ts +1 -0
- package/src/types/schema.ts +2 -12
- package/dist/lib/browser/app-graph-builder-TUTK2ONB.mjs +0 -79
- package/dist/lib/browser/app-graph-builder-TUTK2ONB.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-GIDPSFGY.mjs +0 -409
- package/dist/lib/browser/chunk-GIDPSFGY.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/react-root-5GSVXKQD.mjs +0 -34
- package/dist/lib/browser/react-root-5GSVXKQD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-V7U4IDJV.mjs +0 -36
- package/dist/lib/browser/react-surface-V7U4IDJV.mjs.map +0 -7
- package/dist/lib/browser/state-IXBTB3WH.mjs +0 -29
- package/dist/lib/browser/state-IXBTB3WH.mjs.map +0 -7
- 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/components/Shortcuts/ShortcutsDialog.d.ts +0 -4
- package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -13
- package/src/components/Shortcuts/ShortcutsDialog.tsx +0 -35
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { mx } from '@dxos/
|
|
5
|
+
import { mx } from '@dxos/ui-theme';
|
|
6
6
|
|
|
7
7
|
export const shortcutKey = mx(
|
|
8
|
-
'inline-flex min-
|
|
9
|
-
'rounded bg-neutral-100 dark:bg-neutral-900',
|
|
8
|
+
'inline-flex min-w-[24px] h-[24px] px-0.5 justify-center items-center text-xs',
|
|
9
|
+
'rounded-sm bg-neutral-100 dark:bg-neutral-900',
|
|
10
10
|
);
|
|
@@ -38,7 +38,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
40
|
<div
|
|
41
|
-
className='flex flex-col
|
|
41
|
+
className='flex flex-col w-[15rem] min-h-[10rem] overflow-hidden rounded-md shadow-xl bg-accent-surface text-accent-surface-text'
|
|
42
42
|
role='tooltip'
|
|
43
43
|
data-testid='helpPlugin.tooltip'
|
|
44
44
|
data-step={index + 1}
|
|
@@ -46,7 +46,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
46
46
|
ref={forwardedRef}
|
|
47
47
|
>
|
|
48
48
|
<div className='flex p-2'>
|
|
49
|
-
<h2 className='grow
|
|
49
|
+
<h2 className='grow px-2 py-1 text-lg font-medium text-accent-surface-text'>{title}</h2>
|
|
50
50
|
<IconButton
|
|
51
51
|
density='fine'
|
|
52
52
|
icon='ph--x--bold'
|
|
@@ -58,7 +58,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
58
58
|
data-testid='helpPlugin.tooltip.close'
|
|
59
59
|
/>
|
|
60
60
|
</div>
|
|
61
|
-
<div className='flex grow
|
|
61
|
+
<div className='flex grow px-4 my-2'>{content}</div>
|
|
62
62
|
<div className='flex p-2 items-center justify-between' {...arrowNavigationAttrs}>
|
|
63
63
|
{
|
|
64
64
|
<IconButton
|
|
@@ -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
|
/>
|
|
@@ -79,7 +78,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
79
78
|
key={i}
|
|
80
79
|
icon={index === i ? 'ph--circle--fill' : 'ph--circle--regular'}
|
|
81
80
|
size={2}
|
|
82
|
-
classNames='
|
|
81
|
+
classNames='mx-1 cursor-pointer'
|
|
83
82
|
/>
|
|
84
83
|
))}
|
|
85
84
|
</div>
|
|
@@ -2,24 +2,24 @@
|
|
|
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
|
|
|
10
|
-
import {
|
|
8
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
+
import { StorybookPlugin } from '@dxos/plugin-testing';
|
|
10
|
+
import { random } 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 { useHelp } from '
|
|
14
|
+
import { useHelp } from '#hooks';
|
|
15
15
|
|
|
16
16
|
import { WelcomeTour, type WelcomeTourProps } from './WelcomeTour';
|
|
17
17
|
|
|
18
18
|
const App = () => {
|
|
19
19
|
const { running, start } = useHelp();
|
|
20
|
-
const [items, setItems] = useState(() => Array.from({ length: 5 }).map(() =>
|
|
20
|
+
const [items, setItems] = useState(() => Array.from({ length: 5 }).map(() => random.lorem.sentence()));
|
|
21
21
|
const handleAdd = () => {
|
|
22
|
-
setItems((items) => [...items,
|
|
22
|
+
setItems((items) => [...items, random.lorem.sentence()]);
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
return (
|
|
@@ -32,7 +32,7 @@ const App = () => {
|
|
|
32
32
|
<div>{String(running)}</div>
|
|
33
33
|
</div>
|
|
34
34
|
<div>
|
|
35
|
-
<ul className='p-2 border border-
|
|
35
|
+
<ul className='p-2 border border-primary-500 rounded-md' data-joyride='basic/2'>
|
|
36
36
|
{items.map((item, i) => (
|
|
37
37
|
<li key={i} className='flex items-center gap-2'>
|
|
38
38
|
<Icon icon='ph--circle--regular' />
|
|
@@ -76,25 +76,25 @@ export const Default: StoryObj<typeof WelcomeTour> = {
|
|
|
76
76
|
{
|
|
77
77
|
target: '[data-joyride="basic/1"]',
|
|
78
78
|
title: 'plugins/Step 1',
|
|
79
|
-
content:
|
|
79
|
+
content: random.lorem.paragraph(),
|
|
80
80
|
disableBeacon: true,
|
|
81
81
|
placement: 'right',
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
target: '[data-joyride="basic/2"]',
|
|
85
85
|
title: 'plugins/Step 2',
|
|
86
|
-
content:
|
|
86
|
+
content: random.lorem.paragraph(),
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
target: '[data-joyride="basic/3"]',
|
|
90
90
|
title: 'plugins/Step 3',
|
|
91
|
-
content:
|
|
91
|
+
content: random.lorem.paragraph(),
|
|
92
92
|
placement: 'right',
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
target: '[data-joyride="basic/4"]',
|
|
96
96
|
title: 'plugins/Step 4',
|
|
97
|
-
content:
|
|
97
|
+
content: random.lorem.paragraph(),
|
|
98
98
|
placement: 'top-end',
|
|
99
99
|
},
|
|
100
100
|
],
|
|
@@ -104,11 +104,16 @@ export const Default: StoryObj<typeof WelcomeTour> = {
|
|
|
104
104
|
/**
|
|
105
105
|
* IMPORTANT: Run in separate tab.
|
|
106
106
|
*/
|
|
107
|
-
const meta
|
|
108
|
-
title: 'plugins/plugin-help/WelcomeTour',
|
|
107
|
+
const meta = {
|
|
108
|
+
title: 'plugins/plugin-help/components/WelcomeTour',
|
|
109
109
|
component: WelcomeTour,
|
|
110
110
|
render: DefaultStory,
|
|
111
|
-
decorators: [
|
|
112
|
-
|
|
111
|
+
decorators: [
|
|
112
|
+
withTheme(),
|
|
113
|
+
withPluginManager({
|
|
114
|
+
plugins: [StorybookPlugin({})],
|
|
115
|
+
}),
|
|
116
|
+
],
|
|
117
|
+
} satisfies Meta<typeof WelcomeTour>;
|
|
113
118
|
|
|
114
119
|
export default meta;
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
6
|
import Joyride, { ACTIONS, EVENTS } from 'react-joyride';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { usePluginManager } from '@dxos/app-framework/ui';
|
|
9
|
+
import { useLayout } from '@dxos/app-toolkit/ui';
|
|
10
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
11
|
+
|
|
12
|
+
import { HelpContext, type Step } from '#types';
|
|
9
13
|
|
|
10
|
-
import { HelpContext, type Step } from '../../types';
|
|
11
14
|
import { Tooltip, floaterProps } from '../Tooltip';
|
|
12
15
|
|
|
13
16
|
const addStepClass = (target: string | HTMLElement) => {
|
|
@@ -75,7 +78,7 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
|
|
|
75
78
|
const setStepIndex = (index: number) => {
|
|
76
79
|
if (runningProp) {
|
|
77
80
|
const step = steps[index];
|
|
78
|
-
step?.before?.(manager.
|
|
81
|
+
step?.before?.(manager.capabilities);
|
|
79
82
|
}
|
|
80
83
|
_setStepIndex(index);
|
|
81
84
|
};
|
|
@@ -93,20 +96,16 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
|
|
|
93
96
|
}
|
|
94
97
|
};
|
|
95
98
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
return () => clearTimeout(timeout);
|
|
99
|
+
useAsyncEffect(async () => {
|
|
100
|
+
if (runningProp) {
|
|
101
|
+
// This handles the case when the target is not yet in the document.
|
|
102
|
+
// If the target is not in the document, when the joyride is turned on, it will not show the tooltip.
|
|
103
|
+
await waitForTarget(steps[stepIndex]);
|
|
104
|
+
setStepIndex(0);
|
|
105
|
+
setRunning(true);
|
|
106
|
+
} else if (typeof runningProp !== 'undefined') {
|
|
107
|
+
setRunning(false);
|
|
108
|
+
}
|
|
110
109
|
}, [runningProp]);
|
|
111
110
|
|
|
112
111
|
// https://docs.react-joyride.com/callback
|
|
@@ -164,6 +163,7 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
|
|
|
164
163
|
callback={callback}
|
|
165
164
|
floaterProps={floaterProps}
|
|
166
165
|
tooltipComponent={Tooltip}
|
|
166
|
+
spotlightPadding={0}
|
|
167
167
|
/>
|
|
168
168
|
</HelpContext.Provider>
|
|
169
169
|
);
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
+
import { Dialog } from '@dxos/react-ui';
|
|
10
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
11
|
+
|
|
12
|
+
import { translations } from '#translations';
|
|
13
|
+
|
|
14
|
+
import { ShortcutsDialogContent } from './ShortcutsDialogContent';
|
|
15
|
+
|
|
16
|
+
const DefaultStory = () => (
|
|
17
|
+
<Dialog.Root defaultOpen>
|
|
18
|
+
<Dialog.Overlay>
|
|
19
|
+
<ShortcutsDialogContent />
|
|
20
|
+
</Dialog.Overlay>
|
|
21
|
+
</Dialog.Root>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const meta = {
|
|
25
|
+
title: 'plugins/plugin-help/containers/ShortcutsDialogContent',
|
|
26
|
+
component: ShortcutsDialogContent,
|
|
27
|
+
render: DefaultStory,
|
|
28
|
+
decorators: [withTheme(), withPluginManager()],
|
|
29
|
+
parameters: {
|
|
30
|
+
layout: 'fullscreen',
|
|
31
|
+
translations,
|
|
32
|
+
},
|
|
33
|
+
} satisfies Meta<typeof ShortcutsDialogContent>;
|
|
34
|
+
|
|
35
|
+
export default meta;
|
|
36
|
+
|
|
37
|
+
type Story = StoryObj<typeof meta>;
|
|
38
|
+
|
|
39
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Dialog, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
|
|
9
|
+
import { ShortcutsList } from '#components';
|
|
10
|
+
import { meta } from '#meta';
|
|
11
|
+
|
|
12
|
+
export const ShortcutsDialogContent = () => {
|
|
13
|
+
const { t } = useTranslation(meta.id);
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Dialog.Content>
|
|
17
|
+
<Dialog.Header>
|
|
18
|
+
<Dialog.Title>{t('shortcuts-dialog.title')}</Dialog.Title>
|
|
19
|
+
<Dialog.Close asChild>
|
|
20
|
+
<Dialog.CloseIconButton />
|
|
21
|
+
</Dialog.Close>
|
|
22
|
+
</Dialog.Header>
|
|
23
|
+
<Dialog.Body>
|
|
24
|
+
<ShortcutsList />
|
|
25
|
+
</Dialog.Body>
|
|
26
|
+
</Dialog.Content>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export const ShortcutsDialogContent: ComponentType<any> = lazy(() => import('./ShortcutsDialogContent'));
|
|
8
|
+
export const ShortcutsHints: ComponentType<any> = lazy(() => import('./ShortcutsHints'));
|
|
9
|
+
export const ShortcutsList: ComponentType<any> = lazy(() => import('./ShortcutsList'));
|
package/src/hooks/useHelp.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { useContext } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { raise } from '@dxos/debug';
|
|
8
8
|
|
|
9
|
-
import { HelpContext } from '
|
|
9
|
+
import { HelpContext } from '#types';
|
|
10
10
|
|
|
11
11
|
export const useHelp = () => {
|
|
12
12
|
return useContext(HelpContext) ?? raise(new Error('Missing HelpContext'));
|
package/src/index.ts
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { HelpCapabilities } from './
|
|
5
|
+
export { HelpCapabilities } from './types';
|
|
6
6
|
export * from './components';
|
|
7
|
-
export * from './
|
|
7
|
+
export * from './constants';
|
|
8
8
|
export * from './HelpPlugin';
|
|
9
9
|
export * from './hooks';
|
|
10
|
-
export * from './types';
|
package/src/meta.ts
CHANGED
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export const meta: PluginMeta = {
|
|
11
|
-
id: HELP_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.help',
|
|
12
10
|
name: 'Help',
|
|
11
|
+
description: trim`
|
|
12
|
+
Built-in help system with documentation, tutorials, and contextual assistance.
|
|
13
|
+
Access keyboard shortcuts, feature guides, and support resources.
|
|
14
|
+
`,
|
|
13
15
|
icon: 'ph--info--regular',
|
|
14
16
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { meta } from '#meta';
|
|
11
|
+
|
|
12
|
+
const HELP_OPERATION = `${meta.id}.operation`;
|
|
13
|
+
|
|
14
|
+
export const Start = Operation.make({
|
|
15
|
+
meta: { key: `${HELP_OPERATION}.start`, name: 'Start Help' },
|
|
16
|
+
services: [Capability.Service],
|
|
17
|
+
input: Schema.Void,
|
|
18
|
+
output: Schema.Void,
|
|
19
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { HelpCapabilities } from '../types';
|
|
11
|
+
import { Start } from './definitions';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof Start> = Start.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
yield* Capabilities.updateAtomValue(HelpCapabilities.State, (state) => ({ ...state, running: true }));
|
|
17
|
+
}),
|
|
18
|
+
),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export default handler;
|
package/src/translations.ts
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'open
|
|
15
|
-
'open
|
|
16
|
-
'shortcuts
|
|
13
|
+
'plugin.name': 'Help',
|
|
14
|
+
'open-help-tour.message': 'Show welcome tour',
|
|
15
|
+
'open-shortcuts.label': 'Show shortcuts',
|
|
16
|
+
'shortcuts-dialog.title': 'Shortcuts',
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
},
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
|
|
10
|
+
import { meta } from '#meta';
|
|
11
|
+
|
|
12
|
+
export namespace HelpCapabilities {
|
|
13
|
+
export const StateSchema = Schema.mutable(
|
|
14
|
+
Schema.Struct({
|
|
15
|
+
running: Schema.Boolean,
|
|
16
|
+
showHints: Schema.Boolean,
|
|
17
|
+
showWelcome: Schema.Boolean,
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export type State = Schema.Schema.Type<typeof StateSchema>;
|
|
22
|
+
|
|
23
|
+
export const State = Capability.make<Atom.Writable<State>>(`${meta.id}.capability.state`);
|
|
24
|
+
}
|
package/src/types/index.ts
CHANGED
package/src/types/schema.ts
CHANGED
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema } from 'effect';
|
|
6
5
|
import { type Context, createContext } from 'react';
|
|
7
6
|
import { type Step as BaseStep } from 'react-joyride';
|
|
8
7
|
|
|
9
|
-
import { type
|
|
10
|
-
|
|
11
|
-
import { meta } from '../meta';
|
|
8
|
+
import { type CapabilityManager } from '@dxos/app-framework';
|
|
12
9
|
|
|
13
10
|
export type Step = BaseStep & {
|
|
14
|
-
before?: (
|
|
11
|
+
before?: (capabilities: CapabilityManager.CapabilityManager) => void;
|
|
15
12
|
};
|
|
16
13
|
|
|
17
14
|
export type HelpContextType = {
|
|
@@ -31,10 +28,3 @@ export const HelpContext: Context<HelpContextType> = createContext<HelpContextTy
|
|
|
31
28
|
start: () => {},
|
|
32
29
|
stop: () => {},
|
|
33
30
|
});
|
|
34
|
-
|
|
35
|
-
export namespace HelpAction {
|
|
36
|
-
export class Start extends Schema.TaggedClass<Start>()(`${meta.id}/action/start`, {
|
|
37
|
-
input: Schema.Void,
|
|
38
|
-
output: Schema.Void,
|
|
39
|
-
}) {}
|
|
40
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SHORTCUTS_DIALOG
|
|
3
|
-
} from "./chunk-GIDPSFGY.mjs";
|
|
4
|
-
import {
|
|
5
|
-
HelpAction
|
|
6
|
-
} from "./chunk-J2SJSGSX.mjs";
|
|
7
|
-
import {
|
|
8
|
-
HelpCapabilities
|
|
9
|
-
} from "./chunk-LDRUZNSN.mjs";
|
|
10
|
-
import {
|
|
11
|
-
HELP_PLUGIN
|
|
12
|
-
} from "./chunk-3Y4CMOZP.mjs";
|
|
13
|
-
|
|
14
|
-
// src/capabilities/app-graph-builder.ts
|
|
15
|
-
import { Rx } from "@effect-rx/rx-react";
|
|
16
|
-
import { Option, pipe } from "effect";
|
|
17
|
-
import { Capabilities, LayoutAction, contributes, createIntent } from "@dxos/app-framework";
|
|
18
|
-
import { createExtension } from "@dxos/app-graph";
|
|
19
|
-
var app_graph_builder_default = (context) => contributes(Capabilities.AppGraphBuilder, createExtension({
|
|
20
|
-
id: HELP_PLUGIN,
|
|
21
|
-
actions: (node) => Rx.make((get) => pipe(get(node), Option.flatMap((node2) => node2.id === "root" ? Option.some(node2) : Option.none()), Option.map(() => [
|
|
22
|
-
{
|
|
23
|
-
id: HelpAction.Start._tag,
|
|
24
|
-
data: async () => {
|
|
25
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
26
|
-
const state = context.getCapability(HelpCapabilities.MutableState);
|
|
27
|
-
state.showHints = true;
|
|
28
|
-
await dispatch(createIntent(HelpAction.Start));
|
|
29
|
-
},
|
|
30
|
-
properties: {
|
|
31
|
-
label: [
|
|
32
|
-
"open help tour",
|
|
33
|
-
{
|
|
34
|
-
ns: HELP_PLUGIN
|
|
35
|
-
}
|
|
36
|
-
],
|
|
37
|
-
icon: "ph--info--regular",
|
|
38
|
-
keyBinding: {
|
|
39
|
-
macos: "shift+meta+/",
|
|
40
|
-
// TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
|
|
41
|
-
windows: "shift+ctrl+/",
|
|
42
|
-
linux: "shift+ctrl+?"
|
|
43
|
-
},
|
|
44
|
-
testId: "helpPlugin.openHelp"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: "dxos.org/plugin/help/open-shortcuts",
|
|
49
|
-
data: async () => {
|
|
50
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
51
|
-
const state = context.getCapability(HelpCapabilities.MutableState);
|
|
52
|
-
state.showHints = true;
|
|
53
|
-
await dispatch(createIntent(LayoutAction.UpdateDialog, {
|
|
54
|
-
part: "dialog",
|
|
55
|
-
subject: SHORTCUTS_DIALOG,
|
|
56
|
-
options: {
|
|
57
|
-
blockAlign: "center"
|
|
58
|
-
}
|
|
59
|
-
}));
|
|
60
|
-
},
|
|
61
|
-
properties: {
|
|
62
|
-
label: [
|
|
63
|
-
"open shortcuts label",
|
|
64
|
-
{
|
|
65
|
-
ns: HELP_PLUGIN
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
icon: "ph--keyboard--regular",
|
|
69
|
-
keyBinding: {
|
|
70
|
-
macos: "meta+ctrl+/"
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
]), Option.getOrElse(() => [])))
|
|
75
|
-
}));
|
|
76
|
-
export {
|
|
77
|
-
app_graph_builder_default as default
|
|
78
|
-
};
|
|
79
|
-
//# sourceMappingURL=app-graph-builder-TUTK2ONB.mjs.map
|
|
@@ -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, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';\nimport { createExtension } from '@dxos/app-graph';\n\nimport { SHORTCUTS_DIALOG } from '../components';\nimport { HELP_PLUGIN } from '../meta';\nimport { HelpAction } from '../types';\n\nimport { HelpCapabilities } from './capabilities';\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,cAAkCC,aAAaC,oBAAoB;AAC1F,SAASC,uBAAuB;AAQhC,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", "LayoutAction", "contributes", "createIntent", "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
|
-
}
|