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