@dxos/plugin-navtree 0.8.4-main.fffef41 → 0.8.4-staging.60fe92afc8
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/PLUGIN.mdl +376 -0
- 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 +68 -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-MDGKDQMZ.mjs +37 -0
- package/dist/lib/neutral/chunk-MDGKDQMZ.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 +805 -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 +178 -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-YYTYJW4M.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-Q5XMAG7Z.mjs +50 -0
- package/dist/lib/neutral/react-surface-Q5XMAG7Z.mjs.map +7 -0
- package/dist/lib/neutral/state-VVJEWUHM.mjs +126 -0
- package/dist/lib/neutral/state-VVJEWUHM.mjs.map +7 -0
- package/dist/lib/neutral/testing/index.mjs +439 -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 +11 -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 +4 -3
- 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} +10 -6
- 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 +124 -62
- package/src/NavTreePlugin.node.ts +17 -0
- package/src/NavTreePlugin.test.ts +27 -0
- package/src/NavTreePlugin.tsx +46 -76
- 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 +55 -63
- 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 +25 -42
- package/src/components/Sidebar/L0Menu.tsx +155 -184
- package/src/components/Sidebar/L1Panel.tsx +181 -101
- 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 +5 -5
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useActions.ts +44 -0
- package/src/hooks/useLoadDescendents.ts +23 -0
- package/src/hooks/useNavTreeModel.ts +120 -0
- package/src/hooks/useNavTreeState.ts +35 -0
- package/src/index.ts +1 -3
- package/src/meta.ts +22 -7
- 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 +168 -238
- 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} +9 -5
- package/src/util.ts +28 -17
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/app-graph-builder-OHSCN3GX.mjs +0 -46
- package/dist/lib/browser/app-graph-builder-OHSCN3GX.mjs.map +0 -7
- package/dist/lib/browser/chunk-5VLWX4PK.mjs +0 -15
- package/dist/lib/browser/chunk-5VLWX4PK.mjs.map +0 -7
- package/dist/lib/browser/chunk-7D2MPHXV.mjs +0 -1483
- package/dist/lib/browser/chunk-7D2MPHXV.mjs.map +0 -7
- package/dist/lib/browser/chunk-E6MZBCU5.mjs +0 -19
- package/dist/lib/browser/chunk-E6MZBCU5.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-YUVXVPHG.mjs +0 -47
- package/dist/lib/browser/intent-resolver-YUVXVPHG.mjs.map +0 -7
- package/dist/lib/browser/keyboard-YYTYJW4M.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-J7MWWAGD.mjs +0 -51
- package/dist/lib/browser/react-surface-J7MWWAGD.mjs.map +0 -7
- package/dist/lib/browser/state-EUSVT6BI.mjs +0 -117
- package/dist/lib/browser/state-EUSVT6BI.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 -126
- package/src/components/CommandsDialog/CommandsTrigger.tsx +0 -36
- package/src/components/CommandsDialog/index.ts +0 -6
- package/src/components/NavTreeContainer.tsx +0 -369
- 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/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/PLUGIN.mdl
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: org.dxos.plugin.navtree
|
|
3
|
+
name: NavTreePlugin
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Hierarchical navigation sidebar for `DXOS` Composer — renders the application graph as a collapsible tree, manages workspace tabs, exposes keyboard-driven command search, and handles drag-and-drop rearrangement of spaces, folders, and objects.
|
|
8
|
+
|
|
9
|
+
## Extensions
|
|
10
|
+
|
|
11
|
+
The following extension dialects are used in this document.
|
|
12
|
+
Each extension is defined in the Appendix or resolved via its URI.
|
|
13
|
+
|
|
14
|
+
| Term | URI |
|
|
15
|
+
|-------------|--------------------------------|
|
|
16
|
+
| `type` | `org.dxos.mdl.type@1.0` |
|
|
17
|
+
| `feat` | `org.dxos.mdl.feat@1.0` |
|
|
18
|
+
| `test` | `org.dxos.mdl.test@1.0` |
|
|
19
|
+
| `component` | `org.dxos.mdl.component@1.0` |
|
|
20
|
+
| `op` | `org.dxos.mdl.op@1.0` |
|
|
21
|
+
|
|
22
|
+
## Types
|
|
23
|
+
|
|
24
|
+
```mdl
|
|
25
|
+
type NavTreeItemState
|
|
26
|
+
fields:
|
|
27
|
+
open: boolean # whether the tree node is expanded
|
|
28
|
+
current: boolean # whether the node is in the active layout
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```mdl
|
|
32
|
+
type KeyBinding
|
|
33
|
+
fields:
|
|
34
|
+
macos?: string
|
|
35
|
+
windows?: string
|
|
36
|
+
linux?: string
|
|
37
|
+
ios?: string
|
|
38
|
+
unknown?: string
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```mdl
|
|
42
|
+
type NodeProperties
|
|
43
|
+
fields:
|
|
44
|
+
label: Label
|
|
45
|
+
icon?: string
|
|
46
|
+
iconHue?: string
|
|
47
|
+
role?: string
|
|
48
|
+
error?: string
|
|
49
|
+
modified?: boolean
|
|
50
|
+
palette?: string
|
|
51
|
+
disabled?: boolean
|
|
52
|
+
testId?: string
|
|
53
|
+
position?: Position
|
|
54
|
+
className?: string
|
|
55
|
+
keyBinding?: string | KeyBinding
|
|
56
|
+
persistenceClass?: string
|
|
57
|
+
persistenceKey?: string
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Components
|
|
61
|
+
|
|
62
|
+
```mdl
|
|
63
|
+
component NavTree
|
|
64
|
+
desc: Root navigation tree that renders workspace tabs at the top level and a collapsible subtree for the active workspace.
|
|
65
|
+
props:
|
|
66
|
+
id: string # root node id (Node.RootId)
|
|
67
|
+
root: Node # root of the application graph
|
|
68
|
+
tab: string # currently active workspace tab id
|
|
69
|
+
open: boolean # whether the navigation sidebar is open
|
|
70
|
+
state:
|
|
71
|
+
model: NavTreeModel # live tree model built from graph connections
|
|
72
|
+
slots:
|
|
73
|
+
itemEnd?: ReactNode # per-item trailing content (e.g. action badges)
|
|
74
|
+
actions:
|
|
75
|
+
openChange(item: Node, path: string[], open: boolean)
|
|
76
|
+
tabChange(node: Node)
|
|
77
|
+
select(item: Node, path: string[], option: boolean)
|
|
78
|
+
back()
|
|
79
|
+
itemHover(item: Node)
|
|
80
|
+
layout: |
|
|
81
|
+
┌─────────────────────────┐
|
|
82
|
+
│ workspace tabs │
|
|
83
|
+
│ [tab] [tab] [tab] │
|
|
84
|
+
├─────────────────────────┤
|
|
85
|
+
│ collapsible tree │
|
|
86
|
+
│ ▾ Space │
|
|
87
|
+
│ ▾ Folder │
|
|
88
|
+
│ • Object │
|
|
89
|
+
│ • Object │
|
|
90
|
+
│ • Object │
|
|
91
|
+
└─────────────────────────┘
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```mdl
|
|
95
|
+
component NavTreeContainer
|
|
96
|
+
desc: Smart container that wires the NavTree to the app graph, layout state, and drag-and-drop monitor.
|
|
97
|
+
props:
|
|
98
|
+
tab: string
|
|
99
|
+
popoverAnchorId?: string
|
|
100
|
+
state:
|
|
101
|
+
layout: LayoutState # active items, sidebar open/closed, mode
|
|
102
|
+
model: NavTreeModel
|
|
103
|
+
actions:
|
|
104
|
+
handleSelect(item: Node, path: string[], option: boolean)
|
|
105
|
+
handleOpenChange(item: Node, path: string[], open: boolean)
|
|
106
|
+
handleTabChange(node: Node)
|
|
107
|
+
handleBack()
|
|
108
|
+
handleDrop(source: TreeData, target: TreeData, instruction: Instruction)
|
|
109
|
+
emits:
|
|
110
|
+
onNavigate(subject: string | string[])
|
|
111
|
+
layout: |
|
|
112
|
+
┌──────────────────────────┐
|
|
113
|
+
│ NavTreeContext.Provider │
|
|
114
|
+
│ └─ NavTree │
|
|
115
|
+
└──────────────────────────┘
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```mdl
|
|
119
|
+
component CommandsDialogContent
|
|
120
|
+
desc: Full-screen command palette dialog — surfaces all graph actions, searchable by label.
|
|
121
|
+
props:
|
|
122
|
+
onClose?: () => void
|
|
123
|
+
state:
|
|
124
|
+
query: string
|
|
125
|
+
results: Node[]
|
|
126
|
+
actions:
|
|
127
|
+
search(query: string) → Node[]
|
|
128
|
+
execute(node: Node)
|
|
129
|
+
layout: |
|
|
130
|
+
┌──────────────────────────┐
|
|
131
|
+
│ [search input] │
|
|
132
|
+
├──────────────────────────┤
|
|
133
|
+
│ result list │
|
|
134
|
+
│ icon label shortcut │
|
|
135
|
+
│ icon label │
|
|
136
|
+
│ … │
|
|
137
|
+
└──────────────────────────┘
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
```mdl
|
|
141
|
+
component CommandsTrigger
|
|
142
|
+
desc: Search-input surface slot component — opens the commands dialog on click or ⌘K / Ctrl+K.
|
|
143
|
+
slots:
|
|
144
|
+
(none)
|
|
145
|
+
actions:
|
|
146
|
+
openCommandsDialog()
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Operations
|
|
150
|
+
|
|
151
|
+
```mdl
|
|
152
|
+
op expose
|
|
153
|
+
desc: Expands tree nodes along the path to a subject and marks each as open so the item becomes visible in the NavTree.
|
|
154
|
+
input:
|
|
155
|
+
subject: string # attendable DXN or node id
|
|
156
|
+
output: void
|
|
157
|
+
effects: [echo:read]
|
|
158
|
+
note: |
|
|
159
|
+
Resolves the full ancestor path via expandAttendableId, calls Graph.expand per node,
|
|
160
|
+
then sets each path segment open in NavTreeCapabilities.State.
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Features
|
|
164
|
+
|
|
165
|
+
```mdl
|
|
166
|
+
feat F-1: Sidebar Navigation
|
|
167
|
+
|
|
168
|
+
req F-1.1: NavTree renders all root-level graph connections as workspace tabs.
|
|
169
|
+
req F-1.2:
|
|
170
|
+
when: user selects a workspace tab
|
|
171
|
+
then: LayoutOperation.SwitchWorkspace is invoked; subtree for that workspace is expanded
|
|
172
|
+
req F-1.3:
|
|
173
|
+
when: sidebar is closed and user selects a workspace tab
|
|
174
|
+
then: sidebar opens (state transitions to expanded)
|
|
175
|
+
req F-1.4:
|
|
176
|
+
when: same active tab is clicked while sidebar is expanded
|
|
177
|
+
then: sidebar collapses (state transitions to collapsed or closed on mobile)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
```mdl
|
|
181
|
+
feat F-2: Tree Expand / Collapse
|
|
182
|
+
|
|
183
|
+
req F-2.1: Tree items with children show an expand/collapse toggle.
|
|
184
|
+
req F-2.2:
|
|
185
|
+
when: user expands a node
|
|
186
|
+
then: open state persisted to localStorage keyed by path; Graph.expand called for the node
|
|
187
|
+
req F-2.3:
|
|
188
|
+
when: plugin initialises after layout is ready
|
|
189
|
+
then: all paths previously marked open are re-expanded from localStorage
|
|
190
|
+
req F-2.4:
|
|
191
|
+
when: op:expose is called
|
|
192
|
+
then: all ancestors of the subject are expanded and marked open
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
```mdl
|
|
196
|
+
feat F-3: Item Selection
|
|
197
|
+
|
|
198
|
+
req F-3.1:
|
|
199
|
+
when: user selects a non-current item
|
|
200
|
+
then: LayoutOperation.Open (single mode) or LayoutOperation.Set (multi mode) is invoked
|
|
201
|
+
req F-3.2:
|
|
202
|
+
when: user option-clicks a currently active item
|
|
203
|
+
then: LayoutOperation.Close is invoked for that item
|
|
204
|
+
req F-3.3:
|
|
205
|
+
when: user clicks a currently active item without option key
|
|
206
|
+
then: LayoutOperation.ScrollIntoView is invoked
|
|
207
|
+
req F-3.4:
|
|
208
|
+
when: item has a default disposition action
|
|
209
|
+
then: that action is run after navigation
|
|
210
|
+
req F-3.5:
|
|
211
|
+
when: navigation succeeds on mobile
|
|
212
|
+
then: sidebar is closed automatically
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
```mdl
|
|
216
|
+
feat F-4: Drag and Drop
|
|
217
|
+
|
|
218
|
+
req F-4.1: NavTree items can be dragged to rearrange within the same parent.
|
|
219
|
+
req F-4.2: NavTree items can be dragged to copy or transfer to a different parent.
|
|
220
|
+
req F-4.3:
|
|
221
|
+
when: drop instruction is rearrange
|
|
222
|
+
then: onRearrange callback on the parent node is called with the new order
|
|
223
|
+
req F-4.4:
|
|
224
|
+
when: drop instruction is copy
|
|
225
|
+
then: onCopy callback on the target node is called
|
|
226
|
+
req F-4.5:
|
|
227
|
+
when: drop instruction is transfer
|
|
228
|
+
then: onTransferStart and onTransferEnd callbacks are called on source and target parents
|
|
229
|
+
req F-4.6:
|
|
230
|
+
when: target node reports blockInstruction for an instruction type
|
|
231
|
+
then: that instruction is blocked and the drop is not applied
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
```mdl
|
|
235
|
+
feat F-5: Keyboard Shortcuts
|
|
236
|
+
|
|
237
|
+
req F-5.1: NavTree plugin registers keyboard shortcuts for all graph actions that declare a keyBinding property.
|
|
238
|
+
req F-5.2: Graph is traversed on change (debounced 500 ms) to bind newly added shortcuts.
|
|
239
|
+
req F-5.3: The commands dialog is opened via ⌘K (macOS) / Ctrl+K (Windows/Linux).
|
|
240
|
+
req F-5.4:
|
|
241
|
+
when: plugin deactivates
|
|
242
|
+
then: Keyboard.singleton is destroyed and all shortcuts are unregistered
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
```mdl
|
|
246
|
+
feat F-6: State Persistence
|
|
247
|
+
|
|
248
|
+
req F-6.1: Per-path open/current state is stored in an atom family keyed by path string.
|
|
249
|
+
req F-6.2: Open state (not current) is persisted to localStorage on every change.
|
|
250
|
+
req F-6.3: Current state reflects active layout items and is never persisted.
|
|
251
|
+
req F-6.4:
|
|
252
|
+
when: layout.active changes
|
|
253
|
+
then: removed items are marked not-current; newly active items are marked current
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Acceptance
|
|
257
|
+
|
|
258
|
+
```mdl
|
|
259
|
+
test T-1: Workspace tab switch
|
|
260
|
+
given: two workspace tabs exist in the graph
|
|
261
|
+
when: user clicks the second workspace tab
|
|
262
|
+
then:
|
|
263
|
+
- LayoutOperation.SwitchWorkspace is invoked with the tab's node id
|
|
264
|
+
- sidebar transitions to expanded
|
|
265
|
+
- subtree for the selected workspace is expanded
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
```mdl
|
|
269
|
+
test T-2: Tree node expand persists
|
|
270
|
+
given: NavTree is rendered with a collapsed folder node
|
|
271
|
+
when: user expands the folder
|
|
272
|
+
then:
|
|
273
|
+
- folder node state.open === true
|
|
274
|
+
- localStorage entry updated for the folder's path
|
|
275
|
+
- Graph.expand called for the folder node id
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
```mdl
|
|
279
|
+
test T-3: Expose navigates to nested item
|
|
280
|
+
given: a deeply nested object id is active in the layout
|
|
281
|
+
when: op:expose is called with that object id
|
|
282
|
+
then:
|
|
283
|
+
- all ancestor paths are marked open
|
|
284
|
+
- Graph.expand is called for each ancestor
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
```mdl
|
|
288
|
+
test T-4: Select item in single mode
|
|
289
|
+
given: layout.mode === single, item not currently active
|
|
290
|
+
when: user selects a tree item
|
|
291
|
+
then: LayoutOperation.Open is invoked with the item id
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
```mdl
|
|
295
|
+
test T-5: Command palette opens on keyboard shortcut
|
|
296
|
+
given: NavTree is active
|
|
297
|
+
when: user presses ⌘K (macOS) or Ctrl+K (Windows)
|
|
298
|
+
then:
|
|
299
|
+
- CommandsDialogContent is shown in the layout dialog slot
|
|
300
|
+
- search input is focused
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
```mdl
|
|
304
|
+
test T-6: Drag-and-drop rearrange
|
|
305
|
+
given: two sibling items in the same folder
|
|
306
|
+
when: user drags the first item below the second
|
|
307
|
+
then:
|
|
308
|
+
- onRearrange callback is called with the reordered array
|
|
309
|
+
- tree re-renders with the new order
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Appendix: Extension Definitions
|
|
315
|
+
|
|
316
|
+
```mdl
|
|
317
|
+
ext type
|
|
318
|
+
uri: org.dxos.mdl.type@1.0
|
|
319
|
+
desc: A named data structure with typed fields and optional literals.
|
|
320
|
+
fields:
|
|
321
|
+
desc?: Prose
|
|
322
|
+
fields?: FieldMap
|
|
323
|
+
literals?: UnionList
|
|
324
|
+
extends?: TypeRef[]
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
```mdl
|
|
328
|
+
ext feat
|
|
329
|
+
uri: org.dxos.mdl.feat@1.0
|
|
330
|
+
desc: A named feature grouping one or more requirements.
|
|
331
|
+
fields:
|
|
332
|
+
desc?: Prose
|
|
333
|
+
req: RequirementList
|
|
334
|
+
nesting: self
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
```mdl
|
|
338
|
+
ext test
|
|
339
|
+
uri: org.dxos.mdl.test@1.0
|
|
340
|
+
desc: An acceptance scenario expressed as given / when / then steps.
|
|
341
|
+
fields:
|
|
342
|
+
given?: Step | Step[]
|
|
343
|
+
when?: Step | Step[]
|
|
344
|
+
then: Step | Step[]
|
|
345
|
+
tags?: TagList
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
```mdl
|
|
349
|
+
ext component
|
|
350
|
+
uri: org.dxos.mdl.component@1.0
|
|
351
|
+
desc: A UI component with props, internal state, slots, actions, and events.
|
|
352
|
+
fields:
|
|
353
|
+
desc?: Prose
|
|
354
|
+
props?: FieldMap
|
|
355
|
+
state?: FieldMap
|
|
356
|
+
slots?: FieldMap
|
|
357
|
+
actions?: ActionMap
|
|
358
|
+
emits?: EventMap
|
|
359
|
+
layout?: CodeBlock
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
```mdl
|
|
363
|
+
ext op
|
|
364
|
+
uri: org.dxos.mdl.op@1.0
|
|
365
|
+
desc: |
|
|
366
|
+
A named operation with typed inputs, outputs, and declared errors.
|
|
367
|
+
Pure ops have no effects or requires. Effectful ops declare both.
|
|
368
|
+
fields:
|
|
369
|
+
desc?: Prose
|
|
370
|
+
input?: FieldMap
|
|
371
|
+
output?: TypeExpr
|
|
372
|
+
errors?: ErrorMap
|
|
373
|
+
effects?: EffectList
|
|
374
|
+
requires?: ServiceList
|
|
375
|
+
note?: Prose
|
|
376
|
+
```
|
package/README.md
CHANGED
|
@@ -12,4 +12,4 @@ DXOS Surface plugin for a tree view visualization of the graph.
|
|
|
12
12
|
|
|
13
13
|
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
14
14
|
|
|
15
|
-
License: [
|
|
15
|
+
License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2023 © DXOS
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/containers/CommandsDialogContent/CommandsDialogContent.tsx
|
|
4
|
+
import React, { forwardRef, useMemo, useState } from "react";
|
|
5
|
+
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
6
|
+
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
7
|
+
import { useAppGraph } from "@dxos/app-toolkit/ui";
|
|
8
|
+
import { Keyboard, keySymbols } from "@dxos/keyboard";
|
|
9
|
+
import { Graph, Node, useActionRunner } from "@dxos/plugin-graph";
|
|
10
|
+
import { useActions } from "@dxos/plugin-graph";
|
|
11
|
+
import { Button, Dialog, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
12
|
+
import { SearchList, useSearchListResults } from "@dxos/react-ui-search";
|
|
13
|
+
import { osTranslations } from "@dxos/ui-theme";
|
|
14
|
+
import { getHostPlatform } from "@dxos/util";
|
|
15
|
+
import { KEY_BINDING, meta } from "#meta";
|
|
16
|
+
var CommandsDialogContent = /* @__PURE__ */ forwardRef(({ selected: initial }, forwardedRef) => {
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
|
+
const { invokePromise } = useOperationInvoker();
|
|
19
|
+
const runAction = useActionRunner();
|
|
20
|
+
const { graph } = useAppGraph();
|
|
21
|
+
const [selected, setSelected] = useState(initial);
|
|
22
|
+
const allActions = useMemo(() => {
|
|
23
|
+
const current = Keyboard.singleton.getCurrentContext();
|
|
24
|
+
const actionMap = /* @__PURE__ */ new Set();
|
|
25
|
+
const actions2 = [];
|
|
26
|
+
Graph.traverse(graph, {
|
|
27
|
+
relation: [
|
|
28
|
+
"child",
|
|
29
|
+
"action"
|
|
30
|
+
],
|
|
31
|
+
visitor: (node, path) => {
|
|
32
|
+
const isActionLike = Node.isAction(node) || Node.isActionGroup(node);
|
|
33
|
+
const parentId = path.at(-2) ?? "";
|
|
34
|
+
const matches = current === parentId || current.startsWith(parentId + "/");
|
|
35
|
+
if (isActionLike && !actionMap.has(node.id) && matches) {
|
|
36
|
+
actionMap.add(node.id);
|
|
37
|
+
actions2.push(node);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
actions2.sort((a, b) => {
|
|
42
|
+
return toLocalizedString(a.properties.label, t)?.toLowerCase().localeCompare(toLocalizedString(b.properties.label, t)?.toLowerCase());
|
|
43
|
+
});
|
|
44
|
+
return actions2;
|
|
45
|
+
}, [
|
|
46
|
+
graph
|
|
47
|
+
]);
|
|
48
|
+
const group = allActions.find(({ id }) => id === selected);
|
|
49
|
+
const groupActions = useActions(graph, group?.id);
|
|
50
|
+
const actions = Node.isActionGroup(group) ? groupActions : allActions;
|
|
51
|
+
const { results, handleSearch } = useSearchListResults({
|
|
52
|
+
items: actions,
|
|
53
|
+
extract: (action) => toLocalizedString(action.properties.label, t)
|
|
54
|
+
});
|
|
55
|
+
return /* @__PURE__ */ React.createElement(Dialog.Content, {
|
|
56
|
+
ref: forwardedRef
|
|
57
|
+
}, /* @__PURE__ */ React.createElement(Dialog.Title, {
|
|
58
|
+
srOnly: true
|
|
59
|
+
}, t("commands-dialog.title", {
|
|
60
|
+
ns: meta.id
|
|
61
|
+
})), /* @__PURE__ */ React.createElement(SearchList.Root, {
|
|
62
|
+
onSearch: handleSearch
|
|
63
|
+
}, /* @__PURE__ */ React.createElement(SearchList.Input, {
|
|
64
|
+
placeholder: t("command-list-input.placeholder")
|
|
65
|
+
}), /* @__PURE__ */ React.createElement(SearchList.Viewport, null, results.map((action) => {
|
|
66
|
+
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
67
|
+
return /* @__PURE__ */ React.createElement(SearchList.Item, {
|
|
68
|
+
value: action.id,
|
|
69
|
+
key: action.id,
|
|
70
|
+
label: toLocalizedString(action.properties.label, t),
|
|
71
|
+
icon: action.properties.icon,
|
|
72
|
+
suffix: shortcut ? keySymbols(shortcut).join("") : void 0,
|
|
73
|
+
onSelect: () => {
|
|
74
|
+
if (action.properties.disabled) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (Node.isActionGroup(action)) {
|
|
78
|
+
setSelected(action.id);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
void invokePromise(LayoutOperation.UpdateDialog, {
|
|
82
|
+
state: false
|
|
83
|
+
});
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
const lookupId = group?.id ?? action.id;
|
|
86
|
+
const node = Graph.getConnections(graph, lookupId, Node.actionRelation("inbound"))[0];
|
|
87
|
+
if (node && Node.isAction(action)) {
|
|
88
|
+
void runAction(action, {
|
|
89
|
+
parent: node,
|
|
90
|
+
caller: KEY_BINDING
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
classNames: "flex items-center gap-2",
|
|
96
|
+
disabled: action.properties.disabled,
|
|
97
|
+
...action.properties?.testId && {
|
|
98
|
+
"data-testid": action.properties.testId
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}))), /* @__PURE__ */ React.createElement(Dialog.ActionBar, null, /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
102
|
+
asChild: true
|
|
103
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
104
|
+
classNames: "w-full"
|
|
105
|
+
}, t("close.label", {
|
|
106
|
+
ns: osTranslations
|
|
107
|
+
})))));
|
|
108
|
+
});
|
|
109
|
+
export {
|
|
110
|
+
CommandsDialogContent as default
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=CommandsDialogContent-UBGIQ5FI.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/CommandsDialogContent/CommandsDialogContent.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { forwardRef, useMemo, useState } from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { useAppGraph } from '@dxos/app-toolkit/ui';\nimport { Keyboard, keySymbols } from '@dxos/keyboard';\nimport { Graph, Node, useActionRunner } from '@dxos/plugin-graph';\nimport { useActions } from '@dxos/plugin-graph';\nimport { Button, Dialog, toLocalizedString, useTranslation } from '@dxos/react-ui';\nimport { SearchList, useSearchListResults } from '@dxos/react-ui-search';\nimport { osTranslations } from '@dxos/ui-theme';\nimport { getHostPlatform } from '@dxos/util';\n\nimport { KEY_BINDING, meta } from '#meta';\n\nexport type CommandsDialogContentProps = {\n selected?: string;\n};\n\n// TODO(wittjosiah): This probably deserves its own plugin but for now it lives here w/ other navigation UI.\nexport const CommandsDialogContent = forwardRef<HTMLDivElement, CommandsDialogContentProps>(\n ({ selected: initial }, forwardedRef) => {\n const { t } = useTranslation(meta.id);\n const { invokePromise } = useOperationInvoker();\n const runAction = useActionRunner();\n const { graph } = useAppGraph();\n const [selected, setSelected] = useState<string | undefined>(initial);\n\n // Traverse graph.\n // TODO(burdon): Factor out commonality with shortcut dialog.\n const allActions = useMemo(() => {\n // TODO(burdon): Get from navtree (not keyboard).\n const current = Keyboard.singleton.getCurrentContext();\n const actionMap = new Set<string>();\n const actions: Node.ActionLike[] = [];\n Graph.traverse(graph, {\n relation: ['child', 'action'],\n visitor: (node, path) => {\n const isActionLike = Node.isAction(node) || Node.isActionGroup(node);\n const parentId = path.at(-2) ?? '';\n const matches = current === parentId || current.startsWith(parentId + '/');\n if (isActionLike && !actionMap.has(node.id) && matches) {\n actionMap.add(node.id);\n actions.push(node);\n }\n },\n });\n\n actions.sort((a, b) => {\n return toLocalizedString(a.properties.label, t)\n ?.toLowerCase()\n .localeCompare(toLocalizedString(b.properties.label, t)?.toLowerCase());\n });\n\n return actions;\n }, [graph]);\n\n const group = allActions.find(({ id }) => id === selected);\n const groupActions = useActions(graph, group?.id);\n const actions = Node.isActionGroup(group) ? groupActions : allActions;\n\n const { results, handleSearch } = useSearchListResults({\n items: actions,\n extract: (action) => toLocalizedString(action.properties.label, t),\n });\n\n return (\n <Dialog.Content ref={forwardedRef}>\n <Dialog.Title srOnly>{t('commands-dialog.title', { ns: meta.id })}</Dialog.Title>\n <SearchList.Root onSearch={handleSearch}>\n <SearchList.Input placeholder={t('command-list-input.placeholder')} />\n <SearchList.Viewport>\n {results.map((action) => {\n const shortcut =\n typeof action.properties.keyBinding === 'string'\n ? action.properties.keyBinding\n : action.properties.keyBinding?.[getHostPlatform()];\n\n return (\n <SearchList.Item\n value={action.id}\n key={action.id}\n label={toLocalizedString(action.properties.label, t)}\n icon={action.properties.icon}\n suffix={shortcut ? keySymbols(shortcut).join('') : undefined}\n onSelect={() => {\n if (action.properties.disabled) {\n return;\n }\n\n if (Node.isActionGroup(action)) {\n setSelected(action.id);\n return;\n }\n\n void invokePromise(LayoutOperation.UpdateDialog, { state: false });\n setTimeout(() => {\n const lookupId = group?.id ?? action.id;\n const node = Graph.getConnections(graph, lookupId, Node.actionRelation('inbound'))[0];\n if (node && Node.isAction(action)) {\n void runAction(action, { parent: node, caller: KEY_BINDING });\n }\n });\n }}\n classNames='flex items-center gap-2'\n disabled={action.properties.disabled}\n {...(action.properties?.testId && {\n 'data-testid': action.properties.testId,\n })}\n />\n );\n })}\n </SearchList.Viewport>\n </SearchList.Root>\n <Dialog.ActionBar>\n <Dialog.Close asChild>\n <Button classNames='w-full'>{t('close.label', { ns: osTranslations })}</Button>\n </Dialog.Close>\n </Dialog.ActionBar>\n </Dialog.Content>\n );\n },\n);\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["React", "forwardRef", "useMemo", "useState", "useOperationInvoker", "LayoutOperation", "useAppGraph", "Keyboard", "keySymbols", "Graph", "Node", "useActionRunner", "useActions", "Button", "Dialog", "toLocalizedString", "useTranslation", "SearchList", "useSearchListResults", "osTranslations", "getHostPlatform", "KEY_BINDING", "meta", "CommandsDialogContent", "selected", "initial", "forwardedRef", "t", "id", "invokePromise", "runAction", "graph", "setSelected", "allActions", "current", "singleton", "getCurrentContext", "actionMap", "Set", "actions", "traverse", "relation", "visitor", "node", "path", "isActionLike", "isAction", "isActionGroup", "parentId", "at", "matches", "startsWith", "has", "add", "push", "sort", "a", "b", "properties", "label", "toLowerCase", "localeCompare", "group", "find", "groupActions", "results", "handleSearch", "items", "extract", "action", "Content", "ref", "Title", "srOnly", "ns", "Root", "onSearch", "Input", "placeholder", "Viewport", "map", "shortcut", "keyBinding", "Item", "value", "key", "icon", "suffix", "join", "undefined", "onSelect", "disabled", "UpdateDialog", "state", "setTimeout", "lookupId", "getConnections", "actionRelation", "parent", "caller", "classNames", "testId", "ActionBar", "Close", "asChild"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/containers/CommandsTrigger/CommandsTrigger.tsx
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { useOperationInvoker } from "@dxos/app-framework/ui";
|
|
6
|
+
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
7
|
+
import { Button, Icon, useTranslation } from "@dxos/react-ui";
|
|
8
|
+
import { COMMANDS_DIALOG, meta } from "#meta";
|
|
9
|
+
var CommandsTrigger = () => {
|
|
10
|
+
const { invokePromise } = useOperationInvoker();
|
|
11
|
+
const { t } = useTranslation(meta.id);
|
|
12
|
+
return /* @__PURE__ */ React.createElement(Button, {
|
|
13
|
+
classNames: "m-1 px-1 lg:px-2",
|
|
14
|
+
onClick: () => void invokePromise(LayoutOperation.UpdateDialog, {
|
|
15
|
+
subject: COMMANDS_DIALOG,
|
|
16
|
+
blockAlign: "start"
|
|
17
|
+
})
|
|
18
|
+
}, /* @__PURE__ */ React.createElement("span", {
|
|
19
|
+
className: "text-description font-normal grow text-start"
|
|
20
|
+
}, t("command-list-input.placeholder")), /* @__PURE__ */ React.createElement(Icon, {
|
|
21
|
+
icon: "ph--magnifying-glass--regular"
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
CommandsTrigger as default
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=CommandsTrigger-BH5WLMHK.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/CommandsTrigger/CommandsTrigger.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { useOperationInvoker } from '@dxos/app-framework/ui';\nimport { LayoutOperation } from '@dxos/app-toolkit';\nimport { Button, Icon, useTranslation } from '@dxos/react-ui';\n\nimport { COMMANDS_DIALOG, meta } from '#meta';\n\n// TODO(thure): Refactor to be handled by a more appropriate plugin.\nexport const CommandsTrigger = () => {\n const { invokePromise } = useOperationInvoker();\n const { t } = useTranslation(meta.id);\n return (\n <Button\n classNames='m-1 px-1 lg:px-2'\n onClick={() =>\n void invokePromise(LayoutOperation.UpdateDialog, { subject: COMMANDS_DIALOG, blockAlign: 'start' })\n }\n >\n <span className='text-description font-normal grow text-start'>{t('command-list-input.placeholder')}</span>\n <Icon icon='ph--magnifying-glass--regular' />\n </Button>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;AAIA,OAAOA,WAAW;AAElB,SAASC,2BAA2B;AACpC,SAASC,uBAAuB;AAChC,SAASC,QAAQC,MAAMC,sBAAsB;AAE7C,SAASC,iBAAiBC,YAAY;AAG/B,IAAMC,kBAAkB,MAAA;AAC7B,QAAM,EAAEC,cAAa,IAAKR,oBAAAA;AAC1B,QAAM,EAAES,EAAC,IAAKL,eAAeE,KAAKI,EAAE;AACpC,SACE,sBAAA,cAACR,QAAAA;IACCS,YAAW;IACXC,SAAS,MACP,KAAKJ,cAAcP,gBAAgBY,cAAc;MAAEC,SAAST;MAAiBU,YAAY;IAAQ,CAAA;KAGnG,sBAAA,cAACC,QAAAA;IAAKC,WAAU;KAAgDR,EAAE,gCAAA,CAAA,GAClE,sBAAA,cAACN,MAAAA;IAAKe,MAAK;;AAGjB;",
|
|
6
|
+
"names": ["React", "useOperationInvoker", "LayoutOperation", "Button", "Icon", "useTranslation", "COMMANDS_DIALOG", "meta", "CommandsTrigger", "invokePromise", "t", "id", "classNames", "onClick", "UpdateDialog", "subject", "blockAlign", "span", "className", "icon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
NODE_TYPE,
|
|
3
|
+
NavTreeContainer
|
|
4
|
+
} from "./chunk-5OPDKH6B.mjs";
|
|
5
|
+
import "./chunk-JOSNCOV4.mjs";
|
|
6
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
7
|
+
export {
|
|
8
|
+
NODE_TYPE,
|
|
9
|
+
NavTreeContainer,
|
|
10
|
+
NavTreeContainer as default
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=NavTreeContainer-6AR4BFDD.mjs.map
|