@dxos/plugin-help 0.8.4-main.f5c0578 → 0.8.4-main.fcc0d83b33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/lib/browser/chunk-53QC3FTJ.mjs +34 -0
  2. package/dist/lib/browser/chunk-53QC3FTJ.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  4. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-RWK34XL5.mjs +31 -0
  6. package/dist/lib/browser/chunk-RWK34XL5.mjs.map +7 -0
  7. package/dist/lib/browser/index.mjs +347 -83
  8. package/dist/lib/browser/index.mjs.map +4 -4
  9. package/dist/lib/browser/meta.json +1 -1
  10. package/dist/lib/browser/meta.mjs +13 -5
  11. package/dist/lib/browser/meta.mjs.map +4 -4
  12. package/dist/lib/browser/operations/index.mjs +13 -0
  13. package/dist/lib/browser/operations/index.mjs.map +7 -0
  14. package/dist/lib/browser/start-JQ2LLVCT.mjs +23 -0
  15. package/dist/lib/browser/start-JQ2LLVCT.mjs.map +7 -0
  16. package/dist/lib/browser/translations.mjs +20 -0
  17. package/dist/lib/browser/translations.mjs.map +7 -0
  18. package/dist/lib/browser/types/index.mjs +4 -4
  19. package/dist/types/src/HelpPlugin.d.ts +3 -2
  20. package/dist/types/src/HelpPlugin.d.ts.map +1 -1
  21. package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
  22. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  23. package/dist/types/src/capabilities/index.d.ts +16 -6
  24. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  25. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  26. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/react-root.d.ts +5 -3
  28. package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
  29. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  30. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  31. package/dist/types/src/capabilities/state.d.ts +11 -2
  32. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  33. package/dist/types/src/components/Shortcuts/Key.d.ts.map +1 -1
  34. package/dist/types/src/components/Shortcuts/ShortcutsHints.d.ts.map +1 -1
  35. package/dist/types/src/components/Shortcuts/ShortcutsSection.d.ts.map +1 -1
  36. package/dist/types/src/components/Shortcuts/index.d.ts +0 -1
  37. package/dist/types/src/components/Shortcuts/index.d.ts.map +1 -1
  38. package/dist/types/src/components/Tooltip/Tooltip.d.ts +9 -9
  39. package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
  40. package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts +1 -1
  41. package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts.map +1 -1
  42. package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts +9 -4
  43. package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts.map +1 -1
  44. package/dist/types/src/constants.d.ts +2 -0
  45. package/dist/types/src/constants.d.ts.map +1 -0
  46. package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts +3 -0
  47. package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts.map +1 -0
  48. package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.d.ts +25 -0
  49. package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.d.ts.map +1 -0
  50. package/dist/types/src/containers/ShortcutsDialogContent/index.d.ts +2 -0
  51. package/dist/types/src/containers/ShortcutsDialogContent/index.d.ts.map +1 -0
  52. package/dist/types/src/containers/ShortcutsHints/ShortcutsHints.d.ts +2 -0
  53. package/dist/types/src/containers/ShortcutsHints/ShortcutsHints.d.ts.map +1 -0
  54. package/dist/types/src/containers/ShortcutsHints/index.d.ts +2 -0
  55. package/dist/types/src/containers/ShortcutsHints/index.d.ts.map +1 -0
  56. package/dist/types/src/containers/ShortcutsList/ShortcutsList.d.ts +2 -0
  57. package/dist/types/src/containers/ShortcutsList/ShortcutsList.d.ts.map +1 -0
  58. package/dist/types/src/containers/ShortcutsList/index.d.ts +2 -0
  59. package/dist/types/src/containers/ShortcutsList/index.d.ts.map +1 -0
  60. package/dist/types/src/containers/index.d.ts +5 -0
  61. package/dist/types/src/containers/index.d.ts.map +1 -0
  62. package/dist/types/src/hooks/useHelp.d.ts +1 -1
  63. package/dist/types/src/hooks/useHelp.d.ts.map +1 -1
  64. package/dist/types/src/index.d.ts +2 -3
  65. package/dist/types/src/index.d.ts.map +1 -1
  66. package/dist/types/src/meta.d.ts +2 -3
  67. package/dist/types/src/meta.d.ts.map +1 -1
  68. package/dist/types/src/operations/definitions.d.ts +4 -0
  69. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  70. package/dist/types/src/operations/index.d.ts +4 -0
  71. package/dist/types/src/operations/index.d.ts.map +1 -0
  72. package/dist/types/src/operations/start.d.ts +5 -0
  73. package/dist/types/src/operations/start.d.ts.map +1 -0
  74. package/dist/types/src/translations.d.ts +5 -6
  75. package/dist/types/src/translations.d.ts.map +1 -1
  76. package/dist/types/src/types/capabilities.d.ts +21 -0
  77. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  78. package/dist/types/src/types/index.d.ts +1 -0
  79. package/dist/types/src/types/index.d.ts.map +1 -1
  80. package/dist/types/src/types/schema.d.ts +2 -14
  81. package/dist/types/src/types/schema.d.ts.map +1 -1
  82. package/dist/types/tsconfig.tsbuildinfo +1 -1
  83. package/package.json +61 -44
  84. package/src/HelpPlugin.tsx +22 -49
  85. package/src/capabilities/app-graph-builder.ts +53 -67
  86. package/src/capabilities/index.ts +10 -7
  87. package/src/capabilities/operation-handler.ts +16 -0
  88. package/src/capabilities/react-root.tsx +28 -25
  89. package/src/capabilities/react-surface.tsx +28 -22
  90. package/src/capabilities/state.ts +19 -16
  91. package/src/components/Shortcuts/ShortcutsHints.tsx +13 -5
  92. package/src/components/Shortcuts/ShortcutsList.tsx +5 -5
  93. package/src/components/Shortcuts/ShortcutsSection.tsx +1 -3
  94. package/src/components/Shortcuts/index.ts +0 -1
  95. package/src/components/Shortcuts/styles.ts +3 -3
  96. package/src/components/Tooltip/Tooltip.tsx +4 -5
  97. package/src/components/WelcomeTour/WelcomeTour.stories.tsx +21 -16
  98. package/src/components/WelcomeTour/WelcomeTour.tsx +18 -18
  99. package/src/constants.ts +7 -0
  100. package/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.tsx +39 -0
  101. package/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.tsx +28 -0
  102. package/src/containers/ShortcutsDialogContent/index.ts +5 -0
  103. package/src/containers/ShortcutsHints/ShortcutsHints.tsx +5 -0
  104. package/src/containers/ShortcutsHints/index.ts +5 -0
  105. package/src/containers/ShortcutsList/ShortcutsList.tsx +5 -0
  106. package/src/containers/ShortcutsList/index.ts +5 -0
  107. package/src/containers/index.ts +9 -0
  108. package/src/hooks/useHelp.tsx +1 -1
  109. package/src/index.ts +2 -3
  110. package/src/meta.ts +8 -6
  111. package/src/operations/definitions.ts +19 -0
  112. package/src/operations/index.ts +9 -0
  113. package/src/operations/start.ts +21 -0
  114. package/src/translations.ts +5 -5
  115. package/src/types/capabilities.ts +24 -0
  116. package/src/types/index.ts +1 -0
  117. package/src/types/schema.ts +2 -12
  118. package/dist/lib/browser/app-graph-builder-TUTK2ONB.mjs +0 -79
  119. package/dist/lib/browser/app-graph-builder-TUTK2ONB.mjs.map +0 -7
  120. package/dist/lib/browser/chunk-3Y4CMOZP.mjs +0 -13
  121. package/dist/lib/browser/chunk-3Y4CMOZP.mjs.map +0 -7
  122. package/dist/lib/browser/chunk-GIDPSFGY.mjs +0 -409
  123. package/dist/lib/browser/chunk-GIDPSFGY.mjs.map +0 -7
  124. package/dist/lib/browser/chunk-J2SJSGSX.mjs +0 -34
  125. package/dist/lib/browser/chunk-J2SJSGSX.mjs.map +0 -7
  126. package/dist/lib/browser/chunk-LDRUZNSN.mjs +0 -16
  127. package/dist/lib/browser/chunk-LDRUZNSN.mjs.map +0 -7
  128. package/dist/lib/browser/react-root-5GSVXKQD.mjs +0 -34
  129. package/dist/lib/browser/react-root-5GSVXKQD.mjs.map +0 -7
  130. package/dist/lib/browser/react-surface-V7U4IDJV.mjs +0 -36
  131. package/dist/lib/browser/react-surface-V7U4IDJV.mjs.map +0 -7
  132. package/dist/lib/browser/state-IXBTB3WH.mjs +0 -29
  133. package/dist/lib/browser/state-IXBTB3WH.mjs.map +0 -7
  134. package/dist/types/src/capabilities/capabilities.d.ts +0 -10
  135. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  136. package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts +0 -4
  137. package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts.map +0 -1
  138. package/src/capabilities/capabilities.ts +0 -13
  139. package/src/components/Shortcuts/ShortcutsDialog.tsx +0 -35
