@dxos/plugin-navtree 0.8.4-main.fd6878d → 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-HMTMA33N.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 -105
- 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 +25 -5
- 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 +33 -4
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +10 -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 +8 -5
- 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 +3 -4
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +23 -6
- 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 -4
- 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} +14 -9
- 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 +56 -87
- package/src/NavTreePlugin.workerd.ts +16 -0
- package/src/capabilities/app-graph-builder.ts +34 -44
- 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 +112 -106
- package/src/components/NavTree/NavTree.tsx +69 -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 +25 -19
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +78 -54
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +40 -51
- package/src/components/Sidebar/L0Menu.tsx +182 -210
- package/src/components/Sidebar/L1Panel.tsx +185 -110
- package/src/components/Sidebar/L1Tabs.tsx +18 -34
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +9 -9
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +20 -12
- 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 +5 -4
- package/src/containers/NavTreeDocumentTitle/index.ts +5 -0
- package/src/containers/index.ts +12 -0
- package/src/experimental/Tree.stories.tsx +105 -110
- package/src/experimental/Tree.tsx +7 -24
- 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 +26 -8
- 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 +169 -238
- package/src/testing/generator.ts +36 -39
- 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} +13 -8
- package/src/util.ts +28 -17
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/app-graph-builder-6JDBQ25U.mjs +0 -45
- package/dist/lib/browser/app-graph-builder-6JDBQ25U.mjs.map +0 -7
- package/dist/lib/browser/chunk-ERDGQTH5.mjs +0 -16
- package/dist/lib/browser/chunk-ERDGQTH5.mjs.map +0 -7
- package/dist/lib/browser/chunk-SNGLGBFJ.mjs +0 -1469
- package/dist/lib/browser/chunk-SNGLGBFJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-WCARAZ7J.mjs +0 -15
- package/dist/lib/browser/chunk-WCARAZ7J.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -148
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-N35ZIHFD.mjs +0 -47
- package/dist/lib/browser/intent-resolver-N35ZIHFD.mjs.map +0 -7
- package/dist/lib/browser/keyboard-HMTMA33N.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-WKWXMM2N.mjs +0 -51
- package/dist/lib/browser/react-surface-WKWXMM2N.mjs.map +0 -7
- package/dist/lib/browser/state-P5DGL7KS.mjs +0 -117
- package/dist/lib/browser/state-P5DGL7KS.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 -337
- 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,1469 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NavTreeCapabilities
|
|
3
|
-
} from "./chunk-WCARAZ7J.mjs";
|
|
4
|
-
import {
|
|
5
|
-
COMMANDS_DIALOG,
|
|
6
|
-
KEY_BINDING,
|
|
7
|
-
NAVTREE_PLUGIN,
|
|
8
|
-
meta
|
|
9
|
-
} from "./chunk-ERDGQTH5.mjs";
|
|
10
|
-
|
|
11
|
-
// src/components/CommandsDialog/CommandsDialog.tsx
|
|
12
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
13
|
-
import React, { useMemo, useState } from "react";
|
|
14
|
-
import { LayoutAction, createIntent, useAppGraph, useIntentDispatcher } from "@dxos/app-framework";
|
|
15
|
-
import { isAction, isActionGroup } from "@dxos/app-graph";
|
|
16
|
-
import { Keyboard, keySymbols } from "@dxos/keyboard";
|
|
17
|
-
import { useActions } from "@dxos/plugin-graph";
|
|
18
|
-
import { Button, Dialog, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
19
|
-
import { SearchList } from "@dxos/react-ui-searchlist";
|
|
20
|
-
import { cardDialogContent, cardDialogHeader, cardDialogPaddedOverflow, cardDialogSearchListRoot } from "@dxos/react-ui-stack";
|
|
21
|
-
import { descriptionText, mx } from "@dxos/react-ui-theme";
|
|
22
|
-
import { getHostPlatform } from "@dxos/util";
|
|
23
|
-
var CommandsDialogContent = ({ selected: initial }) => {
|
|
24
|
-
var _effect = _useSignals();
|
|
25
|
-
try {
|
|
26
|
-
const { t } = useTranslation(NAVTREE_PLUGIN);
|
|
27
|
-
const [selected, setSelected] = useState(initial);
|
|
28
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
29
|
-
const { graph } = useAppGraph();
|
|
30
|
-
const allActions = useMemo(() => {
|
|
31
|
-
const current = Keyboard.singleton.getCurrentContext();
|
|
32
|
-
const actionMap = /* @__PURE__ */ new Set();
|
|
33
|
-
const actions2 = [];
|
|
34
|
-
graph.traverse({
|
|
35
|
-
visitor: (node, path) => {
|
|
36
|
-
if ((isAction(node) || isActionGroup(node)) && !actionMap.has(node.id) && current.startsWith(path.slice(0, -1).join("/"))) {
|
|
37
|
-
actionMap.add(node.id);
|
|
38
|
-
actions2.push(node);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
actions2.sort((a, b) => {
|
|
43
|
-
return toLocalizedString(a.properties.label, t)?.toLowerCase().localeCompare(toLocalizedString(b.properties.label, t)?.toLowerCase());
|
|
44
|
-
});
|
|
45
|
-
return actions2;
|
|
46
|
-
}, [
|
|
47
|
-
graph
|
|
48
|
-
]);
|
|
49
|
-
const group = allActions.find(({ id }) => id === selected);
|
|
50
|
-
const groupActions = useActions(graph, group?.id);
|
|
51
|
-
const actions = isActionGroup(group) ? groupActions : allActions;
|
|
52
|
-
return /* @__PURE__ */ React.createElement(Dialog.Content, {
|
|
53
|
-
classNames: cardDialogContent
|
|
54
|
-
}, /* @__PURE__ */ React.createElement(Dialog.Title, {
|
|
55
|
-
classNames: cardDialogHeader
|
|
56
|
-
}, t("commands dialog title", {
|
|
57
|
-
ns: NAVTREE_PLUGIN
|
|
58
|
-
})), /* @__PURE__ */ React.createElement(SearchList.Root, {
|
|
59
|
-
label: t("command list input placeholder"),
|
|
60
|
-
classNames: cardDialogSearchListRoot
|
|
61
|
-
}, /* @__PURE__ */ React.createElement(SearchList.Input, {
|
|
62
|
-
placeholder: t("command list input placeholder")
|
|
63
|
-
}), /* @__PURE__ */ React.createElement(SearchList.Content, {
|
|
64
|
-
classNames: cardDialogPaddedOverflow
|
|
65
|
-
}, actions?.map((action) => {
|
|
66
|
-
const label = toLocalizedString(action.properties.label, t);
|
|
67
|
-
const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
|
|
68
|
-
return /* @__PURE__ */ React.createElement(SearchList.Item, {
|
|
69
|
-
value: label,
|
|
70
|
-
key: action.id,
|
|
71
|
-
onSelect: () => {
|
|
72
|
-
if (action.properties.disabled) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (isActionGroup(action)) {
|
|
76
|
-
setSelected(action.id);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
void dispatch(createIntent(LayoutAction.UpdateDialog, {
|
|
80
|
-
part: "dialog",
|
|
81
|
-
options: {
|
|
82
|
-
state: false
|
|
83
|
-
}
|
|
84
|
-
}));
|
|
85
|
-
setTimeout(() => {
|
|
86
|
-
const node = graph.getConnections(group?.id ?? action.id, "inbound")[0];
|
|
87
|
-
void (node && isAction(action) && action.data({
|
|
88
|
-
parent: node,
|
|
89
|
-
caller: KEY_BINDING
|
|
90
|
-
}));
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
classNames: "flex items-center gap-2",
|
|
94
|
-
disabled: action.properties.disabled,
|
|
95
|
-
...action.properties?.testId && {
|
|
96
|
-
"data-testid": action.properties.testId
|
|
97
|
-
}
|
|
98
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
|
99
|
-
icon: action.properties.icon,
|
|
100
|
-
size: 4
|
|
101
|
-
}), /* @__PURE__ */ React.createElement("span", {
|
|
102
|
-
className: "grow truncate"
|
|
103
|
-
}, label), shortcut && /* @__PURE__ */ React.createElement("span", {
|
|
104
|
-
className: mx("shrink-0", descriptionText)
|
|
105
|
-
}, keySymbols(shortcut).join("")));
|
|
106
|
-
}))), /* @__PURE__ */ React.createElement("div", {
|
|
107
|
-
role: "none",
|
|
108
|
-
className: "pli-cardSpacingInline pbe-cardSpacingBlock"
|
|
109
|
-
}, /* @__PURE__ */ React.createElement(Dialog.Close, {
|
|
110
|
-
asChild: true
|
|
111
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
112
|
-
classNames: "is-full"
|
|
113
|
-
}, t("close label", {
|
|
114
|
-
ns: "os"
|
|
115
|
-
})))));
|
|
116
|
-
} finally {
|
|
117
|
-
_effect.f();
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
// src/components/CommandsDialog/CommandsTrigger.tsx
|
|
122
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
123
|
-
import React2 from "react";
|
|
124
|
-
import { LayoutAction as LayoutAction2, createIntent as createIntent2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
125
|
-
import { Button as Button2, Icon as Icon2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
126
|
-
var CommandsTrigger = () => {
|
|
127
|
-
var _effect = _useSignals2();
|
|
128
|
-
try {
|
|
129
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
130
|
-
const { t } = useTranslation2(NAVTREE_PLUGIN);
|
|
131
|
-
return /* @__PURE__ */ React2.createElement(Button2, {
|
|
132
|
-
classNames: "m-1 pli-1 lg:pli-2",
|
|
133
|
-
onClick: () => dispatch(createIntent2(LayoutAction2.UpdateDialog, {
|
|
134
|
-
part: "dialog",
|
|
135
|
-
subject: COMMANDS_DIALOG,
|
|
136
|
-
options: {
|
|
137
|
-
blockAlign: "start"
|
|
138
|
-
}
|
|
139
|
-
}))
|
|
140
|
-
}, /* @__PURE__ */ React2.createElement("span", {
|
|
141
|
-
className: "text-description font-normal grow text-start"
|
|
142
|
-
}, t("command list input placeholder")), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
143
|
-
icon: "ph--magnifying-glass--regular",
|
|
144
|
-
size: 5
|
|
145
|
-
}));
|
|
146
|
-
} finally {
|
|
147
|
-
_effect.f();
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// src/util.ts
|
|
152
|
-
import { isActionLike } from "@dxos/app-graph";
|
|
153
|
-
import { isNonNullable } from "@dxos/util";
|
|
154
|
-
var getParent = (graph, node, path) => {
|
|
155
|
-
const parentId = path[path.length - 2];
|
|
156
|
-
return graph.getConnections(node.id, "inbound").find((n) => n.id === parentId);
|
|
157
|
-
};
|
|
158
|
-
var getPersistenceParent = (graph, node, path, persistenceClass) => {
|
|
159
|
-
if (node.properties.acceptPersistenceClass?.has(persistenceClass)) {
|
|
160
|
-
return node;
|
|
161
|
-
} else {
|
|
162
|
-
const parent = getParent(graph, node, path);
|
|
163
|
-
return parent ? getPersistenceParent(graph, parent, path.slice(0, path.length - 1), persistenceClass) : null;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
var resolveMigrationOperation = (graph, activeNode, destinationPath, destinationRelatedNode) => {
|
|
167
|
-
const activeClass = activeNode.properties.persistenceClass;
|
|
168
|
-
if (destinationRelatedNode && activeClass) {
|
|
169
|
-
const persistenceParent = getPersistenceParent(graph, destinationRelatedNode, destinationPath, activeClass);
|
|
170
|
-
if (persistenceParent) {
|
|
171
|
-
const activeKey = activeNode.properties.persistenceKey;
|
|
172
|
-
if (activeKey && persistenceParent?.properties.acceptPersistenceKey) {
|
|
173
|
-
return persistenceParent.properties.acceptPersistenceKey.has(activeKey) && persistenceParent.properties.onTransferStart ? "transfer" : persistenceParent.properties.onCopy ? "copy" : "reject";
|
|
174
|
-
} else {
|
|
175
|
-
return "reject";
|
|
176
|
-
}
|
|
177
|
-
} else {
|
|
178
|
-
return "reject";
|
|
179
|
-
}
|
|
180
|
-
} else {
|
|
181
|
-
return "reject";
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
var sortActions = (actions) => actions.sort((a, b) => {
|
|
185
|
-
if (a.properties.disposition === b.properties.disposition) {
|
|
186
|
-
return 0;
|
|
187
|
-
}
|
|
188
|
-
if (a.properties.disposition === "list-item-primary") {
|
|
189
|
-
return -1;
|
|
190
|
-
}
|
|
191
|
-
return 1;
|
|
192
|
-
});
|
|
193
|
-
var getChildren = (graph, node, path = []) => {
|
|
194
|
-
return graph.getConnections(node.id, "outbound").map((n) => {
|
|
195
|
-
const nextPath = [
|
|
196
|
-
...path,
|
|
197
|
-
node.id
|
|
198
|
-
];
|
|
199
|
-
return nextPath.includes(n.id) ? void 0 : n;
|
|
200
|
-
}).filter(isNonNullable);
|
|
201
|
-
};
|
|
202
|
-
var l0ItemType = (item) => {
|
|
203
|
-
if (item.properties.disposition === "collection") {
|
|
204
|
-
return "collection";
|
|
205
|
-
} else if (isActionLike(item)) {
|
|
206
|
-
return "action";
|
|
207
|
-
} else if (item.properties.disposition === "navigation") {
|
|
208
|
-
return "link";
|
|
209
|
-
} else {
|
|
210
|
-
return "tab";
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
// src/components/NavTreeContainer.tsx
|
|
215
|
-
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
216
|
-
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
217
|
-
import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
|
|
218
|
-
import { untracked } from "@preact/signals-core";
|
|
219
|
-
import React10, { memo as memo2, useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo6 } from "react";
|
|
220
|
-
import { LayoutAction as LayoutAction3, Surface, createIntent as createIntent3, useAppGraph as useAppGraph2, useCapability, useIntentDispatcher as useIntentDispatcher3, useLayout } from "@dxos/app-framework";
|
|
221
|
-
import { ROOT_ID, isAction as isAction3, isActionLike as isActionLike2 } from "@dxos/app-graph";
|
|
222
|
-
import { PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
|
|
223
|
-
import { useConnections, useActions as useGraphActions } from "@dxos/plugin-graph";
|
|
224
|
-
import { useMediaQuery as useMediaQuery2, useSidebars } from "@dxos/react-ui";
|
|
225
|
-
import { isTreeData } from "@dxos/react-ui-list";
|
|
226
|
-
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
227
|
-
import { arrayMove as arrayMove2, byPosition } from "@dxos/util";
|
|
228
|
-
|
|
229
|
-
// src/capabilities/index.ts
|
|
230
|
-
import { lazy } from "@dxos/app-framework";
|
|
231
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-6JDBQ25U.mjs"));
|
|
232
|
-
var IntentResolver = lazy(() => import("./intent-resolver-N35ZIHFD.mjs"));
|
|
233
|
-
var Keyboard2 = lazy(() => import("./keyboard-HMTMA33N.mjs"));
|
|
234
|
-
var ReactSurface = lazy(() => import("./react-surface-WKWXMM2N.mjs"));
|
|
235
|
-
var State = lazy(() => import("./state-P5DGL7KS.mjs"));
|
|
236
|
-
|
|
237
|
-
// src/components/NavTree/NavTree.tsx
|
|
238
|
-
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
239
|
-
import React9, { useMemo as useMemo5 } from "react";
|
|
240
|
-
import { Tabs as Tabs3 } from "@dxos/react-ui-tabs";
|
|
241
|
-
|
|
242
|
-
// src/hooks.ts
|
|
243
|
-
import { useEffect as useEffect2 } from "react";
|
|
244
|
-
|
|
245
|
-
// src/components/NavTreeContext.tsx
|
|
246
|
-
import { createContext, useContext } from "react";
|
|
247
|
-
import { raise } from "@dxos/debug";
|
|
248
|
-
var NavTreeContext = /* @__PURE__ */ createContext(null);
|
|
249
|
-
var useNavTreeContext = () => useContext(NavTreeContext) ?? raise(new Error("Missing NavTreeContext"));
|
|
250
|
-
|
|
251
|
-
// src/components/NavTreeDocumentTitle.tsx
|
|
252
|
-
import { useEffect } from "react";
|
|
253
|
-
import { toLocalizedString as toLocalizedString2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
254
|
-
var NavTreeDocumentTitle = ({ node }) => {
|
|
255
|
-
const { t } = useTranslation3(NAVTREE_PLUGIN);
|
|
256
|
-
useEffect(() => {
|
|
257
|
-
document.title = node ? toLocalizedString2(node.properties.label, t) : t("current app name", {
|
|
258
|
-
ns: "appkit"
|
|
259
|
-
});
|
|
260
|
-
}, [
|
|
261
|
-
node?.properties?.label
|
|
262
|
-
]);
|
|
263
|
-
return null;
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
// src/hooks.ts
|
|
267
|
-
var useLoadDescendents = (root) => {
|
|
268
|
-
const { loadDescendents } = useNavTreeContext();
|
|
269
|
-
useEffect2(() => {
|
|
270
|
-
const frame = requestAnimationFrame(() => {
|
|
271
|
-
if (root) {
|
|
272
|
-
void loadDescendents?.(root);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
return () => cancelAnimationFrame(frame);
|
|
276
|
-
}, [
|
|
277
|
-
root
|
|
278
|
-
]);
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
// src/components/Sidebar/L0Menu.tsx
|
|
282
|
-
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
283
|
-
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
284
|
-
import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
285
|
-
import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
|
|
286
|
-
import { scrollJustEnoughIntoView } from "@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view";
|
|
287
|
-
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
288
|
-
import React4, { forwardRef, useCallback, useLayoutEffect, useMemo as useMemo2, useRef, useState as useState2 } from "react";
|
|
289
|
-
import { invariant } from "@dxos/invariant";
|
|
290
|
-
import { Icon as Icon3, ListItem, ScrollArea, Tooltip, toLocalizedString as toLocalizedString3, useMediaQuery, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
291
|
-
import { DropdownMenu, MenuProvider } from "@dxos/react-ui-menu";
|
|
292
|
-
import { Tabs } from "@dxos/react-ui-tabs";
|
|
293
|
-
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
294
|
-
import { arrayMove, getFirstTwoRenderableChars } from "@dxos/util";
|
|
295
|
-
|
|
296
|
-
// src/components/UserAccountAvatar/UserAccountAvatar.tsx
|
|
297
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
298
|
-
import React3 from "react";
|
|
299
|
-
import { Avatar } from "@dxos/react-ui";
|
|
300
|
-
import { hexToFallback } from "@dxos/util";
|
|
301
|
-
var UserAccountAvatar = ({ size, userId, hue, emoji, status }) => {
|
|
302
|
-
var _effect = _useSignals3();
|
|
303
|
-
try {
|
|
304
|
-
const fallbackValue = hexToFallback(userId ?? "0");
|
|
305
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
306
|
-
className: "grid place-items-center",
|
|
307
|
-
"data-joyride": "welcome/account"
|
|
308
|
-
}, /* @__PURE__ */ React3.createElement(Avatar.Root, null, /* @__PURE__ */ React3.createElement(Avatar.Content, {
|
|
309
|
-
variant: "circle",
|
|
310
|
-
size: size ?? 12,
|
|
311
|
-
status: status ?? "active",
|
|
312
|
-
hue: hue || fallbackValue.hue,
|
|
313
|
-
fallback: emoji || fallbackValue.emoji,
|
|
314
|
-
"data-testid": "treeView.userAccount"
|
|
315
|
-
})));
|
|
316
|
-
} finally {
|
|
317
|
-
_effect.f();
|
|
318
|
-
}
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
// src/components/Sidebar/L0Menu.tsx
|
|
322
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-navtree/src/components/Sidebar/L0Menu.tsx";
|
|
323
|
-
var useL0ItemClick = ({ item, parent, path }, type) => {
|
|
324
|
-
const { tab, isCurrent, onSelect, onTabChange } = useNavTreeContext();
|
|
325
|
-
const [isLg] = useMediaQuery("lg", {
|
|
326
|
-
ssr: false
|
|
327
|
-
});
|
|
328
|
-
return useCallback((event) => {
|
|
329
|
-
switch (type) {
|
|
330
|
-
case "action": {
|
|
331
|
-
const { data: invoke, properties: { caller } } = item;
|
|
332
|
-
return invoke?.(caller ? {
|
|
333
|
-
node: parent,
|
|
334
|
-
caller
|
|
335
|
-
} : {
|
|
336
|
-
node: parent
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
case "tab":
|
|
340
|
-
return onTabChange?.(item);
|
|
341
|
-
case "link":
|
|
342
|
-
return onSelect?.({
|
|
343
|
-
item,
|
|
344
|
-
path,
|
|
345
|
-
current: !isCurrent(path, item),
|
|
346
|
-
option: event.altKey
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
}, [
|
|
350
|
-
item,
|
|
351
|
-
parent,
|
|
352
|
-
type,
|
|
353
|
-
tab,
|
|
354
|
-
isCurrent,
|
|
355
|
-
onSelect,
|
|
356
|
-
onTabChange,
|
|
357
|
-
isLg
|
|
358
|
-
]);
|
|
359
|
-
};
|
|
360
|
-
var l0Breakpoints = {
|
|
361
|
-
lg: "hidden lg:grid"
|
|
362
|
-
};
|
|
363
|
-
var l0ItemRoot = 'group/l0item flex w-full justify-center items-center relative data[type!="collection"]:cursor-pointer app-no-drag dx-focus-ring-group';
|
|
364
|
-
var l0ItemContent = "flex justify-center items-center dx-focus-ring-group-indicator transition-colors rounded-sm";
|
|
365
|
-
var L0ItemRoot = /* @__PURE__ */ forwardRef(({ item, parent, path, children }, forwardedRef) => {
|
|
366
|
-
var _effect = _useSignals4();
|
|
367
|
-
try {
|
|
368
|
-
const { getProps } = useNavTreeContext();
|
|
369
|
-
const { id, testId } = getProps?.(item, path) ?? {};
|
|
370
|
-
const type = l0ItemType(item);
|
|
371
|
-
const itemPath = useMemo2(() => [
|
|
372
|
-
...path,
|
|
373
|
-
item.id
|
|
374
|
-
], [
|
|
375
|
-
item.id,
|
|
376
|
-
path
|
|
377
|
-
]);
|
|
378
|
-
const { t } = useTranslation4(NAVTREE_PLUGIN);
|
|
379
|
-
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
380
|
-
const handleClick = useL0ItemClick({
|
|
381
|
-
item,
|
|
382
|
-
parent,
|
|
383
|
-
path: itemPath
|
|
384
|
-
}, type);
|
|
385
|
-
const rootProps = type === "tab" ? {
|
|
386
|
-
value: item.id,
|
|
387
|
-
tabIndex: 0,
|
|
388
|
-
onClick: handleClick,
|
|
389
|
-
"data-testid": testId,
|
|
390
|
-
"data-itemid": id
|
|
391
|
-
} : type !== "collection" ? {
|
|
392
|
-
onClick: handleClick,
|
|
393
|
-
"data-testid": testId,
|
|
394
|
-
"data-itemid": id
|
|
395
|
-
} : {
|
|
396
|
-
onClick: handleClick
|
|
397
|
-
};
|
|
398
|
-
const Root = type === "collection" ? "h2" : type === "tab" ? Tabs.TabPrimitive : "button";
|
|
399
|
-
return /* @__PURE__ */ React4.createElement(Tooltip.Trigger, {
|
|
400
|
-
asChild: true,
|
|
401
|
-
delayDuration: 0,
|
|
402
|
-
side: "right",
|
|
403
|
-
content: localizedString
|
|
404
|
-
}, /* @__PURE__ */ React4.createElement(Root, {
|
|
405
|
-
...rootProps,
|
|
406
|
-
"data-type": type,
|
|
407
|
-
className: mx2(l0ItemRoot, l0Breakpoints[item.properties.l0Breakpoint]),
|
|
408
|
-
ref: forwardedRef
|
|
409
|
-
}, children));
|
|
410
|
-
} finally {
|
|
411
|
-
_effect.f();
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
var L0Avatar = ({ item }) => {
|
|
415
|
-
var _effect = _useSignals4();
|
|
416
|
-
try {
|
|
417
|
-
const { t } = useTranslation4(NAVTREE_PLUGIN);
|
|
418
|
-
const type = l0ItemType(item);
|
|
419
|
-
const hue = item.properties.hue ?? null;
|
|
420
|
-
const hueFgStyle = hue && {
|
|
421
|
-
style: {
|
|
422
|
-
color: `var(--dx-${hue}SurfaceText)`
|
|
423
|
-
}
|
|
424
|
-
};
|
|
425
|
-
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
426
|
-
const avatarValue = useMemo2(() => type === "tab" ? getFirstTwoRenderableChars(localizedString).join("").toUpperCase() : [], [
|
|
427
|
-
type,
|
|
428
|
-
item.properties.label,
|
|
429
|
-
t
|
|
430
|
-
]);
|
|
431
|
-
return /* @__PURE__ */ React4.createElement("span", {
|
|
432
|
-
role: "img",
|
|
433
|
-
className: "place-self-center text-xl font-light",
|
|
434
|
-
...hueFgStyle
|
|
435
|
-
}, avatarValue);
|
|
436
|
-
} finally {
|
|
437
|
-
_effect.f();
|
|
438
|
-
}
|
|
439
|
-
};
|
|
440
|
-
var L0Item = ({ item, parent, path, pinned, onRearrange }) => {
|
|
441
|
-
var _effect = _useSignals4();
|
|
442
|
-
try {
|
|
443
|
-
const { t } = useTranslation4(NAVTREE_PLUGIN);
|
|
444
|
-
const itemElement = useRef(null);
|
|
445
|
-
const [closestEdge, setEdge] = useState2(null);
|
|
446
|
-
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
447
|
-
const hue = item.properties.hue ?? null;
|
|
448
|
-
useLayoutEffect(() => {
|
|
449
|
-
if (!itemElement.current || !onRearrange) {
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
return combine(draggable({
|
|
453
|
-
element: itemElement.current,
|
|
454
|
-
getInitialData: () => ({
|
|
455
|
-
id: item.id,
|
|
456
|
-
type: "l0Item"
|
|
457
|
-
}),
|
|
458
|
-
onGenerateDragPreview: ({ nativeSetDragImage, source, location }) => {
|
|
459
|
-
document.body.setAttribute("data-drag-preview", "true");
|
|
460
|
-
const element = source.element.querySelector("[data-frame]");
|
|
461
|
-
scrollJustEnoughIntoView({
|
|
462
|
-
element
|
|
463
|
-
});
|
|
464
|
-
const { x, y } = preserveOffsetOnSource({
|
|
465
|
-
element,
|
|
466
|
-
input: location.current.input
|
|
467
|
-
})({
|
|
468
|
-
container: element.offsetParent ?? document.body
|
|
469
|
-
});
|
|
470
|
-
nativeSetDragImage?.(element, x, y);
|
|
471
|
-
},
|
|
472
|
-
onDragStart: () => {
|
|
473
|
-
document.body.removeAttribute("data-drag-preview");
|
|
474
|
-
itemElement.current.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
475
|
-
},
|
|
476
|
-
onDrop: () => {
|
|
477
|
-
itemElement.current.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
478
|
-
}
|
|
479
|
-
}), dropTargetForElements({
|
|
480
|
-
element: itemElement.current,
|
|
481
|
-
getData: ({ input, element }) => {
|
|
482
|
-
return attachClosestEdge({
|
|
483
|
-
id: item.id,
|
|
484
|
-
type: "l0Item"
|
|
485
|
-
}, {
|
|
486
|
-
input,
|
|
487
|
-
element,
|
|
488
|
-
allowedEdges: [
|
|
489
|
-
"top",
|
|
490
|
-
"bottom"
|
|
491
|
-
]
|
|
492
|
-
});
|
|
493
|
-
},
|
|
494
|
-
onDragEnter: ({ self, source }) => {
|
|
495
|
-
if (source.data.type === self.data.type) {
|
|
496
|
-
setEdge(extractClosestEdge(self.data));
|
|
497
|
-
}
|
|
498
|
-
},
|
|
499
|
-
onDrag: ({ self, source }) => {
|
|
500
|
-
if (source.data.type === self.data.type) {
|
|
501
|
-
setEdge(extractClosestEdge(self.data));
|
|
502
|
-
}
|
|
503
|
-
},
|
|
504
|
-
onDragLeave: () => setEdge(null),
|
|
505
|
-
onDrop: ({ self, source }) => {
|
|
506
|
-
setEdge(null);
|
|
507
|
-
if (source.data.type === self.data.type) {
|
|
508
|
-
onRearrange(source.data, self.data, extractClosestEdge(self.data));
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}));
|
|
512
|
-
}, [
|
|
513
|
-
item,
|
|
514
|
-
onRearrange
|
|
515
|
-
]);
|
|
516
|
-
return /* @__PURE__ */ React4.createElement(L0ItemRoot, {
|
|
517
|
-
ref: itemElement,
|
|
518
|
-
item,
|
|
519
|
-
parent,
|
|
520
|
-
path
|
|
521
|
-
}, /* @__PURE__ */ React4.createElement("div", {
|
|
522
|
-
role: "none",
|
|
523
|
-
"data-frame": true,
|
|
524
|
-
...hue && {
|
|
525
|
-
style: {
|
|
526
|
-
background: `var(--dx-${hue}Surface)`
|
|
527
|
-
}
|
|
528
|
-
},
|
|
529
|
-
className: mx2(l0ItemContent, pinned ? "p-2 group-hover/l0item:bg-activeSurface" : "is-[--l0-avatar-size] bs-[--l0-avatar-size] bg-activeSurface")
|
|
530
|
-
}, /* @__PURE__ */ React4.createElement(ItemAvatar, {
|
|
531
|
-
item
|
|
532
|
-
})), /* @__PURE__ */ React4.createElement("div", {
|
|
533
|
-
role: "none",
|
|
534
|
-
className: "hidden group-aria-selected/l0item:block absolute inline-start-0 inset-block-2 is-1 bg-accentSurface rounded-ie"
|
|
535
|
-
}), /* @__PURE__ */ React4.createElement("span", {
|
|
536
|
-
id: `${item.id}__label`,
|
|
537
|
-
className: "sr-only"
|
|
538
|
-
}, localizedString), closestEdge && /* @__PURE__ */ React4.createElement(ListItem.DropIndicator, {
|
|
539
|
-
edge: closestEdge
|
|
540
|
-
}));
|
|
541
|
-
} finally {
|
|
542
|
-
_effect.f();
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
var ItemAvatar = ({ item }) => {
|
|
546
|
-
var _effect = _useSignals4();
|
|
547
|
-
try {
|
|
548
|
-
const type = l0ItemType(item);
|
|
549
|
-
if (item.properties.icon) {
|
|
550
|
-
const hue = item.properties.hue ?? null;
|
|
551
|
-
const hueFgStyle = hue && {
|
|
552
|
-
style: {
|
|
553
|
-
color: `var(--dx-${hue}SurfaceText)`
|
|
554
|
-
}
|
|
555
|
-
};
|
|
556
|
-
return /* @__PURE__ */ React4.createElement(Icon3, {
|
|
557
|
-
icon: item.properties.icon,
|
|
558
|
-
size: 5,
|
|
559
|
-
...hueFgStyle
|
|
560
|
-
});
|
|
561
|
-
}
|
|
562
|
-
if (type === "tab" && item.properties.disposition !== "pin-end") {
|
|
563
|
-
return /* @__PURE__ */ React4.createElement(L0Avatar, {
|
|
564
|
-
item
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
return null;
|
|
568
|
-
} finally {
|
|
569
|
-
_effect.f();
|
|
570
|
-
}
|
|
571
|
-
};
|
|
572
|
-
var L0Collection = ({ item, path }) => {
|
|
573
|
-
var _effect = _useSignals4();
|
|
574
|
-
try {
|
|
575
|
-
const navTreeContext = useNavTreeContext();
|
|
576
|
-
useLoadDescendents(item);
|
|
577
|
-
const collectionItems = navTreeContext.useItems(item);
|
|
578
|
-
const groupPath = useMemo2(() => [
|
|
579
|
-
...path,
|
|
580
|
-
item.id
|
|
581
|
-
], [
|
|
582
|
-
item.id,
|
|
583
|
-
path
|
|
584
|
-
]);
|
|
585
|
-
const { id, testId } = navTreeContext.getProps?.(item, path) ?? {};
|
|
586
|
-
const handleRearrange = useCallback((source, target, closestEdge) => {
|
|
587
|
-
invariant(item.properties.onRearrangeChildren, void 0, {
|
|
588
|
-
F: __dxlog_file,
|
|
589
|
-
L: 271,
|
|
590
|
-
S: void 0,
|
|
591
|
-
A: [
|
|
592
|
-
"item.properties.onRearrangeChildren",
|
|
593
|
-
""
|
|
594
|
-
]
|
|
595
|
-
});
|
|
596
|
-
const sourceIndex = collectionItems.findIndex((i) => i.id === source.id);
|
|
597
|
-
const targetIndex = collectionItems.findIndex((i) => i.id === target.id);
|
|
598
|
-
const insertIndex = source.id === target.id ? sourceIndex : targetIndex + (sourceIndex < targetIndex ? closestEdge === "top" ? -1 : 0 : closestEdge === "bottom" ? 1 : 0);
|
|
599
|
-
const nextOrder = arrayMove([
|
|
600
|
-
...collectionItems
|
|
601
|
-
], sourceIndex, insertIndex);
|
|
602
|
-
return item.properties.onRearrangeChildren(nextOrder);
|
|
603
|
-
}, [
|
|
604
|
-
collectionItems,
|
|
605
|
-
item.properties.onRearrangeChildren
|
|
606
|
-
]);
|
|
607
|
-
return /* @__PURE__ */ React4.createElement("div", {
|
|
608
|
-
role: "group",
|
|
609
|
-
className: "contents group/l0c",
|
|
610
|
-
"aria-labelledby": `${item.id}__label`,
|
|
611
|
-
"data-itemid": id,
|
|
612
|
-
"data-testid": testId
|
|
613
|
-
}, collectionItems.map((collectionItem) => /* @__PURE__ */ React4.createElement(L0Item, {
|
|
614
|
-
key: collectionItem.id,
|
|
615
|
-
item: collectionItem,
|
|
616
|
-
parent: item,
|
|
617
|
-
path: groupPath,
|
|
618
|
-
...item.properties.onRearrangeChildren && {
|
|
619
|
-
onRearrange: handleRearrange
|
|
620
|
-
}
|
|
621
|
-
})));
|
|
622
|
-
} finally {
|
|
623
|
-
_effect.f();
|
|
624
|
-
}
|
|
625
|
-
};
|
|
626
|
-
var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent, path }) => {
|
|
627
|
-
var _effect = _useSignals4();
|
|
628
|
-
try {
|
|
629
|
-
const { t } = useTranslation4(NAVTREE_PLUGIN);
|
|
630
|
-
return /* @__PURE__ */ React4.createElement(Tabs.Tablist, {
|
|
631
|
-
classNames: [
|
|
632
|
-
"group/l0 absolute z-[1] inset-block-0 inline-start-0 rounded-is",
|
|
633
|
-
"grid grid-cols-[var(--l0-size)] grid-rows-[var(--rail-size)_1fr_min-content_var(--l0-size)] contain-layout",
|
|
634
|
-
"!is-[--l0-size] bg-baseSurface border-ie border-subduedSeparator app-drag pbe-[env(safe-area-inset-bottom)]"
|
|
635
|
-
]
|
|
636
|
-
}, /* @__PURE__ */ React4.createElement(MenuProvider, null, /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
|
|
637
|
-
group: parent,
|
|
638
|
-
items: menuActions
|
|
639
|
-
}, /* @__PURE__ */ React4.createElement(Tooltip.Trigger, {
|
|
640
|
-
content: t("app menu label"),
|
|
641
|
-
side: "right",
|
|
642
|
-
asChild: true
|
|
643
|
-
}, /* @__PURE__ */ React4.createElement(DropdownMenu.Trigger, {
|
|
644
|
-
"data-testid": "spacePlugin.addSpace",
|
|
645
|
-
className: mx2(l0ItemRoot, "grid place-items-center")
|
|
646
|
-
}, /* @__PURE__ */ React4.createElement("div", {
|
|
647
|
-
role: "none",
|
|
648
|
-
className: mx2(l0ItemContent, "is-[--rail-action] bs-[--rail-action] group-hover/l0item:bg-hoverSurface")
|
|
649
|
-
}, /* @__PURE__ */ React4.createElement(Icon3, {
|
|
650
|
-
icon: "ph--list--regular",
|
|
651
|
-
size: 5
|
|
652
|
-
})))))), /* @__PURE__ */ React4.createElement(ScrollArea.Root, null, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React4.createElement("div", {
|
|
653
|
-
role: "none",
|
|
654
|
-
className: mx2([
|
|
655
|
-
"flex flex-col gap-1 pbs-1",
|
|
656
|
-
'[body[data-platform="darwin"]_&]:pbs-[calc(30px+0.25rem)]',
|
|
657
|
-
'[body[data-platform="ios"]_&]:pbs-[max(env(safe-area-inset-top),0.25rem)]'
|
|
658
|
-
])
|
|
659
|
-
}, topLevelItems.map((item) => {
|
|
660
|
-
if (l0ItemType(item) === "collection") {
|
|
661
|
-
return /* @__PURE__ */ React4.createElement(L0Collection, {
|
|
662
|
-
key: item.id,
|
|
663
|
-
item,
|
|
664
|
-
parent,
|
|
665
|
-
path
|
|
666
|
-
});
|
|
667
|
-
} else {
|
|
668
|
-
return /* @__PURE__ */ React4.createElement(L0Item, {
|
|
669
|
-
key: item.id,
|
|
670
|
-
item,
|
|
671
|
-
parent,
|
|
672
|
-
path
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
})), /* @__PURE__ */ React4.createElement(ScrollArea.Scrollbar, {
|
|
676
|
-
orientation: "vertical"
|
|
677
|
-
}, /* @__PURE__ */ React4.createElement(ScrollArea.Thumb, null)))), /* @__PURE__ */ React4.createElement("div", {
|
|
678
|
-
role: "none",
|
|
679
|
-
className: "grid grid-cols-1 auto-rows-[--rail-action] pbs-2"
|
|
680
|
-
}, pinnedItems.filter((item) => l0ItemType(item) !== "collection").map((item) => /* @__PURE__ */ React4.createElement(L0Item, {
|
|
681
|
-
key: item.id,
|
|
682
|
-
item,
|
|
683
|
-
parent,
|
|
684
|
-
path,
|
|
685
|
-
pinned: true
|
|
686
|
-
}))), userAccountItem && /* @__PURE__ */ React4.createElement("div", {
|
|
687
|
-
role: "none",
|
|
688
|
-
className: "grid app-no-drag"
|
|
689
|
-
}, /* @__PURE__ */ React4.createElement(L0ItemRoot, {
|
|
690
|
-
key: userAccountItem.id,
|
|
691
|
-
item: userAccountItem,
|
|
692
|
-
parent,
|
|
693
|
-
path
|
|
694
|
-
}, /* @__PURE__ */ React4.createElement(UserAccountAvatar, {
|
|
695
|
-
userId: userAccountItem.properties.userId,
|
|
696
|
-
hue: userAccountItem.properties.hue,
|
|
697
|
-
emoji: userAccountItem.properties.emoji,
|
|
698
|
-
status: userAccountItem.properties.status,
|
|
699
|
-
size: 10
|
|
700
|
-
}))), /* @__PURE__ */ React4.createElement("div", {
|
|
701
|
-
role: "none",
|
|
702
|
-
className: 'hidden [body[data-platform="darwin"]_&]:block absolute block-start-0 is-[calc(var(--l0-size)-1px)] bs-[calc(40px+0.25rem)]',
|
|
703
|
-
style: {
|
|
704
|
-
background: "linear-gradient(to bottom, var(--dx-sidebarSurface) 0%, var(--dx-sidebarSurface) 70%, transparent 100%)"
|
|
705
|
-
}
|
|
706
|
-
}));
|
|
707
|
-
} finally {
|
|
708
|
-
_effect.f();
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
|
|
712
|
-
// src/components/Sidebar/L1Panel.tsx
|
|
713
|
-
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
714
|
-
import React7, { useCallback as useCallback2, useMemo as useMemo3 } from "react";
|
|
715
|
-
import { IconButton as IconButton2, toLocalizedString as toLocalizedString6, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
716
|
-
import { Tree } from "@dxos/react-ui-list";
|
|
717
|
-
import { Tabs as Tabs2 } from "@dxos/react-ui-tabs";
|
|
718
|
-
import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem as hoverableOpenControlItem2 } from "@dxos/react-ui-theme";
|
|
719
|
-
|
|
720
|
-
// src/components/NavTreeItem/NavTreeItemAction.tsx
|
|
721
|
-
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
722
|
-
import React5 from "react";
|
|
723
|
-
import { IconButton, toLocalizedString as toLocalizedString4, useDensityContext, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
724
|
-
import { DropdownMenu as DropdownMenu2, MenuProvider as MenuProvider2 } from "@dxos/react-ui-menu";
|
|
725
|
-
import { hoverableControlItem, hoverableOpenControlItem } from "@dxos/react-ui-theme";
|
|
726
|
-
var fallbackIcon = "ph--placeholder--regular";
|
|
727
|
-
var fineActionButtonProps = {
|
|
728
|
-
size: 4,
|
|
729
|
-
density: "fine"
|
|
730
|
-
};
|
|
731
|
-
var coarseActionButtonProps = {
|
|
732
|
-
size: 5,
|
|
733
|
-
density: "coarse"
|
|
734
|
-
};
|
|
735
|
-
var NavTreeItemActionDropdownMenu = ({ parent, label, icon, testId, menuActions, caller }) => {
|
|
736
|
-
var _effect = _useSignals5();
|
|
737
|
-
try {
|
|
738
|
-
const { t } = useTranslation5(NAVTREE_PLUGIN);
|
|
739
|
-
const density = useDensityContext();
|
|
740
|
-
return /* @__PURE__ */ React5.createElement(MenuProvider2, null, /* @__PURE__ */ React5.createElement(DropdownMenu2.Root, {
|
|
741
|
-
group: parent,
|
|
742
|
-
items: menuActions,
|
|
743
|
-
caller
|
|
744
|
-
}, /* @__PURE__ */ React5.createElement(DropdownMenu2.Trigger, {
|
|
745
|
-
asChild: true
|
|
746
|
-
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
747
|
-
...density === "coarse" ? coarseActionButtonProps : fineActionButtonProps,
|
|
748
|
-
classNames: [
|
|
749
|
-
"shrink-0 pli-2 pointer-fine:pli-1",
|
|
750
|
-
hoverableControlItem,
|
|
751
|
-
hoverableOpenControlItem
|
|
752
|
-
],
|
|
753
|
-
variant: "ghost",
|
|
754
|
-
icon: icon ?? fallbackIcon,
|
|
755
|
-
iconOnly: true,
|
|
756
|
-
label: toLocalizedString4(label, t),
|
|
757
|
-
"data-testid": testId
|
|
758
|
-
}))));
|
|
759
|
-
} finally {
|
|
760
|
-
_effect.f();
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, testId, icon, variant = "ghost", iconOnly = true } = {
|
|
764
|
-
label: "never"
|
|
765
|
-
}, data: invoke, baseLabel }) => {
|
|
766
|
-
var _effect = _useSignals5();
|
|
767
|
-
try {
|
|
768
|
-
const density = useDensityContext();
|
|
769
|
-
return /* @__PURE__ */ React5.createElement(IconButton, {
|
|
770
|
-
...density === "coarse" ? coarseActionButtonProps : fineActionButtonProps,
|
|
771
|
-
variant,
|
|
772
|
-
classNames: [
|
|
773
|
-
"shrink-0",
|
|
774
|
-
hoverableControlItem,
|
|
775
|
-
hoverableOpenControlItem,
|
|
776
|
-
iconOnly ? "pli-2 pointer-fine:pli-1" : "p-2 pointer-fine:p-2 mie-1"
|
|
777
|
-
],
|
|
778
|
-
icon: icon ?? fallbackIcon,
|
|
779
|
-
iconOnly,
|
|
780
|
-
label: baseLabel,
|
|
781
|
-
disabled,
|
|
782
|
-
onClick: (event) => {
|
|
783
|
-
if (disabled) {
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
event.stopPropagation();
|
|
787
|
-
void invoke?.(caller ? {
|
|
788
|
-
parent,
|
|
789
|
-
caller
|
|
790
|
-
} : {
|
|
791
|
-
parent
|
|
792
|
-
});
|
|
793
|
-
},
|
|
794
|
-
"data-testid": testId
|
|
795
|
-
});
|
|
796
|
-
} finally {
|
|
797
|
-
_effect.f();
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) => {
|
|
801
|
-
var _effect = _useSignals5();
|
|
802
|
-
try {
|
|
803
|
-
const { t } = useTranslation5(NAVTREE_PLUGIN);
|
|
804
|
-
const monolithicAction = menuActions?.length === 1 && menuActions[0];
|
|
805
|
-
const baseLabel = toLocalizedString4(monolithicAction ? monolithicAction.properties.label : props.label, t);
|
|
806
|
-
return monolithic && menuActions?.length === 1 ? /* @__PURE__ */ React5.createElement(NavTreeItemMonolithicAction, {
|
|
807
|
-
baseLabel,
|
|
808
|
-
parent: node,
|
|
809
|
-
...menuActions[0]
|
|
810
|
-
}) : /* @__PURE__ */ React5.createElement(NavTreeItemActionDropdownMenu, {
|
|
811
|
-
...props,
|
|
812
|
-
label: baseLabel,
|
|
813
|
-
parent: node,
|
|
814
|
-
menuActions
|
|
815
|
-
});
|
|
816
|
-
} finally {
|
|
817
|
-
_effect.f();
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
|
|
821
|
-
// src/components/NavTreeItem/NavTreeItemColumns.tsx
|
|
822
|
-
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
823
|
-
import React6, { Fragment, memo } from "react";
|
|
824
|
-
import { isAction as isAction2 } from "@dxos/app-graph";
|
|
825
|
-
import { DensityProvider, Popover, Treegrid, toLocalizedString as toLocalizedString5, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
826
|
-
var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fine" }) => {
|
|
827
|
-
var _effect = _useSignals6();
|
|
828
|
-
try {
|
|
829
|
-
const { t } = useTranslation6(NAVTREE_PLUGIN);
|
|
830
|
-
const { useActions: useActions3, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
|
|
831
|
-
const level = path.length - 2;
|
|
832
|
-
const { actions: _actions, groupedActions } = useActions3(item);
|
|
833
|
-
const [primaryAction, ...secondaryActions] = _actions.toSorted((a, _b) => a.properties?.disposition === "list-item-primary" ? -1 : 1);
|
|
834
|
-
const actions = (primaryAction?.properties?.disposition === "list-item-primary" ? secondaryActions : _actions).flatMap((action) => isAction2(action) ? [
|
|
835
|
-
action
|
|
836
|
-
] : []).filter((a) => [
|
|
837
|
-
"list-item",
|
|
838
|
-
"list-item-primary"
|
|
839
|
-
].includes(a.properties?.disposition));
|
|
840
|
-
const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
|
|
841
|
-
useLoadDescendents(item);
|
|
842
|
-
useLoadDescendents(primaryAction && !isAction2(primaryAction) ? primaryAction : void 0);
|
|
843
|
-
return /* @__PURE__ */ React6.createElement(DensityProvider, {
|
|
844
|
-
density
|
|
845
|
-
}, /* @__PURE__ */ React6.createElement("div", {
|
|
846
|
-
role: "none",
|
|
847
|
-
className: "contents app-no-drag"
|
|
848
|
-
}, primaryAction?.properties?.disposition === "list-item-primary" && !primaryAction?.properties?.disabled ? /* @__PURE__ */ React6.createElement(NavTreeItemAction, {
|
|
849
|
-
testId: primaryAction.properties?.testId,
|
|
850
|
-
label: toLocalizedString5(primaryAction.properties?.label, t),
|
|
851
|
-
icon: primaryAction.properties?.icon ?? "ph--placeholder--regular",
|
|
852
|
-
parent: item,
|
|
853
|
-
monolithic: isAction2(primaryAction),
|
|
854
|
-
menuActions: isAction2(primaryAction) ? [
|
|
855
|
-
primaryAction
|
|
856
|
-
] : groupedActions[primaryAction.id],
|
|
857
|
-
menuType: primaryAction.properties?.menuType,
|
|
858
|
-
caller: NAV_TREE_ITEM
|
|
859
|
-
}) : /* @__PURE__ */ React6.createElement(Treegrid.Cell, null), /* @__PURE__ */ React6.createElement(ActionRoot, null, actions.length > 0 ? /* @__PURE__ */ React6.createElement(NavTreeItemAction, {
|
|
860
|
-
testId: `navtree.treeItem.actionsLevel${level}`,
|
|
861
|
-
label: t("tree item actions label"),
|
|
862
|
-
icon: "ph--dots-three-vertical--regular",
|
|
863
|
-
parent: item,
|
|
864
|
-
menuActions: actions,
|
|
865
|
-
menuType: "dropdown",
|
|
866
|
-
caller: NAV_TREE_ITEM
|
|
867
|
-
}) : /* @__PURE__ */ React6.createElement(Treegrid.Cell, null)), ItemEnd && /* @__PURE__ */ React6.createElement(ItemEnd, {
|
|
868
|
-
node: item,
|
|
869
|
-
open
|
|
870
|
-
})));
|
|
871
|
-
} finally {
|
|
872
|
-
_effect.f();
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
|
|
876
|
-
// src/components/Sidebar/L1Panel.tsx
|
|
877
|
-
var L1Panel = ({ open, path, item, currentItemId, onBack }) => {
|
|
878
|
-
var _effect = _useSignals7();
|
|
879
|
-
try {
|
|
880
|
-
const { t } = useTranslation7(meta.id);
|
|
881
|
-
const { isAlternateTree, ...navTreeContext } = useNavTreeContext();
|
|
882
|
-
const { useItems: useItems2 } = navTreeContext;
|
|
883
|
-
const title = toLocalizedString6(item.properties.label, t);
|
|
884
|
-
const alternateTree = useItems2(item, {
|
|
885
|
-
disposition: "alternate-tree"
|
|
886
|
-
})[0];
|
|
887
|
-
const alternatePath = useMemo3(() => [
|
|
888
|
-
...path,
|
|
889
|
-
item.id
|
|
890
|
-
], [
|
|
891
|
-
item.id,
|
|
892
|
-
path
|
|
893
|
-
]);
|
|
894
|
-
const isAlternate = isAlternateTree?.(alternatePath, item) ?? false;
|
|
895
|
-
const useAlternateItems = useCallback2((node, { disposition } = {}) => {
|
|
896
|
-
return useItems2(node, {
|
|
897
|
-
disposition,
|
|
898
|
-
sort: node?.id === alternateTree.id
|
|
899
|
-
});
|
|
900
|
-
}, [
|
|
901
|
-
alternateTree,
|
|
902
|
-
useItems2
|
|
903
|
-
]);
|
|
904
|
-
return /* @__PURE__ */ React7.createElement(Tabs2.Tabpanel, {
|
|
905
|
-
key: item.id,
|
|
906
|
-
value: item.id,
|
|
907
|
-
classNames: [
|
|
908
|
-
"absolute inset-block-0 inline-end-0",
|
|
909
|
-
"is-[calc(100%-var(--l0-size))] lg:is-[--l1-size] grid-cols-1 grid-rows-[var(--rail-size)_1fr]",
|
|
910
|
-
"pbs-[env(safe-area-inset-top)]",
|
|
911
|
-
item.id === currentItemId && "grid"
|
|
912
|
-
],
|
|
913
|
-
tabIndex: -1,
|
|
914
|
-
"aria-label": title,
|
|
915
|
-
...!open && {
|
|
916
|
-
inert: "true"
|
|
917
|
-
}
|
|
918
|
-
}, item.id === currentItemId && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(L1PanelHeader, {
|
|
919
|
-
path,
|
|
920
|
-
item,
|
|
921
|
-
currentItemId,
|
|
922
|
-
onBack
|
|
923
|
-
}), /* @__PURE__ */ React7.createElement("div", {
|
|
924
|
-
role: "none",
|
|
925
|
-
className: "overflow-y-auto"
|
|
926
|
-
}, isAlternate ? /* @__PURE__ */ React7.createElement(Tree, {
|
|
927
|
-
...navTreeContext,
|
|
928
|
-
useItems: useAlternateItems,
|
|
929
|
-
id: alternateTree.id,
|
|
930
|
-
root: alternateTree,
|
|
931
|
-
path: alternatePath,
|
|
932
|
-
levelOffset: 5,
|
|
933
|
-
gridTemplateColumns: "[tree-row-start] 1fr min-content min-content min-content [tree-row-end]",
|
|
934
|
-
renderColumns: NavTreeItemColumns
|
|
935
|
-
}) : /* @__PURE__ */ React7.createElement(Tree, {
|
|
936
|
-
...navTreeContext,
|
|
937
|
-
id: item.id,
|
|
938
|
-
root: item,
|
|
939
|
-
path,
|
|
940
|
-
levelOffset: 5,
|
|
941
|
-
draggable: true,
|
|
942
|
-
gridTemplateColumns: "[tree-row-start] 1fr min-content min-content min-content [tree-row-end]",
|
|
943
|
-
renderColumns: NavTreeItemColumns
|
|
944
|
-
}))));
|
|
945
|
-
} finally {
|
|
946
|
-
_effect.f();
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
var L1PanelHeader = ({ item, path, onBack }) => {
|
|
950
|
-
var _effect = _useSignals7();
|
|
951
|
-
try {
|
|
952
|
-
const { t } = useTranslation7(meta.id);
|
|
953
|
-
const { isAlternateTree, setAlternateTree, ...navTreeContext } = useNavTreeContext();
|
|
954
|
-
const title = toLocalizedString6(item.properties.label, t);
|
|
955
|
-
const alternateTree = navTreeContext.useItems(item, {
|
|
956
|
-
disposition: "alternate-tree"
|
|
957
|
-
})[0];
|
|
958
|
-
const alternatePath = useMemo3(() => [
|
|
959
|
-
...path,
|
|
960
|
-
item.id
|
|
961
|
-
], [
|
|
962
|
-
item.id,
|
|
963
|
-
path
|
|
964
|
-
]);
|
|
965
|
-
const isAlternate = isAlternateTree?.(alternatePath, item) ?? false;
|
|
966
|
-
const backCapable = item.id.startsWith("!") || isAlternate;
|
|
967
|
-
const handleOpen = useCallback2(() => {
|
|
968
|
-
setAlternateTree?.(alternatePath, true);
|
|
969
|
-
}, [
|
|
970
|
-
alternatePath,
|
|
971
|
-
setAlternateTree
|
|
972
|
-
]);
|
|
973
|
-
const handleBack = useCallback2(() => {
|
|
974
|
-
if (isAlternate) {
|
|
975
|
-
setAlternateTree?.(alternatePath, false);
|
|
976
|
-
} else {
|
|
977
|
-
onBack?.();
|
|
978
|
-
}
|
|
979
|
-
}, [
|
|
980
|
-
isAlternate,
|
|
981
|
-
alternatePath,
|
|
982
|
-
setAlternateTree,
|
|
983
|
-
onBack
|
|
984
|
-
]);
|
|
985
|
-
return /* @__PURE__ */ React7.createElement("div", {
|
|
986
|
-
className: "flex is-full items-center border-be border-subduedSeparator app-drag density-coarse"
|
|
987
|
-
}, /* @__PURE__ */ React7.createElement("div", {
|
|
988
|
-
className: "is-6"
|
|
989
|
-
}), /* @__PURE__ */ React7.createElement("h2", {
|
|
990
|
-
className: "flex-1 truncate min-is-0"
|
|
991
|
-
}, title), /* @__PURE__ */ React7.createElement("div", null, backCapable && /* @__PURE__ */ React7.createElement(IconButton2, {
|
|
992
|
-
variant: "ghost",
|
|
993
|
-
icon: "ph--arrow-u-down-left--regular",
|
|
994
|
-
iconOnly: true,
|
|
995
|
-
size: 5,
|
|
996
|
-
label: t("button back"),
|
|
997
|
-
classNames: [
|
|
998
|
-
hoverableControlItem2,
|
|
999
|
-
hoverableOpenControlItem2,
|
|
1000
|
-
"pointer-fine:pli-1"
|
|
1001
|
-
],
|
|
1002
|
-
onClick: handleBack
|
|
1003
|
-
}) || alternateTree && !isAlternate && /* @__PURE__ */ React7.createElement(IconButton2, {
|
|
1004
|
-
"data-testid": "treeView.alternateTreeButton",
|
|
1005
|
-
variant: "ghost",
|
|
1006
|
-
icon: alternateTree.properties.icon ?? "ph--placeholder--regular",
|
|
1007
|
-
iconOnly: true,
|
|
1008
|
-
size: 5,
|
|
1009
|
-
label: toLocalizedString6(alternateTree.properties.label ?? alternateTree.id, t),
|
|
1010
|
-
classNames: [
|
|
1011
|
-
hoverableControlItem2,
|
|
1012
|
-
hoverableOpenControlItem2,
|
|
1013
|
-
"pointer-fine:pli-1"
|
|
1014
|
-
],
|
|
1015
|
-
onClick: handleOpen
|
|
1016
|
-
}) || /* @__PURE__ */ React7.createElement("div", null)), /* @__PURE__ */ React7.createElement(NavTreeItemColumns, {
|
|
1017
|
-
open: true,
|
|
1018
|
-
path,
|
|
1019
|
-
item,
|
|
1020
|
-
density: "coarse"
|
|
1021
|
-
}));
|
|
1022
|
-
} finally {
|
|
1023
|
-
_effect.f();
|
|
1024
|
-
}
|
|
1025
|
-
};
|
|
1026
|
-
|
|
1027
|
-
// src/components/Sidebar/L1Tabs.tsx
|
|
1028
|
-
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
1029
|
-
import React8, { useMemo as useMemo4 } from "react";
|
|
1030
|
-
var L1Tabs = ({ topLevelItems, onBack, ...props }) => {
|
|
1031
|
-
var _effect = _useSignals8();
|
|
1032
|
-
try {
|
|
1033
|
-
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, topLevelItems.map((item) => {
|
|
1034
|
-
const type = l0ItemType(item);
|
|
1035
|
-
switch (type) {
|
|
1036
|
-
case "tab":
|
|
1037
|
-
return /* @__PURE__ */ React8.createElement(L1Panel, {
|
|
1038
|
-
key: item.id,
|
|
1039
|
-
item,
|
|
1040
|
-
...props,
|
|
1041
|
-
onBack
|
|
1042
|
-
});
|
|
1043
|
-
case "collection":
|
|
1044
|
-
return /* @__PURE__ */ React8.createElement(L1PanelCollection, {
|
|
1045
|
-
key: item.id,
|
|
1046
|
-
item,
|
|
1047
|
-
...props
|
|
1048
|
-
});
|
|
1049
|
-
default:
|
|
1050
|
-
return null;
|
|
1051
|
-
}
|
|
1052
|
-
}));
|
|
1053
|
-
} finally {
|
|
1054
|
-
_effect.f();
|
|
1055
|
-
}
|
|
1056
|
-
};
|
|
1057
|
-
var L1PanelCollection = ({ item, path, ...props }) => {
|
|
1058
|
-
var _effect = _useSignals8();
|
|
1059
|
-
try {
|
|
1060
|
-
const { useItems: useItems2 } = useNavTreeContext();
|
|
1061
|
-
useLoadDescendents(item);
|
|
1062
|
-
const collectionItems = useItems2(item);
|
|
1063
|
-
const groupPath = useMemo4(() => [
|
|
1064
|
-
...path,
|
|
1065
|
-
item.id
|
|
1066
|
-
], [
|
|
1067
|
-
item.id,
|
|
1068
|
-
path
|
|
1069
|
-
]);
|
|
1070
|
-
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, collectionItems.filter((item2) => l0ItemType(item2) === "tab").map((item2) => /* @__PURE__ */ React8.createElement(L1Panel, {
|
|
1071
|
-
key: item2.id,
|
|
1072
|
-
item: item2,
|
|
1073
|
-
path: groupPath,
|
|
1074
|
-
...props
|
|
1075
|
-
})));
|
|
1076
|
-
} finally {
|
|
1077
|
-
_effect.f();
|
|
1078
|
-
}
|
|
1079
|
-
};
|
|
1080
|
-
|
|
1081
|
-
// src/components/NavTree/NavTree.tsx
|
|
1082
|
-
var NAV_TREE_ITEM = "NavTreeItem";
|
|
1083
|
-
var NavTree = ({ id, root, ...props }) => {
|
|
1084
|
-
var _effect = _useSignals9();
|
|
1085
|
-
try {
|
|
1086
|
-
const { tab, useItems: useItems2, onBack } = useNavTreeContext();
|
|
1087
|
-
const topLevelActions = useItems2(root, {
|
|
1088
|
-
disposition: "menu",
|
|
1089
|
-
sort: true
|
|
1090
|
-
});
|
|
1091
|
-
const topLevelCollections = useItems2(root, {
|
|
1092
|
-
disposition: "collection"
|
|
1093
|
-
});
|
|
1094
|
-
const topLevelWorkspaces = useItems2(root, {
|
|
1095
|
-
disposition: "workspace"
|
|
1096
|
-
});
|
|
1097
|
-
const topLevelNavigation = useItems2(root, {
|
|
1098
|
-
disposition: "navigation"
|
|
1099
|
-
});
|
|
1100
|
-
const l0Items = useMemo5(() => [
|
|
1101
|
-
// prettier-ignore
|
|
1102
|
-
...topLevelCollections,
|
|
1103
|
-
...topLevelWorkspaces,
|
|
1104
|
-
...topLevelNavigation
|
|
1105
|
-
], [
|
|
1106
|
-
topLevelCollections,
|
|
1107
|
-
topLevelWorkspaces,
|
|
1108
|
-
topLevelNavigation
|
|
1109
|
-
]);
|
|
1110
|
-
const pinnedItems = useItems2(root, {
|
|
1111
|
-
disposition: "pin-end",
|
|
1112
|
-
sort: true
|
|
1113
|
-
});
|
|
1114
|
-
const userAccountItem = useItems2(root, {
|
|
1115
|
-
disposition: "user-account"
|
|
1116
|
-
})[0];
|
|
1117
|
-
const topLevelItems = useMemo5(() => [
|
|
1118
|
-
// prettier-ignore
|
|
1119
|
-
...l0Items,
|
|
1120
|
-
...pinnedItems,
|
|
1121
|
-
...userAccountItem ? [
|
|
1122
|
-
userAccountItem
|
|
1123
|
-
] : []
|
|
1124
|
-
], [
|
|
1125
|
-
l0Items,
|
|
1126
|
-
pinnedItems,
|
|
1127
|
-
userAccountItem
|
|
1128
|
-
]);
|
|
1129
|
-
useLoadDescendents(root);
|
|
1130
|
-
const path = useMemo5(() => [
|
|
1131
|
-
id
|
|
1132
|
-
], [
|
|
1133
|
-
id
|
|
1134
|
-
]);
|
|
1135
|
-
return /* @__PURE__ */ React9.createElement(Tabs3.Root, {
|
|
1136
|
-
value: tab,
|
|
1137
|
-
orientation: "vertical",
|
|
1138
|
-
verticalVariant: "stateless",
|
|
1139
|
-
classNames: "relative"
|
|
1140
|
-
}, /* @__PURE__ */ React9.createElement(L0Menu, {
|
|
1141
|
-
menuActions: topLevelActions,
|
|
1142
|
-
topLevelItems: l0Items,
|
|
1143
|
-
pinnedItems,
|
|
1144
|
-
userAccountItem,
|
|
1145
|
-
path,
|
|
1146
|
-
parent: root
|
|
1147
|
-
}), /* @__PURE__ */ React9.createElement(L1Tabs, {
|
|
1148
|
-
topLevelItems,
|
|
1149
|
-
path,
|
|
1150
|
-
currentItemId: tab,
|
|
1151
|
-
onBack,
|
|
1152
|
-
...props
|
|
1153
|
-
}));
|
|
1154
|
-
} finally {
|
|
1155
|
-
_effect.f();
|
|
1156
|
-
}
|
|
1157
|
-
};
|
|
1158
|
-
|
|
1159
|
-
// src/components/NavTreeContainer.tsx
|
|
1160
|
-
var NODE_TYPE = "dxos/app-graph/node";
|
|
1161
|
-
var renderItemEnd = ({ node, open }) => /* @__PURE__ */ React10.createElement(Surface, {
|
|
1162
|
-
role: "navtree-item-end",
|
|
1163
|
-
data: {
|
|
1164
|
-
id: node.id,
|
|
1165
|
-
subject: node.data,
|
|
1166
|
-
open
|
|
1167
|
-
},
|
|
1168
|
-
limit: 1
|
|
1169
|
-
});
|
|
1170
|
-
var getChildrenFilter = (node) => untracked(() => !isActionLike2(node) && node.type !== PLANK_COMPANION_TYPE);
|
|
1171
|
-
var filterItems = (node, disposition) => {
|
|
1172
|
-
if (!disposition && (node.properties.disposition === "hidden" || node.properties.disposition === "alternate-tree")) {
|
|
1173
|
-
return false;
|
|
1174
|
-
} else if (!disposition) {
|
|
1175
|
-
const action = isAction3(node);
|
|
1176
|
-
return !action || node.properties.disposition === "item";
|
|
1177
|
-
} else {
|
|
1178
|
-
return node.properties.disposition === disposition;
|
|
1179
|
-
}
|
|
1180
|
-
};
|
|
1181
|
-
var getItems = (graph, node, disposition) => {
|
|
1182
|
-
return graph.getConnections(node?.id ?? ROOT_ID, "outbound").filter((node2) => filterItems(node2, disposition));
|
|
1183
|
-
};
|
|
1184
|
-
var useItems = (node, options) => {
|
|
1185
|
-
const { graph } = useAppGraph2();
|
|
1186
|
-
const connections = useConnections(graph, node?.id ?? ROOT_ID);
|
|
1187
|
-
const filtered = connections.filter((node2) => filterItems(node2, options?.disposition));
|
|
1188
|
-
return options?.sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
|
|
1189
|
-
};
|
|
1190
|
-
var useActions2 = (node) => {
|
|
1191
|
-
const { graph } = useAppGraph2();
|
|
1192
|
-
const actions = useGraphActions(graph, node.id);
|
|
1193
|
-
return useMemo6(() => actions.reduce((acc, arg) => {
|
|
1194
|
-
if (arg.properties.disposition === "item") {
|
|
1195
|
-
return acc;
|
|
1196
|
-
}
|
|
1197
|
-
acc.actions.push(arg);
|
|
1198
|
-
if (!isAction3(arg)) {
|
|
1199
|
-
const actionGroup = graph.getActions(arg.id);
|
|
1200
|
-
acc.groupedActions[arg.id] = actionGroup;
|
|
1201
|
-
}
|
|
1202
|
-
return acc;
|
|
1203
|
-
}, {
|
|
1204
|
-
actions: [],
|
|
1205
|
-
groupedActions: {}
|
|
1206
|
-
}), [
|
|
1207
|
-
actions
|
|
1208
|
-
]);
|
|
1209
|
-
};
|
|
1210
|
-
var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar }) => {
|
|
1211
|
-
var _effect = _useSignals10();
|
|
1212
|
-
try {
|
|
1213
|
-
const [isLg] = useMediaQuery2("lg", {
|
|
1214
|
-
ssr: false
|
|
1215
|
-
});
|
|
1216
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
1217
|
-
const { graph } = useAppGraph2();
|
|
1218
|
-
const { isOpen, isCurrent, isAlternateTree, setItem } = useCapability(NavTreeCapabilities.State);
|
|
1219
|
-
const layout = useLayout();
|
|
1220
|
-
const { navigationSidebarState } = useSidebars(NAVTREE_PLUGIN);
|
|
1221
|
-
const getProps = useCallback3((node, path) => {
|
|
1222
|
-
const children = getChildren(graph, node, path).filter(getChildrenFilter);
|
|
1223
|
-
const parentOf = children.length > 0 ? children.map(({ id }) => id) : node.properties.role === "branch" ? [] : void 0;
|
|
1224
|
-
return {
|
|
1225
|
-
id: node.id,
|
|
1226
|
-
label: node.properties.label ?? node.id,
|
|
1227
|
-
parentOf,
|
|
1228
|
-
icon: node.properties.icon,
|
|
1229
|
-
disabled: node.properties.disabled,
|
|
1230
|
-
className: mx3(node.properties.modified && "italic", node.properties.className),
|
|
1231
|
-
headingClassName: node.properties.headingClassName,
|
|
1232
|
-
testId: node.properties.testId
|
|
1233
|
-
};
|
|
1234
|
-
}, [
|
|
1235
|
-
graph
|
|
1236
|
-
]);
|
|
1237
|
-
const loadDescendents = useCallback3((node) => {
|
|
1238
|
-
graph.expand(node.id, "outbound");
|
|
1239
|
-
graph.getConnections(node.id, "outbound").forEach((child) => {
|
|
1240
|
-
graph.expand(child.id, "outbound");
|
|
1241
|
-
});
|
|
1242
|
-
}, [
|
|
1243
|
-
graph
|
|
1244
|
-
]);
|
|
1245
|
-
const handleOpenChange = useCallback3(({ item: { id }, path, open }) => {
|
|
1246
|
-
setItem(path, "open", open);
|
|
1247
|
-
graph.expand(id, "outbound");
|
|
1248
|
-
}, [
|
|
1249
|
-
graph
|
|
1250
|
-
]);
|
|
1251
|
-
const handleTabChange = useCallback3(async (node) => {
|
|
1252
|
-
await dispatch(createIntent3(LayoutAction3.UpdateSidebar, {
|
|
1253
|
-
part: "sidebar",
|
|
1254
|
-
options: {
|
|
1255
|
-
state: node.id === tab ? navigationSidebarState === "expanded" ? isLg ? "collapsed" : "closed" : "expanded" : "expanded"
|
|
1256
|
-
}
|
|
1257
|
-
}));
|
|
1258
|
-
await dispatch(createIntent3(LayoutAction3.SwitchWorkspace, {
|
|
1259
|
-
part: "workspace",
|
|
1260
|
-
subject: node.id
|
|
1261
|
-
}));
|
|
1262
|
-
if (layout.active.length === 0) {
|
|
1263
|
-
const [item] = getItems(graph, node).filter((node2) => !isActionLike2(node2));
|
|
1264
|
-
if (item && item.data) {
|
|
1265
|
-
await dispatch(createIntent3(LayoutAction3.Open, {
|
|
1266
|
-
part: "main",
|
|
1267
|
-
subject: [
|
|
1268
|
-
item.id
|
|
1269
|
-
]
|
|
1270
|
-
}));
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
}, [
|
|
1274
|
-
dispatch,
|
|
1275
|
-
layout.active,
|
|
1276
|
-
tab,
|
|
1277
|
-
navigationSidebarState,
|
|
1278
|
-
isLg
|
|
1279
|
-
]);
|
|
1280
|
-
const canDrop = useCallback3(({ source, target }) => {
|
|
1281
|
-
return target.item.properties.canDrop?.(source) ?? false;
|
|
1282
|
-
}, []);
|
|
1283
|
-
const handleSelect = useCallback3(({ item: node, path, option }) => {
|
|
1284
|
-
if (!node.data) {
|
|
1285
|
-
return;
|
|
1286
|
-
}
|
|
1287
|
-
if (isAction3(node)) {
|
|
1288
|
-
const [parent] = graph.getConnections(node.id, "inbound");
|
|
1289
|
-
void (parent && node.data({
|
|
1290
|
-
parent,
|
|
1291
|
-
caller: NAV_TREE_ITEM
|
|
1292
|
-
}));
|
|
1293
|
-
return;
|
|
1294
|
-
}
|
|
1295
|
-
const current = isCurrent(path, node);
|
|
1296
|
-
if (!current) {
|
|
1297
|
-
void dispatch(createIntent3(LayoutAction3.Open, {
|
|
1298
|
-
part: "main",
|
|
1299
|
-
subject: [
|
|
1300
|
-
node.id
|
|
1301
|
-
],
|
|
1302
|
-
options: {
|
|
1303
|
-
key: node.properties.key
|
|
1304
|
-
}
|
|
1305
|
-
}));
|
|
1306
|
-
} else if (option) {
|
|
1307
|
-
void dispatch(createIntent3(LayoutAction3.Close, {
|
|
1308
|
-
part: "main",
|
|
1309
|
-
subject: [
|
|
1310
|
-
node.id
|
|
1311
|
-
],
|
|
1312
|
-
options: {
|
|
1313
|
-
state: false
|
|
1314
|
-
}
|
|
1315
|
-
}));
|
|
1316
|
-
} else {
|
|
1317
|
-
void dispatch(createIntent3(LayoutAction3.ScrollIntoView, {
|
|
1318
|
-
part: "current",
|
|
1319
|
-
subject: node.id
|
|
1320
|
-
}));
|
|
1321
|
-
}
|
|
1322
|
-
const defaultAction = graph.getActions(node.id).find((action) => action.properties?.disposition === "default");
|
|
1323
|
-
if (isAction3(defaultAction)) {
|
|
1324
|
-
void defaultAction.data();
|
|
1325
|
-
}
|
|
1326
|
-
if (!isLg) {
|
|
1327
|
-
void dispatch(createIntent3(LayoutAction3.UpdateSidebar, {
|
|
1328
|
-
part: "sidebar",
|
|
1329
|
-
options: {
|
|
1330
|
-
state: "closed"
|
|
1331
|
-
}
|
|
1332
|
-
}));
|
|
1333
|
-
}
|
|
1334
|
-
}, [
|
|
1335
|
-
graph,
|
|
1336
|
-
dispatch,
|
|
1337
|
-
isCurrent,
|
|
1338
|
-
isLg
|
|
1339
|
-
]);
|
|
1340
|
-
const handleBack = useCallback3(() => dispatch(createIntent3(LayoutAction3.RevertWorkspace, {
|
|
1341
|
-
part: "workspace",
|
|
1342
|
-
options: {
|
|
1343
|
-
revert: true
|
|
1344
|
-
}
|
|
1345
|
-
})), [
|
|
1346
|
-
dispatch
|
|
1347
|
-
]);
|
|
1348
|
-
useEffect3(() => {
|
|
1349
|
-
return monitorForElements({
|
|
1350
|
-
canMonitor: ({ source }) => isTreeData(source.data),
|
|
1351
|
-
onDrop: ({ location, source }) => {
|
|
1352
|
-
if (!location.current.dropTargets.length) {
|
|
1353
|
-
return;
|
|
1354
|
-
}
|
|
1355
|
-
const target = location.current.dropTargets[0];
|
|
1356
|
-
const instruction = extractInstruction(target.data);
|
|
1357
|
-
if (instruction !== null && instruction.type !== "instruction-blocked") {
|
|
1358
|
-
const sourceNode = source.data.item;
|
|
1359
|
-
const targetNode = target.data.item;
|
|
1360
|
-
const sourcePath = source.data.path;
|
|
1361
|
-
const targetPath = target.data.path;
|
|
1362
|
-
const operation = sourcePath.slice(0, -1).join() === targetPath.slice(0, -1).join() && instruction.type !== "make-child" ? "rearrange" : resolveMigrationOperation(graph, sourceNode, targetPath, targetNode);
|
|
1363
|
-
const sourceParent = getParent(graph, sourceNode, sourcePath);
|
|
1364
|
-
const targetParent = getParent(graph, targetNode, targetPath);
|
|
1365
|
-
const sourceItems = getItems(graph, sourceParent);
|
|
1366
|
-
const targetItems = getItems(graph, targetParent);
|
|
1367
|
-
const sourceIndex = sourceItems.findIndex(({ id }) => id === sourceNode.id);
|
|
1368
|
-
const targetIndex = targetItems.findIndex(({ id }) => id === targetNode.id);
|
|
1369
|
-
const migrationIndex = instruction.type === "make-child" ? void 0 : instruction.type === "reorder-below" ? targetIndex + 1 : targetIndex;
|
|
1370
|
-
switch (operation) {
|
|
1371
|
-
case "rearrange": {
|
|
1372
|
-
const nextItems = sourceItems.map(({ data }) => data);
|
|
1373
|
-
arrayMove2(nextItems, sourceIndex, targetIndex);
|
|
1374
|
-
void sourceParent?.properties.onRearrangeChildren?.(nextItems);
|
|
1375
|
-
break;
|
|
1376
|
-
}
|
|
1377
|
-
case "copy": {
|
|
1378
|
-
const target2 = instruction.type === "make-child" ? targetNode : targetParent;
|
|
1379
|
-
void target2?.properties.onCopy?.(sourceNode, migrationIndex);
|
|
1380
|
-
break;
|
|
1381
|
-
}
|
|
1382
|
-
case "transfer": {
|
|
1383
|
-
const target2 = instruction.type === "make-child" ? targetNode : targetParent;
|
|
1384
|
-
if (!target2?.properties.onTransferStart || !sourceParent?.properties.onTransferEnd) {
|
|
1385
|
-
break;
|
|
1386
|
-
}
|
|
1387
|
-
void target2?.properties.onTransferStart(sourceNode, migrationIndex);
|
|
1388
|
-
void sourceParent?.properties.onTransferEnd?.(sourceNode, target2);
|
|
1389
|
-
break;
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
});
|
|
1395
|
-
}, [
|
|
1396
|
-
graph
|
|
1397
|
-
]);
|
|
1398
|
-
const setAlternateTree = useCallback3((path, open) => {
|
|
1399
|
-
setItem(path, "alternateTree", open);
|
|
1400
|
-
}, [
|
|
1401
|
-
setItem
|
|
1402
|
-
]);
|
|
1403
|
-
const navTreeContextValue = useMemo6(() => ({
|
|
1404
|
-
useItems,
|
|
1405
|
-
tab,
|
|
1406
|
-
useActions: useActions2,
|
|
1407
|
-
loadDescendents,
|
|
1408
|
-
renderItemEnd,
|
|
1409
|
-
popoverAnchorId,
|
|
1410
|
-
topbar,
|
|
1411
|
-
getProps,
|
|
1412
|
-
isCurrent,
|
|
1413
|
-
isOpen,
|
|
1414
|
-
canDrop,
|
|
1415
|
-
isAlternateTree,
|
|
1416
|
-
setAlternateTree,
|
|
1417
|
-
onTabChange: handleTabChange,
|
|
1418
|
-
onOpenChange: handleOpenChange,
|
|
1419
|
-
onSelect: handleSelect,
|
|
1420
|
-
onBack: handleBack
|
|
1421
|
-
}), [
|
|
1422
|
-
tab,
|
|
1423
|
-
useActions2,
|
|
1424
|
-
loadDescendents,
|
|
1425
|
-
renderItemEnd,
|
|
1426
|
-
popoverAnchorId,
|
|
1427
|
-
topbar,
|
|
1428
|
-
getProps,
|
|
1429
|
-
isCurrent,
|
|
1430
|
-
isOpen,
|
|
1431
|
-
canDrop,
|
|
1432
|
-
isAlternateTree,
|
|
1433
|
-
setAlternateTree,
|
|
1434
|
-
handleTabChange,
|
|
1435
|
-
handleOpenChange,
|
|
1436
|
-
handleSelect,
|
|
1437
|
-
handleBack
|
|
1438
|
-
]);
|
|
1439
|
-
return /* @__PURE__ */ React10.createElement(NavTreeContext.Provider, {
|
|
1440
|
-
value: navTreeContextValue
|
|
1441
|
-
}, /* @__PURE__ */ React10.createElement(NavTree, {
|
|
1442
|
-
id: ROOT_ID,
|
|
1443
|
-
root: graph.root,
|
|
1444
|
-
open: layout.sidebarOpen
|
|
1445
|
-
}));
|
|
1446
|
-
} finally {
|
|
1447
|
-
_effect.f();
|
|
1448
|
-
}
|
|
1449
|
-
});
|
|
1450
|
-
|
|
1451
|
-
export {
|
|
1452
|
-
CommandsDialogContent,
|
|
1453
|
-
CommandsTrigger,
|
|
1454
|
-
getParent,
|
|
1455
|
-
getPersistenceParent,
|
|
1456
|
-
resolveMigrationOperation,
|
|
1457
|
-
sortActions,
|
|
1458
|
-
getChildren,
|
|
1459
|
-
l0ItemType,
|
|
1460
|
-
NODE_TYPE,
|
|
1461
|
-
NavTreeContainer,
|
|
1462
|
-
NavTreeDocumentTitle,
|
|
1463
|
-
AppGraphBuilder,
|
|
1464
|
-
IntentResolver,
|
|
1465
|
-
Keyboard2 as Keyboard,
|
|
1466
|
-
ReactSurface,
|
|
1467
|
-
State
|
|
1468
|
-
};
|
|
1469
|
-
//# sourceMappingURL=chunk-SNGLGBFJ.mjs.map
|