@dxos/plugin-help 0.7.4 → 0.7.5-labs.5f04cf6

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 (60) hide show
  1. package/dist/lib/browser/app-graph-builder-G3FCDRBG.mjs +75 -0
  2. package/dist/lib/browser/app-graph-builder-G3FCDRBG.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-24E4WRKH.mjs +36 -0
  4. package/dist/lib/browser/chunk-24E4WRKH.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-76XWX6N3.mjs +13 -0
  6. package/dist/lib/browser/chunk-76XWX6N3.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-GJTAQWB6.mjs +16 -0
  8. package/dist/lib/browser/chunk-GJTAQWB6.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-VNAN5GRY.mjs +361 -0
  10. package/dist/lib/browser/chunk-VNAN5GRY.mjs.map +7 -0
  11. package/dist/lib/browser/index.mjs +71 -503
  12. package/dist/lib/browser/index.mjs.map +4 -4
  13. package/dist/lib/browser/meta.json +1 -1
  14. package/dist/lib/browser/meta.mjs +3 -5
  15. package/dist/lib/browser/react-context-SIW6XKOC.mjs +34 -0
  16. package/dist/lib/browser/react-context-SIW6XKOC.mjs.map +7 -0
  17. package/dist/lib/browser/react-surface-TZZUXIVX.mjs +36 -0
  18. package/dist/lib/browser/react-surface-TZZUXIVX.mjs.map +7 -0
  19. package/dist/lib/browser/state-SLKOTRHH.mjs +29 -0
  20. package/dist/lib/browser/state-SLKOTRHH.mjs.map +7 -0
  21. package/dist/lib/browser/types.mjs +12 -0
  22. package/dist/lib/browser/types.mjs.map +7 -0
  23. package/dist/types/src/HelpPlugin.d.ts +2 -7
  24. package/dist/types/src/HelpPlugin.d.ts.map +1 -1
  25. package/dist/types/src/capabilities/app-graph-builder.d.ts +181 -0
  26. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
  27. package/dist/types/src/capabilities/capabilities.d.ts +10 -0
  28. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  29. package/dist/types/src/capabilities/index.d.ts +186 -0
  30. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  31. package/dist/types/src/capabilities/react-context.d.ts +9 -0
  32. package/dist/types/src/capabilities/react-context.d.ts.map +1 -0
  33. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  34. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  35. package/dist/types/src/capabilities/state.d.ts +4 -0
  36. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  37. package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts +1 -0
  38. package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts.map +1 -1
  39. package/dist/types/src/index.d.ts +4 -5
  40. package/dist/types/src/index.d.ts.map +1 -1
  41. package/dist/types/src/meta.d.ts +1 -5
  42. package/dist/types/src/meta.d.ts.map +1 -1
  43. package/dist/types/src/types.d.ts +15 -6
  44. package/dist/types/src/types.d.ts.map +1 -1
  45. package/dist/types/tsconfig.tsbuildinfo +1 -0
  46. package/package.json +23 -23
  47. package/src/HelpPlugin.tsx +45 -121
  48. package/src/capabilities/app-graph-builder.ts +58 -0
  49. package/src/capabilities/capabilities.ts +13 -0
  50. package/src/capabilities/index.ts +12 -0
  51. package/src/capabilities/react-context.tsx +34 -0
  52. package/src/capabilities/react-surface.tsx +30 -0
  53. package/src/capabilities/state.ts +23 -0
  54. package/src/components/HelpContextProvider/HelpContextProvider.tsx +5 -5
  55. package/src/components/Shortcuts/ShortcutsDialog.tsx +2 -0
  56. package/src/index.ts +4 -9
  57. package/src/meta.ts +1 -6
  58. package/src/types.ts +12 -9
  59. package/dist/lib/browser/chunk-2EMBCGD5.mjs +0 -19
  60. package/dist/lib/browser/chunk-2EMBCGD5.mjs.map +0 -7