@@ -2,7 +2,6 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './ShortcutsDialog';
6
5
  export * from './ShortcutsHints';
7
6
  export * from './ShortcutsList';
8
7
  export * from './ShortcutsSection';
@@ -2,9 +2,9 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { mx } from '@dxos/react-ui-theme';
5
+ import { mx } from '@dxos/ui-theme';
6
6
 
7
7
  export const shortcutKey = mx(
8
- 'inline-flex min-is-[24px] bs-[24px] pli-0.5 justify-center items-center text-xs',
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 is-[15rem] min-bs-[10rem] overflow-hidden rounded-md shadow-xl bg-accentSurface text-accentSurfaceText'
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 pli-2 plb-1 text-lg font-medium text-accentSurfaceText'>{title}</h2>
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 pli-4 mlb-2'>{content}</div>
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='mli-1 cursor-pointer'
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 { faker } from '@dxos/random';
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/storybook-utils';
12
+ import { withTheme } from '@dxos/react-ui/testing';
13
13
 
14
- import { useHelp } from '../../hooks';
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(() => faker.lorem.sentence()));
20
+ const [items, setItems] = useState(() => Array.from({ length: 5 }).map(() => random.lorem.sentence()));
21
21
  const handleAdd = () => {
22
- setItems((items) => [...items, faker.lorem.sentence()]);
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-blue-500 rounded-md' data-joyride='basic/2'>
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: faker.lorem.paragraph(),
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: faker.lorem.paragraph(),
86
+ content: random.lorem.paragraph(),
87
87
  },
