@dxos/plugin-navtree 0.7.4 → 0.7.5-main.9cb18ac
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-PSVCPL4T.mjs → chunk-VAXG4OAG.mjs} +3 -1
- package/dist/lib/browser/chunk-VAXG4OAG.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +124 -144
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +3 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/components/CommandsTrigger.d.ts.map +1 -1
- package/dist/types/src/components/NavTree.d.ts +2 -0
- package/dist/types/src/components/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeContainer.d.ts.map +1 -1
- package/dist/types/src/components/NavTreeFooter.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -0
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +29 -29
- package/src/NavTreePlugin.tsx +67 -62
- package/src/components/CommandsDialog.tsx +3 -3
- package/src/components/CommandsTrigger.tsx +10 -7
- package/src/components/NavTree.tsx +6 -3
- package/src/components/NavTreeContainer.tsx +32 -54
- package/src/components/NavTreeFooter.tsx +3 -2
- package/src/components/NavTreeItemAction.tsx +3 -3
- package/src/components/NotchStart.tsx +4 -4
- package/src/meta.ts +2 -0
- package/dist/lib/browser/chunk-PSVCPL4T.mjs.map +0 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// packages/plugins/plugin-navtree/src/meta.ts
|
|
2
2
|
var NAVTREE_PLUGIN = "dxos.org/plugin/navtree";
|
|
3
3
|
var KEY_BINDING = "KeyBinding";
|
|
4
|
+
var COMMANDS_DIALOG = `${NAVTREE_PLUGIN}/CommandsDialog`;
|
|
4
5
|
var meta_default = {
|
|
5
6
|
id: NAVTREE_PLUGIN
|
|
6
7
|
};
|
|
@@ -8,6 +9,7 @@ var meta_default = {
|
|
|
8
9
|
export {
|
|
9
10
|
NAVTREE_PLUGIN,
|
|
10
11
|
KEY_BINDING,
|
|
12
|
+
COMMANDS_DIALOG,
|
|
11
13
|
meta_default
|
|
12
14
|
};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
15
|
+
//# sourceMappingURL=chunk-VAXG4OAG.mjs.map
|
|
@@ -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// TODO(wittjosiah): Factor out.\nexport const COMMANDS_DIALOG = `${NAVTREE_PLUGIN}/CommandsDialog`;\n\nexport default {\n id: NAVTREE_PLUGIN,\n} satisfies PluginMeta;\n"],
|
|
5
|
+
"mappings": ";AAMO,IAAMA,iBAAiB;AAGvB,IAAMC,cAAc;AAEpB,IAAMC,kBAAkB,GAAGF,cAAAA;AAElC,IAAA,eAAe;EACbG,IAAIH;AACN;",
|
|
6
|
+
"names": ["NAVTREE_PLUGIN", "KEY_BINDING", "COMMANDS_DIALOG", "id"]
|
|
7
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
|
+
COMMANDS_DIALOG,
|
|
2
3
|
KEY_BINDING,
|
|
3
4
|
NAVTREE_PLUGIN,
|
|
4
5
|
meta_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VAXG4OAG.mjs";
|
|
6
7
|
|
|
7
8
|
// packages/plugins/plugin-navtree/src/NavTreePlugin.tsx
|
|
8
9
|
import { effect } from "@preact/signals-core";
|
|
9
10
|
import React9 from "react";
|
|
10
|
-
import { LayoutAction as LayoutAction4, NavigationAction as NavigationAction2, parseGraphPlugin, parseIntentPlugin, parseLayoutPlugin, parseNavigationPlugin as parseNavigationPlugin2, resolvePlugin } from "@dxos/app-framework";
|
|
11
|
+
import { createIntent as createIntent6, createResolver, createSurface, LayoutAction as LayoutAction4, NavigationAction as NavigationAction2, parseGraphPlugin, parseIntentPlugin, parseLayoutPlugin, parseNavigationPlugin as parseNavigationPlugin2, resolvePlugin } from "@dxos/app-framework";
|
|
11
12
|
import { createExtension, isAction as isAction5, isGraphNode } from "@dxos/app-graph";
|
|
12
13
|
import { Keyboard as Keyboard2 } from "@dxos/keyboard";
|
|
13
14
|
import { create } from "@dxos/live-object";
|
|
@@ -16,7 +17,7 @@ import { getHostPlatform as getHostPlatform3 } from "@dxos/util";
|
|
|
16
17
|
|
|
17
18
|
// packages/plugins/plugin-navtree/src/components/CommandsDialog.tsx
|
|
18
19
|
import React, { useMemo, useState } from "react";
|
|
19
|
-
import { useIntentDispatcher, LayoutAction } from "@dxos/app-framework";
|
|
20
|
+
import { useIntentDispatcher, LayoutAction, createIntent } from "@dxos/app-framework";
|
|
20
21
|
import { isActionGroup, isAction } from "@dxos/app-graph";
|
|
21
22
|
import { Keyboard, keySymbols } from "@dxos/keyboard";
|
|
22
23
|
import { useGraph } from "@dxos/plugin-graph";
|
|
@@ -27,7 +28,7 @@ import { getHostPlatform } from "@dxos/util";
|
|
|
27
28
|
var CommandsDialogContent = ({ selected: initial }) => {
|
|
28
29
|
const { t } = useTranslation(NAVTREE_PLUGIN);
|
|
29
30
|
const [selected, setSelected] = useState(initial);
|
|
30
|
-
const dispatch = useIntentDispatcher();
|
|
31
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
31
32
|
const { graph } = useGraph();
|
|
32
33
|
const allActions = useMemo(() => {
|
|
33
34
|
const current = Keyboard.singleton.getCurrentContext();
|
|
@@ -78,13 +79,10 @@ var CommandsDialogContent = ({ selected: initial }) => {
|
|
|
78
79
|
setSelected(action.id);
|
|
79
80
|
return;
|
|
80
81
|
}
|
|
81
|
-
void dispatch({
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
state: false
|
|
86
|
-
}
|
|
87
|
-
});
|
|
82
|
+
void dispatch(createIntent(LayoutAction.SetLayout, {
|
|
83
|
+
element: "dialog",
|
|
84
|
+
state: false
|
|
85
|
+
}));
|
|
88
86
|
setTimeout(() => {
|
|
89
87
|
const node = graph.nodes(group ?? action, {
|
|
90
88
|
relation: "inbound"
|
|
@@ -166,9 +164,7 @@ var NavTreeItemActionDropdownMenu = ({ label, icon, testId, defaultMenuOpen, men
|
|
|
166
164
|
}, toLocalizedString2(label, t)), /* @__PURE__ */ React2.createElement(Icon2, {
|
|
167
165
|
icon: icon ?? fallbackIcon,
|
|
168
166
|
size: 4
|
|
169
|
-
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, {
|
|
170
|
-
classNames: "z-[31]"
|
|
171
|
-
}, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, menuActions?.map((action) => {
|
|
167
|
+
})))), /* @__PURE__ */ React2.createElement(DropdownMenu.Portal, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Content, null, /* @__PURE__ */ React2.createElement(DropdownMenu.Viewport, null, menuActions?.map((action) => {
|
|
172
168
|
const shortcut = getShortcut(action);
|
|
173
169
|
return /* @__PURE__ */ React2.createElement(DropdownMenu.Item, {
|
|
174
170
|
key: action.id,
|
|
@@ -241,7 +237,7 @@ var NavTreeItemActionSearchList = ({ menuActions, icon, label, testId, suppressN
|
|
|
241
237
|
icon: icon ?? fallbackIcon,
|
|
242
238
|
size: 4
|
|
243
239
|
})))), /* @__PURE__ */ React2.createElement(Dialog2.Portal, null, /* @__PURE__ */ React2.createElement(Dialog2.Overlay, null, /* @__PURE__ */ React2.createElement(Dialog2.Content, {
|
|
244
|
-
classNames: "
|
|
240
|
+
classNames: "is-full max-is-[24rem] pli-2 plb-1"
|
|
245
241
|
}, /* @__PURE__ */ React2.createElement(SearchList2.Root, {
|
|
246
242
|
label: t("tree item searchlist input placeholder")
|
|
247
243
|
}, /* @__PURE__ */ React2.createElement(SearchList2.Input, {
|
|
@@ -366,11 +362,12 @@ var NavTreeItemAction = ({ monolithic, menuActions, parent: node, ...props }) =>
|
|
|
366
362
|
// packages/plugins/plugin-navtree/src/components/NavTree.tsx
|
|
367
363
|
var NAV_TREE_ITEM = "NavTreeItem";
|
|
368
364
|
var NavTree = ({ getActions: getActions2, loadDescendents, renderItemEnd: renderItemEnd2, popoverAnchorId, ...props }) => {
|
|
369
|
-
const renderColumns = useCallback(({ item, path, menuOpen, setMenuOpen }) => {
|
|
365
|
+
const renderColumns = useCallback(({ item, path, open, menuOpen, setMenuOpen }) => {
|
|
370
366
|
return /* @__PURE__ */ React3.createElement(NavTreeColumns, {
|
|
371
367
|
path,
|
|
372
368
|
node: item,
|
|
373
369
|
getActions: getActions2,
|
|
370
|
+
open,
|
|
374
371
|
menuOpen,
|
|
375
372
|
setMenuOpen,
|
|
376
373
|
loadDescendents,
|
|
@@ -389,7 +386,7 @@ var NavTree = ({ getActions: getActions2, loadDescendents, renderItemEnd: render
|
|
|
389
386
|
renderColumns
|
|
390
387
|
});
|
|
391
388
|
};
|
|
392
|
-
var NavTreeColumns = ({ path, node, getActions: getActions2, menuOpen, setMenuOpen, loadDescendents, renderItemEnd: ItemEnd, popoverAnchorId }) => {
|
|
389
|
+
var NavTreeColumns = ({ path, node, getActions: getActions2, open, menuOpen, setMenuOpen, loadDescendents, renderItemEnd: ItemEnd, popoverAnchorId }) => {
|
|
393
390
|
const { t } = useTranslation3(NAVTREE_PLUGIN);
|
|
394
391
|
const level = path.length - 2;
|
|
395
392
|
const { actions: _actions, groupedActions } = getActions2(node);
|
|
@@ -431,7 +428,8 @@ var NavTreeColumns = ({ path, node, getActions: getActions2, menuOpen, setMenuOp
|
|
|
431
428
|
menuOpen,
|
|
432
429
|
onChangeMenuOpen: setMenuOpen
|
|
433
430
|
}) : /* @__PURE__ */ React3.createElement(Treegrid.Cell, null)), ItemEnd && /* @__PURE__ */ React3.createElement(ItemEnd, {
|
|
434
|
-
node
|
|
431
|
+
node,
|
|
432
|
+
open
|
|
435
433
|
}));
|
|
436
434
|
};
|
|
437
435
|
|
|
@@ -440,11 +438,11 @@ import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/ad
|
|
|
440
438
|
import { extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item";
|
|
441
439
|
import { untracked } from "@preact/signals-core";
|
|
442
440
|
import React5, { memo, useCallback as useCallback2, useEffect as useEffect2 } from "react";
|
|
443
|
-
import { LayoutAction as LayoutAction2, NavigationAction, Surface, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
441
|
+
import { createIntent as createIntent3, LayoutAction as LayoutAction2, NavigationAction, Surface, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
444
442
|
import { isAction as isAction4, isActionLike } from "@dxos/app-graph";
|
|
445
443
|
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
446
444
|
import { isEchoObject, isSpace } from "@dxos/react-client/echo";
|
|
447
|
-
import {
|
|
445
|
+
import { useMediaQuery, useSidebars as useSidebars2 } from "@dxos/react-ui";
|
|
448
446
|
import { isTreeData } from "@dxos/react-ui-list";
|
|
449
447
|
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
450
448
|
import { arrayMove } from "@dxos/util";
|
|
@@ -453,7 +451,7 @@ import { arrayMove } from "@dxos/util";
|
|
|
453
451
|
import { ArrowSquareOut, GearSix, Warning } from "@phosphor-icons/react";
|
|
454
452
|
import { formatDistance } from "date-fns/formatDistance";
|
|
455
453
|
import React4 from "react";
|
|
456
|
-
import { SettingsAction, parseNavigationPlugin, useResolvePlugin, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
454
|
+
import { SettingsAction, parseNavigationPlugin, useResolvePlugin, useIntentDispatcher as useIntentDispatcher2, createIntent as createIntent2 } from "@dxos/app-framework";
|
|
457
455
|
import { useConfig } from "@dxos/react-client";
|
|
458
456
|
import { Button as Button3, Link, Message, Popover as Popover2, Tooltip as Tooltip2, Trans, useDefaultValue, useSidebars, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
459
457
|
import { LayoutControls } from "@dxos/react-ui-stack";
|
|
@@ -466,7 +464,7 @@ var NavTreeFooter = (props) => {
|
|
|
466
464
|
const config = useConfig();
|
|
467
465
|
const { t } = useTranslation4(NAVTREE_PLUGIN);
|
|
468
466
|
const { navigationSidebarOpen } = useSidebars(NAVTREE_PLUGIN);
|
|
469
|
-
const dispatch = useIntentDispatcher2();
|
|
467
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
470
468
|
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
471
469
|
const navigationPlugin = useResolvePlugin(parseNavigationPlugin);
|
|
472
470
|
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
@@ -537,9 +535,7 @@ var NavTreeFooter = (props) => {
|
|
|
537
535
|
...!navigationSidebarOpen && {
|
|
538
536
|
tabIndex: -1
|
|
539
537
|
},
|
|
540
|
-
onClick: () => dispatch(
|
|
541
|
-
action: SettingsAction.OPEN
|
|
542
|
-
})
|
|
538
|
+
onClick: () => dispatch(createIntent2(SettingsAction.Open))
|
|
543
539
|
}, /* @__PURE__ */ React4.createElement("span", {
|
|
544
540
|
className: "sr-only"
|
|
545
541
|
}, t("open settings label")), /* @__PURE__ */ React4.createElement(GearSix, {
|
|
@@ -647,19 +643,21 @@ var expandActions = (graph, node) => {
|
|
|
647
643
|
|
|
648
644
|
// packages/plugins/plugin-navtree/src/components/NavTreeContainer.tsx
|
|
649
645
|
var NODE_TYPE = "dxos/app-graph/node";
|
|
650
|
-
var renderItemEnd = ({ node }) => /* @__PURE__ */ React5.createElement(Surface, {
|
|
646
|
+
var renderItemEnd = ({ node, open }) => /* @__PURE__ */ React5.createElement(Surface, {
|
|
651
647
|
role: "navtree-item-end",
|
|
652
648
|
data: {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
649
|
+
id: node.id,
|
|
650
|
+
subject: node.data,
|
|
651
|
+
open
|
|
652
|
+
},
|
|
653
|
+
limit: 1
|
|
656
654
|
});
|
|
657
655
|
var NavTreeContainer = /* @__PURE__ */ memo(({ isCurrent, popoverAnchorId, ...props }) => {
|
|
658
656
|
const { closeNavigationSidebar } = useSidebars2(NAVTREE_PLUGIN);
|
|
659
657
|
const [isLg] = useMediaQuery("lg", {
|
|
660
658
|
ssr: false
|
|
661
659
|
});
|
|
662
|
-
const dispatch = useIntentDispatcher3();
|
|
660
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
663
661
|
const { graph } = useGraph2();
|
|
664
662
|
const getActions2 = useCallback2((node) => getActions(graph, node), [
|
|
665
663
|
graph
|
|
@@ -734,34 +732,25 @@ var NavTreeContainer = /* @__PURE__ */ memo(({ isCurrent, popoverAnchorId, ...pr
|
|
|
734
732
|
}
|
|
735
733
|
const current = isCurrent(path, node);
|
|
736
734
|
if (!current) {
|
|
737
|
-
void dispatch({
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
node.id
|
|
743
|
-
]
|
|
744
|
-
}
|
|
735
|
+
void dispatch(createIntent3(NavigationAction.Open, {
|
|
736
|
+
activeParts: {
|
|
737
|
+
main: [
|
|
738
|
+
node.id
|
|
739
|
+
]
|
|
745
740
|
}
|
|
746
|
-
});
|
|
741
|
+
}));
|
|
747
742
|
} else if (option) {
|
|
748
|
-
void dispatch({
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
node.id
|
|
754
|
-
]
|
|
755
|
-
}
|
|
743
|
+
void dispatch(createIntent3(NavigationAction.Close, {
|
|
744
|
+
activeParts: {
|
|
745
|
+
main: [
|
|
746
|
+
node.id
|
|
747
|
+
]
|
|
756
748
|
}
|
|
757
|
-
});
|
|
749
|
+
}));
|
|
758
750
|
} else {
|
|
759
|
-
void dispatch({
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
id: node.id
|
|
763
|
-
}
|
|
764
|
-
});
|
|
751
|
+
void dispatch(createIntent3(LayoutAction2.ScrollIntoView, {
|
|
752
|
+
id: node.id
|
|
753
|
+
}));
|
|
765
754
|
}
|
|
766
755
|
const defaultAction = graph.actions(node).find((action) => action.properties?.disposition === "default");
|
|
767
756
|
if (isAction4(defaultAction)) {
|
|
@@ -827,9 +816,7 @@ var NavTreeContainer = /* @__PURE__ */ memo(({ isCurrent, popoverAnchorId, ...pr
|
|
|
827
816
|
}, [
|
|
828
817
|
graph
|
|
829
818
|
]);
|
|
830
|
-
return /* @__PURE__ */ React5.createElement(
|
|
831
|
-
elevation: "chrome"
|
|
832
|
-
}, /* @__PURE__ */ React5.createElement("div", {
|
|
819
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
833
820
|
role: "none",
|
|
834
821
|
className: "grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] bs-full overflow-hidden"
|
|
835
822
|
}, /* @__PURE__ */ React5.createElement("div", {
|
|
@@ -853,7 +840,7 @@ var NavTreeContainer = /* @__PURE__ */ memo(({ isCurrent, popoverAnchorId, ...pr
|
|
|
853
840
|
canDrop,
|
|
854
841
|
onSelect: handleSelect,
|
|
855
842
|
...props
|
|
856
|
-
})), /* @__PURE__ */ React5.createElement(NavTreeFooter, null))
|
|
843
|
+
})), /* @__PURE__ */ React5.createElement(NavTreeFooter, null));
|
|
857
844
|
});
|
|
858
845
|
|
|
859
846
|
// packages/plugins/plugin-navtree/src/components/NavTreeDocumentTitle.tsx
|
|
@@ -873,8 +860,8 @@ var NavTreeDocumentTitle = ({ node }) => {
|
|
|
873
860
|
|
|
874
861
|
// packages/plugins/plugin-navtree/src/components/NotchStart.tsx
|
|
875
862
|
import React7 from "react";
|
|
876
|
-
import { useIntentDispatcher as useIntentDispatcher4, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
|
|
877
|
-
import { ClientAction } from "@dxos/plugin-client/
|
|
863
|
+
import { createIntent as createIntent4, useIntentDispatcher as useIntentDispatcher4, useResolvePlugin as useResolvePlugin2 } from "@dxos/app-framework";
|
|
864
|
+
import { ClientAction } from "@dxos/plugin-client/types";
|
|
878
865
|
import { parseObservabilityPlugin } from "@dxos/plugin-observability";
|
|
879
866
|
import { useIdentity } from "@dxos/react-client/halo";
|
|
880
867
|
|
|
@@ -911,38 +898,33 @@ var HaloButton = (props) => {
|
|
|
911
898
|
var NotchStart = () => {
|
|
912
899
|
const identity = useIdentity();
|
|
913
900
|
const observabilityPlugin = useResolvePlugin2(parseObservabilityPlugin);
|
|
914
|
-
const dispatch = useIntentDispatcher4();
|
|
901
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
915
902
|
return /* @__PURE__ */ React7.createElement(HaloButton, {
|
|
916
903
|
size: 8,
|
|
917
904
|
identityKey: identity?.identityKey.toHex(),
|
|
918
905
|
hue: identity?.profile?.data?.hue,
|
|
919
906
|
emoji: identity?.profile?.data?.emoji,
|
|
920
907
|
internal: observabilityPlugin?.provides?.observability?.group === "dxos",
|
|
921
|
-
onClick: () => dispatch(
|
|
922
|
-
action: ClientAction.SHARE_IDENTITY
|
|
923
|
-
})
|
|
908
|
+
onClick: () => dispatch(createIntent4(ClientAction.ShareIdentity))
|
|
924
909
|
});
|
|
925
910
|
};
|
|
926
911
|
|
|
927
912
|
// packages/plugins/plugin-navtree/src/components/CommandsTrigger.tsx
|
|
928
913
|
import { MagnifyingGlass } from "@phosphor-icons/react";
|
|
929
914
|
import React8 from "react";
|
|
930
|
-
import { LayoutAction as LayoutAction3,
|
|
915
|
+
import { createIntent as createIntent5, LayoutAction as LayoutAction3, useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework";
|
|
931
916
|
import { Button as Button4, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
932
917
|
import { getSize as getSize2 } from "@dxos/react-ui-theme";
|
|
933
918
|
var CommandsTrigger = () => {
|
|
934
|
-
const { dispatch } =
|
|
919
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
935
920
|
const { t } = useTranslation6(NAVTREE_PLUGIN);
|
|
936
921
|
return /* @__PURE__ */ React8.createElement(Button4, {
|
|
937
922
|
classNames: "w-full h-full !rounded-none",
|
|
938
|
-
onClick: () => dispatch({
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
dialogBlockAlign: "start"
|
|
944
|
-
}
|
|
945
|
-
})
|
|
923
|
+
onClick: () => dispatch(createIntent5(LayoutAction3.SetLayout, {
|
|
924
|
+
element: "dialog",
|
|
925
|
+
component: COMMANDS_DIALOG,
|
|
926
|
+
dialogBlockAlign: "start"
|
|
927
|
+
}))
|
|
946
928
|
}, /* @__PURE__ */ React8.createElement("span", {
|
|
947
929
|
className: "text-description font-normal grow text-start"
|
|
948
930
|
}, t("command list input placeholder")), /* @__PURE__ */ React8.createElement(MagnifyingGlass, {
|
|
@@ -1048,7 +1030,7 @@ var NavTreePlugin = () => {
|
|
|
1048
1030
|
};
|
|
1049
1031
|
return {
|
|
1050
1032
|
meta: meta_default,
|
|
1051
|
-
ready: async (plugins) => {
|
|
1033
|
+
ready: async ({ plugins }) => {
|
|
1052
1034
|
const layout = resolvePlugin(plugins, parseLayoutPlugin)?.provides.layout;
|
|
1053
1035
|
const location = resolvePlugin(plugins, parseNavigationPlugin2)?.provides.location;
|
|
1054
1036
|
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
@@ -1057,15 +1039,11 @@ var NavTreePlugin = () => {
|
|
|
1057
1039
|
return;
|
|
1058
1040
|
}
|
|
1059
1041
|
const soloPart = location?.active.solo?.[0];
|
|
1060
|
-
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.
|
|
1042
|
+
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
|
|
1061
1043
|
if (dispatch && soloPart) {
|
|
1062
|
-
void dispatch({
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
data: {
|
|
1066
|
-
id: soloPart.id
|
|
1067
|
-
}
|
|
1068
|
-
});
|
|
1044
|
+
void dispatch(createIntent6(NavigationAction2.Expose, {
|
|
1045
|
+
id: soloPart.id
|
|
1046
|
+
}));
|
|
1069
1047
|
}
|
|
1070
1048
|
let previous = [];
|
|
1071
1049
|
unsubscribe = effect(() => {
|
|
@@ -1143,81 +1121,83 @@ var NavTreePlugin = () => {
|
|
|
1143
1121
|
}
|
|
1144
1122
|
},
|
|
1145
1123
|
surface: {
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1124
|
+
definitions: () => [
|
|
1125
|
+
createSurface({
|
|
1126
|
+
id: COMMANDS_DIALOG,
|
|
1127
|
+
role: "dialog",
|
|
1128
|
+
filter: (data) => data.component === COMMANDS_DIALOG,
|
|
1129
|
+
component: ({ data }) => /* @__PURE__ */ React9.createElement(CommandsDialogContent, {
|
|
1130
|
+
selected: data.subject
|
|
1131
|
+
})
|
|
1132
|
+
}),
|
|
1133
|
+
createSurface({
|
|
1134
|
+
id: `${NAVTREE_PLUGIN}/navigation`,
|
|
1135
|
+
role: "navigation",
|
|
1136
|
+
component: ({ data }) => /* @__PURE__ */ React9.createElement(NavTreeContainer, {
|
|
1137
|
+
isOpen,
|
|
1138
|
+
isCurrent,
|
|
1139
|
+
onOpenChange: handleOpenChange,
|
|
1140
|
+
popoverAnchorId: data.popoverAnchorId
|
|
1141
|
+
})
|
|
1142
|
+
}),
|
|
1143
|
+
createSurface({
|
|
1144
|
+
id: `${NAVTREE_PLUGIN}/document-title`,
|
|
1145
|
+
role: "document-title",
|
|
1146
|
+
component: ({ data }) => /* @__PURE__ */ React9.createElement(NavTreeDocumentTitle, {
|
|
1147
|
+
node: isGraphNode(data.subject) ? data.subject : void 0
|
|
1148
|
+
})
|
|
1149
|
+
}),
|
|
1150
|
+
createSurface({
|
|
1151
|
+
id: `${NAVTREE_PLUGIN}/notch-start`,
|
|
1152
|
+
role: "notch-start",
|
|
1153
|
+
component: () => /* @__PURE__ */ React9.createElement(NotchStart, null)
|
|
1154
|
+
}),
|
|
1155
|
+
createSurface({
|
|
1156
|
+
id: `${NAVTREE_PLUGIN}/search-input`,
|
|
1157
|
+
role: "search-input",
|
|
1158
|
+
disposition: "fallback",
|
|
1159
|
+
component: () => /* @__PURE__ */ React9.createElement(CommandsTrigger, null)
|
|
1160
|
+
})
|
|
1161
|
+
]
|
|
1178
1162
|
},
|
|
1179
1163
|
intent: {
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
const path = await graph.waitForPath({
|
|
1185
|
-
target: intent.data.id
|
|
1186
|
-
});
|
|
1187
|
-
[
|
|
1188
|
-
...Array(path.length)
|
|
1189
|
-
].forEach((_, index) => {
|
|
1190
|
-
const subpath = path.slice(0, index);
|
|
1191
|
-
const value = getItem(subpath);
|
|
1192
|
-
if (!value.open) {
|
|
1193
|
-
setItem(subpath, "open", true);
|
|
1194
|
-
}
|
|
1195
|
-
});
|
|
1196
|
-
}
|
|
1197
|
-
break;
|
|
1198
|
-
}
|
|
1164
|
+
resolvers: ({ plugins }) => {
|
|
1165
|
+
const graph2 = resolvePlugin(plugins, parseGraphPlugin)?.provides.graph;
|
|
1166
|
+
if (!graph2) {
|
|
1167
|
+
return [];
|
|
1199
1168
|
}
|
|
1169
|
+
return createResolver(NavigationAction2.Expose, async ({ id }) => {
|
|
1170
|
+
const path = await graph2.waitForPath({
|
|
1171
|
+
target: id
|
|
1172
|
+
});
|
|
1173
|
+
[
|
|
1174
|
+
...Array(path.length)
|
|
1175
|
+
].forEach((_, index) => {
|
|
1176
|
+
const subpath = path.slice(0, index);
|
|
1177
|
+
const value = getItem(subpath);
|
|
1178
|
+
if (!value.open) {
|
|
1179
|
+
setItem(subpath, "open", true);
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
});
|
|
1200
1183
|
}
|
|
1201
1184
|
},
|
|
1202
1185
|
graph: {
|
|
1203
1186
|
builder: (plugins) => {
|
|
1204
|
-
const
|
|
1187
|
+
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatchPromise;
|
|
1205
1188
|
return [
|
|
1206
1189
|
createExtension({
|
|
1207
1190
|
id: NAVTREE_PLUGIN,
|
|
1208
1191
|
filter: (node) => node.id === "root",
|
|
1209
1192
|
actions: () => [
|
|
1210
1193
|
{
|
|
1211
|
-
id:
|
|
1194
|
+
id: COMMANDS_DIALOG,
|
|
1212
1195
|
data: async () => {
|
|
1213
|
-
await
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
dialogBlockAlign: "start"
|
|
1219
|
-
}
|
|
1220
|
-
});
|
|
1196
|
+
await dispatch?.(createIntent6(LayoutAction4.SetLayout, {
|
|
1197
|
+
element: "dialog",
|
|
1198
|
+
component: COMMANDS_DIALOG,
|
|
1199
|
+
dialogBlockAlign: "start"
|
|
1200
|
+
}));
|
|
1221
1201
|
},
|
|
1222
1202
|
properties: {
|
|
1223
1203
|
label: [
|