@@ -1,380 +1,36 @@
1
1
  import {
2
- HELP_PLUGIN,
2
+ HelpContextProvider,
3
+ Key,
4
+ SHORTCUTS_DIALOG,
5
+ ShortcutsDialogContent,
6
+ ShortcutsHints,
7
+ ShortcutsList,
8
+ ShortcutsSection,
9
+ Tooltip,
10
+ floaterProps
11
+ } from "./chunk-VNAN5GRY.mjs";
12
+ import {
13
+ HELP_ACTION,
3
14
  HelpAction,
4
- meta_default
5
- } from "./chunk-2EMBCGD5.mjs";
6
-
7
- // packages/plugins/plugin-help/src/HelpPlugin.tsx
8
- import React8 from "react";
9
- import { resolvePlugin as resolvePlugin2, parseIntentPlugin, LayoutAction } from "@dxos/app-framework";
10
- import { createExtension } from "@dxos/app-graph";
11
- import { create } from "@dxos/live-object";
12
- import { LocalStorageStore } from "@dxos/local-storage";
13
-
14
- // packages/plugins/plugin-help/src/components/HelpContextProvider/HelpContextProvider.tsx
15
- import React2, { useState, useEffect } from "react";
16
- import Joyride, { ACTIONS, EVENTS } from "react-joyride";
17
- import { usePlugins, resolvePlugin, parseLayoutPlugin } from "@dxos/app-framework";
18
-
19
- // packages/plugins/plugin-help/src/types.ts
20
- import { createContext } from "react";
21
- var HelpContext = createContext({
22
- running: false,
23
- steps: [],
24
- setSteps: () => {
25
- },
26
- setIndex: () => {
27
- },
28
- start: () => {
29
- },
30
- stop: () => {
31
- }
32
- });
33
-
34
- // packages/plugins/plugin-help/src/components/Tooltip/Tooltip.tsx
35
- import { useArrowNavigationGroup, useFocusableGroup } from "@fluentui/react-tabster";
36
- import { CaretLeft, CaretRight, Circle, X } from "@phosphor-icons/react";
37
- import React, { forwardRef } from "react";
38
- import { Button } from "@dxos/react-ui";
39
- import { getSize, mx } from "@dxos/react-ui-theme";
40
- var floaterProps = {
41
- styles: {
42
- // Arrow color is set by joyride.
43
- arrow: {
44
- length: 8,
45
- spread: 16
46
- },
47
- floater: {
48
- // TODO(burdon): Get tokens from theme.
49
- filter: "drop-shadow(0 0 0.75rem rgba(0, 0, 0, 0.2))"
50
- }
51
- }
52
- };
53
- var Tooltip = /* @__PURE__ */ forwardRef(({ step: { title, content }, index, size, isLastStep, backProps, closeProps, primaryProps }, forwardedRef) => {
54
- const arrowGroup = useArrowNavigationGroup({
55
- axis: "horizontal"
56
- });
57
- const trapFocus = useFocusableGroup({
58
- tabBehavior: "limited-trap-focus"
59
- });
60
- return /* @__PURE__ */ React.createElement("div", {
61
- className: "flex flex-col is-[15rem] min-bs-[10rem] overflow-hidden rounded-md shadow-xl bg-accentSurface text-inverse",
62
- role: "tooltip",
63
- "data-testid": "helpPlugin.tooltip",
64
- "data-step": index + 1,
65
- ...trapFocus,
66
- ref: forwardedRef
67
- }, /* @__PURE__ */ React.createElement("div", {
68
- className: "flex p-2"
69
- }, /* @__PURE__ */ React.createElement("h2", {
70
- className: "grow pli-2 plb-1 text-lg font-medium text-inverse"
71
- }, title), /* @__PURE__ */ React.createElement(Button, {
72
- density: "fine",
73
- variant: "primary",
74
- onClick: closeProps.onClick,
75
- title: closeProps["aria-label"],
76
- "data-testid": "helpPlugin.tooltip.close"
77
- }, /* @__PURE__ */ React.createElement(X, {
78
- weight: "bold",
79
- className: getSize(4)
80
- }))), /* @__PURE__ */ React.createElement("div", {
81
- className: "flex grow pli-4 mlb-2"
82
- }, content), /* @__PURE__ */ React.createElement("div", {
83
- className: "flex p-2 items-center justify-between",
84
- ...arrowGroup
85
- }, /* @__PURE__ */ React.createElement(Button, {
86
- variant: "primary",
87
- onClick: backProps.onClick,
88
- title: backProps["aria-label"],
89
- classNames: [
90
- !(index > 0 && backProps) && "invisible"
91
- ],
92
- "data-testid": "helpPlugin.tooltip.back"
93
- }, /* @__PURE__ */ React.createElement(CaretLeft, {
94
- className: getSize(5)
95
- })), /* @__PURE__ */ React.createElement("div", {
96
- className: "flex grow gap-2 justify-center"
97
- }, /* @__PURE__ */ React.createElement("div", {
98
- className: "flex"
99
- }, Array.from({
100
- length: size
101
- }).map((_, i) => /* @__PURE__ */ React.createElement(Circle, {
102
- key: i,
103
- weight: index === i ? "fill" : "regular",
104
- className: mx(getSize(2), "mli-1 cursor-pointer")
105
- })))), isLastStep ? /* @__PURE__ */ React.createElement(Button, {
106
- variant: "primary",
107
- onClick: closeProps.onClick,
108
- title: closeProps["aria-label"],
109
- autoFocus: true,
110
- "data-testid": "helpPlugin.tooltip.finish"
111
- }, "Done") : /* @__PURE__ */ React.createElement(Button, {
112
- variant: "primary",
113
- onClick: primaryProps.onClick,
114
- title: primaryProps["aria-label"],
115
- autoFocus: true,
116
- "data-testid": "helpPlugin.tooltip.next"
117
- }, /* @__PURE__ */ React.createElement(CaretRight, {
118
- className: getSize(6)
119
- }))));
120
- });
121
-
122
- // packages/plugins/plugin-help/src/components/HelpContextProvider/HelpContextProvider.tsx
123
- var addStepClass = (target) => {
124
- const element = typeof target === "string" ? document.querySelector(target) : target;
125
- if (element) {
126
- element.classList.add("joyride-target");
127
- }
128
- };
129
- var removeTargetClass = (target) => {
130
- const element = typeof target === "string" ? document.querySelector(target) : target;
131
- if (element) {
132
- element.classList.remove("joyride-target");
133
- }
134
- };
135
- var getTarget = (step) => {
136
- return typeof step.target === "string" ? document.querySelector(step.target) : step.target;
137
- };
138
- var waitForTarget = async (step) => {
139
- if (typeof step.target === "string") {
140
- const target = step.target;
141
- const element = document.querySelector(target);
142
- if (element) {
143
- return;
144
- }
145
- await new Promise((resolve) => {
146
- const observer = new MutationObserver((mutations) => {
147
- mutations.forEach((mutation) => {
148
- if (mutation.addedNodes.length > 0) {
149
- const element2 = document.querySelector(target);
150
- if (element2) {
151
- observer.disconnect();
152
- resolve();
153
- }
154
- }
155
- });
156
- });
157
- observer.observe(document.body, {
158
- childList: true,
159
- subtree: true
160
- });
161
- });
162
- }
163
- };
164
- var HelpContextProvider = ({ children, steps: initialSteps, running: runningProp, onRunningChanged }) => {
165
- const { plugins } = usePlugins();
166
- const layoutPlugin = resolvePlugin(plugins, parseLayoutPlugin);
167
- const [running, setRunning] = useState(!!runningProp && !!getTarget(initialSteps[0]));
168
- const [stepIndex, _setStepIndex] = useState(0);
169
- const [steps, setSteps] = useState(initialSteps);
170
- const paused = layoutPlugin?.provides.layout.dialogOpen;
171
- const setStepIndex = (index) => {
172
- if (runningProp) {
173
- const step = steps[index];
174
- step?.before?.({
175
- plugins,
176
- step
177
- });
178
- }
179
- _setStepIndex(index);
180
- };
181
- const setRunningChanged = (state) => {
182
- if (typeof runningProp !== "undefined") {
183
- onRunningChanged?.(state);
184
- } else {
185
- if (state) {
186
- setStepIndex(0);
187
- setRunning(true);
188
- } else {
189
- setRunning(false);
190
- }
191
- }
192
- };
193
- useEffect(() => {
194
- const timeout = setTimeout(async () => {
195
- if (runningProp) {
196
- await waitForTarget(steps[stepIndex]);
197
- setStepIndex(0);
198
- setRunning(true);
199
- } else if (typeof runningProp !== "undefined") {
200
- setRunning(false);
201
- }
202
- });
203
- return () => clearTimeout(timeout);
204
- }, [
205
- runningProp
206
- ]);
207
- const callback = async (options) => {
208
- const { type, action, index, size } = options;
209
- switch (type) {
210
- case EVENTS.STEP_BEFORE:
211
- addStepClass(options.step.target);
212
- break;
213
- case EVENTS.TOUR_END:
214
- break;
215
- case EVENTS.STEP_AFTER:
216
- removeTargetClass(options.step.target);
217
- switch (action) {
218
- case ACTIONS.NEXT:
219
- if (index < size - 1) {
220
- setStepIndex(index + 1);
221
- }
222
- break;
223
- case ACTIONS.PREV:
224
- if (index > 0) {
225
- setStepIndex(index - 1);
226
- }
227
- break;
228
- case ACTIONS.CLOSE:
229
- setRunningChanged(false);
230
- setStepIndex(0);
231
- break;
232
- }
233
- break;
234
- }
235
- };
236
- return /* @__PURE__ */ React2.createElement(HelpContext.Provider, {
237
- value: {
238
- running: running && !paused,
239
- steps,
240
- setSteps,
241
- setIndex: setStepIndex,
242
- start: () => setRunningChanged(true),
243
- stop: () => setRunningChanged(false)
244
- }
245
- }, /* @__PURE__ */ React2.createElement("style", null, `.joyride-target {
246
- --controls-opacity: 1;
247
- }`), /* @__PURE__ */ React2.createElement(Joyride, {
248
- continuous: true,
249
- steps,
250
- stepIndex,
251
- run: running && !paused,
252
- callback,
253
- floaterProps,
254
- tooltipComponent: Tooltip
255
- }), children);
256
- };
257
-
258
- // packages/plugins/plugin-help/src/components/Shortcuts/ShortcutsDialog.tsx
259
- import React5 from "react";
260
- import { Button as Button2, Dialog, Icon, useTranslation as useTranslation2 } from "@dxos/react-ui";
261
-
262
- // packages/plugins/plugin-help/src/components/Shortcuts/ShortcutsList.tsx
263
- import React4, { Fragment } from "react";
264
- import { Keyboard } from "@dxos/keyboard";
265
- import { toLocalizedString, useTranslation } from "@dxos/react-ui";
266
- import { mx as mx3 } from "@dxos/react-ui-theme";
267
-
268
- // packages/plugins/plugin-help/src/components/Shortcuts/Key.tsx
269
- import React3 from "react";
270
- import { keySymbols } from "@dxos/keyboard";
271
-
272
- // packages/plugins/plugin-help/src/components/Shortcuts/styles.ts
273
- import { mx as mx2 } from "@dxos/react-ui-theme";
274
- var shortcutKey = mx2("inline-flex min-is-[24px] bs-[24px] pli-0.5 justify-center items-center text-xs", "rounded bg-neutral-100 dark:bg-neutral-900");
275
-
276
- // packages/plugins/plugin-help/src/components/Shortcuts/Key.tsx
277
- var Key = ({ binding }) => {
278
- return /* @__PURE__ */ React3.createElement("span", {
279
- role: "term",
280
- className: "inline-flex gap-1",
281
- "aria-label": binding,
282
- id: binding
283
- }, keySymbols(binding).map((c, i) => /* @__PURE__ */ React3.createElement("span", {
284
- key: i,
285
- className: shortcutKey
286
- }, c)));
287
- };
288
-
289
- // packages/plugins/plugin-help/src/components/Shortcuts/ShortcutsList.tsx
290
- var ShortcutsList = () => {
291
- const { t } = useTranslation(HELP_PLUGIN);
292
- const bindings = Keyboard.singleton.getBindings();
293
- bindings.sort((a, b) => {
294
- return toLocalizedString(a.data, t)?.toLowerCase().localeCompare(toLocalizedString(b.data, t)?.toLowerCase());
295
- });
296
- return /* @__PURE__ */ React4.createElement("dl", {
297
- className: mx3("is-fit grid grid-cols-[min-content_minmax(12rem,1fr)] gap-2 mlb-4 text-subdued")
298
- }, bindings.map((binding, i) => /* @__PURE__ */ React4.createElement(Fragment, {
299
- key: i
300
- }, /* @__PURE__ */ React4.createElement(Key, {
301
- binding: binding.shortcut
302
- }), /* @__PURE__ */ React4.createElement("span", {
303
- role: "definition",
304
- className: "mis-4",
305
- "aria-labelledby": binding.shortcut
306
- }, toLocalizedString(binding.data, t)))));
307
- };
308
-
309
- // packages/plugins/plugin-help/src/components/Shortcuts/ShortcutsDialog.tsx
310
- var ShortcutsDialogContent = () => {
311
- const { t } = useTranslation2(HELP_PLUGIN);
312
- return /* @__PURE__ */ React5.createElement(Dialog.Content, {
313
- classNames: "p-0 bs-content max-bs-full md:max-is-[25rem] overflow-hidden"
314
- }, /* @__PURE__ */ React5.createElement("div", {
315
- role: "none",
316
- className: "flex justify-between mbe-1 pbs-3 pis-2 pie-3 @md:pbs-4 @md:pis-4 @md:pie-5"
317
- }, /* @__PURE__ */ React5.createElement(Dialog.Title, null, t("shortcuts dialog title")), /* @__PURE__ */ React5.createElement(Dialog.Close, {
318
- asChild: true
319
- }, /* @__PURE__ */ React5.createElement(Button2, {
320
- density: "fine",
321
- variant: "ghost",
322
- autoFocus: true
323
- }, /* @__PURE__ */ React5.createElement(Icon, {
324
- icon: "ph--x--regular",
325
- size: 3
326
- })))), /* @__PURE__ */ React5.createElement("div", {
327
- className: "flex items-center justify-center"
328
- }, /* @__PURE__ */ React5.createElement(ShortcutsList, null)));
329
- };
15
+ HelpContext
16
+ } from "./chunk-24E4WRKH.mjs";
17
+ import {
18
+ HelpCapabilities
19
+ } from "./chunk-GJTAQWB6.mjs";
20
+ import {
21
+ HELP_PLUGIN,
22
+ meta
23
+ } from "./chunk-76XWX6N3.mjs";
330
24
 
