@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.
package/dist/next/components.js
CHANGED
|
@@ -735,14 +735,35 @@ function NavMain({ items }) {
|
|
|
735
735
|
};
|
|
736
736
|
const shouldUseLink = (url) => {
|
|
737
737
|
const currentContext = getCurrentContext();
|
|
738
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
739
|
+
const willUseLink = currentContext ? url.startsWith(currentContext) : false;
|
|
740
|
+
console.log("[NavMain] shouldUseLink check:", {
|
|
741
|
+
url,
|
|
742
|
+
currentPathname: pathname,
|
|
743
|
+
currentContext,
|
|
744
|
+
urlStartsWithContext: currentContext ? url.startsWith(currentContext) : false,
|
|
745
|
+
willUseLink
|
|
746
|
+
});
|
|
747
|
+
}
|
|
738
748
|
if (!currentContext) return false;
|
|
739
749
|
if (url.startsWith(currentContext)) return true;
|
|
740
750
|
return false;
|
|
741
751
|
};
|
|
742
|
-
const handleClick = () => {
|
|
752
|
+
const handleClick = (e) => {
|
|
743
753
|
if (isMobile) {
|
|
744
754
|
setOpenMobile(false);
|
|
745
755
|
}
|
|
756
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
757
|
+
const target = e?.currentTarget;
|
|
758
|
+
const url = target.getAttribute("href") || target.closest("a")?.getAttribute("href");
|
|
759
|
+
const isLink = target.closest("a")?.tagName === "A" && !target.closest("a")?.hasAttribute("data-next-link");
|
|
760
|
+
console.log("[NavMain] Click:", {
|
|
761
|
+
url,
|
|
762
|
+
isLinkComponent: !isLink,
|
|
763
|
+
isAnchorTag: isLink,
|
|
764
|
+
willReload: isLink
|
|
765
|
+
});
|
|
766
|
+
}
|
|
746
767
|
};
|
|
747
768
|
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
748
769
|
console.log("[NavMain] Received items:", {
|
|
@@ -844,24 +865,45 @@ function NavMain({ items }) {
|
|
|
844
865
|
}
|
|
845
866
|
) }),
|
|
846
867
|
/* @__PURE__ */ jsx(CollapsibleContent2, { children: /* @__PURE__ */ jsx(SidebarMenuSub, { children: item.items?.map((subItem) => {
|
|
847
|
-
|
|
848
|
-
|
|
868
|
+
const useLink2 = shouldUseLink(subItem.url);
|
|
869
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
870
|
+
console.log("[NavMain] SubItem navigation:", {
|
|
871
|
+
title: subItem.title,
|
|
872
|
+
url: subItem.url,
|
|
873
|
+
currentContext: getCurrentContext(),
|
|
874
|
+
useLink: useLink2,
|
|
875
|
+
willReload: !useLink2
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
if (useLink2) {
|
|
879
|
+
return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsx(Link, { href: subItem.url, onClick: handleClick, className: "text-blue-500", children: /* @__PURE__ */ jsx("span", { children: subItem.title }) }) }) }, subItem.title);
|
|
849
880
|
}
|
|
850
|
-
return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsx("a", { href: subItem.url, onClick: handleClick, children: /* @__PURE__ */ jsx("span", { children: subItem.title }) }) }) }, subItem.title);
|
|
881
|
+
return /* @__PURE__ */ jsx(SidebarMenuSubItem, { children: /* @__PURE__ */ jsx(SidebarMenuSubButton, { asChild: true, children: /* @__PURE__ */ jsx("a", { href: subItem.url, className: "text-red-500", onClick: handleClick, children: /* @__PURE__ */ jsx("span", { children: subItem.title }) }) }) }, subItem.title);
|
|
851
882
|
}) }) })
|
|
852
883
|
] })
|
|
853
884
|
},
|
|
854
885
|
item.title
|
|
855
886
|
);
|
|
856
887
|
}
|
|
857
|
-
|
|
888
|
+
const useLink = shouldUseLink(item.url);
|
|
889
|
+
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
|
890
|
+
console.log("[NavMain] Item navigation:", {
|
|
891
|
+
title: item.title,
|
|
892
|
+
url: item.url,
|
|
893
|
+
currentContext: getCurrentContext(),
|
|
894
|
+
currentPathname: pathname,
|
|
895
|
+
useLink,
|
|
896
|
+
willReload: !useLink
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
if (useLink) {
|
|
858
900
|
return /* @__PURE__ */ jsx(SidebarMenuItem, { children: /* @__PURE__ */ jsx(
|
|
859
901
|
SidebarMenuButton,
|
|
860
902
|
{
|
|
861
903
|
asChild: true,
|
|
862
904
|
tooltip: item.title,
|
|
863
905
|
isActive,
|
|
864
|
-
children: /* @__PURE__ */ jsxs(Link, { href: item.url, onClick: handleClick, children: [
|
|
906
|
+
children: /* @__PURE__ */ jsxs(Link, { href: item.url, onClick: handleClick, className: "text-blue-500", children: [
|
|
865
907
|
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
866
908
|
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
867
909
|
] })
|
|
@@ -874,7 +916,7 @@ function NavMain({ items }) {
|
|
|
874
916
|
asChild: true,
|
|
875
917
|
tooltip: item.title,
|
|
876
918
|
isActive,
|
|
877
|
-
children: /* @__PURE__ */ jsxs("a", { href: item.url, onClick: handleClick, children: [
|
|
919
|
+
children: /* @__PURE__ */ jsxs("a", { href: item.url, className: "text-red-500", onClick: handleClick, children: [
|
|
878
920
|
item.icon && /* @__PURE__ */ jsx(item.icon, {}),
|
|
879
921
|
/* @__PURE__ */ jsx("span", { children: item.title })
|
|
880
922
|
] })
|