@dxos/plugin-navtree 0.8.2-main.f11618f → 0.8.2-staging.7ac8446
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-TLQLMZXU.mjs → chunk-4RQJXI4D.mjs} +1 -1
- package/dist/lib/browser/chunk-4RQJXI4D.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FHOAKMRS.mjs → chunk-DN43QXSX.mjs} +47 -134
- package/dist/lib/browser/chunk-DN43QXSX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +2 -3
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-OBGGMBVJ.mjs → intent-resolver-BZMUS24C.mjs} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-DWMOF2TM.mjs → react-surface-3HCM3SHJ.mjs} +3 -3
- package/dist/lib/browser/{state-EW62QYEN.mjs → state-M5UJ3MHL.mjs} +11 -17
- package/dist/lib/browser/state-M5UJ3MHL.mjs.map +7 -0
- package/dist/types/src/capabilities/capabilities.d.ts +4 -7
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -34
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +4 -7
- 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 +0 -4
- package/dist/types/src/components/types.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/translations.d.ts +0 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/capabilities/capabilities.ts +4 -5
- package/src/capabilities/state.ts +14 -20
- package/src/components/L1Panels.tsx +30 -115
- package/src/components/NavTree.stories.tsx +5 -5
- package/src/components/NavTreeContainer.tsx +2 -16
- package/src/components/NavTreeItemAction.tsx +4 -10
- package/src/components/NavTreeItemColumns.tsx +27 -29
- package/src/components/UserAccountAvatar.tsx +1 -1
- package/src/components/types.ts +0 -4
- package/src/stories/Graph.stories.tsx +4 -4
- package/src/testing/generator.ts +3 -3
- package/src/translations.ts +0 -1
- package/dist/lib/browser/chunk-FHOAKMRS.mjs.map +0 -7
- package/dist/lib/browser/chunk-TLQLMZXU.mjs.map +0 -7
- package/dist/lib/browser/state-EW62QYEN.mjs.map +0 -7
- /package/dist/lib/browser/{intent-resolver-OBGGMBVJ.mjs.map → intent-resolver-BZMUS24C.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-DWMOF2TM.mjs.map → react-surface-3HCM3SHJ.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type ReactiveObject } from '@dxos/live-object';\n\nimport { NAVTREE_PLUGIN } from '../meta';\nimport { type NavTreeItemGraphNode } from '../types';\n\nexport namespace NavTreeCapabilities {\n export const State = defineCapability<{\n state: Map<string, ReactiveObject<{ open: boolean; current: boolean }>>;\n getItem: (path: string[]) => ReactiveObject<{ open: boolean; current: boolean }>;\n setItem: (path: string[], key: 'open' | 'current', next: boolean) => void;\n isOpen: (path: string[], item: NavTreeItemGraphNode) => boolean;\n isCurrent: (path: string[], item: NavTreeItemGraphNode) => boolean;\n }>(`${NAVTREE_PLUGIN}/capability/state`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA,SAASA,wBAAwB;;UAMhBC,sBAAAA;uBACFC,QAAQC,iBAMlB,GAAGC,cAAAA,mBAAiC;AACzC,GARiBH,wBAAAA,sBAAAA,CAAAA,EAAAA;",
|
|
6
|
+
"names": ["defineCapability", "NavTreeCapabilities", "State", "defineCapability", "NAVTREE_PLUGIN"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NavTreeCapabilities
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4RQJXI4D.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 useCallback2, 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
|
|
253
|
+
import { byPosition } 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,37 +641,31 @@ var L0Menu = ({ topLevelItems, pinnedItems, userAccountItem, parent, path }) =>
|
|
|
641
641
|
};
|
|
642
642
|
|
|
643
643
|
// packages/plugins/plugin-navtree/src/components/L1Panels.tsx
|
|
644
|
-
import React7, {
|
|
644
|
+
import React7, { useMemo as useMemo3 } from "react";
|
|
645
645
|
import { useLayout } from "@dxos/app-framework";
|
|
646
|
-
import { Button as Button3, Icon as Icon3,
|
|
646
|
+
import { Button as Button3, Icon as Icon3, 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";
|
|
651
650
|
|
|
652
651
|
// packages/plugins/plugin-navtree/src/components/NavTreeItemColumns.tsx
|
|
653
652
|
import React6, { Fragment, memo } from "react";
|
|
654
653
|
import { isAction as isAction3 } from "@dxos/app-graph";
|
|
655
|
-
import {
|
|
654
|
+
import { Popover as Popover2, toLocalizedString as toLocalizedString5, Treegrid, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
656
655
|
|
|
657
656
|
// packages/plugins/plugin-navtree/src/components/NavTreeItemAction.tsx
|
|
658
657
|
import React5, { useRef as useRef2 } from "react";
|
|
659
|
-
import { useTranslation as useTranslation5, toLocalizedString as toLocalizedString4, IconButton
|
|
658
|
+
import { useTranslation as useTranslation5, toLocalizedString as toLocalizedString4, IconButton } from "@dxos/react-ui";
|
|
660
659
|
import { DropdownMenu, MenuProvider } from "@dxos/react-ui-menu";
|
|
661
660
|
import { hoverableControlItem, hoverableOpenControlItem, mx as mx3 } from "@dxos/react-ui-theme";
|
|
662
661
|
var fallbackIcon = "ph--placeholder--regular";
|
|
663
|
-
var
|
|
662
|
+
var actionButtonProps = {
|
|
664
663
|
size: 4,
|
|
665
664
|
density: "fine"
|
|
666
665
|
};
|
|
667
|
-
var coarseActionButtonProps = {
|
|
668
|
-
size: 5,
|
|
669
|
-
density: "coarse"
|
|
670
|
-
};
|
|
671
666
|
var NavTreeItemActionDropdownMenu = ({ label, icon, testId, menuActions, onAction }) => {
|
|
672
667
|
const { t } = useTranslation5(NAVTREE_PLUGIN);
|
|
673
668
|
const suppressNextTooltip = useRef2(false);
|
|
674
|
-
const density = useDensityContext();
|
|
675
669
|
return /* @__PURE__ */ React5.createElement(MenuProvider, {
|
|
676
670
|
onAction
|
|
677
671
|
}, /* @__PURE__ */ React5.createElement(DropdownMenu.Root, {
|
|
@@ -680,7 +674,7 @@ var NavTreeItemActionDropdownMenu = ({ label, icon, testId, menuActions, onActio
|
|
|
680
674
|
}, /* @__PURE__ */ React5.createElement(DropdownMenu.Trigger, {
|
|
681
675
|
asChild: true
|
|
682
676
|
}, /* @__PURE__ */ React5.createElement(IconButton, {
|
|
683
|
-
...
|
|
677
|
+
...actionButtonProps,
|
|
684
678
|
classNames: mx3("shrink-0 pli-2 pointer-fine:pli-1", hoverableControlItem, hoverableOpenControlItem),
|
|
685
679
|
variant: "ghost",
|
|
686
680
|
icon: icon ?? fallbackIcon,
|
|
@@ -693,9 +687,8 @@ var NavTreeItemActionDropdownMenu = ({ label, icon, testId, menuActions, onActio
|
|
|
693
687
|
var NavTreeItemMonolithicAction = ({ parent, properties: { disabled, caller, testId, icon, variant = "ghost", iconOnly = true } = {
|
|
694
688
|
label: "never"
|
|
695
689
|
}, data: invoke, baseLabel }) => {
|
|
696
|
-
const density = useDensityContext();
|
|
697
690
|
return /* @__PURE__ */ React5.createElement(IconButton, {
|
|
698
|
-
...
|
|
691
|
+
...actionButtonProps,
|
|
699
692
|
variant,
|
|
700
693
|
classNames: mx3("shrink-0", hoverableControlItem, hoverableOpenControlItem, iconOnly ? "pli-2 pointer-fine:pli-1" : "p-2 pointer-fine:p-2 mie-1"),
|
|
701
694
|
icon: icon ?? fallbackIcon,
|
|
@@ -740,7 +733,7 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
|
|
|
740
733
|
};
|
|
741
734
|
|
|
742
735
|
// packages/plugins/plugin-navtree/src/components/NavTreeItemColumns.tsx
|
|
743
|
-
var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open
|
|
736
|
+
var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open }) => {
|
|
744
737
|
const { t } = useTranslation6(NAVTREE_PLUGIN);
|
|
745
738
|
const { getActions: getActions2, renderItemEnd: ItemEnd, popoverAnchorId } = useNavTreeContext();
|
|
746
739
|
const level = path.length - 2;
|
|
@@ -752,9 +745,7 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fi
|
|
|
752
745
|
const ActionRoot = popoverAnchorId === `dxos.org/ui/${NAV_TREE_ITEM}/${item.id}` ? Popover2.Anchor : Fragment;
|
|
753
746
|
useLoadDescendents(item);
|
|
754
747
|
useLoadDescendents(primaryAction && !isAction3(primaryAction) ? primaryAction : void 0);
|
|
755
|
-
return /* @__PURE__ */ React6.createElement(
|
|
756
|
-
density
|
|
757
|
-
}, /* @__PURE__ */ React6.createElement("div", {
|
|
748
|
+
return /* @__PURE__ */ React6.createElement("div", {
|
|
758
749
|
role: "none",
|
|
759
750
|
className: "contents app-no-drag"
|
|
760
751
|
}, primaryAction?.properties?.disposition === "list-item-primary" && !primaryAction?.properties?.disabled ? /* @__PURE__ */ React6.createElement(NavTreeItemAction, {
|
|
@@ -779,67 +770,14 @@ var NavTreeItemColumns = /* @__PURE__ */ memo(({ path, item, open, density = "fi
|
|
|
779
770
|
}) : /* @__PURE__ */ React6.createElement(Treegrid.Cell, null)), ItemEnd && /* @__PURE__ */ React6.createElement(ItemEnd, {
|
|
780
771
|
node: item,
|
|
781
772
|
open
|
|
782
|
-
}))
|
|
773
|
+
}));
|
|
783
774
|
});
|
|
784
775
|
|
|
785
776
|
// 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
|
-
};
|
|
802
777
|
var L1Panel = ({ item, path, currentItemId, onBack }) => {
|
|
803
778
|
const layout = useLayout();
|
|
804
|
-
const
|
|
779
|
+
const navTreeContext = useNavTreeContext();
|
|
805
780
|
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;
|
|
843
781
|
return /* @__PURE__ */ React7.createElement(Tabs2.Tabpanel, {
|
|
844
782
|
key: item.id,
|
|
845
783
|
value: item.id,
|
|
@@ -848,45 +786,29 @@ var L1Panel = ({ item, path, currentItemId, onBack }) => {
|
|
|
848
786
|
item.id === currentItemId && "grid"
|
|
849
787
|
],
|
|
850
788
|
tabIndex: -1,
|
|
851
|
-
"aria-label": title,
|
|
852
789
|
...!layout.sidebarOpen && {
|
|
853
790
|
inert: "true"
|
|
854
791
|
}
|
|
855
792
|
}, item.id === currentItemId && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("h2", {
|
|
856
|
-
className: "flex items-center border-be border-separator app-drag
|
|
857
|
-
},
|
|
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, {
|
|
793
|
+
className: "flex items-center border-be border-separator app-drag"
|
|
794
|
+
}, /* @__PURE__ */ React7.createElement(Button3, {
|
|
863
795
|
variant: "ghost",
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
icon:
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
}), /* @__PURE__ */ React7.createElement(NavTreeItemColumns, {
|
|
796
|
+
density: "fine",
|
|
797
|
+
classNames: mx4("is-6 pli-0 dx-focus-ring-inset", !item.id.startsWith("!") && "invisible", hoverableControlItem2, hoverableOpenControlItem2),
|
|
798
|
+
onClick: onBack
|
|
799
|
+
}, /* @__PURE__ */ React7.createElement(Icon3, {
|
|
800
|
+
icon: "ph--caret-left--regular",
|
|
801
|
+
size: 3
|
|
802
|
+
})), /* @__PURE__ */ React7.createElement("span", {
|
|
803
|
+
className: "flex-1 truncate cursor-default"
|
|
804
|
+
}, toLocalizedString6(item.properties.label, t)), /* @__PURE__ */ React7.createElement(NavTreeItemColumns, {
|
|
873
805
|
path,
|
|
874
806
|
item,
|
|
875
|
-
open: true
|
|
876
|
-
density: "coarse"
|
|
807
|
+
open: true
|
|
877
808
|
})), /* @__PURE__ */ React7.createElement("div", {
|
|
878
809
|
role: "none",
|
|
879
810
|
className: "overflow-y-auto"
|
|
880
|
-
},
|
|
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, {
|
|
811
|
+
}, /* @__PURE__ */ React7.createElement(Tree, {
|
|
890
812
|
...navTreeContext,
|
|
891
813
|
id: item.id,
|
|
892
814
|
root: item,
|
|
@@ -944,7 +866,7 @@ var L1Panels = ({ topLevelItems, path, currentItemId, onBack }) => {
|
|
|
944
866
|
var NAV_TREE_ITEM = "NavTreeItem";
|
|
945
867
|
var NavTree = ({ id, root }) => {
|
|
946
868
|
const { tab, getItems, onBack } = useNavTreeContext();
|
|
947
|
-
const topLevelActions = getItems(root, "item").toSorted((a, b) =>
|
|
869
|
+
const topLevelActions = getItems(root, "item").toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
948
870
|
const topLevelCollections = getItems(root, "collection");
|
|
949
871
|
const topLevelWorkspaces = getItems(root, "workspace");
|
|
950
872
|
const topLevelNavigation = getItems(root, "navigation");
|
|
@@ -959,7 +881,7 @@ var NavTree = ({ id, root }) => {
|
|
|
959
881
|
topLevelWorkspaces,
|
|
960
882
|
topLevelNavigation
|
|
961
883
|
]);
|
|
962
|
-
const pinnedItems = getItems(root, "pin-end").toSorted((a, b) =>
|
|
884
|
+
const pinnedItems = getItems(root, "pin-end").toSorted((a, b) => byPosition(a.properties, b.properties));
|
|
963
885
|
const userAccountItem = getItems(root, "user-account")[0];
|
|
964
886
|
const topLevelItems = useMemo4(() => [
|
|
965
887
|
...l0Items,
|
|
@@ -1001,10 +923,10 @@ var NavTree = ({ id, root }) => {
|
|
|
1001
923
|
// packages/plugins/plugin-navtree/src/capabilities/index.ts
|
|
1002
924
|
import { lazy } from "@dxos/app-framework";
|
|
1003
925
|
var AppGraphBuilder = lazy(() => import("./app-graph-builder-26D3MUCA.mjs"));
|
|
1004
|
-
var IntentResolver = lazy(() => import("./intent-resolver-
|
|
926
|
+
var IntentResolver = lazy(() => import("./intent-resolver-BZMUS24C.mjs"));
|
|
1005
927
|
var Keyboard2 = lazy(() => import("./keyboard-IQXHKUWM.mjs"));
|
|
1006
|
-
var ReactSurface = lazy(() => import("./react-surface-
|
|
1007
|
-
var State = lazy(() => import("./state-
|
|
928
|
+
var ReactSurface = lazy(() => import("./react-surface-3HCM3SHJ.mjs"));
|
|
929
|
+
var State = lazy(() => import("./state-M5UJ3MHL.mjs"));
|
|
1008
930
|
|
|
1009
931
|
// packages/plugins/plugin-navtree/src/components/NavTreeContainer.tsx
|
|
1010
932
|
var NODE_TYPE = "dxos/app-graph/node";
|
|
@@ -1025,15 +947,15 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1025
947
|
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
1026
948
|
const { graph } = useAppGraph2();
|
|
1027
949
|
const layout = useLayout2();
|
|
1028
|
-
const { isOpen, isCurrent,
|
|
1029
|
-
const getActions2 =
|
|
950
|
+
const { isOpen, isCurrent, setItem } = useCapability(NavTreeCapabilities.State);
|
|
951
|
+
const getActions2 = useCallback2((node) => getActions(graph, node), [
|
|
1030
952
|
graph
|
|
1031
953
|
]);
|
|
1032
|
-
const getItems =
|
|
954
|
+
const getItems = useCallback2((node, disposition) => {
|
|
1033
955
|
return graph.nodes(node ?? graph.root, {
|
|
1034
956
|
filter: (node2) => {
|
|
1035
957
|
return untracked(() => {
|
|
1036
|
-
if (
|
|
958
|
+
if (node2.properties.disposition === "hidden") {
|
|
1037
959
|
return false;
|
|
1038
960
|
} else if (!disposition) {
|
|
1039
961
|
const action = isAction4(node2);
|
|
@@ -1047,7 +969,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1047
969
|
}, [
|
|
1048
970
|
graph
|
|
1049
971
|
]);
|
|
1050
|
-
const getProps =
|
|
972
|
+
const getProps = useCallback2((node, path) => {
|
|
1051
973
|
const children = getChildren(graph, node, getChildrenFilter, path);
|
|
1052
974
|
const parentOf = children.length > 0 ? children.map(({ id }) => id) : node.properties.role === "branch" ? [] : void 0;
|
|
1053
975
|
return {
|
|
@@ -1063,7 +985,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1063
985
|
}, [
|
|
1064
986
|
graph
|
|
1065
987
|
]);
|
|
1066
|
-
const loadDescendents =
|
|
988
|
+
const loadDescendents = useCallback2((node) => {
|
|
1067
989
|
void expandActions(graph, node);
|
|
1068
990
|
if (!isActionLike2(node)) {
|
|
1069
991
|
void expandChildren(graph, node).then(() => (
|
|
@@ -1077,7 +999,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1077
999
|
}, [
|
|
1078
1000
|
graph
|
|
1079
1001
|
]);
|
|
1080
|
-
const onOpenChange =
|
|
1002
|
+
const onOpenChange = useCallback2(({ item: { id }, path, open }) => {
|
|
1081
1003
|
setItem(path, "open", open);
|
|
1082
1004
|
if (graph) {
|
|
1083
1005
|
const node = graph.findNode(id);
|
|
@@ -1086,7 +1008,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1086
1008
|
}, [
|
|
1087
1009
|
graph
|
|
1088
1010
|
]);
|
|
1089
|
-
const onTabChange =
|
|
1011
|
+
const onTabChange = useCallback2(async (node) => {
|
|
1090
1012
|
await dispatch(createIntent4(LayoutAction4.SwitchWorkspace, {
|
|
1091
1013
|
part: "workspace",
|
|
1092
1014
|
subject: node.id
|
|
@@ -1106,7 +1028,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1106
1028
|
dispatch,
|
|
1107
1029
|
layout
|
|
1108
1030
|
]);
|
|
1109
|
-
const canDrop =
|
|
1031
|
+
const canDrop = useCallback2((source, target) => {
|
|
1110
1032
|
const sourceNode = source.item;
|
|
1111
1033
|
const targetNode = target.item;
|
|
1112
1034
|
if (isSpace(targetNode.data)) {
|
|
@@ -1117,7 +1039,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1117
1039
|
return false;
|
|
1118
1040
|
}
|
|
1119
1041
|
}, []);
|
|
1120
|
-
const handleSelect =
|
|
1042
|
+
const handleSelect = useCallback2(({ item: node, path, option }) => {
|
|
1121
1043
|
if (!node.data) {
|
|
1122
1044
|
return;
|
|
1123
1045
|
}
|
|
@@ -1176,7 +1098,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1176
1098
|
isCurrent,
|
|
1177
1099
|
isLg
|
|
1178
1100
|
]);
|
|
1179
|
-
const onBack =
|
|
1101
|
+
const onBack = useCallback2(() => dispatch(createIntent4(LayoutAction4.RevertWorkspace, {
|
|
1180
1102
|
part: "workspace",
|
|
1181
1103
|
options: {
|
|
1182
1104
|
revert: true
|
|
@@ -1234,11 +1156,6 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1234
1156
|
}, [
|
|
1235
1157
|
graph
|
|
1236
1158
|
]);
|
|
1237
|
-
const setAlternateTree = useCallback3((path, open) => {
|
|
1238
|
-
setItem(path, "alternateTree", open);
|
|
1239
|
-
}, [
|
|
1240
|
-
setItem
|
|
1241
|
-
]);
|
|
1242
1159
|
const navTreeContextValue = useMemo5(() => ({
|
|
1243
1160
|
tab,
|
|
1244
1161
|
onTabChange,
|
|
@@ -1254,9 +1171,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1254
1171
|
isOpen,
|
|
1255
1172
|
onOpenChange,
|
|
1256
1173
|
canDrop,
|
|
1257
|
-
onSelect: handleSelect
|
|
1258
|
-
isAlternateTree,
|
|
1259
|
-
setAlternateTree
|
|
1174
|
+
onSelect: handleSelect
|
|
1260
1175
|
}), [
|
|
1261
1176
|
tab,
|
|
1262
1177
|
onTabChange,
|
|
@@ -1272,9 +1187,7 @@ var NavTreeContainer = /* @__PURE__ */ memo2(({ tab, popoverAnchorId, topbar })
|
|
|
1272
1187
|
isOpen,
|
|
1273
1188
|
onOpenChange,
|
|
1274
1189
|
canDrop,
|
|
1275
|
-
handleSelect
|
|
1276
|
-
isAlternateTree,
|
|
1277
|
-
setAlternateTree
|
|
1190
|
+
handleSelect
|
|
1278
1191
|
]);
|
|
1279
1192
|
return /* @__PURE__ */ React9.createElement(NavTreeContext.Provider, {
|
|
1280
1193
|
value: navTreeContextValue
|
|
@@ -1306,4 +1219,4 @@ export {
|
|
|
1306
1219
|
ReactSurface,
|
|
1307
1220
|
State
|
|
1308
1221
|
};
|
|
1309
|
-
//# sourceMappingURL=chunk-
|
|
1222
|
+
//# sourceMappingURL=chunk-DN43QXSX.mjs.map
|