@dxos/plugin-help 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5
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-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-K4LQ2TR7.mjs +34 -0
- package/dist/lib/browser/chunk-K4LQ2TR7.mjs.map +7 -0
- package/dist/lib/browser/chunk-KUUIRJG5.mjs +31 -0
- package/dist/lib/browser/chunk-KUUIRJG5.mjs.map +7 -0
- package/dist/lib/browser/chunk-TEXIV2IJ.mjs +16 -0
- package/dist/lib/browser/chunk-TEXIV2IJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +358 -75
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +2 -3
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/start-YZBO346C.mjs +23 -0
- package/dist/lib/browser/start-YZBO346C.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -0
- 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/ShortcutsHints.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsList.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.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 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/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 -5
- 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 +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +16 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +63 -39
- package/src/HelpPlugin.tsx +22 -48
- package/src/capabilities/app-graph-builder.ts +54 -67
- package/src/capabilities/index.ts +10 -7
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-root.tsx +28 -24
- package/src/capabilities/react-surface.tsx +28 -22
- package/src/capabilities/state.ts +19 -15
- package/src/components/Shortcuts/ShortcutsHints.tsx +13 -5
- package/src/components/Shortcuts/ShortcutsList.tsx +6 -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 +31 -30
- package/src/components/WelcomeTour/WelcomeTour.stories.tsx +27 -22
- package/src/components/WelcomeTour/WelcomeTour.tsx +18 -19
- package/src/constants.ts +7 -0
- package/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.tsx +38 -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 -1
- 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 +6 -0
- package/src/{types.ts → types/schema.ts} +2 -13
- package/dist/lib/browser/app-graph-builder-IXCF4ZDE.mjs +0 -79
- package/dist/lib/browser/app-graph-builder-IXCF4ZDE.mjs.map +0 -7
- package/dist/lib/browser/chunk-27RZVOIE.mjs +0 -408
- package/dist/lib/browser/chunk-27RZVOIE.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-LDRUZNSN.mjs +0 -16
- package/dist/lib/browser/chunk-LDRUZNSN.mjs.map +0 -7
- package/dist/lib/browser/chunk-WAN2NFYE.mjs +0 -36
- package/dist/lib/browser/chunk-WAN2NFYE.mjs.map +0 -7
- package/dist/lib/browser/react-root-A32LXEU4.mjs +0 -34
- package/dist/lib/browser/react-root-A32LXEU4.mjs.map +0 -7
- package/dist/lib/browser/react-surface-DIIOUUMT.mjs +0 -36
- package/dist/lib/browser/react-surface-DIIOUUMT.mjs.map +0 -7
- package/dist/lib/browser/state-FWUZG6NL.mjs +0 -29
- package/dist/lib/browser/state-FWUZG6NL.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -12
- package/dist/lib/node-esm/app-graph-builder-5QQRWRWG.mjs +0 -80
- package/dist/lib/node-esm/app-graph-builder-5QQRWRWG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6JMO5FFN.mjs +0 -37
- package/dist/lib/node-esm/chunk-6JMO5FFN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CXQ5LKQI.mjs +0 -17
- package/dist/lib/node-esm/chunk-CXQ5LKQI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PU7X4MJO.mjs +0 -409
- package/dist/lib/node-esm/chunk-PU7X4MJO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-T523OGIV.mjs +0 -15
- package/dist/lib/node-esm/chunk-T523OGIV.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -115
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/react-root-Q6PGYYYP.mjs +0 -35
- package/dist/lib/node-esm/react-root-Q6PGYYYP.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QEIKNNW3.mjs +0 -37
- package/dist/lib/node-esm/react-surface-QEIKNNW3.mjs.map +0 -7
- package/dist/lib/node-esm/state-Y476FGII.mjs +0 -30
- package/dist/lib/node-esm/state-Y476FGII.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -13
- package/dist/lib/node-esm/types.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/dist/types/src/types.d.ts +0 -29
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -13
- package/src/components/Shortcuts/ShortcutsDialog.tsx +0 -34
- /package/dist/lib/browser/{types.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/meta.mjs.map → browser/types/index.mjs.map} +0 -0
|
@@ -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
|
);
|
|
@@ -3,18 +3,16 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { useArrowNavigationGroup, useFocusableGroup } from '@fluentui/react-tabster';
|
|
6
|
-
import { CaretLeft, CaretRight, Circle, X } from '@phosphor-icons/react';
|
|
7
6
|
import React, { forwardRef } from 'react';
|
|
8
7
|
// TODO(thure): This needed to be imported in the package.json specifically to pacify TS2742. See if this is resolved with typescript@5.5.x.
|
|
9
8
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
10
9
|
import _floater from 'react-floater';
|
|
11
|
-
import { type
|
|
10
|
+
import { type Props, type TooltipRenderProps } from 'react-joyride';
|
|
12
11
|
// TODO(thure): This needed to be imported in the package.json specifically to pacify TS2742. See if this is resolved with typescript@5.5.x.
|
|
13
12
|
// eslint-disable-next-line unused-imports/no-unused-imports
|
|
14
13
|
import _typefest from 'type-fest';
|
|
15
14
|
|
|
16
|
-
import { Button } from '@dxos/react-ui';
|
|
17
|
-
import { getSize, mx } from '@dxos/react-ui-theme';
|
|
15
|
+
import { Button, Icon, IconButton } from '@dxos/react-ui';
|
|
18
16
|
|
|
19
17
|
// https://docs.react-joyride.com/styling
|
|
20
18
|
// https://github.com/gilbarbara/react-floater
|
|
@@ -40,7 +38,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
40
38
|
|
|
41
39
|
return (
|
|
42
40
|
<div
|
|
43
|
-
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'
|
|
44
42
|
role='tooltip'
|
|
45
43
|
data-testid='helpPlugin.tooltip'
|
|
46
44
|
data-step={index + 1}
|
|
@@ -48,37 +46,39 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
48
46
|
ref={forwardedRef}
|
|
49
47
|
>
|
|
50
48
|
<div className='flex p-2'>
|
|
51
|
-
<h2 className='grow
|
|
52
|
-
<
|
|
49
|
+
<h2 className='grow px-2 py-1 text-lg font-medium text-accent-surface-text'>{title}</h2>
|
|
50
|
+
<IconButton
|
|
53
51
|
density='fine'
|
|
54
|
-
|
|
52
|
+
icon='ph--x--bold'
|
|
53
|
+
iconOnly
|
|
54
|
+
label={closeProps['aria-label']}
|
|
55
55
|
onClick={closeProps.onClick}
|
|
56
|
-
|
|
56
|
+
size={4}
|
|
57
|
+
variant='primary'
|
|
57
58
|
data-testid='helpPlugin.tooltip.close'
|
|
58
|
-
|
|
59
|
-
<X weight='bold' className={getSize(4)} />
|
|
60
|
-
</Button>
|
|
59
|
+
/>
|
|
61
60
|
</div>
|
|
62
|
-
<div className='flex grow
|
|
61
|
+
<div className='flex grow px-4 my-2'>{content}</div>
|
|
63
62
|
<div className='flex p-2 items-center justify-between' {...arrowNavigationAttrs}>
|
|
64
63
|
{
|
|
65
|
-
<
|
|
66
|
-
variant='primary'
|
|
67
|
-
onClick={backProps.onClick}
|
|
68
|
-
title={backProps['aria-label']}
|
|
64
|
+
<IconButton
|
|
69
65
|
classNames={[!(index > 0 && backProps) && 'invisible']}
|
|
66
|
+
icon='ph--caret-left--regular'
|
|
67
|
+
iconOnly
|
|
68
|
+
label={backProps['aria-label']}
|
|
69
|
+
onClick={backProps.onClick}
|
|
70
|
+
variant='primary'
|
|
70
71
|
data-testid='helpPlugin.tooltip.back'
|
|
71
|
-
|
|
72
|
-
<CaretLeft className={getSize(5)} />
|
|
73
|
-
</Button>
|
|
72
|
+
/>
|
|
74
73
|
}
|
|
75
74
|
<div className='flex grow gap-2 justify-center'>
|
|
76
75
|
<div className='flex'>
|
|
77
76
|
{Array.from({ length: size }).map((_, i) => (
|
|
78
|
-
<
|
|
77
|
+
<Icon
|
|
79
78
|
key={i}
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
icon={index === i ? 'ph--circle--fill' : 'ph--circle--regular'}
|
|
80
|
+
size={2}
|
|
81
|
+
classNames='mx-1 cursor-pointer'
|
|
82
82
|
/>
|
|
83
83
|
))}
|
|
84
84
|
</div>
|
|
@@ -94,15 +94,16 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
94
94
|
Done
|
|
95
95
|
</Button>
|
|
96
96
|
) : (
|
|
97
|
-
<
|
|
98
|
-
variant='primary'
|
|
99
|
-
onClick={primaryProps.onClick}
|
|
100
|
-
title={primaryProps['aria-label']}
|
|
97
|
+
<IconButton
|
|
101
98
|
autoFocus
|
|
99
|
+
icon='ph--caret-right--regular'
|
|
100
|
+
iconOnly
|
|
101
|
+
label={primaryProps['aria-label']}
|
|
102
|
+
onClick={primaryProps.onClick}
|
|
103
|
+
size={6}
|
|
104
|
+
variant='primary'
|
|
102
105
|
data-testid='helpPlugin.tooltip.next'
|
|
103
|
-
|
|
104
|
-
<CaretRight className={getSize(6)} />
|
|
105
|
-
</Button>
|
|
106
|
+
/>
|
|
106
107
|
)}
|
|
107
108
|
</div>
|
|
108
109
|
</div>
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { Circle } from '@phosphor-icons/react';
|
|
8
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
9
6
|
import React, { useState } from 'react';
|
|
10
7
|
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
8
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
+
import { StorybookPlugin } from '@dxos/plugin-testing';
|
|
10
|
+
import { random } from '@dxos/random';
|
|
11
|
+
import { Button, Icon } from '@dxos/react-ui';
|
|
12
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
|
+
|
|
14
|
+
import { useHelp } from '#hooks';
|
|
14
15
|
|
|
15
16
|
import { WelcomeTour, type WelcomeTourProps } from './WelcomeTour';
|
|
16
|
-
import { useHelp } from '../../hooks';
|
|
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,10 +32,10 @@ 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' />
|
|
39
39
|
<span>{item}</span>
|
|
40
40
|
</li>
|
|
41
41
|
))}
|
|
@@ -49,9 +49,9 @@ const App = () => {
|
|
|
49
49
|
<div className='flex grow' />
|
|
50
50
|
<div className='flex items-center py-2'>
|
|
51
51
|
<div className='grow' />
|
|
52
|
-
<
|
|
53
|
-
<
|
|
54
|
-
<
|
|
52
|
+
<Icon icon='ph--circle--regular' data-joyride='basic/4' />
|
|
53
|
+
<Icon icon='ph--circle--regular' />
|
|
54
|
+
<Icon icon='ph--circle--regular' />
|
|
55
55
|
</div>
|
|
56
56
|
</div>
|
|
57
57
|
);
|
|
@@ -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,13 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { useState
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
6
|
import Joyride, { ACTIONS, EVENTS } from 'react-joyride';
|
|
7
7
|
|
|
8
|
-
import { usePluginManager
|
|
8
|
+
import { usePluginManager } from '@dxos/app-framework/ui';
|
|
9
|
+
import { useLayout } from '@dxos/app-toolkit/ui';
|
|
10
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
9
11
|
|
|
10
|
-
import { type Step
|
|
11
|
-
|
|
12
|
+
import { HelpContext, type Step } from '#types';
|
|
13
|
+
|
|
14
|
+
import { Tooltip, floaterProps } from '../Tooltip';
|
|
12
15
|
|
|
13
16
|
const addStepClass = (target: string | HTMLElement) => {
|
|
14
17
|
const element = typeof target === 'string' ? document.querySelector(target) : target;
|
|
@@ -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
|
package/src/constants.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
import { ShortcutsDialogContent } from './ShortcutsDialogContent';
|
|
14
|
+
|
|
15
|
+
const DefaultStory = () => (
|
|
16
|
+
<Dialog.Root defaultOpen>
|
|
17
|
+
<Dialog.Overlay>
|
|
18
|
+
<ShortcutsDialogContent />
|
|
19
|
+
</Dialog.Overlay>
|
|
20
|
+
</Dialog.Root>
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const meta = {
|
|
24
|
+
title: 'plugins/plugin-help/containers/ShortcutsDialogContent',
|
|
25
|
+
component: ShortcutsDialogContent,
|
|
26
|
+
render: DefaultStory,
|
|
27
|
+
decorators: [withTheme(), withPluginManager()],
|
|
28
|
+
parameters: {
|
|
29
|
+
layout: 'fullscreen',
|
|
30
|
+
translations,
|
|
31
|
+
},
|
|
32
|
+
} satisfies Meta<typeof ShortcutsDialogContent>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
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,8 +2,9 @@
|
|
|
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 './constants';
|
|
7
8
|
export * from './meta';
|
|
8
9
|
export * from './HelpPlugin';
|
|
9
10
|
export * from './hooks';
|
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/operation';
|
|
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/operation';
|
|
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
|
+
}
|
|
@@ -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 { HELP_PLUGIN } 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,11 +28,3 @@ export const HelpContext: Context<HelpContextType> = createContext<HelpContextTy
|
|
|
31
28
|
start: () => {},
|
|
32
29
|
stop: () => {},
|
|
33
30
|
});
|
|
34
|
-
|
|
35
|
-
export const HELP_ACTION = `${HELP_PLUGIN}/action`;
|
|
36
|
-
export namespace HelpAction {
|
|
37
|
-
export class Start extends Schema.TaggedClass<Start>()(`${HELP_ACTION}/start`, {
|
|
38
|
-
input: Schema.Void,
|
|
39
|
-
output: Schema.Void,
|
|
40
|
-
}) {}
|
|
41
|
-
}
|