331
- // packages/plugins/plugin-help/src/components/Shortcuts/ShortcutsHints.tsx
332
- import React6 from "react";
333
- import { Keyboard as Keyboard2 } from "@dxos/keyboard";
334
- import { Button as Button3, Icon as Icon2, toLocalizedString as toLocalizedString2, useTranslation as useTranslation3 } from "@dxos/react-ui";
335
- var Shortcut = ({ binding }) => {
336
- const { t } = useTranslation3("os");
337
- return /* @__PURE__ */ React6.createElement("div", {
338
- role: "none",
339
- className: "flex items-center gap-2 whitespace-nowrap"
340
- }, /* @__PURE__ */ React6.createElement(Key, {
341
- binding: binding.shortcut
342
- }), /* @__PURE__ */ React6.createElement("span", {
343
- className: "text-sm"
344
- }, toLocalizedString2(binding.data, t)));
345
- };
346
- var ShortcutsHints = ({ onClose }) => {
347
- const defaults = [
348
- "meta+k",
349
- "meta+/",
350
- "meta+,"
351
- ];
352
- const bindings = Keyboard2.singleton.getBindings();
353
- const hints = bindings.filter((binding) => defaults.includes(binding.shortcut));
354
- return /* @__PURE__ */ React6.createElement("div", {
355
- role: "none",
356
- className: "flex overflow-hidden px-2 gap-4"
357
- }, hints.map((binding) => /* @__PURE__ */ React6.createElement(Shortcut, {
358
- key: binding.shortcut,
359
- binding
360
- })), onClose && /* @__PURE__ */ React6.createElement(Button3, {
361
- variant: "ghost",
362
- classNames: "p-0 cursor-pointer",
363
- onClick: onClose
364
- }, /* @__PURE__ */ React6.createElement(Icon2, {
365
- icon: "ph--x--regular",
366
- size: 4
367
- })));
368
- };
25
+ // packages/plugins/plugin-help/src/capabilities/index.ts
26
+ import { lazy } from "@dxos/app-framework";
27
+ var AppGraphBuilder = lazy(() => import("./app-graph-builder-G3FCDRBG.mjs"));
28
+ var ReactContext = lazy(() => import("./react-context-SIW6XKOC.mjs"));
29
+ var ReactSurface = lazy(() => import("./react-surface-TZZUXIVX.mjs"));
30
+ var HelpState = lazy(() => import("./state-SLKOTRHH.mjs"));
369
31
 
