@unterberg/nivel 0.2.34 → 0.2.36

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.
@@ -437,26 +437,416 @@ var LandingPageNavbar_default = LandingPageNavbar;
437
437
 
438
438
  // src/runtime/client/components/Navbar/MegaMenu.tsx
439
439
  import { cmMerge as cmMerge4 } from "@classmatejs/react";
440
- import { useEffect as useEffect2, useMemo, useState as useState2 } from "react";
440
+ import { useCallback as useCallback3, useEffect as useEffect2, useMemo, useRef, useState as useState2 } from "react";
441
441
  import { usePageContext } from "vike-react/usePageContext";
442
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
442
+
443
+ // src/runtime/client/components/docsNavigation.ts
444
+ var containsActiveHref = (items, currentHref) => {
445
+ return items.some((item) => {
446
+ if (item.kind === "page") {
447
+ return item.href === currentHref;
448
+ }
449
+ return item.href === currentHref || containsActiveHref(item.items, currentHref);
450
+ });
451
+ };
452
+ var hasActiveItem = (items, activeHref) => containsActiveHref(items, activeHref);
453
+ var getVisibleNavItems = (items) => items.filter((item) => item.showInNav);
454
+ var getVisibleGroupItems = (group) => {
455
+ const visibleItems = getVisibleNavItems(group.items);
456
+ if (!group.href) {
457
+ return visibleItems;
458
+ }
459
+ return visibleItems.filter((item) => {
460
+ if (item.kind !== "page") {
461
+ return true;
462
+ }
463
+ return item.href !== group.href;
464
+ });
465
+ };
466
+ var getGroupHref = (group) => group.href ?? null;
467
+
468
+ // src/runtime/client/components/Navbar/MegaMenu.tsx
469
+ import { Fragment, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
470
+ var detailsTransitionDurationMs = 260;
443
471
  var findActiveItemId = (section, currentHref) => {
444
472
  if (!section) {
445
473
  return void 0;
446
474
  }
447
- for (const item of section.items) {
448
- if (item.href === currentHref) {
449
- return item.id;
450
- }
451
- if (item.kind === "group") {
452
- for (const child of item.items) {
453
- if (child.href === currentHref) {
454
- return child.id;
475
+ const findActiveNodeId = (items) => {
476
+ for (const item of items) {
477
+ if (item.href === currentHref) {
478
+ return item.id;
479
+ }
480
+ if (item.kind === "group") {
481
+ const activeChildId = findActiveNodeId(item.items);
482
+ if (activeChildId) {
483
+ return activeChildId;
455
484
  }
456
485
  }
457
486
  }
487
+ return void 0;
488
+ };
489
+ return findActiveNodeId(section.items);
490
+ };
491
+ var MegaMenuNodeLink = ({ title, href, icon: Icon, isActive, className, onClose }) => {
492
+ const content = /* @__PURE__ */ jsxs6("span", { className: "flex min-w-0 items-center gap-2", children: [
493
+ Icon ? /* @__PURE__ */ jsx8(Icon, { className: "size-4 shrink-0", "aria-hidden": "true" }) : null,
494
+ /* @__PURE__ */ jsx8("span", { className: "min-w-0", children: title ? renderInlineMarkdown(title, { codeClassName: "text-sm!" }) : null })
495
+ ] });
496
+ if (href) {
497
+ return /* @__PURE__ */ jsx8(
498
+ "a",
499
+ {
500
+ className: cmMerge4(
501
+ "flex min-w-0 items-center text-base-muted hover:text-base-content",
502
+ isActive && "text-primary! font-semibold",
503
+ className
504
+ ),
505
+ href: withSiteBaseUrl(href),
506
+ onClick: onClose,
507
+ children: content
508
+ }
509
+ );
458
510
  }
459
- return void 0;
511
+ return /* @__PURE__ */ jsx8(
512
+ "span",
513
+ {
514
+ className: cmMerge4(
515
+ "flex min-w-0 items-center text-base-content",
516
+ isActive && "text-primary! font-semibold",
517
+ className
518
+ ),
519
+ children: content
520
+ }
521
+ );
522
+ };
523
+ var MegaMenuNodeList = ({
524
+ items,
525
+ activeItemId,
526
+ currentHref,
527
+ docsIconMap,
528
+ onClose,
529
+ onContentHeightChange,
530
+ openGroupId,
531
+ onOpenGroupChange,
532
+ depth = 0
533
+ }) => {
534
+ const visibleItems = getVisibleNavItems(items);
535
+ if (visibleItems.length === 0) {
536
+ return null;
537
+ }
538
+ return /* @__PURE__ */ jsx8("ul", { className: cmMerge4("menu menu-sm w-full p-0", depth > 0 && "mt-1 pl-3"), children: visibleItems.map((item) => /* @__PURE__ */ jsx8(
539
+ MegaMenuNode,
540
+ {
541
+ item,
542
+ activeItemId,
543
+ currentHref,
544
+ docsIconMap,
545
+ onClose,
546
+ onContentHeightChange,
547
+ openGroupId,
548
+ onOpenGroupChange,
549
+ depth
550
+ },
551
+ item.id
552
+ )) });
553
+ };
554
+ var MegaMenuNode = ({
555
+ item,
556
+ activeItemId,
557
+ currentHref,
558
+ docsIconMap,
559
+ onClose,
560
+ onContentHeightChange,
561
+ openGroupId,
562
+ onOpenGroupChange,
563
+ depth
564
+ }) => {
565
+ if (item.kind === "page") {
566
+ const PageIcon = docsIconMap[getDocsIconMapKey("page", item.id)];
567
+ return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsx8(
568
+ MegaMenuNodeLink,
569
+ {
570
+ title: item.navTitle || item.title,
571
+ href: item.href,
572
+ icon: PageIcon,
573
+ isActive: activeItemId === item.id,
574
+ className: "rounded-field px-2 py-1.5 text-sm",
575
+ onClose
576
+ }
577
+ ) });
578
+ }
579
+ return /* @__PURE__ */ jsx8(
580
+ MegaMenuGroup,
581
+ {
582
+ group: item,
583
+ activeItemId,
584
+ currentHref,
585
+ docsIconMap,
586
+ onClose,
587
+ onContentHeightChange,
588
+ openGroupId,
589
+ onOpenGroupChange,
590
+ depth
591
+ }
592
+ );
593
+ };
594
+ var MegaMenuGroup = ({
595
+ group,
596
+ activeItemId,
597
+ currentHref,
598
+ docsIconMap,
599
+ onClose,
600
+ onContentHeightChange,
601
+ openGroupId,
602
+ onOpenGroupChange,
603
+ depth
604
+ }) => {
605
+ const groupHref = getGroupHref(group);
606
+ const visibleItems = getVisibleGroupItems(group);
607
+ const GroupIcon = docsIconMap[getDocsIconMapKey("group", group.id)];
608
+ const isActive = groupHref === currentHref || containsActiveHref(group.items, currentHref);
609
+ const isCollapsible = group.collapsible !== void 0;
610
+ const isOpen = openGroupId === group.id;
611
+ if (!group.title) {
612
+ return /* @__PURE__ */ jsx8(Fragment, { children: visibleItems.map((item) => /* @__PURE__ */ jsx8(
613
+ MegaMenuNode,
614
+ {
615
+ item,
616
+ activeItemId,
617
+ currentHref,
618
+ docsIconMap,
619
+ onClose,
620
+ onContentHeightChange,
621
+ openGroupId,
622
+ onOpenGroupChange,
623
+ depth
624
+ },
625
+ item.id
626
+ )) });
627
+ }
628
+ const title = /* @__PURE__ */ jsx8(
629
+ MegaMenuNodeLink,
630
+ {
631
+ title: group.title,
632
+ href: groupHref ?? void 0,
633
+ icon: GroupIcon,
634
+ isActive,
635
+ className: cmMerge4(
636
+ depth === 0 ? cmMerge4(!isCollapsible && "mb-2", "text-lg font-semibold tracking-tight") : cmMerge4(!isCollapsible && "rounded-field px-2 py-1.5", "text-sm font-semibold")
637
+ ),
638
+ onClose
639
+ }
640
+ );
641
+ const nestedItems = visibleItems.length > 0 ? /* @__PURE__ */ jsx8(
642
+ MegaMenuNodeList,
643
+ {
644
+ items: visibleItems,
645
+ activeItemId,
646
+ currentHref,
647
+ docsIconMap,
648
+ onClose,
649
+ onContentHeightChange,
650
+ openGroupId,
651
+ onOpenGroupChange,
652
+ depth: depth + 1
653
+ }
654
+ ) : null;
655
+ if (isCollapsible) {
656
+ return /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs6(
657
+ "details",
658
+ {
659
+ open: isOpen,
660
+ onToggle: (event) => {
661
+ if (event.target !== event.currentTarget) {
662
+ return;
663
+ }
664
+ if (!event.nativeEvent.isTrusted) {
665
+ return;
666
+ }
667
+ const isOpening = event.currentTarget.open;
668
+ if (isOpening) {
669
+ onOpenGroupChange(group.id);
670
+ onContentHeightChange(true);
671
+ return;
672
+ }
673
+ if (openGroupId === group.id) {
674
+ onOpenGroupChange(null);
675
+ onContentHeightChange(false);
676
+ }
677
+ },
678
+ children: [
679
+ /* @__PURE__ */ jsx8("summary", { className: cmMerge4("rounded-field flex min-h-0 items-center py-1.5", depth === 0 ? "px-0" : "px-2"), children: title }),
680
+ nestedItems
681
+ ]
682
+ }
683
+ ) });
684
+ }
685
+ return /* @__PURE__ */ jsxs6("li", { children: [
686
+ title,
687
+ nestedItems
688
+ ] });
689
+ };
690
+ var MegaMenuPageColumn = ({
691
+ item,
692
+ activeItemId,
693
+ docsIconMap,
694
+ onClose
695
+ }) => {
696
+ const PageIcon = docsIconMap[getDocsIconMapKey("page", item.id)];
697
+ return /* @__PURE__ */ jsx8("li", { className: "mb-6 flex-1 px-4 py-3", children: /* @__PURE__ */ jsx8(
698
+ MegaMenuNodeLink,
699
+ {
700
+ title: item.navTitle || item.title,
701
+ href: item.href,
702
+ icon: PageIcon,
703
+ isActive: activeItemId === item.id,
704
+ className: "text-lg font-semibold tracking-tight",
705
+ onClose
706
+ }
707
+ ) });
708
+ };
709
+ var MegaMenuGroupColumn = ({
710
+ item,
711
+ activeItemId,
712
+ currentHref,
713
+ docsIconMap,
714
+ onClose,
715
+ onContentHeightChange,
716
+ openGroupId,
717
+ onOpenGroupChange
718
+ }) => {
719
+ const groupHref = getGroupHref(item);
720
+ const visibleItems = getVisibleGroupItems(item);
721
+ const GroupIcon = docsIconMap[getDocsIconMapKey("group", item.id)];
722
+ const isActive = groupHref === currentHref || containsActiveHref(item.items, currentHref);
723
+ const isCollapsible = item.collapsible !== void 0;
724
+ const isOpen = openGroupId === item.id;
725
+ if (!item.title) {
726
+ return /* @__PURE__ */ jsx8(Fragment, { children: visibleItems.map((child) => /* @__PURE__ */ jsx8(
727
+ MegaMenuColumn,
728
+ {
729
+ item: child,
730
+ activeItemId,
731
+ currentHref,
732
+ docsIconMap,
733
+ onClose,
734
+ onContentHeightChange,
735
+ openGroupId,
736
+ onOpenGroupChange
737
+ },
738
+ child.id
739
+ )) });
740
+ }
741
+ const title = /* @__PURE__ */ jsx8(
742
+ MegaMenuNodeLink,
743
+ {
744
+ title: item.title,
745
+ href: groupHref ?? void 0,
746
+ icon: GroupIcon,
747
+ isActive,
748
+ className: cmMerge4(!isCollapsible && "mb-4", "text-lg font-semibold tracking-tight"),
749
+ onClose
750
+ }
751
+ );
752
+ const nestedItems = visibleItems.length > 0 ? /* @__PURE__ */ jsx8(
753
+ MegaMenuNodeList,
754
+ {
755
+ items: visibleItems,
756
+ activeItemId,
757
+ currentHref,
758
+ docsIconMap,
759
+ onClose,
760
+ onContentHeightChange,
761
+ openGroupId,
762
+ onOpenGroupChange,
763
+ depth: 1
764
+ }
765
+ ) : null;
766
+ if (isCollapsible) {
767
+ return /* @__PURE__ */ jsx8("li", { className: "mb-6 flex-1 px-4 py-3", children: /* @__PURE__ */ jsx8("ul", { className: "w-full p-0", children: /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs6(
768
+ "details",
769
+ {
770
+ open: isOpen,
771
+ onToggle: (event) => {
772
+ if (event.target !== event.currentTarget) {
773
+ return;
774
+ }
775
+ if (!event.nativeEvent.isTrusted) {
776
+ return;
777
+ }
778
+ const isOpening = event.currentTarget.open;
779
+ if (isOpening) {
780
+ onOpenGroupChange(item.id);
781
+ onContentHeightChange(true);
782
+ return;
783
+ }
784
+ if (openGroupId === item.id) {
785
+ onOpenGroupChange(null);
786
+ onContentHeightChange(false);
787
+ }
788
+ },
789
+ children: [
790
+ /* @__PURE__ */ jsx8("summary", { className: "rounded-field mb-4 flex min-h-0 items-center px-0 py-1.5", children: title }),
791
+ nestedItems
792
+ ]
793
+ }
794
+ ) }) }) });
795
+ }
796
+ return /* @__PURE__ */ jsxs6("li", { className: "mb-6 flex-1 px-4 py-3", children: [
797
+ title,
798
+ nestedItems
799
+ ] });
800
+ };
801
+ var MegaMenuColumn = ({
802
+ item,
803
+ activeItemId,
804
+ currentHref,
805
+ docsIconMap,
806
+ onClose,
807
+ onContentHeightChange,
808
+ openGroupId,
809
+ onOpenGroupChange
810
+ }) => {
811
+ if (item.kind === "page") {
812
+ return /* @__PURE__ */ jsx8(
813
+ MegaMenuPageColumn,
814
+ {
815
+ item,
816
+ activeItemId,
817
+ currentHref,
818
+ docsIconMap,
819
+ onClose,
820
+ onContentHeightChange,
821
+ openGroupId,
822
+ onOpenGroupChange
823
+ }
824
+ );
825
+ }
826
+ return /* @__PURE__ */ jsx8(
827
+ MegaMenuGroupColumn,
828
+ {
829
+ item,
830
+ activeItemId,
831
+ currentHref,
832
+ docsIconMap,
833
+ onClose,
834
+ onContentHeightChange,
835
+ openGroupId,
836
+ onOpenGroupChange
837
+ }
838
+ );
839
+ };
840
+ var hasVisibleItems = (items) => {
841
+ return items.some((item) => {
842
+ if (!item.showInNav) {
843
+ return false;
844
+ }
845
+ if (item.kind === "group") {
846
+ return Boolean(item.title || item.href || hasVisibleItems(item.items));
847
+ }
848
+ return true;
849
+ });
460
850
  };
