@dxos/plugin-navtree 0.8.4-main.ead640a → 0.8.4-main.effb148878
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/CommandsDialogContent-UBGIQ5FI.mjs +112 -0
- package/dist/lib/neutral/CommandsDialogContent-UBGIQ5FI.mjs.map +7 -0
- package/dist/lib/neutral/CommandsTrigger-BH5WLMHK.mjs +27 -0
- package/dist/lib/neutral/CommandsTrigger-BH5WLMHK.mjs.map +7 -0
- package/dist/lib/neutral/NavTreeContainer-6AR4BFDD.mjs +12 -0
- package/dist/lib/neutral/NavTreeContainer-6AR4BFDD.mjs.map +7 -0
- package/dist/lib/neutral/NavTreeDocumentTitle-H3E6ZLYE.mjs +22 -0
- package/dist/lib/neutral/NavTreeDocumentTitle-H3E6ZLYE.mjs.map +7 -0
- package/dist/lib/neutral/NavTreePlugin.mjs +56 -0
- package/dist/lib/neutral/NavTreePlugin.mjs.map +7 -0
- package/dist/lib/neutral/NavTreePlugin.node.mjs +18 -0
- package/dist/lib/neutral/NavTreePlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/NavTreePlugin.workerd.mjs +16 -0
- package/dist/lib/neutral/NavTreePlugin.workerd.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-Z347LKSF.mjs +42 -0
- package/dist/lib/neutral/app-graph-builder-Z347LKSF.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5OPDKH6B.mjs +273 -0
- package/dist/lib/neutral/chunk-5OPDKH6B.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/neutral/chunk-JOSNCOV4.mjs +79 -0
- package/dist/lib/neutral/chunk-JOSNCOV4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-RWLAJYUL.mjs +35 -0
- package/dist/lib/neutral/chunk-RWLAJYUL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-T7QS2EFI.mjs +8 -0
- package/dist/lib/neutral/chunk-T7QS2EFI.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZSWYB7JW.mjs +27 -0
- package/dist/lib/neutral/chunk-ZSWYB7JW.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +879 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +20 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/expose-26FV4W5D.mjs +38 -0
- package/dist/lib/neutral/expose-26FV4W5D.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +169 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +34 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/{browser/keyboard-AHSAWKXA.mjs → neutral/keyboard-EJ65BVTC.mjs} +25 -20
- package/dist/lib/neutral/keyboard-EJ65BVTC.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +12 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-ORDOJUL2.mjs +13 -0
- package/dist/lib/neutral/operation-handler-ORDOJUL2.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-EWCZMKVX.mjs +50 -0
- package/dist/lib/neutral/react-surface-EWCZMKVX.mjs.map +7 -0
- package/dist/lib/neutral/state-VVITVXWM.mjs +127 -0
- package/dist/lib/neutral/state-VVITVXWM.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +433 -0
- package/dist/lib/neutral/testing/index.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +23 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +10 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts +3 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/NavTreePlugin.node.d.ts +4 -0
- package/dist/types/src/NavTreePlugin.node.d.ts.map +1 -0
- package/dist/types/src/NavTreePlugin.test.d.ts +2 -0
- package/dist/types/src/NavTreePlugin.test.d.ts.map +1 -0
- package/dist/types/src/NavTreePlugin.workerd.d.ts +4 -0
- package/dist/types/src/NavTreePlugin.workerd.d.ts.map +1 -0
- 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 +7 -108
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts +3 -2
- package/dist/types/src/capabilities/keyboard.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-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 +4 -18
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- 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 +10 -12
- 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 +13 -9
- 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.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 -17
- 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/CommandsDialogContent.stories.d.ts +28 -0
- package/dist/types/src/containers/CommandsDialogContent/CommandsDialogContent.stories.d.ts.map +1 -0
- package/dist/types/src/containers/CommandsDialogContent/index.d.ts +2 -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 +2 -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 +2 -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.d.ts +2 -2
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +18 -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 +18 -0
- package/dist/types/src/hooks/useNavTreeState.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -3
- 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/operations/expose.d.ts +5 -0
- package/dist/types/src/operations/expose.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- 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/translations.d.ts +8 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/NavTreeCapabilities.d.ts +13 -0
- package/dist/types/src/types/NavTreeCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/NavTreeEvents.d.ts +3 -0
- package/dist/types/src/types/NavTreeEvents.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 +12 -8
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +126 -59
- package/src/NavTreePlugin.node.ts +17 -0
- package/src/NavTreePlugin.test.ts +27 -0
- package/src/NavTreePlugin.tsx +41 -77
- package/src/NavTreePlugin.workerd.ts +16 -0
- package/src/capabilities/app-graph-builder.ts +34 -45
- package/src/capabilities/index.ts +10 -8
- package/src/capabilities/keyboard.ts +58 -51
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +46 -38
- package/src/capabilities/state.ts +132 -84
- package/src/components/NavTree/NavTree.stories.tsx +51 -57
- package/src/components/NavTree/NavTree.tsx +65 -33
- 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 +23 -15
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +75 -52
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +46 -20
- package/src/components/Sidebar/L0Menu.tsx +155 -184
- package/src/components/Sidebar/L1Panel.tsx +203 -102
- package/src/components/Sidebar/L1Tabs.tsx +18 -34
- 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 +13 -19
- package/src/containers/CommandsDialogContent/CommandsDialogContent.stories.tsx +46 -0
- package/src/containers/CommandsDialogContent/CommandsDialogContent.tsx +127 -0
- package/src/containers/CommandsDialogContent/index.ts +5 -0
- package/src/containers/CommandsTrigger/CommandsTrigger.tsx +28 -0
- package/src/containers/CommandsTrigger/index.ts +5 -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 +5 -0
- package/src/containers/index.ts +12 -0
- package/src/experimental/Tree.stories.tsx +82 -85
- package/src/experimental/Tree.tsx +4 -4
- 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 +35 -0
- package/src/index.ts +1 -3
- package/src/meta.ts +23 -4
- package/src/operations/expose.ts +42 -0
- package/src/operations/index.ts +7 -0
- package/src/plugin.ts +11 -0
- package/src/testing/app-graph-builder.ts +167 -239
- package/src/testing/generator.ts +35 -38
- package/src/testing/update-state.ts +6 -6
- package/src/translations.ts +8 -10
- package/src/types/NavTreeCapabilities.ts +21 -0
- package/src/types/NavTreeEvents.ts +12 -0
- package/src/types/index.ts +8 -0
- package/src/{types.ts → types/schema.ts} +6 -6
- package/src/util.ts +28 -17
- 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/index.mjs +0 -146
- package/dist/lib/browser/index.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/meta.json +0 -1
- 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/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/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/capabilities.ts +0 -20
- package/src/capabilities/intent-resolver.ts +0 -37
- package/src/components/CommandsDialog/CommandsDialog.tsx +0 -118
- package/src/components/CommandsDialog/CommandsTrigger.tsx +0 -35
- 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
package/package.json
CHANGED
|
@@ -1,88 +1,155 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-navtree",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.effb148878",
|
|
4
4
|
"description": "DXOS Surface plugin for a tree view visualization of the graph.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
8
12
|
"author": "DXOS.org",
|
|
9
13
|
"sideEffects": true,
|
|
10
14
|
"type": "module",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#capabilities": {
|
|
17
|
+
"source": "./src/capabilities/index.ts",
|
|
18
|
+
"types": "./dist/types/src/capabilities/index.d.ts",
|
|
19
|
+
"default": "./dist/lib/neutral/capabilities/index.mjs"
|
|
20
|
+
},
|
|
21
|
+
"#components": {
|
|
22
|
+
"source": "./src/components/index.ts",
|
|
23
|
+
"types": "./dist/types/src/components/index.d.ts",
|
|
24
|
+
"default": "./dist/lib/neutral/components/index.mjs"
|
|
25
|
+
},
|
|
26
|
+
"#containers": {
|
|
27
|
+
"source": "./src/containers/index.ts",
|
|
28
|
+
"types": "./dist/types/src/containers/index.d.ts",
|
|
29
|
+
"default": "./dist/lib/neutral/containers/index.mjs"
|
|
30
|
+
},
|
|
31
|
+
"#hooks": {
|
|
32
|
+
"source": "./src/hooks/index.ts",
|
|
33
|
+
"types": "./dist/types/src/hooks/index.d.ts",
|
|
34
|
+
"default": "./dist/lib/neutral/hooks/index.mjs"
|
|
35
|
+
},
|
|
36
|
+
"#meta": {
|
|
37
|
+
"source": "./src/meta.ts",
|
|
38
|
+
"types": "./dist/types/src/meta.d.ts",
|
|
39
|
+
"default": "./dist/lib/neutral/meta.mjs"
|
|
40
|
+
},
|
|
41
|
+
"#operations": {
|
|
42
|
+
"source": "./src/operations/index.ts",
|
|
43
|
+
"types": "./dist/types/src/operations/index.d.ts",
|
|
44
|
+
"default": "./dist/lib/neutral/operations/index.mjs"
|
|
45
|
+
},
|
|
46
|
+
"#plugin": {
|
|
47
|
+
"source": {
|
|
48
|
+
"workerd": "./src/NavTreePlugin.workerd.ts",
|
|
49
|
+
"node": "./src/NavTreePlugin.node.ts",
|
|
50
|
+
"default": "./src/NavTreePlugin.tsx"
|
|
51
|
+
},
|
|
52
|
+
"types": "./dist/types/src/NavTreePlugin.d.ts",
|
|
53
|
+
"workerd": "./dist/lib/neutral/NavTreePlugin.workerd.mjs",
|
|
54
|
+
"node": "./dist/lib/neutral/NavTreePlugin.node.mjs",
|
|
55
|
+
"default": "./dist/lib/neutral/NavTreePlugin.mjs"
|
|
56
|
+
},
|
|
57
|
+
"#testing": {
|
|
58
|
+
"source": "./src/testing/index.ts",
|
|
59
|
+
"types": "./dist/types/src/testing/index.d.ts",
|
|
60
|
+
"default": "./dist/lib/neutral/testing/index.mjs"
|
|
61
|
+
},
|
|
62
|
+
"#translations": {
|
|
63
|
+
"source": "./src/translations.ts",
|
|
64
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
65
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
66
|
+
},
|
|
67
|
+
"#types": {
|
|
68
|
+
"source": "./src/types/index.ts",
|
|
69
|
+
"types": "./dist/types/src/types/index.d.ts",
|
|
70
|
+
"default": "./dist/lib/neutral/types/index.mjs"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
11
73
|
"exports": {
|
|
12
74
|
".": {
|
|
13
75
|
"source": "./src/index.ts",
|
|
14
76
|
"types": "./dist/types/src/index.d.ts",
|
|
15
|
-
"
|
|
77
|
+
"default": "./dist/lib/neutral/index.mjs"
|
|
78
|
+
},
|
|
79
|
+
"./plugin": {
|
|
80
|
+
"source": "./src/plugin.ts",
|
|
81
|
+
"types": "./dist/types/src/plugin.d.ts",
|
|
82
|
+
"default": "./dist/lib/neutral/plugin.mjs"
|
|
83
|
+
},
|
|
84
|
+
"./translations": {
|
|
85
|
+
"source": "./src/translations.ts",
|
|
86
|
+
"types": "./dist/types/src/translations.d.ts",
|
|
87
|
+
"default": "./dist/lib/neutral/translations.mjs"
|
|
16
88
|
}
|
|
17
89
|
},
|
|
18
90
|
"types": "dist/types/src/index.d.ts",
|
|
19
|
-
"typesVersions": {
|
|
20
|
-
"*": {}
|
|
21
|
-
},
|
|
22
91
|
"files": [
|
|
23
92
|
"dist",
|
|
24
93
|
"src"
|
|
25
94
|
],
|
|
26
95
|
"dependencies": {
|
|
27
|
-
"@atlaskit/pragmatic-drag-and-drop": "
|
|
28
|
-
"@atlaskit/pragmatic-drag-and-drop-hitbox": "
|
|
29
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
30
|
-
"@preact/signals-core": "^1.12.1",
|
|
96
|
+
"@atlaskit/pragmatic-drag-and-drop": "1.7.7",
|
|
97
|
+
"@atlaskit/pragmatic-drag-and-drop-hitbox": "1.1.0",
|
|
31
98
|
"@radix-ui/react-dismissable-layer": "1.1.5",
|
|
32
99
|
"@radix-ui/react-use-controllable-state": "1.1.0",
|
|
33
|
-
"date-fns": "^3.
|
|
34
|
-
"@dxos/app-framework": "0.8.4-main.
|
|
35
|
-
"@dxos/app-graph": "0.8.4-main.
|
|
36
|
-
"@dxos/async": "0.8.4-main.
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/plugin-
|
|
46
|
-
"@dxos/plugin-
|
|
47
|
-
"@dxos/plugin-
|
|
48
|
-
"@dxos/protocols": "0.8.4-main.
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/react-ui-attention": "0.8.4-main.
|
|
51
|
-
"@dxos/react-ui-list": "0.8.4-main.
|
|
52
|
-
"@dxos/react-ui-menu": "0.8.4-main.
|
|
53
|
-
"@dxos/react-ui-
|
|
54
|
-
"@dxos/react-
|
|
55
|
-
"@dxos/react-ui-
|
|
56
|
-
"@dxos/
|
|
100
|
+
"date-fns": "^3.6.0",
|
|
101
|
+
"@dxos/app-framework": "0.8.4-main.effb148878",
|
|
102
|
+
"@dxos/app-graph": "0.8.4-main.effb148878",
|
|
103
|
+
"@dxos/async": "0.8.4-main.effb148878",
|
|
104
|
+
"@dxos/compute": "0.8.4-main.effb148878",
|
|
105
|
+
"@dxos/debug": "0.8.4-main.effb148878",
|
|
106
|
+
"@dxos/app-toolkit": "0.8.4-main.effb148878",
|
|
107
|
+
"@dxos/keyboard": "0.8.4-main.effb148878",
|
|
108
|
+
"@dxos/invariant": "0.8.4-main.effb148878",
|
|
109
|
+
"@dxos/lit-ui": "0.8.4-main.effb148878",
|
|
110
|
+
"@dxos/log": "0.8.4-main.effb148878",
|
|
111
|
+
"@dxos/echo": "0.8.4-main.effb148878",
|
|
112
|
+
"@dxos/plugin-graph": "0.8.4-main.effb148878",
|
|
113
|
+
"@dxos/plugin-deck": "0.8.4-main.effb148878",
|
|
114
|
+
"@dxos/plugin-observability": "0.8.4-main.effb148878",
|
|
115
|
+
"@dxos/protocols": "0.8.4-main.effb148878",
|
|
116
|
+
"@dxos/random": "0.8.4-main.effb148878",
|
|
117
|
+
"@dxos/react-ui-attention": "0.8.4-main.effb148878",
|
|
118
|
+
"@dxos/react-ui-list": "0.8.4-main.effb148878",
|
|
119
|
+
"@dxos/react-ui-menu": "0.8.4-main.effb148878",
|
|
120
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.effb148878",
|
|
121
|
+
"@dxos/react-client": "0.8.4-main.effb148878",
|
|
122
|
+
"@dxos/react-ui-search": "0.8.4-main.effb148878",
|
|
123
|
+
"@dxos/react-ui-stack": "0.8.4-main.effb148878",
|
|
124
|
+
"@dxos/util": "0.8.4-main.effb148878",
|
|
125
|
+
"@dxos/react-ui-tabs": "0.8.4-main.effb148878"
|
|
57
126
|
},
|
|
58
127
|
"devDependencies": {
|
|
59
|
-
"@effect-
|
|
60
|
-
"@effect/platform": "0.
|
|
61
|
-
"@types/react": "~19.2.
|
|
62
|
-
"@types/react-dom": "~19.2.
|
|
63
|
-
"effect": "3.
|
|
64
|
-
"react": "~19.2.
|
|
65
|
-
"react-dom": "~19.2.
|
|
66
|
-
"vite": "
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/plugin-
|
|
69
|
-
"@dxos/plugin-
|
|
70
|
-
"@dxos/plugin-
|
|
71
|
-
"@dxos/plugin-
|
|
72
|
-
"@dxos/
|
|
73
|
-
"@dxos/
|
|
74
|
-
"@dxos/
|
|
75
|
-
"@dxos/react-ui-theme": "0.8.4-main.ead640a",
|
|
76
|
-
"@dxos/storybook-utils": "0.8.4-main.ead640a"
|
|
128
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
129
|
+
"@effect/platform": "0.94.4",
|
|
130
|
+
"@types/react": "~19.2.7",
|
|
131
|
+
"@types/react-dom": "~19.2.3",
|
|
132
|
+
"effect": "3.20.0",
|
|
133
|
+
"react": "~19.2.3",
|
|
134
|
+
"react-dom": "~19.2.3",
|
|
135
|
+
"vite": "^8.0.14",
|
|
136
|
+
"@dxos/plugin-attention": "0.8.4-main.effb148878",
|
|
137
|
+
"@dxos/plugin-client": "0.8.4-main.effb148878",
|
|
138
|
+
"@dxos/plugin-space": "0.8.4-main.effb148878",
|
|
139
|
+
"@dxos/plugin-testing": "0.8.4-main.effb148878",
|
|
140
|
+
"@dxos/plugin-theme": "0.8.4-main.effb148878",
|
|
141
|
+
"@dxos/storybook-utils": "0.8.4-main.effb148878",
|
|
142
|
+
"@dxos/react-ui": "0.8.4-main.effb148878",
|
|
143
|
+
"@dxos/ui-theme": "0.8.4-main.effb148878"
|
|
77
144
|
},
|
|
78
145
|
"peerDependencies": {
|
|
79
|
-
"@effect-
|
|
80
|
-
"@effect/platform": "
|
|
81
|
-
"effect": "
|
|
82
|
-
"react": "
|
|
83
|
-
"react-dom": "
|
|
84
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
85
|
-
"@dxos/
|
|
146
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
147
|
+
"@effect/platform": "0.94.4",
|
|
148
|
+
"effect": "3.20.0",
|
|
149
|
+
"react": "~19.2.3",
|
|
150
|
+
"react-dom": "~19.2.3",
|
|
151
|
+
"@dxos/react-ui": "0.8.4-main.effb148878",
|
|
152
|
+
"@dxos/ui-theme": "0.8.4-main.effb148878"
|
|
86
153
|
},
|
|
87
154
|
"publishConfig": {
|
|
88
155
|
"access": "public"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
|
+
|
|
8
|
+
import { AppGraphBuilder, OperationHandler } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
|
|
11
|
+
export const NavTreePlugin = Plugin.define(meta).pipe(
|
|
12
|
+
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
13
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
14
|
+
Plugin.make,
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default NavTreePlugin;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, test } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { ActivationEvents } from '@dxos/app-framework';
|
|
8
|
+
import { createComposerTestApp } from '@dxos/plugin-testing/harness';
|
|
9
|
+
|
|
10
|
+
import { NavTreePlugin } from '#plugin';
|
|
11
|
+
|
|
12
|
+
import { meta } from './meta';
|
|
13
|
+
|
|
14
|
+
const moduleId = (name: string) => `${meta.id}.module.${name}`;
|
|
15
|
+
|
|
16
|
+
describe('NavTreePlugin', () => {
|
|
17
|
+
test('modules activate on the expected events', async ({ expect }) => {
|
|
18
|
+
await using harness = await createComposerTestApp({
|
|
19
|
+
plugins: [NavTreePlugin()],
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
expect(harness.manager.getActive()).toEqual(expect.arrayContaining([moduleId('AppGraphBuilder')]));
|
|
23
|
+
|
|
24
|
+
await harness.fire(ActivationEvents.SetupProcessManager);
|
|
25
|
+
expect(harness.manager.getActive()).toContain(moduleId('OperationHandler'));
|
|
26
|
+
});
|
|
27
|
+
});
|
package/src/NavTreePlugin.tsx
CHANGED
|
@@ -2,93 +2,57 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
Capabilities,
|
|
7
|
-
Events,
|
|
8
|
-
LayoutAction,
|
|
9
|
-
allOf,
|
|
10
|
-
contributes,
|
|
11
|
-
createIntent,
|
|
12
|
-
defineModule,
|
|
13
|
-
definePlugin,
|
|
14
|
-
} from '@dxos/app-framework';
|
|
15
|
-
import { type TreeData } from '@dxos/react-ui-list';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
16
6
|
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { meta } from './meta';
|
|
21
|
-
import { translations } from './translations';
|
|
7
|
+
import { ActivationEvent, ActivationEvents, Capabilities, Capability, Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { AppActivationEvents, AppCapabilities, AppPlugin, LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { Graph } from '@dxos/plugin-graph';
|
|
22
10
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
import { AppGraphBuilder, Keyboard, OperationHandler, ReactSurface, State } from '#capabilities';
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
import { translations } from '#translations';
|
|
14
|
+
import { NavTreeEvents } from '#types';
|
|
15
|
+
|
|
16
|
+
export const NavTreePlugin = Plugin.define(meta).pipe(
|
|
17
|
+
AppPlugin.addAppGraphModule({ activate: AppGraphBuilder }),
|
|
18
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
19
|
+
AppPlugin.addSurfaceModule({ activate: ReactSurface }),
|
|
20
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
21
|
+
Plugin.addModule({
|
|
22
|
+
id: 'state',
|
|
23
|
+
activatesOn: AppActivationEvents.LayoutReady,
|
|
24
|
+
firesAfterActivation: [NavTreeEvents.StateReady],
|
|
28
25
|
activate: State,
|
|
29
26
|
}),
|
|
30
|
-
|
|
31
|
-
id:
|
|
32
|
-
activatesOn:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
activate: ()
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
switch (type) {
|
|
44
|
-
case 'node':
|
|
45
|
-
return item;
|
|
46
|
-
case 'object':
|
|
47
|
-
return item.data;
|
|
48
|
-
case 'view-object':
|
|
49
|
-
return { id: `${item.id}-view`, object: item.data };
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
}),
|
|
54
|
-
}),
|
|
55
|
-
defineModule({
|
|
56
|
-
id: `${meta.id}/module/expose`,
|
|
57
|
-
activatesOn: allOf(Events.DispatcherReady, Events.AppGraphReady, Events.LayoutReady, NavTreeEvents.StateReady),
|
|
58
|
-
activate: async (context) => {
|
|
59
|
-
const layout = context.getCapability(Capabilities.Layout);
|
|
60
|
-
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
61
|
-
const { graph } = context.getCapability(Capabilities.AppGraph);
|
|
62
|
-
if (dispatch && layout.active.length === 1) {
|
|
27
|
+
Plugin.addModule({
|
|
28
|
+
id: 'expose',
|
|
29
|
+
activatesOn: ActivationEvent.allOf(
|
|
30
|
+
ActivationEvents.ProcessManagerReady,
|
|
31
|
+
AppActivationEvents.AppGraphReady,
|
|
32
|
+
AppActivationEvents.LayoutReady,
|
|
33
|
+
NavTreeEvents.StateReady,
|
|
34
|
+
),
|
|
35
|
+
activate: Effect.fnUntraced(function* () {
|
|
36
|
+
const layout = yield* Capabilities.getAtomValue(AppCapabilities.Layout);
|
|
37
|
+
const { invokePromise } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
38
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
39
|
+
if (invokePromise && layout.active.length === 1) {
|
|
63
40
|
// TODO(wittjosiah): This should really be fired once the navtree renders for the first time.
|
|
64
41
|
// That is the point at which the graph is expanded and the path should be available.
|
|
65
|
-
void graph
|
|
66
|
-
.
|
|
67
|
-
.then(() => dispatch(createIntent(LayoutAction.Expose, { part: 'navigation', subject: layout.active[0] })))
|
|
42
|
+
void Graph.waitForPath(graph, { target: layout.active[0] }, { timeout: 30_000 })
|
|
43
|
+
.then(() => invokePromise(LayoutOperation.Expose, { subject: layout.active[0] }))
|
|
68
44
|
.catch(() => {});
|
|
69
45
|
}
|
|
70
46
|
|
|
71
47
|
return [];
|
|
72
|
-
},
|
|
48
|
+
}),
|
|
73
49
|
}),
|
|
74
|
-
|
|
75
|
-
id:
|
|
76
|
-
activatesOn:
|
|
50
|
+
Plugin.addModule({
|
|
51
|
+
id: 'keyboard',
|
|
52
|
+
activatesOn: ActivationEvent.allOf(AppActivationEvents.AppGraphReady, ActivationEvents.ProcessManagerReady),
|
|
77
53
|
activate: Keyboard,
|
|
78
54
|
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}),
|
|
84
|
-
defineModule({
|
|
85
|
-
id: `${meta.id}/module/intent-resolver`,
|
|
86
|
-
activatesOn: Events.SetupIntentResolver,
|
|
87
|
-
activate: IntentResolver,
|
|
88
|
-
}),
|
|
89
|
-
defineModule({
|
|
90
|
-
id: `${meta.id}/module/app-graph-builder`,
|
|
91
|
-
activatesOn: Events.SetupAppGraph,
|
|
92
|
-
activate: AppGraphBuilder,
|
|
93
|
-
}),
|
|
94
|
-
]);
|
|
55
|
+
Plugin.make,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
export default NavTreePlugin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
7
|
+
|
|
8
|
+
import { OperationHandler } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
|
|
11
|
+
export const NavTreePlugin = Plugin.define(meta).pipe(
|
|
12
|
+
AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),
|
|
13
|
+
Plugin.make,
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export default NavTreePlugin;
|
|
@@ -2,52 +2,41 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import * as Function from 'effect/Function';
|
|
7
|
-
import * as Option from 'effect/Option';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
8
6
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
9
|
+
import { Operation } from '@dxos/compute';
|
|
10
|
+
import { GraphBuilder, Node, NodeMatcher } from '@dxos/plugin-graph';
|
|
11
11
|
|
|
12
|
-
import { COMMANDS_DIALOG, meta } from '
|
|
12
|
+
import { COMMANDS_DIALOG, meta } from '#meta';
|
|
13
13
|
|
|
14
|
-
export default (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
actions: (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
},
|
|
14
|
+
export default Capability.makeModule(
|
|
15
|
+
Effect.fnUntraced(function* () {
|
|
16
|
+
const extensions = yield* GraphBuilder.createExtension({
|
|
17
|
+
id: 'root',
|
|
18
|
+
match: NodeMatcher.whenRoot,
|
|
19
|
+
actions: () =>
|
|
20
|
+
Effect.succeed([
|
|
21
|
+
Node.makeAction({
|
|
22
|
+
id: COMMANDS_DIALOG,
|
|
23
|
+
data: () =>
|
|
24
|
+
Operation.invoke(LayoutOperation.UpdateDialog, {
|
|
25
|
+
subject: COMMANDS_DIALOG,
|
|
26
|
+
blockAlign: 'start',
|
|
27
|
+
}),
|
|
28
|
+
properties: {
|
|
29
|
+
label: ['open-commands.label', { ns: meta.id }],
|
|
30
|
+
icon: 'ph--magnifying-glass--regular',
|
|
31
|
+
keyBinding: {
|
|
32
|
+
macos: 'meta+k',
|
|
33
|
+
windows: 'ctrl+k',
|
|
47
34
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
]),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return Capability.contributes(AppCapabilities.AppGraphBuilder, extensions);
|
|
41
|
+
}),
|
|
42
|
+
);
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
7
|
|
|
7
|
-
export const AppGraphBuilder = lazy(() => import('./app-graph-builder'));
|
|
8
|
-
export const
|
|
9
|
-
export const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
8
|
+
export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
|
|
9
|
+
export const Keyboard = Capability.lazy('Keyboard', () => import('./keyboard'));
|
|
10
|
+
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
11
|
+
'OperationHandler',
|
|
12
|
+
() => import('./operation-handler'),
|
|
13
|
+
);
|
|
14
|
+
export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
|
|
15
|
+
export const State = Capability.lazy('State', () => import('./state'));
|
|
@@ -2,58 +2,65 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
6
9
|
import { debounce } from '@dxos/async';
|
|
7
10
|
import { Keyboard } from '@dxos/keyboard';
|
|
8
|
-
import {
|
|
11
|
+
import { Graph, Node, runAction } from '@dxos/plugin-graph';
|
|
9
12
|
import { getHostPlatform } from '@dxos/util';
|
|
10
13
|
|
|
11
|
-
import { KEY_BINDING } from '
|
|
12
|
-
|
|
13
|
-
export default (
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
14
|
+
import { KEY_BINDING } from '#meta';
|
|
15
|
+
|
|
16
|
+
export default Capability.makeModule(
|
|
17
|
+
Effect.fnUntraced(function* () {
|
|
18
|
+
const { graph } = yield* Capability.get(AppCapabilities.AppGraph);
|
|
19
|
+
const invoker = yield* Capability.get(Capabilities.OperationInvoker);
|
|
20
|
+
const pluginContext = yield* Capability.Service;
|
|
21
|
+
|
|
22
|
+
// TODO(wittjosiah): Factor out.
|
|
23
|
+
// TODO(wittjosiah): Handle removal of actions.
|
|
24
|
+
const visitor = (node: Node.Node, path: string[]) => {
|
|
25
|
+
let shortcut: string | undefined;
|
|
26
|
+
if (typeof node.properties.keyBinding === 'object') {
|
|
27
|
+
const availablePlatforms = Object.keys(node.properties.keyBinding);
|
|
28
|
+
const platform = getHostPlatform();
|
|
29
|
+
shortcut = availablePlatforms.includes(platform)
|
|
30
|
+
? node.properties.keyBinding[platform]
|
|
31
|
+
: platform === 'ios'
|
|
32
|
+
? node.properties.keyBinding.macos // Fallback to macos if ios-specific bindings not provided.
|
|
33
|
+
: platform === 'linux' || platform === 'unknown'
|
|
34
|
+
? node.properties.keyBinding.windows // Fallback to windows if platform-specific bindings not provided.
|
|
35
|
+
: undefined;
|
|
36
|
+
} else {
|
|
37
|
+
shortcut = node.properties.keyBinding;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (shortcut && Node.isAction(node)) {
|
|
41
|
+
Keyboard.singleton.getContext(path.slice(0, -1).join('/')).bind({
|
|
42
|
+
shortcut,
|
|
43
|
+
handler: () => void runAction(invoker, pluginContext, node, { parent: node, caller: KEY_BINDING }),
|
|
44
|
+
data: node.properties.label,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const eventHandler = debounce(() => {
|
|
50
|
+
Graph.traverse(graph, { relation: ['child', 'action'], visitor });
|
|
51
|
+
}, 500);
|
|
52
|
+
|
|
53
|
+
const unsubscribe = graph.onNodeChanged.on(eventHandler);
|
|
54
|
+
|
|
55
|
+
// TODO(burdon): Create context and plugin.
|
|
56
|
+
Keyboard.singleton.initialize();
|
|
57
|
+
Keyboard.singleton.setCurrentContext(Node.RootId);
|
|
58
|
+
|
|
59
|
+
return Capability.contributes(Capabilities.Null, null, () =>
|
|
60
|
+
Effect.sync(() => {
|
|
61
|
+
unsubscribe();
|
|
62
|
+
Keyboard.singleton.destroy();
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
65
|
+
}),
|
|
66
|
+
);
|