88
88
  {
89
89
  target: '[data-joyride="basic/3"]',
90
90
  title: 'plugins/Step 3',
91
- content: faker.lorem.paragraph(),
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: faker.lorem.paragraph(),
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: Meta<typeof WelcomeTour> = {
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: [withTheme],
112
- };
111
+ decorators: [
112
+ withTheme(),
113
+ withPluginManager({
114
+ plugins: [StorybookPlugin({})],
115
+ }),
116
+ ],
117
+ } satisfies Meta<typeof WelcomeTour>;
113
118
 
114
119
  export default meta;
@@ -2,12 +2,15 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import React, { useEffect, useState } from 'react';
5
+ import React, { useState } from 'react';
6
6
  import Joyride, { ACTIONS, EVENTS } from 'react-joyride';
7
7
 
8
- import { useLayout, usePluginManager } from '@dxos/app-framework';
8
+ import { usePluginManager } from '@dxos/app-framework/ui';
9
+ import { useLayout } from '@dxos/app-toolkit/ui';
10
+ import { useAsyncEffect } from '@dxos/react-ui';
11
+
12
+ import { HelpContext, type Step } from '#types';
9
13
 
10
- import { HelpContext, type Step } from '../../types';
11
14
  import { Tooltip, floaterProps } from '../Tooltip';
12
15
 
