@dxos/plugin-navtree 0.8.1 → 0.8.2-main.2f9c567
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/{chunk-DN43QXSX.mjs → chunk-FBQKXPOR.mjs} +134 -47
- package/dist/lib/browser/chunk-FBQKXPOR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4RQJXI4D.mjs → chunk-TLQLMZXU.mjs} +1 -1
- package/dist/lib/browser/chunk-TLQLMZXU.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +3 -2
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-BZMUS24C.mjs → intent-resolver-XCABZFA6.mjs} +5 -5
- package/dist/lib/browser/intent-resolver-XCABZFA6.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-3HCM3SHJ.mjs → react-surface-FQEYRV4Q.mjs} +3 -3
- package/dist/lib/browser/{state-M5UJ3MHL.mjs → state-EW62QYEN.mjs} +17 -11
- package/dist/lib/browser/state-EW62QYEN.mjs.map +7 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +7 -4
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +34 -3
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +7 -4
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/L1Panels.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItemAction.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeItemColumns.d.ts +1 -1
- package/dist/types/src/components/NavTreeItemColumns.d.ts.map +1 -1
- package/dist/types/src/components/types.d.ts +4 -0
- package/dist/types/src/components/types.d.ts.map +1 -1
- package/dist/types/src/testing/generator.d.ts +6 -6
- package/dist/types/src/testing/generator.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +33 -31
- package/src/capabilities/capabilities.ts +5 -4
- package/src/capabilities/intent-resolver.ts +4 -3
- package/src/capabilities/state.ts +20 -14
- package/src/components/L1Panels.tsx +115 -30
- package/src/components/NavTree.stories.tsx +5 -5
- package/src/components/NavTreeContainer.tsx +16 -2
- package/src/components/NavTreeItemAction.tsx +10 -4
- package/src/components/NavTreeItemColumns.tsx +29 -27
- package/src/components/UserAccountAvatar.tsx +1 -1
- package/src/components/types.ts +4 -0
- package/src/stories/Graph.stories.tsx +4 -4
- package/src/testing/generator.ts +13 -11
- package/src/translations.ts +1 -0
- package/dist/lib/browser/chunk-4RQJXI4D.mjs.map +0 -7
- package/dist/lib/browser/chunk-DN43QXSX.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BZMUS24C.mjs.map +0 -7
- package/dist/lib/browser/state-M5UJ3MHL.mjs.map +0 -7
- /package/dist/lib/browser/{react-surface-3HCM3SHJ.mjs.map → react-surface-FQEYRV4Q.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NavTreeCapabilities
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-TLQLMZXU.mjs";
|
|
4
4
|
import {
|
|
5
5
|
COMMANDS_DIALOG,
|
|
6
6
|
KEY_BINDING,
|
|
@@ -237,7 +237,7 @@ var l0ItemType = (item) => {
|
|
|
237
237
|
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
238
238
|
import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
|
|
239
239
|
import { untracked } from "@preact/signals-core";
|
|
240
|
-
import React9, { memo as memo2, useCallback as
|
|
240
|
+
import React9, { memo as memo2, useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo5 } from "react";
|
|
241
241
|
import { createIntent as createIntent4, LayoutAction as LayoutAction4, Surface, useAppGraph as useAppGraph2, useCapability, useIntentDispatcher as useIntentDispatcher4, useLayout as useLayout2 } 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";
|
|
@@ -250,7 +250,7 @@ import { arrayMove as arrayMove2 } from "@dxos/util";
|
|
|
250
250
|
// packages/plugins/plugin-navtree/src/components/NavTree.tsx
|
|
251
251
|
import React8, { useMemo as useMemo4 } from "react";
|
|
252
252
|
import { Tabs as Tabs3 } from "@dxos/react-ui-tabs";
|
|
253
|
-
import { byPosition } from "@dxos/util";
|
|
253
|
+
import { byPosition as byPosition2 } from "@dxos/util";
|
|
254
254
|
|
|
255
255
|
// packages/plugins/plugin-navtree/src/components/L0Menu.tsx
|
|
256
256
|
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
@@ -287,7 +287,7 @@ var UserAccountAvatar = (props) => {
|
|
|
287
287
|
status: props.status ?? "active",
|
|
288
288
|
hue: props.hue || fallbackValue.hue,
|
|
289
289
|
fallback: props.emoji || fallbackValue.emoji,
|
|
290
|
-
"data-testid": "
|
|
290
|
+
"data-testid": "treeView.userAccount"
|
|
291
291
|
})));
|
|
292
292
|
};
|
|
293
293
|
|
|
@@ -641,31 +641,37 @@ var L0Menu = ({ topLevelItems, pinnedItems, userAccountItem, parent, path }) =>
|
|
|
641
641
|
};
|
|
642
642
|
|
|
643
643
|
// packages/plugins/plugin-navtree/src/components/L1Panels.tsx
|
|
644
|
-
import React7, { useMemo as useMemo3 } from "react";
|
|
644
|
+
import React7, { useCallback as useCallback2, useMemo as useMemo3 } from "react";
|
|
645
645
|
import { useLayout } from "@dxos/app-framework";
|
|
646
|
-
import { Button as Button3, Icon as Icon3, toLocalizedString as toLocalizedString6, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
646
|
+
import { Button as Button3, Icon as Icon3, IconButton as IconButton2, toLocalizedString as toLocalizedString6, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
647
647
|
import { Tree } from "@dxos/react-ui-list";
|
|
648
648
|
import { Tabs as Tabs2 } from "@dxos/react-ui-tabs";
|
|
649
649
|
import { hoverableControlItem as hoverableControlItem2, hoverableOpenControlItem as hoverableOpenControlItem2, mx as mx4 } from "@dxos/react-ui-theme";
|
|
650
|
+
import { byPosition } from "@dxos/util";
|
|
650
651
|
|
|
651
652
|
// packages/plugins/plugin-navtree/src/components/NavTreeItemColumns.tsx
|
|
652
653
|
import React6, { Fragment, memo } from "react";
|
|
653
654
|
import { isAction as isAction3 } from "@dxos/app-graph";
|
|
654
|
-
import { Popover as Popover2, toLocalizedString as toLocalizedString5, Treegrid, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
655
|
+
import { DensityProvider, Popover as Popover2, toLocalizedString as toLocalizedString5, Treegrid, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
655
656
|
|
|
656
657
|
// packages/plugins/plugin-navtree/src/components/NavTreeItemAction.tsx
|
|
657
658
|
import React5, { useRef as useRef2 } from "react";
|
|
658
|
-
import { useTranslation as useTranslation5, toLocalizedString as toLocalizedString4, IconButton } from "@dxos/react-ui";
|
|
659
|
+
import { useTranslation as useTranslation5, toLocalizedString as toLocalizedString4, IconButton, useDensityContext } from "@dxos/react-ui";
|
|
659
660
|
import { DropdownMenu, MenuProvider } from "@dxos/react-ui-menu";
|
|
660
661
|
import { hoverableControlItem, hoverableOpenControlItem, mx as mx3 } from "@dxos/react-ui-theme";
|
|
661
662
|
var fallbackIcon = "ph--placeholder--regular";
|
|
662
|
-
var
|
|
663
|
+
var fineActionButtonProps = {
|
|
663
664
|
size: 4,
|
|
664
665
|
density: "fine"
|
|
665
666
|
};
|
|
667
|
+
var coarseActionButtonProps = {
|
|
668
|
+
size: 5,
|
|
669
|
+
density: "coarse"
|
|
670
|
+
};
|
|
666
671
|
var NavTreeItemActionDropdownMenu = ({ label, icon, testId, menuActions, onAction }) => {
|
|
667
672
|
const { t } = useTranslation5(NAVTREE_PLUGIN);
|
|
668
673
|
const suppressNextTooltip = useRef2(false);
|
|
674
|
+
const density = useDensityContext();
|
|
669
675
|
return /* @__PURE__ */ React5.createElement(MenuProvider, {
|
|
670
676
|
onAction
|
|
671
677
|
}, /* @__PURE__ */ React5.createElement(DropdownMenu.Root, {
|
|
@@ -674,7 +680,7 @@ var NavTreeItemActionDropdownMenu = ({ label, icon, testId, menuActions, onActio
|
|
|
674
680
|
}, /* @__PURE__ */ React5.createElement(DropdownMenu.Trigger, {
|
|
675
681
|
asChild: true
|
|
676
682
|
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
677
|
-
...
|
|
683
|
+
...density === "coarse" ? coarseActionButtonProps : fineActionButtonProps,
|
|
678
684
|
classNames: mx3("shrink-0 pli-2 pointer-fine:pli-1", hoverableControlItem, hoverableOpenControlItem),
|
|
679
685
|
variant: "ghost",
|
|
680
686
|
icon: icon ?? fallbackIcon,
|
|
@@ -687,8 +693,9 @@ var NavTreeItemActionDropdownMenu = ({ label, icon, testId, menuActions, onActio
|
|
|
687
693
|
var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, testId, icon, variant = "ghost", iconOnly = true } = {
|
|
688
694
|
label: "never"
|
|
689
695
|
}, data: invoke, baseLabel }) => {
|
|
696
|
+
const density = useDensityContext();
|
|
690
697
|
return /* @__PURE__ */ React5.createElement(IconButton, {
|
|
691
|
-
...
|
|
698
|
+
...density === "coarse" ? coarseActionButtonProps : fineActionButtonProps,
|
|
692
699
|
variant,
|
|
693
700
|
classNames: mx3("shrink-0", hoverableControlItem, hoverableOpenControlItem, iconOnly ? "pli-2 pointer-fine:pli-1" : "p-2 pointer-fine:p-2 mie-1"),
|
|
694
701
|
icon: icon ?? fallbackIcon,
|
|
@@ -733,7 +740,7 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
|
|
|
733
740
|
};
|
|
734
741
|
|
|
735
742
|
// packages/plugins/plugin-navtree/src/components/NavTreeItemColumns.tsx
|
|
736
|
-
var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open }) => {
|
|
743
|
+
var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fine" }) => {
|
|
737
744
|
const { t } = useTranslation6(NAVTREE_PLUGIN);
|
|
738
745
|
const { getActions: getActions2, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
|
|
739
746
|
const level = path.length - 2;
|
|
@@ -745,7 +752,9 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open }) => {
|
|
|
745
752
|
const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover2.Anchor : Fragment;
|
|
746
753
|
useLoadDescendents(item);
|
|
747
754
|
useLoadDescendents(primaryAction && !isAction3(primaryAction) ? primaryAction : void 0);
|
|
748
|
-
return /* @__PURE__ */ React6.createElement(
|
|
755
|
+
return /* @__PURE__ */ React6.createElement(DensityProvider, {
|
|
756
|
+
density
|
|
757
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
749
758
|
role: "none",
|
|
750
759
|
className: "contents app-no-drag"
|
|
751
760
|
}, primaryAction?.properties?.disposition === "list-item-primary" && !primaryAction?.properties?.disabled ? /* @__PURE__ */ React6.createElement(NavTreeItemAction, {
|
|
@@ -770,14 +779,67 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open }) => {
|
|
|
770
779
|
}) : /* @__PURE__ */ React6.createElement(Treegrid.Cell, null)), ItemEnd && /* @__PURE__ */ React6.createElement(ItemEnd, {
|
|
771
780
|
node: item,
|
|
772
781
|
open
|
|
773
|
-
}));
|
|
782
|
+
})));
|
|
774
783
|
});
|
|
775
784
|
|
|
776
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";
|
|
787
|
+
var HeadingBackButton = ({ title, onClick }) => {
|
|
788
|
+
const { t } = useTranslation7(NAVTREE_PLUGIN);
|
|
789
|
+
return /* @__PURE__ */ React7.createElement(Button3, {
|
|
790
|
+
variant: "ghost",
|
|
791
|
+
classNames: "pli-1 flex-1 relative group text-start justify-start bs-[--rail-action] font-normal",
|
|
792
|
+
onClick
|
|
793
|
+
}, /* @__PURE__ */ React7.createElement(Icon3, {
|
|
794
|
+
icon: "ph--caret-left--bold",
|
|
795
|
+
size: 3
|
|
796
|
+
}), /* @__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")
|
|
800
|
+
}, title));
|
|
801
|
+
};
|
|
777
802
|
var L1Panel = ({ item, path, currentItemId, onBack }) => {
|
|
778
803
|
const layout = useLayout();
|
|
779
|
-
const navTreeContext = useNavTreeContext();
|
|
804
|
+
const { isAlternateTree, setAlternateTree, ...navTreeContext } = useNavTreeContext();
|
|
780
805
|
const { t } = useTranslation7(NAVTREE_PLUGIN);
|
|
806
|
+
const alternateTree = navTreeContext.getItems(item, "alternate-tree")[0];
|
|
807
|
+
const alternatePath = useMemo3(() => [
|
|
808
|
+
...path,
|
|
809
|
+
item.id
|
|
810
|
+
], [
|
|
811
|
+
item.id,
|
|
812
|
+
path
|
|
813
|
+
]);
|
|
814
|
+
const handleOpen = useCallback2(() => setAlternateTree?.(alternatePath, true), [
|
|
815
|
+
alternatePath,
|
|
816
|
+
setAlternateTree
|
|
817
|
+
]);
|
|
818
|
+
const isAlternate = isAlternateTree?.(alternatePath, item) ?? false;
|
|
819
|
+
const alternateGetItems = useCallback2((node, disposition) => {
|
|
820
|
+
const items = navTreeContext.getItems(node, disposition);
|
|
821
|
+
if (node === alternateTree) {
|
|
822
|
+
return items.toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
823
|
+
}
|
|
824
|
+
return items;
|
|
825
|
+
}, [
|
|
826
|
+
navTreeContext,
|
|
827
|
+
alternateTree
|
|
828
|
+
]);
|
|
829
|
+
const handleBack = useCallback2(() => {
|
|
830
|
+
if (isAlternate) {
|
|
831
|
+
setAlternateTree?.(alternatePath, false);
|
|
832
|
+
} else {
|
|
833
|
+
onBack?.();
|
|
834
|
+
}
|
|
835
|
+
}, [
|
|
836
|
+
isAlternate,
|
|
837
|
+
onBack,
|
|
838
|
+
alternatePath,
|
|
839
|
+
setAlternateTree
|
|
840
|
+
]);
|
|
841
|
+
const title = toLocalizedString6(item.properties.label, t);
|
|
842
|
+
const backCapable = item.id.startsWith("!") || isAlternate;
|
|
781
843
|
return /* @__PURE__ */ React7.createElement(Tabs2.Tabpanel, {
|
|
782
844
|
key: item.id,
|
|
783
845
|
value: item.id,
|
|
@@ -786,29 +848,45 @@ var L1Panel = ({ item, path, currentItemId, onBack }) => {
|
|
|
786
848
|
item.id === currentItemId && "grid"
|
|
787
849
|
],
|
|
788
850
|
tabIndex: -1,
|
|
851
|
+
"aria-label": title,
|
|
789
852
|
...!layout.sidebarOpen && {
|
|
790
853
|
inert: "true"
|
|
791
854
|
}
|
|
792
855
|
}, item.id === currentItemId && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("h2", {
|
|
793
|
-
className: "flex items-center border-be border-separator app-drag"
|
|
794
|
-
}, /* @__PURE__ */ React7.createElement(
|
|
856
|
+
className: "flex items-center border-be border-separator app-drag pis-1"
|
|
857
|
+
}, backCapable ? /* @__PURE__ */ React7.createElement(HeadingBackButton, {
|
|
858
|
+
title,
|
|
859
|
+
onClick: handleBack
|
|
860
|
+
}) : /* @__PURE__ */ React7.createElement("span", {
|
|
861
|
+
className: "flex-1 truncate min-is-0 pis-6"
|
|
862
|
+
}, title), alternateTree && !isAlternate && /* @__PURE__ */ React7.createElement(IconButton2, {
|
|
795
863
|
variant: "ghost",
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
icon: "ph--
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
}
|
|
864
|
+
classNames: mx4("shrink-0", hoverableControlItem2, hoverableOpenControlItem2, "pli-2 pointer-fine:pli-1"),
|
|
865
|
+
iconOnly: true,
|
|
866
|
+
size: 5,
|
|
867
|
+
density: "coarse",
|
|
868
|
+
icon: alternateTree.properties.icon ?? "ph--placeholder--regular",
|
|
869
|
+
label: toLocalizedString6(alternateTree.properties.label ?? alternateTree.id, t),
|
|
870
|
+
"data-testid": "treeView.alternateTreeButton",
|
|
871
|
+
onClick: handleOpen
|
|
872
|
+
}), /* @__PURE__ */ React7.createElement(NavTreeItemColumns, {
|
|
805
873
|
path,
|
|
806
874
|
item,
|
|
807
|
-
open: true
|
|
875
|
+
open: true,
|
|
876
|
+
density: "coarse"
|
|
808
877
|
})), /* @__PURE__ */ React7.createElement("div", {
|
|
809
878
|
role: "none",
|
|
810
879
|
className: "overflow-y-auto"
|
|
811
|
-
}, /* @__PURE__ */ React7.createElement(Tree, {
|
|
880
|
+
}, isAlternate ? /* @__PURE__ */ React7.createElement(Tree, {
|
|
881
|
+
...navTreeContext,
|
|
882
|
+
getItems: alternateGetItems,
|
|
883
|
+
id: alternateTree.id,
|
|
884
|
+
root: alternateTree,
|
|
885
|
+
path: alternatePath,
|
|
886
|
+
levelOffset: 5,
|
|
887
|
+
gridTemplateColumns: "[tree-row-start] 1fr min-content min-content min-content [tree-row-end]",
|
|
888
|
+
renderColumns: NavTreeItemColumns
|
|
889
|
+
}) : /* @__PURE__ */ React7.createElement(Tree, {
|
|
812
890
|
...navTreeContext,
|
|
813
891
|
id: item.id,
|
|
814
892
|
root: item,
|
|
@@ -866,7 +944,7 @@ var L1Panels = ({ topLevelItems, path, currentItemId, onBack }) => {
|
|
|
866
944
|
var NAV_TREE_ITEM = "NavTreeItem";
|
|
867
945
|
var NavTree = ({ id, root }) => {
|
|
868
946
|
const { tab, getItems, onBack } = useNavTreeContext();
|
|
869
|
-
const topLevelActions = getItems(root, "item").toSorted((a, b) =>
|
|
947
|
+
const topLevelActions = getItems(root, "item").toSorted((a, b) => byPosition2(a.properties, b.properties));
|
|
870
948
|
const topLevelCollections = getItems(root, "collection");
|
|
871
949
|
const topLevelWorkspaces = getItems(root, "workspace");
|
|
872
950
|
const topLevelNavigation = getItems(root, "navigation");
|
|
@@ -881,7 +959,7 @@ var NavTree = ({ id, root }) => {
|
|
|
881
959
|
topLevelWorkspaces,
|
|
882
960
|
topLevelNavigation
|
|
883
961
|
]);
|
|
884
|
-
const pinnedItems = getItems(root, "pin-end").toSorted((a, b) =>
|
|
962
|
+
const pinnedItems = getItems(root, "pin-end").toSorted((a, b) => byPosition2(a.properties, b.properties));
|
|
885
963
|
const userAccountItem = getItems(root, "user-account")[0];
|
|
886
964
|
const topLevelItems = useMemo4(() => [
|
|
887
965
|
...l0Items,
|
|
@@ -923,10 +1001,10 @@ var NavTree = ({ id, root }) => {
|
|
|
923
1001
|
// packages/plugins/plugin-navtree/src/capabilities/index.ts
|
|
924
1002
|
import { lazy } from "@dxos/app-framework";
|
|
925
1003
|
var AppGraphBuilder = lazy(() => import("./app-graph-builder-26D3MUCA.mjs"));
|
|
926
|
-
var IntentResolver = lazy(() => import("./intent-resolver-
|
|
1004
|
+
var IntentResolver = lazy(() => import("./intent-resolver-XCABZFA6.mjs"));
|
|
927
1005
|
var Keyboard2 = lazy(() => import("./keyboard-IQXHKUWM.mjs"));
|
|
928
|
-
var ReactSurface = lazy(() => import("./react-surface-
|
|
929
|
-
var State = lazy(() => import("./state-
|
|
1006
|
+
var ReactSurface = lazy(() => import("./react-surface-FQEYRV4Q.mjs"));
|
|
1007
|
+
var State = lazy(() => import("./state-EW62QYEN.mjs"));
|
|
930
1008
|
|
|
931
1009
|
// packages/plugins/plugin-navtree/src/components/NavTreeContainer.tsx
|
|
932
1010
|
var NODE_TYPE = "dxos/app-graph/node";
|
|
@@ -947,15 +1025,15 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
947
1025
|
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
948
1026
|
const { graph } = useAppGraph2();
|
|
949
1027
|
const layout = useLayout2();
|
|
950
|
-
const { isOpen, isCurrent, setItem } = useCapability(NavTreeCapabilities.State);
|
|
951
|
-
const getActions2 =
|
|
1028
|
+
const { isOpen, isCurrent, isAlternateTree, setItem } = useCapability(NavTreeCapabilities.State);
|
|
1029
|
+
const getActions2 = useCallback3((node) => getActions(graph, node), [
|
|
952
1030
|
graph
|
|
953
1031
|
]);
|
|
954
|
-
const getItems =
|
|
1032
|
+
const getItems = useCallback3((node, disposition) => {
|
|
955
1033
|
return graph.nodes(node ?? graph.root, {
|
|
956
1034
|
filter: (node2) => {
|
|
957
1035
|
return untracked(() => {
|
|
958
|
-
if (node2.properties.disposition === "hidden") {
|
|
1036
|
+
if (!disposition && (node2.properties.disposition === "hidden" || node2.properties.disposition === "alternate-tree")) {
|
|
959
1037
|
return false;
|
|
960
1038
|
} else if (!disposition) {
|
|
961
1039
|
const action = isAction4(node2);
|
|
@@ -969,7 +1047,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
969
1047
|
}, [
|
|
970
1048
|
graph
|
|
971
1049
|
]);
|
|
972
|
-
const getProps =
|
|
1050
|
+
const getProps = useCallback3((node, path) => {
|
|
973
1051
|
const children = getChildren(graph, node, getChildrenFilter, path);
|
|
974
1052
|
const parentOf = children.length > 0 ? children.map(({ id }) => id) : node.properties.role === "branch" ? [] : void 0;
|
|
975
1053
|
return {
|
|
@@ -985,7 +1063,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
985
1063
|
}, [
|
|
986
1064
|
graph
|
|
987
1065
|
]);
|
|
988
|
-
const loadDescendents =
|
|
1066
|
+
const loadDescendents = useCallback3((node) => {
|
|
989
1067
|
void expandActions(graph, node);
|
|
990
1068
|
if (!isActionLike2(node)) {
|
|
991
1069
|
void expandChildren(graph, node).then(() => (
|
|
@@ -999,7 +1077,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
999
1077
|
}, [
|
|
1000
1078
|
graph
|
|
1001
1079
|
]);
|
|
1002
|
-
const onOpenChange =
|
|
1080
|
+
const onOpenChange = useCallback3(({ item: { id }, path, open }) => {
|
|
1003
1081
|
setItem(path, "open", open);
|
|
1004
1082
|
if (graph) {
|
|
1005
1083
|
const node = graph.findNode(id);
|
|
@@ -1008,7 +1086,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1008
1086
|
}, [
|
|
1009
1087
|
graph
|
|
1010
1088
|
]);
|
|
1011
|
-
const onTabChange =
|
|
1089
|
+
const onTabChange = useCallback3(async (node) => {
|
|
1012
1090
|
await dispatch(createIntent4(LayoutAction4.SwitchWorkspace, {
|
|
1013
1091
|
part: "workspace",
|
|
1014
1092
|
subject: node.id
|
|
@@ -1028,7 +1106,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1028
1106
|
dispatch,
|
|
1029
1107
|
layout
|
|
1030
1108
|
]);
|
|
1031
|
-
const canDrop =
|
|
1109
|
+
const canDrop = useCallback3((source, target) => {
|
|
1032
1110
|
const sourceNode = source.item;
|
|
1033
1111
|
const targetNode = target.item;
|
|
1034
1112
|
if (isSpace(targetNode.data)) {
|
|
@@ -1039,7 +1117,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1039
1117
|
return false;
|
|
1040
1118
|
}
|
|
1041
1119
|
}, []);
|
|
1042
|
-
const handleSelect =
|
|
1120
|
+
const handleSelect = useCallback3(({ item: node, path, option }) => {
|
|
1043
1121
|
if (!node.data) {
|
|
1044
1122
|
return;
|
|
1045
1123
|
}
|
|
@@ -1098,7 +1176,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1098
1176
|
isCurrent,
|
|
1099
1177
|
isLg
|
|
1100
1178
|
]);
|
|
1101
|
-
const onBack =
|
|
1179
|
+
const onBack = useCallback3(() => dispatch(createIntent4(LayoutAction4.RevertWorkspace, {
|
|
1102
1180
|
part: "workspace",
|
|
1103
1181
|
options: {
|
|
1104
1182
|
revert: true
|
|
@@ -1156,6 +1234,11 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1156
1234
|
}, [
|
|
1157
1235
|
graph
|
|
1158
1236
|
]);
|
|
1237
|
+
const setAlternateTree = useCallback3((path, open) => {
|
|
1238
|
+
setItem(path, "alternateTree", open);
|
|
1239
|
+
}, [
|
|
1240
|
+
setItem
|
|
1241
|
+
]);
|
|
1159
1242
|
const navTreeContextValue = useMemo5(() => ({
|
|
1160
1243
|
tab,
|
|
1161
1244
|
onTabChange,
|
|
@@ -1171,7 +1254,9 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1171
1254
|
isOpen,
|
|
1172
1255
|
onOpenChange,
|
|
1173
1256
|
canDrop,
|
|
1174
|
-
onSelect: handleSelect
|
|
1257
|
+
onSelect: handleSelect,
|
|
1258
|
+
isAlternateTree,
|
|
1259
|
+
setAlternateTree
|
|
1175
1260
|
}), [
|
|
1176
1261
|
tab,
|
|
1177
1262
|
onTabChange,
|
|
@@ -1187,7 +1272,9 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1187
1272
|
isOpen,
|
|
1188
1273
|
onOpenChange,
|
|
1189
1274
|
canDrop,
|
|
1190
|
-
handleSelect
|
|
1275
|
+
handleSelect,
|
|
1276
|
+
isAlternateTree,
|
|
1277
|
+
setAlternateTree
|
|
1191
1278
|
]);
|
|
1192
1279
|
return /* @__PURE__ */ React9.createElement(NavTreeContext.Provider, {
|
|
1193
1280
|
value: navTreeContextValue
|
|
@@ -1219,4 +1306,4 @@ export {
|
|
|
1219
1306
|
ReactSurface,
|
|
1220
1307
|
State
|
|
1221
1308
|
};
|
|
1222
|
-
//# sourceMappingURL=chunk-
|
|
1309
|
+
//# sourceMappingURL=chunk-FBQKXPOR.mjs.map
|