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