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