370
- // packages/plugins/plugin-help/src/components/Shortcuts/ShortcutsSection.tsx
371
- import React7 from "react";
372
- import { descriptionText } from "@dxos/react-ui-theme";
373
- var ShortcutsSection = () => {
374
- return /* @__PURE__ */ React7.createElement("section", {
375
- className: descriptionText
376
- }, /* @__PURE__ */ React7.createElement(ShortcutsList, null));
377
- };
32
+ // packages/plugins/plugin-help/src/HelpPlugin.tsx
33
+ import { createResolver, defineModule, definePlugin, Events, contributes, Capabilities } from "@dxos/app-framework";
378
34
 
379
35
  // packages/plugins/plugin-help/src/translations.ts
380
36
  var translations_default = [
@@ -391,132 +47,41 @@ var translations_default = [
391
47
  ];
392
48
 
393
49
  // packages/plugins/plugin-help/src/HelpPlugin.tsx
394
- var HelpPlugin = ({ steps = [] }) => {
395
- const settings = new LocalStorageStore(HELP_PLUGIN, {
396
- showHints: true,
397
- showWelcome: true
398
- });
399
- const state = create({
400
- running: false
401
- });
402
- return {
403
- meta: meta_default,
404
- ready: async () => {
405
- settings.prop({
406
- key: "showHints",
407
- type: LocalStorageStore.bool({
408
- allowUndefined: true
409
- })
410
- }).prop({
411
- key: "showWelcome",
412
- type: LocalStorageStore.bool({
413
- allowUndefined: true
414
- })
415
- });
416
- },
417
- provides: {
418
- context: ({ children }) => {
419
- return /* @__PURE__ */ React8.createElement(HelpContextProvider, {
420
- steps,
421
- running: state.running,
422
- onRunningChanged: (newState) => {
423
- state.running = newState;
424
- if (!newState) {
425
- settings.values.showHints = false;
426
- }
427
- }
428
- }, children);
429
- },
430
- translations: translations_default,
431
- graph: {
432
- builder: (plugins) => {
433
- const intentPlugin = resolvePlugin2(plugins, parseIntentPlugin);
434
- return createExtension({
435
- id: HELP_PLUGIN,
436
- filter: (node) => node.id === "root",
437
- actions: () => [
438
- {
439
- id: HelpAction.START,
440
- data: async () => {
441
- settings.values.showHints = true;
442
- await intentPlugin?.provides.intent.dispatch({
443
- plugin: HELP_PLUGIN,
444
- action: HelpAction.START
445
- });
446
- },
447
- properties: {
448
- label: [
449
- "open help tour",
450
- {
451
- ns: HELP_PLUGIN
452
- }
453
- ],
454
- icon: "ph--info--regular",
455
- keyBinding: {
456
- macos: "shift+meta+/",
457
- // TODO(wittjosiah): Test on windows to see if it behaves the same as linux.
458
- windows: "shift+ctrl+/",
459
- linux: "shift+ctrl+?"
460
- },
461
- testId: "helpPlugin.openHelp"
462
- }
463
- },
464
- {
465
- id: "dxos.org/plugin/help/open-shortcuts",
466
- data: async () => {
467
- settings.values.showHints = true;
468
- await intentPlugin?.provides.intent.dispatch({
469
- action: LayoutAction.SET_LAYOUT,
470
- data: {
471
- element: "dialog",
472
- component: `${HELP_PLUGIN}/Shortcuts`
473
- }
474
- });
475
- },
476
- properties: {
477
- label: [
478
- "open shortcuts label",
479
- {
480
- ns: HELP_PLUGIN
481
- }
482
- ],
483
- icon: "ph--keyboard--regular",
484
- keyBinding: {
485
- macos: "meta+ctrl+/"
486
- }
487
- }
488
- }
489
- ]
490
- });
491
- }
492
- },
493
- surface: {
494
- component: ({ data, role }) => {
495
- switch (role) {
496
- case "hints":
497
- return /* @__PURE__ */ React8.createElement(ShortcutsHints, null);
498
- case "keyshortcuts":
499
- return /* @__PURE__ */ React8.createElement(ShortcutsList, null);
500
- }
501
- switch (data.component) {
502
- case `${HELP_PLUGIN}/Shortcuts`:
503
- return /* @__PURE__ */ React8.createElement(ShortcutsDialogContent, null);
504
- }
505
- return null;
506
- }
507
- },
508
- intent: {
509
- resolver: async (intent) => {
510
- switch (intent.action) {
511
- case HelpAction.START:
512
- state.running = true;
513
- break;
514
- }
515
- }
516
- }
517
- }
518
- };
519
- };
50
+ var HelpPlugin = ({ steps = [] }) => definePlugin(meta, [
51
+ defineModule({
52
+ id: `${meta.id}/module/state`,
53
+ activatesOn: Events.Startup,
54
+ activate: HelpState
55
+ }),
56
+ defineModule({
57
+ id: `${meta.id}/module/translations`,
58
+ activatesOn: Events.SetupTranslations,
59
+ activate: () => contributes(Capabilities.Translations, translations_default)
60
+ }),
61
+ defineModule({
62
+ id: `${meta.id}/module/react-context`,
63
+ activatesOn: Events.Startup,
64
+ activate: () => ReactContext(steps)
65
+ }),
66
+ defineModule({
67
+ id: `${meta.id}/module/react-surface`,
68
+ activatesOn: Events.Startup,
69
+ activate: ReactSurface
70
+ }),
71
+ defineModule({
72
+ id: `${meta.id}/module/intent-resolver`,
73
+ activatesOn: Events.SetupIntents,
74
+ activate: (context) => contributes(Capabilities.IntentResolver, createResolver(HelpAction.Start, () => {
75
+ const state = context.requestCapability(HelpCapabilities.MutableState);
76
+ state.running = true;
77
+ }))
78
+ }),
79
+ defineModule({
80
+ id: `${meta.id}/module/app-graph-builder`,
81
+ activatesOn: Events.SetupAppGraph,
82
+ activate: AppGraphBuilder
83
+ })
84
+ ]);
520
85
 
521
86
  // packages/plugins/plugin-help/src/hooks/useHelp.tsx
522
87
  import { useContext } from "react";
@@ -524,20 +89,23 @@ import { raise } from "@dxos/debug";
524
89
  var useHelp = () => {
525
90
  return useContext(HelpContext) ?? raise(new Error("Missing HelpContext"));
526
91
  };
527
-
528
- // packages/plugins/plugin-help/src/index.ts
529
- var src_default = HelpPlugin;
530
92
  export {
93
+ HELP_ACTION,
94
+ HELP_PLUGIN,
95
+ HelpAction,
96
+ HelpCapabilities,
97
+ HelpContext,
531
98
  HelpContextProvider,
532
99
  HelpPlugin,
533
100
  Key,
101
+ SHORTCUTS_DIALOG,
534
102
  ShortcutsDialogContent,
535
103
  ShortcutsHints,
536
104
  ShortcutsList,
537
105
  ShortcutsSection,
538
106
  Tooltip,
539
- src_default as default,
540
107
  floaterProps,
108
+ meta,
541
109
  useHelp
542
110
  };
543
111
  //# sourceMappingURL=index.mjs.map