@dxos/plugin-navtree 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b
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-OHSCN3GX.mjs} +13 -12
- package/dist/lib/browser/app-graph-builder-OHSCN3GX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WEMCSQI7.mjs → chunk-5DWDYPGQ.mjs} +212 -189
- package/dist/lib/browser/chunk-5DWDYPGQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WCARAZ7J.mjs → chunk-5VLWX4PK.mjs} +4 -4
- package/dist/lib/browser/chunk-5VLWX4PK.mjs.map +7 -0
- package/dist/lib/browser/chunk-E6MZBCU5.mjs +19 -0
- package/dist/lib/browser/chunk-E6MZBCU5.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +6 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-3XYN2CBU.mjs → intent-resolver-YUVXVPHG.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-YUVXVPHG.mjs.map +7 -0
- package/dist/lib/browser/{keyboard-QRS6WOQH.mjs → keyboard-YJEK2HTH.mjs} +8 -10
- package/dist/lib/browser/{keyboard-QRS6WOQH.mjs.map → keyboard-YJEK2HTH.mjs.map} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-JSJ5SQX5.mjs → react-surface-RPXGIV45.mjs} +22 -16
- package/dist/lib/browser/react-surface-RPXGIV45.mjs.map +7 -0
- package/dist/lib/browser/{state-54DY3DOY.mjs → state-BFD5KJCV.mjs} +7 -7
- package/dist/lib/browser/state-BFD5KJCV.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 +18 -15
- 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/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +3 -3
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts +3 -2
- package/dist/types/src/components/CommandsDialog/CommandsDialog.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 +30 -1
- package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts +29 -4
- package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts +8 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItem/NavTreeItemAction.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.map +1 -1
- package/dist/types/src/components/Sidebar/L1Tabs.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -1
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts +8 -5
- package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +3 -3
- 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 +1 -2
- package/dist/types/src/experimental/Tree.d.ts.map +1 -1
- package/dist/types/src/experimental/Tree.stories.d.ts +7 -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/testing/generator.d.ts +2 -2
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +4 -3
- package/dist/types/src/types.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 -48
- package/src/NavTreePlugin.tsx +75 -76
- package/src/capabilities/app-graph-builder.ts +10 -9
- package/src/capabilities/capabilities.ts +2 -2
- package/src/capabilities/intent-resolver.ts +2 -2
- package/src/capabilities/keyboard.ts +3 -5
- package/src/capabilities/react-surface.tsx +16 -13
- package/src/capabilities/state.ts +5 -5
- package/src/components/CommandsDialog/CommandsDialog.tsx +102 -90
- package/src/components/CommandsDialog/CommandsTrigger.tsx +4 -3
- package/src/components/NavTree/NavTree.stories.tsx +67 -53
- package/src/components/NavTree/NavTree.tsx +8 -4
- package/src/components/NavTreeContainer.tsx +313 -244
- package/src/components/NavTreeDocumentTitle.tsx +2 -2
- package/src/components/NavTreeItem/NavTreeItemAction.stories.tsx +4 -6
- package/src/components/NavTreeItem/NavTreeItemAction.tsx +7 -6
- package/src/components/NavTreeItem/NavTreeItemColumns.tsx +31 -24
- package/src/components/Sidebar/L0Menu.tsx +56 -55
- package/src/components/Sidebar/L1Panel.tsx +23 -28
- package/src/components/Sidebar/L1Tabs.tsx +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 -0
- package/src/components/types.ts +4 -3
- package/src/events.ts +2 -2
- package/src/experimental/Tree.stories.tsx +28 -30
- package/src/experimental/Tree.tsx +6 -23
- package/src/meta.ts +10 -7
- package/src/testing/app-graph-builder.ts +20 -19
- package/src/testing/generator.ts +10 -8
- package/src/types.ts +4 -3
- 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-WCARAZ7J.mjs.map +0 -7
- package/dist/lib/browser/chunk-WEMCSQI7.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3XYN2CBU.mjs.map +0 -7
- package/dist/lib/browser/react-surface-JSJ5SQX5.mjs.map +0 -7
- package/dist/lib/browser/state-54DY3DOY.mjs.map +0 -7
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NavTreeCapabilities
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5VLWX4PK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
COMMANDS_DIALOG,
|
|
6
6
|
KEY_BINDING,
|
|
7
|
-
NAVTREE_PLUGIN,
|
|
8
7
|
meta
|
|
9
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-E6MZBCU5.mjs";
|
|
10
9
|
|
|
11
10
|
// src/components/CommandsDialog/CommandsDialog.tsx
|
|
12
11
|
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
13
|
-
import React, { useMemo, useState } from "react";
|
|
14
|
-
import {
|
|
12
|
+
import React, { forwardRef, useMemo, useState } from "react";
|
|
13
|
+
import { LayoutAction, createIntent } from "@dxos/app-framework";
|
|
14
|
+
import { useAppGraph, useIntentDispatcher } from "@dxos/app-framework/react";
|
|
15
15
|
import { isAction, isActionGroup } from "@dxos/app-graph";
|
|
16
16
|
import { Keyboard, keySymbols } from "@dxos/keyboard";
|
|
17
17
|
import { useActions } from "@dxos/plugin-graph";
|
|
18
|
-
import { Button, Dialog, Icon,
|
|
18
|
+
import { Button, Dialog, Icon, toLocalizedString, useTranslation } from "@dxos/react-ui";
|
|
19
19
|
import { SearchList } from "@dxos/react-ui-searchlist";
|
|
20
20
|
import { cardDialogContent, cardDialogHeader, cardDialogPaddedOverflow, cardDialogSearchListRoot } from "@dxos/react-ui-stack";
|
|
21
21
|
import { descriptionText, mx } from "@dxos/react-ui-theme";
|
|
22
22
|
import { getHostPlatform } from "@dxos/util";
|
|
23
|
-
var CommandsDialogContent = ({ selected: initial }) => {
|
|
23
|
+
var CommandsDialogContent = /* @__PURE__ */ forwardRef(({ selected: initial }, forwardedRef) => {
|
|
24
24
|
var _effect = _useSignals();
|
|
25
25
|
try {
|
|
26
|
-
const { t } = useTranslation(
|
|
27
|
-
const [selected, setSelected] = useState(initial);
|
|
26
|
+
const { t } = useTranslation(meta.id);
|
|
28
27
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
29
28
|
const { graph } = useAppGraph();
|
|
29
|
+
const [selected, setSelected] = useState(initial);
|
|
30
30
|
const allActions = useMemo(() => {
|
|
31
31
|
const current = Keyboard.singleton.getCurrentContext();
|
|
32
32
|
const actionMap = /* @__PURE__ */ new Set();
|
|
@@ -50,11 +50,12 @@ var CommandsDialogContent = ({ selected: initial }) => {
|
|
|
50
50
|
const groupActions = useActions(graph, group?.id);
|
|
51
51
|
const actions = isActionGroup(group) ? groupActions : allActions;
|
|
52
52
|
return /* @__PURE__ */ React.createElement(Dialog.Content, {
|
|
53
|
-
classNames: cardDialogContent
|
|
53
|
+
classNames: cardDialogContent,
|
|
54
|
+
ref: forwardedRef
|
|
54
55
|
}, /* @__PURE__ */ React.createElement(Dialog.Title, {
|
|
55
56
|
classNames: cardDialogHeader
|
|
56
57
|
}, t("commands dialog title", {
|
|
57
|
-
ns:
|
|
58
|
+
ns: meta.id
|
|
58
59
|
})), /* @__PURE__ */ React.createElement(SearchList.Root, {
|
|
59
60
|
label: t("command list input placeholder"),
|
|
60
61
|
classNames: cardDialogSearchListRoot
|
|
@@ -116,18 +117,19 @@ var CommandsDialogContent = ({ selected: initial }) => {
|
|
|
116
117
|
} finally {
|
|
117
118
|
_effect.f();
|
|
118
119
|
}
|
|
119
|
-
};
|
|
120
|
+
});
|
|
120
121
|
|
|
121
122
|
// src/components/CommandsDialog/CommandsTrigger.tsx
|
|
122
123
|
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
123
124
|
import React2 from "react";
|
|
124
|
-
import {
|
|
125
|
+
import { LayoutAction as LayoutAction2, createIntent as createIntent2 } from "@dxos/app-framework";
|
|
126
|
+
import { useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework/react";
|
|
125
127
|
import { Button as Button2, Icon as Icon2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
126
128
|
var CommandsTrigger = () => {
|
|
127
129
|
var _effect = _useSignals2();
|
|
128
130
|
try {
|
|
129
131
|
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
130
|
-
const { t } = useTranslation2(
|
|
132
|
+
const { t } = useTranslation2(meta.id);
|
|
131
133
|
return /* @__PURE__ */ React2.createElement(Button2, {
|
|
132
134
|
classNames: "m-1 pli-1 lg:pli-2",
|
|
133
135
|
onClick: () => dispatch(createIntent2(LayoutAction2.UpdateDialog, {
|
|
@@ -149,7 +151,7 @@ var CommandsTrigger = () => {
|
|
|
149
151
|
};
|
|
150
152
|
|
|
151
153
|
// src/util.ts
|
|
152
|
-
import {
|
|
154
|
+
import { isActionLike } from "@dxos/app-graph";
|
|
153
155
|
import { isNonNullable } from "@dxos/util";
|
|
154
156
|
var getParent = (graph, node, path) => {
|
|
155
157
|
const parentId = path[path.length - 2];
|
|
@@ -199,22 +201,6 @@ var getChildren = (graph, node, path = []) => {
|
|
|
199
201
|
return nextPath.includes(n.id) ? void 0 : n;
|
|
200
202
|
}).filter(isNonNullable);
|
|
201
203
|
};
|
|
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
204
|
var l0ItemType = (item) => {
|
|
219
205
|
if (item.properties.disposition === "collection") {
|
|
220
206
|
return "collection";
|
|
@@ -232,19 +218,28 @@ import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking
|
|
|
232
218
|
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
233
219
|
import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
|
|
234
220
|
import { untracked } from "@preact/signals-core";
|
|
235
|
-
import React10, { memo as memo2, useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo6 } from "react";
|
|
236
|
-
import {
|
|
237
|
-
import {
|
|
221
|
+
import React10, { forwardRef as forwardRef4, memo as memo2, useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo6 } from "react";
|
|
222
|
+
import { LayoutAction as LayoutAction3, createIntent as createIntent3 } from "@dxos/app-framework";
|
|
223
|
+
import { Surface, useAppGraph as useAppGraph2, useCapability, useIntentDispatcher as useIntentDispatcher3, useLayout } from "@dxos/app-framework/react";
|
|
224
|
+
import { ROOT_ID, isAction as isAction3, isActionLike as isActionLike2 } from "@dxos/app-graph";
|
|
238
225
|
import { PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
|
|
239
|
-
import { useConnections } from "@dxos/plugin-graph";
|
|
226
|
+
import { useConnections, useActions as useGraphActions } from "@dxos/plugin-graph";
|
|
240
227
|
import { useMediaQuery as useMediaQuery2, useSidebars } from "@dxos/react-ui";
|
|
241
228
|
import { isTreeData } from "@dxos/react-ui-list";
|
|
242
229
|
import { mx as mx3 } from "@dxos/react-ui-theme";
|
|
243
230
|
import { arrayMove as arrayMove2, byPosition } from "@dxos/util";
|
|
244
231
|
|
|
232
|
+
// src/capabilities/index.ts
|
|
233
|
+
import { lazy } from "@dxos/app-framework";
|
|
234
|
+
var AppGraphBuilder = lazy(() => import("./app-graph-builder-OHSCN3GX.mjs"));
|
|
235
|
+
var IntentResolver = lazy(() => import("./intent-resolver-YUVXVPHG.mjs"));
|
|
236
|
+
var Keyboard2 = lazy(() => import("./keyboard-YJEK2HTH.mjs"));
|
|
237
|
+
var ReactSurface = lazy(() => import("./react-surface-RPXGIV45.mjs"));
|
|
238
|
+
var State = lazy(() => import("./state-BFD5KJCV.mjs"));
|
|
239
|
+
|
|
245
240
|
// src/components/NavTree/NavTree.tsx
|
|
246
241
|
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
247
|
-
import React9, { useMemo as useMemo5 } from "react";
|
|
242
|
+
import React9, { forwardRef as forwardRef3, useMemo as useMemo5 } from "react";
|
|
248
243
|
import { Tabs as Tabs3 } from "@dxos/react-ui-tabs";
|
|
249
244
|
|
|
250
245
|
// src/hooks.ts
|
|
@@ -260,7 +255,7 @@ var useNavTreeContext = () => useContext(NavTreeContext) ?? raise(new Error("Mis
|
|
|
260
255
|
import { useEffect } from "react";
|
|
261
256
|
import { toLocalizedString as toLocalizedString2, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
262
257
|
var NavTreeDocumentTitle = ({ node }) => {
|
|
263
|
-
const { t } = useTranslation3(
|
|
258
|
+
const { t } = useTranslation3(meta.id);
|
|
264
259
|
useEffect(() => {
|
|
265
260
|
document.title = node ? toLocalizedString2(node.properties.label, t) : t("current app name", {
|
|
266
261
|
ns: "appkit"
|
|
@@ -293,13 +288,14 @@ import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-d
|
|
|
293
288
|
import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
|
|
294
289
|
import { scrollJustEnoughIntoView } from "@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view";
|
|
295
290
|
import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
|
|
296
|
-
import React4, { forwardRef, useCallback, useLayoutEffect, useMemo as useMemo2, useRef, useState as useState2 } from "react";
|
|
291
|
+
import React4, { forwardRef as forwardRef2, useCallback, useLayoutEffect, useMemo as useMemo2, useRef, useState as useState2 } from "react";
|
|
297
292
|
import { invariant } from "@dxos/invariant";
|
|
293
|
+
import { DxAvatar } from "@dxos/lit-ui/react";
|
|
298
294
|
import { Icon as Icon3, ListItem, ScrollArea, Tooltip, toLocalizedString as toLocalizedString3, useMediaQuery, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
299
|
-
import {
|
|
295
|
+
import { DropdownMenu, MenuProvider } from "@dxos/react-ui-menu";
|
|
300
296
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
301
297
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
302
|
-
import { arrayMove
|
|
298
|
+
import { arrayMove } from "@dxos/util";
|
|
303
299
|
|
|
304
300
|
// src/components/UserAccountAvatar/UserAccountAvatar.tsx
|
|
305
301
|
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
@@ -310,8 +306,10 @@ var UserAccountAvatar = ({ size, userId, hue, emoji, status }) => {
|
|
|
310
306
|
var _effect = _useSignals3();
|
|
311
307
|
try {
|
|
312
308
|
const fallbackValue = hexToFallback(userId ?? "0");
|
|
313
|
-
return /* @__PURE__ */ React3.createElement(
|
|
314
|
-
|
|
309
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(L0ItemActiveTabIndicator, {
|
|
310
|
+
classNames: "inset-block-6"
|
|
311
|
+
}), /* @__PURE__ */ React3.createElement("div", {
|
|
312
|
+
className: "grid place-items-center dx-focus-ring-group-indicator rounded-full",
|
|
315
313
|
"data-joyride": "welcome/account"
|
|
316
314
|
}, /* @__PURE__ */ React3.createElement(Avatar.Root, null, /* @__PURE__ */ React3.createElement(Avatar.Content, {
|
|
317
315
|
variant: "circle",
|
|
@@ -320,7 +318,7 @@ var UserAccountAvatar = ({ size, userId, hue, emoji, status }) => {
|
|
|
320
318
|
hue: hue || fallbackValue.hue,
|
|
321
319
|
fallback: emoji || fallbackValue.emoji,
|
|
322
320
|
"data-testid": "treeView.userAccount"
|
|
323
|
-
})));
|
|
321
|
+
}))));
|
|
324
322
|
} finally {
|
|
325
323
|
_effect.f();
|
|
326
324
|
}
|
|
@@ -330,9 +328,7 @@ var UserAccountAvatar = ({ size, userId, hue, emoji, status }) => {
|
|
|
330
328
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-navtree/src/components/Sidebar/L0Menu.tsx";
|
|
331
329
|
var useL0ItemClick = ({ item, parent, path }, type) => {
|
|
332
330
|
const { tab, isCurrent, onSelect, onTabChange } = useNavTreeContext();
|
|
333
|
-
const [isLg] = useMediaQuery("lg"
|
|
334
|
-
ssr: false
|
|
335
|
-
});
|
|
331
|
+
const [isLg] = useMediaQuery("lg");
|
|
336
332
|
return useCallback((event) => {
|
|
337
333
|
switch (type) {
|
|
338
334
|
case "action": {
|
|
@@ -368,9 +364,9 @@ var useL0ItemClick = ({ item, parent, path }, type) => {
|
|
|
368
364
|
var l0Breakpoints = {
|
|
369
365
|
lg: "hidden lg:grid"
|
|
370
366
|
};
|
|
371
|
-
var l0ItemRoot = 'group/l0item flex
|
|
367
|
+
var l0ItemRoot = 'group/l0item flex is-full justify-center items-center relative data[type!="collection"]:cursor-pointer app-no-drag dx-focus-ring-group';
|
|
372
368
|
var l0ItemContent = "flex justify-center items-center dx-focus-ring-group-indicator transition-colors rounded-sm";
|
|
373
|
-
var L0ItemRoot = /* @__PURE__ */
|
|
369
|
+
var L0ItemRoot = /* @__PURE__ */ forwardRef2(({ item, parent, path, children }, forwardedRef) => {
|
|
374
370
|
var _effect = _useSignals4();
|
|
375
371
|
try {
|
|
376
372
|
const { getProps } = useNavTreeContext();
|
|
@@ -383,7 +379,7 @@ var L0ItemRoot = /* @__PURE__ */ forwardRef(({ item, parent, path, children }, f
|
|
|
383
379
|
item.id,
|
|
384
380
|
path
|
|
385
381
|
]);
|
|
386
|
-
const { t } = useTranslation4(
|
|
382
|
+
const { t } = useTranslation4(meta.id);
|
|
387
383
|
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
388
384
|
const handleClick = useL0ItemClick({
|
|
389
385
|
item,
|
|
@@ -395,21 +391,21 @@ var L0ItemRoot = /* @__PURE__ */ forwardRef(({ item, parent, path, children }, f
|
|
|
395
391
|
tabIndex: 0,
|
|
396
392
|
onClick: handleClick,
|
|
397
393
|
"data-testid": testId,
|
|
398
|
-
"data-
|
|
394
|
+
"data-object-id": id
|
|
399
395
|
} : type !== "collection" ? {
|
|
400
396
|
onClick: handleClick,
|
|
401
397
|
"data-testid": testId,
|
|
402
|
-
"data-
|
|
398
|
+
"data-object-id": id
|
|
403
399
|
} : {
|
|
404
|
-
onClick: handleClick
|
|
400
|
+
onClick: handleClick,
|
|
401
|
+
role: "button"
|
|
405
402
|
};
|
|
406
|
-
const Root = type === "collection" ? "h2" : type === "tab" ? Tabs.TabPrimitive : "button";
|
|
407
403
|
return /* @__PURE__ */ React4.createElement(Tooltip.Trigger, {
|
|
408
404
|
asChild: true,
|
|
409
405
|
delayDuration: 0,
|
|
410
406
|
side: "right",
|
|
411
407
|
content: localizedString
|
|
412
|
-
}, /* @__PURE__ */ React4.createElement(
|
|
408
|
+
}, /* @__PURE__ */ React4.createElement(Tabs.TabPrimitive, {
|
|
413
409
|
...rootProps,
|
|
414
410
|
"data-type": type,
|
|
415
411
|
className: mx2(l0ItemRoot, l0Breakpoints[item.properties.l0Breakpoint]),
|
|
@@ -419,28 +415,13 @@ var L0ItemRoot = /* @__PURE__ */ forwardRef(({ item, parent, path, children }, f
|
|
|
419
415
|
_effect.f();
|
|
420
416
|
}
|
|
421
417
|
});
|
|
422
|
-
var
|
|
418
|
+
var L0ItemActiveTabIndicator = ({ classNames }) => {
|
|
423
419
|
var _effect = _useSignals4();
|
|
424
420
|
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);
|
|
421
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
422
|
+
role: "none",
|
|
423
|
+
className: mx2("hidden group-aria-selected/l0item:block absolute inline-start-0 inset-block-2 is-1 bg-accentSurface rounded-ie", classNames)
|
|
424
|
+
});
|
|
444
425
|
} finally {
|
|
445
426
|
_effect.f();
|
|
446
427
|
}
|
|
@@ -448,7 +429,7 @@ var L0Avatar = ({ item }) => {
|
|
|
448
429
|
var L0Item = ({ item, parent, path, pinned, onRearrange }) => {
|
|
449
430
|
var _effect = _useSignals4();
|
|
450
431
|
try {
|
|
451
|
-
const { t } = useTranslation4(
|
|
432
|
+
const { t } = useTranslation4(meta.id);
|
|
452
433
|
const itemElement = useRef(null);
|
|
453
434
|
const [closestEdge, setEdge] = useState2(null);
|
|
454
435
|
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
@@ -537,10 +518,7 @@ var L0Item = ({ item, parent, path, pinned, onRearrange }) => {
|
|
|
537
518
|
className: mx2(l0ItemContent, pinned ? "p-2 group-hover/l0item:bg-activeSurface" : "is-[--l0-avatar-size] bs-[--l0-avatar-size] bg-activeSurface")
|
|
538
519
|
}, /* @__PURE__ */ React4.createElement(ItemAvatar, {
|
|
539
520
|
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", {
|
|
521
|
+
})), /* @__PURE__ */ React4.createElement(L0ItemActiveTabIndicator, null), /* @__PURE__ */ React4.createElement("span", {
|
|
544
522
|
id: `${item.id}__label`,
|
|
545
523
|
className: "sr-only"
|
|
546
524
|
}, localizedString), closestEdge && /* @__PURE__ */ React4.createElement(ListItem.DropIndicator, {
|
|
@@ -553,6 +531,7 @@ var L0Item = ({ item, parent, path, pinned, onRearrange }) => {
|
|
|
553
531
|
var ItemAvatar = ({ item }) => {
|
|
554
532
|
var _effect = _useSignals4();
|
|
555
533
|
try {
|
|
534
|
+
const { t } = useTranslation4(meta.id);
|
|
556
535
|
const type = l0ItemType(item);
|
|
557
536
|
if (item.properties.icon) {
|
|
558
537
|
const hue = item.properties.hue ?? null;
|
|
@@ -563,13 +542,19 @@ var ItemAvatar = ({ item }) => {
|
|
|
563
542
|
};
|
|
564
543
|
return /* @__PURE__ */ React4.createElement(Icon3, {
|
|
565
544
|
icon: item.properties.icon,
|
|
566
|
-
size:
|
|
545
|
+
size: 6,
|
|
567
546
|
...hueFgStyle
|
|
568
547
|
});
|
|
569
548
|
}
|
|
570
549
|
if (type === "tab" && item.properties.disposition !== "pin-end") {
|
|
571
|
-
|
|
572
|
-
|
|
550
|
+
const hue = item.properties.hue ?? null;
|
|
551
|
+
const localizedString = toLocalizedString3(item.properties.label, t);
|
|
552
|
+
return /* @__PURE__ */ React4.createElement(DxAvatar, {
|
|
553
|
+
hue,
|
|
554
|
+
hueVariant: "surface",
|
|
555
|
+
variant: "square",
|
|
556
|
+
size: 12,
|
|
557
|
+
fallback: localizedString
|
|
573
558
|
});
|
|
574
559
|
}
|
|
575
560
|
return null;
|
|
@@ -616,7 +601,7 @@ var L0Collection = ({ item, path }) => {
|
|
|
616
601
|
role: "group",
|
|
617
602
|
className: "contents group/l0c",
|
|
618
603
|
"aria-labelledby": `${item.id}__label`,
|
|
619
|
-
"data-
|
|
604
|
+
"data-object-id": id,
|
|
620
605
|
"data-testid": testId
|
|
621
606
|
}, collectionItems.map((collectionItem) => /* @__PURE__ */ React4.createElement(L0Item, {
|
|
622
607
|
key: collectionItem.id,
|
|
@@ -634,7 +619,7 @@ var L0Collection = ({ item, path }) => {
|
|
|
634
619
|
var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent, path }) => {
|
|
635
620
|
var _effect = _useSignals4();
|
|
636
621
|
try {
|
|
637
|
-
const { t } = useTranslation4(
|
|
622
|
+
const { t } = useTranslation4(meta.id);
|
|
638
623
|
return /* @__PURE__ */ React4.createElement(Tabs.Tablist, {
|
|
639
624
|
classNames: [
|
|
640
625
|
"group/l0 absolute z-[1] inset-block-0 inline-start-0 rounded-is",
|
|
@@ -648,16 +633,20 @@ var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent
|
|
|
648
633
|
content: t("app menu label"),
|
|
649
634
|
side: "right",
|
|
650
635
|
asChild: true
|
|
636
|
+
}, /* @__PURE__ */ React4.createElement(Tabs.TabPrimitive, {
|
|
637
|
+
value: "options",
|
|
638
|
+
asChild: true,
|
|
639
|
+
role: "button"
|
|
651
640
|
}, /* @__PURE__ */ React4.createElement(DropdownMenu.Trigger, {
|
|
652
641
|
"data-testid": "spacePlugin.addSpace",
|
|
653
|
-
className: mx2(l0ItemRoot, "grid place-items-center")
|
|
642
|
+
className: mx2(l0ItemRoot, "grid place-items-center dx-focus-ring-group")
|
|
654
643
|
}, /* @__PURE__ */ React4.createElement("div", {
|
|
655
644
|
role: "none",
|
|
656
645
|
className: mx2(l0ItemContent, "is-[--rail-action] bs-[--rail-action] group-hover/l0item:bg-hoverSurface")
|
|
657
646
|
}, /* @__PURE__ */ React4.createElement(Icon3, {
|
|
658
647
|
icon: "ph--list--regular",
|
|
659
648
|
size: 5
|
|
660
|
-
})))))), /* @__PURE__ */ React4.createElement(ScrollArea.Root, null, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React4.createElement("div", {
|
|
649
|
+
}))))))), /* @__PURE__ */ React4.createElement(ScrollArea.Root, null, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React4.createElement("div", {
|
|
661
650
|
role: "none",
|
|
662
651
|
className: mx2([
|
|
663
652
|
"flex flex-col gap-1 pbs-1",
|
|
@@ -720,7 +709,7 @@ var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent
|
|
|
720
709
|
// src/components/Sidebar/L1Panel.tsx
|
|
721
710
|
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
722
711
|
import React7, { useCallback as useCallback2, useMemo as useMemo3 } from "react";
|
|
723
|
-
import { IconButton as IconButton2, toLocalizedString as toLocalizedString6, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
712
|
+
import { DensityProvider, IconButton as IconButton2, toLocalizedString as toLocalizedString6, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
724
713
|
import { Tree } from "@dxos/react-ui-list";
|
|
725
714
|
import { Tabs as Tabs2 } from "@dxos/react-ui-tabs";
|
|
726
715
|
import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem as hoverableOpenControlItem2 } from "@dxos/react-ui-theme";
|
|
@@ -728,7 +717,7 @@ import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem
|
|
|
728
717
|
// src/components/NavTreeItem/NavTreeItemAction.tsx
|
|
729
718
|
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
730
719
|
import React5 from "react";
|
|
731
|
-
import {
|
|
720
|
+
import { IconButton, toLocalizedString as toLocalizedString4, useDensityContext, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
732
721
|
import { DropdownMenu as DropdownMenu2, MenuProvider as MenuProvider2 } from "@dxos/react-ui-menu";
|
|
733
722
|
import { hoverableControlItem, hoverableOpenControlItem } from "@dxos/react-ui-theme";
|
|
734
723
|
var fallbackIcon = "ph--placeholder--regular";
|
|
@@ -743,7 +732,7 @@ var coarseActionButtonProps = {
|
|
|
743
732
|
var NavTreeItemActionDropdownMenu = ({ parent, label, icon, testId, menuActions, caller }) => {
|
|
744
733
|
var _effect = _useSignals5();
|
|
745
734
|
try {
|
|
746
|
-
const { t } = useTranslation5(
|
|
735
|
+
const { t } = useTranslation5(meta.id);
|
|
747
736
|
const density = useDensityContext();
|
|
748
737
|
return /* @__PURE__ */ React5.createElement(MenuProvider2, null, /* @__PURE__ */ React5.createElement(DropdownMenu2.Root, {
|
|
749
738
|
group: parent,
|
|
@@ -788,10 +777,10 @@ var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, tes
|
|
|
788
777
|
label: baseLabel,
|
|
789
778
|
disabled,
|
|
790
779
|
onClick: (event) => {
|
|
780
|
+
event.stopPropagation();
|
|
791
781
|
if (disabled) {
|
|
792
782
|
return;
|
|
793
783
|
}
|
|
794
|
-
event.stopPropagation();
|
|
795
784
|
void invoke?.(caller ? {
|
|
796
785
|
parent,
|
|
797
786
|
caller
|
|
@@ -808,7 +797,7 @@ var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, tes
|
|
|
808
797
|
var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) => {
|
|
809
798
|
var _effect = _useSignals5();
|
|
810
799
|
try {
|
|
811
|
-
const { t } = useTranslation5(
|
|
800
|
+
const { t } = useTranslation5(meta.id);
|
|
812
801
|
const monolithicAction = menuActions?.length === 1 && menuActions[0];
|
|
813
802
|
const baseLabel = toLocalizedString4(monolithicAction ? monolithicAction.properties.label : props.label, t);
|
|
814
803
|
return monolithic && menuActions?.length === 1 ? /* @__PURE__ */ React5.createElement(NavTreeItemMonolithicAction, {
|
|
@@ -829,42 +818,46 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
|
|
|
829
818
|
// src/components/NavTreeItem/NavTreeItemColumns.tsx
|
|
830
819
|
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
831
820
|
import React6, { Fragment, memo } from "react";
|
|
832
|
-
import { isAction as
|
|
833
|
-
import {
|
|
834
|
-
var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open
|
|
821
|
+
import { isAction as isAction2 } from "@dxos/app-graph";
|
|
822
|
+
import { Popover, Treegrid, toLocalizedString as toLocalizedString5, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
823
|
+
var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open }) => {
|
|
835
824
|
var _effect = _useSignals6();
|
|
836
825
|
try {
|
|
837
|
-
const { t } = useTranslation6(
|
|
838
|
-
const {
|
|
826
|
+
const { t } = useTranslation6(meta.id);
|
|
827
|
+
const { useActions: useActions3, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
|
|
839
828
|
const level = path.length - 2;
|
|
840
|
-
const { actions: _actions, groupedActions } =
|
|
829
|
+
const { actions: _actions, groupedActions } = useActions3(item);
|
|
841
830
|
const [primaryAction, ...secondaryActions] = _actions.toSorted((a, _b) => a.properties?.disposition === "list-item-primary" ? -1 : 1);
|
|
842
|
-
const actions = (primaryAction?.properties?.disposition === "list-item-primary" ? secondaryActions : _actions).flatMap((action) =>
|
|
831
|
+
const actions = (primaryAction?.properties?.disposition === "list-item-primary" ? secondaryActions : _actions).flatMap((action) => isAction2(action) ? [
|
|
843
832
|
action
|
|
844
833
|
] : []).filter((a) => [
|
|
845
834
|
"list-item",
|
|
846
835
|
"list-item-primary"
|
|
847
836
|
].includes(a.properties?.disposition));
|
|
848
|
-
const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
|
|
849
837
|
useLoadDescendents(item);
|
|
850
|
-
useLoadDescendents(primaryAction && !
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
}, /* @__PURE__ */ React6.createElement("div", {
|
|
838
|
+
useLoadDescendents(primaryAction && !isAction2(primaryAction) ? primaryAction : void 0);
|
|
839
|
+
const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
|
|
840
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
854
841
|
role: "none",
|
|
855
842
|
className: "contents app-no-drag"
|
|
856
|
-
}, primaryAction?.properties?.disposition === "list-item-primary" && !primaryAction?.properties?.disabled ? /* @__PURE__ */ React6.createElement(
|
|
843
|
+
}, primaryAction?.properties?.disposition === "list-item-primary" && !primaryAction?.properties?.disabled ? /* @__PURE__ */ React6.createElement(Treegrid.Cell, {
|
|
844
|
+
classNames: "contents"
|
|
845
|
+
}, /* @__PURE__ */ React6.createElement(NavTreeItemAction, {
|
|
857
846
|
testId: primaryAction.properties?.testId,
|
|
858
847
|
label: toLocalizedString5(primaryAction.properties?.label, t),
|
|
859
848
|
icon: primaryAction.properties?.icon ?? "ph--placeholder--regular",
|
|
860
849
|
parent: item,
|
|
861
|
-
monolithic:
|
|
862
|
-
menuActions:
|
|
850
|
+
monolithic: isAction2(primaryAction),
|
|
851
|
+
menuActions: isAction2(primaryAction) ? [
|
|
863
852
|
primaryAction
|
|
864
853
|
] : groupedActions[primaryAction.id],
|
|
865
854
|
menuType: primaryAction.properties?.menuType,
|
|
866
855
|
caller: NAV_TREE_ITEM
|
|
867
|
-
}) : /* @__PURE__ */ React6.createElement(Treegrid.Cell,
|
|
856
|
+
})) : /* @__PURE__ */ React6.createElement(Treegrid.Cell, {
|
|
857
|
+
role: "none"
|
|
858
|
+
}), /* @__PURE__ */ React6.createElement(ActionRoot, null, actions.length > 0 ? /* @__PURE__ */ React6.createElement(Treegrid.Cell, {
|
|
859
|
+
classNames: "contents"
|
|
860
|
+
}, /* @__PURE__ */ React6.createElement(NavTreeItemAction, {
|
|
868
861
|
testId: `navtree.treeItem.actionsLevel${level}`,
|
|
869
862
|
label: t("tree item actions label"),
|
|
870
863
|
icon: "ph--dots-three-vertical--regular",
|
|
@@ -872,7 +865,11 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fi
|
|
|
872
865
|
menuActions: actions,
|
|
873
866
|
menuType: "dropdown",
|
|
874
867
|
caller: NAV_TREE_ITEM
|
|
875
|
-
}) : /* @__PURE__ */ React6.createElement(Treegrid.Cell,
|
|
868
|
+
})) : /* @__PURE__ */ React6.createElement(Treegrid.Cell, {
|
|
869
|
+
role: "none"
|
|
870
|
+
})), ItemEnd && /* @__PURE__ */ React6.createElement(Treegrid.Cell, {
|
|
871
|
+
classNames: "contents"
|
|
872
|
+
}, /* @__PURE__ */ React6.createElement(ItemEnd, {
|
|
876
873
|
node: item,
|
|
877
874
|
open
|
|
878
875
|
})));
|
|
@@ -887,8 +884,8 @@ var L1Panel = ({ open, path, item, currentItemId, onBack }) => {
|
|
|
887
884
|
try {
|
|
888
885
|
const { t } = useTranslation7(meta.id);
|
|
889
886
|
const { isAlternateTree, ...navTreeContext } = useNavTreeContext();
|
|
890
|
-
const { useItems: useItems2 } = navTreeContext;
|
|
891
887
|
const title = toLocalizedString6(item.properties.label, t);
|
|
888
|
+
const { useItems: useItems2 } = navTreeContext;
|
|
892
889
|
const alternateTree = useItems2(item, {
|
|
893
890
|
disposition: "alternate-tree"
|
|
894
891
|
})[0];
|
|
@@ -921,9 +918,11 @@ var L1Panel = ({ open, path, item, currentItemId, onBack }) => {
|
|
|
921
918
|
tabIndex: -1,
|
|
922
919
|
"aria-label": title,
|
|
923
920
|
...!open && {
|
|
924
|
-
inert:
|
|
921
|
+
inert: true
|
|
925
922
|
}
|
|
926
|
-
}, item.id === currentItemId && /* @__PURE__ */ React7.createElement(
|
|
923
|
+
}, item.id === currentItemId && /* @__PURE__ */ React7.createElement(DensityProvider, {
|
|
924
|
+
density: "fine"
|
|
925
|
+
}, /* @__PURE__ */ React7.createElement(L1PanelHeader, {
|
|
927
926
|
path,
|
|
928
927
|
item,
|
|
929
928
|
currentItemId,
|
|
@@ -933,22 +932,22 @@ var L1Panel = ({ open, path, item, currentItemId, onBack }) => {
|
|
|
933
932
|
className: "overflow-y-auto"
|
|
934
933
|
}, isAlternate ? /* @__PURE__ */ React7.createElement(Tree, {
|
|
935
934
|
...navTreeContext,
|
|
936
|
-
useItems: useAlternateItems,
|
|
937
935
|
id: alternateTree.id,
|
|
938
936
|
root: alternateTree,
|
|
939
937
|
path: alternatePath,
|
|
940
938
|
levelOffset: 5,
|
|
941
939
|
gridTemplateColumns: "[tree-row-start] 1fr min-content min-content min-content [tree-row-end]",
|
|
942
|
-
renderColumns: NavTreeItemColumns
|
|
940
|
+
renderColumns: NavTreeItemColumns,
|
|
941
|
+
useItems: useAlternateItems
|
|
943
942
|
}) : /* @__PURE__ */ React7.createElement(Tree, {
|
|
944
943
|
...navTreeContext,
|
|
945
944
|
id: item.id,
|
|
946
945
|
root: item,
|
|
947
946
|
path,
|
|
948
947
|
levelOffset: 5,
|
|
949
|
-
draggable: true,
|
|
950
948
|
gridTemplateColumns: "[tree-row-start] 1fr min-content min-content min-content [tree-row-end]",
|
|
951
|
-
renderColumns: NavTreeItemColumns
|
|
949
|
+
renderColumns: NavTreeItemColumns,
|
|
950
|
+
draggable: true
|
|
952
951
|
}))));
|
|
953
952
|
} finally {
|
|
954
953
|
_effect.f();
|
|
@@ -996,11 +995,10 @@ var L1PanelHeader = ({ item, path, onBack }) => {
|
|
|
996
995
|
className: "is-6"
|
|
997
996
|
}), /* @__PURE__ */ React7.createElement("h2", {
|
|
998
997
|
className: "flex-1 truncate min-is-0"
|
|
999
|
-
}, title),
|
|
998
|
+
}, title), backCapable && /* @__PURE__ */ React7.createElement(IconButton2, {
|
|
1000
999
|
variant: "ghost",
|
|
1001
1000
|
icon: "ph--arrow-u-down-left--regular",
|
|
1002
1001
|
iconOnly: true,
|
|
1003
|
-
size: 5,
|
|
1004
1002
|
label: t("button back"),
|
|
1005
1003
|
classNames: [
|
|
1006
1004
|
hoverableControlItem2,
|
|
@@ -1013,7 +1011,6 @@ var L1PanelHeader = ({ item, path, onBack }) => {
|
|
|
1013
1011
|
variant: "ghost",
|
|
1014
1012
|
icon: alternateTree.properties.icon ?? "ph--placeholder--regular",
|
|
1015
1013
|
iconOnly: true,
|
|
1016
|
-
size: 5,
|
|
1017
1014
|
label: toLocalizedString6(alternateTree.properties.label ?? alternateTree.id, t),
|
|
1018
1015
|
classNames: [
|
|
1019
1016
|
hoverableControlItem2,
|
|
@@ -1021,7 +1018,7 @@ var L1PanelHeader = ({ item, path, onBack }) => {
|
|
|
1021
1018
|
"pointer-fine:pli-1"
|
|
1022
1019
|
],
|
|
1023
1020
|
onClick: handleOpen
|
|
1024
|
-
})
|
|
1021
|
+
}), /* @__PURE__ */ React7.createElement(NavTreeItemColumns, {
|
|
1025
1022
|
open: true,
|
|
1026
1023
|
path,
|
|
1027
1024
|
item,
|
|
@@ -1088,7 +1085,7 @@ var L1PanelCollection = ({ item, path, ...props }) => {
|
|
|
1088
1085
|
|
|
1089
1086
|
// src/components/NavTree/NavTree.tsx
|
|
1090
1087
|
var NAV_TREE_ITEM = "NavTreeItem";
|
|
1091
|
-
var NavTree = ({ id, root, ...props }) => {
|
|
1088
|
+
var NavTree = /* @__PURE__ */ forwardRef3(({ id, root, ...props }, forwardedRef) => {
|
|
1092
1089
|
var _effect = _useSignals9();
|
|
1093
1090
|
try {
|
|
1094
1091
|
const { tab, useItems: useItems2, onBack } = useNavTreeContext();
|
|
@@ -1140,37 +1137,36 @@ var NavTree = ({ id, root, ...props }) => {
|
|
|
1140
1137
|
], [
|
|
1141
1138
|
id
|
|
1142
1139
|
]);
|
|
1143
|
-
return
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1140
|
+
return (
|
|
1141
|
+
// TODO(thure): `Tabs.Root` forces all items that should be able to receive focus to use `Tabs.Tab(Primitive)` since
|
|
1142
|
+
// it uses RovingFocus and doesn’t support moving focus to an item that is not a tab. Assess whether this situation
|
|
1143
|
+
// should change including whether it should motivate a change in the design/taxonomy, or if this means this should
|
|
1144
|
+
// not use `react-ui-tabs` at all.
|
|
1145
|
+
/* @__PURE__ */ React9.createElement(Tabs3.Root, {
|
|
1146
|
+
value: tab,
|
|
1147
|
+
orientation: "vertical",
|
|
1148
|
+
verticalVariant: "stateless",
|
|
1149
|
+
classNames: "relative",
|
|
1150
|
+
ref: forwardedRef
|
|
1151
|
+
}, /* @__PURE__ */ React9.createElement(L0Menu, {
|
|
1152
|
+
menuActions: topLevelActions,
|
|
1153
|
+
topLevelItems: l0Items,
|
|
1154
|
+
pinnedItems,
|
|
1155
|
+
userAccountItem,
|
|
1156
|
+
path,
|
|
1157
|
+
parent: root
|
|
1158
|
+
}), /* @__PURE__ */ React9.createElement(L1Tabs, {
|
|
1159
|
+
topLevelItems,
|
|
1160
|
+
path,
|
|
1161
|
+
currentItemId: tab,
|
|
1162
|
+
onBack,
|
|
1163
|
+
...props
|
|
1164
|
+
}))
|
|
1165
|
+
);
|
|
1162
1166
|
} finally {
|
|
1163
1167
|
_effect.f();
|
|
1164
1168
|
}
|
|
1165
|
-
};
|
|
1166
|
-
|
|
1167
|
-
// src/capabilities/index.ts
|
|
1168
|
-
import { lazy } from "@dxos/app-framework";
|
|
1169
|
-
var AppGraphBuilder = lazy(() => import("./app-graph-builder-5J4LRWDX.mjs"));
|
|
1170
|
-
var IntentResolver = lazy(() => import("./intent-resolver-3XYN2CBU.mjs"));
|
|
1171
|
-
var Keyboard2 = lazy(() => import("./keyboard-QRS6WOQH.mjs"));
|
|
1172
|
-
var ReactSurface = lazy(() => import("./react-surface-JSJ5SQX5.mjs"));
|
|
1173
|
-
var State = lazy(() => import("./state-54DY3DOY.mjs"));
|
|
1169
|
+
});
|
|
1174
1170
|
|
|
1175
1171
|
// src/components/NavTreeContainer.tsx
|
|
1176
1172
|
var NODE_TYPE = "dxos/app-graph/node";
|
|
@@ -1183,12 +1179,12 @@ var renderItemEnd = ({ node, open }) => /* @__PURE__ */ React10.createElement(Su
|
|
|
1183
1179
|
},
|
|
1184
1180
|
limit: 1
|
|
1185
1181
|
});
|
|
1186
|
-
var getChildrenFilter = (node) => untracked(() => !isActionLike2(node) && node.type !== PLANK_COMPANION_TYPE);
|
|
1182
|
+
var getChildrenFilter = (node) => untracked(() => !isActionLike2(node) && node.type !== PLANK_COMPANION_TYPE && node.properties.disposition !== "hidden");
|
|
1187
1183
|
var filterItems = (node, disposition) => {
|
|
1188
1184
|
if (!disposition && (node.properties.disposition === "hidden" || node.properties.disposition === "alternate-tree")) {
|
|
1189
1185
|
return false;
|
|
1190
1186
|
} else if (!disposition) {
|
|
1191
|
-
const action =
|
|
1187
|
+
const action = isAction3(node);
|
|
1192
1188
|
return !action || node.properties.disposition === "item";
|
|
1193
1189
|
} else {
|
|
1194
1190
|
return node.properties.disposition === disposition;
|
|
@@ -1203,31 +1199,47 @@ var useItems = (node, options) => {
|
|
|
1203
1199
|
const filtered = connections.filter((node2) => filterItems(node2, options?.disposition));
|
|
1204
1200
|
return options?.sort ? filtered.toSorted((a, b) => byPosition(a.properties, b.properties)) : filtered;
|
|
1205
1201
|
};
|
|
1206
|
-
var
|
|
1202
|
+
var useActions2 = (node) => {
|
|
1203
|
+
const { graph } = useAppGraph2();
|
|
1204
|
+
const actions = useGraphActions(graph, node.id);
|
|
1205
|
+
return useMemo6(() => actions.reduce((acc, arg) => {
|
|
1206
|
+
if (arg.properties.disposition === "item") {
|
|
1207
|
+
return acc;
|
|
1208
|
+
}
|
|
1209
|
+
acc.actions.push(arg);
|
|
1210
|
+
if (!isAction3(arg)) {
|
|
1211
|
+
const actionGroup = graph.getActions(arg.id);
|
|
1212
|
+
acc.groupedActions[arg.id] = actionGroup;
|
|
1213
|
+
}
|
|
1214
|
+
return acc;
|
|
1215
|
+
}, {
|
|
1216
|
+
actions: [],
|
|
1217
|
+
groupedActions: {}
|
|
1218
|
+
}), [
|
|
1219
|
+
actions
|
|
1220
|
+
]);
|
|
1221
|
+
};
|
|
1222
|
+
var NavTreeContainer$ = /* @__PURE__ */ forwardRef4(({ tab, popoverAnchorId, topbar }, forwardedRef) => {
|
|
1207
1223
|
var _effect = _useSignals10();
|
|
1208
1224
|
try {
|
|
1209
|
-
const [isLg] = useMediaQuery2("lg"
|
|
1210
|
-
ssr: false
|
|
1211
|
-
});
|
|
1225
|
+
const [isLg] = useMediaQuery2("lg");
|
|
1212
1226
|
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
1213
1227
|
const { graph } = useAppGraph2();
|
|
1214
1228
|
const { isOpen, isCurrent, isAlternateTree, setItem } = useCapability(NavTreeCapabilities.State);
|
|
1215
1229
|
const layout = useLayout();
|
|
1216
|
-
const { navigationSidebarState } = useSidebars(
|
|
1217
|
-
const getActions2 = useCallback3((node) => getActions(graph, node), [
|
|
1218
|
-
graph
|
|
1219
|
-
]);
|
|
1230
|
+
const { navigationSidebarState } = useSidebars(meta.id);
|
|
1220
1231
|
const getProps = useCallback3((node, path) => {
|
|
1221
1232
|
const children = getChildren(graph, node, path).filter(getChildrenFilter);
|
|
1222
1233
|
const parentOf = children.length > 0 ? children.map(({ id }) => id) : node.properties.role === "branch" ? [] : void 0;
|
|
1223
1234
|
return {
|
|
1224
1235
|
id: node.id,
|
|
1225
|
-
label: node.properties.label ?? node.id,
|
|
1226
1236
|
parentOf,
|
|
1227
|
-
icon: node.properties.icon,
|
|
1228
1237
|
disabled: node.properties.disabled,
|
|
1229
|
-
|
|
1238
|
+
label: node.properties.label ?? node.id,
|
|
1239
|
+
className: mx3(node.properties.className, node.properties.modified && "italic"),
|
|
1230
1240
|
headingClassName: node.properties.headingClassName,
|
|
1241
|
+
icon: node.properties.icon,
|
|
1242
|
+
iconHue: node.properties.iconHue,
|
|
1231
1243
|
testId: node.properties.testId
|
|
1232
1244
|
};
|
|
1233
1245
|
}, [
|
|
@@ -1276,14 +1288,20 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1276
1288
|
navigationSidebarState,
|
|
1277
1289
|
isLg
|
|
1278
1290
|
]);
|
|
1291
|
+
const blockInstruction = useCallback3(({ instruction, source, target }) => {
|
|
1292
|
+
return target.item.properties.blockInstruction?.(source, instruction) ?? false;
|
|
1293
|
+
}, []);
|
|
1279
1294
|
const canDrop = useCallback3(({ source, target }) => {
|
|
1280
1295
|
return target.item.properties.canDrop?.(source) ?? false;
|
|
1281
1296
|
}, []);
|
|
1297
|
+
const canSelect = useCallback3(({ item }) => {
|
|
1298
|
+
return item.properties.selectable ?? true;
|
|
1299
|
+
}, []);
|
|
1282
1300
|
const handleSelect = useCallback3(({ item: node, path, option }) => {
|
|
1283
1301
|
if (!node.data) {
|
|
1284
1302
|
return;
|
|
1285
1303
|
}
|
|
1286
|
-
if (
|
|
1304
|
+
if (isAction3(node)) {
|
|
1287
1305
|
const [parent] = graph.getConnections(node.id, "inbound");
|
|
1288
1306
|
void (parent && node.data({
|
|
1289
1307
|
parent,
|
|
@@ -1319,7 +1337,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1319
1337
|
}));
|
|
1320
1338
|
}
|
|
1321
1339
|
const defaultAction = graph.getActions(node.id).find((action) => action.properties?.disposition === "default");
|
|
1322
|
-
if (
|
|
1340
|
+
if (isAction3(defaultAction)) {
|
|
1323
1341
|
void defaultAction.data();
|
|
1324
1342
|
}
|
|
1325
1343
|
if (!isLg) {
|
|
@@ -1400,52 +1418,58 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1400
1418
|
setItem
|
|
1401
1419
|
]);
|
|
1402
1420
|
const navTreeContextValue = useMemo6(() => ({
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
loadDescendents,
|
|
1407
|
-
renderItemEnd,
|
|
1408
|
-
popoverAnchorId,
|
|
1409
|
-
topbar,
|
|
1421
|
+
blockInstruction,
|
|
1422
|
+
canDrop,
|
|
1423
|
+
canSelect,
|
|
1410
1424
|
getProps,
|
|
1425
|
+
isAlternateTree,
|
|
1411
1426
|
isCurrent,
|
|
1412
1427
|
isOpen,
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
setAlternateTree,
|
|
1416
|
-
onTabChange: handleTabChange,
|
|
1428
|
+
loadDescendents,
|
|
1429
|
+
onBack: handleBack,
|
|
1417
1430
|
onOpenChange: handleOpenChange,
|
|
1418
1431
|
onSelect: handleSelect,
|
|
1419
|
-
|
|
1420
|
-
}), [
|
|
1421
|
-
tab,
|
|
1422
|
-
getActions2,
|
|
1423
|
-
loadDescendents,
|
|
1424
|
-
renderItemEnd,
|
|
1432
|
+
onTabChange: handleTabChange,
|
|
1425
1433
|
popoverAnchorId,
|
|
1434
|
+
renderItemEnd,
|
|
1435
|
+
setAlternateTree,
|
|
1436
|
+
tab,
|
|
1426
1437
|
topbar,
|
|
1438
|
+
useActions: useActions2,
|
|
1439
|
+
useItems
|
|
1440
|
+
}), [
|
|
1441
|
+
blockInstruction,
|
|
1442
|
+
canDrop,
|
|
1443
|
+
canSelect,
|
|
1427
1444
|
getProps,
|
|
1445
|
+
handleBack,
|
|
1446
|
+
handleOpenChange,
|
|
1447
|
+
handleSelect,
|
|
1448
|
+
handleTabChange,
|
|
1449
|
+
isAlternateTree,
|
|
1428
1450
|
isCurrent,
|
|
1429
1451
|
isOpen,
|
|
1430
|
-
|
|
1431
|
-
|
|
1452
|
+
loadDescendents,
|
|
1453
|
+
popoverAnchorId,
|
|
1454
|
+
renderItemEnd,
|
|
1432
1455
|
setAlternateTree,
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
handleBack
|
|
1456
|
+
tab,
|
|
1457
|
+
topbar,
|
|
1458
|
+
useActions2
|
|
1437
1459
|
]);
|
|
1438
1460
|
return /* @__PURE__ */ React10.createElement(NavTreeContext.Provider, {
|
|
1439
1461
|
value: navTreeContextValue
|
|
1440
1462
|
}, /* @__PURE__ */ React10.createElement(NavTree, {
|
|
1441
1463
|
id: ROOT_ID,
|
|
1442
1464
|
root: graph.root,
|
|
1443
|
-
open: layout.sidebarOpen
|
|
1465
|
+
open: layout.sidebarOpen,
|
|
1466
|
+
ref: forwardedRef
|
|
1444
1467
|
}));
|
|
1445
1468
|
} finally {
|
|
1446
1469
|
_effect.f();
|
|
1447
1470
|
}
|
|
1448
1471
|
});
|
|
1472
|
+
var NavTreeContainer = /* @__PURE__ */ memo2(NavTreeContainer$);
|
|
1449
1473
|
|
|
1450
1474
|
export {
|
|
1451
1475
|
CommandsDialogContent,
|
|
@@ -1455,7 +1479,6 @@ export {
|
|
|
1455
1479
|
resolveMigrationOperation,
|
|
1456
1480
|
sortActions,
|
|
1457
1481
|
getChildren,
|
|
1458
|
-
getActions,
|
|
1459
1482
|
l0ItemType,
|
|
1460
1483
|
NODE_TYPE,
|
|
1461
1484
|
NavTreeContainer,
|
|
@@ -1466,4 +1489,4 @@ export {
|
|
|
1466
1489
|
ReactSurface,
|
|
1467
1490
|
State
|
|
1468
1491
|
};
|
|
1469
|
-
//# sourceMappingURL=chunk-
|
|
1492
|
+
//# sourceMappingURL=chunk-5DWDYPGQ.mjs.map
|