@dxos/plugin-navtree 0.8.2-main.2f9c567 → 0.8.2-main.30e4dbb

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.
Files changed (116) hide show
  1. package/dist/lib/browser/{chunk-FBQKXPOR.mjs → chunk-ZULGSU3L.mjs} +239 -204
  2. package/dist/lib/browser/chunk-ZULGSU3L.mjs.map +7 -0
  3. package/dist/lib/browser/index.mjs +2 -2
  4. package/dist/lib/browser/index.mjs.map +2 -2
  5. package/dist/lib/browser/{keyboard-IQXHKUWM.mjs → keyboard-2KXRP22I.mjs} +2 -2
  6. package/dist/lib/browser/{keyboard-IQXHKUWM.mjs.map → keyboard-2KXRP22I.mjs.map} +3 -3
  7. package/dist/lib/browser/meta.json +1 -1
  8. package/dist/lib/browser/{react-surface-FQEYRV4Q.mjs → react-surface-BVZN7664.mjs} +2 -2
  9. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
  10. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  11. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  12. package/dist/types/src/capabilities/keyboard.d.ts.map +1 -1
  13. package/dist/types/src/capabilities/state.d.ts.map +1 -1
  14. package/dist/types/src/components/CommandsDialog/CommandsDialog.d.ts.map +1 -0
  15. package/dist/types/src/components/CommandsDialog/CommandsTrigger.d.ts.map +1 -0
  16. package/dist/types/src/components/CommandsDialog/index.d.ts +3 -0
  17. package/dist/types/src/components/CommandsDialog/index.d.ts.map +1 -0
  18. package/dist/types/src/components/NavTree/NavTree.d.ts +8 -0
  19. package/dist/types/src/components/NavTree/NavTree.d.ts.map +1 -0
  20. package/dist/types/src/components/NavTree/NavTree.stories.d.ts +8 -0
  21. package/dist/types/src/components/NavTree/NavTree.stories.d.ts.map +1 -0
  22. package/dist/types/src/components/NavTree/index.d.ts +2 -0
  23. package/dist/types/src/components/NavTree/index.d.ts.map +1 -0
  24. package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
  25. package/dist/types/src/components/NavTreeContext.d.ts.map +1 -1
  26. package/dist/types/src/components/NavTreeDocumentTitle.d.ts.map +1 -1
  27. package/dist/types/src/components/{NavTreeItemAction.d.ts → NavTreeItem/NavTreeItemAction.d.ts} +2 -3
  28. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.d.ts.map +1 -0
  29. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts +8 -0
  30. package/dist/types/src/components/NavTreeItem/NavTreeItemAction.stories.d.ts.map +1 -0
  31. package/dist/types/src/components/{NavTreeItemColumns.d.ts → NavTreeItem/NavTreeItemColumns.d.ts} +1 -1
  32. package/dist/types/src/components/NavTreeItem/NavTreeItemColumns.d.ts.map +1 -0
  33. package/dist/types/src/components/NavTreeItem/index.d.ts +3 -0
  34. package/dist/types/src/components/NavTreeItem/index.d.ts.map +1 -0
  35. package/dist/types/src/components/Sidebar/L0Menu.d.ts +13 -0
  36. package/dist/types/src/components/Sidebar/L0Menu.d.ts.map +1 -0
  37. package/dist/types/src/components/Sidebar/L1Panel.d.ts +15 -0
  38. package/dist/types/src/components/Sidebar/L1Panel.d.ts.map +1 -0
  39. package/dist/types/src/components/Sidebar/index.d.ts +3 -0
  40. package/dist/types/src/components/Sidebar/index.d.ts.map +1 -0
  41. package/dist/types/src/components/{UserAccountAvatar.d.ts → UserAccountAvatar/UserAccountAvatar.d.ts} +1 -1
  42. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.d.ts.map +1 -0
  43. package/dist/types/src/components/{UserAccountAvatar.stories.d.ts → UserAccountAvatar/UserAccountAvatar.stories.d.ts} +1 -2
  44. package/dist/types/src/components/UserAccountAvatar/UserAccountAvatar.stories.d.ts.map +1 -0
  45. package/dist/types/src/components/UserAccountAvatar/index.d.ts +2 -0
  46. package/dist/types/src/components/UserAccountAvatar/index.d.ts.map +1 -0
  47. package/dist/types/src/components/index.d.ts +0 -1
  48. package/dist/types/src/components/index.d.ts.map +1 -1
  49. package/dist/types/src/components/types.d.ts +14 -15
  50. package/dist/types/src/components/types.d.ts.map +1 -1
  51. package/dist/types/src/experimental/Tree.d.ts.map +1 -1
  52. package/dist/types/src/hooks.d.ts.map +1 -1
  53. package/dist/types/src/testing/app-graph-builder.d.ts +11 -0
  54. package/dist/types/src/testing/app-graph-builder.d.ts.map +1 -0
  55. package/dist/types/src/testing/generator.d.ts +1 -0
  56. package/dist/types/src/testing/generator.d.ts.map +1 -1
  57. package/dist/types/src/testing/index.d.ts +1 -0
  58. package/dist/types/src/testing/index.d.ts.map +1 -1
  59. package/dist/types/src/testing/update-state.d.ts.map +1 -1
  60. package/dist/types/src/translations.d.ts +1 -1
  61. package/dist/types/src/util.d.ts +1 -1
  62. package/dist/types/src/util.d.ts.map +1 -1
  63. package/dist/types/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +32 -31
  65. package/src/capabilities/keyboard.ts +1 -1
  66. package/src/components/{CommandsDialog.tsx → CommandsDialog/CommandsDialog.tsx} +2 -2
  67. package/src/components/{CommandsTrigger.tsx → CommandsDialog/CommandsTrigger.tsx} +1 -1
  68. package/src/components/CommandsDialog/index.ts +6 -0
  69. package/src/components/NavTree/NavTree.stories.tsx +87 -0
  70. package/src/components/{NavTree.tsx → NavTree/NavTree.tsx} +24 -11
  71. package/src/components/NavTree/index.ts +5 -0
  72. package/src/components/NavTreeContainer.tsx +35 -16
  73. package/src/components/NavTreeContext.tsx +1 -1
  74. package/src/components/{NavTreeItemAction.stories.tsx → NavTreeItem/NavTreeItemAction.stories.tsx} +12 -6
  75. package/src/components/{NavTreeItemAction.tsx → NavTreeItem/NavTreeItemAction.tsx} +13 -14
  76. package/src/components/{NavTreeItemColumns.tsx → NavTreeItem/NavTreeItemColumns.tsx} +5 -5
  77. package/src/components/NavTreeItem/index.ts +6 -0
  78. package/src/components/{L0Menu.tsx → Sidebar/L0Menu.tsx} +182 -129
  79. package/src/components/{L1Panels.tsx → Sidebar/L1Panel.tsx} +29 -48
  80. package/src/components/Sidebar/index.ts +6 -0
  81. package/src/components/{UserAccountAvatar.stories.tsx → UserAccountAvatar/UserAccountAvatar.stories.tsx} +5 -5
  82. package/src/components/{UserAccountAvatar.tsx → UserAccountAvatar/UserAccountAvatar.tsx} +6 -6
  83. package/src/components/UserAccountAvatar/index.ts +5 -0
  84. package/src/components/index.ts +0 -1
  85. package/src/components/types.ts +13 -15
  86. package/src/testing/app-graph-builder.ts +158 -0
  87. package/src/testing/generator.ts +2 -1
  88. package/src/testing/index.ts +1 -0
  89. package/src/translations.ts +1 -1
  90. package/dist/lib/browser/chunk-FBQKXPOR.mjs.map +0 -7
  91. package/dist/types/src/components/CommandsDialog.d.ts.map +0 -1
  92. package/dist/types/src/components/CommandsTrigger.d.ts.map +0 -1
  93. package/dist/types/src/components/L0Menu.d.ts +0 -10
  94. package/dist/types/src/components/L0Menu.d.ts.map +0 -1
  95. package/dist/types/src/components/L1Panels.d.ts +0 -14
  96. package/dist/types/src/components/L1Panels.d.ts.map +0 -1
  97. package/dist/types/src/components/NavTree.d.ts +0 -5
  98. package/dist/types/src/components/NavTree.d.ts.map +0 -1
  99. package/dist/types/src/components/NavTree.stories.d.ts +0 -7
  100. package/dist/types/src/components/NavTree.stories.d.ts.map +0 -1
  101. package/dist/types/src/components/NavTreeItemAction.d.ts.map +0 -1
  102. package/dist/types/src/components/NavTreeItemAction.stories.d.ts +0 -41
  103. package/dist/types/src/components/NavTreeItemAction.stories.d.ts.map +0 -1
  104. package/dist/types/src/components/NavTreeItemColumns.d.ts.map +0 -1
  105. package/dist/types/src/components/UserAccountAvatar.d.ts.map +0 -1
  106. package/dist/types/src/components/UserAccountAvatar.stories.d.ts.map +0 -1
  107. package/dist/types/src/stories/Graph.stories.d.ts +0 -7
  108. package/dist/types/src/stories/Graph.stories.d.ts.map +0 -1
  109. package/dist/types/src/stories/StorybookNavTree.d.ts +0 -4
  110. package/dist/types/src/stories/StorybookNavTree.d.ts.map +0 -1
  111. package/src/components/NavTree.stories.tsx +0 -107
  112. package/src/stories/Graph.stories.tsx +0 -130
  113. package/src/stories/StorybookNavTree.tsx +0 -63
  114. /package/dist/lib/browser/{react-surface-FQEYRV4Q.mjs.map → react-surface-BVZN7664.mjs.map} +0 -0
  115. /package/dist/types/src/components/{CommandsDialog.d.ts → CommandsDialog/CommandsDialog.d.ts} +0 -0
  116. /package/dist/types/src/components/{CommandsTrigger.d.ts → CommandsDialog/CommandsTrigger.d.ts} +0 -0
