@dxos/plugin-navtree 0.6.14-staging.e15392e → 0.7.1-staging.599df14
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/index.mjs +50 -38
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/types/src/NavTreePlugin.d.ts.map +1 -1
- package/dist/types/src/components/NavTree.d.ts.map +1 -1
- package/dist/types/src/components/NavTree.stories.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/package.json +28 -28
- package/src/NavTreePlugin.tsx +21 -18
- package/src/components/CommandsTrigger.tsx +1 -1
- package/src/components/NavBarStart.tsx +3 -3
- package/src/components/NavTree.stories.tsx +0 -1
- package/src/components/NavTree.tsx +0 -1
- package/src/components/NavTreeContainer.tsx +5 -3
- package/src/components/NavTreeFooter.tsx +14 -11
- package/src/types.ts +1 -1
|
@@ -6,12 +6,13 @@ import {
|
|
|
6
6
|
|
|
7
7
|
// packages/plugins/plugin-navtree/src/NavTreePlugin.tsx
|
|
8
8
|
import React10 from "react";
|
|
9
|
-
import { resolvePlugin, parseIntentPlugin, LayoutAction as LayoutAction3, parseGraphPlugin, NavigationAction as NavigationAction2 } from "@dxos/app-framework";
|
|
9
|
+
import { resolvePlugin, parseIntentPlugin, LayoutAction as LayoutAction3, parseGraphPlugin, NavigationAction as NavigationAction2, parseNavigationPlugin as parseNavigationPlugin2 } from "@dxos/app-framework";
|
|
10
10
|
import { createExtension, isAction as isAction5, isGraphNode } from "@dxos/app-graph";
|
|
11
11
|
import { invariant } from "@dxos/invariant";
|
|
12
12
|
import { Keyboard as Keyboard2 } from "@dxos/keyboard";
|
|
13
13
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
14
14
|
import { Path as Path2 } from "@dxos/react-ui-mosaic";
|
|
15
|
+
import { mx as mx5 } from "@dxos/react-ui-theme";
|
|
15
16
|
import { getHostPlatform as getHostPlatform3 } from "@dxos/util";
|
|
16
17
|
|
|
17
18
|
// packages/plugins/plugin-navtree/src/components/CommandsDialog.tsx
|
|
@@ -122,7 +123,7 @@ var CommandsDialogContent = ({ selected: initial }) => {
|
|
|
122
123
|
import React2, { Fragment } from "react";
|
|
123
124
|
import { getGraph } from "@dxos/app-graph";
|
|
124
125
|
import { Popover, toLocalizedString as toLocalizedString2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
125
|
-
import {
|
|
126
|
+
import { StackItem } from "@dxos/react-ui-stack";
|
|
126
127
|
var TREE_ITEM_MAIN_HEADING = "TreeItemMainHeading";
|
|
127
128
|
var NavBarStart = ({ activeNode, popoverAnchorId }) => {
|
|
128
129
|
const { t } = useTranslation2(NAVTREE_PLUGIN);
|
|
@@ -131,7 +132,7 @@ var NavBarStart = ({ activeNode, popoverAnchorId }) => {
|
|
|
131
132
|
const actions = graph.actions(activeNode);
|
|
132
133
|
const label = toLocalizedString2(activeNode.properties?.label, t);
|
|
133
134
|
const menuTriggerLabel = t("node actions menu invoker label");
|
|
134
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ActionRoot, null, /* @__PURE__ */ React2.createElement(
|
|
135
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ActionRoot, null, /* @__PURE__ */ React2.createElement(StackItem.Sigil, {
|
|
135
136
|
icon: activeNode.properties?.icon ?? "ph--dots-three-vertical--regular",
|
|
136
137
|
attendableId: activeNode.id,
|
|
137
138
|
triggerLabel: menuTriggerLabel,
|
|
@@ -142,7 +143,7 @@ var NavBarStart = ({ activeNode, popoverAnchorId }) => {
|
|
|
142
143
|
node: action,
|
|
143
144
|
caller: TREE_ITEM_MAIN_HEADING
|
|
144
145
|
})
|
|
145
|
-
})), /* @__PURE__ */ React2.createElement(
|
|
146
|
+
})), /* @__PURE__ */ React2.createElement(StackItem.HeadingLabel, {
|
|
146
147
|
attendableId: activeNode.id
|
|
147
148
|
}, label));
|
|
148
149
|
};
|
|
@@ -413,7 +414,6 @@ var NavTree = ({ loadDescendents, renderPresence: renderPresence2, popoverAnchor
|
|
|
413
414
|
...props,
|
|
414
415
|
draggable: true,
|
|
415
416
|
gridTemplateColumns: "[tree-row-start] 1fr min-content min-content min-content [tree-row-end]",
|
|
416
|
-
classNames: "pbs-1",
|
|
417
417
|
renderColumns
|
|
418
418
|
});
|
|
419
419
|
};
|
|
@@ -478,13 +478,14 @@ import { arrayMove } from "@dxos/util";
|
|
|
478
478
|
import { ArrowSquareOut, GearSix, Warning } from "@phosphor-icons/react";
|
|
479
479
|
import { formatDistance } from "date-fns/formatDistance";
|
|
480
480
|
import React5 from "react";
|
|
481
|
-
import { SettingsAction,
|
|
481
|
+
import { SettingsAction, parseNavigationPlugin, useResolvePlugin, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
482
482
|
import { useConfig } from "@dxos/react-client";
|
|
483
|
-
import { Button as Button3,
|
|
484
|
-
import {
|
|
483
|
+
import { Button as Button3, Link, Message, Popover as Popover3, Tooltip as Tooltip2, Trans, useDefaultValue, useSidebars, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
484
|
+
import { LayoutControls } from "@dxos/react-ui-stack";
|
|
485
485
|
import { getSize, mx as mx3 } from "@dxos/react-ui-theme";
|
|
486
486
|
var buttonStyles = "pli-1.5 text-xs font-normal";
|
|
487
487
|
var repo = "https://github.com/dxos/dxos";
|
|
488
|
+
var VERSION_REGEX = /([\d.]+)/;
|
|
488
489
|
var NavTreeFooter = (props) => {
|
|
489
490
|
const layoutPart = useDefaultValue(props.layoutPart, () => "sidebar");
|
|
490
491
|
const config = useConfig();
|
|
@@ -493,11 +494,12 @@ var NavTreeFooter = (props) => {
|
|
|
493
494
|
const dispatch = useIntentDispatcher2();
|
|
494
495
|
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
495
496
|
const navigationPlugin = useResolvePlugin(parseNavigationPlugin);
|
|
497
|
+
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
496
498
|
const releaseUrl = config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production" ? `${repo}/releases/tag/v${version}` : `${repo}/commit/${commitHash}`;
|
|
497
499
|
const previewUrl = "https://docs.dxos.org/composer#technology-preview";
|
|
498
500
|
return /* @__PURE__ */ React5.createElement("div", {
|
|
499
501
|
role: "none",
|
|
500
|
-
className: mx3("bs-[--rail-size] pbe-[env(safe-area-inset-bottom)] box-content
|
|
502
|
+
className: mx3("flex bs-[--rail-size] pbe-[env(safe-area-inset-bottom)] box-content justify-end", layoutPart === "complementary" && "md:justify-end flex-row-reverse")
|
|
501
503
|
}, /* @__PURE__ */ React5.createElement(Popover3.Root, null, /* @__PURE__ */ React5.createElement(Popover3.Trigger, {
|
|
502
504
|
asChild: true
|
|
503
505
|
}, /* @__PURE__ */ React5.createElement(Button3, {
|
|
@@ -506,7 +508,7 @@ var NavTreeFooter = (props) => {
|
|
|
506
508
|
...!navigationSidebarOpen && {
|
|
507
509
|
tabIndex: -1
|
|
508
510
|
}
|
|
509
|
-
}, "v",
|
|
511
|
+
}, "v", v)), /* @__PURE__ */ React5.createElement(Popover3.Portal, null, /* @__PURE__ */ React5.createElement(Popover3.Content, {
|
|
510
512
|
side: "top",
|
|
511
513
|
role: "message",
|
|
512
514
|
classNames: "z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]"
|
|
@@ -566,10 +568,10 @@ var NavTreeFooter = (props) => {
|
|
|
566
568
|
}, /* @__PURE__ */ React5.createElement("span", {
|
|
567
569
|
className: "sr-only"
|
|
568
570
|
}, t("open settings label")), /* @__PURE__ */ React5.createElement(GearSix, {
|
|
569
|
-
className: mx3(getSize(
|
|
571
|
+
className: mx3(getSize(5), "rotate-90")
|
|
570
572
|
}))), /* @__PURE__ */ React5.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React5.createElement(Tooltip2.Content, {
|
|
571
573
|
classNames: "z-[12]"
|
|
572
|
-
}, t("open settings label"), /* @__PURE__ */ React5.createElement(Tooltip2.Arrow, null)))), navigationPlugin?.meta.id === "dxos.org/plugin/deck" && /* @__PURE__ */ React5.createElement(
|
|
574
|
+
}, t("open settings label"), /* @__PURE__ */ React5.createElement(Tooltip2.Arrow, null)))), navigationPlugin?.meta.id === "dxos.org/plugin/deck" && /* @__PURE__ */ React5.createElement(LayoutControls, {
|
|
573
575
|
variant: "hide-disabled",
|
|
574
576
|
capabilities: {
|
|
575
577
|
incrementStart: false,
|
|
@@ -845,13 +847,16 @@ var NavTreeContainer = ({ items, current, open, popoverAnchorId, ...props }) =>
|
|
|
845
847
|
elevation: "chrome"
|
|
846
848
|
}, /* @__PURE__ */ React6.createElement("div", {
|
|
847
849
|
role: "none",
|
|
848
|
-
className: "
|
|
850
|
+
className: "grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] bs-full overflow-hidden"
|
|
851
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
852
|
+
role: "none",
|
|
853
|
+
className: "border-be border-separator"
|
|
849
854
|
}, /* @__PURE__ */ React6.createElement(Surface, {
|
|
850
855
|
role: "search-input",
|
|
851
856
|
limit: 1
|
|
852
|
-
}), /* @__PURE__ */ React6.createElement("div", {
|
|
857
|
+
})), /* @__PURE__ */ React6.createElement("div", {
|
|
853
858
|
role: "none",
|
|
854
|
-
className: "!overflow-y-auto"
|
|
859
|
+
className: "border-be border-separator !overflow-y-auto"
|
|
855
860
|
}, /* @__PURE__ */ React6.createElement(NavTree, {
|
|
856
861
|
items,
|
|
857
862
|
open,
|
|
@@ -943,7 +948,7 @@ var CommandsTrigger = () => {
|
|
|
943
948
|
const { dispatch } = useIntent();
|
|
944
949
|
const { t } = useTranslation7(NAVTREE_PLUGIN);
|
|
945
950
|
return /* @__PURE__ */ React9.createElement(Button4, {
|
|
946
|
-
classNames: "
|
|
951
|
+
classNames: "w-full h-full !rounded-none",
|
|
947
952
|
onClick: () => dispatch({
|
|
948
953
|
action: LayoutAction2.SET_LAYOUT,
|
|
949
954
|
data: {
|
|
@@ -1007,7 +1012,7 @@ var NavTreePlugin = () => {
|
|
|
1007
1012
|
const getItem = (node, parent, filter) => {
|
|
1008
1013
|
invariant(graph, void 0, {
|
|
1009
1014
|
F: __dxlog_file,
|
|
1010
|
-
L:
|
|
1015
|
+
L: 82,
|
|
1011
1016
|
S: void 0,
|
|
1012
1017
|
A: [
|
|
1013
1018
|
"graph",
|
|
@@ -1027,7 +1032,7 @@ var NavTreePlugin = () => {
|
|
|
1027
1032
|
icon: node.properties.icon,
|
|
1028
1033
|
disabled: node.properties.disabled,
|
|
1029
1034
|
testId: node.properties.testId,
|
|
1030
|
-
className: node.properties.className,
|
|
1035
|
+
className: mx5(node.properties.modified && "italic", node.properties.className),
|
|
1031
1036
|
headingClassName: node.properties.headingClassName,
|
|
1032
1037
|
path,
|
|
1033
1038
|
parentOf,
|
|
@@ -1060,18 +1065,27 @@ var NavTreePlugin = () => {
|
|
|
1060
1065
|
return {
|
|
1061
1066
|
meta: meta_default,
|
|
1062
1067
|
ready: async (plugins) => {
|
|
1068
|
+
state.prop({
|
|
1069
|
+
key: "open",
|
|
1070
|
+
type: LocalStorageStore.json()
|
|
1071
|
+
});
|
|
1063
1072
|
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
1064
1073
|
graph = graphPlugin?.provides.graph;
|
|
1065
1074
|
if (!graph) {
|
|
1066
1075
|
return;
|
|
1067
1076
|
}
|
|
1077
|
+
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;
|
|
1078
|
+
const soloPart = resolvePlugin(plugins, parseNavigationPlugin2)?.provides.location.active.solo?.[0];
|
|
1079
|
+
if (dispatch && soloPart) {
|
|
1080
|
+
void dispatch({
|
|
1081
|
+
plugin: NAVTREE_PLUGIN,
|
|
1082
|
+
action: NavigationAction2.EXPOSE,
|
|
1083
|
+
data: {
|
|
1084
|
+
id: soloPart.id
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1068
1088
|
state.values.root = graph.root;
|
|
1069
|
-
getChildren(graph, state.values.root);
|
|
1070
|
-
getActions(graph, state.values.root);
|
|
1071
|
-
state.prop({
|
|
1072
|
-
key: "open",
|
|
1073
|
-
type: LocalStorageStore.json()
|
|
1074
|
-
});
|
|
1075
1089
|
void expandOpenGraphNodes(graph, state.values.open);
|
|
1076
1090
|
graph.subscribeTraverse({
|
|
1077
1091
|
visitor: (node, path) => {
|
|
@@ -1171,25 +1185,23 @@ var NavTreePlugin = () => {
|
|
|
1171
1185
|
}
|
|
1172
1186
|
},
|
|
1173
1187
|
intent: {
|
|
1174
|
-
resolver: (intent) => {
|
|
1188
|
+
resolver: async (intent) => {
|
|
1175
1189
|
switch (intent.action) {
|
|
1176
1190
|
case NavigationAction2.EXPOSE: {
|
|
1177
1191
|
if (graph && intent.data?.id) {
|
|
1178
|
-
const path = graph.
|
|
1192
|
+
const path = await graph.waitForPath({
|
|
1179
1193
|
target: intent.data.id
|
|
1180
1194
|
});
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
state.values.open.push(...additionalOpenItems);
|
|
1192
|
-
}
|
|
1195
|
+
const additionalOpenItems = [
|
|
1196
|
+
...Array(path.length)
|
|
1197
|
+
].reduce((acc, _, index) => {
|
|
1198
|
+
const itemId = Path2.create(...path.slice(0, index));
|
|
1199
|
+
if (itemId.length > 0 && !state.values.open.includes(itemId)) {
|
|
1200
|
+
acc.push(itemId);
|
|
1201
|
+
}
|
|
1202
|
+
return acc;
|
|
1203
|
+
}, []);
|
|
1204
|
+
state.values.open.push(...additionalOpenItems);
|
|
1193
1205
|
}
|
|
1194
1206
|
break;
|
|
1195
1207
|
}
|