13
16
  const addStepClass = (target: string | HTMLElement) => {
@@ -75,7 +78,7 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
75
78
  const setStepIndex = (index: number) => {
76
79
  if (runningProp) {
77
80
  const step = steps[index];
78
- step?.before?.(manager.context);
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
- useEffect(() => {
97
- const timeout = setTimeout(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
- }
107
- });
108
-
109
- return () => clearTimeout(timeout);
99
+ useAsyncEffect(async () => {
100
+ if (runningProp) {
101
+ // This handles the case when the target is not yet in the document.
102
+ // If the target is not in the document, when the joyride is turned on, it will not show the tooltip.
103
+ await waitForTarget(steps[stepIndex]);
104
+ setStepIndex(0);
105
+ setRunning(true);
106
+ } else if (typeof runningProp !== 'undefined') {
107
+ setRunning(false);
108
+ }
110
109
  }, [runningProp]);
111
110
 
112
111
  // https://docs.react-joyride.com/callback
@@ -164,6 +163,7 @@ export const WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunni
164
163
  callback={callback}
165
164
  floaterProps={floaterProps}
166
165
  tooltipComponent={Tooltip}
166
+ spotlightPadding={0}
167
167
  />
168
168
  </HelpContext.Provider>
169
169
  );
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { meta } from '#meta';
6
+
7
+ export const SHORTCUTS_DIALOG = `${meta.id}.ShortcutsDialog`;
@@ -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,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export { ShortcutsDialogContent as default } from './ShortcutsDialogContent';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export { ShortcutsHints } from '../../components';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ export { ShortcutsHints as default } from './ShortcutsHints';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export { ShortcutsList } from '../../components';
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export { ShortcutsList as default } from './ShortcutsList';
@@ -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'));
@@ -6,7 +6,7 @@ import { useContext } from 'react';
6
6
 
7
7
  import { raise } from '@dxos/debug';
8
8
 
9
- import { HelpContext } from '../types';
9
+ import { HelpContext } from '#types';
10
10
 
11
11
  export const useHelp = () => {
12
12
  return useContext(HelpContext) ?? raise(new Error('Missing HelpContext'));
package/src/index.ts CHANGED
@@ -2,9 +2,8 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export { HelpCapabilities } from './capabilities';
5
+ export { HelpCapabilities } from './types';
6
6
  export * from './components';
7
- export * from './meta';
7
+ export * from './constants';
8
8
  export * from './HelpPlugin';
9
9
  export * from './hooks';
10
- export * from './types';
package/src/meta.ts CHANGED
@@ -2,13 +2,15 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- // TODO(burdon): Rename Guide? Help?
8
- export const HELP_PLUGIN = 'dxos.org/plugin/help';
9
-
10
- export const meta: PluginMeta = {
11
- id: HELP_PLUGIN,
8
+ export const meta: Plugin.Meta = {
9
+ id: 'org.dxos.plugin.help',
12
10
  name: 'Help',
11
+ description: trim`
12
+ Built-in help system with documentation, tutorials, and contextual assistance.
13
+ Access keyboard shortcuts, feature guides, and support resources.
14
+ `,
13
15
  icon: 'ph--info--regular',
14
16
  };
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Schema from 'effect/Schema';
6
+
7
+ import { Capability } from '@dxos/app-framework';
8
+ import { Operation } from '@dxos/compute';
9
+
10
+ import { meta } from '#meta';
11
+
12
+ const HELP_OPERATION = `${meta.id}.operation`;
13
+
14
+ export const Start = Operation.make({
15
+ meta: { key: `${HELP_OPERATION}.start`, name: 'Start Help' },
16
+ services: [Capability.Service],
17
+ input: Schema.Void,
18
+ output: Schema.Void,
19
+ });
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { OperationHandlerSet } from '@dxos/compute';
6
+
7
+ export * as HelpOperation from './definitions';
8
+
9
+ export const HelpOperationHandlerSet = OperationHandlerSet.lazy(() => import('./start'));
@@ -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;
@@ -4,16 +4,16 @@
4
4
 
5
5
  import { type Resource } from '@dxos/react-ui';
6
6
 
7
- import { meta } from './meta';
7
+ import { meta } from '#meta';
8
8
 
9
9
  export const translations = [
10
10
  {
11
11
  'en-US': {
12
12
  [meta.id]: {
13
- 'plugin name': 'Help',
14
- 'open help tour': 'Show welcome tour',
15
- 'open shortcuts label': 'Show shortcuts',
16
- 'shortcuts dialog title': '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,4 +2,5 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ export * from './capabilities';
5
6
  export * from './schema';
@@ -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 PluginContext } from '@dxos/app-framework';
10
-
11
- import { meta } from '../meta';
8
+ import { type CapabilityManager } from '@dxos/app-framework';
12
9
 
13
10
  export type Step = BaseStep & {
14
- before?: (context: PluginContext) => void;
11
+ before?: (capabilities: CapabilityManager.CapabilityManager) => void;
15
12
  };
16
13
 
17
14
  export type HelpContextType = {
@@ -31,10 +28,3 @@ export const HelpContext: Context<HelpContextType> = createContext<HelpContextTy
31
28
  start: () => {},
32
29
  stop: () => {},
33
30
  });
34
-
35
- export namespace HelpAction {
36
- export class Start extends Schema.TaggedClass<Start>()(`${meta.id}/action/start`, {
37
- input: Schema.Void,
38
- output: Schema.Void,
39
- }) {}
40
- }
@@ -1,79 +0,0 @@
1
- import {
2
- SHORTCUTS_DIALOG
3
- } from "./chunk-GIDPSFGY.mjs";
4
- import {
5
- HelpAction
6
- } from "./chunk-J2SJSGSX.mjs";
7
- import {
8
- HelpCapabilities
9
- } from "./chunk-LDRUZNSN.mjs";
10
- import {
11
- HELP_PLUGIN
12
- } from "./chunk-3Y4CMOZP.mjs";
13
-
14
- // src/capabilities/app-graph-builder.ts
15
- import { Rx } from "@effect-rx/rx-react";
16
- import { Option, pipe } from "effect";
17
- import { Capabilities, LayoutAction, contributes, createIntent } from "@dxos/app-framework";
18
- import { createExtension } from "@dxos/app-graph";
19
- var app_graph_builder_default = (context) => contributes(Capabilities.AppGraphBuilder, createExtension({
20
- id: HELP_PLUGIN,
21
- actions: (node) => Rx.make((get) => pipe(get(node), Option.flatMap((node2) => node2.id === "root" ? Option.some(node2) : Option.none()), Option.map(() => [
22
- {
23
- id: HelpAction.Start._tag,
24
- data: async () => {
25
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
26
- const state = context.getCapability(HelpCapabilities.MutableState);
27
- state.showHints = true;
28
- await dispatch(createIntent(HelpAction.Start));
29
- },
30
- properties: {
31
- label: [
32
- "open help tour",
33
- {
34
- ns: HELP_PLUGIN
35
- }
36
- ],
37
- icon: "ph--info--regular",
38
- keyBinding: {
39
- macos: "shift+meta+/",
40
- // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
41
- windows: "shift+ctrl+/",
42
- linux: "shift+ctrl+?"
43
- },
44
- testId: "helpPlugin.openHelp"
45
- }
46
- },
47
- {
48
- id: "dxos.org/plugin/help/open-shortcuts",
49
- data: async () => {
50
- const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
51
- const state = context.getCapability(HelpCapabilities.MutableState);
52
- state.showHints = true;
53
- await dispatch(createIntent(LayoutAction.UpdateDialog, {
54
- part: "dialog",
55
- subject: SHORTCUTS_DIALOG,
56
- options: {
57
- blockAlign: "center"
58
- }
59
- }));
60
- },
61
- properties: {
62
- label: [
63
- "open shortcuts label",
64
- {
65
- ns: HELP_PLUGIN
66
- }
67
- ],
68
- icon: "ph--keyboard--regular",
69
- keyBinding: {
70
- macos: "meta+ctrl+/"
71
- }
72
- }
73
- }
74
- ]), Option.getOrElse(() => [])))
75
- }));
76
- export {
77
- app_graph_builder_default as default
78
- };
79
- //# sourceMappingURL=app-graph-builder-TUTK2ONB.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/app-graph-builder.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport { Option, pipe } from 'effect';\n\nimport { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';\nimport { createExtension } from '@dxos/app-graph';\n\nimport { SHORTCUTS_DIALOG } from '../components';\nimport { HELP_PLUGIN } from '../meta';\nimport { HelpAction } from '../types';\n\nimport { HelpCapabilities } from './capabilities';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: HELP_PLUGIN,\n actions: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id === 'root' ? Option.some(node) : Option.none())),\n Option.map(() => [\n {\n id: HelpAction.Start._tag,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n const state = context.getCapability(HelpCapabilities.MutableState);\n state.showHints = true;\n await dispatch(createIntent(HelpAction.Start));\n },\n properties: {\n label: ['open help tour', { ns: HELP_PLUGIN }],\n icon: 'ph--info--regular',\n keyBinding: {\n macos: 'shift+meta+/',\n // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.\n windows: 'shift+ctrl+/',\n linux: 'shift+ctrl+?',\n },\n testId: 'helpPlugin.openHelp',\n },\n },\n {\n id: 'dxos.org/plugin/help/open-shortcuts',\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n const state = context.getCapability(HelpCapabilities.MutableState);\n state.showHints = true;\n await dispatch(\n createIntent(LayoutAction.UpdateDialog, {\n part: 'dialog',\n subject: SHORTCUTS_DIALOG,\n options: {\n blockAlign: 'center',\n },\n }),\n );\n },\n properties: {\n label: ['open shortcuts label', { ns: HELP_PLUGIN }],\n icon: 'ph--keyboard--regular',\n keyBinding: {\n macos: 'meta+ctrl+/',\n },\n },\n },\n ]),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n );\n"],
5
- "mappings": ";;;;;;;;;;;;;;AAIA,SAASA,UAAU;AACnB,SAASC,QAAQC,YAAY;AAE7B,SAASC,cAAcC,cAAkCC,aAAaC,oBAAoB;AAC1F,SAASC,uBAAuB;AAQhC,IAAA,4BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC;EACJC,SAAS,CAACC,SACRC,GAAGC,KAAK,CAACC,QACPC,KACED,IAAIH,IAAAA,GACJK,OAAOC,QAAQ,CAACN,UAAUA,MAAKH,OAAO,SAASQ,OAAOE,KAAKP,KAAAA,IAAQK,OAAOG,KAAI,CAAA,GAC9EH,OAAOI,IAAI,MAAM;IACf;MACEZ,IAAIa,WAAWC,MAAMC;MACrBC,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKvB,QAAQwB,cAActB,aAAauB,gBAAgB;AACzF,cAAMC,QAAQ1B,QAAQwB,cAAcG,iBAAiBC,YAAY;AACjEF,cAAMG,YAAY;AAClB,cAAMN,SAASO,aAAaZ,WAAWC,KAAK,CAAA;MAC9C;MACAY,YAAY;QACVC,OAAO;UAAC;UAAkB;YAAEC,IAAI3B;UAAY;;QAC5C4B,MAAM;QACNC,YAAY;UACVC,OAAO;;UAEPC,SAAS;UACTC,OAAO;QACT;QACAC,QAAQ;MACV;IACF;IACA;MACElC,IAAI;MACJgB,MAAM,YAAA;AACJ,cAAM,EAAEC,iBAAiBC,SAAQ,IAAKvB,QAAQwB,cAActB,aAAauB,gBAAgB;AACzF,cAAMC,QAAQ1B,QAAQwB,cAAcG,iBAAiBC,YAAY;AACjEF,cAAMG,YAAY;AAClB,cAAMN,SACJO,aAAaU,aAAaC,cAAc;UACtCC,MAAM;UACNC,SAASC;UACTC,SAAS;YACPC,YAAY;UACd;QACF,CAAA,CAAA;MAEJ;MACAf,YAAY;QACVC,OAAO;UAAC;UAAwB;YAAEC,IAAI3B;UAAY;;QAClD4B,MAAM;QACNC,YAAY;UACVC,OAAO;QACT;MACF;IACF;GACD,GACDvB,OAAOkC,UAAU,MAAM,CAAA,CAAE,CAAA,CAAA;AAGjC,CAAA,CAAA;",
6
- "names": ["Rx", "Option", "pipe", "Capabilities", "LayoutAction", "contributes", "createIntent", "createExtension", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "HELP_PLUGIN", "actions", "node", "Rx", "make", "get", "pipe", "Option", "flatMap", "some", "none", "map", "HelpAction", "Start", "_tag", "data", "dispatchPromise", "dispatch", "getCapability", "IntentDispatcher", "state", "HelpCapabilities", "MutableState", "showHints", "createIntent", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "linux", "testId", "LayoutAction", "UpdateDialog", "part", "subject", "SHORTCUTS_DIALOG", "options", "blockAlign", "getOrElse"]
7
- }
@@ -1,13 +0,0 @@
1
- // src/meta.ts
2
- var HELP_PLUGIN = "dxos.org/plugin/help";
3
- var meta = {
4
- id: HELP_PLUGIN,
5
- name: "Help",
6
- icon: "ph--info--regular"
7
- };
8
-
9
- export {
10
- HELP_PLUGIN,
11
- meta
12
- };
13
- //# sourceMappingURL=chunk-3Y4CMOZP.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/meta.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\n// TODO(burdon): Rename Guide? Help?\nexport const HELP_PLUGIN = 'dxos.org/plugin/help';\n\nexport const meta: PluginMeta = {\n id: HELP_PLUGIN,\n name: 'Help',\n icon: 'ph--info--regular',\n};\n"],
5
- "mappings": ";AAOO,IAAMA,cAAc;AAEpB,IAAMC,OAAmB;EAC9BC,IAAIF;EACJG,MAAM;EACNC,MAAM;AACR;",
6
- "names": ["HELP_PLUGIN", "meta", "id", "name", "icon"]
7
- }