@@ -7,7 +7,7 @@ import {
7
7
  NAVTREE_PLUGIN
8
8
  } from "./chunk-IEW3JD5C.mjs";
9
9
 
10
- // packages/plugins/plugin-navtree/src/components/CommandsDialog.tsx
10
+ // packages/plugins/plugin-navtree/src/components/CommandsDialog/CommandsDialog.tsx
11
11
  import React, { useMemo, useState } from "react";
12
12
  import { createIntent, LayoutAction, useAppGraph, useIntentDispatcher } from "@dxos/app-framework";
13
13
  import { isActionGroup, isAction } from "@dxos/app-graph";
@@ -81,7 +81,7 @@ var CommandsDialogContent = ({ selected: initial }) => {
81
81
  relation: "inbound"
82
82
  })[0];
83
83
  void (node && isAction(action) && action.data({
84
- node,
84
+ parent: node,
85
85
  caller: KEY_BINDING
86
86
  }));
87
87
  });
@@ -109,7 +109,7 @@ var CommandsDialogContent = ({ selected: initial }) => {
109
109
  }))));
110
110
  };
111
111
 
112
- // packages/plugins/plugin-navtree/src/components/CommandsTrigger.tsx
112
+ // packages/plugins/plugin-navtree/src/components/CommandsDialog/CommandsTrigger.tsx
113
113
  import { MagnifyingGlass } from "@phosphor-icons/react";
114
114
  import React2 from "react";
115
115
  import { createIntent as createIntent2, LayoutAction as LayoutAction2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
@@ -238,61 +238,28 @@ import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/ad
238
238
  import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
239
239
  import { untracked } from "@preact/signals-core";
240
240
  import React9, { memo as memo2, useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo5 } from "react";
241
- import { createIntent as createIntent4, LayoutAction as LayoutAction4, Surface, useAppGraph as useAppGraph2, useCapability, useIntentDispatcher as useIntentDispatcher4, useLayout as useLayout2 } from "@dxos/app-framework";
241
+ import { createIntent as createIntent3, LayoutAction as LayoutAction3, Surface, useAppGraph as useAppGraph2, useCapability, useIntentDispatcher as useIntentDispatcher3, useLayout } from "@dxos/app-framework";
242
242
  import { isAction as isAction4, isActionLike as isActionLike2 } from "@dxos/app-graph";
243
243
  import { PLANK_COMPANION_TYPE } from "@dxos/plugin-deck/types";
244
244
  import { isEchoObject, isSpace } from "@dxos/react-client/echo";
245
- import { useMediaQuery as useMediaQuery2 } from "@dxos/react-ui";
245
+ import { useMediaQuery as useMediaQuery2, useSidebars } from "@dxos/react-ui";
246
246
  import { isTreeData } from "@dxos/react-ui-list";
247
247
  import { mx as mx5 } from "@dxos/react-ui-theme";
248
248
  import { arrayMove as arrayMove2 } from "@dxos/util";
249
249
 
250
- // packages/plugins/plugin-navtree/src/components/NavTree.tsx
250
+ // packages/plugins/plugin-navtree/src/components/NavTree/NavTree.tsx
251
251
  import React8, { useMemo as useMemo4 } from "react";
252
252
  import { Tabs as Tabs3 } from "@dxos/react-ui-tabs";
253
253
  import { byPosition as byPosition2 } from "@dxos/util";
254
254
 
255
- // packages/plugins/plugin-navtree/src/components/L0Menu.tsx
256
- import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
257
- import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
258
- import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
259
- import { scrollJustEnoughIntoView } from "@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view";
260
- import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
261
- import React4, { useCallback, useLayoutEffect, useMemo as useMemo2, useRef, useState as useState2 } from "react";
262
- import { createIntent as createIntent3, LayoutAction as LayoutAction3, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
263
- import { invariant } from "@dxos/invariant";
264
- import { Popover, ScrollArea, toLocalizedString as toLocalizedString3, Tooltip, useMediaQuery, useSidebars, useTranslation as useTranslation4, ListItem, Icon as Icon2 } from "@dxos/react-ui";
265
- import { Tabs } from "@dxos/react-ui-tabs";
266
- import { mx as mx2 } from "@dxos/react-ui-theme";
267
- import { arrayMove, getFirstTwoRenderableChars } from "@dxos/util";
255
+ // packages/plugins/plugin-navtree/src/hooks.ts
256
+ import { useEffect as useEffect2 } from "react";
268
257
 
269
258
  // packages/plugins/plugin-navtree/src/components/NavTreeContext.tsx
270
259
  import { createContext, useContext } from "react";
271
260
  import { raise } from "@dxos/debug";
272
261
  var NavTreeContext = /* @__PURE__ */ createContext(null);
273
- var useNavTreeContext = () => useContext(NavTreeContext) ?? raise(new Error("NavTreeContext not found"));
274
-
275
- // packages/plugins/plugin-navtree/src/components/UserAccountAvatar.tsx
276
- import React3 from "react";
277
- import { Avatar } from "@dxos/react-ui";
278
- import { hexToFallback } from "@dxos/util";
279
- var UserAccountAvatar = (props) => {
280
- const fallbackValue = hexToFallback(props.userId ?? "0");
281
- return /* @__PURE__ */ React3.createElement("div", {
282
- className: "grid place-items-center",
283
- "data-joyride": "welcome/account"
284
- }, /* @__PURE__ */ React3.createElement(Avatar.Root, null, /* @__PURE__ */ React3.createElement(Avatar.Content, {
285
- variant: "circle",
286
- size: props.size ?? 12,
287
- status: props.status ?? "active",
288
- hue: props.hue || fallbackValue.hue,
289
- fallback: props.emoji || fallbackValue.emoji,
290
- "data-testid": "treeView.userAccount"
291
- })));
292
- };
293
-
294
- // packages/plugins/plugin-navtree/src/hooks.ts
295
- import { useEffect as useEffect2 } from "react";
262
+ var useNavTreeContext = () => useContext(NavTreeContext) ?? raise(new Error("Missing NavTreeContext"));
296
263
 
297
264
  // packages/plugins/plugin-navtree/src/components/NavTreeDocumentTitle.tsx
298
265
  import { useEffect } from "react";
@@ -324,32 +291,48 @@ var useLoadDescendents = (root) => {
324
291
  ]);
325
292
  };
