@dxos/plugin-help 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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-EEXGETLQ.mjs +16 -0
- package/dist/lib/browser/chunk-EEXGETLQ.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 +13 -97
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +2 -1
- 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 +4 -2
- package/dist/types/src/HelpPlugin.d.ts.map +1 -1
- package/dist/types/src/HelpPlugin.test.d.ts +2 -0
- package/dist/types/src/HelpPlugin.test.d.ts.map +1 -0
- 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.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/{components/Shortcuts/ShortcutsDialog.d.ts → containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts} +1 -2
- 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 +5 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- 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 +62 -45
- package/src/HelpPlugin.test.ts +30 -0
- package/src/HelpPlugin.tsx +21 -44
- 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 +4 -4
- 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 +17 -13
- package/src/components/WelcomeTour/WelcomeTour.tsx +6 -3
- 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 +9 -4
- package/src/meta.ts +8 -3
- 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-AR2S4WLE.mjs +0 -79
- package/dist/lib/browser/app-graph-builder-AR2S4WLE.mjs.map +0 -7
- package/dist/lib/browser/chunk-3WYHGOGD.mjs +0 -16
- package/dist/lib/browser/chunk-3WYHGOGD.mjs.map +0 -7
- package/dist/lib/browser/chunk-4KB36WUN.mjs +0 -34
- package/dist/lib/browser/chunk-4KB36WUN.mjs.map +0 -7
- package/dist/lib/browser/chunk-HUJHLAHD.mjs +0 -11
- package/dist/lib/browser/chunk-HUJHLAHD.mjs.map +0 -7
- package/dist/lib/browser/chunk-RZFM47PY.mjs +0 -407
- package/dist/lib/browser/chunk-RZFM47PY.mjs.map +0 -7
- package/dist/lib/browser/react-root-WTD4XPY6.mjs +0 -34
- package/dist/lib/browser/react-root-WTD4XPY6.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ZFAK7QKZ.mjs +0 -36
- package/dist/lib/browser/react-surface-ZFAK7QKZ.mjs.map +0 -7
- package/dist/lib/browser/state-Y7EYMGFM.mjs +0 -29
- package/dist/lib/browser/state-Y7EYMGFM.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.map +0 -1
- package/src/capabilities/capabilities.ts +0 -13
- package/src/components/Shortcuts/ShortcutsDialog.tsx +0 -35
|
@@ -6,9 +6,9 @@ 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
10
|
|
|
11
|
-
import { meta } from '
|
|
11
|
+
import { meta } from '#meta';
|
|
12
12
|
|
|
13
13
|
import { Key } from './Key';
|
|
14
14
|
|
|
@@ -22,11 +22,11 @@ export const ShortcutsList = () => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<dl className={mx('
|
|
25
|
+
<dl className={mx('w-fit grid grid-cols-[min-content_minmax(12rem,1fr)] gap-2 my-4 text-subdued select-none')}>
|
|
26
26
|
{bindings.map((binding, i) => (
|
|
27
27
|
<Fragment key={i}>
|
|
28
28
|
<Key binding={binding.shortcut} />
|
|
29
|
-
<span role='definition' className='
|
|
29
|
+
<span role='definition' className='ms-4' aria-labelledby={binding.shortcut}>
|
|
30
30
|
{toLocalizedString(binding.data, t)}
|
|
31
31
|
</span>
|
|
32
32
|
</Fragment>
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import { descriptionText } from '@dxos/react-ui-theme';
|
|
8
|
-
|
|
9
7
|
import { ShortcutsList } from './ShortcutsList';
|
|
10
8
|
|
|
11
9
|
export const ShortcutsSection = () => {
|
|
12
10
|
return (
|
|
13
|
-
<section className=
|
|
11
|
+
<section className='text-description'>
|
|
14
12
|
<ShortcutsList />
|
|
15
13
|
</section>
|
|
16
14
|
);
|
|
@@ -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>
|
|
@@ -6,20 +6,20 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import React, { useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { StorybookPlugin } from '@dxos/plugin-testing';
|
|
10
|
+
import { random } from '@dxos/random';
|
|
11
11
|
import { Button, Icon } from '@dxos/react-ui';
|
|
12
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
|
],
|
|
@@ -105,11 +105,15 @@ export const Default: StoryObj<typeof WelcomeTour> = {
|
|
|
105
105
|
* IMPORTANT: Run in separate tab.
|
|
106
106
|
*/
|
|
107
107
|
const meta = {
|
|
108
|
-
title: 'plugins/plugin-help/WelcomeTour',
|
|
108
|
+
title: 'plugins/plugin-help/components/WelcomeTour',
|
|
109
109
|
component: WelcomeTour,
|
|
110
110
|
render: DefaultStory,
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
decorators: [
|
|
112
|
+
withTheme(),
|
|
113
|
+
withPluginManager({
|
|
114
|
+
plugins: [StorybookPlugin({})],
|
|
115
|
+
}),
|
|
116
|
+
],
|
|
113
117
|
} satisfies Meta<typeof WelcomeTour>;
|
|
114
118
|
|
|
115
119
|
export default meta;
|
|
@@ -5,10 +5,12 @@
|
|
|
5
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';
|
|
9
10
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
10
11
|
|
|
11
|
-
import { HelpContext, type Step } from '
|
|
12
|
+
import { HelpContext, type Step } from '#types';
|
|
13
|
+
|
|
12
14
|
import { Tooltip, floaterProps } from '../Tooltip';
|
|
13
15
|
|
|
14
16
|
const addStepClass = (target: string | HTMLElement) => {
|
|
@@ -76,7 +78,7 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
|
|
|
76
78
|
const setStepIndex = (index: number) => {
|
|
77
79
|
if (runningProp) {
|
|
78
80
|
const step = steps[index];
|
|
79
|
-
step?.before?.(manager.
|
|
81
|
+
step?.before?.(manager.capabilities);
|
|
80
82
|
}
|
|
81
83
|
_setStepIndex(index);
|
|
82
84
|
};
|
|
@@ -161,6 +163,7 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
|
|
|
161
163
|
callback={callback}
|
|
162
164
|
floaterProps={floaterProps}
|
|
163
165
|
tooltipComponent={Tooltip}
|
|
166
|
+
spotlightPadding={0}
|
|
164
167
|
/>
|
|
165
168
|
</HelpContext.Provider>
|
|
166
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,14 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export { HelpCapabilities } from './types';
|
|
10
|
+
export * from './constants';
|
|
7
11
|
export * from './meta';
|
|
8
|
-
export * from './HelpPlugin';
|
|
9
|
-
export * from './hooks';
|
|
10
12
|
export * from './types';
|
|
13
|
+
|
|
14
|
+
export const HelpPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
15
|
+
export type { HelpPluginOptions } from '#plugin';
|
package/src/meta.ts
CHANGED
|
@@ -2,10 +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
|
-
export const meta:
|
|
8
|
-
id: 'dxos.
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.help',
|
|
9
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
|
+
`,
|
|
10
15
|
icon: 'ph--info--regular',
|
|
11
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-RZFM47PY.mjs";
|
|
4
|
-
import {
|
|
5
|
-
HelpAction
|
|
6
|
-
} from "./chunk-4KB36WUN.mjs";
|
|
7
|
-
import {
|
|
8
|
-
HelpCapabilities
|
|
9
|
-
} from "./chunk-3WYHGOGD.mjs";
|
|
10
|
-
import {
|
|
11
|
-
meta
|
|
12
|
-
} from "./chunk-HUJHLAHD.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: meta.id,
|
|
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: meta.id
|
|
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: `${meta.id}/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: meta.id
|
|
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-AR2S4WLE.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 { meta } 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: meta.id,\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: meta.id }],\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: `${meta.id}/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: meta.id }],\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,6BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC,KAAKD;EACTE,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,KAAKD;UAAG;;QACxC6B,MAAM;QACNC,YAAY;UACVC,OAAO;;UAEPC,SAAS;UACTC,OAAO;QACT;QACAC,QAAQ;MACV;IACF;IACA;MACElC,IAAI,GAAGC,KAAKD,EAAE;MACdgB,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,KAAKD;UAAG;;QAC9C6B,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", "meta", "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,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-HUJHLAHD.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/capabilities.ts
|
|
6
|
-
import { defineCapability } from "@dxos/app-framework";
|
|
7
|
-
(function(HelpCapabilities2) {
|
|
8
|
-
HelpCapabilities2.State = defineCapability(`${meta.id}/capability/state`);
|
|
9
|
-
HelpCapabilities2.MutableState = defineCapability(`${meta.id}/capability/state`);
|
|
10
|
-
})(HelpCapabilities || (HelpCapabilities = {}));
|
|
11
|
-
var HelpCapabilities;
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
HelpCapabilities
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-3WYHGOGD.mjs.map
|