@dxos/plugin-help 0.7.5-main.9d26e3a → 0.7.5-main.9d2a38b

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