@dxos/plugin-navtree 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/CommandsDialogContent-2DKIOLJL.mjs +113 -0
- package/dist/lib/browser/CommandsDialogContent-2DKIOLJL.mjs.map +7 -0
- package/dist/lib/browser/CommandsTrigger-ABODVVMP.mjs +33 -0
- package/dist/lib/browser/CommandsTrigger-ABODVVMP.mjs.map +7 -0
- package/dist/lib/browser/NavTreeContainer-TLSYS4KK.mjs +12 -0
- package/dist/lib/browser/NavTreeContainer-TLSYS4KK.mjs.map +7 -0
- package/dist/lib/browser/NavTreeDocumentTitle-L6NLLWLD.mjs +26 -0
- package/dist/lib/browser/NavTreeDocumentTitle-L6NLLWLD.mjs.map +7 -0
- package/dist/lib/browser/app-graph-builder-Z43OTNI2.mjs +44 -0
- package/dist/lib/browser/app-graph-builder-Z43OTNI2.mjs.map +7 -0
- package/dist/lib/browser/chunk-A4VDCIJC.mjs +19 -0
- package/dist/lib/browser/chunk-A4VDCIJC.mjs.map +7 -0
- package/dist/lib/browser/chunk-AYF2TX65.mjs +14 -0
- package/dist/lib/browser/chunk-AYF2TX65.mjs.map +7 -0
- package/dist/lib/browser/chunk-JT37R5HS.mjs +1468 -0
- package/dist/lib/browser/chunk-JT37R5HS.mjs.map +7 -0
- package/dist/lib/browser/chunk-KF26WA4O.mjs +23 -0
- package/dist/lib/browser/chunk-KF26WA4O.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +86 -91
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{keyboard-AHSAWKXA.mjs → keyboard-HYGFQO7T.mjs} +25 -19
- package/dist/lib/browser/keyboard-HYGFQO7T.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-VDWVUII5.mjs +49 -0
- package/dist/lib/browser/operation-resolver-VDWVUII5.mjs.map +7 -0
- package/dist/lib/browser/react-surface-D2RLMV4Z.mjs +59 -0
- package/dist/lib/browser/react-surface-D2RLMV4Z.mjs.map +7 -0
- package/dist/lib/browser/state-CWMNNF7K.mjs +131 -0
- package/dist/lib/browser/state-CWMNNF7K.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts +2 -1
- package/dist/types/src/NavTreePlugin.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 -108
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard/index.d.ts +3 -0
- package/dist/types/src/capabilities/keyboard/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts +5 -0
- package/dist/types/src/capabilities/keyboard/keyboard.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -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-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 +3 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +6 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/components/NavTree/NavTree.d.ts +11 -4
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +2 -2
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/{NavTreeContext.d.ts → NavTreeContext/NavTreeContext.d.ts} +1 -1
- package/dist/types/src/components/NavTreeContext/NavTreeContext.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeContext/index.d.ts +2 -0
- package/dist/types/src/components/NavTreeContext/index.d.ts.map +1 -0
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts +10 -8
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +3 -2
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +8 -5
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +4 -7
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +5 -4
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +8 -16
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts +6 -0
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts +3 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsTrigger/CommandsTrigger.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsTrigger/index.d.ts +3 -0
- package/dist/types/src/containers/CommandsTrigger/index.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts +9 -0
- package/dist/types/src/containers/NavTreeContainer/NavTreeContainer.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeContainer/index.d.ts +3 -0
- package/dist/types/src/containers/NavTreeContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.d.ts +1 -1
- package/dist/types/src/containers/NavTreeDocumentTitle/NavTreeDocumentTitle.d.ts.map +1 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts +3 -0
- package/dist/types/src/containers/NavTreeDocumentTitle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +7 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/experimental/Tree.stories.d.ts +15 -4
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +5 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useActions.d.ts +5 -0
- package/dist/types/src/hooks/useActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useLoadDescendents.d.ts +6 -0
- package/dist/types/src/hooks/useLoadDescendents.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavTreeModel.d.ts +7 -0
- package/dist/types/src/hooks/useNavTreeModel.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavTreeState.d.ts +22 -0
- package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -2
- 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/testing/app-graph-builder.d.ts +2 -3
- package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +5 -6
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/testing/update-state.d.ts +2 -2
- package/dist/types/src/testing/update-state.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +16 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/schema.d.ts} +7 -7
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/util.d.ts +11 -7
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +55 -53
- package/src/NavTreePlugin.tsx +54 -73
- package/src/capabilities/app-graph-builder/app-graph-builder.ts +42 -0
- package/src/capabilities/app-graph-builder/index.ts +7 -0
- package/src/capabilities/index.ts +5 -9
- package/src/capabilities/keyboard/index.ts +7 -0
- package/src/capabilities/keyboard/keyboard.ts +66 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +45 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +53 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +149 -0
- package/src/components/NavTree/NavTree.stories.tsx +44 -51
- package/src/components/NavTree/NavTree.tsx +63 -32
- package/src/components/{NavTreeContext.tsx → NavTreeContext/NavTreeContext.tsx} +1 -1
- package/src/components/NavTreeContext/index.ts +5 -0
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +18 -8
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +55 -32
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +42 -16
- package/src/components/Sidebar/L0Menu.tsx +145 -155
- package/src/components/Sidebar/L1Panel.tsx +247 -93
- package/src/components/Sidebar/L1Tabs.tsx +18 -33
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +2 -3
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +1 -1
- package/src/components/index.ts +1 -3
- package/src/components/types.ts +14 -19
- package/src/containers/CommandsDialogContent/CommandsDialogContent.tsx +135 -0
- package/src/containers/CommandsDialogContent/index.ts +7 -0
- package/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.tsx +5 -14
- package/src/containers/CommandsTrigger/index.ts +7 -0
- package/src/containers/NavTreeContainer/NavTreeContainer.tsx +271 -0
- package/src/containers/NavTreeContainer/index.ts +6 -0
- package/src/{components → containers/NavTreeDocumentTitle}/NavTreeDocumentTitle.tsx +4 -3
- package/src/containers/NavTreeDocumentTitle/index.ts +7 -0
- package/src/containers/index.ts +12 -0
- package/src/experimental/Tree.stories.tsx +54 -60
- package/src/experimental/Tree.tsx +3 -3
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useActions.ts +34 -0
- package/src/hooks/useLoadDescendents.ts +23 -0
- package/src/hooks/useNavTreeModel.ts +118 -0
- package/src/hooks/useNavTreeState.ts +42 -0
- package/src/index.ts +1 -2
- package/src/meta.ts +9 -4
- package/src/testing/app-graph-builder.ts +159 -235
- package/src/testing/generator.ts +19 -17
- package/src/testing/update-state.ts +6 -6
- package/src/types/capabilities.ts +21 -0
- package/src/types/events.ts +12 -0
- package/src/types/index.ts +7 -0
- package/src/{types.ts → types/schema.ts} +6 -6
- package/src/util.ts +27 -16
- package/dist/lib/browser/app-graph-builder-YAPMENYT.mjs +0 -46
- package/dist/lib/browser/app-graph-builder-YAPMENYT.mjs.map +0 -7
- package/dist/lib/browser/chunk-IMFXKPSB.mjs +0 -1482
- package/dist/lib/browser/chunk-IMFXKPSB.mjs.map +0 -7
- package/dist/lib/browser/chunk-LPAREX6J.mjs +0 -15
- package/dist/lib/browser/chunk-LPAREX6J.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZENLR72O.mjs +0 -14
- package/dist/lib/browser/chunk-ZENLR72O.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-TCQXGF6U.mjs +0 -47
- package/dist/lib/browser/intent-resolver-TCQXGF6U.mjs.map +0 -7
- package/dist/lib/browser/keyboard-AHSAWKXA.mjs.map +0 -7
- package/dist/lib/browser/react-surface-AH2TP73M.mjs +0 -51
- package/dist/lib/browser/react-surface-AH2TP73M.mjs.map +0 -7
- package/dist/lib/browser/state-2Q623V7U.mjs +0 -117
- package/dist/lib/browser/state-2Q623V7U.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 -21
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/keyboard.d.ts +0 -4
- package/dist/types/src/capabilities/keyboard.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 -20
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts +0 -5
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +0 -1
- package/dist/types/src/components/CommandsDialog/index.d.ts +0 -3
- package/dist/types/src/components/CommandsDialog/index.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeContainer.d.ts +0 -9
- package/dist/types/src/components/NavTreeContainer.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeContext.d.ts.map +0 -1
- package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/hooks.d.ts +0 -3
- package/dist/types/src/hooks.d.ts.map +0 -1
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -53
- package/src/capabilities/capabilities.ts +0 -20
- package/src/capabilities/intent-resolver.ts +0 -37
- package/src/capabilities/keyboard.ts +0 -59
- package/src/capabilities/react-surface.tsx +0 -45
- package/src/capabilities/state.ts +0 -105
- package/src/components/CommandsDialog/CommandsDialog.tsx +0 -118
- package/src/components/CommandsDialog/index.ts +0 -6
- package/src/components/NavTreeContainer.tsx +0 -346
- package/src/events.ts +0 -11
- package/src/hooks.ts +0 -21
- /package/dist/types/src/{components/CommandsDialog → containers/CommandsTrigger}/CommandsTrigger.d.ts +0 -0
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type Live } from '@dxos/live-object';
|
|
2
|
-
import { type NavTreeItemGraphNode } from '../types';
|
|
3
|
-
export declare namespace NavTreeCapabilities {
|
|
4
|
-
const State: import("@dxos/app-framework").InterfaceDef<{
|
|
5
|
-
state: Map<string, Live<{
|
|
6
|
-
open: boolean;
|
|
7
|
-
current: boolean;
|
|
8
|
-
alternateTree?: boolean;
|
|
9
|
-
}>>;
|
|
10
|
-
getItem: (path: string[]) => Live<{
|
|
11
|
-
open: boolean;
|
|
12
|
-
current: boolean;
|
|
13
|
-
alternateTree?: boolean;
|
|
14
|
-
}>;
|
|
15
|
-
setItem: (path: string[], key: "open" | "current" | "alternateTree", next: boolean) => void;
|
|
16
|
-
isOpen: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
17
|
-
isCurrent: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
18
|
-
isAlternateTree: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
19
|
-
}>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/capabilities.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,yBAAiB,mBAAmB,CAAC;IAC5B,MAAM,KAAK;eACT,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,OAAO,EAAE,OAAO,CAAC;YAAC,aAAa,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC,CAAC;iBAC7E,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;YAAE,IAAI,EAAE,OAAO,CAAC;YAAC,OAAO,EAAE,OAAO,CAAC;YAAC,aAAa,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;iBACtF,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,eAAe,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI;gBACnF,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,oBAAoB,KAAK,OAAO;mBACpD,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,oBAAoB,KAAK,OAAO;yBACjD,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,oBAAoB,KAAK,OAAO;MACzC,CAAC;CACnC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Capabilities, type PluginContext } from '@dxos/app-framework';
|
|
2
|
-
declare const _default: (context: PluginContext) => import("@dxos/app-framework").Capability<import("@dxos/app-framework").InterfaceDef<Capabilities.IntentResolver>>;
|
|
3
|
-
export default _default;
|
|
4
|
-
//# sourceMappingURL=intent-resolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"intent-resolver.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/intent-resolver.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAgB,KAAK,aAAa,EAA+B,MAAM,qBAAqB,CAAC;yBAKlG,SAAS,aAAa;AAAtC,wBAyBI"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/keyboard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmC,KAAK,aAAa,EAAe,MAAM,qBAAqB,CAAC;yBAQvF,SAAS,aAAa;AAAtC,wBA8CE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-surface.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/react-surface.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;;AAM/E,wBAgCK"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type PluginContext } from '@dxos/app-framework';
|
|
2
|
-
import { type Live } from '@dxos/echo';
|
|
3
|
-
declare const _default: (context: PluginContext) => import("@dxos/app-framework").Capability<import("@dxos/app-framework").InterfaceDef<{
|
|
4
|
-
state: Map<string, Live<{
|
|
5
|
-
open: boolean;
|
|
6
|
-
current: boolean;
|
|
7
|
-
alternateTree?: boolean;
|
|
8
|
-
}>>;
|
|
9
|
-
getItem: (path: string[]) => Live<{
|
|
10
|
-
open: boolean;
|
|
11
|
-
current: boolean;
|
|
12
|
-
alternateTree?: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
setItem: (path: string[], key: "open" | "current" | "alternateTree", next: boolean) => void;
|
|
15
|
-
isOpen: (path: string[], item: import("../types").NavTreeItemGraphNode) => boolean;
|
|
16
|
-
isCurrent: (path: string[], item: import("../types").NavTreeItemGraphNode) => boolean;
|
|
17
|
-
isAlternateTree: (path: string[], item: import("../types").NavTreeItemGraphNode) => boolean;
|
|
18
|
-
}>>;
|
|
19
|
-
export default _default;
|
|
20
|
-
//# sourceMappingURL=state.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/state.ts"],"names":[],"mappings":"AAMA,OAAO,EAAgB,KAAK,aAAa,EAAe,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;yBAyBvB,SAAS,aAAa;;;;qBAnBM,CAAC;;;;;qBAKtB,CAAC;;;;;;;AAcxB,wBAwEE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandsDialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/CommandsDialog/CommandsDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAoBjD,eAAO,MAAM,qBAAqB,GAAI,uBAAuB;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,sBA6FjF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CommandsTrigger.d.ts","sourceRoot":"","sources":["../../../../../src/components/CommandsDialog/CommandsTrigger.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,eAAO,MAAM,eAAe,yBAsB3B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CommandsDialog/index.ts"],"names":[],"mappings":"AAIA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type NavTreeContextValue } from './types';
|
|
3
|
-
export declare const NODE_TYPE = "dxos/app-graph/node";
|
|
4
|
-
export type NavTreeContainerProps = {
|
|
5
|
-
popoverAnchorId?: string;
|
|
6
|
-
topbar?: boolean;
|
|
7
|
-
} & Pick<NavTreeContextValue, 'tab'>;
|
|
8
|
-
export declare const NavTreeContainer: React.MemoExoticComponent<({ tab, popoverAnchorId, topbar }: NavTreeContainerProps) => React.JSX.Element>;
|
|
9
|
-
//# sourceMappingURL=NavTreeContainer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavTreeContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/NavTreeContainer.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAgD,MAAM,OAAO,CAAC;AA0BrE,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,eAAO,MAAM,SAAS,wBAAwB,CAAC;AA0D/C,MAAM,MAAM,qBAAqB,GAAG;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,GAAG,IAAI,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AAErC,eAAO,MAAM,gBAAgB,+DAA2C,qBAAqB,uBAsP3F,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavTreeContext.d.ts","sourceRoot":"","sources":["../../../../src/components/NavTreeContext.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,cAAc,qDAAkD,CAAC;AAE9E,eAAO,MAAM,iBAAiB,2BAAiF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavTreeDocumentTitle.d.ts","sourceRoot":"","sources":["../../../../src/components/NavTreeDocumentTitle.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAK5C,eAAO,MAAM,oBAAoB,GAAI,UAAU;IAAE,IAAI,CAAC,EAAE,IAAI,CAAA;CAAE,SAM7D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/events.ts"],"names":[],"mappings":"AAQA,yBAAiB,aAAa,CAAC;IACtB,MAAM,UAAU,+CAAmC,CAAC;CAC5D"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAI5C,eAAO,MAAM,kBAAkB,GAAI,OAAO,IAAI,SAU7C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE9D,MAAM,MAAM,oBAAoB,GAAG,IAAI,CACrC,GAAG,EACH,OAAO,CACL,cAAc,GAAG;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,oBAAoB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,mBAAmB,EAAE,CAAC,SAAS,EAAE,oBAAoB,EAAE,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IAC/E,MAAM,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IACjF,eAAe,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IAC1F,aAAa,EAAE,CAAC,UAAU,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,oBAAoB,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CAClH,CACF,CACF,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC1C,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,EAAE,KAAK,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG;IAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,GAAG;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IAGvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import * as Function from 'effect/Function';
|
|
7
|
-
import * as Option from 'effect/Option';
|
|
8
|
-
|
|
9
|
-
import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
10
|
-
import { ROOT_ID, createExtension } from '@dxos/plugin-graph';
|
|
11
|
-
|
|
12
|
-
import { COMMANDS_DIALOG, meta } from '../meta';
|
|
13
|
-
|
|
14
|
-
export default (context: PluginContext) =>
|
|
15
|
-
contributes(
|
|
16
|
-
Capabilities.AppGraphBuilder,
|
|
17
|
-
createExtension({
|
|
18
|
-
id: meta.id,
|
|
19
|
-
actions: (node) =>
|
|
20
|
-
Rx.make((get) =>
|
|
21
|
-
Function.pipe(
|
|
22
|
-
get(node),
|
|
23
|
-
Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),
|
|
24
|
-
Option.map(() => [
|
|
25
|
-
{
|
|
26
|
-
id: COMMANDS_DIALOG,
|
|
27
|
-
data: async () => {
|
|
28
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
29
|
-
await dispatch(
|
|
30
|
-
createIntent(LayoutAction.UpdateDialog, {
|
|
31
|
-
part: 'dialog',
|
|
32
|
-
subject: COMMANDS_DIALOG,
|
|
33
|
-
options: {
|
|
34
|
-
blockAlign: 'start',
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
38
|
-
},
|
|
39
|
-
properties: {
|
|
40
|
-
label: ['open commands label', { ns: meta.id }],
|
|
41
|
-
icon: 'ph--magnifying-glass--regular',
|
|
42
|
-
keyBinding: {
|
|
43
|
-
macos: 'meta+k',
|
|
44
|
-
windows: 'ctrl+k',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
]),
|
|
49
|
-
Option.getOrElse(() => []),
|
|
50
|
-
),
|
|
51
|
-
),
|
|
52
|
-
}),
|
|
53
|
-
);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
-
import { type Live } from '@dxos/live-object';
|
|
7
|
-
|
|
8
|
-
import { meta } from '../meta';
|
|
9
|
-
import { type NavTreeItemGraphNode } from '../types';
|
|
10
|
-
|
|
11
|
-
export namespace NavTreeCapabilities {
|
|
12
|
-
export const State = defineCapability<{
|
|
13
|
-
state: Map<string, Live<{ open: boolean; current: boolean; alternateTree?: boolean }>>;
|
|
14
|
-
getItem: (path: string[]) => Live<{ open: boolean; current: boolean; alternateTree?: boolean }>;
|
|
15
|
-
setItem: (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => void;
|
|
16
|
-
isOpen: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
17
|
-
isCurrent: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
18
|
-
isAlternateTree: (path: string[], item: NavTreeItemGraphNode) => boolean;
|
|
19
|
-
}>(`${meta.id}/capability/state`);
|
|
20
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Schema from 'effect/Schema';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, LayoutAction, type PluginContext, contributes, createResolver } from '@dxos/app-framework';
|
|
8
|
-
import { log } from '@dxos/log';
|
|
9
|
-
|
|
10
|
-
import { NavTreeCapabilities } from './capabilities';
|
|
11
|
-
|
|
12
|
-
export default (context: PluginContext) =>
|
|
13
|
-
contributes(
|
|
14
|
-
Capabilities.IntentResolver,
|
|
15
|
-
createResolver({
|
|
16
|
-
intent: LayoutAction.UpdateLayout,
|
|
17
|
-
filter: (data): data is Schema.Schema.Type<typeof LayoutAction.Expose.fields.input> =>
|
|
18
|
-
Schema.is(LayoutAction.Expose.fields.input)(data),
|
|
19
|
-
resolve: async ({ subject }) => {
|
|
20
|
-
const { graph } = context.getCapability(Capabilities.AppGraph);
|
|
21
|
-
const { getItem, setItem } = context.getCapability(NavTreeCapabilities.State);
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
const path = await graph.waitForPath({ target: subject }, { timeout: 1_000 });
|
|
25
|
-
[...Array(path.length)].forEach((_, index) => {
|
|
26
|
-
const subpath = path.slice(0, index);
|
|
27
|
-
const value = getItem(subpath);
|
|
28
|
-
if (!value.open) {
|
|
29
|
-
setItem(subpath, 'open', true);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
} catch {
|
|
33
|
-
log('Path to node not found', { subject });
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
}),
|
|
37
|
-
);
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Capabilities as AppCapabilities, type PluginContext, contributes } from '@dxos/app-framework';
|
|
6
|
-
import { debounce } from '@dxos/async';
|
|
7
|
-
import { Keyboard } from '@dxos/keyboard';
|
|
8
|
-
import { type Node, isAction } from '@dxos/plugin-graph';
|
|
9
|
-
import { getHostPlatform } from '@dxos/util';
|
|
10
|
-
|
|
11
|
-
import { KEY_BINDING } from '../meta';
|
|
12
|
-
|
|
13
|
-
export default (context: PluginContext) => {
|
|
14
|
-
const { graph } = context.getCapability(AppCapabilities.AppGraph);
|
|
15
|
-
|
|
16
|
-
// TODO(wittjosiah): Factor out.
|
|
17
|
-
// TODO(wittjosiah): Handle removal of actions.
|
|
18
|
-
const visitor = (node: Node, path: string[]) => {
|
|
19
|
-
let shortcut: string | undefined;
|
|
20
|
-
if (typeof node.properties.keyBinding === 'object') {
|
|
21
|
-
const availablePlatforms = Object.keys(node.properties.keyBinding);
|
|
22
|
-
const platform = getHostPlatform();
|
|
23
|
-
shortcut = availablePlatforms.includes(platform)
|
|
24
|
-
? node.properties.keyBinding[platform]
|
|
25
|
-
: platform === 'ios'
|
|
26
|
-
? node.properties.keyBinding.macos // Fallback to macos if ios-specific bindings not provided.
|
|
27
|
-
: platform === 'linux' || platform === 'unknown'
|
|
28
|
-
? node.properties.keyBinding.windows // Fallback to windows if platform-specific bindings not provided.
|
|
29
|
-
: undefined;
|
|
30
|
-
} else {
|
|
31
|
-
shortcut = node.properties.keyBinding;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (shortcut && isAction(node)) {
|
|
35
|
-
Keyboard.singleton.getContext(path.slice(0, -1).join('/')).bind({
|
|
36
|
-
shortcut,
|
|
37
|
-
handler: () => {
|
|
38
|
-
void node.data({ parent: node, caller: KEY_BINDING });
|
|
39
|
-
},
|
|
40
|
-
data: node.properties.label,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const eventHandler = debounce(() => {
|
|
46
|
-
graph.traverse({ visitor });
|
|
47
|
-
}, 500);
|
|
48
|
-
|
|
49
|
-
const unsubscribe = graph.onNodeChanged.on(eventHandler);
|
|
50
|
-
|
|
51
|
-
// TODO(burdon): Create context and plugin.
|
|
52
|
-
Keyboard.singleton.initialize();
|
|
53
|
-
Keyboard.singleton.setCurrentContext(graph.root.id);
|
|
54
|
-
|
|
55
|
-
return contributes(AppCapabilities.Null, null, () => {
|
|
56
|
-
unsubscribe();
|
|
57
|
-
Keyboard.singleton.destroy();
|
|
58
|
-
});
|
|
59
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, contributes, createSurface } from '@dxos/app-framework';
|
|
8
|
-
import { isGraphNode } from '@dxos/plugin-graph';
|
|
9
|
-
|
|
10
|
-
import { CommandsDialogContent, CommandsTrigger, NavTreeContainer, NavTreeDocumentTitle } from '../components';
|
|
11
|
-
import { COMMANDS_DIALOG, meta } from '../meta';
|
|
12
|
-
|
|
13
|
-
export default () =>
|
|
14
|
-
contributes(Capabilities.ReactSurface, [
|
|
15
|
-
createSurface({
|
|
16
|
-
id: COMMANDS_DIALOG,
|
|
17
|
-
role: 'dialog',
|
|
18
|
-
filter: (data): data is { props: { selected?: string } } => data.component === COMMANDS_DIALOG,
|
|
19
|
-
component: ({ data }) => <CommandsDialogContent {...data.props} />,
|
|
20
|
-
}),
|
|
21
|
-
createSurface({
|
|
22
|
-
id: `${meta.id}/navigation`,
|
|
23
|
-
role: 'navigation',
|
|
24
|
-
filter: (data): data is { popoverAnchorId?: string; topbar: boolean; current: string } =>
|
|
25
|
-
typeof data.current === 'string',
|
|
26
|
-
component: ({ data }) => (
|
|
27
|
-
<NavTreeContainer
|
|
28
|
-
tab={data.current}
|
|
29
|
-
popoverAnchorId={data.popoverAnchorId as string | undefined}
|
|
30
|
-
topbar={data.topbar as boolean}
|
|
31
|
-
/>
|
|
32
|
-
),
|
|
33
|
-
}),
|
|
34
|
-
createSurface({
|
|
35
|
-
id: `${meta.id}/document-title`,
|
|
36
|
-
role: 'document-title',
|
|
37
|
-
component: ({ data }) => <NavTreeDocumentTitle node={isGraphNode(data.subject) ? data.subject : undefined} />,
|
|
38
|
-
}),
|
|
39
|
-
createSurface({
|
|
40
|
-
id: `${meta.id}/search-input`,
|
|
41
|
-
role: 'search-input',
|
|
42
|
-
position: 'fallback',
|
|
43
|
-
component: () => <CommandsTrigger />,
|
|
44
|
-
}),
|
|
45
|
-
]);
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { effect, untracked } from '@preact/signals-core';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, type PluginContext, contributes } from '@dxos/app-framework';
|
|
8
|
-
import { type Live } from '@dxos/echo';
|
|
9
|
-
import { live } from '@dxos/live-object';
|
|
10
|
-
import { Path } from '@dxos/react-ui-list';
|
|
11
|
-
|
|
12
|
-
import { meta } from '../meta';
|
|
13
|
-
|
|
14
|
-
import { NavTreeCapabilities } from './capabilities';
|
|
15
|
-
|
|
16
|
-
const KEY = `${meta.id}/state/v1`;
|
|
17
|
-
|
|
18
|
-
const getInitialState = () => {
|
|
19
|
-
const stringified = localStorage.getItem(KEY);
|
|
20
|
-
if (!stringified) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
const cached: [string, { open: boolean; current: boolean }][] = JSON.parse(stringified);
|
|
26
|
-
return cached.map(([key, value]): [string, Live<{ open: boolean; current: boolean }>] => [
|
|
27
|
-
key,
|
|
28
|
-
live({ open: value.open, current: false }),
|
|
29
|
-
]);
|
|
30
|
-
} catch {}
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default (context: PluginContext) => {
|
|
34
|
-
const layout = context.getCapability(Capabilities.Layout);
|
|
35
|
-
|
|
36
|
-
// TODO(wittjosiah): This currently needs to be not a Live at the root.
|
|
37
|
-
// If it is a Live then React errors when initializing new paths because of state change during render.
|
|
38
|
-
// Ideally this could be a Live but be able to access and update the root level without breaking render.
|
|
39
|
-
// Wrapping accesses and updates in `untracked` didn't seem to work in all cases.
|
|
40
|
-
const state = new Map<string, Live<{ open: boolean; current: boolean; alternateTree?: boolean }>>(
|
|
41
|
-
getInitialState() ?? [
|
|
42
|
-
// TODO(thure): Initialize these dynamically.
|
|
43
|
-
['root', live({ open: true, current: false })],
|
|
44
|
-
['root~dxos.org/plugin/space-spaces', live({ open: true, current: false })],
|
|
45
|
-
['root~dxos.org/plugin/files', live({ open: true, current: false })],
|
|
46
|
-
],
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const getItem = (_path: string[]) => {
|
|
50
|
-
const path = Path.create(..._path);
|
|
51
|
-
const value = state.get(path) ?? live({ open: false, current: false, alternateTree: false });
|
|
52
|
-
if (!state.has(path)) {
|
|
53
|
-
state.set(path, value);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return value;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
const setItem = (path: string[], key: 'open' | 'current' | 'alternateTree', next: boolean) => {
|
|
60
|
-
const value = getItem(path);
|
|
61
|
-
value[key] = next;
|
|
62
|
-
|
|
63
|
-
localStorage.setItem(KEY, JSON.stringify(Array.from(state.entries())));
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const isOpen = (path: string[]) => getItem(path).open;
|
|
67
|
-
const isCurrent = (path: string[]) => getItem(path).current;
|
|
68
|
-
const isAlternateTree = (path: string[]) => {
|
|
69
|
-
const item = getItem(path);
|
|
70
|
-
return item.alternateTree ?? false;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
let previous: string[] = [];
|
|
74
|
-
const unsubscribe = effect(() => {
|
|
75
|
-
const removed = previous.filter((id) => !layout.active.includes(id));
|
|
76
|
-
previous = layout.active;
|
|
77
|
-
|
|
78
|
-
const handleUpdate = () => {
|
|
79
|
-
removed.forEach((id) => {
|
|
80
|
-
const keys = Array.from(state.keys()).filter((key) => Path.last(key) === id);
|
|
81
|
-
keys.forEach((key) => {
|
|
82
|
-
setItem(Path.parts(key), 'current', false);
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
layout.active.forEach((id) => {
|
|
87
|
-
const keys = Array.from(new Set([...state.keys(), id])).filter((key) => Path.last(key) === id);
|
|
88
|
-
keys.forEach((key) => {
|
|
89
|
-
setItem(Path.parts(key), 'current', true);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// TODO(wittjosiah): This is setTimeout because there's a race between the keys be initialized.
|
|
95
|
-
// Keys are initialized on the first render of an item in the navtree.
|
|
96
|
-
// This could be avoided if the location was a path as well and not just an id.
|
|
97
|
-
const timeout = setTimeout(handleUpdate, 500);
|
|
98
|
-
untracked(() => handleUpdate());
|
|
99
|
-
return () => clearTimeout(timeout);
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
return contributes(NavTreeCapabilities.State, { state, getItem, setItem, isOpen, isCurrent, isAlternateTree }, () =>
|
|
103
|
-
unsubscribe(),
|
|
104
|
-
);
|
|
105
|
-
};
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { useMemo, useState } from 'react';
|
|
6
|
-
|
|
7
|
-
import { LayoutAction, createIntent, useAppGraph, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
|
-
import { type ActionLike, isAction, isActionGroup } from '@dxos/app-graph';
|
|
9
|
-
import { Keyboard, keySymbols } from '@dxos/keyboard';
|
|
10
|
-
import { useActions } from '@dxos/plugin-graph';
|
|
11
|
-
import { Button, Dialog, Icon, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
12
|
-
import { SearchList } from '@dxos/react-ui-searchlist';
|
|
13
|
-
import {
|
|
14
|
-
cardDialogContent,
|
|
15
|
-
cardDialogHeader,
|
|
16
|
-
cardDialogPaddedOverflow,
|
|
17
|
-
cardDialogSearchListRoot,
|
|
18
|
-
} from '@dxos/react-ui-stack';
|
|
19
|
-
import { descriptionText, mx } from '@dxos/react-ui-theme';
|
|
20
|
-
import { getHostPlatform } from '@dxos/util';
|
|
21
|
-
|
|
22
|
-
import { KEY_BINDING, meta } from '../../meta';
|
|
23
|
-
|
|
24
|
-
// TODO(wittjosiah): This probably deserves its own plugin but for now it lives here w/ other navigation UI.
|
|
25
|
-
export const CommandsDialogContent = ({ selected: initial }: { selected?: string }) => {
|
|
26
|
-
const { t } = useTranslation(meta.id);
|
|
27
|
-
const [selected, setSelected] = useState<string | undefined>(initial);
|
|
28
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
29
|
-
const { graph } = useAppGraph();
|
|
30
|
-
|
|
31
|
-
// Traverse graph.
|
|
32
|
-
// TODO(burdon): Factor out commonality with shortcut dialog.
|
|
33
|
-
const allActions = useMemo(() => {
|
|
34
|
-
// TODO(burdon): Get from navtree (not keyboard).
|
|
35
|
-
const current = Keyboard.singleton.getCurrentContext();
|
|
36
|
-
const actionMap = new Set<string>();
|
|
37
|
-
const actions: ActionLike[] = [];
|
|
38
|
-
graph.traverse({
|
|
39
|
-
visitor: (node, path) => {
|
|
40
|
-
if (
|
|
41
|
-
(isAction(node) || isActionGroup(node)) &&
|
|
42
|
-
!actionMap.has(node.id) &&
|
|
43
|
-
current.startsWith(path.slice(0, -1).join('/'))
|
|
44
|
-
) {
|
|
45
|
-
actionMap.add(node.id);
|
|
46
|
-
actions.push(node);
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
actions.sort((a, b) => {
|
|
52
|
-
return toLocalizedString(a.properties.label, t)
|
|
53
|
-
?.toLowerCase()
|
|
54
|
-
.localeCompare(toLocalizedString(b.properties.label, t)?.toLowerCase());
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return actions;
|
|
58
|
-
}, [graph]);
|
|
59
|
-
|
|
60
|
-
const group = allActions.find(({ id }) => id === selected);
|
|
61
|
-
const groupActions = useActions(graph, group?.id);
|
|
62
|
-
const actions = isActionGroup(group) ? groupActions : allActions;
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<Dialog.Content classNames={cardDialogContent}>
|
|
66
|
-
<Dialog.Title classNames={cardDialogHeader}>{t('commands dialog title', { ns: meta.id })}</Dialog.Title>
|
|
67
|
-
|
|
68
|
-
{/* TODO(burdon): BUG: Overscrolls container. */}
|
|
69
|
-
<SearchList.Root label={t('command list input placeholder')} classNames={cardDialogSearchListRoot}>
|
|
70
|
-
<SearchList.Input placeholder={t('command list input placeholder')} />
|
|
71
|
-
<SearchList.Content classNames={cardDialogPaddedOverflow}>
|
|
72
|
-
{actions?.map((action) => {
|
|
73
|
-
const label = toLocalizedString(action.properties.label, t);
|
|
74
|
-
const shortcut =
|
|
75
|
-
typeof action.properties.keyBinding === 'string'
|
|
76
|
-
? action.properties.keyBinding
|
|
77
|
-
: action.properties.keyBinding?.[getHostPlatform()];
|
|
78
|
-
return (
|
|
79
|
-
<SearchList.Item
|
|
80
|
-
value={label}
|
|
81
|
-
key={action.id}
|
|
82
|
-
onSelect={() => {
|
|
83
|
-
if (action.properties.disabled) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (isActionGroup(action)) {
|
|
88
|
-
setSelected(action.id);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
void dispatch(createIntent(LayoutAction.UpdateDialog, { part: 'dialog', options: { state: false } }));
|
|
93
|
-
setTimeout(() => {
|
|
94
|
-
const node = graph.getConnections(group?.id ?? action.id, 'inbound')[0];
|
|
95
|
-
void (node && isAction(action) && action.data({ parent: node, caller: KEY_BINDING }));
|
|
96
|
-
});
|
|
97
|
-
}}
|
|
98
|
-
classNames='flex items-center gap-2'
|
|
99
|
-
disabled={action.properties.disabled}
|
|
100
|
-
{...(action.properties?.testId && { 'data-testid': action.properties.testId })}
|
|
101
|
-
>
|
|
102
|
-
<Icon icon={action.properties.icon} size={4} />
|
|
103
|
-
<span className='grow truncate'>{label}</span>
|
|
104
|
-
{shortcut && <span className={mx('shrink-0', descriptionText)}>{keySymbols(shortcut).join('')}</span>}
|
|
105
|
-
</SearchList.Item>
|
|
106
|
-
);
|
|
107
|
-
})}
|
|
108
|
-
</SearchList.Content>
|
|
109
|
-
</SearchList.Root>
|
|
110
|
-
|
|
111
|
-
<div role='none' className='pli-cardSpacingInline pbe-cardSpacingBlock'>
|
|
112
|
-
<Dialog.Close asChild>
|
|
113
|
-
<Button classNames='is-full'>{t('close label', { ns: 'os' })}</Button>
|
|
114
|
-
</Dialog.Close>
|
|
115
|
-
</div>
|
|
116
|
-
</Dialog.Content>
|
|
117
|
-
);
|
|
118
|
-
};
|