@dxos/plugin-navtree 0.6.13-main.ed424a1 → 0.6.13

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.
@@ -10,4 +10,4 @@ export {
10
10
  KEY_BINDING,
11
11
  meta_default
12
12
  };
13
- //# sourceMappingURL=chunk-PSVCPL4T.mjs.map
13
+ //# sourceMappingURL=chunk-U7MTKDFQ.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/meta.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport const NAVTREE_PLUGIN = 'dxos.org/plugin/navtree';\n\n// TODO(wittjosiah): Factor out.\nexport const KEY_BINDING = 'KeyBinding';\n\nexport default {\n id: NAVTREE_PLUGIN,\n};\n"],
5
+ "mappings": ";AAIO,IAAMA,iBAAiB;AAGvB,IAAMC,cAAc;AAE3B,IAAA,eAAe;EACbC,IAAIF;AACN;",
6
+ "names": ["NAVTREE_PLUGIN", "KEY_BINDING", "id"]
7
+ }
@@ -2,11 +2,12 @@ import {
2
2
  KEY_BINDING,
3
3
  NAVTREE_PLUGIN,
4
4
  meta_default
5
- } from "./chunk-PSVCPL4T.mjs";
5
+ } from "./chunk-U7MTKDFQ.mjs";
6
6
 
7
7
  // packages/plugins/plugin-navtree/src/NavTreePlugin.tsx
8
+ import { MagnifyingGlass as MagnifyingGlass2 } from "@phosphor-icons/react";
8
9
  import React8 from "react";
9
- import { resolvePlugin, parseIntentPlugin, LayoutAction as LayoutAction3, parseGraphPlugin, NavigationAction as NavigationAction2 } from "@dxos/app-framework";
10
+ import { resolvePlugin, parseIntentPlugin, LayoutAction as LayoutAction4, parseGraphPlugin, NavigationAction as NavigationAction2 } from "@dxos/app-framework";
10
11
  import { createExtension, isAction as isAction4, isGraphNode } from "@dxos/app-graph";
11
12
  import { Keyboard as Keyboard2 } from "@dxos/keyboard";
12
13
  import { LocalStorageStore } from "@dxos/local-storage";
@@ -14,12 +15,13 @@ import { Path as Path3 } from "@dxos/react-ui-mosaic";
14
15
  import { getHostPlatform as getHostPlatform2 } from "@dxos/util";
15
16
 
16
17
  // packages/plugins/plugin-navtree/src/components/CommandsDialog.tsx
18
+ import { DotOutline } from "@phosphor-icons/react";
17
19
  import React, { useMemo, useState } from "react";
18
20
  import { useIntentDispatcher, LayoutAction } from "@dxos/app-framework";
19
21
  import { isActionGroup, isAction } from "@dxos/app-graph";
20
22
  import { Keyboard, keySymbols } from "@dxos/keyboard";
21
23
  import { useGraph } from "@dxos/plugin-graph";
22
- import { Button, Dialog, Icon, useTranslation, toLocalizedString } from "@dxos/react-ui";
24
+ import { Button, Dialog, useTranslation, toLocalizedString } from "@dxos/react-ui";
23
25
  import { SearchList } from "@dxos/react-ui-searchlist";
24
26
  import { descriptionText, mx } from "@dxos/react-ui-theme";
25
27
  import { getHostPlatform } from "@dxos/util";
