@logickernel/bridge 0.11.6 → 0.11.8

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.
@@ -764,14 +764,35 @@ function NavMain({ items }) {
764
764
  };
765
765
  const shouldUseLink = (url) => {
766
766
  const currentContext = getCurrentContext();
767
+ if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
768
+ const willUseLink = currentContext ? url.startsWith(currentContext) : false;
769
+ console.log("[NavMain] shouldUseLink check:", {
770
+ url,
771
+ currentPathname: pathname,
772
+ currentContext,
773
+ urlStartsWithContext: currentContext ? url.startsWith(currentContext) : false,
774
+ willUseLink
775
+ });
776
+ }
767
777
  if (!currentContext) return false;
768
778
  if (url.startsWith(currentContext)) return true;
769
779
  return false;
770
780
  };
771
- const handleClick = () => {
781
+ const handleClick = (e) => {
772
782
  if (isMobile) {
773
783
  setOpenMobile(false);
774
784
  }
785
+ if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
786
+ const target = e?.currentTarget;
787
+ const url = target.getAttribute("href") || target.closest("a")?.getAttribute("href");
788
+ const isLink = target.closest("a")?.tagName === "A" && !target.closest("a")?.hasAttribute("data-next-link");
789
+ console.log("[NavMain] Click:", {
790
+ url,
791
+ isLinkComponent: !isLink,
792
+ isAnchorTag: isLink,
793
+ willReload: isLink
794
+ });
795
+ }
775
796
  };
776
797
  if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
777
798
  console.log("[NavMain] Received items:", {
@@ -873,24 +894,45 @@ function NavMain({ items }) {
873
894
  }
874
895
  ) }),
875
896
  /* @__PURE__ */ jsxRuntime.jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSub, { children: item.items?.map((subItem) => {
876
- if (shouldUseLink(subItem.url)) {
877
- return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: subItem.url, onClick: handleClick, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title);
897
+ const useLink2 = shouldUseLink(subItem.url);
898
+ if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
899
+ console.log("[NavMain] SubItem navigation:", {
900
+ title: subItem.title,
901
+ url: subItem.url,
902
+ currentContext: getCurrentContext(),
903
+ useLink: useLink2,
904
+ willReload: !useLink2
905
+ });
906
+ }
907
+ if (useLink2) {
908
+ return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: subItem.url, onClick: handleClick, className: "text-blue-500", children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title);
878
909
  }
879
- return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: subItem.url, onClick: handleClick, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title);
910
+ return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("a", { href: subItem.url, className: "text-red-500", onClick: handleClick, children: /* @__PURE__ */ jsxRuntime.jsx("span", { children: subItem.title }) }) }) }, subItem.title);
880
911
  }) }) })
881
912
  ] })
882
913
  },
883
914
  item.title
884
915
  );
885
916
  }
886
- if (shouldUseLink(item.url)) {
917
+ const useLink = shouldUseLink(item.url);
918
+ if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
919
+ console.log("[NavMain] Item navigation:", {
920
+ title: item.title,
921
+ url: item.url,
922
+ currentContext: getCurrentContext(),
923
+ currentPathname: pathname,
924
+ useLink,
925
+ willReload: !useLink
926
+ });
927
+ }
928
+ if (useLink) {
887
929
  return /* @__PURE__ */ jsxRuntime.jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsxRuntime.jsx(
888
930
  SidebarMenuButton,
889
931
  {
890
932
  asChild: true,
891
933
  tooltip: item.title,
892
934
  isActive,
893
- children: /* @__PURE__ */ jsxRuntime.jsxs(Link__default.default, { href: item.url, onClick: handleClick, children: [
935
+ children: /* @__PURE__ */ jsxRuntime.jsxs(Link__default.default, { href: item.url, onClick: handleClick, className: "text-blue-500", children: [
894
936
  item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
895
937
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
896
938
  ] })
@@ -903,7 +945,7 @@ function NavMain({ items }) {
903
945
  asChild: true,
904
946
  tooltip: item.title,
905
947
  isActive,
906
- children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: item.url, onClick: handleClick, children: [
948
+ children: /* @__PURE__ */ jsxRuntime.jsxs("a", { href: item.url, className: "text-red-500", onClick: handleClick, children: [
907
949
  item.icon && /* @__PURE__ */ jsxRuntime.jsx(item.icon, {}),
908
950
  /* @__PURE__ */ jsxRuntime.jsx("span", { children: item.title })
909
951
  ] })