@dxos/plugin-help 0.8.4-main.f5c0578 → 0.8.4-main.fcfe5033a5
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/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-K4LQ2TR7.mjs +34 -0
- package/dist/lib/browser/chunk-K4LQ2TR7.mjs.map +7 -0
- package/dist/lib/browser/chunk-KUUIRJG5.mjs +31 -0
- package/dist/lib/browser/chunk-KUUIRJG5.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/index.mjs +358 -73
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +2 -3
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/start-YZBO346C.mjs +23 -0
- package/dist/lib/browser/start-YZBO346C.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -4
- package/dist/types/src/HelpPlugin.d.ts +3 -2
- package/dist/types/src/HelpPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +16 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-root.d.ts +5 -3
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +11 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- 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 +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.d.ts.map +1 -1
- package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts +9 -4
- package/dist/types/src/components/WelcomeTour/WelcomeTour.stories.d.ts.map +1 -1
- package/dist/types/src/constants.d.ts +2 -0
- package/dist/types/src/constants.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts +3 -0
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.d.ts +25 -0
- package/dist/types/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.d.ts.map +1 -0
- package/dist/types/src/containers/ShortcutsDialogContent/index.d.ts +2 -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 +2 -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 +2 -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/hooks/useHelp.d.ts +1 -1
- package/dist/types/src/hooks/useHelp.d.ts.map +1 -1
- 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 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/definitions.d.ts +4 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/start.d.ts +5 -0
- package/dist/types/src/operations/start.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +5 -5
- package/dist/types/src/translations.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 +2 -14
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +57 -34
- package/src/HelpPlugin.tsx +22 -48
- package/src/capabilities/app-graph-builder.ts +53 -67
- package/src/capabilities/index.ts +10 -7
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-root.tsx +28 -25
- package/src/capabilities/react-surface.tsx +28 -22
- package/src/capabilities/state.ts +19 -16
- package/src/components/Shortcuts/ShortcutsHints.tsx +13 -5
- package/src/components/Shortcuts/ShortcutsList.tsx +5 -5
- 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 +21 -16
- package/src/components/WelcomeTour/WelcomeTour.tsx +17 -18
- package/src/constants.ts +7 -0
- package/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.stories.tsx +38 -0
- package/src/containers/ShortcutsDialogContent/ShortcutsDialogContent.tsx +28 -0
- package/src/containers/ShortcutsDialogContent/index.ts +5 -0
- package/src/containers/ShortcutsHints/ShortcutsHints.tsx +5 -0
- package/src/containers/ShortcutsHints/index.ts +5 -0
- package/src/containers/ShortcutsList/ShortcutsList.tsx +5 -0
- package/src/containers/ShortcutsList/index.ts +5 -0
- package/src/containers/index.ts +9 -0
- package/src/hooks/useHelp.tsx +1 -1
- package/src/index.ts +2 -1
- package/src/meta.ts +8 -6
- package/src/operations/definitions.ts +19 -0
- package/src/operations/index.ts +9 -0
- package/src/operations/start.ts +21 -0
- package/src/translations.ts +5 -5
- package/src/types/capabilities.ts +24 -0
- package/src/types/index.ts +1 -0
- package/src/types/schema.ts +2 -12
- package/dist/lib/browser/app-graph-builder-TUTK2ONB.mjs +0 -79
- package/dist/lib/browser/app-graph-builder-TUTK2ONB.mjs.map +0 -7
- package/dist/lib/browser/chunk-3Y4CMOZP.mjs +0 -13
- package/dist/lib/browser/chunk-3Y4CMOZP.mjs.map +0 -7
- package/dist/lib/browser/chunk-GIDPSFGY.mjs +0 -409
- package/dist/lib/browser/chunk-GIDPSFGY.mjs.map +0 -7
- package/dist/lib/browser/chunk-J2SJSGSX.mjs +0 -34
- package/dist/lib/browser/chunk-J2SJSGSX.mjs.map +0 -7
- package/dist/lib/browser/chunk-LDRUZNSN.mjs +0 -16
- package/dist/lib/browser/chunk-LDRUZNSN.mjs.map +0 -7
- package/dist/lib/browser/react-root-5GSVXKQD.mjs +0 -34
- package/dist/lib/browser/react-root-5GSVXKQD.mjs.map +0 -7
- package/dist/lib/browser/react-surface-V7U4IDJV.mjs +0 -36
- package/dist/lib/browser/react-surface-V7U4IDJV.mjs.map +0 -7
- package/dist/lib/browser/state-IXBTB3WH.mjs +0 -29
- package/dist/lib/browser/state-IXBTB3WH.mjs.map +0 -7
- 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/components/Shortcuts/ShortcutsDialog.d.ts +0 -4
- package/dist/types/src/components/Shortcuts/ShortcutsDialog.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -13
- package/src/components/Shortcuts/ShortcutsDialog.tsx +0 -35
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/types/capabilities.ts
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import { Capability } from "@dxos/app-framework";
|
|
4
|
+
import { meta } from "#meta";
|
|
5
|
+
(function(HelpCapabilities2) {
|
|
6
|
+
HelpCapabilities2.StateSchema = Schema.mutable(Schema.Struct({
|
|
7
|
+
running: Schema.Boolean,
|
|
8
|
+
showHints: Schema.Boolean,
|
|
9
|
+
showWelcome: Schema.Boolean
|
|
10
|
+
}));
|
|
11
|
+
HelpCapabilities2.State = Capability.make(`${meta.id}.capability.state`);
|
|
12
|
+
})(HelpCapabilities || (HelpCapabilities = {}));
|
|
13
|
+
var HelpCapabilities;
|
|
14
|
+
|
|
15
|
+
// src/types/schema.ts
|
|
16
|
+
import { createContext } from "react";
|
|
17
|
+
var HelpContext = createContext({
|
|
18
|
+
running: false,
|
|
19
|
+
steps: [],
|
|
20
|
+
setSteps: () => {
|
|
21
|
+
},
|
|
22
|
+
setIndex: () => {
|
|
23
|
+
},
|
|
24
|
+
start: () => {
|
|
25
|
+
},
|
|
26
|
+
stop: () => {
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
HelpCapabilities,
|
|
32
|
+
HelpContext
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-K4LQ2TR7.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 { type Context, createContext } from 'react';\nimport { type Step as BaseStep } from 'react-joyride';\n\nimport { type CapabilityManager } from '@dxos/app-framework';\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"],
|
|
5
|
+
"mappings": ";AAKA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAE3B,SAASC,YAAY;UAEJC,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,SAAuBa,qBAAqB;AAkBrC,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;",
|
|
6
|
+
"names": ["Schema", "Capability", "meta", "HelpCapabilities", "StateSchema", "mutable", "Struct", "running", "Boolean", "showHints", "showWelcome", "State", "Capability", "make", "meta", "id", "createContext", "HelpContext", "createContext", "running", "steps", "setSteps", "setIndex", "start", "stop"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
+
|
|
5
|
+
// src/operations/definitions.ts
|
|
6
|
+
var definitions_exports = {};
|
|
7
|
+
__export(definitions_exports, {
|
|
8
|
+
Start: () => Start
|
|
9
|
+
});
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import { Capability } from "@dxos/app-framework";
|
|
12
|
+
import { Operation } from "@dxos/operation";
|
|
13
|
+
import { meta } from "#meta";
|
|
14
|
+
var HELP_OPERATION = `${meta.id}.operation`;
|
|
15
|
+
var Start = Operation.make({
|
|
16
|
+
meta: {
|
|
17
|
+
key: `${HELP_OPERATION}.start`,
|
|
18
|
+
name: "Start Help"
|
|
19
|
+
},
|
|
20
|
+
services: [
|
|
21
|
+
Capability.Service
|
|
22
|
+
],
|
|
23
|
+
input: Schema.Void,
|
|
24
|
+
output: Schema.Void
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
Start,
|
|
29
|
+
definitions_exports
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=chunk-KUUIRJG5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/operations/definitions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Capability } from '@dxos/app-framework';\nimport { Operation } from '@dxos/operation';\n\nimport { meta } from '#meta';\n\nconst HELP_OPERATION = `${meta.id}.operation`;\n\nexport const Start = Operation.make({\n meta: { key: `${HELP_OPERATION}.start`, name: 'Start Help' },\n services: [Capability.Service],\n input: Schema.Void,\n output: Schema.Void,\n});\n"],
|
|
5
|
+
"mappings": ";;;;;AAAA;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAE1B,SAASC,YAAY;AAErB,IAAMC,iBAAiB,GAAGC,KAAKC,EAAE;AAE1B,IAAMC,QAAQC,UAAUC,KAAK;EAClCJ,MAAM;IAAEK,KAAK,GAAGN,cAAAA;IAAwBO,MAAM;EAAa;EAC3DC,UAAU;IAACC,WAAWC;;EACtBC,OAAcC;EACdC,QAAeD;AACjB,CAAA;",
|
|
6
|
+
"names": ["Schema", "Capability", "Operation", "meta", "HELP_OPERATION", "meta", "id", "Start", "Operation", "make", "key", "name", "services", "Capability", "Service", "input", "Void", "output"]
|
|
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
|
+
}
|
|
@@ -1,105 +1,390 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
ShortcutsDialogContent,
|
|
5
|
-
ShortcutsHints,
|
|
6
|
-
ShortcutsList,
|
|
7
|
-
ShortcutsSection,
|
|
8
|
-
Tooltip,
|
|
9
|
-
WelcomeTour,
|
|
10
|
-
floaterProps
|
|
11
|
-
} from "./chunk-GIDPSFGY.mjs";
|
|
2
|
+
meta
|
|
3
|
+
} from "./chunk-TEXIV2IJ.mjs";
|
|
12
4
|
import {
|
|
13
|
-
|
|
5
|
+
HelpCapabilities,
|
|
14
6
|
HelpContext
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import
|
|
17
|
-
HelpCapabilities
|
|
18
|
-
} from "./chunk-LDRUZNSN.mjs";
|
|
19
|
-
import {
|
|
20
|
-
HELP_PLUGIN,
|
|
21
|
-
meta
|
|
22
|
-
} from "./chunk-3Y4CMOZP.mjs";
|
|
7
|
+
} from "./chunk-K4LQ2TR7.mjs";
|
|
8
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
23
9
|
|
|
24
|
-
// src/
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
// src/components/Shortcuts/ShortcutsHints.tsx
|
|
11
|
+
import React2 from "react";
|
|
12
|
+
import { Keyboard } from "@dxos/keyboard";
|
|
13
|
+
import { IconButton, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
14
|
+
import { osTranslations } from "@dxos/ui-theme";
|
|
15
|
+
|
|
16
|
+
// src/components/Shortcuts/Key.tsx
|
|
17
|
+
import React from "react";
|
|
18
|
+
import { keySymbols } from "@dxos/keyboard";
|
|
19
|
+
|
|
20
|
+
// src/components/Shortcuts/styles.ts
|
|
21
|
+
import { mx } from "@dxos/ui-theme";
|
|
22
|
+
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");
|
|
23
|
+
|
|
24
|
+
// src/components/Shortcuts/Key.tsx
|
|
25
|
+
var Key = ({ binding }) => {
|
|
26
|
+
return /* @__PURE__ */ React.createElement("span", {
|
|
27
|
+
role: "term",
|
|
28
|
+
className: "inline-flex gap-1",
|
|
29
|
+
"aria-label": binding,
|
|
30
|
+
id: binding
|
|
31
|
+
}, keySymbols(binding).map((c, i) => /* @__PURE__ */ React.createElement("span", {
|
|
32
|
+
key: i,
|
|
33
|
+
className: shortcutKey
|
|
34
|
+
}, c)));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/components/Shortcuts/ShortcutsHints.tsx
|
|
38
|
+
var Shortcut = ({ binding }) => {
|
|
39
|
+
const { t } = useTranslation(osTranslations);
|
|
40
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
41
|
+
role: "none",
|
|
42
|
+
className: "flex items-center gap-2 whitespace-nowrap"
|
|
43
|
+
}, /* @__PURE__ */ React2.createElement(Key, {
|
|
44
|
+
binding: binding.shortcut
|
|
45
|
+
}), /* @__PURE__ */ React2.createElement("span", {
|
|
46
|
+
className: "text-sm"
|
|
47
|
+
}, toLocalizedString(binding.data, t)));
|
|
48
|
+
};
|
|
49
|
+
var ShortcutsHints = ({ onClose }) => {
|
|
50
|
+
const defaults = [
|
|
51
|
+
"meta+k",
|
|
52
|
+
"meta+/",
|
|
53
|
+
"meta+,"
|
|
54
|
+
];
|
|
55
|
+
const bindings = Keyboard.singleton.getBindings();
|
|
56
|
+
const hints = bindings.filter((binding) => defaults.includes(binding.shortcut));
|
|
57
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
58
|
+
role: "none",
|
|
59
|
+
className: "flex overflow-hidden px-2 gap-4"
|
|
60
|
+
}, hints.map((binding) => /* @__PURE__ */ React2.createElement(Shortcut, {
|
|
61
|
+
key: binding.shortcut,
|
|
62
|
+
binding
|
|
63
|
+
})), onClose && /* @__PURE__ */ React2.createElement(IconButton, {
|
|
64
|
+
icon: "ph--x--regular",
|
|
65
|
+
size: 4,
|
|
66
|
+
label: "Close",
|
|
67
|
+
iconOnly: true,
|
|
68
|
+
noTooltip: true,
|
|
69
|
+
variant: "ghost",
|
|
70
|
+
classNames: "p-0 cursor-pointer",
|
|
71
|
+
onClick: onClose
|
|
72
|
+
}));
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// src/components/Shortcuts/ShortcutsList.tsx
|
|
76
|
+
import React3, { Fragment } from "react";
|
|
77
|
+
import { Keyboard as Keyboard2 } from "@dxos/keyboard";
|
|
78
|
+
import { toLocalizedString as toLocalizedString2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
79
|
+
import { mx as mx2 } from "@dxos/ui-theme";
|
|
80
|
+
import { meta as meta2 } from "#meta";
|
|
81
|
+
var ShortcutsList = () => {
|
|
82
|
+
const { t } = useTranslation2(meta2.id);
|
|
83
|
+
const bindings = Keyboard2.singleton.getBindings();
|
|
84
|
+
bindings.sort((a, b) => {
|
|
85
|
+
return toLocalizedString2(a.data, t)?.toLowerCase().localeCompare(toLocalizedString2(b.data, t)?.toLowerCase());
|
|
86
|
+
});
|
|
87
|
+
return /* @__PURE__ */ React3.createElement("dl", {
|
|
88
|
+
className: mx2("w-fit grid grid-cols-[min-content_minmax(12rem,1fr)] gap-2 my-4 text-subdued select-none")
|
|
89
|
+
}, bindings.map((binding, i) => /* @__PURE__ */ React3.createElement(Fragment, {
|
|
90
|
+
key: i
|
|
91
|
+
}, /* @__PURE__ */ React3.createElement(Key, {
|
|
92
|
+
binding: binding.shortcut
|
|
93
|
+
}), /* @__PURE__ */ React3.createElement("span", {
|
|
94
|
+
role: "definition",
|
|
95
|
+
className: "ms-4",
|
|
96
|
+
"aria-labelledby": binding.shortcut
|
|
97
|
+
}, toLocalizedString2(binding.data, t)))));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// src/components/Shortcuts/ShortcutsSection.tsx
|
|
101
|
+
import React4 from "react";
|
|
102
|
+
var ShortcutsSection = () => {
|
|
103
|
+
return /* @__PURE__ */ React4.createElement("section", {
|
|
104
|
+
className: "text-description"
|
|
105
|
+
}, /* @__PURE__ */ React4.createElement(ShortcutsList, null));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
109
|
+
import { useArrowNavigationGroup, useFocusableGroup } from "@fluentui/react-tabster";
|
|
110
|
+
import React5, { forwardRef } from "react";
|
|
111
|
+
import { Button, Icon, IconButton as IconButton2 } from "@dxos/react-ui";
|
|
112
|
+
var floaterProps = {
|
|
113
|
+
styles: {
|
|
114
|
+
// Arrow color is set by joyride.
|
|
115
|
+
arrow: {
|
|
116
|
+
length: 8,
|
|
117
|
+
spread: 16
|
|
118
|
+
},
|
|
119
|
+
floater: {
|
|
120
|
+
// TODO(burdon): Get tokens from theme.
|
|
121
|
+
filter: "drop-shadow(0 0 0.75rem rgba(0, 0, 0, 0.2))"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
var Tooltip = /* @__PURE__ */ forwardRef(({ step: { title, content }, index, size, isLastStep, backProps, closeProps, primaryProps }, forwardedRef) => {
|
|
126
|
+
const arrowNavigationAttrs = useArrowNavigationGroup({
|
|
127
|
+
axis: "horizontal"
|
|
128
|
+
});
|
|
129
|
+
const focusableGroupAttrs = useFocusableGroup({
|
|
130
|
+
tabBehavior: "limited-trap-focus"
|
|
131
|
+
});
|
|
132
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
133
|
+
className: "flex flex-col w-[15rem] min-h-[10rem] overflow-hidden rounded-md shadow-xl bg-accent-surface text-accent-surface-text",
|
|
134
|
+
role: "tooltip",
|
|
135
|
+
"data-testid": "helpPlugin.tooltip",
|
|
136
|
+
"data-step": index + 1,
|
|
137
|
+
...focusableGroupAttrs,
|
|
138
|
+
ref: forwardedRef
|
|
139
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
140
|
+
className: "flex p-2"
|
|
141
|
+
}, /* @__PURE__ */ React5.createElement("h2", {
|
|
142
|
+
className: "grow px-2 py-1 text-lg font-medium text-accent-surface-text"
|
|
143
|
+
}, title), /* @__PURE__ */ React5.createElement(IconButton2, {
|
|
144
|
+
density: "fine",
|
|
145
|
+
icon: "ph--x--bold",
|
|
146
|
+
iconOnly: true,
|
|
147
|
+
label: closeProps["aria-label"],
|
|
148
|
+
onClick: closeProps.onClick,
|
|
149
|
+
size: 4,
|
|
150
|
+
variant: "primary",
|
|
151
|
+
"data-testid": "helpPlugin.tooltip.close"
|
|
152
|
+
})), /* @__PURE__ */ React5.createElement("div", {
|
|
153
|
+
className: "flex grow px-4 my-2"
|
|
154
|
+
}, content), /* @__PURE__ */ React5.createElement("div", {
|
|
155
|
+
className: "flex p-2 items-center justify-between",
|
|
156
|
+
...arrowNavigationAttrs
|
|
157
|
+
}, /* @__PURE__ */ React5.createElement(IconButton2, {
|
|
158
|
+
classNames: [
|
|
159
|
+
!(index > 0 && backProps) && "invisible"
|
|
160
|
+
],
|
|
161
|
+
icon: "ph--caret-left--regular",
|
|
162
|
+
iconOnly: true,
|
|
163
|
+
label: backProps["aria-label"],
|
|
164
|
+
onClick: backProps.onClick,
|
|
165
|
+
variant: "primary",
|
|
166
|
+
"data-testid": "helpPlugin.tooltip.back"
|
|
167
|
+
}), /* @__PURE__ */ React5.createElement("div", {
|
|
168
|
+
className: "flex grow gap-2 justify-center"
|
|
169
|
+
}, /* @__PURE__ */ React5.createElement("div", {
|
|
170
|
+
className: "flex"
|
|
171
|
+
}, Array.from({
|
|
172
|
+
length: size
|
|
173
|
+
}).map((_, i) => /* @__PURE__ */ React5.createElement(Icon, {
|
|
174
|
+
key: i,
|
|
175
|
+
icon: index === i ? "ph--circle--fill" : "ph--circle--regular",
|
|
176
|
+
size: 2,
|
|
177
|
+
classNames: "mx-1 cursor-pointer"
|
|
178
|
+
})))), isLastStep ? /* @__PURE__ */ React5.createElement(Button, {
|
|
179
|
+
variant: "primary",
|
|
180
|
+
onClick: closeProps.onClick,
|
|
181
|
+
title: closeProps["aria-label"],
|
|
182
|
+
autoFocus: true,
|
|
183
|
+
"data-testid": "helpPlugin.tooltip.finish"
|
|
184
|
+
}, "Done") : /* @__PURE__ */ React5.createElement(IconButton2, {
|
|
185
|
+
autoFocus: true,
|
|
186
|
+
icon: "ph--caret-right--regular",
|
|
187
|
+
iconOnly: true,
|
|
188
|
+
label: primaryProps["aria-label"],
|
|
189
|
+
onClick: primaryProps.onClick,
|
|
190
|
+
size: 6,
|
|
191
|
+
variant: "primary",
|
|
192
|
+
"data-testid": "helpPlugin.tooltip.next"
|
|
193
|
+
})));
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// src/components/WelcomeTour/WelcomeTour.tsx
|
|
197
|
+
import React6, { useState } from "react";
|
|
198
|
+
import Joyride, { ACTIONS, EVENTS } from "react-joyride";
|
|
199
|
+
import { usePluginManager } from "@dxos/app-framework/ui";
|
|
200
|
+
import { useLayout } from "@dxos/app-toolkit/ui";
|
|
201
|
+
import { useAsyncEffect } from "@dxos/react-ui";
|
|
202
|
+
import { HelpContext as HelpContext2 } from "#types";
|
|
203
|
+
var addStepClass = (target) => {
|
|
204
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
205
|
+
if (element) {
|
|
206
|
+
element.classList.add("joyride-target");
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
var removeTargetClass = (target) => {
|
|
210
|
+
const element = typeof target === "string" ? document.querySelector(target) : target;
|
|
211
|
+
if (element) {
|
|
212
|
+
element.classList.remove("joyride-target");
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
var getTarget = (step) => {
|
|
216
|
+
return typeof step.target === "string" ? document.querySelector(step.target) : step.target;
|
|
217
|
+
};
|
|
218
|
+
var waitForTarget = async (step) => {
|
|
219
|
+
if (typeof step.target === "string") {
|
|
220
|
+
const target = step.target;
|
|
221
|
+
const element = document.querySelector(target);
|
|
222
|
+
if (element) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
await new Promise((resolve) => {
|
|
226
|
+
const observer = new MutationObserver((mutations) => {
|
|
227
|
+
mutations.forEach((mutation) => {
|
|
228
|
+
if (mutation.addedNodes.length > 0) {
|
|
229
|
+
const element2 = document.querySelector(target);
|
|
230
|
+
if (element2) {
|
|
231
|
+
observer.disconnect();
|
|
232
|
+
resolve();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
observer.observe(document.body, {
|
|
238
|
+
childList: true,
|
|
239
|
+
subtree: true
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
var WelcomeTour = ({ steps: initialSteps, running: runningProp, onRunningChanged }) => {
|
|
245
|
+
const manager = usePluginManager();
|
|
246
|
+
const layout = useLayout();
|
|
247
|
+
const [running, setRunning] = useState(!!runningProp && !!getTarget(initialSteps[0]));
|
|
248
|
+
const [stepIndex, _setStepIndex] = useState(0);
|
|
249
|
+
const [steps, setSteps] = useState(initialSteps);
|
|
250
|
+
const paused = layout.dialogOpen;
|
|
251
|
+
const setStepIndex = (index) => {
|
|
252
|
+
if (runningProp) {
|
|
253
|
+
const step = steps[index];
|
|
254
|
+
step?.before?.(manager.capabilities);
|
|
255
|
+
}
|
|
256
|
+
_setStepIndex(index);
|
|
257
|
+
};
|
|
258
|
+
const setRunningChanged = (state) => {
|
|
259
|
+
if (typeof runningProp !== "undefined") {
|
|
260
|
+
onRunningChanged?.(state);
|
|
261
|
+
} else {
|
|
262
|
+
if (state) {
|
|
263
|
+
setStepIndex(0);
|
|
264
|
+
setRunning(true);
|
|
265
|
+
} else {
|
|
266
|
+
setRunning(false);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
useAsyncEffect(async () => {
|
|
271
|
+
if (runningProp) {
|
|
272
|
+
await waitForTarget(steps[stepIndex]);
|
|
273
|
+
setStepIndex(0);
|
|
274
|
+
setRunning(true);
|
|
275
|
+
} else if (typeof runningProp !== "undefined") {
|
|
276
|
+
setRunning(false);
|
|
277
|
+
}
|
|
278
|
+
}, [
|
|
279
|
+
runningProp
|
|
280
|
+
]);
|
|
281
|
+
const callback = async (options) => {
|
|
282
|
+
const { type, action, index, size } = options;
|
|
283
|
+
switch (type) {
|
|
284
|
+
case EVENTS.STEP_BEFORE:
|
|
285
|
+
addStepClass(options.step.target);
|
|
286
|
+
break;
|
|
287
|
+
case EVENTS.TOUR_END:
|
|
288
|
+
break;
|
|
289
|
+
case EVENTS.STEP_AFTER:
|
|
290
|
+
removeTargetClass(options.step.target);
|
|
291
|
+
switch (action) {
|
|
292
|
+
case ACTIONS.NEXT:
|
|
293
|
+
if (index < size - 1) {
|
|
294
|
+
setStepIndex(index + 1);
|
|
295
|
+
}
|
|
296
|
+
break;
|
|
297
|
+
case ACTIONS.PREV:
|
|
298
|
+
if (index > 0) {
|
|
299
|
+
setStepIndex(index - 1);
|
|
300
|
+
}
|
|
301
|
+
break;
|
|
302
|
+
case ACTIONS.CLOSE:
|
|
303
|
+
setRunningChanged(false);
|
|
304
|
+
setStepIndex(0);
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
return /* @__PURE__ */ React6.createElement(HelpContext2.Provider, {
|
|
311
|
+
value: {
|
|
312
|
+
running: running && !paused,
|
|
313
|
+
steps,
|
|
314
|
+
setSteps,
|
|
315
|
+
setIndex: setStepIndex,
|
|
316
|
+
start: () => setRunningChanged(true),
|
|
317
|
+
stop: () => setRunningChanged(false)
|
|
318
|
+
}
|
|
319
|
+
}, /* @__PURE__ */ React6.createElement("style", null, `.joyride-target {
|
|
320
|
+
--controls-opacity: 1;
|
|
321
|
+
}`), /* @__PURE__ */ React6.createElement(Joyride, {
|
|
322
|
+
continuous: true,
|
|
323
|
+
steps,
|
|
324
|
+
stepIndex,
|
|
325
|
+
run: running && !paused,
|
|
326
|
+
callback,
|
|
327
|
+
floaterProps,
|
|
328
|
+
tooltipComponent: Tooltip
|
|
329
|
+
}));
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
// src/constants.ts
|
|
333
|
+
import { meta as meta3 } from "#meta";
|
|
334
|
+
var SHORTCUTS_DIALOG = `${meta3.id}.ShortcutsDialog`;
|
|
30
335
|
|
|
31
336
|
// src/HelpPlugin.tsx
|
|
32
|
-
import {
|
|
337
|
+
import { ActivationEvents, Plugin } from "@dxos/app-framework";
|
|
338
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
339
|
+
import { AppGraphBuilder, HelpState, OperationHandler, ReactRoot, ReactSurface } from "#capabilities";
|
|
340
|
+
import { meta as meta5 } from "#meta";
|
|
33
341
|
|
|
34
342
|
// src/translations.ts
|
|
343
|
+
import { meta as meta4 } from "#meta";
|
|
35
344
|
var translations = [
|
|
36
345
|
{
|
|
37
346
|
"en-US": {
|
|
38
|
-
[
|
|
39
|
-
"plugin
|
|
40
|
-
"open
|
|
41
|
-
"open
|
|
42
|
-
"shortcuts
|
|
347
|
+
[meta4.id]: {
|
|
348
|
+
"plugin.name": "Help",
|
|
349
|
+
"open-help-tour.message": "Show welcome tour",
|
|
350
|
+
"open-shortcuts.label": "Show shortcuts",
|
|
351
|
+
"shortcuts-dialog.title": "Shortcuts"
|
|
43
352
|
}
|
|
44
353
|
}
|
|
45
354
|
}
|
|
46
355
|
];
|
|
47
356
|
|
|
48
357
|
// src/HelpPlugin.tsx
|
|
49
|
-
var HelpPlugin = (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
defineModule({
|
|
66
|
-
id: `${meta.id}/module/react-surface`,
|
|
67
|
-
activatesOn: Events.SetupReactSurface,
|
|
68
|
-
activate: ReactSurface
|
|
69
|
-
}),
|
|
70
|
-
defineModule({
|
|
71
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
72
|
-
activatesOn: Events.SetupIntentResolver,
|
|
73
|
-
activate: (context) => contributes(Capabilities.IntentResolver, createResolver({
|
|
74
|
-
intent: HelpAction.Start,
|
|
75
|
-
resolve: () => {
|
|
76
|
-
const state = context.getCapability(HelpCapabilities.MutableState);
|
|
77
|
-
state.running = true;
|
|
78
|
-
}
|
|
79
|
-
}))
|
|
80
|
-
}),
|
|
81
|
-
defineModule({
|
|
82
|
-
id: `${meta.id}/module/app-graph-builder`,
|
|
83
|
-
activatesOn: Events.SetupAppGraph,
|
|
84
|
-
activate: AppGraphBuilder
|
|
85
|
-
})
|
|
86
|
-
]);
|
|
358
|
+
var HelpPlugin = Plugin.define(meta5).pipe(AppPlugin.addAppGraphModule({
|
|
359
|
+
activate: AppGraphBuilder
|
|
360
|
+
}), AppPlugin.addOperationHandlerModule({
|
|
361
|
+
activate: OperationHandler
|
|
362
|
+
}), AppPlugin.addSurfaceModule({
|
|
363
|
+
activate: ReactSurface
|
|
364
|
+
}), AppPlugin.addTranslationsModule({
|
|
365
|
+
translations
|
|
366
|
+
}), Plugin.addModule({
|
|
367
|
+
activatesOn: ActivationEvents.Startup,
|
|
368
|
+
activate: HelpState
|
|
369
|
+
}), Plugin.addModule(({ steps = [] }) => ({
|
|
370
|
+
id: "react-root",
|
|
371
|
+
activatesOn: ActivationEvents.Startup,
|
|
372
|
+
activate: () => ReactRoot(steps)
|
|
373
|
+
})), Plugin.make);
|
|
87
374
|
|
|
88
375
|
// src/hooks/useHelp.tsx
|
|
89
376
|
import { useContext } from "react";
|
|
90
377
|
import { raise } from "@dxos/debug";
|
|
378
|
+
import { HelpContext as HelpContext3 } from "#types";
|
|
91
379
|
var useHelp = () => {
|
|
92
|
-
return useContext(
|
|
380
|
+
return useContext(HelpContext3) ?? raise(new Error("Missing HelpContext"));
|
|
93
381
|
};
|
|
94
382
|
export {
|
|
95
|
-
HELP_PLUGIN,
|
|
96
|
-
HelpAction,
|
|
97
383
|
HelpCapabilities,
|
|
98
384
|
HelpContext,
|
|
99
385
|
HelpPlugin,
|
|
100
386
|
Key,
|
|
101
387
|
SHORTCUTS_DIALOG,
|
|
102
|
-
ShortcutsDialogContent,
|
|
103
388
|
ShortcutsHints,
|
|
104
389
|
ShortcutsList,
|
|
105
390
|
ShortcutsSection,
|