@@ -66,6 +68,7 @@ var CommandsDialogContent = ({ selected: initial }) => {
66
68
  }, actions?.map((action) => {
67
69
  const label = toLocalizedString(action.properties.label, t);
68
70
  const shortcut = typeof action.properties.keyBinding === "string" ? action.properties.keyBinding : action.properties.keyBinding?.[getHostPlatform()];
71
+ const Icon = action.properties.icon ?? DotOutline;
69
72
  return /* @__PURE__ */ React.createElement(SearchList.Item, {
70
73
  value: label,
71
74
  key: action.id,
@@ -100,8 +103,8 @@ var CommandsDialogContent = ({ selected: initial }) => {
100
103
  "data-testid": action.properties.testId
101
104
  }
102
105
  }, /* @__PURE__ */ React.createElement(Icon, {
103
- icon: action.properties.icon,
104
- size: 4
106
+ size: 4,
107
+ className: mx(!action.properties.icon && "invisible")
105
108
  }), /* @__PURE__ */ React.createElement("span", {
106
109
  className: "grow truncate"
107
110
  }, label), shortcut && /* @__PURE__ */ React.createElement("span", {
@@ -118,6 +121,7 @@ var CommandsDialogContent = ({ selected: initial }) => {
118
121
  };
119
122
 
120
123
  // packages/plugins/plugin-navtree/src/components/NavBarStart.tsx
124
+ import { DotsThreeVertical } from "@phosphor-icons/react";
121
125
  import React2, { Fragment } from "react";
122
126
  import { getGraph } from "@dxos/app-graph";
123
127
  import { Popover, toLocalizedString as toLocalizedString2, useTranslation as useTranslation2 } from "@dxos/react-ui";
@@ -126,17 +130,16 @@ var TREE_ITEM_MAIN_HEADING = "TreeItemMainHeading";
126
130
  var NavBarStart = ({ activeNode, popoverAnchorId }) => {
127
131
  const { t } = useTranslation2(NAVTREE_PLUGIN);
128
132
  const ActionRoot = popoverAnchorId === `dxos.org/ui/${TREE_ITEM_MAIN_HEADING}/${activeNode.id}` || popoverAnchorId === `dxos.org/ui/${KEY_BINDING}/${activeNode.id}` ? Popover.Anchor : Fragment;
133
+ const Icon = activeNode.properties?.icon ?? DotsThreeVertical;
129
134
  const graph = getGraph(activeNode);
130
135
  const actions = graph.actions(activeNode);
131
136
  const label = toLocalizedString2(activeNode.properties?.label, t);
132
137
  const menuTriggerLabel = t("node actions menu invoker label");
133
138
  return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ActionRoot, null, /* @__PURE__ */ React2.createElement(PlankHeading.ActionsMenu, {
134
- icon: activeNode.properties?.icon ?? "ph--dots-three-vertical--regular",
139
+ Icon,
135
140
  attendableId: activeNode.id,
136
141
  triggerLabel: menuTriggerLabel,
137
- actions: [
138
- actions
139
- ],
142
+ actions,
140
143
  onAction: (action) => typeof action.data === "function" && action.data({
141
144
  node: action,
142
145
  caller: TREE_ITEM_MAIN_HEADING
@@ -148,13 +151,11 @@ var NavBarStart = ({ activeNode, popoverAnchorId }) => {
148
151
 
149
152
  // packages/plugins/plugin-navtree/src/components/NavTreeContainer.tsx
150
153
  import React4, { useCallback, useMemo as useMemo2 } from "react";
151
- import { NavigationAction, Surface, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
154
+ import { NavigationAction, LayoutAction as LayoutAction2, Surface, SLUG_PATH_SEPARATOR, SLUG_COLLECTION_INDICATOR, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
152
155
  import { getGraph as getGraph2, isAction as isAction3, isActionLike } from "@dxos/app-graph";
153
156
  import { ElevationProvider, useMediaQuery, useSidebars as useSidebars2 } from "@dxos/react-ui";
154
- import { List } from "@dxos/react-ui-list";
155
- import { Mosaic, Path as Path2 } from "@dxos/react-ui-mosaic";
156
- import { getLevel, NavTree } from "@dxos/react-ui-navtree";
157
- import { ghostHover, mx as mx3 } from "@dxos/react-ui-theme";
157
+ import { Path as Path2 } from "@dxos/react-ui-mosaic";
158
+ import { NavTree, getLevel } from "@dxos/react-ui-navtree";
158
159
  import { arrayMove } from "@dxos/util";
159
160
 
160
161
  // packages/plugins/plugin-navtree/src/components/NavTreeFooter.tsx
@@ -169,7 +170,7 @@ import { getSize, mx as mx2 } from "@dxos/react-ui-theme";
169
170
  var buttonStyles = "pli-1.5 text-xs font-normal";
170
171
  var repo = "https://github.com/dxos/dxos";
171
172
  var NavTreeFooter = (props) => {
172
- const layoutPart = useDefaultValue(props.layoutPart, () => "sidebar");
173
+ const layoutPart = useDefaultValue(props.layoutPart, "sidebar");
173
174
  const config = useConfig();
174
175
  const { t } = useTranslation3(NAVTREE_PLUGIN);
175
176
  const { navigationSidebarOpen } = useSidebars(NAVTREE_PLUGIN);
@@ -450,13 +451,26 @@ var NavTreeContainer = ({ root, activeIds, openItemIds, onOpenItemIdsChange, att
450
451
  await dispatch({
451
452
  action: NavigationAction.OPEN,
452
453
  data: {
453
- activeParts: {
454
+ activeParts: node.data?.comments ? {
455
+ main: [
456
+ node.id
457
+ ],
458
+ complementary: [
459
+ `${node.id}${SLUG_PATH_SEPARATOR}comments${SLUG_COLLECTION_INDICATOR}`
460
+ ]
461
+ } : {
454
462
  main: [
455
463
  node.id
456
464
  ]
457
465
  }
458
466
  }
459
467
  });
468
+ await dispatch({
469
+ action: LayoutAction2.SCROLL_INTO_VIEW,
470
+ data: {
471
+ id: node.id
472
+ }
473
+ });
460
474
  const defaultAction = actions?.find((action) => action.properties?.disposition === "default");
461
475
  if (isAction3(defaultAction)) {
462
476
  void defaultAction.data();
@@ -666,35 +680,7 @@ var NavTreeContainer = ({ root, activeIds, openItemIds, onOpenItemIdsChange, att
666
680
  onOpenItemIdsChange,
667
681
  openItemIds
668
682
  ]);
669
- const debug = false;
670
- if (debug) {
671
- const getLabel = (item) => {
672
- const label = item.node?.properties?.label;
673
- return typeof label === "string" ? label : item.id;
674
- };
675
- return /* @__PURE__ */ React4.createElement("div", {
676
- className: "bs-full overflow-hidden row-span-3 grid grid-cols-1 grid-rows-[min-content_1fr_min-content]"
677
- }, /* @__PURE__ */ React4.createElement("div", {
678
- className: "flex items-center p-2"
679
- }, "Items: ", items.length), /* @__PURE__ */ React4.createElement("div", {
680
- role: "none",
681
- className: "!overflow-y-auto"
682
- }, /* @__PURE__ */ React4.createElement(List.Root, {
683
- items,
684
- isItem: () => true
685
- }, ({ items: items2 }) => items2.map((item) => /* @__PURE__ */ React4.createElement(List.Item, {
686
- key: item.id,
687
- item,
688
- classNames: mx3("p-2", ghostHover)
689
- }, /* @__PURE__ */ React4.createElement(List.ItemDragHandle, null), /* @__PURE__ */ React4.createElement(List.ItemTitle, {
690
- classNames: "p-2 text-sm",
691
- onClick: () => handleNavigate(item)
692
- }, getLabel(item)), /* @__PURE__ */ React4.createElement(List.IconButton, {
693
- icon: "ph--caret-down--regular",
694
- onClick: () => handleItemOpenChange(item, true)
695
- }))))), /* @__PURE__ */ React4.createElement(NavTreeFooter, null));
696
- }
697
- return /* @__PURE__ */ React4.createElement(Mosaic.Root, null, /* @__PURE__ */ React4.createElement(Mosaic.DragOverlay, null), /* @__PURE__ */ React4.createElement(ElevationProvider, {
683
+ return /* @__PURE__ */ React4.createElement(ElevationProvider, {
698
684
  elevation: "chrome"
699
685
  }, /* @__PURE__ */ React4.createElement("div", {
700
686
  role: "none",
@@ -711,17 +697,17 @@ var NavTreeContainer = ({ root, activeIds, openItemIds, onOpenItemIdsChange, att
711
697
  current: activeIds,
712
698
  attended,
713
699
  type: NODE_TYPE,
714
- loadDescendents,
715
- popoverAnchorId,
716
- renderPresence,
717
- resolveItemLevel,
718
700
  open: openItemIds,
719
701
  onNavigate: handleNavigate,
720
702
  onItemOpenChange: handleItemOpenChange,
721
703
  onMove: handleMove,
722
704
  onDrop: handleDrop,
723
- onDragEnd: handleDragEnd
724
- })), /* @__PURE__ */ React4.createElement(NavTreeFooter, null))));
705
+ onDragEnd: handleDragEnd,
706
+ popoverAnchorId,
707
+ renderPresence,
708
+ resolveItemLevel,
709
+ loadDescendents
710
+ })), /* @__PURE__ */ React4.createElement(NavTreeFooter, null)));
725
711
  };
726
712
 
727
713
  // packages/plugins/plugin-navtree/src/components/NavTreeDocumentTitle.tsx
@@ -750,7 +736,7 @@ import { useIdentity } from "@dxos/react-client/halo";
750
736
  import React5 from "react";
751
737
  import { ConnectionState, useNetworkStatus } from "@dxos/react-client/mesh";
752
738
  import { Avatar } from "@dxos/react-ui";
753
- import { focusRing, mx as mx4 } from "@dxos/react-ui-theme";
739
+ import { focusRing, mx as mx3 } from "@dxos/react-ui-theme";
754
740
  import { hexToFallback } from "@dxos/util";
755
741
  var INTERNAL = "https://avatars.githubusercontent.com/u/57182821";
756
742
  var HaloButton = (props) => {
@@ -758,7 +744,7 @@ var HaloButton = (props) => {
758
744
  const fallbackValue = hexToFallback(identityKey ?? "0");
759
745
  const { swarm: connectionState } = useNetworkStatus();
760
746
  return /* @__PURE__ */ React5.createElement("button", {
761
- className: mx4(focusRing, "rounded grid place-items-center"),
747
+ className: mx3(focusRing, "rounded grid place-items-center"),
762
748
  onClick
763
749
  }, /* @__PURE__ */ React5.createElement(Avatar.Root, {
764
750
  size,
@@ -795,7 +781,7 @@ var NotchStart = () => {
795
781
  // packages/plugins/plugin-navtree/src/components/CommandsTrigger.tsx
796
782
  import { MagnifyingGlass } from "@phosphor-icons/react";
797
783
  import React7 from "react";
798
- import { LayoutAction as LayoutAction2, useIntent } from "@dxos/app-framework";
784
+ import { LayoutAction as LayoutAction3, useIntent } from "@dxos/app-framework";
799
785
  import { Button as Button3, useTranslation as useTranslation5 } from "@dxos/react-ui";
800
786
  import { getSize as getSize2 } from "@dxos/react-ui-theme";
801
787
  var CommandsTrigger = () => {
@@ -804,7 +790,7 @@ var CommandsTrigger = () => {
804
790
  return /* @__PURE__ */ React7.createElement(Button3, {
805
791
  classNames: "pis-3 pie-2 gap-2 mli-1 mbs-1 min-bs-0 bs-[--rail-action] justify-start",
806
792
  onClick: () => dispatch({
807
- action: LayoutAction2.SET_LAYOUT,
793
+ action: LayoutAction3.SET_LAYOUT,
808
794
  data: {
809
795
  element: "dialog",
810
796
  component: `${NAVTREE_PLUGIN}/Commands`,
@@ -1018,7 +1004,7 @@ var NavTreePlugin = () => {
1018
1004
  id: "dxos.org/plugin/navtree/open-commands",
1019
1005
  data: async () => {
1020
1006
  await intentPlugin?.provides.intent.dispatch({
1021
- action: LayoutAction3.SET_LAYOUT,
1007
+ action: LayoutAction4.SET_LAYOUT,
1022
1008
  data: {
1023
1009
  element: "dialog",
1024
1010
  component: `${NAVTREE_PLUGIN}/Commands`,
@@ -1033,7 +1019,8 @@ var NavTreePlugin = () => {
1033
1019
  ns: NAVTREE_PLUGIN
1034
1020
  }
1035
1021
  ],
1036
- icon: "ph--magnifying-glass--regular",
1022
+ icon: (props) => /* @__PURE__ */ React8.createElement(MagnifyingGlass2, props),
1023
+ iconSymbol: "ph--magnifying-glass--regular",
1037
1024
  keyBinding: {
1038
1025
  macos: "meta+k",
1039
1026
  windows: "ctrl+k"