461
851
  var MegaMenu = ({
462
852
  isActive,
@@ -472,6 +862,9 @@ var MegaMenu = ({
472
862
  const visibleSectionId = hoveredSectionId ?? activeSectionId ?? sections[0]?.id;
473
863
  const [visibleSectionElement, setVisibleSectionElement] = useState2(null);
474
864
  const [contentHeight, setContentHeight] = useState2(0);
865
+ const [openGroupId, setOpenGroupId] = useState2(null);
866
+ const contentHeightAnimationFrameRef = useRef(null);
867
+ const contentHeightTimeoutRef = useRef(null);
475
868
  const activeItemId = useMemo(
476
869
  () => findActiveItemId(
477
870
  sections.find((section) => section.id === visibleSectionId),
@@ -479,31 +872,82 @@ var MegaMenu = ({
479
872
  ),
480
873
  [sections, visibleSectionId, urlPathname]
481
874
  );
875
+ const clearScheduledContentHeightUpdate = useCallback3(() => {
876
+ if (contentHeightAnimationFrameRef.current !== null) {
877
+ cancelAnimationFrame(contentHeightAnimationFrameRef.current);
878
+ contentHeightAnimationFrameRef.current = null;
879
+ }
880
+ if (contentHeightTimeoutRef.current !== null) {
881
+ clearTimeout(contentHeightTimeoutRef.current);
882
+ contentHeightTimeoutRef.current = null;
883
+ }
884
+ }, []);
885
+ const setContentHeightFromDisplayedHeight = useCallback3(() => {
886
+ if (visibleSectionElement === null) {
887
+ return;
888
+ }
889
+ setContentHeight(Math.ceil(visibleSectionElement.offsetHeight));
890
+ }, [visibleSectionElement]);
891
+ const setContentHeightFromFullHeight = useCallback3(() => {
892
+ if (visibleSectionElement === null) {
893
+ return;
894
+ }
895
+ setContentHeight(Math.ceil(visibleSectionElement.scrollHeight));
896
+ }, [visibleSectionElement]);
897
+ const scheduleContentHeightUpdate = useCallback3(
898
+ (isOpening) => {
899
+ clearScheduledContentHeightUpdate();
900
+ if (isOpening) {
901
+ contentHeightAnimationFrameRef.current = requestAnimationFrame(() => {
902
+ setContentHeightFromFullHeight();
903
+ contentHeightAnimationFrameRef.current = null;
904
+ });
905
+ }
906
+ contentHeightTimeoutRef.current = setTimeout(() => {
907
+ setContentHeightFromDisplayedHeight();
908
+ contentHeightTimeoutRef.current = null;
909
+ }, detailsTransitionDurationMs);
910
+ },
911
+ [clearScheduledContentHeightUpdate, setContentHeightFromDisplayedHeight, setContentHeightFromFullHeight]
912
+ );
913
+ const closeMegaMenu = useCallback3(() => {
914
+ setOpenGroupId(null);
915
+ onClose();
916
+ }, [onClose]);
482
917
  useEffect2(() => {
483
918
  if (!isActive || !visibleSectionId || visibleSectionElement === null) {
484
919
  return;
485
920
  }
486
- const updateContentHeight = () => {
487
- setContentHeight(visibleSectionElement.offsetHeight);
488
- };
489
- updateContentHeight();
490
- if (typeof ResizeObserver === "undefined") {
921
+ contentHeightAnimationFrameRef.current = requestAnimationFrame(() => {
922
+ setContentHeightFromDisplayedHeight();
923
+ contentHeightAnimationFrameRef.current = null;
924
+ });
925
+ return clearScheduledContentHeightUpdate;
926
+ }, [
927
+ clearScheduledContentHeightUpdate,
928
+ isActive,
929
+ setContentHeightFromDisplayedHeight,
930
+ visibleSectionElement,
931
+ visibleSectionId
932
+ ]);
933
+ useEffect2(() => clearScheduledContentHeightUpdate, [clearScheduledContentHeightUpdate]);
934
+ useEffect2(() => {
935
+ if (!visibleSectionId) {
491
936
  return;
492
937
  }
493
- const resizeObserver = new ResizeObserver(() => {
494
- updateContentHeight();
495
- });
496
- resizeObserver.observe(visibleSectionElement);
497
- return () => {
498
- resizeObserver.disconnect();
499
- };
500
- }, [visibleSectionElement, visibleSectionId, isActive]);
938
+ setOpenGroupId(null);
939
+ }, [visibleSectionId]);
940
+ useEffect2(() => {
941
+ if (!isActive) {
942
+ setOpenGroupId(null);
943
+ }
944
+ }, [isActive]);
501
945
  return /* @__PURE__ */ jsxs6(
502
946
  "div",
503
947
  {
504
948
  className: cmMerge4("fixed top-14 left-0 z-3 w-full", isActive ? "pointer-events-auto" : "pointer-events-none"),
505
949
  onPointerEnter: () => onOpen(visibleSectionId),
506
- onPointerLeave: onClose,
950
+ onPointerLeave: closeMegaMenu,
507
951
  children: [
508
952
  /* @__PURE__ */ jsx8(
509
953
  "div",
@@ -537,53 +981,20 @@ var MegaMenu = ({
537
981
  section.id === visibleSectionId ? "opacity-100" : "opacity-0 pointer-events-none",
538
982
  "transition-all absolute w-full duration-300"
539
983
  ),
540
- children: section.items.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "mt-2 flex ", children: section.items.map((child) => {
541
- if (child.showInNav === false) {
542
- return null;
543
- }
544
- const ChildIcon = docs.docsIconMap[getDocsIconMapKey(child.kind, child.id)];
545
- return /* @__PURE__ */ jsxs6("li", { className: "flex-1 py-3 mb-6 px-4", children: [
546
- child.href ? /* @__PURE__ */ jsxs6(
547
- "a",
548
- {
549
- className: cmMerge4(
550
- "mb-4 flex items-center gap-2 text-lg font-semibold tracking-tight",
551
- activeItemId === child.id && "text-primary!"
552
- ),
553
- href: withSiteBaseUrl(child.href),
554
- children: [
555
- ChildIcon ? /* @__PURE__ */ jsx8(ChildIcon, { className: "size-4 shrink-0", "aria-hidden": "true" }) : null,
556
- /* @__PURE__ */ jsx8("span", { children: child.title })
557
- ]
558
- }
559
- ) : /* @__PURE__ */ jsxs6("span", { className: "mb-4 flex items-center gap-2 text-lg font-semibold tracking-tight", children: [
560
- ChildIcon ? /* @__PURE__ */ jsx8(ChildIcon, { className: "size-4 shrink-0", "aria-hidden": "true" }) : null,
561
- /* @__PURE__ */ jsx8("span", { children: child.title })
562
- ] }),
563
- child.kind === "group" && child.items.length > 0 && /* @__PURE__ */ jsx8("ul", { className: "menu border-l border-base-muted-light py-0 w-full", children: child.items.map((subChild) => {
564
- const SubChildIcon = docs.docsIconMap[getDocsIconMapKey(subChild.kind, subChild.id)];
565
- const typedChild = subChild;
566
- return /* @__PURE__ */ jsx8("li", { children: typedChild.href ? /* @__PURE__ */ jsx8(
567
- "a",
568
- {
569
- className: cmMerge4(
570
- "text-base-muted hover:text-base-content",
571
- activeItemId === typedChild.id && "text-primary! font-semibold"
572
- ),
573
- href: withSiteBaseUrl(typedChild.href),
574
- onClick: onClose,
575
- children: /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-2", children: [
576
- SubChildIcon ? /* @__PURE__ */ jsx8(SubChildIcon, { className: "size-4 shrink-0", "aria-hidden": "true" }) : null,
577
- /* @__PURE__ */ jsx8("span", { children: renderInlineMarkdown(typedChild?.navTitle || typedChild.title) })
578
- ] })
579
- }
580
- ) : /* @__PURE__ */ jsxs6("span", { className: "flex items-center gap-2", children: [
581
- SubChildIcon ? /* @__PURE__ */ jsx8(SubChildIcon, { className: "size-4 shrink-0", "aria-hidden": "true" }) : null,
582
- /* @__PURE__ */ jsx8("span", { children: renderInlineMarkdown(typedChild?.navTitle || typedChild.title) })
583
- ] }) }, typedChild.id);
584
- }) })
585
- ] }, child.id);
586
- }) })
984
+ children: hasVisibleItems(section.items) && /* @__PURE__ */ jsx8("ul", { className: "menu mt-2 flex-row items-start p-0 w-full", children: getVisibleNavItems(section.items).map((child) => /* @__PURE__ */ jsx8(
985
+ MegaMenuColumn,
986
+ {
987
+ item: child,
988
+ activeItemId,
989
+ currentHref: urlPathname,
990
+ docsIconMap: docs.docsIconMap,
991
+ onClose: closeMegaMenu,
992
+ onContentHeightChange: scheduleContentHeightUpdate,
993
+ openGroupId,
994
+ onOpenGroupChange: setOpenGroupId
995
+ },
996
+ child.id
997
+ )) })
587
998
  },
588
999
  section.id
589
1000
  ))
@@ -597,22 +1008,22 @@ var MegaMenu = ({
597
1008
  };
598
1009
 
599
1010
  // src/runtime/client/components/Navbar/useMegaMenu.ts
600
- import { useCallback as useCallback3, useEffect as useEffect3, useRef, useState as useState3 } from "react";
1011
+ import { useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
601
1012
  var megaMenuOpenDelayMs = 120;
602
1013
  var megaMenuCloseDelayMs = 140;
603
1014
  var useMegaMenu = ({ activeSectionId, sections }) => {
604
1015
  const [isMegaMenuOpen, setIsMegaMenuOpen] = useState3(false);
605
- const megaMenuOpenTimeoutRef = useRef(null);
606
- const megaMenuCloseTimeoutRef = useRef(null);
1016
+ const megaMenuOpenTimeoutRef = useRef2(null);
1017
+ const megaMenuCloseTimeoutRef = useRef2(null);
607
1018
  const [hoveredSectionId, setHoveredSectionId] = useState3(activeSectionId ?? sections[0]?.id);
608
- const clearMegaMenuOpenTimeout = useCallback3(() => {
1019
+ const clearMegaMenuOpenTimeout = useCallback4(() => {
609
1020
  if (megaMenuOpenTimeoutRef.current === null) {
610
1021
  return;
611
1022
  }
612
1023
  window.clearTimeout(megaMenuOpenTimeoutRef.current);
613
1024
  megaMenuOpenTimeoutRef.current = null;
614
1025
  }, []);
615
- const clearMegaMenuCloseTimeout = useCallback3(() => {
1026
+ const clearMegaMenuCloseTimeout = useCallback4(() => {
616
1027
  if (megaMenuCloseTimeoutRef.current === null) {
617
1028
  return;
618
1029
  }
@@ -873,13 +1284,13 @@ var AppLayout = ({ children, header }) => {
873
1284
  };
874
1285
 
875
1286
  // src/runtime/client/components/MetaHead/FaviconLinks.tsx
876
- import { Fragment, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1287
+ import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
877
1288
  var FaviconLinks = ({ head }) => {
878
1289
  const { appleTouchIcon, faviconIco, faviconSvg } = head;
879
- return /* @__PURE__ */ jsxs9(Fragment, { children: [
1290
+ return /* @__PURE__ */ jsxs9(Fragment2, { children: [
880
1291
  appleTouchIcon && /* @__PURE__ */ jsx11("link", { rel: "apple-touch-icon", href: appleTouchIcon }),
881
1292
  faviconSvg && /* @__PURE__ */ jsx11("link", { rel: "icon", type: "image/svg+xml", href: faviconSvg }),
882
- faviconIco && /* @__PURE__ */ jsxs9(Fragment, { children: [
1293
+ faviconIco && /* @__PURE__ */ jsxs9(Fragment2, { children: [
883
1294
  /* @__PURE__ */ jsx11("link", { rel: "shortcut icon", type: "image/x-icon", href: faviconIco }),
884
1295
  /* @__PURE__ */ jsx11("link", { rel: "icon", type: "image/x-icon", href: faviconIco })
885
1296
  ] })
@@ -887,7 +1298,7 @@ var FaviconLinks = ({ head }) => {
887
1298
  };
888
1299
 
889
1300
  // src/runtime/client/components/MetaHead/FontLinks.tsx
890
- import { Fragment as Fragment2, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1301
+ import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
891
1302
  var defaultInterFontStylesheetHref = nivelAssetUrl("fonts/fonts-inter.css");
892
1303
  var defaultInterFontCss = `
893
1304
  @font-face {
@@ -921,7 +1332,7 @@ var FontLinks = ({ head }) => {
921
1332
  const { fontStylesheetHref, fontPreloadHrefs } = head;
922
1333
  const effectivePreloadHrefs = fontPreloadHrefs ?? [];
923
1334
  const shouldInlineDefaultInterFonts = fontStylesheetHref === defaultInterFontStylesheetHref;
924
- return /* @__PURE__ */ jsxs10(Fragment2, { children: [
1335
+ return /* @__PURE__ */ jsxs10(Fragment3, { children: [
925
1336
  effectivePreloadHrefs.map((href) => /* @__PURE__ */ jsx12("link", { rel: "preload", href, as: "font", type: "font/woff2", crossOrigin: "anonymous" }, href)),
926
1337
  shouldInlineDefaultInterFonts ? /* @__PURE__ */ jsx12("style", { dangerouslySetInnerHTML: { __html: defaultInterFontCss } }) : null,
927
1338
  fontStylesheetHref && !shouldInlineDefaultInterFonts ? /* @__PURE__ */ jsx12("link", { rel: "stylesheet", href: fontStylesheetHref }) : null
@@ -978,11 +1389,11 @@ var ThemeBootstrap = ({ theme }) => {
978
1389
  };
979
1390
 
980
1391
  // src/runtime/client/components/MetaHead/index.tsx
981
- import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
1392
+ import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
982
1393
  var MetaHead = () => {
983
1394
  const docs = useDocsFromPageGlobalContext();
984
1395
  const shouldBlockCrawlers = docs.robots === false;
985
- return /* @__PURE__ */ jsxs11(Fragment3, { children: [
1396
+ return /* @__PURE__ */ jsxs11(Fragment4, { children: [
986
1397
  /* @__PURE__ */ jsx14(ThemeBootstrap, { theme: docs.theme }),
987
1398
  /* @__PURE__ */ jsx14(FaviconLinks, { head: docs.head }),
988
1399
  /* @__PURE__ */ jsx14(FontLinks, { head: docs.head }),
@@ -1177,36 +1588,9 @@ var HeadingLinkCopy = () => {
1177
1588
 
1178
1589
  // src/runtime/client/components/Sidebar.tsx
1179
1590
  import { cmMerge as cmMerge7 } from "@classmatejs/react";
1180
- import { memo as memo3, useEffect as useEffect6, useRef as useRef2 } from "react";
1591
+ import { memo as memo3, useEffect as useEffect6, useRef as useRef3 } from "react";
1181
1592
  import { usePageContext as usePageContext4 } from "vike-react/usePageContext";
1182
-
1183
- // src/runtime/client/components/docsNavigation.ts
1184
- var containsActiveHref = (items, currentHref) => {
1185
- return items.some((item) => {
1186
- if (item.kind === "page") {
1187
- return item.href === currentHref;
1188
- }
1189
- return item.href === currentHref || containsActiveHref(item.items, currentHref);
1190
- });
1191
- };
1192
- var hasActiveItem = (items, activeHref) => containsActiveHref(items, activeHref);
1193
- var getVisibleNavItems = (items) => items.filter((item) => item.showInNav);
1194
- var getVisibleGroupItems = (group) => {
1195
- const visibleItems = getVisibleNavItems(group.items);
1196
- if (!group.href) {
1197
- return visibleItems;
1198
- }
1199
- return visibleItems.filter((item) => {
1200
- if (item.kind !== "page") {
1201
- return true;
1202
- }
1203
- return item.href !== group.href;
1204
- });
1205
- };
1206
- var getGroupHref = (group) => group.href ?? null;
1207
-
1208
- // src/runtime/client/components/Sidebar.tsx
1209
- import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
1593
+ import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
1210
1594
  var useAutoOpenDetails = (nodeId, isOpenByDefault, hasActiveDescendant) => {
1211
1595
  const storedOpen = useDocsSidebarStore((state) => state.openNodes[nodeId]);
1212
1596
  const { setNodeOpen } = useDocsSidebarActions();
@@ -1307,9 +1691,9 @@ var SidebarNestedGroup = ({ group, currentHref, docsIconMap }) => {
1307
1691
  const GroupIcon = docsIconMap[getDocsIconMapKey("group", group.id)];
1308
1692
  if (!isCollapsible) {
1309
1693
  if (!group.title) {
1310
- return /* @__PURE__ */ jsx18(Fragment4, { children: renderSidebarItems(visibleItems, currentHref, docsIconMap) });
1694
+ return /* @__PURE__ */ jsx18(Fragment5, { children: renderSidebarItems(visibleItems, currentHref, docsIconMap) });
1311
1695
  }
1312
- return /* @__PURE__ */ jsxs15(Fragment4, { children: [
1696
+ return /* @__PURE__ */ jsxs15(Fragment5, { children: [
1313
1697
  /* @__PURE__ */ jsx18(SidebarGroupDivider, { title: group.title, icon: GroupIcon }),
1314
1698
  renderSidebarItems(visibleItems, currentHref, docsIconMap)
1315
1699
  ] });
@@ -1362,7 +1746,7 @@ var SidebarSectionGroup = ({ section, currentHref, activeSectionId }) => {
1362
1746
  };
1363
1747
  var Sidebar = memo3(
1364
1748
  ({ currentHref: currentHrefProp = "", activeSectionId: activeSectionIdProp = "" }) => {
1365
- const scrollContainerRef = useRef2(null);
1749
+ const scrollContainerRef = useRef3(null);
1366
1750
  const { urlPathname } = usePageContext4();
1367
1751
  const currentHref = currentHrefProp || urlPathname;
1368
1752
  const docs = useDocsGlobalContext();
@@ -1393,7 +1777,7 @@ var Sidebar = memo3(
1393
1777
  // src/runtime/client/components/TableOfContents.tsx
1394
1778
  import cm5, { cmMerge as cmMerge8 } from "@classmatejs/react";
1395
1779
  import { Flame, TableOfContentsIcon } from "lucide-react";
1396
- import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
1780
+ import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
1397
1781
  var TableOfContents = ({
1398
1782
  headings: headingsProp = [],
1399
1783
  tableOfContents: tableOfContentsProp = false,
@@ -1404,7 +1788,7 @@ var TableOfContents = ({
1404
1788
  const effectiveHeadings = headingsProp;
1405
1789
  const effectiveTableOfContents = tableOfContentsProp;
1406
1790
  return /* @__PURE__ */ jsx19("aside", { className: cmMerge8(effectiveTableOfContents ? "w-64" : "w-32", "hidden shrink-0 xl:block"), children: /* @__PURE__ */ jsx19("div", { className: "sticky top-14", children: /* @__PURE__ */ jsxs16("div", { className: "relative h-[calc(100svh-14*var(--spacing))] overflow-y-auto overflow-x-hidden pt-10 pb-8", children: [
1407
- effectiveTableOfContents ? effectiveHeadings.length > 0 && /* @__PURE__ */ jsxs16(Fragment5, { children: [
1791
+ effectiveTableOfContents ? effectiveHeadings.length > 0 && /* @__PURE__ */ jsxs16(Fragment6, { children: [
1408
1792
  /* @__PURE__ */ jsxs16("p", { className: "mb-4 flex items-center gap-2 text-xs font-semibold uppercase tracking-widest text-base-muted", children: [
1409
1793
  /* @__PURE__ */ jsx19(TableOfContentsIcon, { className: "size-3" }),
1410
1794
  "On this page"
@@ -1445,7 +1829,7 @@ var Adbar = ({ partners }) => {
1445
1829
  var PartnerLogo = ({
1446
1830
  partner
1447
1831
  }) => {
1448
- return /* @__PURE__ */ jsxs16(Fragment5, { children: [
1832
+ return /* @__PURE__ */ jsxs16(Fragment6, { children: [
1449
1833
  /* @__PURE__ */ jsx19(
1450
1834
  Image,
1451
1835
  {
@@ -1490,7 +1874,7 @@ import { useId } from "react";
1490
1874
 
1491
1875
  // src/runtime/client/components/BreadcrumbSidebarTrigger.tsx
1492
1876
  import { ChevronLast, ChevronsRight as ChevronsRight2 } from "lucide-react";
1493
- import { useCallback as useCallback4 } from "react";
1877
+ import { useCallback as useCallback5 } from "react";
1494
1878
  import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
1495
1879
  var dedupeBreadcrumbs2 = (items) => {
1496
1880
  return items.filter((item, index) => index === 0 || items[index - 1]?.title !== item.title);
@@ -1523,7 +1907,7 @@ var BreadcrumbSidebarTrigger = ({ currentHref }) => {
1523
1907
  ...activeSection ? [{ id: activeSection.id, title: activeSection.navTitle }] : [],
1524
1908
  ...activeSection ? getSidebarBreadcrumbs2(activeSection.items, currentHref) ?? [] : []
1525
1909
  ]);
1526
- const handleClick = useCallback4(() => {
1910
+ const handleClick = useCallback5(() => {
1527
1911
  alert("TODO: Open mobile menu");
1528
1912
  }, []);
1529
1913
  return /* @__PURE__ */ jsx20("button", { className: "cursor-pointer min-w-0 max-w-full block", type: "button", onClick: handleClick, children: /* @__PURE__ */ jsxs17("span", { className: "flex items-center gap-1 min-w-0 overflow-hidden lg:hidden", children: [
@@ -1537,7 +1921,7 @@ var BreadcrumbSidebarTrigger = ({ currentHref }) => {
1537
1921
  var BreadcrumbSidebarTrigger_default = BreadcrumbSidebarTrigger;
1538
1922
 
1539
1923
  // src/runtime/client/components/TableOfContentsMobile.tsx
1540
- import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
1924
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
1541
1925
  var TableOfContentsMobile = ({
1542
1926
  headings = [],
1543
1927
  tableOfContents = false,
@@ -1550,7 +1934,7 @@ var TableOfContentsMobile = ({
1550
1934
  const selectId = useId();
1551
1935
  const labelId = `${selectId}-label`;
1552
1936
  const selectedValue = tableOfContents && headings.some((heading) => heading.id === activeHeadingId) ? activeHeadingId : "";
1553
- return /* @__PURE__ */ jsxs18(Fragment6, { children: [
1937
+ return /* @__PURE__ */ jsxs18(Fragment7, { children: [
1554
1938
  /* @__PURE__ */ jsx21("div", { className: "h-12 xl:hidden" }),
1555
1939
  /* @__PURE__ */ jsx21(StyledTOC, { children: /* @__PURE__ */ jsxs18(StyledTOCInner, { children: [
1556
1940
  /* @__PURE__ */ jsx21("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx21(BreadcrumbSidebarTrigger_default, { currentHref }) }),
@@ -1746,13 +2130,13 @@ var useTableOfContentsState = ({
1746
2130
  };
1747
2131
 
1748
2132
  // src/runtime/client/DocsLayout.tsx
1749
- import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
2133
+ import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
1750
2134
  var DocsLayout = ({ children }) => {
1751
2135
  const data = useData();
1752
2136
  const { activeHeadingId, effectiveHeadings, setActiveHeadingId } = useTableOfContentsState({
1753
2137
  headings: data.headings
1754
2138
  });
1755
- return /* @__PURE__ */ jsxs19(Fragment7, { children: [
2139
+ return /* @__PURE__ */ jsxs19(Fragment8, { children: [
1756
2140
  /* @__PURE__ */ jsx22(HeadingLinkCopy, {}),
1757
2141
  /* @__PURE__ */ jsx22("div", { className: "absolute top-0 left-0 h-[60svh] w-full bg-radial-[at_65%_-85%] from-primary-muted-light/40 to-65% dark:from-primary-muted-light/60" }),
1758
2142
  /* @__PURE__ */ jsx22(LayoutComponent, { children: /* @__PURE__ */ jsxs19("div", { className: "lg:flex gap-14", children: [
@@ -1810,4 +2194,4 @@ export {
1810
2194
  DocsLayout,
1811
2195
  DocsPage
1812
2196
  };
1813
- //# sourceMappingURL=chunk-LZDZWW3P.js.map
2197
+ //# sourceMappingURL=chunk-N6WF4LPU.js.map