@dxos/plugin-help 0.8.4-main.c4373fc → 0.8.4-main.d05673bc65
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/ShortcutsDialogContent-SFEN5YKG.mjs +36 -0
- package/dist/lib/browser/ShortcutsDialogContent-SFEN5YKG.mjs.map +7 -0
- package/dist/lib/browser/ShortcutsHints-SUH2FE3T.mjs +12 -0
- package/dist/lib/browser/ShortcutsHints-SUH2FE3T.mjs.map +7 -0
- package/dist/lib/browser/ShortcutsList-4YPEJM33.mjs +12 -0
- package/dist/lib/browser/ShortcutsList-4YPEJM33.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-5RXPFQPI.mjs +79 -0
- package/dist/lib/browser/app-graph-builder-5RXPFQPI.mjs.map +7 -0
- package/dist/lib/browser/chunk-HMLZFBYY.mjs +58 -0
- package/dist/lib/browser/chunk-HMLZFBYY.mjs.map +7 -0
- package/dist/lib/browser/chunk-P34WCEMS.mjs +11 -0
- package/dist/lib/browser/chunk-P34WCEMS.mjs.map +7 -0
- package/dist/lib/browser/chunk-TEXIV2IJ.mjs +16 -0
- package/dist/lib/browser/chunk-TEXIV2IJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-VGW5FGD7.mjs +335 -0
- package/dist/lib/browser/chunk-VGW5FGD7.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +62 -58
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/lib/browser/react-root-JBHEZA5U.mjs +43 -0
- package/dist/lib/browser/react-root-JBHEZA5U.mjs.map +7 -0
- package/dist/lib/browser/react-surface-W5S45O6Y.mjs +42 -0
- package/dist/lib/browser/react-surface-W5S45O6Y.mjs.map +7 -0
- package/dist/lib/browser/state-SEPP77HO.mjs +27 -0
- package/dist/lib/browser/state-SEPP77HO.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +8 -6
- 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/ShortcutsHints.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/ShortcutsSection.d.ts.map +1 -1
- package/dist/types/src/components/Shortcuts/index.d.ts +0 -1
- package/dist/types/src/components/Shortcuts/index.d.ts.map +1 -1
- package/dist/types/src/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts.map +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/{components/Shortcuts/ShortcutsDialog.d.ts → containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts} +1 -2
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsDialogContent/index.d.ts +3 -0
- package/dist/types/src/containers/ShortcutsDialogContent/index.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsHints/ShortcutsHints.d.ts +2 -0
- package/dist/types/src/containers/ShortcutsHints/ShortcutsHints.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsHints/index.d.ts +3 -0
- package/dist/types/src/containers/ShortcutsHints/index.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsList/ShortcutsList.d.ts +2 -0
- package/dist/types/src/containers/ShortcutsList/ShortcutsList.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsList/index.d.ts +3 -0
- package/dist/types/src/containers/ShortcutsList/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- 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 +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +16 -12
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -34
- package/src/HelpPlugin.tsx +17 -42
- 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 +36 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +27 -0
- package/src/components/Shortcuts/ShortcutsHints.tsx +13 -5
- package/src/components/Shortcuts/ShortcutsList.tsx +3 -3
- package/src/components/Shortcuts/ShortcutsSection.tsx +1 -3
- package/src/components/Shortcuts/index.ts +0 -1
- package/src/components/Shortcuts/styles.ts +3 -3
- package/src/components/Tooltip/Tooltip.tsx +4 -5
- package/src/components/WelcomeTour/WelcomeTour.stories.tsx +9 -5
- package/src/components/WelcomeTour/WelcomeTour.tsx +3 -2
- package/src/constants.ts +7 -0
- package/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.tsx +29 -0
- package/src/containers/ShortcutsDialogContent/index.ts +7 -0
- package/src/containers/ShortcutsHints/ShortcutsHints.tsx +5 -0
- package/src/containers/ShortcutsHints/index.ts +7 -0
- package/src/containers/ShortcutsList/ShortcutsList.tsx +5 -0
- package/src/containers/ShortcutsList/index.ts +7 -0
- package/src/containers/index.ts +9 -0
- package/src/index.ts +2 -1
- package/src/meta.ts +8 -3
- package/src/types/capabilities.ts +24 -0
- package/src/types/index.ts +1 -0
- package/src/types/schema.ts +11 -7
- package/dist/lib/browser/app-graph-builder-OBX2JPME.mjs +0 -80
- package/dist/lib/browser/app-graph-builder-OBX2JPME.mjs.map +0 -7
- package/dist/lib/browser/chunk-2OGXA47I.mjs +0 -34
- package/dist/lib/browser/chunk-2OGXA47I.mjs.map +0 -7
- package/dist/lib/browser/chunk-2X6D7RV7.mjs +0 -407
- package/dist/lib/browser/chunk-2X6D7RV7.mjs.map +0 -7
- package/dist/lib/browser/chunk-3WYHGOGD.mjs +0 -16
- package/dist/lib/browser/chunk-3WYHGOGD.mjs.map +0 -7
- package/dist/lib/browser/chunk-HUJHLAHD.mjs +0 -11
- package/dist/lib/browser/chunk-HUJHLAHD.mjs.map +0 -7
- package/dist/lib/browser/react-root-TXBGER6K.mjs +0 -34
- package/dist/lib/browser/react-root-TXBGER6K.mjs.map +0 -7
- package/dist/lib/browser/react-surface-B6YRCLU3.mjs +0 -36
- package/dist/lib/browser/react-surface-B6YRCLU3.mjs.map +0 -7
- package/dist/lib/browser/state-Y7EYMGFM.mjs +0 -29
- package/dist/lib/browser/state-Y7EYMGFM.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/components/Shortcuts/ShortcutsDialog.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -78
- package/src/capabilities/capabilities.ts +0 -13
- package/src/capabilities/react-root.tsx +0 -33
- package/src/capabilities/react-surface.tsx +0 -30
- package/src/capabilities/state.ts +0 -24
- package/src/components/Shortcuts/ShortcutsDialog.tsx +0 -35
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShortcutsList
|
|
3
|
+
} from "./chunk-VGW5FGD7.mjs";
|
|
4
|
+
import "./chunk-HMLZFBYY.mjs";
|
|
5
|
+
import {
|
|
6
|
+
meta
|
|
7
|
+
} from "./chunk-TEXIV2IJ.mjs";
|
|
8
|
+
|
|
9
|
+
// src/containers/ShortcutsDialogContent/ShortcutsDialogContent.tsx
|
|
10
|
+
import React from "react";
|
|
11
|
+
import { Dialog, IconButton, useTranslation } from "@dxos/react-ui";
|
|
12
|
+
var ShortcutsDialogContent = () => {
|
|
13
|
+
const { t } = useTranslation(meta.id);
|
|
14
|
+
return /* @__PURE__ */ React.createElement(Dialog.Content, null, /* @__PURE__ */ React.createElement("div", {
|
|
15
|
+
role: "none",
|
|
16
|
+
className: "flex justify-between mb-1 pt-3 ps-2 pe-3 @md:pt-4 @md:ps-4 @md:pe-5"
|
|
17
|
+
}, /* @__PURE__ */ React.createElement(Dialog.Title, null, t("shortcuts dialog title")), /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
18
|
+
asChild: true
|
|
19
|
+
}, /* @__PURE__ */ React.createElement(IconButton, {
|
|
20
|
+
icon: "ph--x--bold",
|
|
21
|
+
iconOnly: true,
|
|
22
|
+
size: 3,
|
|
23
|
+
label: "Close",
|
|
24
|
+
variant: "ghost",
|
|
25
|
+
autoFocus: true
|
|
26
|
+
}))), /* @__PURE__ */ React.createElement("div", {
|
|
27
|
+
className: "flex items-center justify-center"
|
|
28
|
+
}, /* @__PURE__ */ React.createElement(ShortcutsList, null)));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/containers/ShortcutsDialogContent/index.ts
|
|
32
|
+
var ShortcutsDialogContent_default = ShortcutsDialogContent;
|
|
33
|
+
export {
|
|
34
|
+
ShortcutsDialogContent_default as default
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=ShortcutsDialogContent-SFEN5YKG.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ShortcutsDialogContent/ShortcutsDialogContent.tsx", "../../../src/containers/ShortcutsDialogContent/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Dialog, IconButton, useTranslation } from '@dxos/react-ui';\n\nimport { ShortcutsList } from '../../components';\nimport { meta } from '../../meta';\n\nexport const ShortcutsDialogContent = () => {\n const { t } = useTranslation(meta.id);\n\n return (\n <Dialog.Content>\n <div role='none' className='flex justify-between mb-1 pt-3 ps-2 pe-3 @md:pt-4 @md:ps-4 @md:pe-5'>\n <Dialog.Title>{t('shortcuts dialog title')}</Dialog.Title>\n <Dialog.Close asChild>\n <IconButton icon='ph--x--bold' iconOnly size={3} label='Close' variant='ghost' autoFocus />\n </Dialog.Close>\n </div>\n\n <div className='flex items-center justify-center'>\n <ShortcutsList />\n </div>\n </Dialog.Content>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ShortcutsDialogContent } from './ShortcutsDialogContent';\n\nexport default ShortcutsDialogContent;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,QAAQC,YAAYC,sBAAsB;AAK5C,IAAMC,yBAAyB,MAAA;AACpC,QAAM,EAAEC,EAAC,IAAKC,eAAeC,KAAKC,EAAE;AAEpC,SACE,sBAAA,cAACC,OAAOC,SAAO,MACb,sBAAA,cAACC,OAAAA;IAAIC,MAAK;IAAOC,WAAU;KACzB,sBAAA,cAACJ,OAAOK,OAAK,MAAET,EAAE,wBAAA,CAAA,GACjB,sBAAA,cAACI,OAAOM,OAAK;IAACC,SAAAA;KACZ,sBAAA,cAACC,YAAAA;IAAWC,MAAK;IAAcC,UAAAA;IAASC,MAAM;IAAGC,OAAM;IAAQC,SAAQ;IAAQC,WAAAA;QAInF,sBAAA,cAACZ,OAAAA;IAAIE,WAAU;KACb,sBAAA,cAACW,eAAAA,IAAAA,CAAAA,CAAAA;AAIT;;;ACtBA,IAAA,iCAAeC;",
|
|
6
|
+
"names": ["React", "Dialog", "IconButton", "useTranslation", "ShortcutsDialogContent", "t", "useTranslation", "meta", "id", "Dialog", "Content", "div", "role", "className", "Title", "Close", "asChild", "IconButton", "icon", "iconOnly", "size", "label", "variant", "autoFocus", "ShortcutsList", "ShortcutsDialogContent"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShortcutsHints
|
|
3
|
+
} from "./chunk-VGW5FGD7.mjs";
|
|
4
|
+
import "./chunk-HMLZFBYY.mjs";
|
|
5
|
+
import "./chunk-TEXIV2IJ.mjs";
|
|
6
|
+
|
|
7
|
+
// src/containers/ShortcutsHints/index.ts
|
|
8
|
+
var ShortcutsHints_default = ShortcutsHints;
|
|
9
|
+
export {
|
|
10
|
+
ShortcutsHints_default as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=ShortcutsHints-SUH2FE3T.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ShortcutsHints/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { ShortcutsHints } from './ShortcutsHints';\n\nexport default ShortcutsHints;\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAMA,IAAA,yBAAeA;",
|
|
6
|
+
"names": ["ShortcutsHints"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShortcutsList
|
|
3
|
+
} from "./chunk-VGW5FGD7.mjs";
|
|
4
|
+
import "./chunk-HMLZFBYY.mjs";
|
|
5
|
+
import "./chunk-TEXIV2IJ.mjs";
|
|
6
|
+
|
|
7
|
+
// src/containers/ShortcutsList/index.ts
|
|
8
|
+
var ShortcutsList_default = ShortcutsList;
|
|
9
|
+
export {
|
|
10
|
+
ShortcutsList_default as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=ShortcutsList-4YPEJM33.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/ShortcutsList/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { ShortcutsList } from './ShortcutsList';\n\nexport default ShortcutsList;\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAMA,IAAA,wBAAeA;",
|
|
6
|
+
"names": ["ShortcutsList"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SHORTCUTS_DIALOG
|
|
3
|
+
} from "./chunk-P34WCEMS.mjs";
|
|
4
|
+
import {
|
|
5
|
+
HelpCapabilities,
|
|
6
|
+
HelpOperation
|
|
7
|
+
} from "./chunk-HMLZFBYY.mjs";
|
|
8
|
+
import {
|
|
9
|
+
meta
|
|
10
|
+
} from "./chunk-TEXIV2IJ.mjs";
|
|
11
|
+
|
|
12
|
+
// src/capabilities/app-graph-builder/app-graph-builder.ts
|
|
13
|
+
import * as Effect from "effect/Effect";
|
|
14
|
+
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
15
|
+
import { GraphBuilder, NodeMatcher } from "@dxos/app-graph";
|
|
16
|
+
import { AppCapabilities, LayoutOperation } from "@dxos/app-toolkit";
|
|
17
|
+
import { Operation } from "@dxos/operation";
|
|
18
|
+
var app_graph_builder_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
19
|
+
const extensions = yield* GraphBuilder.createExtension({
|
|
20
|
+
id: meta.id,
|
|
21
|
+
match: NodeMatcher.whenRoot,
|
|
22
|
+
actions: () => Effect.succeed([
|
|
23
|
+
{
|
|
24
|
+
id: HelpOperation.Start.meta.key,
|
|
25
|
+
data: Effect.fnUntraced(function* () {
|
|
26
|
+
yield* Capabilities.updateAtomValue(HelpCapabilities.State, (s) => ({
|
|
27
|
+
...s,
|
|
28
|
+
showHints: true
|
|
29
|
+
}));
|
|
30
|
+
yield* Operation.invoke(HelpOperation.Start);
|
|
31
|
+
}),
|
|
32
|
+
properties: {
|
|
33
|
+
label: [
|
|
34
|
+
"open help tour",
|
|
35
|
+
{
|
|
36
|
+
ns: meta.id
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
icon: "ph--info--regular",
|
|
40
|
+
keyBinding: {
|
|
41
|
+
macos: "shift+meta+/",
|
|
42
|
+
windows: "shift+ctrl+/",
|
|
43
|
+
linux: "shift+ctrl+?"
|
|
44
|
+
},
|
|
45
|
+
testId: "helpPlugin.openHelp"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: `${meta.id}.open-shortcuts`,
|
|
50
|
+
data: Effect.fnUntraced(function* () {
|
|
51
|
+
yield* Capabilities.updateAtomValue(HelpCapabilities.State, (s) => ({
|
|
52
|
+
...s,
|
|
53
|
+
showHints: true
|
|
54
|
+
}));
|
|
55
|
+
yield* Operation.invoke(LayoutOperation.UpdateDialog, {
|
|
56
|
+
subject: SHORTCUTS_DIALOG
|
|
57
|
+
});
|
|
58
|
+
}),
|
|
59
|
+
properties: {
|
|
60
|
+
label: [
|
|
61
|
+
"open shortcuts label",
|
|
62
|
+
{
|
|
63
|
+
ns: meta.id
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
icon: "ph--keyboard--regular",
|
|
67
|
+
keyBinding: {
|
|
68
|
+
macos: "meta+ctrl+/"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
])
|
|
73
|
+
});
|
|
74
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
75
|
+
}));
|
|
76
|
+
export {
|
|
77
|
+
app_graph_builder_default as default
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=app-graph-builder-5RXPFQPI.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/app-graph-builder/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { GraphBuilder, NodeMatcher } from '@dxos/app-graph';\nimport { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';\nimport { Operation } from '@dxos/operation';\n\nimport { SHORTCUTS_DIALOG } from '../../constants';\nimport { meta } from '../../meta';\nimport { HelpCapabilities, HelpOperation } from '../../types';\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const extensions = yield* GraphBuilder.createExtension({\n id: meta.id,\n match: NodeMatcher.whenRoot,\n actions: () =>\n Effect.succeed([\n {\n id: HelpOperation.Start.meta.key,\n data: Effect.fnUntraced(function* () {\n yield* Capabilities.updateAtomValue(HelpCapabilities.State, (s) => ({ ...s, showHints: true }));\n yield* Operation.invoke(HelpOperation.Start);\n }),\n properties: {\n label: ['open help tour', { ns: meta.id }],\n icon: 'ph--info--regular',\n keyBinding: {\n macos: 'shift+meta+/',\n windows: 'shift+ctrl+/',\n linux: 'shift+ctrl+?',\n },\n testId: 'helpPlugin.openHelp',\n },\n },\n {\n id: `${meta.id}.open-shortcuts`,\n data: Effect.fnUntraced(function* () {\n yield* Capabilities.updateAtomValue(HelpCapabilities.State, (s) => ({ ...s, showHints: true }));\n yield* Operation.invoke(LayoutOperation.UpdateDialog, {\n subject: SHORTCUTS_DIALOG,\n });\n }),\n properties: {\n label: ['open shortcuts label', { ns: meta.id }],\n icon: 'ph--keyboard--regular',\n keyBinding: {\n macos: 'meta+ctrl+/',\n },\n },\n },\n ]),\n });\n\n return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,cAAcC,mBAAmB;AAC1C,SAASC,iBAAiBC,uBAAuB;AACjD,SAASC,iBAAiB;AAM1B,IAAA,4BAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAChB,QAAMC,aAAa,OAAOC,aAAaC,gBAAgB;IACrDC,IAAIC,KAAKD;IACTE,OAAOC,YAAYC;IACnBC,SAAS,MACAC,eAAQ;MACb;QACEN,IAAIO,cAAcC,MAAMP,KAAKQ;QAC7BC,MAAad,kBAAW,aAAA;AACtB,iBAAOe,aAAaC,gBAAgBC,iBAAiBC,OAAO,CAACC,OAAO;YAAE,GAAGA;YAAGC,WAAW;UAAK,EAAA;AAC5F,iBAAOC,UAAUC,OAAOX,cAAcC,KAAK;QAC7C,CAAA;QACAW,YAAY;UACVC,OAAO;YAAC;YAAkB;cAAEC,IAAIpB,KAAKD;YAAG;;UACxCsB,MAAM;UACNC,YAAY;YACVC,OAAO;YACPC,SAAS;YACTC,OAAO;UACT;UACAC,QAAQ;QACV;MACF;MACA;QACE3B,IAAI,GAAGC,KAAKD,EAAE;QACdU,MAAad,kBAAW,aAAA;AACtB,iBAAOe,aAAaC,gBAAgBC,iBAAiBC,OAAO,CAACC,OAAO;YAAE,GAAGA;YAAGC,WAAW;UAAK,EAAA;AAC5F,iBAAOC,UAAUC,OAAOU,gBAAgBC,cAAc;YACpDC,SAASC;UACX,CAAA;QACF,CAAA;QACAZ,YAAY;UACVC,OAAO;YAAC;YAAwB;cAAEC,IAAIpB,KAAKD;YAAG;;UAC9CsB,MAAM;UACNC,YAAY;YACVC,OAAO;UACT;QACF;MACF;KACD;EACL,CAAA;AAEA,SAAO9B,WAAWsC,YAAYC,gBAAgBC,iBAAiBrC,UAAAA;AACjE,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capabilities", "Capability", "GraphBuilder", "NodeMatcher", "AppCapabilities", "LayoutOperation", "Operation", "Capability", "makeModule", "fnUntraced", "extensions", "GraphBuilder", "createExtension", "id", "meta", "match", "NodeMatcher", "whenRoot", "actions", "succeed", "HelpOperation", "Start", "key", "data", "Capabilities", "updateAtomValue", "HelpCapabilities", "State", "s", "showHints", "Operation", "invoke", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "linux", "testId", "LayoutOperation", "UpdateDialog", "subject", "SHORTCUTS_DIALOG", "contributes", "AppCapabilities", "AppGraphBuilder"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
meta
|
|
3
|
+
} from "./chunk-TEXIV2IJ.mjs";
|
|
4
|
+
|
|
5
|
+
// src/types/capabilities.ts
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import { Capability } from "@dxos/app-framework";
|
|
8
|
+
(function(HelpCapabilities2) {
|
|
9
|
+
HelpCapabilities2.StateSchema = Schema.mutable(Schema.Struct({
|
|
10
|
+
running: Schema.Boolean,
|
|
11
|
+
showHints: Schema.Boolean,
|
|
12
|
+
showWelcome: Schema.Boolean
|
|
13
|
+
}));
|
|
14
|
+
HelpCapabilities2.State = Capability.make(`${meta.id}.capability.state`);
|
|
15
|
+
})(HelpCapabilities || (HelpCapabilities = {}));
|
|
16
|
+
var HelpCapabilities;
|
|
17
|
+
|
|
18
|
+
// src/types/schema.ts
|
|
19
|
+
import * as Schema2 from "effect/Schema";
|
|
20
|
+
import { createContext } from "react";
|
|
21
|
+
import { Capability as Capability2 } from "@dxos/app-framework";
|
|
22
|
+
import { Operation } from "@dxos/operation";
|
|
23
|
+
var HelpContext = createContext({
|
|
24
|
+
running: false,
|
|
25
|
+
steps: [],
|
|
26
|
+
setSteps: () => {
|
|
27
|
+
},
|
|
28
|
+
setIndex: () => {
|
|
29
|
+
},
|
|
30
|
+
start: () => {
|
|
31
|
+
},
|
|
32
|
+
stop: () => {
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
var HELP_OPERATION = `${meta.id}.operation`;
|
|
36
|
+
(function(HelpOperation2) {
|
|
37
|
+
HelpOperation2.Start = Operation.make({
|
|
38
|
+
meta: {
|
|
39
|
+
key: `${HELP_OPERATION}.start`,
|
|
40
|
+
name: "Start Help"
|
|
41
|
+
},
|
|
42
|
+
services: [
|
|
43
|
+
Capability2.Service
|
|
44
|
+
],
|
|
45
|
+
schema: {
|
|
46
|
+
input: Schema2.Void,
|
|
47
|
+
output: Schema2.Void
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
})(HelpOperation || (HelpOperation = {}));
|
|
51
|
+
var HelpOperation;
|
|
52
|
+
|
|
53
|
+
export {
|
|
54
|
+
HelpCapabilities,
|
|
55
|
+
HelpContext,
|
|
56
|
+
HelpOperation
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=chunk-HMLZFBYY.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/capabilities.ts", "../../../src/types/schema.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Atom } from '@effect-atom/atom-react';\nimport * as Schema from 'effect/Schema';\n\nimport { Capability } from '@dxos/app-framework';\n\nimport { meta } from '../meta';\n\nexport namespace HelpCapabilities {\n export const StateSchema = Schema.mutable(\n Schema.Struct({\n running: Schema.Boolean,\n showHints: Schema.Boolean,\n showWelcome: Schema.Boolean,\n }),\n );\n\n export type State = Schema.Schema.Type<typeof StateSchema>;\n\n export const State = Capability.make<Atom.Writable<State>>(`${meta.id}.capability.state`);\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\nimport { type Context, createContext } from 'react';\nimport { type Step as BaseStep } from 'react-joyride';\n\nimport { Capability, type CapabilityManager } from '@dxos/app-framework';\nimport { Operation } from '@dxos/operation';\n\nimport { meta } from '../meta';\n\nexport type Step = BaseStep & {\n before?: (capabilities: CapabilityManager.CapabilityManager) => void;\n};\n\nexport type HelpContextType = {\n running: boolean;\n steps: Step[];\n setSteps: (steps: Step[]) => void;\n setIndex: (index: number) => void;\n start: () => void;\n stop: () => void;\n};\n\nexport const HelpContext: Context<HelpContextType> = createContext<HelpContextType>({\n running: false,\n steps: [],\n setSteps: () => {},\n setIndex: () => {},\n start: () => {},\n stop: () => {},\n});\n\nconst HELP_OPERATION = `${meta.id}.operation`;\n\nexport namespace HelpOperation {\n export const Start = Operation.make({\n meta: { key: `${HELP_OPERATION}.start`, name: 'Start Help' },\n services: [Capability.Service],\n schema: { input: Schema.Void, output: Schema.Void },\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAKA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;UAIVC,mBAAAA;oBACFC,cAAqBC,eACzBC,cAAO;IACZC,SAAgBC;IAChBC,WAAkBD;IAClBE,aAAoBF;EACtB,CAAA,CAAA;oBAKWG,QAAQC,WAAWC,KAA2B,GAAGC,KAAKC,EAAE,mBAAmB;AAC1F,GAZiBZ,qBAAAA,mBAAAA,CAAAA,EAAAA;;;;ACPjB,YAAYa,aAAY;AACxB,SAAuBC,qBAAqB;AAG5C,SAASC,cAAAA,mBAA0C;AACnD,SAASC,iBAAiB;AAiBnB,IAAMC,cAAwCC,cAA+B;EAClFC,SAAS;EACTC,OAAO,CAAA;EACPC,UAAU,MAAA;EAAO;EACjBC,UAAU,MAAA;EAAO;EACjBC,OAAO,MAAA;EAAO;EACdC,MAAM,MAAA;EAAO;AACf,CAAA;AAEA,IAAMC,iBAAiB,GAAGC,KAAKC,EAAE;UAEhBC,gBAAAA;iBACFC,QAAQC,UAAUC,KAAK;IAClCL,MAAM;MAAEM,KAAK,GAAGP,cAAAA;MAAwBQ,MAAM;IAAa;IAC3DC,UAAU;MAACC,YAAWC;;IACtBC,QAAQ;MAAEC,OAAcC;MAAMC,QAAeD;IAAK;EACpD,CAAA;AACF,GANiBX,kBAAAA,gBAAAA,CAAAA,EAAAA;;",
|
|
6
|
+
"names": ["Schema", "Capability", "HelpCapabilities", "StateSchema", "mutable", "Struct", "running", "Boolean", "showHints", "showWelcome", "State", "Capability", "make", "meta", "id", "Schema", "createContext", "Capability", "Operation", "HelpContext", "createContext", "running", "steps", "setSteps", "setIndex", "start", "stop", "HELP_OPERATION", "meta", "id", "HelpOperation", "Start", "Operation", "make", "key", "name", "services", "Capability", "Service", "schema", "input", "Void", "output"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/constants.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { meta } from './meta';\n\nexport const SHORTCUTS_DIALOG = `${meta.id}.ShortcutsDialog`;\n"],
|
|
5
|
+
"mappings": ";;;;;AAMO,IAAMA,mBAAmB,GAAGC,KAAKC,EAAE;",
|
|
6
|
+
"names": ["SHORTCUTS_DIALOG", "meta", "id"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// src/meta.ts
|
|
2
|
+
import { trim } from "@dxos/util";
|
|
3
|
+
var meta = {
|
|
4
|
+
id: "org.dxos.plugin.help",
|
|
5
|
+
name: "Help",
|
|
6
|
+
description: trim`
|
|
7
|
+
Built-in help system with documentation, tutorials, and contextual assistance.
|
|
8
|
+
Access keyboard shortcuts, feature guides, and support resources.
|
|
9
|
+
`,
|
|
10
|
+
icon: "ph--info--regular"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
meta
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-TEXIV2IJ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'org.dxos.plugin.help',\n name: 'Help',\n description: trim`\n Built-in help system with documentation, tutorials, and contextual assistance.\n Access keyboard shortcuts, feature guides, and support resources.\n `,\n icon: 'ph--info--regular',\n};\n"],
|
|
5
|
+
"mappings": ";AAKA,SAASA,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;AACR;",
|
|
6
|
+
"names": ["trim", "meta", "id", "name", "description", "trim", "icon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HelpContext
|
|
3
|
+
} from "./chunk-HMLZFBYY.mjs";
|
|
4
|
+
import {
|
|
5
|
+
meta
|
|
6
|
+
} from "./chunk-TEXIV2IJ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/components/Shortcuts/Key.tsx
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { keySymbols } from "@dxos/keyboard";
|
|
11
|
+
|
|
12
|
+
// src/components/Shortcuts/styles.ts
|
|
13
|
+
import { mx } from "@dxos/ui-theme";
|
|
14
|
+
var shortcutKey = mx("inline-flex min-w-[24px] h-[24px] px-0.5 justify-center items-center text-xs", "rounded-sm bg-neutral-100 dark:bg-neutral-900");
|
|
15
|
+
|
|
16
|
+
// src/components/Shortcuts/Key.tsx
|
|
17
|
+
var Key = ({ binding }) => {
|
|
18
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
19
|
+
role: "term",
|
|
20
|
+
className: "inline-flex gap-1",
|
|
21
|
+
"aria-label": binding,
|
|
22
|
+
id: binding
|
|
23
|
+
}, keySymbols(binding).map((c, i) => /* @__PURE__ */ React.createElement("span", {
|
|
24
|
+
key: i,
|
|
25
|
+
className: shortcutKey
|
|
26
|
+
}, c)));
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// src/components/Shortcuts/ShortcutsHints.tsx
|
|
30
|
+
import React2 from "react";
|
|
31
|
+
import { Keyboard } from "@dxos/keyboard";
|
|
32
|
+
import { IconButton, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
33
|
+
import { osTranslations } from "@dxos/ui-theme";
|
|
34
|
+
var Shortcut = ({ binding }) => {
|
|
35
|
+
const { t } = useTranslation(osTranslations);
|
|
36
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
37
|
+
role: "none",
|
|
38
|
+
className: "flex items-center gap-2 whitespace-nowrap"
|
|
39
|
+
}, /* @__PURE__ */ React2.createElement(Key, {
|
|
40
|
+
binding: binding.shortcut
|
|
41
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
42
|
+
className: "text-sm"
|
|
43
|
+
}, toLocalizedString(binding.data, t)));
|
|
44
|
+
};
|
|
45
|
+
var ShortcutsHints = ({ onClose }) => {
|
|
46
|
+
const defaults = [
|
|
47
|
+
"meta+k",
|
|
48
|
+
"meta+/",
|
|
49
|
+
"meta+,"
|
|
50
|
+
];
|
|
51
|
+
const bindings = Keyboard.singleton.getBindings();
|
|
52
|
+
const hints = bindings.filter((binding) => defaults.includes(binding.shortcut));
|
|
53
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
54
|
+
role: "none",
|
|
55
|
+
className: "flex overflow-hidden px-2 gap-4"
|
|
56
|
+
}, hints.map((binding) => /* @__PURE__ */ React2.createElement(Shortcut, {
|
|
57
|
+
key: binding.shortcut,
|
|
58
|
+
binding
|
|
59
|
+
})), onClose && /* @__PURE__ */ React2.createElement(IconButton, {
|
|
60
|
+
icon: "ph--x--regular",
|
|
61
|
+
size: 4,
|
|
62
|
+
label: "Close",
|
|
63
|
+
iconOnly: true,
|
|
64
|
+
noTooltip: true,
|
|
65
|
+
variant: "ghost",
|
|
66
|
+
classNames: "p-0 cursor-pointer",
|
|
67
|
+
onClick: onClose
|
|
68
|
+
}));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/components/Shortcuts/ShortcutsList.tsx
|
|
72
|
+
import React3, { Fragment } from "react";
|
|
73
|
+
import { Keyboard as Keyboard2 } from "@dxos/keyboard";
|
|
74
|
+
import { toLocalizedString as toLocalizedString2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
75
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
76
|
+
var ShortcutsList = () => {
|
|
77
|
+
const { t } = useTranslation2(meta.id);
|
|
78
|
+
const bindings = Keyboard2.singleton.getBindings();
|
|
79
|
+
bindings.sort((a, b) => {
|
|
80
|
+
return toLocalizedString2(a.data, t)?.toLowerCase().localeCompare(toLocalizedString2(b.data, t)?.toLowerCase());
|
|
81
|
+
});
|
|
82
|
+
return /* @__PURE__ */ React3.createElement("dl", {
|
|
83
|
+
className: mx2("w-fit grid grid-cols-[min-content_minmax(12rem,1fr)] gap-2 my-4 text-subdued select-none")
|
|
84
|
+
}, bindings.map((binding, i) => /* @__PURE__ */ React3.createElement(Fragment, {
|
|
85
|
+
key: i
|
|
86
|
+
}, /* @__PURE__ */ React3.createElement(Key, {
|
|
87
|
+
binding: binding.shortcut
|
|
88
|
+
}), /* @__PURE__ */ React3.createElement("span", {
|
|
89
|
+
role: "definition",
|
|
90
|
+
className: "ms-4",
|
|
91
|
+
"aria-labelledby": binding.shortcut
|
|
92
|
+
}, toLocalizedString2(binding.data, t)))));
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/components/Shortcuts/ShortcutsSection.tsx
|
|
96
|
+
import React4 from "react";
|
|
97
|
+
var ShortcutsSection = () => {
|
|
98
|
+
return /* @__PURE__ */ React4.createElement("section", {
|
|
99
|
+
className: "text-description"
|
|
100
|
+
}, /* @__PURE__ */ React4.createElement(ShortcutsList, null));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
104
|
+
import { useArrowNavigationGroup, useFocusableGroup } from "@fluentui/react-tabster";
|
|
105
|
+
import React5, { forwardRef } from "react";
|
|
106
|
+
import { Button, Icon, IconButton as IconButton2 } from "@dxos/react-ui";
|
|
107
|
+
var floaterProps = {
|
|
108
|
+
styles: {
|
|
109
|
+
// Arrow color is set by joyride.
|
|
110
|
+
arrow: {
|
|
111
|
+
length: 8,
|
|
112
|
+
spread: 16
|
|
113
|
+
},
|
|
114
|
+
floater: {
|
|
115
|
+
// TODO(burdon): Get tokens from theme.
|
|
116
|
+
filter: "drop-shadow(0 0 0.75rem rgba(0, 0, 0, 0.2))"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
var Tooltip = /* @__PURE__ */ forwardRef(({ step: { title, content }, index, size, isLastStep, backProps, closeProps, primaryProps }, forwardedRef) => {
|
|
121
|
+
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
122
|
+
axis: "horizontal"
|
|
123
|
+
});
|
|
124
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
125
|
+
tabBehavior: "limited-trap-focus"
|
|
126
|
+
});
|
|
127
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
128
|
+
className: "flex flex-col w-[15rem] min-h-[10rem] overflow-hidden rounded-md shadow-xl bg-accent-surface text-accent-surface-text",
|
|
129
|
+
role: "tooltip",
|
|
130
|
+
"data-testid": "helpPlugin.tooltip",
|
|
131
|
+
"data-step": index + 1,
|
|
132
|
+
...focusableGroupAttrs,
|
|
133
|
+
ref: forwardedRef
|
|
134
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
135
|
+
className: "flex p-2"
|
|
136
|
+
}, /* @__PURE__ */ React5.createElement("h2", {
|
|
137
|
+
className: "grow px-2 py-1 text-lg font-medium text-accent-surface-text"
|
|
138
|
+
}, title), /* @__PURE__ */ React5.createElement(IconButton2, {
|
|
139
|
+
density: "fine",
|
|
140
|
+
icon: "ph--x--bold",
|
|
141
|
+
iconOnly: true,
|
|
142
|
+
label: closeProps["aria-label"],
|
|
143
|
+
onClick: closeProps.onClick,
|
|
144
|
+
size: 4,
|
|
145
|
+
variant: "primary",
|
|
146
|
+
"data-testid": "helpPlugin.tooltip.close"
|
|
147
|
+
})), /* @__PURE__ */ React5.createElement("div", {
|
|
148
|
+
className: "flex grow px-4 my-2"
|
|
149
|
+
}, content), /* @__PURE__ */ React5.createElement("div", {
|
|
150
|
+
className: "flex p-2 items-center justify-between",
|
|
151
|
+
...arrowNavigationAttrs
|
|
152
|
+
}, /* @__PURE__ */ React5.createElement(IconButton2, {
|
|
153
|
+
classNames: [
|
|
154
|
+
!(index > 0 && backProps) && "invisible"
|
|
155
|
+
],
|
|
156
|
+
icon: "ph--caret-left--regular",
|
|
157
|
+
iconOnly: true,
|
|
158
|
+
label: backProps["aria-label"],
|
|
159
|
+
onClick: backProps.onClick,
|
|
160
|
+
variant: "primary",
|
|
161
|
+
"data-testid": "helpPlugin.tooltip.back"
|
|
162
|
+
}), /* @__PURE__ */ React5.createElement("div", {
|
|
163
|
+
className: "flex grow gap-2 justify-center"
|
|
164
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
165
|
+
className: "flex"
|
|
166
|
+
}, Array.from({
|
|
167
|
+
length: size
|
|
168
|
+
}).map((_, i) => /* @__PURE__ */ React5.createElement(Icon, {
|
|
169
|
+
key: i,
|
|
170
|
+
icon: index === i ? "ph--circle--fill" : "ph--circle--regular",
|
|
171
|
+
size: 2,
|
|
172
|
+
classNames: "mx-1 cursor-pointer"
|
|
173
|
+
})))), isLastStep ? /* @__PURE__ */ React5.createElement(Button, {
|
|
174
|
+
variant: "primary",
|
|
175
|
+
onClick: closeProps.onClick,
|
|
176
|
+
title: closeProps["aria-label"],
|
|
177
|
+
autoFocus: true,
|
|
178
|
+
"data-testid": "helpPlugin.tooltip.finish"
|
|
179
|
+
}, "Done") : /* @__PURE__ */ React5.createElement(IconButton2, {
|
|
180
|
+
autoFocus: true,
|
|
181
|
+
icon: "ph--caret-right--regular",
|
|
182
|
+
iconOnly: true,
|
|
183
|
+
label: primaryProps["aria-label"],
|
|
184
|
+
onClick: primaryProps.onClick,
|
|
185
|
+
size: 6,
|
|
186
|
+
variant: "primary",
|
|
187
|
+
"data-testid": "helpPlugin.tooltip.next"
|
|
188
|
+
})));
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// src/components/WelcomeTour/WelcomeTour.tsx
|
|
192
|
+
import React6, { useState } from "react";
|
|
193
|
+
import Joyride, { ACTIONS, EVENTS } from "react-joyride";
|
|
194
|
+
import { usePluginManager } from "@dxos/app-framework/ui";
|
|
195
|
+
import { useLayout } from "@dxos/app-toolkit/ui";
|
|
196
|
+
import { useAsyncEffect } from "@dxos/react-ui";
|
|
197
|
+
var addStepClass = (target) => {
|
|
198
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
199
|
+
if (element) {
|
|
200
|
+
element.classList.add("joyride-target");
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
var removeTargetClass = (target) => {
|
|
204
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
205
|
+
if (element) {
|
|
206
|
+
element.classList.remove("joyride-target");
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
var getTarget = (step) => {
|
|
210
|
+
return typeof step.target === "string" ? document.querySelector(step.target) : step.target;
|
|
211
|
+
};
|
|
212
|
+
var waitForTarget = async (step) => {
|
|
213
|
+
if (typeof step.target === "string") {
|
|
214
|
+
const target = step.target;
|
|
215
|
+
const element = document.querySelector(target);
|
|
216
|
+
if (element) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
await new Promise((resolve) => {
|
|
220
|
+
const observer = new MutationObserver((mutations) => {
|
|
221
|
+
mutations.forEach((mutation) => {
|
|
222
|
+
if (mutation.addedNodes.length > 0) {
|
|
223
|
+
const element2 = document.querySelector(target);
|
|
224
|
+
if (element2) {
|
|
225
|
+
observer.disconnect();
|
|
226
|
+
resolve();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
observer.observe(document.body, {
|
|
232
|
+
childList: true,
|
|
233
|
+
subtree: true
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
var WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunningChanged }) => {
|
|
239
|
+
const manager = usePluginManager();
|
|
240
|
+
const layout = useLayout();
|
|
241
|
+
const [running, setRunning] = useState(!!runningProp && !!getTarget(initialSteps[0]));
|
|
242
|
+
const [stepIndex, _setStepIndex] = useState(0);
|
|
243
|
+
const [steps, setSteps] = useState(initialSteps);
|
|
244
|
+
const paused = layout.dialogOpen;
|
|
245
|
+
const setStepIndex = (index) => {
|
|
246
|
+
if (runningProp) {
|
|
247
|
+
const step = steps[index];
|
|
248
|
+
step?.before?.(manager.capabilities);
|
|
249
|
+
}
|
|
250
|
+
_setStepIndex(index);
|
|
251
|
+
};
|
|
252
|
+
const setRunningChanged = (state) => {
|
|
253
|
+
if (typeof runningProp !== "undefined") {
|
|
254
|
+
onRunningChanged?.(state);
|
|
255
|
+
} else {
|
|
256
|
+
if (state) {
|
|
257
|
+
setStepIndex(0);
|
|
258
|
+
setRunning(true);
|
|
259
|
+
} else {
|
|
260
|
+
setRunning(false);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
useAsyncEffect(async () => {
|
|
265
|
+
if (runningProp) {
|
|
266
|
+
await waitForTarget(steps[stepIndex]);
|
|
267
|
+
setStepIndex(0);
|
|
268
|
+
setRunning(true);
|
|
269
|
+
} else if (typeof runningProp !== "undefined") {
|
|
270
|
+
setRunning(false);
|
|
271
|
+
}
|
|
272
|
+
}, [
|
|
273
|
+
runningProp
|
|
274
|
+
]);
|
|
275
|
+
const callback = async (options) => {
|
|
276
|
+
const { type, action, index, size } = options;
|
|
277
|
+
switch (type) {
|
|
278
|
+
case EVENTS.STEP_BEFORE:
|
|
279
|
+
addStepClass(options.step.target);
|
|
280
|
+
break;
|
|
281
|
+
case EVENTS.TOUR_END:
|
|
282
|
+
break;
|
|
283
|
+
case EVENTS.STEP_AFTER:
|
|
284
|
+
removeTargetClass(options.step.target);
|
|
285
|
+
switch (action) {
|
|
286
|
+
case ACTIONS.NEXT:
|
|
287
|
+
if (index < size - 1) {
|
|
288
|
+
setStepIndex(index + 1);
|
|
289
|
+
}
|
|
290
|
+
break;
|
|
291
|
+
case ACTIONS.PREV:
|
|
292
|
+
if (index > 0) {
|
|
293
|
+
setStepIndex(index - 1);
|
|
294
|
+
}
|
|
295
|
+
break;
|
|
296
|
+
case ACTIONS.CLOSE:
|
|
297
|
+
setRunningChanged(false);
|
|
298
|
+
setStepIndex(0);
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
return /* @__PURE__ */ React6.createElement(HelpContext.Provider, {
|
|
305
|
+
value: {
|
|
306
|
+
running: running && !paused,
|
|
307
|
+
steps,
|
|
308
|
+
setSteps,
|
|
309
|
+
setIndex: setStepIndex,
|
|
310
|
+
start: () => setRunningChanged(true),
|
|
311
|
+
stop: () => setRunningChanged(false)
|
|
312
|
+
}
|
|
313
|
+
}, /* @__PURE__ */ React6.createElement("style", null, `.joyride-target {
|
|
314
|
+
--controls-opacity: 1;
|
|
315
|
+
}`), /* @__PURE__ */ React6.createElement(Joyride, {
|
|
316
|
+
continuous: true,
|
|
317
|
+
steps,
|
|
318
|
+
stepIndex,
|
|
319
|
+
run: running && !paused,
|
|
320
|
+
callback,
|
|
321
|
+
floaterProps,
|
|
322
|
+
tooltipComponent: Tooltip
|
|
323
|
+
}));
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export {
|
|
327
|
+
Key,
|
|
328
|
+
ShortcutsHints,
|
|
329
|
+
ShortcutsList,
|
|
330
|
+
ShortcutsSection,
|
|
331
|
+
floaterProps,
|
|
332
|
+
Tooltip,
|
|
333
|
+
WelcomeTour
|
|
334
|
+
};
|
|
335
|
+
//# sourceMappingURL=chunk-VGW5FGD7.mjs.map
|