@dxos/plugin-navtree 0.6.14-staging.9e90729 → 0.6.14-staging.c117501
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 +47 -37
- 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 -1
- package/src/components/NavTreeFooter.tsx +13 -10
- 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 mx6 } 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
|
};
|
|
@@ -472,19 +472,21 @@ import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
|
472
472
|
import { isEchoObject, isSpace } from "@dxos/react-client/echo";
|
|
473
473
|
import { ElevationProvider, useMediaQuery, useSidebars as useSidebars2 } from "@dxos/react-ui";
|
|
474
474
|
import { isItem } from "@dxos/react-ui-list";
|
|
475
|
+
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
475
476
|
import { arrayMove } from "@dxos/util";
|
|
476
477
|
|
|
477
478
|
// packages/plugins/plugin-navtree/src/components/NavTreeFooter.tsx
|
|
478
479
|
import { ArrowSquareOut, GearSix, Warning } from "@phosphor-icons/react";
|
|
479
480
|
import { formatDistance } from "date-fns/formatDistance";
|
|
480
481
|
import React5 from "react";
|
|
481
|
-
import { SettingsAction,
|
|
482
|
+
import { SettingsAction, parseNavigationPlugin, useResolvePlugin, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
482
483
|
import { useConfig } from "@dxos/react-client";
|
|
483
|
-
import { Button as Button3,
|
|
484
|
-
import {
|
|
484
|
+
import { Button as Button3, Link, Message, Popover as Popover3, Tooltip as Tooltip2, Trans, useDefaultValue, useSidebars, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
485
|
+
import { LayoutControls } from "@dxos/react-ui-stack";
|
|
485
486
|
import { getSize, mx as mx3 } from "@dxos/react-ui-theme";
|
|
486
487
|
var buttonStyles = "pli-1.5 text-xs font-normal";
|
|
487
488
|
var repo = "https://github.com/dxos/dxos";
|
|
489
|
+
var VERSION_REGEX = /([\d.]+)/;
|
|
488
490
|
var NavTreeFooter = (props) => {
|
|
489
491
|
const layoutPart = useDefaultValue(props.layoutPart, () => "sidebar");
|
|
490
492
|
const config = useConfig();
|
|
@@ -493,11 +495,12 @@ var NavTreeFooter = (props) => {
|
|
|
493
495
|
const dispatch = useIntentDispatcher2();
|
|
494
496
|
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
495
497
|
const navigationPlugin = useResolvePlugin(parseNavigationPlugin);
|
|
498
|
+
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
496
499
|
const releaseUrl = config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production" ? `${repo}/releases/tag/v${version}` : `${repo}/commit/${commitHash}`;
|
|
497
500
|
const previewUrl = "https://docs.dxos.org/composer#technology-preview";
|
|
498
501
|
return /* @__PURE__ */ React5.createElement("div", {
|
|
499
502
|
role: "none",
|
|
500
|
-
className: mx3("bs-[--rail-size] pbe-[env(safe-area-inset-bottom)] box-content
|
|
503
|
+
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
504
|
}, /* @__PURE__ */ React5.createElement(Popover3.Root, null, /* @__PURE__ */ React5.createElement(Popover3.Trigger, {
|
|
502
505
|
asChild: true
|
|
503
506
|
}, /* @__PURE__ */ React5.createElement(Button3, {
|
|
@@ -506,7 +509,7 @@ var NavTreeFooter = (props) => {
|
|
|
506
509
|
...!navigationSidebarOpen && {
|
|
507
510
|
tabIndex: -1
|
|
508
511
|
}
|
|
509
|
-
}, "v",
|
|
512
|
+
}, "v", v)), /* @__PURE__ */ React5.createElement(Popover3.Portal, null, /* @__PURE__ */ React5.createElement(Popover3.Content, {
|
|
510
513
|
side: "top",
|
|
511
514
|
role: "message",
|
|
512
515
|
classNames: "z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]"
|
|
@@ -569,7 +572,7 @@ var NavTreeFooter = (props) => {
|
|
|
569
572
|
className: mx3(getSize(4), "rotate-90")
|
|
570
573
|
}))), /* @__PURE__ */ React5.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React5.createElement(Tooltip2.Content, {
|
|
571
574
|
classNames: "z-[12]"
|
|
572
|
-
}, t("open settings label"), /* @__PURE__ */ React5.createElement(Tooltip2.Arrow, null)))), navigationPlugin?.meta.id === "dxos.org/plugin/deck" && /* @__PURE__ */ React5.createElement(
|
|
575
|
+
}, t("open settings label"), /* @__PURE__ */ React5.createElement(Tooltip2.Arrow, null)))), navigationPlugin?.meta.id === "dxos.org/plugin/deck" && /* @__PURE__ */ React5.createElement(LayoutControls, {
|
|
573
576
|
variant: "hide-disabled",
|
|
574
577
|
capabilities: {
|
|
575
578
|
incrementStart: false,
|
|
@@ -845,7 +848,7 @@ var NavTreeContainer = ({ items, current, open, popoverAnchorId, ...props }) =>
|
|
|
845
848
|
elevation: "chrome"
|
|
846
849
|
}, /* @__PURE__ */ React6.createElement("div", {
|
|
847
850
|
role: "none",
|
|
848
|
-
className: "
|
|
851
|
+
className: mx4("grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content]", "bs-full overflow-hidden row-span-3 divide-y divide-separator")
|
|
849
852
|
}, /* @__PURE__ */ React6.createElement(Surface, {
|
|
850
853
|
role: "search-input",
|
|
851
854
|
limit: 1
|
|
@@ -891,7 +894,7 @@ import { useIdentity } from "@dxos/react-client/halo";
|
|
|
891
894
|
import React7 from "react";
|
|
892
895
|
import { ConnectionState, useNetworkStatus } from "@dxos/react-client/mesh";
|
|
893
896
|
import { Avatar } from "@dxos/react-ui";
|
|
894
|
-
import { focusRing, mx as
|
|
897
|
+
import { focusRing, mx as mx5 } from "@dxos/react-ui-theme";
|
|
895
898
|
import { hexToFallback } from "@dxos/util";
|
|
896
899
|
var INTERNAL = "https://avatars.githubusercontent.com/u/57182821";
|
|
897
900
|
var HaloButton = (props) => {
|
|
@@ -899,7 +902,7 @@ var HaloButton = (props) => {
|
|
|
899
902
|
const fallbackValue = hexToFallback(identityKey ?? "0");
|
|
900
903
|
const { swarm: connectionState } = useNetworkStatus();
|
|
901
904
|
return /* @__PURE__ */ React7.createElement("button", {
|
|
902
|
-
className:
|
|
905
|
+
className: mx5(focusRing, "rounded grid place-items-center"),
|
|
903
906
|
onClick
|
|
904
907
|
}, /* @__PURE__ */ React7.createElement(Avatar.Root, {
|
|
905
908
|
size,
|
|
@@ -943,7 +946,7 @@ var CommandsTrigger = () => {
|
|
|
943
946
|
const { dispatch } = useIntent();
|
|
944
947
|
const { t } = useTranslation7(NAVTREE_PLUGIN);
|
|
945
948
|
return /* @__PURE__ */ React9.createElement(Button4, {
|
|
946
|
-
classNames: "
|
|
949
|
+
classNames: "w-full h-full !rounded-none",
|
|
947
950
|
onClick: () => dispatch({
|
|
948
951
|
action: LayoutAction2.SET_LAYOUT,
|
|
949
952
|
data: {
|
|
@@ -1007,7 +1010,7 @@ var NavTreePlugin = () => {
|
|
|
1007
1010
|
const getItem = (node, parent, filter) => {
|
|
1008
1011
|
invariant(graph, void 0, {
|
|
1009
1012
|
F: __dxlog_file,
|
|
1010
|
-
L:
|
|
1013
|
+
L: 82,
|
|
1011
1014
|
S: void 0,
|
|
1012
1015
|
A: [
|
|
1013
1016
|
"graph",
|
|
@@ -1027,7 +1030,7 @@ var NavTreePlugin = () => {
|
|
|
1027
1030
|
icon: node.properties.icon,
|
|
1028
1031
|
disabled: node.properties.disabled,
|
|
1029
1032
|
testId: node.properties.testId,
|
|
1030
|
-
className: node.properties.className,
|
|
1033
|
+
className: mx6(node.properties.modified && "italic", node.properties.className),
|
|
1031
1034
|
headingClassName: node.properties.headingClassName,
|
|
1032
1035
|
path,
|
|
1033
1036
|
parentOf,
|
|
@@ -1060,18 +1063,27 @@ var NavTreePlugin = () => {
|
|
|
1060
1063
|
return {
|
|
1061
1064
|
meta: meta_default,
|
|
1062
1065
|
ready: async (plugins) => {
|
|
1066
|
+
state.prop({
|
|
1067
|
+
key: "open",
|
|
1068
|
+
type: LocalStorageStore.json()
|
|
1069
|
+
});
|
|
1063
1070
|
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
1064
1071
|
graph = graphPlugin?.provides.graph;
|
|
1065
1072
|
if (!graph) {
|
|
1066
1073
|
return;
|
|
1067
1074
|
}
|
|
1075
|
+
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;
|
|
1076
|
+
const soloPart = resolvePlugin(plugins, parseNavigationPlugin2)?.provides.location.active.solo?.[0];
|
|
1077
|
+
if (dispatch && soloPart) {
|
|
1078
|
+
void dispatch({
|
|
1079
|
+
plugin: NAVTREE_PLUGIN,
|
|
1080
|
+
action: NavigationAction2.EXPOSE,
|
|
1081
|
+
data: {
|
|
1082
|
+
id: soloPart.id
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1068
1086
|
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
1087
|
void expandOpenGraphNodes(graph, state.values.open);
|
|
1076
1088
|
graph.subscribeTraverse({
|
|
1077
1089
|
visitor: (node, path) => {
|
|
@@ -1171,25 +1183,23 @@ var NavTreePlugin = () => {
|
|
|
1171
1183
|
}
|
|
1172
1184
|
},
|
|
1173
1185
|
intent: {
|
|
1174
|
-
resolver: (intent) => {
|
|
1186
|
+
resolver: async (intent) => {
|
|
1175
1187
|
switch (intent.action) {
|
|
1176
1188
|
case NavigationAction2.EXPOSE: {
|
|
1177
1189
|
if (graph && intent.data?.id) {
|
|
1178
|
-
const path = graph.
|
|
1190
|
+
const path = await graph.waitForPath({
|
|
1179
1191
|
target: intent.data.id
|
|
1180
1192
|
});
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
state.values.open.push(...additionalOpenItems);
|
|
1192
|
-
}
|
|
1193
|
+
const additionalOpenItems = [
|
|
1194
|
+
...Array(path.length)
|
|
1195
|
+
].reduce((acc, _, index) => {
|
|
1196
|
+
const itemId = Path2.create(...path.slice(0, index));
|
|
1197
|
+
if (itemId.length > 0 && !state.values.open.includes(itemId)) {
|
|
1198
|
+
acc.push(itemId);
|
|
1199
|
+
}
|
|
1200
|
+
return acc;
|
|
1201
|
+
}, []);
|
|
1202
|
+
state.values.open.push(...additionalOpenItems);
|
|
1193
1203
|
}
|
|
1194
1204
|
break;
|
|
1195
1205
|
}
|