@dxos/plugin-navtree 0.8.4-main.84f28bd → 0.8.4-main.a4bbb77
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/dist/lib/browser/{app-graph-builder-5J4LRWDX.mjs → app-graph-builder-BCXDEDN7.mjs} +9 -9
- package/dist/lib/browser/app-graph-builder-BCXDEDN7.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TZA65AKW.mjs → chunk-6AZKY5WZ.mjs} +279 -237
- package/dist/lib/browser/chunk-6AZKY5WZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WCARAZ7J.mjs → chunk-LPAREX6J.mjs} +4 -4
- package/dist/lib/browser/chunk-LPAREX6J.mjs.map +7 -0
- package/dist/lib/browser/chunk-ZENLR72O.mjs +14 -0
- package/dist/lib/browser/chunk-ZENLR72O.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +8 -11
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-3XYN2CBU.mjs → intent-resolver-G6COWRWW.mjs} +6 -6
- package/dist/lib/browser/{intent-resolver-3XYN2CBU.mjs.map → intent-resolver-G6COWRWW.mjs.map} +3 -3
- package/dist/lib/browser/{keyboard-QRS6WOQH.mjs → keyboard-AHSAWKXA.mjs} +4 -4
- package/dist/lib/{node-esm/keyboard-MOZWHFUM.mjs.map → browser/keyboard-AHSAWKXA.mjs.map} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-N2HPMYCU.mjs → react-surface-FOCB4Y5R.mjs} +10 -10
- package/dist/lib/browser/react-surface-FOCB4Y5R.mjs.map +7 -0
- package/dist/lib/browser/{state-54DY3DOY.mjs → state-2Q623V7U.mjs} +7 -7
- package/dist/lib/browser/state-2Q623V7U.mjs.map +7 -0
- package/dist/types/src/NavTreePlugin.d.ts +1 -1
- 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/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -6
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts +1 -1
- package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/state.d.ts +2 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts +2 -2
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +26 -3
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +32 -4
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L0Menu.d.ts +2 -0
- package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Panel.d.ts +5 -6
- package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts +12 -0
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -0
- package/dist/types/src/components/Sidebar/index.d.ts +1 -0
- package/dist/types/src/components/Sidebar/index.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +8 -5
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +2 -2
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.d.ts +4 -5
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +10 -4
- package/dist/types/src/experimental/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -49
- package/src/NavTreePlugin.tsx +75 -76
- package/src/capabilities/app-graph-builder.ts +5 -5
- package/src/capabilities/capabilities.ts +2 -2
- package/src/capabilities/intent-resolver.ts +1 -1
- package/src/capabilities/keyboard.ts +2 -2
- package/src/capabilities/react-surface.tsx +5 -5
- package/src/capabilities/state.ts +4 -3
- package/src/components/CommandsDialog/CommandsDialog.tsx +5 -5
- package/src/components/CommandsDialog/CommandsTrigger.tsx +5 -7
- package/src/components/NavTree/NavTree.stories.tsx +21 -18
- package/src/components/NavTree/NavTree.tsx +7 -3
- package/src/components/NavTreeContainer.tsx +43 -18
- package/src/components/NavTreeDocumentTitle.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +4 -6
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +9 -9
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +9 -9
- package/src/components/Sidebar/L0Menu.tsx +51 -50
- package/src/components/Sidebar/L1Panel.tsx +71 -93
- package/src/components/Sidebar/L1Tabs.tsx +58 -0
- package/src/components/Sidebar/index.ts +1 -0
- package/src/components/UserAccountAvatar/UserAccountAvatar.stories.tsx +9 -8
- package/src/components/UserAccountAvatar/UserAccountAvatar.tsx +20 -12
- package/src/components/index.ts +1 -1
- package/src/components/types.ts +3 -2
- package/src/events.ts +2 -2
- package/src/experimental/Tree.stories.tsx +37 -36
- package/src/experimental/Tree.tsx +16 -34
- package/src/meta.ts +5 -7
- package/src/testing/app-graph-builder.ts +1 -1
- package/src/translations.ts +1 -0
- package/src/util.ts +2 -20
- package/dist/lib/browser/app-graph-builder-5J4LRWDX.mjs.map +0 -7
- package/dist/lib/browser/chunk-ERDGQTH5.mjs +0 -16
- package/dist/lib/browser/chunk-ERDGQTH5.mjs.map +0 -7
- package/dist/lib/browser/chunk-TZA65AKW.mjs.map +0 -7
- package/dist/lib/browser/chunk-WCARAZ7J.mjs.map +0 -7
- package/dist/lib/browser/keyboard-QRS6WOQH.mjs.map +0 -7
- package/dist/lib/browser/react-surface-N2HPMYCU.mjs.map +0 -7
- package/dist/lib/browser/state-54DY3DOY.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-GY7GCTGU.mjs +0 -46
- package/dist/lib/node-esm/app-graph-builder-GY7GCTGU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CY7QWR4R.mjs +0 -1429
- package/dist/lib/node-esm/chunk-CY7QWR4R.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-P2JGW3WR.mjs +0 -18
- package/dist/lib/node-esm/chunk-P2JGW3WR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-V3QXFDDP.mjs +0 -16
- package/dist/lib/node-esm/chunk-V3QXFDDP.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -150
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-R7UNPSZY.mjs +0 -48
- package/dist/lib/node-esm/intent-resolver-R7UNPSZY.mjs.map +0 -7
- package/dist/lib/node-esm/keyboard-MOZWHFUM.mjs +0 -52
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-EW5FDMW4.mjs +0 -52
- package/dist/lib/node-esm/react-surface-EW5FDMW4.mjs.map +0 -7
- package/dist/lib/node-esm/state-Z3OTRC2I.mjs +0 -118
- package/dist/lib/node-esm/state-Z3OTRC2I.mjs.map +0 -7
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NavTreeCapabilities
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LPAREX6J.mjs";
|
|
4
4
|
import {
|
|
5
5
|
COMMANDS_DIALOG,
|
|
6
6
|
KEY_BINDING,
|
|
7
|
-
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
meta
|
|
8
|
+
} from "./chunk-ZENLR72O.mjs";
|
|
9
9
|
|
|
10
10
|
// src/components/CommandsDialog/CommandsDialog.tsx
|
|
11
11
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
12
12
|
import React, { useMemo, useState } from "react";
|
|
13
|
-
import {
|
|
13
|
+
import { LayoutAction, createIntent, useAppGraph, useIntentDispatcher } from "@dxos/app-framework";
|
|
14
14
|
import { isAction, isActionGroup } from "@dxos/app-graph";
|
|
15
15
|
import { Keyboard, keySymbols } from "@dxos/keyboard";
|
|
16
16
|
import { useActions } from "@dxos/plugin-graph";
|
|
17
|
-
import { Button, Dialog, Icon,
|
|
17
|
+
import { Button, Dialog, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
18
18
|
import { SearchList } from "@dxos/react-ui-searchlist";
|
|
19
19
|
import { cardDialogContent, cardDialogHeader, cardDialogPaddedOverflow, cardDialogSearchListRoot } from "@dxos/react-ui-stack";
|
|
20
20
|
import { descriptionText, mx } from "@dxos/react-ui-theme";
|
|
@@ -22,7 +22,7 @@ import { getHostPlatform } from "@dxos/util";
|
|
|
22
22
|
var CommandsDialogContent = ({ selected: initial }) => {
|
|
23
23
|
var _effect = _useSignals();
|
|
24
24
|
try {
|
|
25
|
-
const { t } = useTranslation(
|
|
25
|
+
const { t } = useTranslation(meta.id);
|
|
26
26
|
const [selected, setSelected] = useState(initial);
|
|
27
27
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
28
28
|
const { graph } = useAppGraph();
|
|
@@ -53,7 +53,7 @@ var CommandsDialogContent = ({ selected: initial }) => {
|
|
|
53
53
|
}, /* @__PURE__ */ React.createElement(Dialog.Title, {
|
|
54
54
|
classNames: cardDialogHeader
|
|
55
55
|
}, t("commands dialog title", {
|
|
56
|
-
ns:
|
|
56
|
+
ns: meta.id
|
|
57
57
|
})), /* @__PURE__ */ React.createElement(SearchList.Root, {
|
|
58
58
|
label: t("command list input placeholder"),
|
|
59
59
|
classNames: cardDialogSearchListRoot
|
|
@@ -119,16 +119,14 @@ var CommandsDialogContent = ({ selected: initial }) => {
|
|
|
119
119
|
|
|
120
120
|
// src/components/CommandsDialog/CommandsTrigger.tsx
|
|
121
121
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
122
|
-
import { MagnifyingGlass } from "@phosphor-icons/react";
|
|
123
122
|
import React2 from "react";
|
|
124
|
-
import {
|
|
125
|
-
import { Button as Button2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
126
|
-
import { getSize } from "@dxos/react-ui-theme";
|
|
123
|
+
import { LayoutAction as LayoutAction2, createIntent as createIntent2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
124
|
+
import { Button as Button2, Icon as Icon2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
127
125
|
var CommandsTrigger = () => {
|
|
128
126
|
var _effect = _useSignals2();
|
|
129
127
|
try {
|
|
130
128
|
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
131
|
-
const { t } = useTranslation2(
|
|
129
|
+
const { t } = useTranslation2(meta.id);
|
|
132
130
|
return /* @__PURE__ */ React2.createElement(Button2, {
|
|
133
131
|
classNames: "m-1 pli-1 lg:pli-2",
|
|
134
132
|
onClick: () => dispatch(createIntent2(LayoutAction2.UpdateDialog, {
|
|
@@ -140,8 +138,9 @@ var CommandsTrigger = () => {
|
|
|
140
138
|
}))
|
|
141
139
|
}, /* @__PURE__ */ React2.createElement("span", {
|
|
142
140
|
className: "text-description font-normal grow text-start"
|
|
143
|
-
}, t("command list input placeholder")), /* @__PURE__ */ React2.createElement(
|
|
144
|
-
|
|
141
|
+
}, t("command list input placeholder")), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
142
|
+
icon: "ph--magnifying-glass--regular",
|
|
143
|
+
size: 5
|
|
145
144
|
}));
|
|
146
145
|
} finally {
|
|
147
146
|
_effect.f();
|
|
@@ -149,7 +148,7 @@ var CommandsTrigger = () => {
|
|
|
149
148
|
};
|
|
150
149
|
|
|
151
150
|
// src/util.ts
|
|
152
|
-
import {
|
|
151
|
+
import { isActionLike } from "@dxos/app-graph";
|
|
153
152
|
import { isNonNullable } from "@dxos/util";
|
|
154
153
|
var getParent = (graph, node, path) => {
|
|
155
154
|
const parentId = path[path.length - 2];
|
|
@@ -199,22 +198,6 @@ var getChildren = (graph, node, path = []) => {
|
|
|
199
198
|
return nextPath.includes(n.id) ? void 0 : n;
|
|
200
199
|
}).filter(isNonNullable);
|
|
201
200
|
};
|
|
202
|
-
var getActions = (graph, node) => {
|
|
203
|
-
return graph.getActions(node.id).reduce((acc, arg) => {
|
|
204
|
-
if (arg.properties.disposition === "item") {
|
|
205
|
-
return acc;
|
|
206
|
-
}
|
|
207
|
-
acc.actions.push(arg);
|
|
208
|
-
if (!isAction2(arg)) {
|
|
209
|
-
const actionGroup = graph.getActions(arg.id);
|
|
210
|
-
acc.groupedActions[arg.id] = actionGroup;
|
|
211
|
-
}
|
|
212
|
-
return acc;
|
|
213
|
-
}, {
|
|
214
|
-
actions: [],
|
|
215
|
-
groupedActions: {}
|
|
216
|
-
});
|
|
217
|
-
};
|
|
218
201
|
var l0ItemType = (item) => {
|
|
219
202
|
if (item.properties.disposition === "collection") {
|
|
220
203
|
return "collection";
|
|
@@ -228,23 +211,31 @@ var l0ItemType = (item) => {
|
|
|
228
211
|
};
|
|
229
212
|
|
|
230
213
|
// src/components/NavTreeContainer.tsx
|
|
231
|
-
import { useSignals as
|
|
214
|
+
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
232
215
|
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
233
216
|
import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
|
|
234
217
|
import { untracked } from "@preact/signals-core";
|
|
235
|
-
import
|
|
236
|
-
import {
|
|
237
|
-
import { isAction as
|
|
218
|
+
import React10, { memo as memo2, useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo6 } from "react";
|
|
219
|
+
import { LayoutAction as LayoutAction3, Surface, createIntent as createIntent3, useAppGraph as useAppGraph2, useCapability, useIntentDispatcher as useIntentDispatcher3, useLayout } from "@dxos/app-framework";
|
|
220
|
+
import { ROOT_ID, isAction as isAction3, isActionLike as isActionLike2 } from "@dxos/app-graph";
|
|
238
221
|
import { PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
|
|
239
|
-
import { useConnections } from "@dxos/plugin-graph";
|
|
222
|
+
import { useConnections, useActions as useGraphActions } from "@dxos/plugin-graph";
|
|
240
223
|
import { useMediaQuery as useMediaQuery2, useSidebars } from "@dxos/react-ui";
|
|
241
224
|
import { isTreeData } from "@dxos/react-ui-list";
|
|
242
|
-
import { mx as
|
|
225
|
+
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
243
226
|
import { arrayMove as arrayMove2, byPosition } from "@dxos/util";
|
|
244
227
|
|
|
228
|
+
// src/capabilities/index.ts
|
|
229
|
+
import { lazy } from "@dxos/app-framework";
|
|
230
|
+
var AppGraphBuilder = lazy(() => import("./app-graph-builder-BCXDEDN7.mjs"));
|
|
231
|
+
var IntentResolver = lazy(() => import("./intent-resolver-G6COWRWW.mjs"));
|
|
232
|
+
var Keyboard2 = lazy(() => import("./keyboard-AHSAWKXA.mjs"));
|
|
233
|
+
var ReactSurface = lazy(() => import("./react-surface-FOCB4Y5R.mjs"));
|
|
234
|
+
var State = lazy(() => import("./state-2Q623V7U.mjs"));
|
|
235
|
+
|
|
245
236
|
// src/components/NavTree/NavTree.tsx
|
|
246
|
-
import { useSignals as
|
|
247
|
-
import
|
|
237
|
+
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
238
|
+
import React9, { useMemo as useMemo5 } from "react";
|
|
248
239
|
import { Tabs as Tabs3 } from "@dxos/react-ui-tabs";
|
|
249
240
|
|
|
250
241
|
// src/hooks.ts
|
|
@@ -260,7 +251,7 @@ var useNavTreeContext = () => useContext(NavTreeContext) ?? raise(new Error("Mis
|
|
|
260
251
|
import { useEffect } from "react";
|
|
261
252
|
import { toLocalizedString as toLocalizedString2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
262
253
|
var NavTreeDocumentTitle = ({ node }) => {
|
|
263
|
-
const { t } = useTranslation3(
|
|
254
|
+
const { t } = useTranslation3(meta.id);
|
|
264
255
|
useEffect(() => {
|
|
265
256
|
document.title = node ? toLocalizedString2(node.properties.label, t) : t("current app name", {
|
|
266
257
|
ns: "appkit"
|
|
@@ -295,11 +286,12 @@ import { scrollJustEnoughIntoView } from "@atlaskit/pragmatic-drag-and-drop/elem
|
|
|
295
286
|
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
296
287
|
import React4, { forwardRef, useCallback, useLayoutEffect, useMemo as useMemo2, useRef, useState as useState2 } from "react";
|
|
297
288
|
import { invariant } from "@dxos/invariant";
|
|
298
|
-
import {
|
|
299
|
-
import {
|
|
289
|
+
import { DxAvatar } from "@dxos/lit-ui/react";
|
|
290
|
+
import { Icon as Icon3, ListItem, ScrollArea, Tooltip, toLocalizedString as toLocalizedString3, useMediaQuery, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
291
|
+
import { DropdownMenu, MenuProvider } from "@dxos/react-ui-menu";
|
|
300
292
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
301
293
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
302
|
-
import { arrayMove
|
|
294
|
+
import { arrayMove } from "@dxos/util";
|
|
303
295
|
|
|
304
296
|
// src/components/UserAccountAvatar/UserAccountAvatar.tsx
|
|
305
297
|
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
@@ -310,8 +302,10 @@ var UserAccountAvatar = ({ size, userId, hue, emoji, status }) => {
|
|
|
310
302
|
var _effect = _useSignals3();
|
|
311
303
|
try {
|
|
312
304
|
const fallbackValue = hexToFallback(userId ?? "0");
|
|
313
|
-
return /* @__PURE__ */ React3.createElement(
|
|
314
|
-
|
|
305
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(L0ItemActiveTabIndicator, {
|
|
306
|
+
classNames: "inset-block-6"
|
|
307
|
+
}), /* @__PURE__ */ React3.createElement("div", {
|
|
308
|
+
className: "grid place-items-center dx-focus-ring-group-indicator rounded-full",
|
|
315
309
|
"data-joyride": "welcome/account"
|
|
316
310
|
}, /* @__PURE__ */ React3.createElement(Avatar.Root, null, /* @__PURE__ */ React3.createElement(Avatar.Content, {
|
|
317
311
|
variant: "circle",
|
|
@@ -320,7 +314,7 @@ var UserAccountAvatar = ({ size, userId, hue, emoji, status }) => {
|
|
|
320
314
|
hue: hue || fallbackValue.hue,
|
|
321
315
|
fallback: emoji || fallbackValue.emoji,
|
|
322
316
|
"data-testid": "treeView.userAccount"
|
|
323
|
-
})));
|
|
317
|
+
}))));
|
|
324
318
|
} finally {
|
|
325
319
|
_effect.f();
|
|
326
320
|
}
|
|
@@ -383,7 +377,7 @@ var L0ItemRoot = /* @__PURE__ */ forwardRef(({ item, parent, path, children }, f
|
|
|
383
377
|
item.id,
|
|
384
378
|
path
|
|
385
379
|
]);
|
|
386
|
-
const { t } = useTranslation4(
|
|
380
|
+
const { t } = useTranslation4(meta.id);
|
|
387
381
|
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
388
382
|
const handleClick = useL0ItemClick({
|
|
389
383
|
item,
|
|
@@ -401,15 +395,15 @@ var L0ItemRoot = /* @__PURE__ */ forwardRef(({ item, parent, path, children }, f
|
|
|
401
395
|
"data-testid": testId,
|
|
402
396
|
"data-itemid": id
|
|
403
397
|
} : {
|
|
404
|
-
onClick: handleClick
|
|
398
|
+
onClick: handleClick,
|
|
399
|
+
role: "button"
|
|
405
400
|
};
|
|
406
|
-
const Root = type === "collection" ? "h2" : type === "tab" ? Tabs.TabPrimitive : "button";
|
|
407
401
|
return /* @__PURE__ */ React4.createElement(Tooltip.Trigger, {
|
|
408
402
|
asChild: true,
|
|
409
403
|
delayDuration: 0,
|
|
410
404
|
side: "right",
|
|
411
405
|
content: localizedString
|
|
412
|
-
}, /* @__PURE__ */ React4.createElement(
|
|
406
|
+
}, /* @__PURE__ */ React4.createElement(Tabs.TabPrimitive, {
|
|
413
407
|
...rootProps,
|
|
414
408
|
"data-type": type,
|
|
415
409
|
className: mx2(l0ItemRoot, l0Breakpoints[item.properties.l0Breakpoint]),
|
|
@@ -419,28 +413,13 @@ var L0ItemRoot = /* @__PURE__ */ forwardRef(({ item, parent, path, children }, f
|
|
|
419
413
|
_effect.f();
|
|
420
414
|
}
|
|
421
415
|
});
|
|
422
|
-
var
|
|
416
|
+
var L0ItemActiveTabIndicator = ({ classNames }) => {
|
|
423
417
|
var _effect = _useSignals4();
|
|
424
418
|
try {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
style: {
|
|
430
|
-
color: `var(--dx-${hue}SurfaceText)`
|
|
431
|
-
}
|
|
432
|
-
};
|
|
433
|
-
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
434
|
-
const avatarValue = useMemo2(() => type === "tab" ? getFirstTwoRenderableChars(localizedString).join("").toUpperCase() : [], [
|
|
435
|
-
type,
|
|
436
|
-
item.properties.label,
|
|
437
|
-
t
|
|
438
|
-
]);
|
|
439
|
-
return /* @__PURE__ */ React4.createElement("span", {
|
|
440
|
-
role: "img",
|
|
441
|
-
className: "place-self-center text-xl font-light",
|
|
442
|
-
...hueFgStyle
|
|
443
|
-
}, avatarValue);
|
|
419
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
420
|
+
role: "none",
|
|
421
|
+
className: mx2("hidden group-aria-selected/l0item:block absolute inline-start-0 inset-block-2 is-1 bg-accentSurface rounded-ie", classNames)
|
|
422
|
+
});
|
|
444
423
|
} finally {
|
|
445
424
|
_effect.f();
|
|
446
425
|
}
|
|
@@ -448,7 +427,7 @@ var L0Avatar = ({ item }) => {
|
|
|
448
427
|
var L0Item = ({ item, parent, path, pinned, onRearrange }) => {
|
|
449
428
|
var _effect = _useSignals4();
|
|
450
429
|
try {
|
|
451
|
-
const { t } = useTranslation4(
|
|
430
|
+
const { t } = useTranslation4(meta.id);
|
|
452
431
|
const itemElement = useRef(null);
|
|
453
432
|
const [closestEdge, setEdge] = useState2(null);
|
|
454
433
|
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
@@ -537,10 +516,7 @@ var L0Item = ({ item, parent, path, pinned, onRearrange }) => {
|
|
|
537
516
|
className: mx2(l0ItemContent, pinned ? "p-2 group-hover/l0item:bg-activeSurface" : "is-[--l0-avatar-size] bs-[--l0-avatar-size] bg-activeSurface")
|
|
538
517
|
}, /* @__PURE__ */ React4.createElement(ItemAvatar, {
|
|
539
518
|
item
|
|
540
|
-
})), /* @__PURE__ */ React4.createElement("
|
|
541
|
-
role: "none",
|
|
542
|
-
className: "hidden group-aria-selected/l0item:block absolute inline-start-0 inset-block-2 is-1 bg-accentSurface rounded-ie"
|
|
543
|
-
}), /* @__PURE__ */ React4.createElement("span", {
|
|
519
|
+
})), /* @__PURE__ */ React4.createElement(L0ItemActiveTabIndicator, null), /* @__PURE__ */ React4.createElement("span", {
|
|
544
520
|
id: `${item.id}__label`,
|
|
545
521
|
className: "sr-only"
|
|
546
522
|
}, localizedString), closestEdge && /* @__PURE__ */ React4.createElement(ListItem.DropIndicator, {
|
|
@@ -553,6 +529,7 @@ var L0Item = ({ item, parent, path, pinned, onRearrange }) => {
|
|
|
553
529
|
var ItemAvatar = ({ item }) => {
|
|
554
530
|
var _effect = _useSignals4();
|
|
555
531
|
try {
|
|
532
|
+
const { t } = useTranslation4(meta.id);
|
|
556
533
|
const type = l0ItemType(item);
|
|
557
534
|
if (item.properties.icon) {
|
|
558
535
|
const hue = item.properties.hue ?? null;
|
|
@@ -561,15 +538,21 @@ var ItemAvatar = ({ item }) => {
|
|
|
561
538
|
color: `var(--dx-${hue}SurfaceText)`
|
|
562
539
|
}
|
|
563
540
|
};
|
|
564
|
-
return /* @__PURE__ */ React4.createElement(
|
|
541
|
+
return /* @__PURE__ */ React4.createElement(Icon3, {
|
|
565
542
|
icon: item.properties.icon,
|
|
566
|
-
size:
|
|
543
|
+
size: 6,
|
|
567
544
|
...hueFgStyle
|
|
568
545
|
});
|
|
569
546
|
}
|
|
570
547
|
if (type === "tab" && item.properties.disposition !== "pin-end") {
|
|
571
|
-
|
|
572
|
-
|
|
548
|
+
const hue = item.properties.hue ?? null;
|
|
549
|
+
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
550
|
+
return /* @__PURE__ */ React4.createElement(DxAvatar, {
|
|
551
|
+
hue,
|
|
552
|
+
hueVariant: "surface",
|
|
553
|
+
variant: "square",
|
|
554
|
+
size: 12,
|
|
555
|
+
fallback: localizedString
|
|
573
556
|
});
|
|
574
557
|
}
|
|
575
558
|
return null;
|
|
@@ -634,7 +617,7 @@ var L0Collection = ({ item, path }) => {
|
|
|
634
617
|
var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent, path }) => {
|
|
635
618
|
var _effect = _useSignals4();
|
|
636
619
|
try {
|
|
637
|
-
const { t } = useTranslation4(
|
|
620
|
+
const { t } = useTranslation4(meta.id);
|
|
638
621
|
return /* @__PURE__ */ React4.createElement(Tabs.Tablist, {
|
|
639
622
|
classNames: [
|
|
640
623
|
"group/l0 absolute z-[1] inset-block-0 inline-start-0 rounded-is",
|
|
@@ -648,16 +631,20 @@ var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent
|
|
|
648
631
|
content: t("app menu label"),
|
|
649
632
|
side: "right",
|
|
650
633
|
asChild: true
|
|
634
|
+
}, /* @__PURE__ */ React4.createElement(Tabs.TabPrimitive, {
|
|
635
|
+
value: "options",
|
|
636
|
+
asChild: true,
|
|
637
|
+
role: "button"
|
|
651
638
|
}, /* @__PURE__ */ React4.createElement(DropdownMenu.Trigger, {
|
|
652
639
|
"data-testid": "spacePlugin.addSpace",
|
|
653
|
-
className: mx2(l0ItemRoot, "grid place-items-center")
|
|
640
|
+
className: mx2(l0ItemRoot, "grid place-items-center dx-focus-ring-group")
|
|
654
641
|
}, /* @__PURE__ */ React4.createElement("div", {
|
|
655
642
|
role: "none",
|
|
656
643
|
className: mx2(l0ItemContent, "is-[--rail-action] bs-[--rail-action] group-hover/l0item:bg-hoverSurface")
|
|
657
|
-
}, /* @__PURE__ */ React4.createElement(
|
|
644
|
+
}, /* @__PURE__ */ React4.createElement(Icon3, {
|
|
658
645
|
icon: "ph--list--regular",
|
|
659
646
|
size: 5
|
|
660
|
-
})))))), /* @__PURE__ */ React4.createElement(ScrollArea.Root, null, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React4.createElement("div", {
|
|
647
|
+
}))))))), /* @__PURE__ */ React4.createElement(ScrollArea.Root, null, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React4.createElement("div", {
|
|
661
648
|
role: "none",
|
|
662
649
|
className: mx2([
|
|
663
650
|
"flex flex-col gap-1 pbs-1",
|
|
@@ -720,17 +707,17 @@ var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent
|
|
|
720
707
|
// src/components/Sidebar/L1Panel.tsx
|
|
721
708
|
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
722
709
|
import React7, { useCallback as useCallback2, useMemo as useMemo3 } from "react";
|
|
723
|
-
import {
|
|
710
|
+
import { IconButton as IconButton2, toLocalizedString as toLocalizedString6, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
724
711
|
import { Tree } from "@dxos/react-ui-list";
|
|
725
712
|
import { Tabs as Tabs2 } from "@dxos/react-ui-tabs";
|
|
726
|
-
import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem as hoverableOpenControlItem2
|
|
713
|
+
import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem as hoverableOpenControlItem2 } from "@dxos/react-ui-theme";
|
|
727
714
|
|
|
728
715
|
// src/components/NavTreeItem/NavTreeItemAction.tsx
|
|
729
716
|
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
730
717
|
import React5 from "react";
|
|
731
|
-
import {
|
|
718
|
+
import { IconButton, toLocalizedString as toLocalizedString4, useDensityContext, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
732
719
|
import { DropdownMenu as DropdownMenu2, MenuProvider as MenuProvider2 } from "@dxos/react-ui-menu";
|
|
733
|
-
import { hoverableControlItem, hoverableOpenControlItem
|
|
720
|
+
import { hoverableControlItem, hoverableOpenControlItem } from "@dxos/react-ui-theme";
|
|
734
721
|
var fallbackIcon = "ph--placeholder--regular";
|
|
735
722
|
var fineActionButtonProps = {
|
|
736
723
|
size: 4,
|
|
@@ -743,7 +730,7 @@ var coarseActionButtonProps = {
|
|
|
743
730
|
var NavTreeItemActionDropdownMenu = ({ parent, label, icon, testId, menuActions, caller }) => {
|
|
744
731
|
var _effect = _useSignals5();
|
|
745
732
|
try {
|
|
746
|
-
const { t } = useTranslation5(
|
|
733
|
+
const { t } = useTranslation5(meta.id);
|
|
747
734
|
const density = useDensityContext();
|
|
748
735
|
return /* @__PURE__ */ React5.createElement(MenuProvider2, null, /* @__PURE__ */ React5.createElement(DropdownMenu2.Root, {
|
|
749
736
|
group: parent,
|
|
@@ -753,7 +740,11 @@ var NavTreeItemActionDropdownMenu = ({ parent, label, icon, testId, menuActions,
|
|
|
753
740
|
asChild: true
|
|
754
741
|
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
755
742
|
...density === "coarse" ? coarseActionButtonProps : fineActionButtonProps,
|
|
756
|
-
classNames:
|
|
743
|
+
classNames: [
|
|
744
|
+
"shrink-0 pli-2 pointer-fine:pli-1",
|
|
745
|
+
hoverableControlItem,
|
|
746
|
+
hoverableOpenControlItem
|
|
747
|
+
],
|
|
757
748
|
variant: "ghost",
|
|
758
749
|
icon: icon ?? fallbackIcon,
|
|
759
750
|
iconOnly: true,
|
|
@@ -773,7 +764,12 @@ var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, tes
|
|
|
773
764
|
return /* @__PURE__ */ React5.createElement(IconButton, {
|
|
774
765
|
...density === "coarse" ? coarseActionButtonProps : fineActionButtonProps,
|
|
775
766
|
variant,
|
|
776
|
-
classNames:
|
|
767
|
+
classNames: [
|
|
768
|
+
"shrink-0",
|
|
769
|
+
hoverableControlItem,
|
|
770
|
+
hoverableOpenControlItem,
|
|
771
|
+
iconOnly ? "pli-2 pointer-fine:pli-1" : "p-2 pointer-fine:p-2 mie-1"
|
|
772
|
+
],
|
|
777
773
|
icon: icon ?? fallbackIcon,
|
|
778
774
|
iconOnly,
|
|
779
775
|
label: baseLabel,
|
|
@@ -799,7 +795,7 @@ var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, tes
|
|
|
799
795
|
var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) => {
|
|
800
796
|
var _effect = _useSignals5();
|
|
801
797
|
try {
|
|
802
|
-
const { t } = useTranslation5(
|
|
798
|
+
const { t } = useTranslation5(meta.id);
|
|
803
799
|
const monolithicAction = menuActions?.length === 1 && menuActions[0];
|
|
804
800
|
const baseLabel = toLocalizedString4(monolithicAction ? monolithicAction.properties.label : props.label, t);
|
|
805
801
|
return monolithic && menuActions?.length === 1 ? /* @__PURE__ */ React5.createElement(NavTreeItemMonolithicAction, {
|
|
@@ -820,17 +816,17 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
|
|
|
820
816
|
// src/components/NavTreeItem/NavTreeItemColumns.tsx
|
|
821
817
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
822
818
|
import React6, { Fragment, memo } from "react";
|
|
823
|
-
import { isAction as
|
|
824
|
-
import { DensityProvider, Popover, toLocalizedString as toLocalizedString5,
|
|
819
|
+
import { isAction as isAction2 } from "@dxos/app-graph";
|
|
820
|
+
import { DensityProvider, Popover, Treegrid, toLocalizedString as toLocalizedString5, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
825
821
|
var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fine" }) => {
|
|
826
822
|
var _effect = _useSignals6();
|
|
827
823
|
try {
|
|
828
|
-
const { t } = useTranslation6(
|
|
829
|
-
const {
|
|
824
|
+
const { t } = useTranslation6(meta.id);
|
|
825
|
+
const { useActions: useActions3, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
|
|
830
826
|
const level = path.length - 2;
|
|
831
|
-
const { actions: _actions, groupedActions } =
|
|
832
|
-
const [primaryAction, ...secondaryActions] = _actions.toSorted((a,
|
|
833
|
-
const actions = (primaryAction?.properties?.disposition === "list-item-primary" ? secondaryActions : _actions).flatMap((action) =>
|
|
827
|
+
const { actions: _actions, groupedActions } = useActions3(item);
|
|
828
|
+
const [primaryAction, ...secondaryActions] = _actions.toSorted((a, _b) => a.properties?.disposition === "list-item-primary" ? -1 : 1);
|
|
829
|
+
const actions = (primaryAction?.properties?.disposition === "list-item-primary" ? secondaryActions : _actions).flatMap((action) => isAction2(action) ? [
|
|
834
830
|
action
|
|
835
831
|
] : []).filter((a) => [
|
|
836
832
|
"list-item",
|
|
@@ -838,7 +834,7 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fi
|
|
|
838
834
|
].includes(a.properties?.disposition));
|
|
839
835
|
const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
|
|
840
836
|
useLoadDescendents(item);
|
|
841
|
-
useLoadDescendents(primaryAction && !
|
|
837
|
+
useLoadDescendents(primaryAction && !isAction2(primaryAction) ? primaryAction : void 0);
|
|
842
838
|
return /* @__PURE__ */ React6.createElement(DensityProvider, {
|
|
843
839
|
density
|
|
844
840
|
}, /* @__PURE__ */ React6.createElement("div", {
|
|
@@ -849,8 +845,8 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fi
|
|
|
849
845
|
label: toLocalizedString5(primaryAction.properties?.label, t),
|
|
850
846
|
icon: primaryAction.properties?.icon ?? "ph--placeholder--regular",
|
|
851
847
|
parent: item,
|
|
852
|
-
monolithic:
|
|
853
|
-
menuActions:
|
|
848
|
+
monolithic: isAction2(primaryAction),
|
|
849
|
+
menuActions: isAction2(primaryAction) ? [
|
|
854
850
|
primaryAction
|
|
855
851
|
] : groupedActions[primaryAction.id],
|
|
856
852
|
menuType: primaryAction.properties?.menuType,
|
|
@@ -873,30 +869,14 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fi
|
|
|
873
869
|
});
|
|
874
870
|
|
|
875
871
|
// src/components/Sidebar/L1Panel.tsx
|
|
876
|
-
var
|
|
877
|
-
var TitleButton = ({ title, onClick }) => {
|
|
878
|
-
var _effect = _useSignals7();
|
|
879
|
-
try {
|
|
880
|
-
return /* @__PURE__ */ React7.createElement(Button3, {
|
|
881
|
-
variant: "ghost",
|
|
882
|
-
classNames: "pli-1 flex-1 group text-start justify-start bs-[--rail-action] font-normal",
|
|
883
|
-
onClick
|
|
884
|
-
}, /* @__PURE__ */ React7.createElement(Icon3, {
|
|
885
|
-
icon: "ph--caret-left--bold",
|
|
886
|
-
size: 3
|
|
887
|
-
}), /* @__PURE__ */ React7.createElement("span", {
|
|
888
|
-
className: mx4(headingBackButtonLabel)
|
|
889
|
-
}, title));
|
|
890
|
-
} finally {
|
|
891
|
-
_effect.f();
|
|
892
|
-
}
|
|
893
|
-
};
|
|
894
|
-
var L1Panel = ({ open, item, path, currentItemId, onBack }) => {
|
|
872
|
+
var L1Panel = ({ open, path, item, currentItemId, onBack }) => {
|
|
895
873
|
var _effect = _useSignals7();
|
|
896
874
|
try {
|
|
897
|
-
const {
|
|
898
|
-
const {
|
|
899
|
-
const
|
|
875
|
+
const { t } = useTranslation7(meta.id);
|
|
876
|
+
const { isAlternateTree, ...navTreeContext } = useNavTreeContext();
|
|
877
|
+
const { useItems: useItems2 } = navTreeContext;
|
|
878
|
+
const title = toLocalizedString6(item.properties.label, t);
|
|
879
|
+
const alternateTree = useItems2(item, {
|
|
900
880
|
disposition: "alternate-tree"
|
|
901
881
|
})[0];
|
|
902
882
|
const alternatePath = useMemo3(() => [
|
|
@@ -906,34 +886,16 @@ var L1Panel = ({ open, item, path, currentItemId, onBack }) => {
|
|
|
906
886
|
item.id,
|
|
907
887
|
path
|
|
908
888
|
]);
|
|
909
|
-
const handleOpen = useCallback2(() => setAlternateTree?.(alternatePath, true), [
|
|
910
|
-
alternatePath,
|
|
911
|
-
setAlternateTree
|
|
912
|
-
]);
|
|
913
889
|
const isAlternate = isAlternateTree?.(alternatePath, item) ?? false;
|
|
914
890
|
const useAlternateItems = useCallback2((node, { disposition } = {}) => {
|
|
915
|
-
return
|
|
891
|
+
return useItems2(node, {
|
|
916
892
|
disposition,
|
|
917
893
|
sort: node?.id === alternateTree.id
|
|
918
894
|
});
|
|
919
895
|
}, [
|
|
920
|
-
|
|
921
|
-
|
|
896
|
+
alternateTree,
|
|
897
|
+
useItems2
|
|
922
898
|
]);
|
|
923
|
-
const handleBack = useCallback2(() => {
|
|
924
|
-
if (isAlternate) {
|
|
925
|
-
setAlternateTree?.(alternatePath, false);
|
|
926
|
-
} else {
|
|
927
|
-
onBack?.();
|
|
928
|
-
}
|
|
929
|
-
}, [
|
|
930
|
-
isAlternate,
|
|
931
|
-
onBack,
|
|
932
|
-
alternatePath,
|
|
933
|
-
setAlternateTree
|
|
934
|
-
]);
|
|
935
|
-
const title = toLocalizedString6(item.properties.label, t);
|
|
936
|
-
const backCapable = item.id.startsWith("!") || isAlternate;
|
|
937
899
|
return /* @__PURE__ */ React7.createElement(Tabs2.Tabpanel, {
|
|
938
900
|
key: item.id,
|
|
939
901
|
value: item.id,
|
|
@@ -946,30 +908,14 @@ var L1Panel = ({ open, item, path, currentItemId, onBack }) => {
|
|
|
946
908
|
tabIndex: -1,
|
|
947
909
|
"aria-label": title,
|
|
948
910
|
...!open && {
|
|
949
|
-
inert:
|
|
911
|
+
inert: true
|
|
950
912
|
}
|
|
951
|
-
}, item.id === currentItemId && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(
|
|
952
|
-
className: "flex items-center border-be border-subduedSeparator app-drag pli-1 density-coarse"
|
|
953
|
-
}, backCapable ? /* @__PURE__ */ React7.createElement(TitleButton, {
|
|
954
|
-
title,
|
|
955
|
-
onClick: handleBack
|
|
956
|
-
}) : /* @__PURE__ */ React7.createElement("span", {
|
|
957
|
-
className: "flex-1 truncate min-is-0 pis-6"
|
|
958
|
-
}, title), alternateTree && !isAlternate && /* @__PURE__ */ React7.createElement(IconButton2, {
|
|
959
|
-
variant: "ghost",
|
|
960
|
-
classNames: mx4("shrink-0", hoverableControlItem2, hoverableOpenControlItem2, "pli-2 pointer-fine:pli-1"),
|
|
961
|
-
iconOnly: true,
|
|
962
|
-
size: 5,
|
|
963
|
-
icon: alternateTree.properties.icon ?? "ph--placeholder--regular",
|
|
964
|
-
label: toLocalizedString6(alternateTree.properties.label ?? alternateTree.id, t),
|
|
965
|
-
"data-testid": "treeView.alternateTreeButton",
|
|
966
|
-
onClick: handleOpen
|
|
967
|
-
}), /* @__PURE__ */ React7.createElement(NavTreeItemColumns, {
|
|
913
|
+
}, item.id === currentItemId && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(L1PanelHeader, {
|
|
968
914
|
path,
|
|
969
915
|
item,
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
})
|
|
916
|
+
currentItemId,
|
|
917
|
+
onBack
|
|
918
|
+
}), /* @__PURE__ */ React7.createElement("div", {
|
|
973
919
|
role: "none",
|
|
974
920
|
className: "overflow-y-auto"
|
|
975
921
|
}, isAlternate ? /* @__PURE__ */ React7.createElement(Tree, {
|
|
@@ -995,48 +941,106 @@ var L1Panel = ({ open, item, path, currentItemId, onBack }) => {
|
|
|
995
941
|
_effect.f();
|
|
996
942
|
}
|
|
997
943
|
};
|
|
998
|
-
var
|
|
944
|
+
var L1PanelHeader = ({ item, path, onBack }) => {
|
|
999
945
|
var _effect = _useSignals7();
|
|
1000
946
|
try {
|
|
1001
|
-
const {
|
|
1002
|
-
|
|
1003
|
-
const
|
|
1004
|
-
const
|
|
947
|
+
const { t } = useTranslation7(meta.id);
|
|
948
|
+
const { isAlternateTree, setAlternateTree, ...navTreeContext } = useNavTreeContext();
|
|
949
|
+
const title = toLocalizedString6(item.properties.label, t);
|
|
950
|
+
const alternateTree = navTreeContext.useItems(item, {
|
|
951
|
+
disposition: "alternate-tree"
|
|
952
|
+
})[0];
|
|
953
|
+
const alternatePath = useMemo3(() => [
|
|
1005
954
|
...path,
|
|
1006
955
|
item.id
|
|
1007
956
|
], [
|
|
1008
957
|
item.id,
|
|
1009
958
|
path
|
|
1010
959
|
]);
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
960
|
+
const isAlternate = isAlternateTree?.(alternatePath, item) ?? false;
|
|
961
|
+
const backCapable = item.id.startsWith("!") || isAlternate;
|
|
962
|
+
const handleOpen = useCallback2(() => {
|
|
963
|
+
setAlternateTree?.(alternatePath, true);
|
|
964
|
+
}, [
|
|
965
|
+
alternatePath,
|
|
966
|
+
setAlternateTree
|
|
967
|
+
]);
|
|
968
|
+
const handleBack = useCallback2(() => {
|
|
969
|
+
if (isAlternate) {
|
|
970
|
+
setAlternateTree?.(alternatePath, false);
|
|
971
|
+
} else {
|
|
972
|
+
onBack?.();
|
|
973
|
+
}
|
|
974
|
+
}, [
|
|
975
|
+
isAlternate,
|
|
976
|
+
alternatePath,
|
|
977
|
+
setAlternateTree,
|
|
978
|
+
onBack
|
|
979
|
+
]);
|
|
980
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
981
|
+
className: "flex is-full items-center border-be border-subduedSeparator app-drag density-coarse"
|
|
982
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
983
|
+
className: "is-6"
|
|
984
|
+
}), /* @__PURE__ */ React7.createElement("h2", {
|
|
985
|
+
className: "flex-1 truncate min-is-0"
|
|
986
|
+
}, title), backCapable && /* @__PURE__ */ React7.createElement(IconButton2, {
|
|
987
|
+
variant: "ghost",
|
|
988
|
+
icon: "ph--arrow-u-down-left--regular",
|
|
989
|
+
iconOnly: true,
|
|
990
|
+
size: 5,
|
|
991
|
+
label: t("button back"),
|
|
992
|
+
classNames: [
|
|
993
|
+
hoverableControlItem2,
|
|
994
|
+
hoverableOpenControlItem2,
|
|
995
|
+
"pointer-fine:pli-1"
|
|
996
|
+
],
|
|
997
|
+
onClick: handleBack
|
|
998
|
+
}) || alternateTree && !isAlternate && /* @__PURE__ */ React7.createElement(IconButton2, {
|
|
999
|
+
"data-testid": "treeView.alternateTreeButton",
|
|
1000
|
+
variant: "ghost",
|
|
1001
|
+
icon: alternateTree.properties.icon ?? "ph--placeholder--regular",
|
|
1002
|
+
iconOnly: true,
|
|
1003
|
+
size: 5,
|
|
1004
|
+
label: toLocalizedString6(alternateTree.properties.label ?? alternateTree.id, t),
|
|
1005
|
+
classNames: [
|
|
1006
|
+
hoverableControlItem2,
|
|
1007
|
+
hoverableOpenControlItem2,
|
|
1008
|
+
"pointer-fine:pli-1"
|
|
1009
|
+
],
|
|
1010
|
+
onClick: handleOpen
|
|
1011
|
+
}), /* @__PURE__ */ React7.createElement(NavTreeItemColumns, {
|
|
1012
|
+
open: true,
|
|
1013
|
+
path,
|
|
1014
|
+
item,
|
|
1015
|
+
density: "coarse"
|
|
1016
|
+
}));
|
|
1017
1017
|
} finally {
|
|
1018
1018
|
_effect.f();
|
|
1019
1019
|
}
|
|
1020
1020
|
};
|
|
1021
|
-
|
|
1022
|
-
|
|
1021
|
+
|
|
1022
|
+
// src/components/Sidebar/L1Tabs.tsx
|
|
1023
|
+
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
1024
|
+
import React8, { useMemo as useMemo4 } from "react";
|
|
1025
|
+
var L1Tabs = ({ topLevelItems, onBack, ...props }) => {
|
|
1026
|
+
var _effect = _useSignals8();
|
|
1023
1027
|
try {
|
|
1024
|
-
return /* @__PURE__ */
|
|
1028
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, topLevelItems.map((item) => {
|
|
1025
1029
|
const type = l0ItemType(item);
|
|
1026
1030
|
switch (type) {
|
|
1027
|
-
case "collection":
|
|
1028
|
-
return /* @__PURE__ */ React7.createElement(L1PanelCollection, {
|
|
1029
|
-
key: item.id,
|
|
1030
|
-
item,
|
|
1031
|
-
...props
|
|
1032
|
-
});
|
|
1033
1031
|
case "tab":
|
|
1034
|
-
return /* @__PURE__ */
|
|
1032
|
+
return /* @__PURE__ */ React8.createElement(L1Panel, {
|
|
1035
1033
|
key: item.id,
|
|
1036
1034
|
item,
|
|
1037
1035
|
...props,
|
|
1038
1036
|
onBack
|
|
1039
1037
|
});
|
|
1038
|
+
case "collection":
|
|
1039
|
+
return /* @__PURE__ */ React8.createElement(L1PanelCollection, {
|
|
1040
|
+
key: item.id,
|
|
1041
|
+
item,
|
|
1042
|
+
...props
|
|
1043
|
+
});
|
|
1040
1044
|
default:
|
|
1041
1045
|
return null;
|
|
1042
1046
|
}
|
|
@@ -1045,11 +1049,34 @@ var L1Panels = ({ topLevelItems, onBack, ...props }) => {
|
|
|
1045
1049
|
_effect.f();
|
|
1046
1050
|
}
|
|
1047
1051
|
};
|
|
1052
|
+
var L1PanelCollection = ({ item, path, ...props }) => {
|
|
1053
|
+
var _effect = _useSignals8();
|
|
1054
|
+
try {
|
|
1055
|
+
const { useItems: useItems2 } = useNavTreeContext();
|
|
1056
|
+
useLoadDescendents(item);
|
|
1057
|
+
const collectionItems = useItems2(item);
|
|
1058
|
+
const groupPath = useMemo4(() => [
|
|
1059
|
+
...path,
|
|
1060
|
+
item.id
|
|
1061
|
+
], [
|
|
1062
|
+
item.id,
|
|
1063
|
+
path
|
|
1064
|
+
]);
|
|
1065
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, collectionItems.filter((item2) => l0ItemType(item2) === "tab").map((item2) => /* @__PURE__ */ React8.createElement(L1Panel, {
|
|
1066
|
+
key: item2.id,
|
|
1067
|
+
item: item2,
|
|
1068
|
+
path: groupPath,
|
|
1069
|
+
...props
|
|
1070
|
+
})));
|
|
1071
|
+
} finally {
|
|
1072
|
+
_effect.f();
|
|
1073
|
+
}
|
|
1074
|
+
};
|
|
1048
1075
|
|
|
1049
1076
|
// src/components/NavTree/NavTree.tsx
|
|
1050
1077
|
var NAV_TREE_ITEM = "NavTreeItem";
|
|
1051
1078
|
var NavTree = ({ id, root, ...props }) => {
|
|
1052
|
-
var _effect =
|
|
1079
|
+
var _effect = _useSignals9();
|
|
1053
1080
|
try {
|
|
1054
1081
|
const { tab, useItems: useItems2, onBack } = useNavTreeContext();
|
|
1055
1082
|
const topLevelActions = useItems2(root, {
|
|
@@ -1065,7 +1092,7 @@ var NavTree = ({ id, root, ...props }) => {
|
|
|
1065
1092
|
const topLevelNavigation = useItems2(root, {
|
|
1066
1093
|
disposition: "navigation"
|
|
1067
1094
|
});
|
|
1068
|
-
const l0Items =
|
|
1095
|
+
const l0Items = useMemo5(() => [
|
|
1069
1096
|
// prettier-ignore
|
|
1070
1097
|
...topLevelCollections,
|
|
1071
1098
|
...topLevelWorkspaces,
|
|
@@ -1082,7 +1109,7 @@ var NavTree = ({ id, root, ...props }) => {
|
|
|
1082
1109
|
const userAccountItem = useItems2(root, {
|
|
1083
1110
|
disposition: "user-account"
|
|
1084
1111
|
})[0];
|
|
1085
|
-
const topLevelItems =
|
|
1112
|
+
const topLevelItems = useMemo5(() => [
|
|
1086
1113
|
// prettier-ignore
|
|
1087
1114
|
...l0Items,
|
|
1088
1115
|
...pinnedItems,
|
|
@@ -1095,46 +1122,44 @@ var NavTree = ({ id, root, ...props }) => {
|
|
|
1095
1122
|
userAccountItem
|
|
1096
1123
|
]);
|
|
1097
1124
|
useLoadDescendents(root);
|
|
1098
|
-
const path =
|
|
1125
|
+
const path = useMemo5(() => [
|
|
1099
1126
|
id
|
|
1100
1127
|
], [
|
|
1101
1128
|
id
|
|
1102
1129
|
]);
|
|
1103
|
-
return
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1130
|
+
return (
|
|
1131
|
+
// TODO(thure): `Tabs.Root` forces all items that should be able to receive focus to use `Tabs.Tab(Primitive)` since
|
|
1132
|
+
// it uses RovingFocus and doesn’t support moving focus to an item that is not a tab. Assess whether this situation
|
|
1133
|
+
// should change including whether it should motivate a change in the design/taxonomy, or if this means this should
|
|
1134
|
+
// not use `react-ui-tabs` at all.
|
|
1135
|
+
/* @__PURE__ */ React9.createElement(Tabs3.Root, {
|
|
1136
|
+
value: tab,
|
|
1137
|
+
orientation: "vertical",
|
|
1138
|
+
verticalVariant: "stateless",
|
|
1139
|
+
classNames: "relative"
|
|
1140
|
+
}, /* @__PURE__ */ React9.createElement(L0Menu, {
|
|
1141
|
+
menuActions: topLevelActions,
|
|
1142
|
+
topLevelItems: l0Items,
|
|
1143
|
+
pinnedItems,
|
|
1144
|
+
userAccountItem,
|
|
1145
|
+
path,
|
|
1146
|
+
parent: root
|
|
1147
|
+
}), /* @__PURE__ */ React9.createElement(L1Tabs, {
|
|
1148
|
+
topLevelItems,
|
|
1149
|
+
path,
|
|
1150
|
+
currentItemId: tab,
|
|
1151
|
+
onBack,
|
|
1152
|
+
...props
|
|
1153
|
+
}))
|
|
1154
|
+
);
|
|
1122
1155
|
} finally {
|
|
1123
1156
|
_effect.f();
|
|
1124
1157
|
}
|
|
1125
1158
|
};
|
|
1126
1159
|
|
|
1127
|
-
// src/capabilities/index.ts
|
|
1128
|
-
import { lazy } from "@dxos/app-framework";
|
|
1129
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-5J4LRWDX.mjs"));
|
|
1130
|
-
var IntentResolver = lazy(() => import("./intent-resolver-3XYN2CBU.mjs"));
|
|
1131
|
-
var Keyboard2 = lazy(() => import("./keyboard-QRS6WOQH.mjs"));
|
|
1132
|
-
var ReactSurface = lazy(() => import("./react-surface-N2HPMYCU.mjs"));
|
|
1133
|
-
var State = lazy(() => import("./state-54DY3DOY.mjs"));
|
|
1134
|
-
|
|
1135
1160
|
// src/components/NavTreeContainer.tsx
|
|
1136
1161
|
var NODE_TYPE = "dxos/app-graph/node";
|
|
1137
|
-
var renderItemEnd = ({ node, open }) => /* @__PURE__ */
|
|
1162
|
+
var renderItemEnd = ({ node, open }) => /* @__PURE__ */ React10.createElement(Surface, {
|
|
1138
1163
|
role: "navtree-item-end",
|
|
1139
1164
|
data: {
|
|
1140
1165
|
id: node.id,
|
|
@@ -1143,12 +1168,12 @@ var renderItemEnd = ({ node, open }) => /* @__PURE__ */ React9.createElement(Sur
|
|
|
1143
1168
|
},
|
|
1144
1169
|
limit: 1
|
|
1145
1170
|
});
|
|
1146
|
-
var getChildrenFilter = (node) => untracked(() => !isActionLike2(node) && node.type !== PLANK_COMPANION_TYPE);
|
|
1171
|
+
var getChildrenFilter = (node) => untracked(() => !isActionLike2(node) && node.type !== PLANK_COMPANION_TYPE && node.properties.disposition !== "hidden");
|
|
1147
1172
|
var filterItems = (node, disposition) => {
|
|
1148
1173
|
if (!disposition && (node.properties.disposition === "hidden" || node.properties.disposition === "alternate-tree")) {
|
|
1149
1174
|
return false;
|
|
1150
1175
|
} else if (!disposition) {
|
|
1151
|
-
const action =
|
|
1176
|
+
const action = isAction3(node);
|
|
1152
1177
|
return !action || node.properties.disposition === "item";
|
|
1153
1178
|
} else {
|
|
1154
1179
|
return node.properties.disposition === disposition;
|
|
@@ -1159,11 +1184,32 @@ var getItems = (graph, node, disposition) => {
|
|
|
1159
1184
|
};
|
|
1160
1185
|
var useItems = (node, options) => {
|
|
1161
1186
|
const { graph } = useAppGraph2();
|
|
1162
|
-
const connections = useConnections(graph, node?.id ?? ROOT_ID)
|
|
1163
|
-
|
|
1187
|
+
const connections = useConnections(graph, node?.id ?? ROOT_ID);
|
|
1188
|
+
const filtered = connections.filter((node2) => filterItems(node2, options?.disposition));
|
|
1189
|
+
return options?.sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
|
|
1190
|
+
};
|
|
1191
|
+
var useActions2 = (node) => {
|
|
1192
|
+
const { graph } = useAppGraph2();
|
|
1193
|
+
const actions = useGraphActions(graph, node.id);
|
|
1194
|
+
return useMemo6(() => actions.reduce((acc, arg) => {
|
|
1195
|
+
if (arg.properties.disposition === "item") {
|
|
1196
|
+
return acc;
|
|
1197
|
+
}
|
|
1198
|
+
acc.actions.push(arg);
|
|
1199
|
+
if (!isAction3(arg)) {
|
|
1200
|
+
const actionGroup = graph.getActions(arg.id);
|
|
1201
|
+
acc.groupedActions[arg.id] = actionGroup;
|
|
1202
|
+
}
|
|
1203
|
+
return acc;
|
|
1204
|
+
}, {
|
|
1205
|
+
actions: [],
|
|
1206
|
+
groupedActions: {}
|
|
1207
|
+
}), [
|
|
1208
|
+
actions
|
|
1209
|
+
]);
|
|
1164
1210
|
};
|
|
1165
1211
|
var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar }) => {
|
|
1166
|
-
var _effect =
|
|
1212
|
+
var _effect = _useSignals10();
|
|
1167
1213
|
try {
|
|
1168
1214
|
const [isLg] = useMediaQuery2("lg", {
|
|
1169
1215
|
ssr: false
|
|
@@ -1172,10 +1218,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1172
1218
|
const { graph } = useAppGraph2();
|
|
1173
1219
|
const { isOpen, isCurrent, isAlternateTree, setItem } = useCapability(NavTreeCapabilities.State);
|
|
1174
1220
|
const layout = useLayout();
|
|
1175
|
-
const { navigationSidebarState } = useSidebars(
|
|
1176
|
-
const getActions2 = useCallback3((node) => getActions(graph, node), [
|
|
1177
|
-
graph
|
|
1178
|
-
]);
|
|
1221
|
+
const { navigationSidebarState } = useSidebars(meta.id);
|
|
1179
1222
|
const getProps = useCallback3((node, path) => {
|
|
1180
1223
|
const children = getChildren(graph, node, path).filter(getChildrenFilter);
|
|
1181
1224
|
const parentOf = children.length > 0 ? children.map(({ id }) => id) : node.properties.role === "branch" ? [] : void 0;
|
|
@@ -1185,7 +1228,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1185
1228
|
parentOf,
|
|
1186
1229
|
icon: node.properties.icon,
|
|
1187
1230
|
disabled: node.properties.disabled,
|
|
1188
|
-
className:
|
|
1231
|
+
className: mx3(node.properties.modified && "italic", node.properties.className),
|
|
1189
1232
|
headingClassName: node.properties.headingClassName,
|
|
1190
1233
|
testId: node.properties.testId
|
|
1191
1234
|
};
|
|
@@ -1242,7 +1285,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1242
1285
|
if (!node.data) {
|
|
1243
1286
|
return;
|
|
1244
1287
|
}
|
|
1245
|
-
if (
|
|
1288
|
+
if (isAction3(node)) {
|
|
1246
1289
|
const [parent] = graph.getConnections(node.id, "inbound");
|
|
1247
1290
|
void (parent && node.data({
|
|
1248
1291
|
parent,
|
|
@@ -1278,7 +1321,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1278
1321
|
}));
|
|
1279
1322
|
}
|
|
1280
1323
|
const defaultAction = graph.getActions(node.id).find((action) => action.properties?.disposition === "default");
|
|
1281
|
-
if (
|
|
1324
|
+
if (isAction3(defaultAction)) {
|
|
1282
1325
|
void defaultAction.data();
|
|
1283
1326
|
}
|
|
1284
1327
|
if (!isLg) {
|
|
@@ -1358,10 +1401,10 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1358
1401
|
}, [
|
|
1359
1402
|
setItem
|
|
1360
1403
|
]);
|
|
1361
|
-
const navTreeContextValue =
|
|
1404
|
+
const navTreeContextValue = useMemo6(() => ({
|
|
1362
1405
|
useItems,
|
|
1363
1406
|
tab,
|
|
1364
|
-
|
|
1407
|
+
useActions: useActions2,
|
|
1365
1408
|
loadDescendents,
|
|
1366
1409
|
renderItemEnd,
|
|
1367
1410
|
popoverAnchorId,
|
|
@@ -1378,7 +1421,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1378
1421
|
onBack: handleBack
|
|
1379
1422
|
}), [
|
|
1380
1423
|
tab,
|
|
1381
|
-
|
|
1424
|
+
useActions2,
|
|
1382
1425
|
loadDescendents,
|
|
1383
1426
|
renderItemEnd,
|
|
1384
1427
|
popoverAnchorId,
|
|
@@ -1394,9 +1437,9 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1394
1437
|
handleSelect,
|
|
1395
1438
|
handleBack
|
|
1396
1439
|
]);
|
|
1397
|
-
return /* @__PURE__ */
|
|
1440
|
+
return /* @__PURE__ */ React10.createElement(NavTreeContext.Provider, {
|
|
1398
1441
|
value: navTreeContextValue
|
|
1399
|
-
}, /* @__PURE__ */
|
|
1442
|
+
}, /* @__PURE__ */ React10.createElement(NavTree, {
|
|
1400
1443
|
id: ROOT_ID,
|
|
1401
1444
|
root: graph.root,
|
|
1402
1445
|
open: layout.sidebarOpen
|
|
@@ -1414,7 +1457,6 @@ export {
|
|
|
1414
1457
|
resolveMigrationOperation,
|
|
1415
1458
|
sortActions,
|
|
1416
1459
|
getChildren,
|
|
1417
|
-
getActions,
|
|
1418
1460
|
l0ItemType,
|
|
1419
1461
|
NODE_TYPE,
|
|
1420
1462
|
NavTreeContainer,
|
|
@@ -1425,4 +1467,4 @@ export {
|
|
|
1425
1467
|
ReactSurface,
|
|
1426
1468
|
State
|
|
1427
1469
|
};
|
|
1428
|
-
//# sourceMappingURL=chunk-
|
|
1470
|
+
//# sourceMappingURL=chunk-6AZKY5WZ.mjs.map
|