@dxos/plugin-navtree 0.6.14-staging.8758a12 → 0.6.14-staging.9b873ce

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.
@@ -12,7 +12,7 @@ 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
+ import { mx as mx6 } from "@dxos/react-ui-theme";
16
16
  import { getHostPlatform as getHostPlatform3 } from "@dxos/util";
17
17
 
18
18
  // packages/plugins/plugin-navtree/src/components/CommandsDialog.tsx
@@ -123,7 +123,7 @@ var CommandsDialogContent = ({ selected: initial }) => {
123
123
  import React2, { Fragment } from "react";
124
124
  import { getGraph } from "@dxos/app-graph";
125
125
  import { Popover, toLocalizedString as toLocalizedString2, useTranslation as useTranslation2 } from "@dxos/react-ui";
126
- import { PlankHeading } from "@dxos/react-ui-deck";
126
+ import { StackItem } from "@dxos/react-ui-stack";
127
127
  var TREE_ITEM_MAIN_HEADING = "TreeItemMainHeading";
128
128
  var NavBarStart = ({ activeNode, popoverAnchorId }) => {
129
129
  const { t } = useTranslation2(NAVTREE_PLUGIN);
@@ -132,7 +132,7 @@ var NavBarStart = ({ activeNode, popoverAnchorId }) => {
132
132
  const actions = graph.actions(activeNode);
133
133
  const label = toLocalizedString2(activeNode.properties?.label, t);
134
134
  const menuTriggerLabel = t("node actions menu invoker label");
135
- return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ActionRoot, null, /* @__PURE__ */ React2.createElement(PlankHeading.ActionsMenu, {
135
+ return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(ActionRoot, null, /* @__PURE__ */ React2.createElement(StackItem.Sigil, {
136
136
  icon: activeNode.properties?.icon ?? "ph--dots-three-vertical--regular",
137
137
  attendableId: activeNode.id,
138
138
  triggerLabel: menuTriggerLabel,
@@ -143,7 +143,7 @@ var NavBarStart = ({ activeNode, popoverAnchorId }) => {
143
143
  node: action,
144
144
  caller: TREE_ITEM_MAIN_HEADING
145
145
  })
146
- })), /* @__PURE__ */ React2.createElement(PlankHeading.Label, {
146
+ })), /* @__PURE__ */ React2.createElement(StackItem.HeadingLabel, {
147
147
  attendableId: activeNode.id
148
148
  }, label));
149
149
  };
@@ -414,7 +414,6 @@ var NavTree = ({ loadDescendents, renderPresence: renderPresence2, popoverAnchor
414
414
  ...props,
415
415
  draggable: true,
416
416
  gridTemplateColumns: "[tree-row-start] 1fr min-content min-content min-content [tree-row-end]",
417
- classNames: "pbs-1",
418
417
  renderColumns
419
418
  });
420
419
  };
@@ -473,19 +472,21 @@ import { useGraph as useGraph2 } from "@dxos/plugin-graph";
473
472
  import { isEchoObject, isSpace } from "@dxos/react-client/echo";
474
473
  import { ElevationProvider, useMediaQuery, useSidebars as useSidebars2 } from "@dxos/react-ui";
475
474
  import { isItem } from "@dxos/react-ui-list";
475
+ import { mx as mx4 } from "@dxos/react-ui-theme";
476
476
  import { arrayMove } from "@dxos/util";
477
477
 
478
478
  // packages/plugins/plugin-navtree/src/components/NavTreeFooter.tsx
479
479
  import { ArrowSquareOut, GearSix, Warning } from "@phosphor-icons/react";
480
480
  import { formatDistance } from "date-fns/formatDistance";
481
481
  import React5 from "react";
