@dxos/plugin-help 0.8.4-main.84f28bd → 0.8.4-main.9735255
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/app-graph-builder-DX3VXARQ.mjs +79 -0
- package/dist/lib/browser/app-graph-builder-DX3VXARQ.mjs.map +7 -0
- package/dist/lib/browser/chunk-IM2QVQOH.mjs +16 -0
- package/dist/lib/browser/chunk-IM2QVQOH.mjs.map +7 -0
- package/dist/lib/browser/chunk-TS66J4C6.mjs +58 -0
- package/dist/lib/browser/chunk-TS66J4C6.mjs.map +7 -0
- package/dist/lib/browser/chunk-W5XAZM46.mjs +360 -0
- package/dist/lib/browser/chunk-W5XAZM46.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +58 -59
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -3
- package/dist/lib/browser/react-root-SZRF6EXG.mjs +43 -0
- package/dist/lib/browser/react-root-SZRF6EXG.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-DIIOUUMT.mjs → react-surface-DWNTJBVM.mjs} +15 -14
- package/dist/lib/browser/react-surface-DWNTJBVM.mjs.map +7 -0
- package/dist/lib/browser/state-VRPLKT3F.mjs +27 -0
- package/dist/lib/browser/state-VRPLKT3F.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +12 -0
- package/dist/types/src/HelpPlugin.d.ts +2 -1
- package/dist/types/src/HelpPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-builder/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +5 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +2 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/index.d.ts +6 -0
- package/dist/types/src/capabilities/react-root/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts +10 -0
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +11 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +13 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsHints.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsList.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts.map +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts +9 -4
- package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +21 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/types/schema.d.ts +32 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +45 -39
- package/src/HelpPlugin.tsx +19 -47
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +61 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +5 -8
- package/src/capabilities/operation-resolver/index.ts +5 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +23 -0
- package/src/capabilities/react-root/index.ts +7 -0
- package/src/capabilities/react-root/react-root.tsx +36 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +34 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +27 -0
- package/src/components/Shortcuts/ShortcutsDialog.tsx +7 -9
- package/src/components/Shortcuts/ShortcutsHints.tsx +14 -6
- package/src/components/Shortcuts/ShortcutsList.tsx +4 -3
- package/src/components/Shortcuts/ShortcutsSection.tsx +1 -1
- package/src/components/Shortcuts/styles.ts +1 -1
- package/src/components/Tooltip/Tooltip.tsx +28 -27
- package/src/components/WelcomeTour/WelcomeTour.stories.tsx +23 -18
- package/src/components/WelcomeTour/WelcomeTour.tsx +16 -19
- package/src/index.ts +1 -1
- package/src/meta.ts +8 -6
- package/src/types/capabilities.ts +24 -0
- package/src/types/index.ts +6 -0
- package/src/{types.ts → types/schema.ts} +13 -10
- 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.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/meta.mjs.map +0 -7
- 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/app-graph-builder.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -10
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-root.d.ts +0 -8
- package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -4
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -29
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -76
- package/src/capabilities/capabilities.ts +0 -13
- package/src/capabilities/react-root.tsx +0 -32
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/state.ts +0 -23
- /package/dist/lib/browser/{types.mjs.map → types/index.mjs.map} +0 -0
|
@@ -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
|
|
@@ -49,36 +47,38 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipRenderProps>(
|
|
|
49
47
|
>
|
|
50
48
|
<div className='flex p-2'>
|
|
51
49
|
<h2 className='grow pli-2 plb-1 text-lg font-medium text-accentSurfaceText'>{title}</h2>
|
|
52
|
-
<
|
|
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
61
|
<div className='flex grow pli-4 mlb-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='mli-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,19 +2,19 @@
|
|
|
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
|
|
|
8
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
9
|
+
import { StorybookPlugin } from '@dxos/plugin-testing';
|
|
11
10
|
import { faker } from '@dxos/random';
|
|
12
|
-
import { Button } from '@dxos/react-ui';
|
|
13
|
-
import { withTheme } from '@dxos/
|
|
11
|
+
import { Button, Icon } from '@dxos/react-ui';
|
|
12
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
13
|
|
|
15
|
-
import { WelcomeTour, type WelcomeTourProps } from './WelcomeTour';
|
|
16
14
|
import { useHelp } from '../../hooks';
|
|
17
15
|
|
|
16
|
+
import { WelcomeTour, type WelcomeTourProps } from './WelcomeTour';
|
|
17
|
+
|
|
18
18
|
const App = () => {
|
|
19
19
|
const { running, start } = useHelp();
|
|
20
20
|
const [items, setItems] = useState(() => Array.from({ length: 5 }).map(() => faker.lorem.sentence()));
|
|
@@ -23,8 +23,8 @@ const App = () => {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<div className='flex flex-col
|
|
27
|
-
<div className='flex items-center gap-2
|
|
26
|
+
<div className='flex flex-col bs-full p-4 space-y-8'>
|
|
27
|
+
<div className='flex items-center gap-2 plb-2'>
|
|
28
28
|
<Button data-joyride='basic/1' onClick={() => start()}>
|
|
29
29
|
Start
|
|
30
30
|
</Button>
|
|
@@ -32,26 +32,26 @@ 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
|
))}
|
|
42
42
|
</ul>
|
|
43
43
|
</div>
|
|
44
|
-
<div className='flex items-center gap-2
|
|
44
|
+
<div className='flex items-center gap-2 plb-2'>
|
|
45
45
|
<Button data-joyride='basic/3' onClick={handleAdd}>
|
|
46
46
|
Add
|
|
47
47
|
</Button>
|
|
48
48
|
</div>
|
|
49
49
|
<div className='flex grow' />
|
|
50
|
-
<div className='flex items-center
|
|
50
|
+
<div className='flex items-center plb-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
|
);
|
|
@@ -104,11 +104,16 @@ export const Default: StoryObj<typeof WelcomeTour> = {
|
|
|
104
104
|
/**
|
|
105
105
|
* IMPORTANT: Run in separate tab.
|
|
106
106
|
*/
|
|
107
|
-
const meta
|
|
107
|
+
const meta = {
|
|
108
108
|
title: 'plugins/plugin-help/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,14 @@
|
|
|
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 {
|
|
8
|
+
import { useLayout, usePluginManager } from '@dxos/app-framework/react';
|
|
9
|
+
import { useAsyncEffect } from '@dxos/react-ui';
|
|
9
10
|
|
|
10
|
-
import { type Step
|
|
11
|
-
import {
|
|
11
|
+
import { HelpContext, type Step } from '../../types';
|
|
12
|
+
import { Tooltip, floaterProps } from '../Tooltip';
|
|
12
13
|
|
|
13
14
|
const addStepClass = (target: string | HTMLElement) => {
|
|
14
15
|
const element = typeof target === 'string' ? document.querySelector(target) : target;
|
|
@@ -75,7 +76,7 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
|
|
|
75
76
|
const setStepIndex = (index: number) => {
|
|
76
77
|
if (runningProp) {
|
|
77
78
|
const step = steps[index];
|
|
78
|
-
step?.before?.(manager.
|
|
79
|
+
step?.before?.(manager.capabilities);
|
|
79
80
|
}
|
|
80
81
|
_setStepIndex(index);
|
|
81
82
|
};
|
|
@@ -93,20 +94,16 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
|
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
96
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
return () => clearTimeout(timeout);
|
|
97
|
+
useAsyncEffect(async () => {
|
|
98
|
+
if (runningProp) {
|
|
99
|
+
// This handles the case when the target is not yet in the document.
|
|
100
|
+
// If the target is not in the document, when the joyride is turned on, it will not show the tooltip.
|
|
101
|
+
await waitForTarget(steps[stepIndex]);
|
|
102
|
+
setStepIndex(0);
|
|
103
|
+
setRunning(true);
|
|
104
|
+
} else if (typeof runningProp !== 'undefined') {
|
|
105
|
+
setRunning(false);
|
|
106
|
+
}
|
|
110
107
|
}, [runningProp]);
|
|
111
108
|
|
|
112
109
|
// https://docs.react-joyride.com/callback
|
package/src/index.ts
CHANGED
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: 'dxos.org/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,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,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { type Context, createContext } from 'react';
|
|
7
7
|
import { type Step as BaseStep } from 'react-joyride';
|
|
8
8
|
|
|
9
|
-
import { type
|
|
9
|
+
import { Capability, type CapabilityManager } from '@dxos/app-framework';
|
|
10
|
+
import { Operation } from '@dxos/operation';
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { meta } from '../meta';
|
|
12
13
|
|
|
13
14
|
export type Step = BaseStep & {
|
|
14
|
-
before?: (
|
|
15
|
+
before?: (capabilities: CapabilityManager.CapabilityManager) => void;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export type HelpContextType = {
|
|
@@ -32,10 +33,12 @@ export const HelpContext: Context<HelpContextType> = createContext<HelpContextTy
|
|
|
32
33
|
stop: () => {},
|
|
33
34
|
});
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
const HELP_OPERATION = `${meta.id}/operation`;
|
|
37
|
+
|
|
38
|
+
export namespace HelpOperation {
|
|
39
|
+
export const Start = Operation.make({
|
|
40
|
+
meta: { key: `${HELP_OPERATION}/start`, name: 'Start Help' },
|
|
41
|
+
services: [Capability.Service],
|
|
42
|
+
schema: { input: Schema.Void, output: Schema.Void },
|
|
43
|
+
});
|
|
41
44
|
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SHORTCUTS_DIALOG
|
|
3
|
-
} from "./chunk-27RZVOIE.mjs";
|
|
4
|
-
import {
|
|
5
|
-
HelpAction
|
|
6
|
-
} from "./chunk-WAN2NFYE.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, contributes, createIntent, LayoutAction } 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-IXCF4ZDE.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, contributes, createIntent, LayoutAction, type PluginContext } from '@dxos/app-framework';\nimport { createExtension } from '@dxos/app-graph';\n\nimport { HelpCapabilities } from './capabilities';\nimport { SHORTCUTS_DIALOG } from '../components';\nimport { HELP_PLUGIN } from '../meta';\nimport { HelpAction } from '../types';\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,aAAaC,cAAcC,oBAAwC;AAC1F,SAASC,uBAAuB;AAOhC,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", "contributes", "createIntent", "LayoutAction", "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
|
-
}
|