@unterberg/nivel 0.2.33 → 0.2.35
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
|
-
|
|
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
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
+
);
|
|
510
|
+
}
|
|
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;
|
|
458
537
|
}
|
|
459
|
-
return
|
|
538
|
+
return /* @__PURE__ */ jsx8("ul", { className: cmMerge4("menu menu-sm w-full p-0", depth > 0 && "mt-1 border-l border-base-muted-light 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: "menu 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
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
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
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
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:
|
|
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
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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
|
|
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 =
|
|
606
|
-
const megaMenuCloseTimeoutRef =
|
|
1016
|
+
const megaMenuOpenTimeoutRef = useRef2(null);
|
|
1017
|
+
const megaMenuCloseTimeoutRef = useRef2(null);
|
|
607
1018
|
const [hoveredSectionId, setHoveredSectionId] = useState3(activeSectionId ?? sections[0]?.id);
|
|
608
|
-
const clearMegaMenuOpenTimeout =
|
|
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 =
|
|
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(
|
|
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(
|
|
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
|
|
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(
|
|
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
|
|
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(
|
|
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 }),
|
|
@@ -1002,10 +1413,56 @@ import { useData } from "vike-react/useData";
|
|
|
1002
1413
|
// src/runtime/client/components/DocsPagination.tsx
|
|
1003
1414
|
import { cmMerge as cmMerge6 } from "@classmatejs/react";
|
|
1004
1415
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
1416
|
+
|
|
1417
|
+
// src/runtime/client/components/DocsBreadcrumbs.tsx
|
|
1418
|
+
import { ChevronsRight } from "lucide-react";
|
|
1005
1419
|
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1420
|
+
var dedupeBreadcrumbs = (items) => {
|
|
1421
|
+
return items.filter((item, index) => index === 0 || items[index - 1]?.title !== item.title);
|
|
1422
|
+
};
|
|
1423
|
+
var getSidebarBreadcrumbs = (items, currentHref) => {
|
|
1424
|
+
for (const item of items) {
|
|
1425
|
+
if (item.kind === "page") {
|
|
1426
|
+
if (item.href === currentHref) {
|
|
1427
|
+
return [{ id: item.id, kind: item.kind, title: item.navTitle }];
|
|
1428
|
+
}
|
|
1429
|
+
continue;
|
|
1430
|
+
}
|
|
1431
|
+
if (item.href === currentHref) {
|
|
1432
|
+
return item.title ? [{ id: item.id, kind: item.kind, title: item.title }] : [];
|
|
1433
|
+
}
|
|
1434
|
+
const nestedBreadcrumbs = getSidebarBreadcrumbs(item.items, currentHref);
|
|
1435
|
+
if (!nestedBreadcrumbs) {
|
|
1436
|
+
continue;
|
|
1437
|
+
}
|
|
1438
|
+
return dedupeBreadcrumbs(item.title ? [{ id: item.id, kind: item.kind, title: item.title }] : nestedBreadcrumbs);
|
|
1439
|
+
}
|
|
1440
|
+
return null;
|
|
1441
|
+
};
|
|
1442
|
+
var DocsBreadcrumbs = ({ currentHref }) => {
|
|
1443
|
+
const docs = useDocsGlobalContext();
|
|
1444
|
+
const activeSection = getActiveSectionByPathname(docs, currentHref);
|
|
1445
|
+
const breadcrumbItems = dedupeBreadcrumbs([
|
|
1446
|
+
...activeSection ? getSidebarBreadcrumbs(activeSection.items, currentHref) ?? [] : []
|
|
1447
|
+
]);
|
|
1448
|
+
return /* @__PURE__ */ jsx15("span", { className: "flex items-center text-sm gap-1 min-w-0 overflow-hidden text-primary", children: breadcrumbItems.map((item, index) => {
|
|
1449
|
+
const Icon = docs.docsIconMap[getDocsIconMapKey(item.kind, item.id)];
|
|
1450
|
+
return /* @__PURE__ */ jsxs12("span", { className: "contents", children: [
|
|
1451
|
+
index > 0 ? /* @__PURE__ */ jsx15(ChevronsRight, { className: "size-4 shrink-0 text-base-muted-medium" }) : null,
|
|
1452
|
+
/* @__PURE__ */ jsxs12("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
1453
|
+
Icon ? /* @__PURE__ */ jsx15(Icon, { className: "size-3 shrink-0", "aria-hidden": "true" }) : null,
|
|
1454
|
+
/* @__PURE__ */ jsx15("span", { className: "truncate", children: renderInlineMarkdown(item.title, { codeClassName: "text-sm!" }) })
|
|
1455
|
+
] })
|
|
1456
|
+
] }, item.id);
|
|
1457
|
+
}) });
|
|
1458
|
+
};
|
|
1459
|
+
var DocsBreadcrumbs_default = DocsBreadcrumbs;
|
|
1460
|
+
|
|
1461
|
+
// src/runtime/client/components/DocsPagination.tsx
|
|
1462
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1006
1463
|
var PaginationCard = ({ item, direction, isOffset }) => {
|
|
1007
1464
|
const isPrevious = direction === "previous";
|
|
1008
|
-
return /* @__PURE__ */
|
|
1465
|
+
return /* @__PURE__ */ jsx16(
|
|
1009
1466
|
"a",
|
|
1010
1467
|
{
|
|
1011
1468
|
href: withSiteBaseUrl(item.href),
|
|
@@ -1015,20 +1472,21 @@ var PaginationCard = ({ item, direction, isOffset }) => {
|
|
|
1015
1472
|
isOffset && "sm:col-start-2"
|
|
1016
1473
|
),
|
|
1017
1474
|
"aria-label": `${isPrevious ? "Previous" : "Next"}: ${item.title}`,
|
|
1018
|
-
children: /* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1475
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col h-full justify-between gap-2", children: [
|
|
1476
|
+
/* @__PURE__ */ jsx16("div", { className: cmMerge6("flex gap-1 text-base-muted", isPrevious ? "justify-start" : "justify-end"), children: /* @__PURE__ */ jsx16(DocsBreadcrumbs_default, { currentHref: item.href }) }),
|
|
1477
|
+
/* @__PURE__ */ jsx16("p", { className: "text-lg font-semibold text-base-content", children: renderInlineMarkdown(item.title) }),
|
|
1478
|
+
/* @__PURE__ */ jsx16(
|
|
1021
1479
|
"div",
|
|
1022
1480
|
{
|
|
1023
1481
|
className: cmMerge6(
|
|
1024
|
-
"flex items-
|
|
1482
|
+
"flex flex-1 items-end gap-1 text-base-muted group-hover:text-base-content",
|
|
1025
1483
|
isPrevious ? "justify-start" : "justify-end"
|
|
1026
1484
|
),
|
|
1027
|
-
children: [
|
|
1028
|
-
isPrevious && /* @__PURE__ */
|
|
1029
|
-
/* @__PURE__ */
|
|
1030
|
-
!isPrevious && /* @__PURE__ */
|
|
1031
|
-
]
|
|
1485
|
+
children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center", children: [
|
|
1486
|
+
isPrevious && /* @__PURE__ */ jsx16(ChevronLeft, { className: "size-4" }),
|
|
1487
|
+
/* @__PURE__ */ jsx16("span", { children: isPrevious ? "Previous" : "Next" }),
|
|
1488
|
+
!isPrevious && /* @__PURE__ */ jsx16(ChevronRight, { className: "size-4" })
|
|
1489
|
+
] })
|
|
1032
1490
|
}
|
|
1033
1491
|
)
|
|
1034
1492
|
] })
|
|
@@ -1048,32 +1506,32 @@ var DocsPagination = ({
|
|
|
1048
1506
|
if (!previousPage && !nextPage) {
|
|
1049
1507
|
return null;
|
|
1050
1508
|
}
|
|
1051
|
-
return /* @__PURE__ */
|
|
1052
|
-
previousPage && /* @__PURE__ */
|
|
1053
|
-
nextPage && /* @__PURE__ */
|
|
1509
|
+
return /* @__PURE__ */ jsx16("nav", { className: "mb-10 mt-16", "aria-label": "Previous Next", children: /* @__PURE__ */ jsxs13("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
1510
|
+
previousPage && /* @__PURE__ */ jsx16(PaginationCard, { item: previousPage, direction: "previous" }),
|
|
1511
|
+
nextPage && /* @__PURE__ */ jsx16(PaginationCard, { isOffset: !previousPage, item: nextPage, direction: "next" })
|
|
1054
1512
|
] }) });
|
|
1055
1513
|
};
|
|
1056
1514
|
|
|
1057
1515
|
// src/runtime/client/components/Footer.tsx
|
|
1058
1516
|
import { Bug, Pencil } from "lucide-react";
|
|
1059
1517
|
import { memo as memo2 } from "react";
|
|
1060
|
-
import { jsx as
|
|
1518
|
+
import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1061
1519
|
var DocsFooter = memo2(() => {
|
|
1062
1520
|
const { brand } = useDocsGlobalContext();
|
|
1063
|
-
return /* @__PURE__ */
|
|
1064
|
-
/* @__PURE__ */
|
|
1065
|
-
/* @__PURE__ */
|
|
1066
|
-
/* @__PURE__ */
|
|
1521
|
+
return /* @__PURE__ */ jsxs14("footer", { className: "mb-8 mt-12 text-sm border-t border-base-muted-light pt-10", children: [
|
|
1522
|
+
/* @__PURE__ */ jsxs14("div", { className: "mb-16 flex items-center gap-2", children: [
|
|
1523
|
+
/* @__PURE__ */ jsxs14("a", { href: "edit", className: "btn btn-sm btn-primary btn-soft", children: [
|
|
1524
|
+
/* @__PURE__ */ jsx17(Pencil, { className: "size-3" }),
|
|
1067
1525
|
" Edit this page"
|
|
1068
1526
|
] }),
|
|
1069
|
-
/* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */
|
|
1527
|
+
/* @__PURE__ */ jsxs14("a", { href: "edit", className: "btn btn-sm btn-primary btn-soft", children: [
|
|
1528
|
+
/* @__PURE__ */ jsx17(Bug, { className: "size-3" }),
|
|
1071
1529
|
" Report Issue"
|
|
1072
1530
|
] })
|
|
1073
1531
|
] }),
|
|
1074
|
-
/* @__PURE__ */
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
/* @__PURE__ */
|
|
1532
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex justify-between items-center", children: [
|
|
1533
|
+
/* @__PURE__ */ jsx17(SocialLinks_default, {}),
|
|
1534
|
+
/* @__PURE__ */ jsx17("div", { className: "flex gap-2 items-center", children: brand && /* @__PURE__ */ jsx17(Brand, { brand, noText: true }) })
|
|
1077
1535
|
] })
|
|
1078
1536
|
] });
|
|
1079
1537
|
});
|
|
@@ -1130,36 +1588,9 @@ var HeadingLinkCopy = () => {
|
|
|
1130
1588
|
|
|
1131
1589
|
// src/runtime/client/components/Sidebar.tsx
|
|
1132
1590
|
import { cmMerge as cmMerge7 } from "@classmatejs/react";
|
|
1133
|
-
import { memo as memo3, useEffect as useEffect6, useRef as
|
|
1591
|
+
import { memo as memo3, useEffect as useEffect6, useRef as useRef3 } from "react";
|
|
1134
1592
|
import { usePageContext as usePageContext4 } from "vike-react/usePageContext";
|
|
1135
|
-
|
|
1136
|
-
// src/runtime/client/components/docsNavigation.ts
|
|
1137
|
-
var containsActiveHref = (items, currentHref) => {
|
|
1138
|
-
return items.some((item) => {
|
|
1139
|
-
if (item.kind === "page") {
|
|
1140
|
-
return item.href === currentHref;
|
|
1141
|
-
}
|
|
1142
|
-
return item.href === currentHref || containsActiveHref(item.items, currentHref);
|
|
1143
|
-
});
|
|
1144
|
-
};
|
|
1145
|
-
var hasActiveItem = (items, activeHref) => containsActiveHref(items, activeHref);
|
|
1146
|
-
var getVisibleNavItems = (items) => items.filter((item) => item.showInNav);
|
|
1147
|
-
var getVisibleGroupItems = (group) => {
|
|
1148
|
-
const visibleItems = getVisibleNavItems(group.items);
|
|
1149
|
-
if (!group.href) {
|
|
1150
|
-
return visibleItems;
|
|
1151
|
-
}
|
|
1152
|
-
return visibleItems.filter((item) => {
|
|
1153
|
-
if (item.kind !== "page") {
|
|
1154
|
-
return true;
|
|
1155
|
-
}
|
|
1156
|
-
return item.href !== group.href;
|
|
1157
|
-
});
|
|
1158
|
-
};
|
|
1159
|
-
var getGroupHref = (group) => group.href ?? null;
|
|
1160
|
-
|
|
1161
|
-
// src/runtime/client/components/Sidebar.tsx
|
|
1162
|
-
import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1593
|
+
import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1163
1594
|
var useAutoOpenDetails = (nodeId, isOpenByDefault, hasActiveDescendant) => {
|
|
1164
1595
|
const storedOpen = useDocsSidebarStore((state) => state.openNodes[nodeId]);
|
|
1165
1596
|
const { setNodeOpen } = useDocsSidebarActions();
|
|
@@ -1179,7 +1610,7 @@ var useAutoOpenDetails = (nodeId, isOpenByDefault, hasActiveDescendant) => {
|
|
|
1179
1610
|
};
|
|
1180
1611
|
};
|
|
1181
1612
|
var SidebarPageLink = ({ title, href, currentHref, icon: Icon }) => {
|
|
1182
|
-
return /* @__PURE__ */
|
|
1613
|
+
return /* @__PURE__ */ jsx18("li", { className: "rounded-none", children: /* @__PURE__ */ jsx18(
|
|
1183
1614
|
"a",
|
|
1184
1615
|
{
|
|
1185
1616
|
href: withSiteBaseUrl(href),
|
|
@@ -1187,23 +1618,23 @@ var SidebarPageLink = ({ title, href, currentHref, icon: Icon }) => {
|
|
|
1187
1618
|
"rounded-field py-2 text-base-muted hover:text-base-content justify-start hover:bg-base-200",
|
|
1188
1619
|
href === currentHref && "text-primary! font-semibold bg-base-200"
|
|
1189
1620
|
),
|
|
1190
|
-
children: /* @__PURE__ */
|
|
1191
|
-
Icon ? /* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */
|
|
1621
|
+
children: /* @__PURE__ */ jsxs15("span", { className: "flex items-center gap-2", children: [
|
|
1622
|
+
Icon ? /* @__PURE__ */ jsx18(Icon, { className: "size-4 shrink-0", "aria-hidden": "true" }) : null,
|
|
1623
|
+
/* @__PURE__ */ jsx18("span", { children: renderInlineMarkdown(title, { codeClassName: "text-sm!" }) })
|
|
1193
1624
|
] })
|
|
1194
1625
|
}
|
|
1195
1626
|
) });
|
|
1196
1627
|
};
|
|
1197
1628
|
var SidebarGroupDivider = ({ title, icon: Icon }) => {
|
|
1198
|
-
return /* @__PURE__ */
|
|
1199
|
-
Icon ? /* @__PURE__ */
|
|
1200
|
-
/* @__PURE__ */
|
|
1629
|
+
return /* @__PURE__ */ jsx18("li", { className: "ml-3 mt-2 mb-2 border-b border-base-muted-light text-xs text-base-muted-medium pointer-events-none font-semibold", children: /* @__PURE__ */ jsxs15("span", { className: "-ml-3 flex items-center gap-2", children: [
|
|
1630
|
+
Icon ? /* @__PURE__ */ jsx18(Icon, { className: "size-4 shrink-0", "aria-hidden": "true" }) : null,
|
|
1631
|
+
/* @__PURE__ */ jsx18("span", { children: renderInlineMarkdown(title, { codeClassName: "text-sm!" }) })
|
|
1201
1632
|
] }) });
|
|
1202
1633
|
};
|
|
1203
1634
|
var SidebarGroupTitle = ({ title, href, isActive, allowNavigation = false, icon: Icon }) => {
|
|
1204
|
-
const content = /* @__PURE__ */
|
|
1205
|
-
Icon ? /* @__PURE__ */
|
|
1206
|
-
/* @__PURE__ */
|
|
1635
|
+
const content = /* @__PURE__ */ jsxs15("span", { className: "flex items-center gap-2", children: [
|
|
1636
|
+
Icon ? /* @__PURE__ */ jsx18(Icon, { className: "size-4 shrink-0", "aria-hidden": "true" }) : null,
|
|
1637
|
+
/* @__PURE__ */ jsx18(
|
|
1207
1638
|
"span",
|
|
1208
1639
|
{
|
|
1209
1640
|
className: cmMerge7(
|
|
@@ -1215,7 +1646,7 @@ var SidebarGroupTitle = ({ title, href, isActive, allowNavigation = false, icon:
|
|
|
1215
1646
|
)
|
|
1216
1647
|
] });
|
|
1217
1648
|
if (allowNavigation && href) {
|
|
1218
|
-
return /* @__PURE__ */
|
|
1649
|
+
return /* @__PURE__ */ jsx18(
|
|
1219
1650
|
"a",
|
|
1220
1651
|
{
|
|
1221
1652
|
href: withSiteBaseUrl(href),
|
|
@@ -1227,12 +1658,12 @@ var SidebarGroupTitle = ({ title, href, isActive, allowNavigation = false, icon:
|
|
|
1227
1658
|
}
|
|
1228
1659
|
);
|
|
1229
1660
|
}
|
|
1230
|
-
return /* @__PURE__ */
|
|
1661
|
+
return /* @__PURE__ */ jsx18("span", { className: "flex items-center gap-2 rounded-field py-2 text-base-content", children: content });
|
|
1231
1662
|
};
|
|
1232
1663
|
var renderSidebarItems = (items, currentHref, docsIconMap) => {
|
|
1233
1664
|
return items.map((item) => {
|
|
1234
1665
|
if (item.kind === "page") {
|
|
1235
|
-
return /* @__PURE__ */
|
|
1666
|
+
return /* @__PURE__ */ jsx18(
|
|
1236
1667
|
SidebarPageLink,
|
|
1237
1668
|
{
|
|
1238
1669
|
title: item.navTitle,
|
|
@@ -1243,12 +1674,12 @@ var renderSidebarItems = (items, currentHref, docsIconMap) => {
|
|
|
1243
1674
|
item.id
|
|
1244
1675
|
);
|
|
1245
1676
|
}
|
|
1246
|
-
return /* @__PURE__ */
|
|
1677
|
+
return /* @__PURE__ */ jsx18(SidebarNestedGroup, { group: item, currentHref, docsIconMap }, item.id);
|
|
1247
1678
|
});
|
|
1248
1679
|
};
|
|
1249
1680
|
var SidebarItemList = ({ items, currentHref, docsIconMap }) => {
|
|
1250
1681
|
const visibleItems = getVisibleNavItems(items);
|
|
1251
|
-
return /* @__PURE__ */
|
|
1682
|
+
return /* @__PURE__ */ jsx18("ul", { className: "menu lg:w-[97%]", children: renderSidebarItems(visibleItems, currentHref, docsIconMap) });
|
|
1252
1683
|
};
|
|
1253
1684
|
var SidebarNestedGroup = ({ group, currentHref, docsIconMap }) => {
|
|
1254
1685
|
const groupHref = getGroupHref(group);
|
|
@@ -1260,14 +1691,14 @@ var SidebarNestedGroup = ({ group, currentHref, docsIconMap }) => {
|
|
|
1260
1691
|
const GroupIcon = docsIconMap[getDocsIconMapKey("group", group.id)];
|
|
1261
1692
|
if (!isCollapsible) {
|
|
1262
1693
|
if (!group.title) {
|
|
1263
|
-
return /* @__PURE__ */
|
|
1694
|
+
return /* @__PURE__ */ jsx18(Fragment5, { children: renderSidebarItems(visibleItems, currentHref, docsIconMap) });
|
|
1264
1695
|
}
|
|
1265
|
-
return /* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */
|
|
1696
|
+
return /* @__PURE__ */ jsxs15(Fragment5, { children: [
|
|
1697
|
+
/* @__PURE__ */ jsx18(SidebarGroupDivider, { title: group.title, icon: GroupIcon }),
|
|
1267
1698
|
renderSidebarItems(visibleItems, currentHref, docsIconMap)
|
|
1268
1699
|
] });
|
|
1269
1700
|
}
|
|
1270
|
-
return /* @__PURE__ */
|
|
1701
|
+
return /* @__PURE__ */ jsx18("li", { children: /* @__PURE__ */ jsxs15(
|
|
1271
1702
|
"details",
|
|
1272
1703
|
{
|
|
1273
1704
|
open: isOpen,
|
|
@@ -1275,7 +1706,7 @@ var SidebarNestedGroup = ({ group, currentHref, docsIconMap }) => {
|
|
|
1275
1706
|
setIsOpen(event.currentTarget.open);
|
|
1276
1707
|
},
|
|
1277
1708
|
children: [
|
|
1278
|
-
/* @__PURE__ */
|
|
1709
|
+
/* @__PURE__ */ jsx18("summary", { className: "rounded-field max-h-9 flex items-center", children: /* @__PURE__ */ jsx18(
|
|
1279
1710
|
SidebarGroupTitle,
|
|
1280
1711
|
{
|
|
1281
1712
|
title: group.title,
|
|
@@ -1285,7 +1716,7 @@ var SidebarNestedGroup = ({ group, currentHref, docsIconMap }) => {
|
|
|
1285
1716
|
icon: GroupIcon
|
|
1286
1717
|
}
|
|
1287
1718
|
) }),
|
|
1288
|
-
visibleItems.length > 0 ? /* @__PURE__ */
|
|
1719
|
+
visibleItems.length > 0 ? /* @__PURE__ */ jsx18(SidebarItemList, { items: visibleItems, currentHref, docsIconMap }) : null
|
|
1289
1720
|
]
|
|
1290
1721
|
}
|
|
1291
1722
|
) });
|
|
@@ -1299,7 +1730,7 @@ var SidebarSectionGroup = ({ section, currentHref, activeSectionId }) => {
|
|
|
1299
1730
|
section.id === activeSectionId,
|
|
1300
1731
|
sectionHasActiveItem
|
|
1301
1732
|
);
|
|
1302
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ jsx18("li", { className: "pb-1", children: /* @__PURE__ */ jsxs15(
|
|
1303
1734
|
"details",
|
|
1304
1735
|
{
|
|
1305
1736
|
open: isOpen,
|
|
@@ -1307,28 +1738,28 @@ var SidebarSectionGroup = ({ section, currentHref, activeSectionId }) => {
|
|
|
1307
1738
|
setIsOpen(event.currentTarget.open);
|
|
1308
1739
|
},
|
|
1309
1740
|
children: [
|
|
1310
|
-
/* @__PURE__ */
|
|
1311
|
-
/* @__PURE__ */
|
|
1741
|
+
/* @__PURE__ */ jsx18("summary", { className: "rounded-field max-h-9 flex items-center", children: /* @__PURE__ */ jsx18(SidebarGroupTitle, { title: section.title, isActive: sectionHasActiveItem, icon: SectionIcon }) }),
|
|
1742
|
+
/* @__PURE__ */ jsx18(SidebarItemList, { items: section.items, currentHref, docsIconMap: docs.docsIconMap })
|
|
1312
1743
|
]
|
|
1313
1744
|
}
|
|
1314
1745
|
) });
|
|
1315
1746
|
};
|
|
1316
1747
|
var Sidebar = memo3(
|
|
1317
1748
|
({ currentHref: currentHrefProp = "", activeSectionId: activeSectionIdProp = "" }) => {
|
|
1318
|
-
const scrollContainerRef =
|
|
1749
|
+
const scrollContainerRef = useRef3(null);
|
|
1319
1750
|
const { urlPathname } = usePageContext4();
|
|
1320
1751
|
const currentHref = currentHrefProp || urlPathname;
|
|
1321
1752
|
const docs = useDocsGlobalContext();
|
|
1322
1753
|
const activeSectionId = activeSectionIdProp || getActiveSectionByPathname(docs, currentHref)?.id || "";
|
|
1323
1754
|
const { sidebarSections } = docs;
|
|
1324
|
-
return /* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1755
|
+
return /* @__PURE__ */ jsx18("aside", { className: "hidden basis-76 shrink-0 lg:block", children: /* @__PURE__ */ jsxs15("div", { className: "-ml-3 sticky top-14", children: [
|
|
1756
|
+
/* @__PURE__ */ jsx18("div", { className: "absolute h-full w-px right-0 top-0 bg-linear-to-t to-base-muted-light via-base-muted-light pointer-events-none z-1" }),
|
|
1757
|
+
/* @__PURE__ */ jsx18(
|
|
1327
1758
|
"div",
|
|
1328
1759
|
{
|
|
1329
1760
|
ref: scrollContainerRef,
|
|
1330
1761
|
className: "pr-4 h-[calc(100svh-14*var(--spacing))] overflow-y-scroll relative z-10",
|
|
1331
|
-
children: /* @__PURE__ */
|
|
1762
|
+
children: /* @__PURE__ */ jsx18("ul", { className: cmMerge7("menu p-0 m-0 w-full px-0 pt-3 li:last-child:border-0"), children: sidebarSections.map((section) => /* @__PURE__ */ jsx18(
|
|
1332
1763
|
SidebarSectionGroup,
|
|
1333
1764
|
{
|
|
1334
1765
|
section,
|
|
@@ -1346,7 +1777,7 @@ var Sidebar = memo3(
|
|
|
1346
1777
|
// src/runtime/client/components/TableOfContents.tsx
|
|
1347
1778
|
import cm5, { cmMerge as cmMerge8 } from "@classmatejs/react";
|
|
1348
1779
|
import { Flame, TableOfContentsIcon } from "lucide-react";
|
|
1349
|
-
import { Fragment as
|
|
1780
|
+
import { Fragment as Fragment6, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1350
1781
|
var TableOfContents = ({
|
|
1351
1782
|
headings: headingsProp = [],
|
|
1352
1783
|
tableOfContents: tableOfContentsProp = false,
|
|
@@ -1356,13 +1787,13 @@ var TableOfContents = ({
|
|
|
1356
1787
|
const { partners } = useDocsGlobalContext();
|
|
1357
1788
|
const effectiveHeadings = headingsProp;
|
|
1358
1789
|
const effectiveTableOfContents = tableOfContentsProp;
|
|
1359
|
-
return /* @__PURE__ */
|
|
1360
|
-
effectiveTableOfContents ? effectiveHeadings.length > 0 && /* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */
|
|
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: [
|
|
1791
|
+
effectiveTableOfContents ? effectiveHeadings.length > 0 && /* @__PURE__ */ jsxs16(Fragment6, { children: [
|
|
1792
|
+
/* @__PURE__ */ jsxs16("p", { className: "mb-4 flex items-center gap-2 text-xs font-semibold uppercase tracking-widest text-base-muted", children: [
|
|
1793
|
+
/* @__PURE__ */ jsx19(TableOfContentsIcon, { className: "size-3" }),
|
|
1363
1794
|
"On this page"
|
|
1364
1795
|
] }),
|
|
1365
|
-
/* @__PURE__ */
|
|
1796
|
+
/* @__PURE__ */ jsx19("nav", { "aria-label": "On this page", className: "mb-12", children: /* @__PURE__ */ jsx19("ul", { children: effectiveHeadings.map((heading) => /* @__PURE__ */ jsx19("li", { children: /* @__PURE__ */ jsx19(
|
|
1366
1797
|
"a",
|
|
1367
1798
|
{
|
|
1368
1799
|
href: `#${heading.id}`,
|
|
@@ -1377,29 +1808,29 @@ var TableOfContents = ({
|
|
|
1377
1808
|
}
|
|
1378
1809
|
) }, heading.id)) }) })
|
|
1379
1810
|
] }) : null,
|
|
1380
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ jsx19(Adbar, { partners })
|
|
1381
1812
|
] }) }) });
|
|
1382
1813
|
};
|
|
1383
1814
|
var Adbar = ({ partners }) => {
|
|
1384
1815
|
if (partners.primary.length === 0 && partners.gold.length === 0) {
|
|
1385
1816
|
return null;
|
|
1386
1817
|
}
|
|
1387
|
-
return /* @__PURE__ */
|
|
1388
|
-
/* @__PURE__ */
|
|
1389
|
-
/* @__PURE__ */
|
|
1818
|
+
return /* @__PURE__ */ jsxs16("aside", { children: [
|
|
1819
|
+
/* @__PURE__ */ jsxs16("p", { className: "mb-4 flex items-center gap-2 text-xs font-semibold uppercase tracking-widest text-base-muted", children: [
|
|
1820
|
+
/* @__PURE__ */ jsx19(Flame, { className: "size-3" }),
|
|
1390
1821
|
"Partners"
|
|
1391
1822
|
] }),
|
|
1392
|
-
/* @__PURE__ */
|
|
1393
|
-
partners.primary.map((partner) => /* @__PURE__ */
|
|
1394
|
-
partners.gold.map((partner) => /* @__PURE__ */
|
|
1823
|
+
/* @__PURE__ */ jsxs16("ul", { className: "grid grid-cols-[repeat(auto-fit,minmax(5.5rem,1fr))] gap-3 opacity-90", children: [
|
|
1824
|
+
partners.primary.map((partner) => /* @__PURE__ */ jsx19(AdbarItem, { className: "col-span-full", children: /* @__PURE__ */ jsx19(AdbarLink, { href: partner.href, title: partner.name, children: /* @__PURE__ */ jsx19(PartnerLogo, { partner }) }) }, partner.name)),
|
|
1825
|
+
partners.gold.map((partner) => /* @__PURE__ */ jsx19(AdbarItem, { children: /* @__PURE__ */ jsx19(AdbarLink, { href: partner.href, title: partner.name, children: /* @__PURE__ */ jsx19(PartnerLogo, { partner }) }) }, partner.name))
|
|
1395
1826
|
] })
|
|
1396
1827
|
] });
|
|
1397
1828
|
};
|
|
1398
1829
|
var PartnerLogo = ({
|
|
1399
1830
|
partner
|
|
1400
1831
|
}) => {
|
|
1401
|
-
return /* @__PURE__ */
|
|
1402
|
-
/* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsxs16(Fragment6, { children: [
|
|
1833
|
+
/* @__PURE__ */ jsx19(
|
|
1403
1834
|
Image,
|
|
1404
1835
|
{
|
|
1405
1836
|
src: partner.logoLight,
|
|
@@ -1409,7 +1840,7 @@ var PartnerLogo = ({
|
|
|
1409
1840
|
className: cmMerge8("block", partner.logoDark ? "dark:hidden" : "dark:invert")
|
|
1410
1841
|
}
|
|
1411
1842
|
),
|
|
1412
|
-
partner.logoDark ? /* @__PURE__ */
|
|
1843
|
+
partner.logoDark ? /* @__PURE__ */ jsx19(Image, { src: partner.logoDark, width: 200, height: 200, alt: partner.logoAlt, className: "hidden dark:block" }) : null
|
|
1413
1844
|
] });
|
|
1414
1845
|
};
|
|
1415
1846
|
var AdbarItem = cm5.li`
|
|
@@ -1442,13 +1873,13 @@ import { TableOfContents as TableOfContents2 } from "lucide-react";
|
|
|
1442
1873
|
import { useId } from "react";
|
|
1443
1874
|
|
|
1444
1875
|
// src/runtime/client/components/BreadcrumbSidebarTrigger.tsx
|
|
1445
|
-
import { ChevronLast, ChevronsRight } from "lucide-react";
|
|
1446
|
-
import { useCallback as
|
|
1447
|
-
import { jsx as
|
|
1448
|
-
var
|
|
1876
|
+
import { ChevronLast, ChevronsRight as ChevronsRight2 } from "lucide-react";
|
|
1877
|
+
import { useCallback as useCallback5 } from "react";
|
|
1878
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1879
|
+
var dedupeBreadcrumbs2 = (items) => {
|
|
1449
1880
|
return items.filter((item, index) => index === 0 || items[index - 1]?.title !== item.title);
|
|
1450
1881
|
};
|
|
1451
|
-
var
|
|
1882
|
+
var getSidebarBreadcrumbs2 = (items, currentHref) => {
|
|
1452
1883
|
for (const item of items) {
|
|
1453
1884
|
if (item.kind === "page") {
|
|
1454
1885
|
if (item.href === currentHref) {
|
|
@@ -1459,11 +1890,11 @@ var getSidebarBreadcrumbs = (items, currentHref) => {
|
|
|
1459
1890
|
if (item.href === currentHref) {
|
|
1460
1891
|
return item.title ? [{ id: item.id, title: item.title }] : [];
|
|
1461
1892
|
}
|
|
1462
|
-
const nestedBreadcrumbs =
|
|
1893
|
+
const nestedBreadcrumbs = getSidebarBreadcrumbs2(item.items, currentHref);
|
|
1463
1894
|
if (!nestedBreadcrumbs) {
|
|
1464
1895
|
continue;
|
|
1465
1896
|
}
|
|
1466
|
-
return
|
|
1897
|
+
return dedupeBreadcrumbs2(
|
|
1467
1898
|
item.title ? [{ id: item.id, title: item.title }, ...nestedBreadcrumbs] : nestedBreadcrumbs
|
|
1468
1899
|
);
|
|
1469
1900
|
}
|
|
@@ -1472,25 +1903,25 @@ var getSidebarBreadcrumbs = (items, currentHref) => {
|
|
|
1472
1903
|
var BreadcrumbSidebarTrigger = ({ currentHref }) => {
|
|
1473
1904
|
const docs = useDocsGlobalContext();
|
|
1474
1905
|
const activeSection = getActiveSectionByPathname(docs, currentHref);
|
|
1475
|
-
const breadcrumbItems =
|
|
1906
|
+
const breadcrumbItems = dedupeBreadcrumbs2([
|
|
1476
1907
|
...activeSection ? [{ id: activeSection.id, title: activeSection.navTitle }] : [],
|
|
1477
|
-
...activeSection ?
|
|
1908
|
+
...activeSection ? getSidebarBreadcrumbs2(activeSection.items, currentHref) ?? [] : []
|
|
1478
1909
|
]);
|
|
1479
|
-
const handleClick =
|
|
1910
|
+
const handleClick = useCallback5(() => {
|
|
1480
1911
|
alert("TODO: Open mobile menu");
|
|
1481
1912
|
}, []);
|
|
1482
|
-
return /* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
index > 0 ? /* @__PURE__ */
|
|
1486
|
-
/* @__PURE__ */
|
|
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: [
|
|
1914
|
+
/* @__PURE__ */ jsx20(ChevronLast, { className: "size-4 shrink-0 text-primary" }),
|
|
1915
|
+
/* @__PURE__ */ jsx20("span", { className: "flex items-center gap-1", children: breadcrumbItems.map((item, index) => /* @__PURE__ */ jsxs17("span", { className: "contents", children: [
|
|
1916
|
+
index > 0 ? /* @__PURE__ */ jsx20(ChevronsRight2, { className: "size-4 shrink-0 text-base-muted-medium" }) : null,
|
|
1917
|
+
/* @__PURE__ */ jsx20("span", { className: index === 0 ? "font-semibold truncate" : "text-sm truncate", children: renderInlineMarkdown(item.title, { codeClassName: "text-sm!" }) })
|
|
1487
1918
|
] }, item.id)) })
|
|
1488
1919
|
] }) });
|
|
1489
1920
|
};
|
|
1490
1921
|
var BreadcrumbSidebarTrigger_default = BreadcrumbSidebarTrigger;
|
|
1491
1922
|
|
|
1492
1923
|
// src/runtime/client/components/TableOfContentsMobile.tsx
|
|
1493
|
-
import { Fragment as
|
|
1924
|
+
import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1494
1925
|
var TableOfContentsMobile = ({
|
|
1495
1926
|
headings = [],
|
|
1496
1927
|
tableOfContents = false,
|
|
@@ -1503,14 +1934,14 @@ var TableOfContentsMobile = ({
|
|
|
1503
1934
|
const selectId = useId();
|
|
1504
1935
|
const labelId = `${selectId}-label`;
|
|
1505
1936
|
const selectedValue = tableOfContents && headings.some((heading) => heading.id === activeHeadingId) ? activeHeadingId : "";
|
|
1506
|
-
return /* @__PURE__ */
|
|
1507
|
-
/* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
/* @__PURE__ */
|
|
1510
|
-
/* @__PURE__ */
|
|
1511
|
-
/* @__PURE__ */
|
|
1512
|
-
/* @__PURE__ */
|
|
1513
|
-
/* @__PURE__ */
|
|
1937
|
+
return /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
1938
|
+
/* @__PURE__ */ jsx21("div", { className: "h-12 xl:hidden" }),
|
|
1939
|
+
/* @__PURE__ */ jsx21(StyledTOC, { children: /* @__PURE__ */ jsxs18(StyledTOCInner, { children: [
|
|
1940
|
+
/* @__PURE__ */ jsx21("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx21(BreadcrumbSidebarTrigger_default, { currentHref }) }),
|
|
1941
|
+
/* @__PURE__ */ jsxs18("label", { className: "select select-sm md:w-80 w-full", htmlFor: selectId, children: [
|
|
1942
|
+
/* @__PURE__ */ jsx21("span", { id: labelId, className: "sr-only", children: pageTitle }),
|
|
1943
|
+
/* @__PURE__ */ jsx21("span", { className: "label flex", "aria-hidden": "true", children: /* @__PURE__ */ jsx21(TableOfContents2, { className: "size-4" }) }),
|
|
1944
|
+
/* @__PURE__ */ jsxs18(
|
|
1514
1945
|
"select",
|
|
1515
1946
|
{
|
|
1516
1947
|
id: selectId,
|
|
@@ -1528,8 +1959,8 @@ var TableOfContentsMobile = ({
|
|
|
1528
1959
|
window.location.hash = encodeURIComponent(value);
|
|
1529
1960
|
},
|
|
1530
1961
|
children: [
|
|
1531
|
-
/* @__PURE__ */
|
|
1532
|
-
tableOfContents && headings.map((heading) => /* @__PURE__ */
|
|
1962
|
+
/* @__PURE__ */ jsx21("option", { value: topOptionValue, children: pageTitle }),
|
|
1963
|
+
tableOfContents && headings.map((heading) => /* @__PURE__ */ jsx21("option", { value: heading.id, children: heading.title }, heading.id))
|
|
1533
1964
|
]
|
|
1534
1965
|
}
|
|
1535
1966
|
)
|
|
@@ -1699,19 +2130,19 @@ var useTableOfContentsState = ({
|
|
|
1699
2130
|
};
|
|
1700
2131
|
|
|
1701
2132
|
// src/runtime/client/DocsLayout.tsx
|
|
1702
|
-
import { Fragment as
|
|
2133
|
+
import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1703
2134
|
var DocsLayout = ({ children }) => {
|
|
1704
2135
|
const data = useData();
|
|
1705
2136
|
const { activeHeadingId, effectiveHeadings, setActiveHeadingId } = useTableOfContentsState({
|
|
1706
2137
|
headings: data.headings
|
|
1707
2138
|
});
|
|
1708
|
-
return /* @__PURE__ */
|
|
1709
|
-
/* @__PURE__ */
|
|
1710
|
-
/* @__PURE__ */
|
|
1711
|
-
/* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */
|
|
1713
|
-
/* @__PURE__ */
|
|
1714
|
-
/* @__PURE__ */
|
|
2139
|
+
return /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
2140
|
+
/* @__PURE__ */ jsx22(HeadingLinkCopy, {}),
|
|
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" }),
|
|
2142
|
+
/* @__PURE__ */ jsx22(LayoutComponent, { children: /* @__PURE__ */ jsxs19("div", { className: "lg:flex gap-14", children: [
|
|
2143
|
+
/* @__PURE__ */ jsx22(Sidebar, { currentHref: data.page.href, activeSectionId: data.page.sectionId }),
|
|
2144
|
+
/* @__PURE__ */ jsxs19("main", { className: "min-w-0 flex-1 basis-auto shrink", children: [
|
|
2145
|
+
/* @__PURE__ */ jsx22(
|
|
1715
2146
|
TableOfContentsMobile_default,
|
|
1716
2147
|
{
|
|
1717
2148
|
headings: effectiveHeadings,
|
|
@@ -1722,11 +2153,11 @@ var DocsLayout = ({ children }) => {
|
|
|
1722
2153
|
setActiveHeadingId
|
|
1723
2154
|
}
|
|
1724
2155
|
),
|
|
1725
|
-
/* @__PURE__ */
|
|
1726
|
-
/* @__PURE__ */
|
|
1727
|
-
/* @__PURE__ */
|
|
2156
|
+
/* @__PURE__ */ jsx22("div", { className: "mt-10 min-w-0", children }),
|
|
2157
|
+
/* @__PURE__ */ jsx22(DocsPagination, { previousPage: data.previousPage, nextPage: data.nextPage }),
|
|
2158
|
+
/* @__PURE__ */ jsx22(DocsFooter, {})
|
|
1728
2159
|
] }),
|
|
1729
|
-
/* @__PURE__ */
|
|
2160
|
+
/* @__PURE__ */ jsx22(
|
|
1730
2161
|
TableOfContents,
|
|
1731
2162
|
{
|
|
1732
2163
|
headings: effectiveHeadings,
|
|
@@ -1741,57 +2172,12 @@ var DocsLayout = ({ children }) => {
|
|
|
1741
2172
|
|
|
1742
2173
|
// src/runtime/client/DocsPage.tsx
|
|
1743
2174
|
import { useData as useData2 } from "vike-react/useData";
|
|
1744
|
-
|
|
1745
|
-
// src/runtime/client/components/DocsBreadcrumbs.tsx
|
|
1746
|
-
import { ChevronsRight as ChevronsRight2 } from "lucide-react";
|
|
1747
|
-
import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1748
|
-
var dedupeBreadcrumbs2 = (items) => {
|
|
1749
|
-
return items.filter((item, index) => index === 0 || items[index - 1]?.title !== item.title);
|
|
1750
|
-
};
|
|
1751
|
-
var getSidebarBreadcrumbs2 = (items, currentHref) => {
|
|
1752
|
-
for (const item of items) {
|
|
1753
|
-
if (item.kind === "page") {
|
|
1754
|
-
if (item.href === currentHref) {
|
|
1755
|
-
return [{ id: item.id, kind: item.kind, title: item.navTitle }];
|
|
1756
|
-
}
|
|
1757
|
-
continue;
|
|
1758
|
-
}
|
|
1759
|
-
if (item.href === currentHref) {
|
|
1760
|
-
return item.title ? [{ id: item.id, kind: item.kind, title: item.title }] : [];
|
|
1761
|
-
}
|
|
1762
|
-
const nestedBreadcrumbs = getSidebarBreadcrumbs2(item.items, currentHref);
|
|
1763
|
-
if (!nestedBreadcrumbs) {
|
|
1764
|
-
continue;
|
|
1765
|
-
}
|
|
1766
|
-
return dedupeBreadcrumbs2(item.title ? [{ id: item.id, kind: item.kind, title: item.title }] : nestedBreadcrumbs);
|
|
1767
|
-
}
|
|
1768
|
-
return null;
|
|
1769
|
-
};
|
|
1770
|
-
var DocsBreadcrumbs = ({ currentHref }) => {
|
|
1771
|
-
const docs = useDocsGlobalContext();
|
|
1772
|
-
const activeSection = getActiveSectionByPathname(docs, currentHref);
|
|
1773
|
-
const breadcrumbItems = dedupeBreadcrumbs2([
|
|
1774
|
-
...activeSection ? getSidebarBreadcrumbs2(activeSection.items, currentHref) ?? [] : []
|
|
1775
|
-
]);
|
|
1776
|
-
return /* @__PURE__ */ jsx22("span", { className: "hidden lg:flex items-center text-sm gap-1 min-w-0 overflow-hidden mb-3 text-primary", children: breadcrumbItems.map((item, index) => {
|
|
1777
|
-
const Icon = docs.docsIconMap[getDocsIconMapKey(item.kind, item.id)];
|
|
1778
|
-
return /* @__PURE__ */ jsxs19("span", { className: "contents", children: [
|
|
1779
|
-
index > 0 ? /* @__PURE__ */ jsx22(ChevronsRight2, { className: "size-4 shrink-0 text-base-muted-medium" }) : null,
|
|
1780
|
-
/* @__PURE__ */ jsxs19("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
1781
|
-
Icon ? /* @__PURE__ */ jsx22(Icon, { className: "size-3 shrink-0", "aria-hidden": "true" }) : null,
|
|
1782
|
-
/* @__PURE__ */ jsx22("span", { className: "truncate", children: renderInlineMarkdown(item.title, { codeClassName: "text-sm!" }) })
|
|
1783
|
-
] })
|
|
1784
|
-
] }, item.id);
|
|
1785
|
-
}) });
|
|
1786
|
-
};
|
|
1787
|
-
var DocsBreadcrumbs_default = DocsBreadcrumbs;
|
|
1788
|
-
|
|
1789
|
-
// src/runtime/client/DocsPage.tsx
|
|
1790
2175
|
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1791
2176
|
var DocsPage = ({ Content }) => {
|
|
1792
2177
|
const { page } = useData2();
|
|
1793
2178
|
return /* @__PURE__ */ jsxs20(ProseContainer, { "data-doc-content": "", children: [
|
|
1794
|
-
/* @__PURE__ */ jsx23(
|
|
2179
|
+
/* @__PURE__ */ jsx23("div", { className: "mb-2 md:hidden", children: /* @__PURE__ */ jsx23(BreadcrumbSidebarTrigger_default, { currentHref: page.href }) }),
|
|
2180
|
+
/* @__PURE__ */ jsx23("div", { className: "mb-2 hidden md:block", children: /* @__PURE__ */ jsx23(DocsBreadcrumbs_default, { currentHref: page.href }) }),
|
|
1795
2181
|
/* @__PURE__ */ jsx23("h1", { className: "scroll-mt-32 xl:scroll-mt-22", children: renderInlineMarkdown(page.title) }),
|
|
1796
2182
|
/* @__PURE__ */ jsx23(Content, {})
|
|
1797
2183
|
] });
|
|
@@ -1808,4 +2194,4 @@ export {
|
|
|
1808
2194
|
DocsLayout,
|
|
1809
2195
|
DocsPage
|
|
1810
2196
|
};
|
|
1811
|
-
//# sourceMappingURL=chunk-
|
|
2197
|
+
//# sourceMappingURL=chunk-25MNMEXU.js.map
|