482
- import { SettingsAction, useResolvePlugin, parseNavigationPlugin, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
482
+ import { SettingsAction, parseNavigationPlugin, useResolvePlugin, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
483
483
  import { useConfig } from "@dxos/react-client";
484
- import { Button as Button3, Tooltip as Tooltip2, Popover as Popover3, useSidebars, useTranslation as useTranslation5, Link, Message, Trans, useDefaultValue } from "@dxos/react-ui";
485
- import { PlankHeading as PlankHeading2 } from "@dxos/react-ui-deck";
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";
486
486
  import { getSize, mx as mx3 } from "@dxos/react-ui-theme";
487
487
  var buttonStyles = "pli-1.5 text-xs font-normal";
488
488
  var repo = "https://github.com/dxos/dxos";
489
+ var VERSION_REGEX = /([\d.]+)/;
489
490
  var NavTreeFooter = (props) => {
490
491
  const layoutPart = useDefaultValue(props.layoutPart, () => "sidebar");
491
492
  const config = useConfig();
@@ -494,11 +495,12 @@ var NavTreeFooter = (props) => {
494
495
  const dispatch = useIntentDispatcher2();
495
496
  const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
496
497
  const navigationPlugin = useResolvePlugin(parseNavigationPlugin);
498
+ const [_, v] = version?.match(VERSION_REGEX) ?? [];
497
499
  const releaseUrl = config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production" ? `${repo}/releases/tag/v${version}` : `${repo}/commit/${commitHash}`;
498
500
  const previewUrl = "https://docs.dxos.org/composer#technology-preview";
499
501
  return /* @__PURE__ */ React5.createElement("div", {
500
502
  role: "none",
501
- className: mx3("bs-[--rail-size] pbe-[env(safe-area-inset-bottom)] box-content border-separator border-bs pli-1 flex justify-end", layoutPart === "complementary" && "md:justify-end flex-row-reverse")
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")
502
504
  }, /* @__PURE__ */ React5.createElement(Popover3.Root, null, /* @__PURE__ */ React5.createElement(Popover3.Trigger, {
503
505
  asChild: true
504
506
  }, /* @__PURE__ */ React5.createElement(Button3, {
@@ -507,7 +509,7 @@ var NavTreeFooter = (props) => {
507
509
  ...!navigationSidebarOpen && {
508
510
  tabIndex: -1
509
511
  }
510
- }, "v", version)), /* @__PURE__ */ React5.createElement(Popover3.Portal, null, /* @__PURE__ */ React5.createElement(Popover3.Content, {
512
+ }, "v", v)), /* @__PURE__ */ React5.createElement(Popover3.Portal, null, /* @__PURE__ */ React5.createElement(Popover3.Content, {
511
513
  side: "top",
512
514
  role: "message",
513
515
  classNames: "z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]"
@@ -570,7 +572,7 @@ var NavTreeFooter = (props) => {
570
572
  className: mx3(getSize(4), "rotate-90")
571
573
  }))), /* @__PURE__ */ React5.createElement(Tooltip2.Portal, null, /* @__PURE__ */ React5.createElement(Tooltip2.Content, {
572
574
  classNames: "z-[12]"
573
- }, t("open settings label"), /* @__PURE__ */ React5.createElement(Tooltip2.Arrow, null)))), navigationPlugin?.meta.id === "dxos.org/plugin/deck" && /* @__PURE__ */ React5.createElement(PlankHeading2.Controls, {
575
+ }, t("open settings label"), /* @__PURE__ */ React5.createElement(Tooltip2.Arrow, null)))), navigationPlugin?.meta.id === "dxos.org/plugin/deck" && /* @__PURE__ */ React5.createElement(LayoutControls, {
574
576
  variant: "hide-disabled",
575
577
  capabilities: {
576
578
  incrementStart: false,
@@ -846,7 +848,7 @@ var NavTreeContainer = ({ items, current, open, popoverAnchorId, ...props }) =>
846
848
  elevation: "chrome"
847
849
  }, /* @__PURE__ */ React6.createElement("div", {
848
850
  role: "none",
849
- className: "bs-full overflow-hidden row-span-3 grid grid-cols-1 grid-rows-[min-content_1fr_min-content]"
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")
850
852
  }, /* @__PURE__ */ React6.createElement(Surface, {
851
853
  role: "search-input",
852
854
  limit: 1
@@ -892,7 +894,7 @@ import { useIdentity } from "@dxos/react-client/halo";
892
894
  import React7 from "react";
893
895
  import { ConnectionState, useNetworkStatus } from "@dxos/react-client/mesh";
894
896
  import { Avatar } from "@dxos/react-ui";
895
- import { focusRing, mx as mx4 } from "@dxos/react-ui-theme";
897
+ import { focusRing, mx as mx5 } from "@dxos/react-ui-theme";
896
898
  import { hexToFallback } from "@dxos/util";
897
899
  var INTERNAL = "https://avatars.githubusercontent.com/u/57182821";
898
900
  var HaloButton = (props) => {
@@ -900,7 +902,7 @@ var HaloButton = (props) => {
900
902
  const fallbackValue = hexToFallback(identityKey ?? "0");
901
903
  const { swarm: connectionState } = useNetworkStatus();
902
904
  return /* @__PURE__ */ React7.createElement("button", {
903
- className: mx4(focusRing, "rounded grid place-items-center"),
905
+ className: mx5(focusRing, "rounded grid place-items-center"),
904
906
  onClick
905
907
  }, /* @__PURE__ */ React7.createElement(Avatar.Root, {
906
908
  size,
@@ -944,7 +946,7 @@ var CommandsTrigger = () => {
944
946
  const { dispatch } = useIntent();
945
947
  const { t } = useTranslation7(NAVTREE_PLUGIN);
946
948
  return /* @__PURE__ */ React9.createElement(Button4, {
947
- classNames: "pis-3 pie-2 gap-2 mli-1 mbs-1 min-bs-0 bs-[--rail-action] justify-start",
949
+ classNames: "w-full h-full !rounded-none",
948
950
  onClick: () => dispatch({
949
951
  action: LayoutAction2.SET_LAYOUT,
950
952
  data: {
@@ -1028,7 +1030,7 @@ var NavTreePlugin = () => {
1028
1030
  icon: node.properties.icon,
1029
1031
  disabled: node.properties.disabled,
1030
1032
  testId: node.properties.testId,
1031
- className: mx5(node.properties.modified && "italic", node.properties.className),
1033
+ className: mx6(node.properties.modified && "italic", node.properties.className),
1032
1034
  headingClassName: node.properties.headingClassName,
1033
1035
  path,
1034
1036
  parentOf,
@@ -1181,25 +1183,23 @@ var NavTreePlugin = () => {
1181
1183
  }
1182
1184
  },
1183
1185
  intent: {
1184
- resolver: (intent) => {
1186
+ resolver: async (intent) => {
1185
1187
  switch (intent.action) {
1186
1188
  case NavigationAction2.EXPOSE: {
1187
1189
  if (graph && intent.data?.id) {
1188
- const path = graph.getPath({
1190
+ const path = await graph.waitForPath({
1189
1191
  target: intent.data.id
1190
1192
  });
1191
- if (Array.isArray(path)) {
1192
- const additionalOpenItems = [
1193
- ...Array(path.length)
1194
- ].reduce((acc, _, index) => {
1195
- const itemId = Path2.create(...path.slice(0, index));
1196
- if (itemId.length > 0 && !state.values.open.includes(itemId)) {
1197
- acc.push(itemId);
1198
- }
1199
- return acc;
1200
- }, []);
1201
- state.values.open.push(...additionalOpenItems);
1202
- }
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);
1203
1203
  }
1204
1204
  break;
1205
1205
  }