@dxos/plugin-help 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29
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/neutral/HelpPlugin.mjs +30 -0
- package/dist/lib/neutral/HelpPlugin.mjs.map +7 -0
- package/dist/lib/neutral/ShortcutsDialogContent-TB5PZWVY.mjs +17 -0
- package/dist/lib/neutral/ShortcutsDialogContent-TB5PZWVY.mjs.map +7 -0
- package/dist/lib/neutral/ShortcutsHints-P4SUBCY7.mjs +8 -0
- package/dist/lib/neutral/ShortcutsList-MZHWIVDH.mjs +8 -0
- package/dist/lib/neutral/app-graph-builder-BJYIYNMN.mjs +75 -0
- package/dist/lib/neutral/app-graph-builder-BJYIYNMN.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BI3HKFKB.mjs +63 -0
- package/dist/lib/neutral/chunk-BI3HKFKB.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GZL2J55W.mjs +8 -0
- package/dist/lib/neutral/chunk-GZL2J55W.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MQQNHGDV.mjs +8 -0
- package/dist/lib/neutral/chunk-MQQNHGDV.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NHTI7NEQ.mjs +19 -0
- package/dist/lib/neutral/chunk-NHTI7NEQ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NJCLRR5U.mjs +331 -0
- package/dist/lib/neutral/chunk-NJCLRR5U.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +20 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +13 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +24 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/{browser → neutral}/meta.mjs +2 -3
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-F2JU4V62.mjs +13 -0
- package/dist/lib/neutral/operation-handler-F2JU4V62.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-root-PYPAXETF.mjs +38 -0
- package/dist/lib/neutral/react-root-PYPAXETF.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-SNS4QQMR.mjs +33 -0
- package/dist/lib/neutral/react-surface-SNS4QQMR.mjs.map +7 -0
- package/dist/lib/neutral/start-XYUDZGXJ.mjs +21 -0
- package/dist/lib/neutral/start-XYUDZGXJ.mjs.map +7 -0
- package/dist/lib/neutral/state-5HQJG3KW.mjs +24 -0
- package/dist/lib/neutral/state-5HQJG3KW.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +20 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +12 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- 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 +0 -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/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 -4
- 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/index.d.ts +3 -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/plugin.d.ts +5 -0
- package/dist/types/src/plugin.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/HelpCapabilities.d.ts +19 -0
- package/dist/types/src/types/HelpCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/HelpOperation.d.ts +4 -0
- package/dist/types/src/types/HelpOperation.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -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 +95 -52
- package/src/HelpPlugin.test.ts +30 -0
- package/src/HelpPlugin.tsx +24 -49
- package/src/capabilities/app-graph-builder.ts +52 -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 +15 -7
- 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 +19 -14
- 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 +2 -4
- package/src/meta.ts +9 -6
- package/src/operations/index.ts +7 -0
- package/src/operations/start.ts +20 -0
- package/src/plugin.ts +12 -0
- package/src/translations.ts +5 -5
- package/src/types/HelpCapabilities.ts +24 -0
- package/src/types/HelpOperation.ts +21 -0
- package/src/types/index.ts +2 -0
- package/src/types/schema.ts +2 -12
- package/dist/lib/browser/app-graph-builder-F62C67SH.mjs +0 -79
- package/dist/lib/browser/app-graph-builder-F62C67SH.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-4CVVSQQC.mjs +0 -407
- package/dist/lib/browser/chunk-4CVVSQQC.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/index.mjs +0 -112
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-root-2LE42L5M.mjs +0 -34
- package/dist/lib/browser/react-root-2LE42L5M.mjs.map +0 -7
- package/dist/lib/browser/react-surface-XKJRPX3R.mjs +0 -36
- package/dist/lib/browser/react-surface-XKJRPX3R.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/lib/browser/types/index.mjs +0 -10
- 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
- /package/dist/lib/{browser/meta.mjs.map → neutral/ShortcutsHints-P4SUBCY7.mjs.map} +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/ShortcutsList-MZHWIVDH.mjs.map} +0 -0
|
@@ -5,14 +5,15 @@
|
|
|
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
|
-
<div
|
|
16
|
+
<div className='flex items-center gap-2 whitespace-nowrap'>
|
|
16
17
|
<Key binding={binding.shortcut} />
|
|
17
18
|
<span className='text-sm'>{toLocalizedString(binding.data, t)}</span>
|
|
18
19
|
</div>
|
|
@@ -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
|
|
30
|
+
<div className='flex overflow-hidden px-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,14 +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
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '#meta';
|
|
12
12
|
|
|
13
13
|
import { Key } from './Key';
|
|
14
14
|
|
|
15
15
|
export const ShortcutsList = () => {
|
|
16
|
-
const { t } = useTranslation(
|
|
16
|
+
const { t } = useTranslation(meta.id);
|
|
17
17
|
const bindings = Keyboard.singleton.getBindings();
|
|
18
18
|
|
|
19
19
|
// TODO(burdon): Get shortcuts from TextEditor.
|
|
@@ -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>
|
|
@@ -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
|
],
|
|
@@ -105,10 +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
|
-
decorators: [
|
|
111
|
+
decorators: [
|
|
112
|
+
withTheme(),
|
|
113
|
+
withPluginManager({
|
|
114
|
+
plugins: [StorybookPlugin({})],
|
|
115
|
+
}),
|
|
116
|
+
],
|
|
112
117
|
} satisfies Meta<typeof WelcomeTour>;
|
|
113
118
|
|
|
114
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,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
export * from './components';
|
|
5
|
+
export * from './constants';
|
|
7
6
|
export * from './meta';
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './hooks';
|
|
7
|
+
export * from './operations';
|
|
10
8
|
export * from './types';
|
package/src/meta.ts
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
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',
|
|
16
|
+
tags: ['system'],
|
|
14
17
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
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, HelpOperation } from '../types';
|
|
11
|
+
|
|
12
|
+
const handler: Operation.WithHandler<typeof HelpOperation.Start> = HelpOperation.Start.pipe(
|
|
13
|
+
Operation.withHandler(
|
|
14
|
+
Effect.fnUntraced(function* () {
|
|
15
|
+
yield* Capabilities.updateAtomValue(HelpCapabilities.State, (state) => ({ ...state, running: true }));
|
|
16
|
+
}),
|
|
17
|
+
),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export default handler;
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const HelpPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
export type { HelpPluginOptions } from '#plugin';
|
|
11
|
+
|
|
12
|
+
export { HelpOperationHandlerSet } from './operations';
|
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-as-namespace
|
|
6
|
+
|
|
7
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
8
|
+
import * as Schema from 'effect/Schema';
|
|
9
|
+
|
|
10
|
+
import { Capability } from '@dxos/app-framework';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
export const StateSchema = Schema.mutable(
|
|
15
|
+
Schema.Struct({
|
|
16
|
+
running: Schema.Boolean,
|
|
17
|
+
showHints: Schema.Boolean,
|
|
18
|
+
showWelcome: Schema.Boolean,
|
|
19
|
+
}),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export type State = Schema.Schema.Type<typeof StateSchema>;
|
|
23
|
+
|
|
24
|
+
export const State = Capability.make<Atom.Writable<State>>(`${meta.id}.capability.state`);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import { Capability } from '@dxos/app-framework';
|
|
10
|
+
import { Operation } from '@dxos/compute';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
const HELP_OPERATION = `${meta.id}.operation`;
|
|
15
|
+
|
|
16
|
+
export const Start = Operation.make({
|
|
17
|
+
meta: { key: `${HELP_OPERATION}.start`, name: 'Start Help' },
|
|
18
|
+
services: [Capability.Service],
|
|
19
|
+
input: Schema.Void,
|
|
20
|
+
output: Schema.Void,
|
|
21
|
+
});
|
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
|
-
}
|