326
293
 
327
- // packages/plugins/plugin-navtree/src/components/L0Menu.tsx
328
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-navtree/src/components/L0Menu.tsx";
294
+ // packages/plugins/plugin-navtree/src/components/Sidebar/L0Menu.tsx
295
+ import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
296
+ import { draggable, dropTargetForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
297
+ import { preserveOffsetOnSource } from "@atlaskit/pragmatic-drag-and-drop/element/preserve-offset-on-source";
298
+ import { scrollJustEnoughIntoView } from "@atlaskit/pragmatic-drag-and-drop/element/scroll-just-enough-into-view";
299
+ import { attachClosestEdge, extractClosestEdge } from "@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge";
300
+ import React4, { forwardRef, useCallback, useLayoutEffect, useMemo as useMemo2, useRef, useState as useState2 } from "react";
301
+ import { invariant } from "@dxos/invariant";
302
+ import { Icon as Icon2, IconButton, ListItem, ScrollArea, Tooltip, toLocalizedString as toLocalizedString3, useMediaQuery, useTranslation as useTranslation4 } from "@dxos/react-ui";
303
+ import { MenuProvider, DropdownMenu } from "@dxos/react-ui-menu";
304
+ import { Tabs } from "@dxos/react-ui-tabs";
305
+ import { mx as mx2 } from "@dxos/react-ui-theme";
306
+ import { arrayMove, getFirstTwoRenderableChars } from "@dxos/util";
307
+
308
+ // packages/plugins/plugin-navtree/src/components/UserAccountAvatar/UserAccountAvatar.tsx
309
+ import React3 from "react";
310
+ import { Avatar } from "@dxos/react-ui";
311
+ import { hexToFallback } from "@dxos/util";
312
+ var UserAccountAvatar = ({ size, userId, hue, emoji, status }) => {
313
+ const fallbackValue = hexToFallback(userId ?? "0");
314
+ return /* @__PURE__ */ React3.createElement("div", {
315
+ className: "grid place-items-center",
316
+ "data-joyride": "welcome/account"
317
+ }, /* @__PURE__ */ React3.createElement(Avatar.Root, null, /* @__PURE__ */ React3.createElement(Avatar.Content, {
318
+ variant: "circle",
319
+ size: size ?? 12,
320
+ status: status ?? "active",
321
+ hue: hue || fallbackValue.hue,
322
+ fallback: emoji || fallbackValue.emoji,
323
+ "data-testid": "treeView.userAccount"
324
+ })));
325
+ };
326
+
327
+ // packages/plugins/plugin-navtree/src/components/Sidebar/L0Menu.tsx
328
+ var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-navtree/src/components/Sidebar/L0Menu.tsx";
329
329
  var useL0ItemClick = ({ item, parent, path }, type) => {
330
- const { tab, onTabChange, onSelect, isCurrent } = useNavTreeContext();
331
- const { dispatchPromise: dispatch } = useIntentDispatcher3();
332
- const { navigationSidebarState } = useSidebars(NAVTREE_PLUGIN);
330
+ const { tab, isCurrent, onSelect, onTabChange } = useNavTreeContext();
333
331
  const [isLg] = useMediaQuery("lg", {
334
332
  ssr: false
335
333
  });
336
334
  return useCallback((event) => {
337
335
  switch (type) {
338
- case "tab":
339
- void dispatch(createIntent3(LayoutAction3.UpdateSidebar, {
340
- part: "sidebar",
341
- options: {
342
- state: item.id === tab ? navigationSidebarState === "expanded" ? isLg ? "collapsed" : "closed" : "expanded" : "expanded"
343
- }
344
- }));
345
- return onTabChange?.(item);
346
- case "link":
347
- return onSelect?.({
348
- item,
349
- path,
350
- current: !isCurrent(path, item),
351
- option: event.altKey
352
- });
353
336
  case "action": {
354
337
  const { data: invoke, properties: { caller } } = item;
355
338
  return invoke?.(caller ? {
@@ -359,26 +342,33 @@ var useL0ItemClick = ({ item, parent, path }, type) => {
359
342
  node: parent
360
343
  });
361
344
  }
345
+ case "tab":
346
+ return onTabChange?.(item);
347
+ case "link":
348
+ return onSelect?.({
349
+ item,
350
+ path,
351
+ current: !isCurrent(path, item),
352
+ option: event.altKey
353
+ });
362
354
  }
363
355
  }, [
364
356
  item,
365
- type,
366
- onSelect,
367
- isCurrent,
368
357
  parent,
358
+ type,
369
359
  tab,
370
- navigationSidebarState,
371
- isLg,
372
- dispatch
360
+ isCurrent,
361
+ onSelect,
362
+ onTabChange,
363
+ isLg
373
364
  ]);
374
365
  };
375
366
  var l0Breakpoints = {
376
367
  lg: "hidden lg:grid"
377
368
  };
378
- var L0Item = ({ item, parent, path, pinned, userAccount, onRearrange }) => {
379
- const { t } = useTranslation4(NAVTREE_PLUGIN);
380
- const itemElement = useRef(null);
381
- const [closestEdge, setEdge] = useState2(null);
369
+ var L0ItemRoot = /* @__PURE__ */ forwardRef(({ item, parent, path, children }, forwardedRef) => {
370
+ const { getProps } = useNavTreeContext();
371
+ const { id, testId } = getProps?.(item, path) ?? {};
382
372
  const type = l0ItemType(item);
383
373
  const itemPath = useMemo2(() => [
384
374
  ...path,
@@ -387,13 +377,12 @@ var L0Item = ({ item, parent, path, pinned, userAccount, onRearrange }) => {
387
377
  item.id,
388
378
  path
389
379
  ]);
390
- const { getProps, popoverAnchorId } = useNavTreeContext();
391
- const { id, testId } = getProps?.(item, path) ?? {};
392
- const Root = type === "collection" ? "h2" : type === "tab" ? Tabs.TabPrimitive : "button";
380
+ const { t } = useTranslation4(NAVTREE_PLUGIN);
381
+ const localizedString = toLocalizedString3(item.properties.label, t);
393
382
  const handleClick = useL0ItemClick({
394
383
  item,
395
- path: itemPath,
396
- parent
384
+ parent,
385
+ path: itemPath
397
386
  }, type);
398
387
  const rootProps = type === "tab" ? {
399
388
  value: item.id,
@@ -408,13 +397,47 @@ var L0Item = ({ item, parent, path, pinned, userAccount, onRearrange }) => {
408
397
  } : {
409
398
  onClick: handleClick
410
399
  };
411
- const localizedString = toLocalizedString3(item.properties.label, t);
400
+ const Root = type === "collection" ? "h2" : type === "tab" ? Tabs.TabPrimitive : "button";
401
+ return /* @__PURE__ */ React4.createElement(Tooltip.Trigger, {
402
+ asChild: true,
403
+ delayDuration: 0,
404
+ side: "right",
405
+ content: localizedString
406
+ }, /* @__PURE__ */ React4.createElement(Root, {
407
+ ...rootProps,
408
+ "data-type": type,
409
+ className: mx2('group/l0item flex w-full justify-center items-center relative data[type!="collection"]:cursor-pointer app-no-drag dx-focus-ring-group', l0Breakpoints[item.properties.l0Breakpoint]),
410
+ ref: forwardedRef
411
+ }, children));
412
+ });
413
+ var L0Avator = ({ item }) => {
414
+ const { t } = useTranslation4(NAVTREE_PLUGIN);
415
+ const type = l0ItemType(item);
412
416
  const hue = item.properties.hue ?? null;
417
+ const hueFgStyle = hue && {
418
+ style: {
419
+ color: `var(--dx-${hue}SurfaceText)`
420
+ }
421
+ };
422
+ const localizedString = toLocalizedString3(item.properties.label, t);
413
423
  const avatarValue = useMemo2(() => type === "tab" ? getFirstTwoRenderableChars(localizedString).join("").toUpperCase() : [], [
414
424
  type,
415
425
  item.properties.label,
416
426
  t
417
427
  ]);
428
+ return /* @__PURE__ */ React4.createElement("span", {
429
+ role: "img",
430
+ className: "place-self-center text-xl font-light",
431
+ ...hueFgStyle
432
+ }, avatarValue);
433
+ };
434
+ var L0Item = ({ item, parent, path, pinned, onRearrange }) => {
435
+ const { t } = useTranslation4(NAVTREE_PLUGIN);
436
+ const itemElement = useRef(null);
437
+ const [closestEdge, setEdge] = useState2(null);
438
+ const type = l0ItemType(item);
439
+ const localizedString = toLocalizedString3(item.properties.label, t);
440
+ const hue = item.properties.hue ?? null;
418
441
  const hueFgStyle = hue && {
419
442
  style: {
420
443
  color: `var(--dx-${hue}SurfaceText)`
@@ -488,20 +511,19 @@ var L0Item = ({ item, parent, path, pinned, userAccount, onRearrange }) => {
488
511
  item,
489
512
  onRearrange
490
513
  ]);
491
- const l0ItemTrigger = /* @__PURE__ */ React4.createElement(Root, {
492
- ...rootProps,
493
- "data-type": type,
494
- className: mx2('group/l0i dx-focus-ring-group grid relative data[type!="collection"]:cursor-pointer app-no-drag', l0Breakpoints[item.properties.l0Breakpoint]),
495
- ref: itemElement
496
- }, userAccount ? /* @__PURE__ */ React4.createElement(UserAccountAvatar, {
497
- userId: item.properties.userId,
498
- hue: item.properties.hue,
499
- emoji: item.properties.emoji,
500
- status: item.properties.status
501
- }) : /* @__PURE__ */ React4.createElement("div", {
514
+ return /* @__PURE__ */ React4.createElement(L0ItemRoot, {
515
+ ref: itemElement,
516
+ item,
517
+ parent,
518
+ path
519
+ }, /* @__PURE__ */ React4.createElement("div", {
502
520
  role: "none",
503
521
  "data-frame": true,
504
- className: mx2("absolute grid dx-focus-ring-group-indicator transition-colors", type === "tab" || pinned ? "rounded" : "rounded-full", pinned ? "bg-transparent group-hover/l0i:bg-groupSurface inset-inline-3 inset-block-0.5" : "bg-groupSurface inset-inline-3 inset-block-2"),
522
+ className: mx2(
523
+ "flex justify-center items-center dx-focus-ring-group-indicator transition-colors rounded",
524
+ // TODO(burdon): Create reusable button/component and/or create var for size.
525
+ pinned ? "bg-transparent w-[50px] p-2 group-hover/l0item:bg-groupSurface" : "bg-groupSurface w-[50px] h-[50px]"
526
+ ),
505
527
  ...hue && {
506
528
  style: {
507
529
  background: `var(--dx-${hue}Surface)`
@@ -509,38 +531,21 @@ var L0Item = ({ item, parent, path, pinned, userAccount, onRearrange }) => {
509
531
  }
510
532
  }, item.properties.icon && /* @__PURE__ */ React4.createElement(Icon2, {
511
533
  icon: item.properties.icon,
512
- size: pinned ? 5 : 7,
513
- classNames: "place-self-center",
514
- ...hueFgStyle
515
- }) || (type === "tab" && item.properties.disposition !== "pin-end" ? /* @__PURE__ */ React4.createElement("span", {
516
- role: "img",
517
- className: "place-self-center text-3xl font-light",
518
- ...hueFgStyle
519
- }, avatarValue) : item.properties.icon && /* @__PURE__ */ React4.createElement(Icon2, {
520
- icon: "ph--planet--regular",
521
- size: pinned ? 5 : 7,
522
- classNames: "place-self-center",
534
+ size: pinned ? 5 : 6,
523
535
  ...hueFgStyle
524
- }))), /* @__PURE__ */ React4.createElement("div", {
536
+ }) || type === "tab" && item.properties.disposition !== "pin-end" && /* @__PURE__ */ React4.createElement(L0Avator, {
537
+ item
538
+ })), /* @__PURE__ */ React4.createElement("div", {
525
539
  role: "none",
526
- className: "hidden group-aria-selected/l0i:block absolute inline-start-0 inset-block-4 is-1 bg-accentSurface rounded-ie"
540
+ className: "hidden group-aria-selected/l0item:block absolute inline-start-0 inset-block-4 is-1 bg-accentSurface rounded-ie"
527
541
  }), /* @__PURE__ */ React4.createElement("span", {
528
542
  id: `${item.id}__label`,
529
543
  className: "sr-only"
530
544
  }, localizedString), onRearrange && closestEdge && /* @__PURE__ */ React4.createElement(ListItem.DropIndicator, {
531
545
  edge: closestEdge
532
546
  }));
533
- return popoverAnchorId === id ? /* @__PURE__ */ React4.createElement(Popover.Anchor, {
534
- asChild: true
535
- }, l0ItemTrigger) : /* @__PURE__ */ React4.createElement(Tooltip.Root, {
536
- delayDuration: 0
537
- }, /* @__PURE__ */ React4.createElement(Tooltip.Trigger, {
538
- asChild: true
539
- }, l0ItemTrigger), /* @__PURE__ */ React4.createElement(Tooltip.Portal, null, /* @__PURE__ */ React4.createElement(Tooltip.Content, {
540
- side: "right"
541
- }, localizedString, /* @__PURE__ */ React4.createElement(Tooltip.Arrow, null))));
542
547
  };
543
- var L0Collection = ({ item, path, parent }) => {
548
+ var L0Collection = ({ item, path }) => {
544
549
  const navTreeContext = useNavTreeContext();
545
550
  useLoadDescendents(item);
546
551
  const collectionItems = navTreeContext.getItems(item);
@@ -555,7 +560,7 @@ var L0Collection = ({ item, path, parent }) => {
555
560
  const handleRearrange = useCallback((source, target, closestEdge) => {
556
561
  invariant(item.properties.onRearrangeChildren, void 0, {
557
562
  F: __dxlog_file,
558
- L: 256,
563
+ L: 266,
559
564
  S: void 0,
560
565
  A: [
561
566
  "item.properties.onRearrangeChildren",
@@ -589,12 +594,35 @@ var L0Collection = ({ item, path, parent }) => {
589
594
  }
590
595
  })));
591
596
  };
592
- var L0Menu = ({ topLevelItems, pinnedItems, userAccountItem, parent, path }) => {
597
+ var L0Menu = ({ menuActions, topLevelItems, pinnedItems, userAccountItem, parent, path }) => {
598
+ const { t } = useTranslation4(NAVTREE_PLUGIN);
593
599
  return /* @__PURE__ */ React4.createElement(Tabs.Tablist, {
594
- classNames: "group/l0 absolute z-[1] inset-block-0 inline-start-0 rounded-is-lg grid grid-cols-[var(--l0-size)] grid-rows-[1fr_min-content_var(--l0-size)] contain-layout !is-[--l0-size] bg-baseSurface border-ie border-separator app-drag pbe-[env(safe-area-inset-bottom)]"
595
- }, /* @__PURE__ */ React4.createElement(ScrollArea.Root, null, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React4.createElement("div", {
600
+ classNames: [
601
+ "group/l0 absolute z-[1] inset-block-0 inline-start-0 rounded-is-lg",
602
+ "grid grid-cols-[var(--l0-size)] grid-rows-[var(--rail-size)_1fr_min-content_var(--l0-size)] gap-1 contain-layout",
603
+ "!is-[--l0-size] bg-baseSurface border-ie border-separator app-drag pbe-[env(safe-area-inset-bottom)]"
604
+ ]
605
+ }, /* @__PURE__ */ React4.createElement("div", {
606
+ role: "none",
607
+ className: "flex justify-center p-1"
608
+ }, /* @__PURE__ */ React4.createElement(MenuProvider, null, /* @__PURE__ */ React4.createElement(DropdownMenu.Root, {
609
+ group: parent,
610
+ items: menuActions
611
+ }, /* @__PURE__ */ React4.createElement(DropdownMenu.Trigger, {
612
+ asChild: true
613
+ }, /* @__PURE__ */ React4.createElement(IconButton, {
614
+ iconOnly: true,
615
+ icon: "ph--dots-three--regular",
616
+ size: 5,
617
+ label: t("app menu label"),
618
+ classNames: "w-[50px] _bg-primary-500"
619
+ }))))), /* @__PURE__ */ React4.createElement(ScrollArea.Root, null, /* @__PURE__ */ React4.createElement(ScrollArea.Viewport, null, /* @__PURE__ */ React4.createElement("div", {
596
620
  role: "none",
597
- className: 'grid auto-rows-[calc(var(--l0-size)-.5rem)] plb-1 [body[data-platform="darwin"]_&]:pbs-[calc(30px+0.25rem)] [body[data-platform="ios"]_&]:pbs-[max(env(safe-area-inset-top),0.25rem)]'
621
+ className: mx2([
622
+ "flex flex-col gap-2",
623
+ '[body[data-platform="darwin"]_&]:pbs-[calc(30px+0.25rem)]',
624
+ '[body[data-platform="ios"]_&]:pbs-[max(env(safe-area-inset-top),0.25rem)]'
625
+ ])
598
626
  }, topLevelItems.map((item) => {
599
627
  if (l0ItemType(item) === "collection") {
600
628
  return /* @__PURE__ */ React4.createElement(L0Collection, {
@@ -624,14 +652,19 @@ var L0Menu = ({ topLevelItems, pinnedItems, userAccountItem, parent, path }) =>
624
652
  pinned: true
625
653
  }))), userAccountItem && /* @__PURE__ */ React4.createElement("div", {
626
654
  role: "none",
627
- className: "grid py-2 app-no-drag"
628
- }, /* @__PURE__ */ React4.createElement(L0Item, {
655
+ className: "grid app-no-drag"
656
+ }, /* @__PURE__ */ React4.createElement(L0ItemRoot, {
629
657
  key: userAccountItem.id,
630
658
  item: userAccountItem,
631
659
  parent,
632
- path,
633
- userAccount: true
634
- })), /* @__PURE__ */ React4.createElement("div", {
660
+ path
661
+ }, /* @__PURE__ */ React4.createElement(UserAccountAvatar, {
662
+ userId: userAccountItem.properties.userId,
663
+ hue: userAccountItem.properties.hue,
664
+ emoji: userAccountItem.properties.emoji,
665
+ status: userAccountItem.properties.status,
666
+ size: 11
667
+ }))), /* @__PURE__ */ React4.createElement("div", {
635
668
  role: "none",
636
669
  className: 'hidden [body[data-platform="darwin"]_&]:block absolute block-start-0 is-[calc(var(--l0-size)-1px)] bs-[calc(40px+0.25rem)]',
637
670
  style: {
@@ -640,24 +673,18 @@ var L0Menu = ({ topLevelItems, pinnedItems, userAccountItem, parent, path }) =>
640
673
  }));
641
674
  };
642
675
 
643
- // packages/plugins/plugin-navtree/src/components/L1Panels.tsx
676
+ // packages/plugins/plugin-navtree/src/components/Sidebar/L1Panel.tsx
644
677
  import React7, { useCallback as useCallback2, useMemo as useMemo3 } from "react";
645
- import { useLayout } from "@dxos/app-framework";
646
- import { Button as Button3, Icon as Icon3, IconButton as IconButton2, toLocalizedString as toLocalizedString6, useTranslation as useTranslation7 } from "@dxos/react-ui";
678
+ import { Button as Button3, Icon as Icon3, IconButton as IconButton3, toLocalizedString as toLocalizedString6, useTranslation as useTranslation7 } from "@dxos/react-ui";
647
679
  import { Tree } from "@dxos/react-ui-list";
648
680
  import { Tabs as Tabs2 } from "@dxos/react-ui-tabs";
649
681
  import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem as hoverableOpenControlItem2, mx as mx4 } from "@dxos/react-ui-theme";
650
682
  import { byPosition } from "@dxos/util";
651
683
 
652
- // packages/plugins/plugin-navtree/src/components/NavTreeItemColumns.tsx
653
- import React6, { Fragment, memo } from "react";
654
- import { isAction as isAction3 } from "@dxos/app-graph";
655
- import { DensityProvider, Popover as Popover2, toLocalizedString as toLocalizedString5, Treegrid, useTranslation as useTranslation6 } from "@dxos/react-ui";
656
-
657
- // packages/plugins/plugin-navtree/src/components/NavTreeItemAction.tsx
684
+ // packages/plugins/plugin-navtree/src/components/NavTreeItem/NavTreeItemAction.tsx
658
685
  import React5, { useRef as useRef2 } from "react";
659
- import { useTranslation as useTranslation5, toLocalizedString as toLocalizedString4, IconButton, useDensityContext } from "@dxos/react-ui";
660
- import { DropdownMenu, MenuProvider } from "@dxos/react-ui-menu";
686
+ import { useTranslation as useTranslation5, toLocalizedString as toLocalizedString4, IconButton as IconButton2, useDensityContext } from "@dxos/react-ui";
687
+ import { DropdownMenu as DropdownMenu2, MenuProvider as MenuProvider2 } from "@dxos/react-ui-menu";
661
688
  import { hoverableControlItem, hoverableOpenControlItem, mx as mx3 } from "@dxos/react-ui-theme";
662
689
  var fallbackIcon = "ph--placeholder--regular";
663
690
  var fineActionButtonProps = {
@@ -668,18 +695,18 @@ var coarseActionButtonProps = {
668
695
  size: 5,
669
696
  density: "coarse"
670
697
  };
671
- var NavTreeItemActionDropdownMenu = ({ label, icon, testId, menuActions, onAction }) => {
698
+ var NavTreeItemActionDropdownMenu = ({ parent, label, icon, testId, menuActions, caller }) => {
672
699
  const { t } = useTranslation5(NAVTREE_PLUGIN);
673
700
  const suppressNextTooltip = useRef2(false);
674
701
  const density = useDensityContext();
675
- return /* @__PURE__ */ React5.createElement(MenuProvider, {
676
- onAction
677
- }, /* @__PURE__ */ React5.createElement(DropdownMenu.Root, {
702
+ return /* @__PURE__ */ React5.createElement(MenuProvider2, null, /* @__PURE__ */ React5.createElement(DropdownMenu2.Root, {
703
+ group: parent,
678
704
  items: menuActions,
705
+ caller,
679
706
  suppressNextTooltip
680
- }, /* @__PURE__ */ React5.createElement(DropdownMenu.Trigger, {
707
+ }, /* @__PURE__ */ React5.createElement(DropdownMenu2.Trigger, {
681
708
  asChild: true
682
- }, /* @__PURE__ */ React5.createElement(IconButton, {
709
+ }, /* @__PURE__ */ React5.createElement(IconButton2, {
683
710
  ...density === "coarse" ? coarseActionButtonProps : fineActionButtonProps,
684
711
  classNames: mx3("shrink-0 pli-2 pointer-fine:pli-1", hoverableControlItem, hoverableOpenControlItem),
685
712
  variant: "ghost",
@@ -694,7 +721,7 @@ var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, tes
694
721
  label: "never"
695
722
  }, data: invoke, baseLabel }) => {
696
723
  const density = useDensityContext();
697
- return /* @__PURE__ */ React5.createElement(IconButton, {
724
+ return /* @__PURE__ */ React5.createElement(IconButton2, {
698
725
  ...density === "coarse" ? coarseActionButtonProps : fineActionButtonProps,
699
726
  variant,
700
727
  classNames: mx3("shrink-0", hoverableControlItem, hoverableOpenControlItem, iconOnly ? "pli-2 pointer-fine:pli-1" : "p-2 pointer-fine:p-2 mie-1"),
@@ -708,10 +735,10 @@ var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, tes
708
735
  }
709
736
  event.stopPropagation();
710
737
  void invoke?.(caller ? {
711
- node: parent,
738
+ parent,
712
739
  caller
713
740
  } : {
714
- node: parent
741
+ parent
715
742
  });
716
743
  },
717
744
  "data-testid": testId
@@ -729,17 +756,14 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
729
756
  ...props,
730
757
  label: baseLabel,
731
758
  parent: node,
732
- menuActions,
733
- onAction: (action) => action.data?.(props.caller ? {
734
- node,
735
- caller: props.caller
736
- } : {
737
- node
738
- })
759
+ menuActions
739
760
  });
740
761
  };
741
762
 
742
- // packages/plugins/plugin-navtree/src/components/NavTreeItemColumns.tsx
763
+ // packages/plugins/plugin-navtree/src/components/NavTreeItem/NavTreeItemColumns.tsx
764
+ import React6, { Fragment, memo } from "react";
765
+ import { isAction as isAction3 } from "@dxos/app-graph";
766
+ import { DensityProvider, Popover, toLocalizedString as toLocalizedString5, Treegrid, useTranslation as useTranslation6 } from "@dxos/react-ui";
743
767
  var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fine" }) => {
744
768
  const { t } = useTranslation6(NAVTREE_PLUGIN);
745
769
  const { getActions: getActions2, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
@@ -749,7 +773,7 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fi
749
773
  const actions = (primaryAction?.properties?.disposition === "list-item-primary" ? secondaryActions : _actions).flatMap((action) => isAction3(action) ? [
750
774
  action
751
775
  ] : []).filter((action) => !action.properties?.hidden);
752
- const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover2.Anchor : Fragment;
776
+ const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover.Anchor : Fragment;
753
777
  useLoadDescendents(item);
754
778
  useLoadDescendents(primaryAction && !isAction3(primaryAction) ? primaryAction : void 0);
755
779
  return /* @__PURE__ */ React6.createElement(DensityProvider, {
@@ -782,10 +806,9 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fi
782
806
  })));
783
807
  });
784
808
 
785
- // packages/plugins/plugin-navtree/src/components/L1Panels.tsx
786
- var headingBackButtonLabel = "absolute inset-0 min-is-0 truncate flex items-center pis-6 transition-[transform,opacity] ease-in-out duration-200";
809
+ // packages/plugins/plugin-navtree/src/components/Sidebar/L1Panel.tsx
810
+ var headingBackButtonLabel = "absolute inset-0 min-is-0 truncate flex items-center pis-6";
787
811
  var HeadingBackButton = ({ title, onClick }) => {
788
- const { t } = useTranslation7(NAVTREE_PLUGIN);
789
812
  return /* @__PURE__ */ React7.createElement(Button3, {
790
813
  variant: "ghost",
791
814
  classNames: "pli-1 flex-1 relative group text-start justify-start bs-[--rail-action] font-normal",
@@ -794,13 +817,10 @@ var HeadingBackButton = ({ title, onClick }) => {
794
817
  icon: "ph--caret-left--bold",
795
818
  size: 3
796
819
  }), /* @__PURE__ */ React7.createElement("span", {
797
- className: mx4(headingBackButtonLabel, "translate-y-2 opacity-0 group-hover:translate-y-0 group-hover:opacity-100 group-focus:translate-y-0 group-focus:opacity-100")
798
- }, t("back label")), /* @__PURE__ */ React7.createElement("span", {
799
- className: mx4(headingBackButtonLabel, "translate-y-0 opacity-100 group-hover:-translate-y-2 group-hover:opacity-0 group-focus:-translate-y-2 group-focus:opacity-0")
820
+ className: mx4(headingBackButtonLabel)
800
821
  }, title));
801
822
  };
802
- var L1Panel = ({ item, path, currentItemId, onBack }) => {
803
- const layout = useLayout();
823
+ var L1Panel = ({ open, item, path, currentItemId, onBack }) => {
804
824
  const { isAlternateTree, setAlternateTree, ...navTreeContext } = useNavTreeContext();
805
825
  const { t } = useTranslation7(NAVTREE_PLUGIN);
806
826
  const alternateTree = navTreeContext.getItems(item, "alternate-tree")[0];
@@ -844,12 +864,14 @@ var L1Panel = ({ item, path, currentItemId, onBack }) => {
844
864
  key: item.id,
845
865
  value: item.id,
846
866
  classNames: [
847
- "absolute inset-block-0 inline-end-0 is-[calc(100%-var(--l0-size))] lg:is-[--l1-size] grid-cols-1 grid-rows-[var(--rail-size)_1fr] pbs-[env(safe-area-inset-top)]",
867
+ "absolute inset-block-0 inline-end-0",
868
+ "is-[calc(100%-var(--l0-size))] lg:is-[--l1-size] grid-cols-1 grid-rows-[var(--rail-size)_1fr]",
869
+ "pbs-[env(safe-area-inset-top)]",
848
870
  item.id === currentItemId && "grid"
849
871
  ],
850
872
  tabIndex: -1,
851
873
  "aria-label": title,
852
- ...!layout.sidebarOpen && {
874
+ ...!open && {
853
875
  inert: "true"
854
876
  }
855
877
  }, item.id === currentItemId && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("h2", {
@@ -859,7 +881,7 @@ var L1Panel = ({ item, path, currentItemId, onBack }) => {
859
881
  onClick: handleBack
860
882
  }) : /* @__PURE__ */ React7.createElement("span", {
861
883
  className: "flex-1 truncate min-is-0 pis-6"
862
- }, title), alternateTree && !isAlternate && /* @__PURE__ */ React7.createElement(IconButton2, {
884
+ }, title), alternateTree && !isAlternate && /* @__PURE__ */ React7.createElement(IconButton3, {
863
885
  variant: "ghost",
864
886
  classNames: mx4("shrink-0", hoverableControlItem2, hoverableOpenControlItem2, "pli-2 pointer-fine:pli-1"),
865
887
  iconOnly: true,
@@ -897,7 +919,7 @@ var L1Panel = ({ item, path, currentItemId, onBack }) => {
897
919
  renderColumns: NavTreeItemColumns
898
920
  }))));
899
921
  };
900
- var L1PanelCollection = ({ item, path, currentItemId }) => {
922
+ var L1PanelCollection = ({ item, path, ...props }) => {
901
923
  const { getItems } = useNavTreeContext();
902
924
  useLoadDescendents(item);
903
925
  const collectionItems = getItems(item);
@@ -912,10 +934,10 @@ var L1PanelCollection = ({ item, path, currentItemId }) => {
912
934
  key: item2.id,
913
935
  item: item2,
914
936
  path: groupPath,
915
- currentItemId
937
+ ...props
916
938
  })));
917
939
  };
918
- var L1Panels = ({ topLevelItems, path, currentItemId, onBack }) => {
940
+ var L1Panels = ({ topLevelItems, onBack, ...props }) => {
919
941
  return /* @__PURE__ */ React7.createElement(React7.Fragment, null, topLevelItems.map((item) => {
920
942
  const type = l0ItemType(item);
921
943
  switch (type) {
@@ -923,15 +945,13 @@ var L1Panels = ({ topLevelItems, path, currentItemId, onBack }) => {
923
945
  return /* @__PURE__ */ React7.createElement(L1PanelCollection, {
924
946
  key: item.id,
925
947
  item,
926
- path,
927
- currentItemId
948
+ ...props
928
949
  });
929
950
  case "tab":
930
951
  return /* @__PURE__ */ React7.createElement(L1Panel, {
931
952
  key: item.id,
932
953
  item,
933
- path,
934
- currentItemId,
954
+ ...props,
935
955
  onBack
936
956
  });
937
957
  default:
@@ -940,21 +960,20 @@ var L1Panels = ({ topLevelItems, path, currentItemId, onBack }) => {
940
960
  }));
941
961
  };
942
962
 
943
- // packages/plugins/plugin-navtree/src/components/NavTree.tsx
963
+ // packages/plugins/plugin-navtree/src/components/NavTree/NavTree.tsx
944
964
  var NAV_TREE_ITEM = "NavTreeItem";
945
- var NavTree = ({ id, root }) => {
965
+ var NavTree = ({ id, root, ...props }) => {
946
966
  const { tab, getItems, onBack } = useNavTreeContext();
947
- const topLevelActions = getItems(root, "item").toSorted((a, b) => byPosition2(a.properties, b.properties));
967
+ const topLevelActions = getItems(root, "menu").toSorted((a, b) => byPosition2(a.properties, b.properties));
948
968
  const topLevelCollections = getItems(root, "collection");
949
969
  const topLevelWorkspaces = getItems(root, "workspace");
950
970
  const topLevelNavigation = getItems(root, "navigation");
951
971
  const l0Items = useMemo4(() => [
952
- ...topLevelActions,
972
+ // prettier-ignore
953
973
  ...topLevelCollections,
954
974
  ...topLevelWorkspaces,
955
975
  ...topLevelNavigation
956
976
  ], [
957
- topLevelActions,
958
977
  topLevelCollections,
959
978
  topLevelWorkspaces,
960
979
  topLevelNavigation
@@ -962,9 +981,12 @@ var NavTree = ({ id, root }) => {
962
981
  const pinnedItems = getItems(root, "pin-end").toSorted((a, b) => byPosition2(a.properties, b.properties));
963
982
  const userAccountItem = getItems(root, "user-account")[0];
964
983
  const topLevelItems = useMemo4(() => [
984
+ // prettier-ignore
965
985
  ...l0Items,
966
986
  ...pinnedItems,
967
- userAccountItem
987
+ ...userAccountItem ? [
988
+ userAccountItem
989
+ ] : []
968
990
  ], [
969
991
  l0Items,
970
992
  pinnedItems,
@@ -984,6 +1006,7 @@ var NavTree = ({ id, root }) => {
984
1006
  verticalVariant: "stateless",
985
1007
  classNames: "relative"
986
1008
  }, /* @__PURE__ */ React8.createElement(L0Menu, {
1009
+ menuActions: topLevelActions,
987
1010
  topLevelItems: l0Items,
988
1011
  pinnedItems,
989
1012
  userAccountItem,
@@ -993,7 +1016,8 @@ var NavTree = ({ id, root }) => {
993
1016
  topLevelItems,
994
1017
  path,
995
1018
  currentItemId: tab,
996
- onBack
1019
+ onBack,
1020
+ ...props
997
1021
  }))
998
1022
  );
999
1023
  };
@@ -1002,8 +1026,8 @@ var NavTree = ({ id, root }) => {
1002
1026
  import { lazy } from "@dxos/app-framework";
1003
1027
  var AppGraphBuilder = lazy(() => import("./app-graph-builder-26D3MUCA.mjs"));
1004
1028
  var IntentResolver = lazy(() => import("./intent-resolver-XCABZFA6.mjs"));
1005
- var Keyboard2 = lazy(() => import("./keyboard-IQXHKUWM.mjs"));
1006
- var ReactSurface = lazy(() => import("./react-surface-FQEYRV4Q.mjs"));
1029
+ var Keyboard2 = lazy(() => import("./keyboard-2KXRP22I.mjs"));
1030
+ var ReactSurface = lazy(() => import("./react-surface-BVZN7664.mjs"));
1007
1031
  var State = lazy(() => import("./state-EW62QYEN.mjs"));
1008
1032
 
1009
1033
  // packages/plugins/plugin-navtree/src/components/NavTreeContainer.tsx
@@ -1022,10 +1046,11 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1022
1046
  const [isLg] = useMediaQuery2("lg", {
1023
1047
  ssr: false
1024
1048
  });
1025
- const { dispatchPromise: dispatch } = useIntentDispatcher4();
1049
+ const { dispatchPromise: dispatch } = useIntentDispatcher3();
1026
1050
  const { graph } = useAppGraph2();
1027
- const layout = useLayout2();
1028
1051
  const { isOpen, isCurrent, isAlternateTree, setItem } = useCapability(NavTreeCapabilities.State);
1052
+ const layout = useLayout();
1053
+ const { navigationSidebarState } = useSidebars(NAVTREE_PLUGIN);
1029
1054
  const getActions2 = useCallback3((node) => getActions(graph, node), [
1030
1055
  graph
1031
1056
  ]);
@@ -1077,7 +1102,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1077
1102
  }, [
1078
1103
  graph
1079
1104
  ]);
1080
- const onOpenChange = useCallback3(({ item: { id }, path, open }) => {
1105
+ const handleOpenChange = useCallback3(({ item: { id }, path, open }) => {
1081
1106
  setItem(path, "open", open);
1082
1107
  if (graph) {
1083
1108
  const node = graph.findNode(id);
@@ -1086,15 +1111,21 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1086
1111
  }, [
1087
1112
  graph
1088
1113
  ]);
1089
- const onTabChange = useCallback3(async (node) => {
1090
- await dispatch(createIntent4(LayoutAction4.SwitchWorkspace, {
1114
+ const handleTabChange = useCallback3(async (node) => {
1115
+ await dispatch(createIntent3(LayoutAction3.UpdateSidebar, {
1116
+ part: "sidebar",
1117
+ options: {
1118
+ state: node.id === tab ? navigationSidebarState === "expanded" ? isLg ? "collapsed" : "closed" : "expanded" : "expanded"
1119
+ }
1120
+ }));
1121
+ await dispatch(createIntent3(LayoutAction3.SwitchWorkspace, {
1091
1122
  part: "workspace",
1092
1123
  subject: node.id
1093
1124
  }));
1094
1125
  if (layout.active.length === 0) {
1095
1126
  const [item] = getItems(node).filter((node2) => !isActionLike2(node2));
1096
1127
  if (item && item.data) {
1097
- await dispatch(createIntent4(LayoutAction4.Open, {
1128
+ await dispatch(createIntent3(LayoutAction3.Open, {
1098
1129
  part: "main",
1099
1130
  subject: [
1100
1131
  item.id
@@ -1104,7 +1135,10 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1104
1135
  }
1105
1136
  }, [
1106
1137
  dispatch,
1107
- layout
1138
+ layout.active,
1139
+ tab,
1140
+ navigationSidebarState,
1141
+ isLg
1108
1142
  ]);
1109
1143
  const canDrop = useCallback3((source, target) => {
1110
1144
  const sourceNode = source.item;
@@ -1126,14 +1160,14 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1126
1160
  relation: "inbound"
1127
1161
  });
1128
1162
  void (parent && node.data({
1129
- node: parent,
1163
+ parent,
1130
1164
  caller: NAV_TREE_ITEM
1131
1165
  }));
1132
1166
  return;
1133
1167
  }
1134
1168
  const current = isCurrent(path, node);
1135
1169
  if (!current) {
1136
- void dispatch(createIntent4(LayoutAction4.Open, {
1170
+ void dispatch(createIntent3(LayoutAction3.Open, {
1137
1171
  part: "main",
1138
1172
  subject: [
1139
1173
  node.id
@@ -1143,7 +1177,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1143
1177
  }
1144
1178
  }));
1145
1179
  } else if (option) {
1146
- void dispatch(createIntent4(LayoutAction4.Close, {
1180
+ void dispatch(createIntent3(LayoutAction3.Close, {
1147
1181
  part: "main",
1148
1182
  subject: [
1149
1183
  node.id
@@ -1153,7 +1187,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1153
1187
  }
1154
1188
  }));
1155
1189
  } else {
1156
- void dispatch(createIntent4(LayoutAction4.ScrollIntoView, {
1190
+ void dispatch(createIntent3(LayoutAction3.ScrollIntoView, {
1157
1191
  part: "current",
1158
1192
  subject: node.id
1159
1193
  }));
@@ -1163,7 +1197,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1163
1197
  void defaultAction.data();
1164
1198
  }
1165
1199
  if (!isLg) {
1166
- void dispatch(createIntent4(LayoutAction4.UpdateSidebar, {
1200
+ void dispatch(createIntent3(LayoutAction3.UpdateSidebar, {
1167
1201
  part: "sidebar",
1168
1202
  options: {
1169
1203
  state: "closed"
@@ -1176,7 +1210,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1176
1210
  isCurrent,
1177
1211
  isLg
1178
1212
  ]);
1179
- const onBack = useCallback3(() => dispatch(createIntent4(LayoutAction4.RevertWorkspace, {
1213
+ const handleBack = useCallback3(() => dispatch(createIntent3(LayoutAction3.RevertWorkspace, {
1180
1214
  part: "workspace",
1181
1215
  options: {
1182
1216
  revert: true
@@ -1241,8 +1275,6 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1241
1275
  ]);
1242
1276
  const navTreeContextValue = useMemo5(() => ({
1243
1277
  tab,
1244
- onTabChange,
1245
- onBack,
1246
1278
  getActions: getActions2,
1247
1279
  loadDescendents,
1248
1280
  renderItemEnd,
@@ -1252,15 +1284,15 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1252
1284
  getProps,
1253
1285
  isCurrent,
1254
1286
  isOpen,
1255
- onOpenChange,
1256
1287
  canDrop,
1257
- onSelect: handleSelect,
1258
1288
  isAlternateTree,
1259
- setAlternateTree
1289
+ setAlternateTree,
1290
+ onTabChange: handleTabChange,
1291
+ onOpenChange: handleOpenChange,
1292
+ onSelect: handleSelect,
1293
+ onBack: handleBack
1260
1294
  }), [
1261
1295
  tab,
1262
- onTabChange,
1263
- onBack,
1264
1296
  getActions2,
1265
1297
  loadDescendents,
1266
1298
  renderItemEnd,
@@ -1270,17 +1302,20 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
1270
1302
  getProps,
1271
1303
  isCurrent,
1272
1304
  isOpen,
1273
- onOpenChange,
1274
1305
  canDrop,
1275
- handleSelect,
1276
1306
  isAlternateTree,
1277
- setAlternateTree
1307
+ setAlternateTree,
1308
+ handleTabChange,
1309
+ handleOpenChange,
1310
+ handleSelect,
1311
+ handleBack
1278
1312
  ]);
1279
1313
  return /* @__PURE__ */ React9.createElement(NavTreeContext.Provider, {
1280
1314
  value: navTreeContextValue
1281
1315
  }, /* @__PURE__ */ React9.createElement(NavTree, {
1316
+ id: graph.root.id,
1282
1317
  root: graph.root,
1283
- id: graph.root.id
1318
+ open: layout.sidebarOpen
1284
1319
  }));
1285
1320
  });
1286
1321
 
@@ -1306,4 +1341,4 @@ export {
1306
1341
  ReactSurface,
1307
1342
  State
1308
1343
  };
1309
- //# sourceMappingURL=chunk-FBQKXPOR.mjs.map
1344
+ //# sourceMappingURL=chunk-ZULGSU3L.mjs.map