@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
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
import {
|
|
2
|
+
l0ItemType
|
|
3
|
+
} from "../chunk-JOSNCOV4.mjs";
|
|
4
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/NavTree/NavTree.tsx
|
|
7
|
+
import React7, { forwardRef as forwardRef2, useMemo as useMemo4 } from "react";
|
|
8
|
+
import { useAppGraph as useAppGraph2 } from "@dxos/app-toolkit/ui";
|
|
9
|
+
import { Node, useConnections, useActions as useGraphActions } from "@dxos/plugin-graph";
|
|
10
|
+
import { Tabs as Tabs3 } from "@dxos/react-ui-tabs";
|
|
11
|
+
import { byPosition } from "@dxos/util";
|
|
12
|
+
import { useLoadDescendents as useLoadDescendents2 } from "#hooks";
|
|
13
|
+
|
|
14
|
+
// src/components/NavTreeContext/NavTreeContext.tsx
|
|
15
|
+
import { createContext, useContext } from "react";
|
|
16
|
+
import { raise } from "@dxos/debug";
|
|
17
|
+
var NavTreeContext = /* @__PURE__ */ createContext(null);
|
|
18
|
+
var useNavTreeContext = () => useContext(NavTreeContext) ?? raise(new Error("Missing NavTreeContext"));
|
|
19
|
+
|
|
20
|
+
// src/components/Sidebar/L0Menu.tsx
|
|
21
|
+
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
22
|
+
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
23
|
+
import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
24
|
+
import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
|
|
25
|
+
import { scrollJustEnoughIntoView } from "@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view";
|
|
26
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
27
|
+
import React2, { forwardRef, memo, useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
28
|
+
import { DxAvatar } from "@dxos/lit-ui/react";
|
|
29
|
+
import { useActionRunner } from "@dxos/plugin-graph";
|
|
30
|
+
import { Icon, IconButton, ListItem, ScrollArea, Tooltip, toLocalizedString, useMediaQuery, useTranslation } from "@dxos/react-ui";
|
|
31
|
+
import { Menu } from "@dxos/react-ui-menu";
|
|
32
|
+
import { Tabs } from "@dxos/react-ui-tabs";
|
|
33
|
+
import { mx } from "@dxos/ui-theme";
|
|
34
|
+
import { arrayMove } from "@dxos/util";
|
|
35
|
+
import { useNavTreeState } from "#hooks";
|
|
36
|
+
import { meta } from "#meta";
|
|
37
|
+
|
|
38
|
+
// src/components/UserAccountAvatar/UserAccountAvatar.tsx
|
|
39
|
+
import React from "react";
|
|
40
|
+
import { Avatar } from "@dxos/react-ui";
|
|
41
|
+
import { hexToFallback } from "@dxos/util";
|
|
42
|
+
var UserAccountAvatar = ({ size, userId, hue, emoji, status }) => {
|
|
43
|
+
const fallbackValue = hexToFallback(userId ?? "0");
|
|
44
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(L0ItemActiveTabIndicator, {
|
|
45
|
+
classNames: "inset-y-6"
|
|
46
|
+
}), /* @__PURE__ */ React.createElement("div", {
|
|
47
|
+
className: "grid place-items-center dx-focus-ring-group-indicator rounded-full",
|
|
48
|
+
"data-joyride": "welcome/account"
|
|
49
|
+
}, /* @__PURE__ */ React.createElement(Avatar.Root, null, /* @__PURE__ */ React.createElement(Avatar.Content, {
|
|
50
|
+
variant: "circle",
|
|
51
|
+
size: size ?? 12,
|
|
52
|
+
status: status ?? "active",
|
|
53
|
+
hue: hue || fallbackValue.hue,
|
|
54
|
+
fallback: emoji || fallbackValue.emoji,
|
|
55
|
+
"data-testid": "treeView.userAccount"
|
|
56
|
+
}))));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// src/components/Sidebar/L0Menu.tsx
|
|
60
|
+
var useL0ItemClick = ({ item, parent, path }, type) => {
|
|
61
|
+
const { onSelect, onTabChange } = useNavTreeContext();
|
|
62
|
+
const { getItem } = useNavTreeState();
|
|
63
|
+
const [isLg] = useMediaQuery("lg");
|
|
64
|
+
const runAction = useActionRunner();
|
|
65
|
+
return useCallback((event) => {
|
|
66
|
+
switch (type) {
|
|
67
|
+
case "action": {
|
|
68
|
+
const { properties: { caller } = {} } = item;
|
|
69
|
+
return void runAction(item, caller ? {
|
|
70
|
+
parent,
|
|
71
|
+
path,
|
|
72
|
+
caller
|
|
73
|
+
} : {
|
|
74
|
+
parent,
|
|
75
|
+
path
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
case "tab":
|
|
79
|
+
return onTabChange?.(item);
|
|
80
|
+
case "link":
|
|
81
|
+
return onSelect?.({
|
|
82
|
+
item,
|
|
83
|
+
path,
|
|
84
|
+
current: !getItem(path).current,
|
|
85
|
+
option: event.altKey
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}, [
|
|
89
|
+
item,
|
|
90
|
+
parent,
|
|
91
|
+
type,
|
|
92
|
+
getItem,
|
|
93
|
+
onSelect,
|
|
94
|
+
onTabChange,
|
|
95
|
+
isLg,
|
|
96
|
+
runAction
|
|
97
|
+
]);
|
|
98
|
+
};
|
|
99
|
+
var l0Breakpoints = {
|
|
100
|
+
lg: "hidden lg:grid"
|
|
101
|
+
};
|
|
102
|
+
var L0ItemRoot = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ item, parent, path, onMouseEnter, children }, forwardedRef) => {
|
|
103
|
+
const { t } = useTranslation(meta.id);
|
|
104
|
+
const { model } = useNavTreeContext();
|
|
105
|
+
const itemPath = useMemo(() => [
|
|
106
|
+
...path,
|
|
107
|
+
item.id
|
|
108
|
+
], [
|
|
109
|
+
item.id,
|
|
110
|
+
path
|
|
111
|
+
]);
|
|
112
|
+
const { id, testId } = useAtomValue(model.itemProps(itemPath));
|
|
113
|
+
const localizedString = toLocalizedString(item.properties.label, t);
|
|
114
|
+
const type = l0ItemType(item);
|
|
115
|
+
const handleClick = useL0ItemClick({
|
|
116
|
+
item,
|
|
117
|
+
parent,
|
|
118
|
+
path: itemPath
|
|
119
|
+
}, type);
|
|
120
|
+
return /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
121
|
+
asChild: true,
|
|
122
|
+
delayDuration: 0,
|
|
123
|
+
side: "right",
|
|
124
|
+
content: localizedString
|
|
125
|
+
}, /* @__PURE__ */ React2.createElement(Tabs.TabPrimitive, {
|
|
126
|
+
className: mx("group/l0item flex w-full justify-center items-center relative", 'dx-app-no-drag dx-focus-ring-group data[type!="collection"]:cursor-pointer', l0Breakpoints[item.properties.l0Breakpoint]),
|
|
127
|
+
tabIndex: type === "tab" ? 0 : void 0,
|
|
128
|
+
"data-type": type,
|
|
129
|
+
"data-testid": testId,
|
|
130
|
+
"data-object-id": id,
|
|
131
|
+
value: item.id,
|
|
132
|
+
onClick: handleClick,
|
|
133
|
+
onMouseEnter,
|
|
134
|
+
ref: forwardedRef
|
|
135
|
+
}, children));
|
|
136
|
+
}));
|
|
137
|
+
var L0ItemActiveTabIndicator = ({ classNames }) => /* @__PURE__ */ React2.createElement("div", {
|
|
138
|
+
className: mx("hidden group-aria-selected/l0item:block absolute start-0 h-6 w-1.5 bg-accent-bg rounded-sm", classNames)
|
|
139
|
+
});
|
|
140
|
+
var L0Item = /* @__PURE__ */ memo(({ item, parent, path, pinned, onRearrange, onItemHover }) => {
|
|
141
|
+
const { t } = useTranslation(meta.id);
|
|
142
|
+
const itemElement = useRef(null);
|
|
143
|
+
const [closestEdge, setEdge] = useState(null);
|
|
144
|
+
const localizedString = toLocalizedString(item.properties.label, t);
|
|
145
|
+
const hue = item.properties.hue ?? null;
|
|
146
|
+
useLayoutEffect(() => {
|
|
147
|
+
if (!itemElement.current || !onRearrange) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
return combine(draggable({
|
|
151
|
+
element: itemElement.current,
|
|
152
|
+
getInitialData: () => ({
|
|
153
|
+
id: item.id,
|
|
154
|
+
type: "l0Item"
|
|
155
|
+
}),
|
|
156
|
+
onGenerateDragPreview: ({ nativeSetDragImage, source, location }) => {
|
|
157
|
+
document.body.setAttribute("data-drag-preview", "true");
|
|
158
|
+
const element = source.element.querySelector("[data-frame]");
|
|
159
|
+
scrollJustEnoughIntoView({
|
|
160
|
+
element
|
|
161
|
+
});
|
|
162
|
+
const { x, y } = preserveOffsetOnSource({
|
|
163
|
+
element,
|
|
164
|
+
input: location.current.input
|
|
165
|
+
})({
|
|
166
|
+
container: element.offsetParent ?? document.body
|
|
167
|
+
});
|
|
168
|
+
nativeSetDragImage?.(element, x, y);
|
|
169
|
+
},
|
|
170
|
+
onDragStart: () => {
|
|
171
|
+
document.body.removeAttribute("data-drag-preview");
|
|
172
|
+
itemElement.current.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "active");
|
|
173
|
+
},
|
|
174
|
+
onDrop: () => {
|
|
175
|
+
itemElement.current.closest("[data-drag-autoscroll]")?.setAttribute("data-drag-autoscroll", "idle");
|
|
176
|
+
}
|
|
177
|
+
}), dropTargetForElements({
|
|
178
|
+
element: itemElement.current,
|
|
179
|
+
getData: ({ input, element }) => {
|
|
180
|
+
return attachClosestEdge({
|
|
181
|
+
id: item.id,
|
|
182
|
+
type: "l0Item"
|
|
183
|
+
}, {
|
|
184
|
+
input,
|
|
185
|
+
element,
|
|
186
|
+
allowedEdges: [
|
|
187
|
+
"top",
|
|
188
|
+
"bottom"
|
|
189
|
+
]
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
onDragEnter: ({ self, source }) => {
|
|
193
|
+
if (source.data.type === self.data.type) {
|
|
194
|
+
setEdge(extractClosestEdge(self.data));
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
onDrag: ({ self, source }) => {
|
|
198
|
+
if (source.data.type === self.data.type) {
|
|
199
|
+
setEdge(extractClosestEdge(self.data));
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
onDragLeave: () => setEdge(null),
|
|
203
|
+
onDrop: ({ self, source }) => {
|
|
204
|
+
setEdge(null);
|
|
205
|
+
if (source.data.type === self.data.type) {
|
|
206
|
+
onRearrange(source.data, self.data, extractClosestEdge(self.data));
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}));
|
|
210
|
+
}, [
|
|
211
|
+
item,
|
|
212
|
+
onRearrange
|
|
213
|
+
]);
|
|
214
|
+
const handleMouseEnter = useCallback(() => onItemHover?.({
|
|
215
|
+
item
|
|
216
|
+
}), [
|
|
217
|
+
item,
|
|
218
|
+
onItemHover
|
|
219
|
+
]);
|
|
220
|
+
return /* @__PURE__ */ React2.createElement(L0ItemRoot, {
|
|
221
|
+
ref: itemElement,
|
|
222
|
+
item,
|
|
223
|
+
parent,
|
|
224
|
+
path,
|
|
225
|
+
onMouseEnter: handleMouseEnter
|
|
226
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
227
|
+
"data-frame": true,
|
|
228
|
+
...hue && {
|
|
229
|
+
style: {
|
|
230
|
+
background: `var(--color-${hue}-surface)`
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
className: mx("flex justify-center items-center dx-focus-ring-group-indicator transition-colors rounded-sm", pinned ? "p-2 group-hover/l0item:bg-current-surface" : "w-(--dx-l0-avatar-size) h-(--dx-l0-avatar-size) bg-current-surface")
|
|
234
|
+
}, /* @__PURE__ */ React2.createElement(ItemAvatar, {
|
|
235
|
+
item
|
|
236
|
+
})), /* @__PURE__ */ React2.createElement(L0ItemActiveTabIndicator, null), /* @__PURE__ */ React2.createElement("span", {
|
|
237
|
+
id: `${item.id}__label`,
|
|
238
|
+
className: "sr-only"
|
|
239
|
+
}, localizedString), closestEdge && /* @__PURE__ */ React2.createElement(ListItem.DropIndicator, {
|
|
240
|
+
edge: closestEdge
|
|
241
|
+
}));
|
|
242
|
+
});
|
|
243
|
+
var ItemAvatar = ({ item }) => {
|
|
244
|
+
const { t } = useTranslation(meta.id);
|
|
245
|
+
if (item.properties.icon) {
|
|
246
|
+
const hue = item.properties.hue ?? null;
|
|
247
|
+
const hueFgStyle = hue && {
|
|
248
|
+
style: {
|
|
249
|
+
color: `var(--color-${hue}-fg)`
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
return /* @__PURE__ */ React2.createElement(Icon, {
|
|
253
|
+
icon: item.properties.icon,
|
|
254
|
+
size: 6,
|
|
255
|
+
...hueFgStyle
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
const type = l0ItemType(item);
|
|
259
|
+
if (type === "tab" && item.properties.disposition !== "pin-end") {
|
|
260
|
+
const hue = item.properties.hue ?? null;
|
|
261
|
+
const localizedString = toLocalizedString(item.properties.label, t);
|
|
262
|
+
return /* @__PURE__ */ React2.createElement(DxAvatar, {
|
|
263
|
+
hue,
|
|
264
|
+
hueVariant: "surface",
|
|
265
|
+
variant: "square",
|
|
266
|
+
size: 12,
|
|
267
|
+
fallback: localizedString
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return null;
|
|
271
|
+
};
|
|
272
|
+
var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent, path, onItemHover }) => {
|
|
273
|
+
const { t } = useTranslation(meta.id);
|
|
274
|
+
const runAction = useActionRunner();
|
|
275
|
+
const handleAction = useCallback((action, params) => {
|
|
276
|
+
void runAction(action, params);
|
|
277
|
+
}, [
|
|
278
|
+
runAction
|
|
279
|
+
]);
|
|
280
|
+
const handleRearrange = useCallback((source, target, closestEdge) => {
|
|
281
|
+
const sourceItem = topLevelItems.find((i) => i.id === source.id);
|
|
282
|
+
if (!sourceItem?.properties.onRearrange) {
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
const sourceIndex = topLevelItems.findIndex((i) => i.id === source.id);
|
|
286
|
+
const targetIndex = topLevelItems.findIndex((i) => i.id === target.id);
|
|
287
|
+
const insertIndex = source.id === target.id ? sourceIndex : targetIndex + (sourceIndex < targetIndex ? closestEdge === "top" ? -1 : 0 : closestEdge === "bottom" ? 1 : 0);
|
|
288
|
+
const nextOrder = arrayMove([
|
|
289
|
+
...topLevelItems
|
|
290
|
+
], sourceIndex, insertIndex);
|
|
291
|
+
return sourceItem.properties.onRearrange(nextOrder.map((item) => item.data));
|
|
292
|
+
}, [
|
|
293
|
+
topLevelItems
|
|
294
|
+
]);
|
|
295
|
+
const hasRearrangeableItems = topLevelItems.some((item) => item.properties.onRearrange);
|
|
296
|
+
return /* @__PURE__ */ React2.createElement(Tabs.Tablist, {
|
|
297
|
+
"data-tauri-drag-region": true,
|
|
298
|
+
classNames: [
|
|
299
|
+
"group/l0 absolute z-[1] inset-y-0 start-0 rounded-is",
|
|
300
|
+
"grid grid-cols-[var(--dx-l0-size)] grid-rows-[var(--dx-rail-size)_1fr_min-content_var(--dx-l0-size)] dx-contain-layout",
|
|
301
|
+
"w-(--dx-l0-size) bg-l0-surface dx-app-drag pb-[env(safe-area-inset-bottom)]",
|
|
302
|
+
'[body[data-platform="macos"]_&]:pt-[30px]',
|
|
303
|
+
'[body[data-platform="ios"]_&]:pt-[max(env(safe-area-inset-top),0.25rem)]'
|
|
304
|
+
]
|
|
305
|
+
}, /* @__PURE__ */ React2.createElement(Menu.Root, {
|
|
306
|
+
onAction: handleAction
|
|
307
|
+
}, /* @__PURE__ */ React2.createElement(Menu.Trigger, {
|
|
308
|
+
asChild: true,
|
|
309
|
+
"data-testid": "spacePlugin.addSpace"
|
|
310
|
+
}, /* @__PURE__ */ React2.createElement("div", {
|
|
311
|
+
className: "grid place-items-center"
|
|
312
|
+
}, /* @__PURE__ */ React2.createElement(IconButton, {
|
|
313
|
+
density: "lg",
|
|
314
|
+
variant: "ghost",
|
|
315
|
+
size: 5,
|
|
316
|
+
icon: "ph--list--regular",
|
|
317
|
+
iconOnly: true,
|
|
318
|
+
square: true,
|
|
319
|
+
label: t("app-menu.label")
|
|
320
|
+
}))), /* @__PURE__ */ React2.createElement(Menu.Content, {
|
|
321
|
+
group: parent,
|
|
322
|
+
items: menuActions
|
|
323
|
+
})), /* @__PURE__ */ React2.createElement(ScrollArea.Root, {
|
|
324
|
+
centered: true,
|
|
325
|
+
thin: true,
|
|
326
|
+
orientation: "vertical"
|
|
327
|
+
}, /* @__PURE__ */ React2.createElement(ScrollArea.Viewport, {
|
|
328
|
+
classNames: "flex flex-col gap-2 py-1"
|
|
329
|
+
}, topLevelItems.map((item) => /* @__PURE__ */ React2.createElement(L0Item, {
|
|
330
|
+
key: item.id,
|
|
331
|
+
item,
|
|
332
|
+
parent,
|
|
333
|
+
path,
|
|
334
|
+
onItemHover,
|
|
335
|
+
...hasRearrangeableItems && {
|
|
336
|
+
onRearrange: handleRearrange
|
|
337
|
+
}
|
|
338
|
+
})))), /* @__PURE__ */ React2.createElement("div", {
|
|
339
|
+
className: "grid grid-cols-1 auto-rows-(--dx-rail-action) pt-2"
|
|
340
|
+
}, pinnedItems.map((item) => /* @__PURE__ */ React2.createElement(L0Item, {
|
|
341
|
+
key: item.id,
|
|
342
|
+
item,
|
|
343
|
+
parent,
|
|
344
|
+
path,
|
|
345
|
+
pinned: true
|
|
346
|
+
}))), userAccountItem && /* @__PURE__ */ React2.createElement("div", {
|
|
347
|
+
className: "grid dx-app-no-drag"
|
|
348
|
+
}, /* @__PURE__ */ React2.createElement(L0ItemRoot, {
|
|
349
|
+
key: userAccountItem.id,
|
|
350
|
+
item: userAccountItem,
|
|
351
|
+
parent,
|
|
352
|
+
path
|
|
353
|
+
}, /* @__PURE__ */ React2.createElement(UserAccountAvatar, {
|
|
354
|
+
userId: userAccountItem.properties.userId,
|
|
355
|
+
hue: userAccountItem.properties.hue,
|
|
356
|
+
emoji: userAccountItem.properties.emoji,
|
|
357
|
+
status: userAccountItem.properties.status,
|
|
358
|
+
size: 10
|
|
359
|
+
}))));
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
// src/components/Sidebar/L1Panel.tsx
|
|
363
|
+
import * as Option from "effect/Option";
|
|
364
|
+
import React5, { memo as memo3, useCallback as useCallback3, useMemo as useMemo3 } from "react";
|
|
365
|
+
import { isPinnedWorkspace } from "@dxos/app-toolkit";
|
|
366
|
+
import { useAppGraph } from "@dxos/app-toolkit/ui";
|
|
367
|
+
import { Graph, useActionRunner as useActionRunner3, useEdges } from "@dxos/plugin-graph";
|
|
368
|
+
import { DensityProvider, IconButton as IconButton3, ScrollArea as ScrollArea2, toLocalizedString as toLocalizedString4, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
369
|
+
import { Tree } from "@dxos/react-ui-list";
|
|
370
|
+
import { Menu as Menu3 } from "@dxos/react-ui-menu";
|
|
371
|
+
import { Tabs as Tabs2 } from "@dxos/react-ui-tabs";
|
|
372
|
+
import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem as hoverableOpenControlItem2 } from "@dxos/ui-theme";
|
|
373
|
+
import { getListActions as getListActions2, useActions as useActions2, useLoadDescendents } from "#hooks";
|
|
374
|
+
import { meta as meta4 } from "#meta";
|
|
375
|
+
|
|
376
|
+
// src/components/NavTreeItem/NavTreeItemColumns.tsx
|
|
377
|
+
import React4, { Fragment, memo as memo2, useMemo as useMemo2 } from "react";
|
|
378
|
+
import { Popover, Treegrid, toLocalizedString as toLocalizedString3, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
379
|
+
import { getListActions, useActions } from "#hooks";
|
|
380
|
+
import { meta as meta3 } from "#meta";
|
|
381
|
+
|
|
382
|
+
// src/components/NavTreeItem/NavTreeItemAction.tsx
|
|
383
|
+
import React3, { useCallback as useCallback2 } from "react";
|
|
384
|
+
import { useActionRunner as useActionRunner2 } from "@dxos/plugin-graph";
|
|
385
|
+
import { IconButton as IconButton2, toLocalizedString as toLocalizedString2, useDensityContext, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
386
|
+
import { composable, composableProps } from "@dxos/react-ui";
|
|
387
|
+
import { Menu as Menu2 } from "@dxos/react-ui-menu";
|
|
388
|
+
import { hoverableControlItem, hoverableOpenControlItem } from "@dxos/ui-theme";
|
|
389
|
+
import { meta as meta2 } from "#meta";
|
|
390
|
+
var fallbackIcon = "ph--circle-dashed--regular";
|
|
391
|
+
var mdActionButtonProps = {
|
|
392
|
+
size: 4,
|
|
393
|
+
density: "md"
|
|
394
|
+
};
|
|
395
|
+
var lgActionButtonProps = {
|
|
396
|
+
size: 5,
|
|
397
|
+
density: "lg"
|
|
398
|
+
};
|
|
399
|
+
var NavTreeItemActionDropdownMenu = composable(({ parent, path, label, icon, testId, menuActions, caller, ...props }, forwardedRef) => {
|
|
400
|
+
const { t } = useTranslation2(meta2.id);
|
|
401
|
+
const density = useDensityContext();
|
|
402
|
+
const runAction = useActionRunner2();
|
|
403
|
+
const handleAction = useCallback2((action, params = {}) => runAction(action, {
|
|
404
|
+
...params,
|
|
405
|
+
path
|
|
406
|
+
}), [
|
|
407
|
+
runAction,
|
|
408
|
+
path
|
|
409
|
+
]);
|
|
410
|
+
return /* @__PURE__ */ React3.createElement(Menu2.Root, {
|
|
411
|
+
caller,
|
|
412
|
+
onAction: handleAction
|
|
413
|
+
}, /* @__PURE__ */ React3.createElement(Menu2.Trigger, {
|
|
414
|
+
asChild: true
|
|
415
|
+
}, /* @__PURE__ */ React3.createElement(IconButton2, {
|
|
416
|
+
...density === "lg" ? lgActionButtonProps : mdActionButtonProps,
|
|
417
|
+
...composableProps(props),
|
|
418
|
+
classNames: [
|
|
419
|
+
"shrink-0 px-2 pointer-fine:px-1",
|
|
420
|
+
hoverableControlItem,
|
|
421
|
+
hoverableOpenControlItem
|
|
422
|
+
],
|
|
423
|
+
variant: "ghost",
|
|
424
|
+
icon: icon ?? fallbackIcon,
|
|
425
|
+
iconOnly: true,
|
|
426
|
+
label: toLocalizedString2(label, t),
|
|
427
|
+
"data-testid": testId,
|
|
428
|
+
ref: forwardedRef
|
|
429
|
+
})), /* @__PURE__ */ React3.createElement(Menu2.Content, {
|
|
430
|
+
group: parent,
|
|
431
|
+
items: menuActions
|
|
432
|
+
}));
|
|
433
|
+
});
|
|
434
|
+
NavTreeItemActionDropdownMenu.displayName = "NavTreeItemActionDropdownMenu";
|
|
435
|
+
var NavTreeItemMonolithicAction = (props) => {
|
|
436
|
+
const { parent, path, properties: { disabled, caller, testId, icon, variant = "ghost", iconOnly = true } = {
|
|
437
|
+
label: "never"
|
|
438
|
+
}, baseLabel } = props;
|
|
439
|
+
const density = useDensityContext();
|
|
440
|
+
const runAction = useActionRunner2();
|
|
441
|
+
return /* @__PURE__ */ React3.createElement(IconButton2, {
|
|
442
|
+
...density === "lg" ? lgActionButtonProps : mdActionButtonProps,
|
|
443
|
+
variant,
|
|
444
|
+
classNames: [
|
|
445
|
+
"shrink-0",
|
|
446
|
+
hoverableControlItem,
|
|
447
|
+
hoverableOpenControlItem,
|
|
448
|
+
iconOnly ? "px-2 pointer-fine:px-1" : "p-2 pointer-fine:p-2 me-1"
|
|
449
|
+
],
|
|
450
|
+
icon: icon ?? fallbackIcon,
|
|
451
|
+
iconOnly,
|
|
452
|
+
label: baseLabel,
|
|
453
|
+
disabled,
|
|
454
|
+
onClick: (event) => {
|
|
455
|
+
event.stopPropagation();
|
|
456
|
+
if (disabled) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
void runAction(props, caller ? {
|
|
460
|
+
parent,
|
|
461
|
+
caller,
|
|
462
|
+
path
|
|
463
|
+
} : {
|
|
464
|
+
parent,
|
|
465
|
+
path
|
|
466
|
+
});
|
|
467
|
+
},
|
|
468
|
+
"data-testid": testId
|
|
469
|
+
});
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
// src/components/NavTreeItem/NavTreeItemColumns.tsx
|
|
473
|
+
var NavTreeItemColumns = /* @__PURE__ */ memo2(({ path, item, open }) => {
|
|
474
|
+
const { t } = useTranslation3(meta3.id);
|
|
475
|
+
const { renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
|
|
476
|
+
const level = path.length - 2;
|
|
477
|
+
const flattenedActions = useActions(item);
|
|
478
|
+
const allActions = useMemo2(() => getListActions(flattenedActions), [
|
|
479
|
+
flattenedActions
|
|
480
|
+
]);
|
|
481
|
+
const ActionRoot = popoverAnchorId === `${NAV_TREE_ITEM}:${item.id}` ? Popover.Anchor : Fragment;
|
|
482
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
483
|
+
className: "contents dx-app-no-drag"
|
|
484
|
+
}, /* @__PURE__ */ React4.createElement(ActionRoot, null, allActions.length === 1 ? /* @__PURE__ */ React4.createElement(Treegrid.Cell, {
|
|
485
|
+
classNames: "contents"
|
|
486
|
+
}, /* @__PURE__ */ React4.createElement(NavTreeItemMonolithicAction, {
|
|
487
|
+
baseLabel: toLocalizedString3(allActions[0].properties?.label, t),
|
|
488
|
+
parent: item,
|
|
489
|
+
path,
|
|
490
|
+
...allActions[0]
|
|
491
|
+
})) : allActions.length > 1 ? /* @__PURE__ */ React4.createElement(Treegrid.Cell, {
|
|
492
|
+
classNames: "contents"
|
|
493
|
+
}, /* @__PURE__ */ React4.createElement(NavTreeItemActionDropdownMenu, {
|
|
494
|
+
testId: `navtree.treeItem.actionsLevel${level}`,
|
|
495
|
+
label: t("tree-item-actions.label"),
|
|
496
|
+
icon: "ph--dots-three-vertical--regular",
|
|
497
|
+
parent: item,
|
|
498
|
+
path,
|
|
499
|
+
menuActions: allActions,
|
|
500
|
+
caller: NAV_TREE_ITEM
|
|
501
|
+
})) : /* @__PURE__ */ React4.createElement(Treegrid.Cell, null)), ItemEnd && /* @__PURE__ */ React4.createElement(Treegrid.Cell, {
|
|
502
|
+
classNames: "contents"
|
|
503
|
+
}, /* @__PURE__ */ React4.createElement(ItemEnd, {
|
|
504
|
+
node: item,
|
|
505
|
+
open
|
|
506
|
+
})));
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
// src/components/Sidebar/L1Panel.tsx
|
|
510
|
+
var L1Panel$ = ({ open, path, item, isCurrent, onBack }) => {
|
|
511
|
+
const { t } = useTranslation4(meta4.id);
|
|
512
|
+
const title = toLocalizedString4(item.properties.label, t);
|
|
513
|
+
const isActivated = useIsActivatedWorkspace(item);
|
|
514
|
+
const shouldRenderContent = isCurrent || isActivated;
|
|
515
|
+
return /* @__PURE__ */ React5.createElement(Tabs2.Panel, {
|
|
516
|
+
key: item.id,
|
|
517
|
+
value: item.id,
|
|
518
|
+
classNames: [
|
|
519
|
+
"absolute inset-y-0 end-0",
|
|
520
|
+
"w-[calc(100%-var(--dx-l0-size))] lg:w-(--dx-l1-size) grid-cols-1 grid-rows-[var(--dx-rail-size)_1fr]",
|
|
521
|
+
"py-[env(safe-area-inset-top)]",
|
|
522
|
+
isCurrent && "grid"
|
|
523
|
+
],
|
|
524
|
+
tabIndex: -1,
|
|
525
|
+
"aria-label": title,
|
|
526
|
+
...isCurrent && {
|
|
527
|
+
"data-testid": "navtree.workspace.visible"
|
|
528
|
+
},
|
|
529
|
+
...!open && {
|
|
530
|
+
inert: true
|
|
531
|
+
}
|
|
532
|
+
}, shouldRenderContent && /* @__PURE__ */ React5.createElement(L1PanelContent, {
|
|
533
|
+
open,
|
|
534
|
+
path,
|
|
535
|
+
item,
|
|
536
|
+
onBack
|
|
537
|
+
}));
|
|
538
|
+
};
|
|
539
|
+
var useIsActivatedWorkspace = (item) => {
|
|
540
|
+
const { graph } = useAppGraph();
|
|
541
|
+
const edges = useEdges(graph, item.id);
|
|
542
|
+
return useMemo3(() => {
|
|
543
|
+
const childIds = edges[Graph.relationKey("child")] ?? [];
|
|
544
|
+
return childIds.some((childId) => {
|
|
545
|
+
const child = Graph.getNode(graph, childId);
|
|
546
|
+
if (Option.isNone(child)) {
|
|
547
|
+
return false;
|
|
548
|
+
}
|
|
549
|
+
return child.value.properties.disposition === void 0;
|
|
550
|
+
});
|
|
551
|
+
}, [
|
|
552
|
+
edges,
|
|
553
|
+
graph
|
|
554
|
+
]);
|
|
555
|
+
};
|
|
556
|
+
var L1PanelContent = ({ path, item, onBack }) => {
|
|
557
|
+
const navTreeContext = useNavTreeContext();
|
|
558
|
+
return /* @__PURE__ */ React5.createElement(DensityProvider, {
|
|
559
|
+
density: "md"
|
|
560
|
+
}, /* @__PURE__ */ React5.createElement(L1PanelHeader, {
|
|
561
|
+
path,
|
|
562
|
+
item,
|
|
563
|
+
onBack
|
|
564
|
+
}), /* @__PURE__ */ React5.createElement(ScrollArea2.Root, {
|
|
565
|
+
thin: true,
|
|
566
|
+
orientation: "vertical"
|
|
567
|
+
}, /* @__PURE__ */ React5.createElement(ScrollArea2.Viewport, null, /* @__PURE__ */ React5.createElement(Tree, {
|
|
568
|
+
classNames: "pt-[2px]",
|
|
569
|
+
model: navTreeContext.model,
|
|
570
|
+
id: item.id,
|
|
571
|
+
rootId: item.id,
|
|
572
|
+
path,
|
|
573
|
+
levelOffset: 5,
|
|
574
|
+
draggable: true,
|
|
575
|
+
gridTemplateColumns: "[tree-row-start] minmax(0, 1fr) min-content min-content [tree-row-end]",
|
|
576
|
+
renderColumns: NavTreeItemColumns,
|
|
577
|
+
blockInstruction: navTreeContext.blockInstruction,
|
|
578
|
+
canDrop: navTreeContext.canDrop,
|
|
579
|
+
canSelect: navTreeContext.canSelect,
|
|
580
|
+
onOpenChange: navTreeContext.onOpenChange,
|
|
581
|
+
onSelect: navTreeContext.onSelect,
|
|
582
|
+
onItemHover: navTreeContext.onItemHover
|
|
583
|
+
}))));
|
|
584
|
+
};
|
|
585
|
+
var L1PanelHeader = ({ item, path, onBack }) => {
|
|
586
|
+
const { t } = useTranslation4(meta4.id);
|
|
587
|
+
const { renderItemEnd: ItemEnd } = useNavTreeContext();
|
|
588
|
+
const title = toLocalizedString4(item.properties.label, t);
|
|
589
|
+
const backCapableWorkspace = isPinnedWorkspace(item.id);
|
|
590
|
+
const { menuActions, onAction } = useL1MenuActions({
|
|
591
|
+
item,
|
|
592
|
+
path
|
|
593
|
+
});
|
|
594
|
+
useLoadDescendents(item);
|
|
595
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
596
|
+
"data-tauri-drag-region": true,
|
|
597
|
+
className: "grid grid-cols-[28px_1fr_min-content_min-content] w-full items-center dx-app-drag dx-density-lg"
|
|
598
|
+
}, backCapableWorkspace ? /* @__PURE__ */ React5.createElement(IconButton3, {
|
|
599
|
+
classNames: [
|
|
600
|
+
hoverableControlItem2,
|
|
601
|
+
hoverableOpenControlItem2
|
|
602
|
+
],
|
|
603
|
+
variant: "ghost",
|
|
604
|
+
icon: "ph--caret-left--regular",
|
|
605
|
+
iconOnly: true,
|
|
606
|
+
size: 4,
|
|
607
|
+
label: t("button-back.button"),
|
|
608
|
+
"data-testid": "treeView.primaryTreeButton",
|
|
609
|
+
onClick: () => onBack?.()
|
|
610
|
+
}) : /* @__PURE__ */ React5.createElement("div", null), /* @__PURE__ */ React5.createElement("h2", {
|
|
611
|
+
"data-tauri-drag-region": true,
|
|
612
|
+
className: "flex-1 truncate min-w-0"
|
|
613
|
+
}, title), /* @__PURE__ */ React5.createElement("div", {
|
|
614
|
+
className: "contents dx-app-no-drag"
|
|
615
|
+
}, /* @__PURE__ */ React5.createElement(MenuActions, {
|
|
616
|
+
item,
|
|
617
|
+
menuActions,
|
|
618
|
+
onAction
|
|
619
|
+
}), ItemEnd && /* @__PURE__ */ React5.createElement(ItemEnd, {
|
|
620
|
+
node: item,
|
|
621
|
+
open: true
|
|
622
|
+
})));
|
|
623
|
+
};
|
|
624
|
+
var MenuActions = ({ item, menuActions, onAction }) => {
|
|
625
|
+
const { t } = useTranslation4(meta4.id);
|
|
626
|
+
if (menuActions.length === 0) {
|
|
627
|
+
return null;
|
|
628
|
+
}
|
|
629
|
+
if (menuActions.length === 1) {
|
|
630
|
+
return /* @__PURE__ */ React5.createElement(IconButton3, {
|
|
631
|
+
classNames: [
|
|
632
|
+
"shrink-0 px-2 pointer-fine:px-1",
|
|
633
|
+
hoverableControlItem2,
|
|
634
|
+
hoverableOpenControlItem2
|
|
635
|
+
],
|
|
636
|
+
variant: "ghost",
|
|
637
|
+
icon: menuActions[0].properties?.icon ?? "ph--circle-dashed--regular",
|
|
638
|
+
iconOnly: true,
|
|
639
|
+
size: 4,
|
|
640
|
+
label: toLocalizedString4(menuActions[0].properties?.label, t),
|
|
641
|
+
"data-testid": menuActions[0].properties?.testId,
|
|
642
|
+
onClick: () => onAction(menuActions[0])
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
return /* @__PURE__ */ React5.createElement(Menu3.Root, {
|
|
646
|
+
caller: NAV_TREE_ITEM,
|
|
647
|
+
onAction
|
|
648
|
+
}, /* @__PURE__ */ React5.createElement(Menu3.Trigger, {
|
|
649
|
+
asChild: true
|
|
650
|
+
}, /* @__PURE__ */ React5.createElement(IconButton3, {
|
|
651
|
+
classNames: [
|
|
652
|
+
"shrink-0 px-2 pointer-fine:px-1",
|
|
653
|
+
hoverableControlItem2,
|
|
654
|
+
hoverableOpenControlItem2
|
|
655
|
+
],
|
|
656
|
+
variant: "ghost",
|
|
657
|
+
icon: "ph--dots-three-vertical--regular",
|
|
658
|
+
iconOnly: true,
|
|
659
|
+
size: 4,
|
|
660
|
+
label: t("tree-item-actions.label"),
|
|
661
|
+
"data-testid": "navtree.treeItem.actionsLevel0"
|
|
662
|
+
})), /* @__PURE__ */ React5.createElement(Menu3.Content, {
|
|
663
|
+
group: item,
|
|
664
|
+
items: menuActions
|
|
665
|
+
}));
|
|
666
|
+
};
|
|
667
|
+
var useL1MenuActions = ({ item, path }) => {
|
|
668
|
+
const runAction = useActionRunner3();
|
|
669
|
+
const menuActions = getListActions2(useActions2(item));
|
|
670
|
+
const onAction = useCallback3((action, params) => {
|
|
671
|
+
void runAction(action, {
|
|
672
|
+
...params,
|
|
673
|
+
path
|
|
674
|
+
});
|
|
675
|
+
}, [
|
|
676
|
+
runAction,
|
|
677
|
+
path
|
|
678
|
+
]);
|
|
679
|
+
return {
|
|
680
|
+
menuActions,
|
|
681
|
+
onAction
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
var L1Panel = /* @__PURE__ */ memo3(L1Panel$);
|
|
685
|
+
|
|
686
|
+
// src/components/Sidebar/L1Tabs.tsx
|
|
687
|
+
import React6 from "react";
|
|
688
|
+
var L1Tabs = ({ topLevelItems, currentItemId, onBack, open, path }) => {
|
|
689
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, topLevelItems.map((item) => {
|
|
690
|
+
const type = l0ItemType(item);
|
|
691
|
+
if (type === "tab") {
|
|
692
|
+
return /* @__PURE__ */ React6.createElement(L1Panel, {
|
|
693
|
+
key: item.id,
|
|
694
|
+
item,
|
|
695
|
+
path,
|
|
696
|
+
open,
|
|
697
|
+
onBack,
|
|
698
|
+
isCurrent: item.id === currentItemId
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
return null;
|
|
702
|
+
}));
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
// src/components/NavTree/NavTree.tsx
|
|
706
|
+
var NAV_TREE_ITEM = "NavTreeItem";
|
|
707
|
+
var NavTree = /* @__PURE__ */ forwardRef2(({ id, root, tab, ...props }, forwardedRef) => {
|
|
708
|
+
const { onBack, onItemHover } = useNavTreeContext();
|
|
709
|
+
const { topLevelActions, l0Items, pinnedItems, userAccountItem, topLevelItems } = useTopLevelNavItems(root);
|
|
710
|
+
useLoadDescendents2(root);
|
|
711
|
+
const path = useMemo4(() => [
|
|
712
|
+
id
|
|
713
|
+
], [
|
|
714
|
+
id
|
|
715
|
+
]);
|
|
716
|
+
return (
|
|
717
|
+
// TODO(thure): `Tabs.Root` forces all items that should be able to receive focus to use `Tabs.Tab(Primitive)` since
|
|
718
|
+
// it uses RovingFocus and doesn't support moving focus to an item that is not a tab. Assess whether this situation
|
|
719
|
+
// should change including whether it should motivate a change in the design/taxonomy, or if this means this should
|
|
720
|
+
// not use `react-ui-tabs` at all.
|
|
721
|
+
/* @__PURE__ */ React7.createElement(Tabs3.Root, {
|
|
722
|
+
value: tab,
|
|
723
|
+
orientation: "vertical",
|
|
724
|
+
classNames: "relative",
|
|
725
|
+
ref: forwardedRef
|
|
726
|
+
}, /* @__PURE__ */ React7.createElement(L0Menu, {
|
|
727
|
+
menuActions: topLevelActions,
|
|
728
|
+
topLevelItems: l0Items,
|
|
729
|
+
pinnedItems,
|
|
730
|
+
userAccountItem,
|
|
731
|
+
path,
|
|
732
|
+
parent: root,
|
|
733
|
+
onItemHover
|
|
734
|
+
}), /* @__PURE__ */ React7.createElement(L1Tabs, {
|
|
735
|
+
topLevelItems,
|
|
736
|
+
path,
|
|
737
|
+
currentItemId: tab,
|
|
738
|
+
onBack,
|
|
739
|
+
...props
|
|
740
|
+
}))
|
|
741
|
+
);
|
|
742
|
+
});
|
|
743
|
+
var useTopLevelNavItems = (root) => {
|
|
744
|
+
const { graph } = useAppGraph2();
|
|
745
|
+
const rootId = root?.id ?? Node.RootId;
|
|
746
|
+
const rootOutboundItems = useConnections(graph, rootId, "child");
|
|
747
|
+
const rootActions = useGraphActions(graph, rootId);
|
|
748
|
+
const { topLevelActions, l0Items, pinnedItems, userAccountItem } = useMemo4(() => {
|
|
749
|
+
const topLevelWorkspaces = [];
|
|
750
|
+
const outboundPinnedItems = [];
|
|
751
|
+
let userAccountItem2;
|
|
752
|
+
for (const node of rootOutboundItems) {
|
|
753
|
+
switch (node.properties.disposition) {
|
|
754
|
+
case "workspace":
|
|
755
|
+
topLevelWorkspaces.push(node);
|
|
756
|
+
break;
|
|
757
|
+
case "pin-end":
|
|
758
|
+
outboundPinnedItems.push(node);
|
|
759
|
+
break;
|
|
760
|
+
case "user-account":
|
|
761
|
+
userAccountItem2 ??= node;
|
|
762
|
+
break;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
const topLevelActions2 = rootActions.filter((action) => action.properties.disposition === "menu").toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
766
|
+
const pinnedItems2 = [
|
|
767
|
+
...outboundPinnedItems,
|
|
768
|
+
...rootActions.filter((action) => action.properties.disposition === "pin-end")
|
|
769
|
+
].toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
770
|
+
return {
|
|
771
|
+
pinnedItems: pinnedItems2,
|
|
772
|
+
topLevelActions: topLevelActions2,
|
|
773
|
+
userAccountItem: userAccountItem2,
|
|
774
|
+
l0Items: topLevelWorkspaces
|
|
775
|
+
};
|
|
776
|
+
}, [
|
|
777
|
+
rootActions,
|
|
778
|
+
rootOutboundItems
|
|
779
|
+
]);
|
|
780
|
+
const topLevelItems = useMemo4(() => [
|
|
781
|
+
...l0Items,
|
|
782
|
+
...pinnedItems,
|
|
783
|
+
...userAccountItem ? [
|
|
784
|
+
userAccountItem
|
|
785
|
+
] : []
|
|
786
|
+
], [
|
|
787
|
+
l0Items,
|
|
788
|
+
pinnedItems,
|
|
789
|
+
userAccountItem
|
|
790
|
+
]);
|
|
791
|
+
return {
|
|
792
|
+
topLevelActions,
|
|
793
|
+
l0Items,
|
|
794
|
+
pinnedItems,
|
|
795
|
+
userAccountItem,
|
|
796
|
+
topLevelItems
|
|
797
|
+
};
|
|
798
|
+
};
|
|
799
|
+
export {
|
|
800
|
+
NAV_TREE_ITEM,
|
|
801
|
+
NavTree,
|
|
802
|
+
NavTreeContext,
|
|
803
|
+
useNavTreeContext
|
|
804
|
+
};
|
|
805
|
+
//# sourceMappingURL=index.mjs.map
|