@clarify-labs/renderer 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/output/{ClarifyShell-BPv2bxI4.js → ClarifyShell-C38EkErX.js} +397 -250
- package/output/ClarifyShell-C38EkErX.js.map +1 -0
- package/output/{ClarifyShell-B74Fq4UU.cjs → ClarifyShell-DdYRgrfY.cjs} +396 -249
- package/output/ClarifyShell-DdYRgrfY.cjs.map +1 -0
- package/output/{OpenApiOperation-BMXfV15v.cjs → OpenApiOperation-CP_fxT_F.cjs} +344 -219
- package/output/OpenApiOperation-CP_fxT_F.cjs.map +1 -0
- package/output/{OpenApiOperation-fJ3QQOJX.js → OpenApiOperation-DIFaYAe5.js} +344 -219
- package/output/OpenApiOperation-DIFaYAe5.js.map +1 -0
- package/output/{PageActions-DOKkt2zo.cjs → PageActions-B08cDCzq.cjs} +278 -167
- package/output/PageActions-B08cDCzq.cjs.map +1 -0
- package/output/{PageActions-BwY7ierv.js → PageActions-tmnpzi23.js} +279 -168
- package/output/PageActions-tmnpzi23.js.map +1 -0
- package/output/app/SectionProvider.d.ts +1 -0
- package/output/client.cjs +3 -3
- package/output/client.js +3 -3
- package/output/core/types.d.ts +1 -0
- package/output/index.cjs +4 -4
- package/output/index.js +4 -4
- package/output/openapi/components/CodeDisplay.d.ts +25 -0
- package/output/openapi/components/EndpointSections.d.ts +4 -0
- package/output/openapi/components/ExamplePanels.d.ts +8 -17
- package/output/openapi/components/OpenApiOperation.state.d.ts +43 -0
- package/output/openapi/components/SelectControl.d.ts +15 -0
- package/output/openapi/components/helpers.d.ts +22 -0
- package/output/preview.cjs +114 -67
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +114 -67
- package/output/preview.js.map +1 -1
- package/output/{render-Cghgq1AQ.js → render-6gHfrR9h.js} +2 -2
- package/output/{render-Cghgq1AQ.js.map → render-6gHfrR9h.js.map} +1 -1
- package/output/{render-ZSckbg74.cjs → render-Bvf5ZMZb.cjs} +2 -2
- package/output/{render-ZSckbg74.cjs.map → render-Bvf5ZMZb.cjs.map} +1 -1
- package/output/renderer.css +168 -107
- package/output/server.cjs +2 -2
- package/output/server.js +2 -2
- package/output/shell/Header.d.ts +2 -0
- package/package.json +1 -1
- package/output/ClarifyShell-B74Fq4UU.cjs.map +0 -1
- package/output/ClarifyShell-BPv2bxI4.js.map +0 -1
- package/output/OpenApiOperation-BMXfV15v.cjs.map +0 -1
- package/output/OpenApiOperation-fJ3QQOJX.js.map +0 -1
- package/output/PageActions-BwY7ierv.js.map +0 -1
- package/output/PageActions-DOKkt2zo.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import clsx from "clsx";
|
|
2
|
-
import { Fragment, Suspense, createContext, forwardRef, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
2
|
+
import { Fragment, Suspense, createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Link, useLocation, useNavigate } from "react-router-dom";
|
|
4
4
|
import { CloseButton, Dialog, DialogBackdrop, DialogPanel, Menu, MenuButton, MenuItem, MenuItems, TransitionChild } from "@headlessui/react";
|
|
5
5
|
import * as LucideIcons from "lucide-react";
|
|
@@ -765,41 +765,93 @@ function createSectionStore(sections) {
|
|
|
765
765
|
} : section) }))
|
|
766
766
|
}));
|
|
767
767
|
}
|
|
768
|
-
function
|
|
769
|
-
const
|
|
770
|
-
|
|
768
|
+
function getHeaderBlockedTop(innerHeight, headerTopAreaRef) {
|
|
769
|
+
const blockedTop = headerTopAreaRef?.current?.offsetHeight ?? 0;
|
|
770
|
+
return Math.max(0, Math.min(innerHeight, blockedTop));
|
|
771
|
+
}
|
|
772
|
+
function getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef) {
|
|
773
|
+
return scrollY + getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
774
|
+
}
|
|
775
|
+
function getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef) {
|
|
776
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
777
|
+
return scrollY + Math.max(0, innerHeight - blockedTop);
|
|
778
|
+
}
|
|
779
|
+
function computeVisibleSections(sections, scrollY, viewportTop, viewportBottom) {
|
|
780
|
+
const visibleSections = [];
|
|
781
|
+
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
782
|
+
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
783
|
+
if (!headingRef?.current) continue;
|
|
784
|
+
const offset = remToPx(offsetRem);
|
|
785
|
+
const sectionTop = headingRef.current.getBoundingClientRect().top + scrollY - offset;
|
|
786
|
+
if (sectionIndex === 0 && sectionTop > viewportTop) visibleSections.push("_top");
|
|
787
|
+
const nextSection = sections[sectionIndex + 1];
|
|
788
|
+
const nextOffset = remToPx(nextSection?.offsetRem ?? offsetRem);
|
|
789
|
+
if ((nextSection?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY - nextOffset > viewportTop && sectionTop < viewportBottom) visibleSections.push(id);
|
|
790
|
+
}
|
|
791
|
+
return visibleSections;
|
|
792
|
+
}
|
|
793
|
+
function useSectionVisibilityDebug(headerTopAreaRef) {
|
|
794
|
+
const lastDebugSignatureRef = useRef("");
|
|
795
|
+
return (snapshot) => {
|
|
796
|
+
const { scrollY, innerHeight, blockedTop, visibleSections } = snapshot;
|
|
797
|
+
const debugSignature = [
|
|
798
|
+
Math.round(scrollY),
|
|
799
|
+
innerHeight,
|
|
800
|
+
Math.round(blockedTop),
|
|
801
|
+
visibleSections.join(",")
|
|
802
|
+
].join("|");
|
|
803
|
+
if (lastDebugSignatureRef.current === debugSignature) return;
|
|
804
|
+
lastDebugSignatureRef.current = debugSignature;
|
|
805
|
+
console.info("[clarify][section-visibility]", {
|
|
806
|
+
...snapshot,
|
|
807
|
+
topAreaHeight: headerTopAreaRef?.current?.offsetHeight ?? 0
|
|
808
|
+
});
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
function useSectionVisibilityObserver(checkVisibleSections, headerTopAreaRef) {
|
|
771
812
|
useEffect(() => {
|
|
772
|
-
function checkVisibleSections() {
|
|
773
|
-
const { innerHeight, scrollY } = window;
|
|
774
|
-
const viewportTop = scrollY;
|
|
775
|
-
const viewportBottom = scrollY + innerHeight;
|
|
776
|
-
const newVisibleSections = [];
|
|
777
|
-
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
778
|
-
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
779
|
-
if (!headingRef?.current) continue;
|
|
780
|
-
const offset = remToPx(offsetRem);
|
|
781
|
-
const top = headingRef.current.getBoundingClientRect().top + scrollY;
|
|
782
|
-
if (sectionIndex === 0 && top - offset > viewportTop) newVisibleSections.push("_top");
|
|
783
|
-
if ((sections[sectionIndex + 1]?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY > viewportTop && top < viewportBottom) newVisibleSections.push(id);
|
|
784
|
-
}
|
|
785
|
-
setVisibleSections(newVisibleSections);
|
|
786
|
-
}
|
|
787
813
|
const raf = window.requestAnimationFrame(() => checkVisibleSections());
|
|
788
814
|
window.addEventListener("scroll", checkVisibleSections, { passive: true });
|
|
789
815
|
window.addEventListener("resize", checkVisibleSections);
|
|
816
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(() => {
|
|
817
|
+
checkVisibleSections();
|
|
818
|
+
});
|
|
819
|
+
if (resizeObserver && headerTopAreaRef?.current) resizeObserver.observe(headerTopAreaRef.current);
|
|
790
820
|
return () => {
|
|
791
821
|
window.cancelAnimationFrame(raf);
|
|
792
822
|
window.removeEventListener("scroll", checkVisibleSections);
|
|
793
823
|
window.removeEventListener("resize", checkVisibleSections);
|
|
824
|
+
resizeObserver?.disconnect();
|
|
794
825
|
};
|
|
795
|
-
}, [
|
|
826
|
+
}, [checkVisibleSections, headerTopAreaRef]);
|
|
796
827
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
const
|
|
801
|
-
|
|
802
|
-
|
|
828
|
+
function useVisibleSections(sectionStore, headerTopAreaRef) {
|
|
829
|
+
const setVisibleSections = useStore(sectionStore, (state) => state.setVisibleSections);
|
|
830
|
+
const sections = useStore(sectionStore, (state) => state.sections);
|
|
831
|
+
const emitVisibilityDebug = useSectionVisibilityDebug(headerTopAreaRef);
|
|
832
|
+
useSectionVisibilityObserver(useCallback(() => {
|
|
833
|
+
const { innerHeight, scrollY } = window;
|
|
834
|
+
const viewportTop = getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef);
|
|
835
|
+
const viewportBottom = getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef);
|
|
836
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
837
|
+
const newVisibleSections = computeVisibleSections(sections, scrollY, viewportTop, viewportBottom);
|
|
838
|
+
emitVisibilityDebug({
|
|
839
|
+
scrollY,
|
|
840
|
+
innerHeight,
|
|
841
|
+
blockedTop,
|
|
842
|
+
viewportTop,
|
|
843
|
+
viewportBottom,
|
|
844
|
+
visibleSections: newVisibleSections
|
|
845
|
+
});
|
|
846
|
+
setVisibleSections(newVisibleSections);
|
|
847
|
+
}, [
|
|
848
|
+
emitVisibilityDebug,
|
|
849
|
+
headerTopAreaRef,
|
|
850
|
+
sections,
|
|
851
|
+
setVisibleSections
|
|
852
|
+
]), headerTopAreaRef);
|
|
853
|
+
}
|
|
854
|
+
function useSyncSections(sectionStore, sections) {
|
|
803
855
|
useIsomorphicLayoutEffect(() => {
|
|
804
856
|
sectionStore.setState((state) => ({
|
|
805
857
|
sections: sections.map((section) => {
|
|
@@ -813,6 +865,14 @@ function SectionProvider(arg0) {
|
|
|
813
865
|
visibleSections: []
|
|
814
866
|
}));
|
|
815
867
|
}, [sectionStore, sections]);
|
|
868
|
+
}
|
|
869
|
+
var SectionStoreContext = createContext(null);
|
|
870
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
871
|
+
function SectionProvider(arg0) {
|
|
872
|
+
const { sections, headerTopAreaRef, children } = arg0;
|
|
873
|
+
const [sectionStore] = useState(() => createSectionStore(sections));
|
|
874
|
+
useVisibleSections(sectionStore, headerTopAreaRef);
|
|
875
|
+
useSyncSections(sectionStore, sections);
|
|
816
876
|
return /* @__PURE__ */ jsx(SectionStoreContext.Provider, {
|
|
817
877
|
value: sectionStore,
|
|
818
878
|
children
|
|
@@ -1189,6 +1249,7 @@ function routeGroupTitles(navigation) {
|
|
|
1189
1249
|
function buildSearchItems(routes, navigation) {
|
|
1190
1250
|
const groupTitles = routeGroupTitles(navigation);
|
|
1191
1251
|
return routes.flatMap((route) => {
|
|
1252
|
+
if (route.isBareAlias) return [];
|
|
1192
1253
|
const groupTitle = groupTitles.get(route.path);
|
|
1193
1254
|
return [{
|
|
1194
1255
|
title: route.title,
|
|
@@ -1375,17 +1436,33 @@ function SearchResult(arg0) {
|
|
|
1375
1436
|
}
|
|
1376
1437
|
//#endregion
|
|
1377
1438
|
//#region source/shell/search/SearchDialog.tsx
|
|
1378
|
-
function
|
|
1379
|
-
const { open, setOpen
|
|
1380
|
-
const t = useBuiltInText();
|
|
1381
|
-
const navigate = useNavigate();
|
|
1439
|
+
function useSearchDialogLifecycle(arg0) {
|
|
1440
|
+
const { open, setOpen } = arg0;
|
|
1382
1441
|
const location = useLocation();
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1442
|
+
useEffect(() => {
|
|
1443
|
+
setOpen(false);
|
|
1444
|
+
}, [
|
|
1445
|
+
location.pathname,
|
|
1446
|
+
location.search,
|
|
1447
|
+
location.hash,
|
|
1448
|
+
setOpen
|
|
1449
|
+
]);
|
|
1450
|
+
useEffect(() => {
|
|
1451
|
+
if (open) return void 0;
|
|
1452
|
+
function onKeyDown(event) {
|
|
1453
|
+
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
1454
|
+
event.preventDefault();
|
|
1455
|
+
setOpen(true);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1459
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1460
|
+
}, [open, setOpen]);
|
|
1461
|
+
}
|
|
1462
|
+
function useSearchData(arg0) {
|
|
1463
|
+
const { query, searchItems, routePrefix, currentLocale } = arg0;
|
|
1386
1464
|
const [fullTextState, setFullTextState] = useState(null);
|
|
1387
1465
|
const [pagefindState, setPagefindState] = useState(null);
|
|
1388
|
-
const searchItems = useMemo(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1389
1466
|
const quickResults = useMemo(() => {
|
|
1390
1467
|
const normalizedQuery = query.trim().toLowerCase();
|
|
1391
1468
|
if (!normalizedQuery) return [];
|
|
@@ -1402,15 +1479,7 @@ function SearchDialog(arg0) {
|
|
|
1402
1479
|
const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
|
|
1403
1480
|
const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
|
|
1404
1481
|
const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey);
|
|
1405
|
-
const showNoResults = query && results.length === 0 && pagefindAvailable !== null;
|
|
1406
|
-
useEffect(() => {
|
|
1407
|
-
setOpen(false);
|
|
1408
|
-
}, [
|
|
1409
|
-
location.pathname,
|
|
1410
|
-
location.search,
|
|
1411
|
-
location.hash,
|
|
1412
|
-
setOpen
|
|
1413
|
-
]);
|
|
1482
|
+
const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null;
|
|
1414
1483
|
useEffect(() => {
|
|
1415
1484
|
let cancelled = false;
|
|
1416
1485
|
loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
|
|
@@ -1473,17 +1542,30 @@ function SearchDialog(arg0) {
|
|
|
1473
1542
|
routePrefix,
|
|
1474
1543
|
trimmedQuery
|
|
1475
1544
|
]);
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1545
|
+
return {
|
|
1546
|
+
results,
|
|
1547
|
+
searchInputLoading,
|
|
1548
|
+
showNoResults
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
function SearchDialog(arg0) {
|
|
1552
|
+
const { open, setOpen, routes, navigation, routePrefix = "/", currentLocale, className, onNavigate = () => {} } = arg0;
|
|
1553
|
+
const t = useBuiltInText();
|
|
1554
|
+
const navigate = useNavigate();
|
|
1555
|
+
const inputRef = useRef(null);
|
|
1556
|
+
const [query, setQuery] = useState("");
|
|
1557
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
1558
|
+
const searchItems = useMemo(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1559
|
+
useSearchDialogLifecycle({
|
|
1560
|
+
open,
|
|
1561
|
+
setOpen
|
|
1562
|
+
});
|
|
1563
|
+
const { results, searchInputLoading, showNoResults } = useSearchData({
|
|
1564
|
+
query,
|
|
1565
|
+
searchItems,
|
|
1566
|
+
routePrefix,
|
|
1567
|
+
currentLocale
|
|
1568
|
+
});
|
|
1487
1569
|
const updateQuery = (value) => {
|
|
1488
1570
|
setQuery(value);
|
|
1489
1571
|
setActiveIndex(0);
|
|
@@ -1498,6 +1580,29 @@ function SearchDialog(arg0) {
|
|
|
1498
1580
|
onNavigate();
|
|
1499
1581
|
closeDialog();
|
|
1500
1582
|
}
|
|
1583
|
+
function renderResultsPanel() {
|
|
1584
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1585
|
+
className: "border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5",
|
|
1586
|
+
children: [showNoResults ? /* @__PURE__ */ jsxs("div", {
|
|
1587
|
+
className: "p-6 text-center",
|
|
1588
|
+
children: [/* @__PURE__ */ jsx(SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ jsx("p", {
|
|
1589
|
+
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1590
|
+
children: t("search.noResults", { query })
|
|
1591
|
+
})]
|
|
1592
|
+
}) : null, results.length ? /* @__PURE__ */ jsx("ul", {
|
|
1593
|
+
id: "clarify-search-results",
|
|
1594
|
+
className: "clarify-search-results",
|
|
1595
|
+
role: "listbox",
|
|
1596
|
+
children: results.map((result, resultIndex) => /* @__PURE__ */ jsx(SearchResult, {
|
|
1597
|
+
result,
|
|
1598
|
+
query,
|
|
1599
|
+
active: resultIndex === activeIndex,
|
|
1600
|
+
onActive: () => setActiveIndex(resultIndex),
|
|
1601
|
+
onSelect: () => selectResult(result)
|
|
1602
|
+
}, result.type === "full-text" ? result.id : result.url))
|
|
1603
|
+
}) : null]
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1501
1606
|
return /* @__PURE__ */ jsxs(Dialog, {
|
|
1502
1607
|
open,
|
|
1503
1608
|
onClose: closeDialog,
|
|
@@ -1527,27 +1632,7 @@ function SearchDialog(arg0) {
|
|
|
1527
1632
|
onClose: closeDialog,
|
|
1528
1633
|
onSubmit: () => selectResult(),
|
|
1529
1634
|
loading: searchInputLoading
|
|
1530
|
-
}),
|
|
1531
|
-
className: "border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5",
|
|
1532
|
-
children: [showNoResults ? /* @__PURE__ */ jsxs("div", {
|
|
1533
|
-
className: "p-6 text-center",
|
|
1534
|
-
children: [/* @__PURE__ */ jsx(SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ jsx("p", {
|
|
1535
|
-
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1536
|
-
children: t("search.noResults", { query })
|
|
1537
|
-
})]
|
|
1538
|
-
}) : null, results.length ? /* @__PURE__ */ jsx("ul", {
|
|
1539
|
-
id: "clarify-search-results",
|
|
1540
|
-
className: "clarify-search-results",
|
|
1541
|
-
role: "listbox",
|
|
1542
|
-
children: results.map((result, resultIndex) => /* @__PURE__ */ jsx(SearchResult, {
|
|
1543
|
-
result,
|
|
1544
|
-
query,
|
|
1545
|
-
active: resultIndex === activeIndex,
|
|
1546
|
-
onActive: () => setActiveIndex(resultIndex),
|
|
1547
|
-
onSelect: () => selectResult(result)
|
|
1548
|
-
}, result.type === "full-text" ? result.id : result.url))
|
|
1549
|
-
}) : null]
|
|
1550
|
-
})]
|
|
1635
|
+
}), renderResultsPanel()]
|
|
1551
1636
|
})
|
|
1552
1637
|
})]
|
|
1553
1638
|
});
|
|
@@ -1790,6 +1875,7 @@ function ProductTabs(arg0) {
|
|
|
1790
1875
|
const pathname = normalizeRoutePath(useLocation().pathname);
|
|
1791
1876
|
if (!tabs?.length) return null;
|
|
1792
1877
|
return /* @__PURE__ */ jsx("div", {
|
|
1878
|
+
"data-clarify-header-tabs": true,
|
|
1793
1879
|
className: "clarify-product-tabs hidden h-14 border-t border-(--clarify-theme-tokens-colors-border) lg:block dark:border-white/10",
|
|
1794
1880
|
children: /* @__PURE__ */ jsx("nav", {
|
|
1795
1881
|
className: "clarify-product-tabs-nav mx-auto flex h-full w-full max-w-(--clarify-theme-layout-max-width) items-stretch gap-6 overflow-x-auto px-5",
|
|
@@ -1822,7 +1908,7 @@ function ProductTabs(arg0) {
|
|
|
1822
1908
|
});
|
|
1823
1909
|
}
|
|
1824
1910
|
var Header = forwardRef(function Header(arg0, ref) {
|
|
1825
|
-
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
|
|
1911
|
+
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, topAreaRef, className, ...props } = arg0;
|
|
1826
1912
|
const t = useBuiltInText();
|
|
1827
1913
|
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1828
1914
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
@@ -1831,7 +1917,121 @@ var Header = forwardRef(function Header(arg0, ref) {
|
|
|
1831
1917
|
const { scrollY } = useScroll();
|
|
1832
1918
|
const bgOpacityLight = useTransform(scrollY, [0, 72], ["70%", "95%"]);
|
|
1833
1919
|
const bgOpacityDark = useTransform(scrollY, [0, 72], ["60%", "92%"]);
|
|
1834
|
-
|
|
1920
|
+
const hasNavbarLinks = Boolean(config.navbar?.links?.length);
|
|
1921
|
+
function renderBrand() {
|
|
1922
|
+
if (homeExternal) return /* @__PURE__ */ jsxs(CloseButton, {
|
|
1923
|
+
as: "a",
|
|
1924
|
+
href: homeHref,
|
|
1925
|
+
"aria-label": t("navbar.home"),
|
|
1926
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1927
|
+
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1928
|
+
logo: config.logo,
|
|
1929
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1930
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1931
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1932
|
+
children: config.title
|
|
1933
|
+
})]
|
|
1934
|
+
});
|
|
1935
|
+
return /* @__PURE__ */ jsxs(CloseButton, {
|
|
1936
|
+
as: Link,
|
|
1937
|
+
to: homeHref,
|
|
1938
|
+
"aria-label": t("navbar.home"),
|
|
1939
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1940
|
+
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1941
|
+
logo: config.logo,
|
|
1942
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1943
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1944
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1945
|
+
children: config.title
|
|
1946
|
+
})]
|
|
1947
|
+
});
|
|
1948
|
+
}
|
|
1949
|
+
function renderTopLinks() {
|
|
1950
|
+
if (!hasNavbarLinks) return null;
|
|
1951
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
1952
|
+
className: "clarify-top-nav hidden md:block",
|
|
1953
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
1954
|
+
role: "list",
|
|
1955
|
+
className: "flex items-center gap-8",
|
|
1956
|
+
children: config.navbar?.links?.map((link) => /* @__PURE__ */ jsx(TopLevelNavItem, {
|
|
1957
|
+
href: localizeHref(link.href, config, currentLocale),
|
|
1958
|
+
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1959
|
+
}, link.href))
|
|
1960
|
+
})
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
function renderHeaderActions() {
|
|
1964
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1965
|
+
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1966
|
+
children: [
|
|
1967
|
+
renderTopLinks(),
|
|
1968
|
+
hasNavbarLinks ? /* @__PURE__ */ jsx("div", { className: "hidden md:block md:h-5 md:w-px md:bg-(--clarify-theme-tokens-colors-border) md:dark:bg-white/15" }) : null,
|
|
1969
|
+
/* @__PURE__ */ jsx(MobileSearch, {
|
|
1970
|
+
routes,
|
|
1971
|
+
navigation,
|
|
1972
|
+
routePrefix: config.routePrefix,
|
|
1973
|
+
currentLocale
|
|
1974
|
+
}),
|
|
1975
|
+
/* @__PURE__ */ jsx(LanguageSwitcher, {
|
|
1976
|
+
config,
|
|
1977
|
+
currentLocale,
|
|
1978
|
+
currentRoute
|
|
1979
|
+
}),
|
|
1980
|
+
/* @__PURE__ */ jsx(ThemeToggle, {}),
|
|
1981
|
+
/* @__PURE__ */ jsx(MobileNavbarMenu, {
|
|
1982
|
+
links: config.navbar?.links,
|
|
1983
|
+
config,
|
|
1984
|
+
currentLocale
|
|
1985
|
+
})
|
|
1986
|
+
]
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
function renderHeaderMain() {
|
|
1990
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1991
|
+
"data-clarify-header-main": true,
|
|
1992
|
+
className: clsx("clarify-header-main relative mx-auto flex h-14 w-full max-w-(--clarify-theme-layout-max-width) items-center justify-between gap-6 px-4 sm:px-6 lg:px-5", (isInsideMobileNavigation || !mobileNavIsOpen) && "shadow-none"),
|
|
1993
|
+
children: [
|
|
1994
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1995
|
+
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1996
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1997
|
+
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
1998
|
+
children: /* @__PURE__ */ jsx(MobileNavigation, {
|
|
1999
|
+
config,
|
|
2000
|
+
navigation,
|
|
2001
|
+
tabs,
|
|
2002
|
+
routes,
|
|
2003
|
+
currentLocale,
|
|
2004
|
+
currentRoute
|
|
2005
|
+
})
|
|
2006
|
+
}), renderBrand()]
|
|
2007
|
+
}),
|
|
2008
|
+
/* @__PURE__ */ jsx("div", {
|
|
2009
|
+
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
2010
|
+
children: /* @__PURE__ */ jsx(Search$1, {
|
|
2011
|
+
routes,
|
|
2012
|
+
navigation,
|
|
2013
|
+
routePrefix: config.routePrefix,
|
|
2014
|
+
currentLocale
|
|
2015
|
+
})
|
|
2016
|
+
}),
|
|
2017
|
+
renderHeaderActions()
|
|
2018
|
+
]
|
|
2019
|
+
});
|
|
2020
|
+
}
|
|
2021
|
+
function renderTopArea() {
|
|
2022
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2023
|
+
ref: topAreaRef,
|
|
2024
|
+
children: [
|
|
2025
|
+
renderHeaderMain(),
|
|
2026
|
+
/* @__PURE__ */ jsx("div", {
|
|
2027
|
+
"data-clarify-header-banner": true,
|
|
2028
|
+
children: banner
|
|
2029
|
+
}),
|
|
2030
|
+
/* @__PURE__ */ jsx(ProductTabs, { tabs })
|
|
2031
|
+
]
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
return /* @__PURE__ */ jsx(motion.header, {
|
|
1835
2035
|
...props,
|
|
1836
2036
|
ref,
|
|
1837
2037
|
"data-pagefind-ignore": true,
|
|
@@ -1840,96 +2040,7 @@ var Header = forwardRef(function Header(arg0, ref) {
|
|
|
1840
2040
|
"--bg-opacity-light": bgOpacityLight,
|
|
1841
2041
|
"--bg-opacity-dark": bgOpacityDark
|
|
1842
2042
|
},
|
|
1843
|
-
children:
|
|
1844
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1845
|
-
className: clsx("clarify-header-main relative mx-auto flex h-14 w-full max-w-(--clarify-theme-layout-max-width) items-center justify-between gap-6 px-4 sm:px-6 lg:px-5", (isInsideMobileNavigation || !mobileNavIsOpen) && "shadow-none"),
|
|
1846
|
-
children: [
|
|
1847
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1848
|
-
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1849
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1850
|
-
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
1851
|
-
children: /* @__PURE__ */ jsx(MobileNavigation, {
|
|
1852
|
-
config,
|
|
1853
|
-
navigation,
|
|
1854
|
-
tabs,
|
|
1855
|
-
routes,
|
|
1856
|
-
currentLocale,
|
|
1857
|
-
currentRoute
|
|
1858
|
-
})
|
|
1859
|
-
}), homeExternal ? /* @__PURE__ */ jsxs(CloseButton, {
|
|
1860
|
-
as: "a",
|
|
1861
|
-
href: homeHref,
|
|
1862
|
-
"aria-label": t("navbar.home"),
|
|
1863
|
-
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1864
|
-
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1865
|
-
logo: config.logo,
|
|
1866
|
-
className: "h-6 w-auto shrink-0 object-contain"
|
|
1867
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1868
|
-
className: "clarify-brand-title truncate font-semibold",
|
|
1869
|
-
children: config.title
|
|
1870
|
-
})]
|
|
1871
|
-
}) : /* @__PURE__ */ jsxs(CloseButton, {
|
|
1872
|
-
as: Link,
|
|
1873
|
-
to: homeHref,
|
|
1874
|
-
"aria-label": t("navbar.home"),
|
|
1875
|
-
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1876
|
-
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1877
|
-
logo: config.logo,
|
|
1878
|
-
className: "h-6 w-auto shrink-0 object-contain"
|
|
1879
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1880
|
-
className: "clarify-brand-title truncate font-semibold",
|
|
1881
|
-
children: config.title
|
|
1882
|
-
})]
|
|
1883
|
-
})]
|
|
1884
|
-
}),
|
|
1885
|
-
/* @__PURE__ */ jsx("div", {
|
|
1886
|
-
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
1887
|
-
children: /* @__PURE__ */ jsx(Search$1, {
|
|
1888
|
-
routes,
|
|
1889
|
-
navigation,
|
|
1890
|
-
routePrefix: config.routePrefix,
|
|
1891
|
-
currentLocale
|
|
1892
|
-
})
|
|
1893
|
-
}),
|
|
1894
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1895
|
-
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1896
|
-
children: [
|
|
1897
|
-
config.navbar?.links?.length ? /* @__PURE__ */ jsx("nav", {
|
|
1898
|
-
className: "clarify-top-nav hidden md:block",
|
|
1899
|
-
children: /* @__PURE__ */ jsx("ul", {
|
|
1900
|
-
role: "list",
|
|
1901
|
-
className: "flex items-center gap-8",
|
|
1902
|
-
children: config.navbar.links.map((link) => /* @__PURE__ */ jsx(TopLevelNavItem, {
|
|
1903
|
-
href: localizeHref(link.href, config, currentLocale),
|
|
1904
|
-
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1905
|
-
}, link.href))
|
|
1906
|
-
})
|
|
1907
|
-
}) : null,
|
|
1908
|
-
config.navbar?.links?.length ? /* @__PURE__ */ jsx("div", { className: "hidden md:block md:h-5 md:w-px md:bg-(--clarify-theme-tokens-colors-border) md:dark:bg-white/15" }) : null,
|
|
1909
|
-
/* @__PURE__ */ jsx(MobileSearch, {
|
|
1910
|
-
routes,
|
|
1911
|
-
navigation,
|
|
1912
|
-
routePrefix: config.routePrefix,
|
|
1913
|
-
currentLocale
|
|
1914
|
-
}),
|
|
1915
|
-
/* @__PURE__ */ jsx(LanguageSwitcher, {
|
|
1916
|
-
config,
|
|
1917
|
-
currentLocale,
|
|
1918
|
-
currentRoute
|
|
1919
|
-
}),
|
|
1920
|
-
/* @__PURE__ */ jsx(ThemeToggle, {}),
|
|
1921
|
-
/* @__PURE__ */ jsx(MobileNavbarMenu, {
|
|
1922
|
-
links: config.navbar?.links,
|
|
1923
|
-
config,
|
|
1924
|
-
currentLocale
|
|
1925
|
-
})
|
|
1926
|
-
]
|
|
1927
|
-
})
|
|
1928
|
-
]
|
|
1929
|
-
}),
|
|
1930
|
-
banner,
|
|
1931
|
-
/* @__PURE__ */ jsx(ProductTabs, { tabs })
|
|
1932
|
-
]
|
|
2043
|
+
children: renderTopArea()
|
|
1933
2044
|
});
|
|
1934
2045
|
});
|
|
1935
2046
|
//#endregion
|
|
@@ -1955,4 +2066,4 @@ function PageTitleActions() {
|
|
|
1955
2066
|
//#endregion
|
|
1956
2067
|
export { LocaleContext as A, themeCookieName as C, copyTextToClipboard as D, prefixHref as E, useConfig as M, useLocale as N, useBuiltInText as O, useOpenApis as P, storeThemePreference as S, localizeHref as T, getStoredLocalePreference as _, safeDecodeURIComponent as a, readLocaleCookie as b, remToPx as c, isSameRoutePath as d, normalizeRoutePath as f, useTheme as g, ThemeProvider as h, Navigation as i, OpenApisContext as j, ConfigContext as k, lucideIconRegistry as l, ThemeToggle as m, PageTitleActions as n, SectionProvider as o, resolveLocalizedText as p, Header as r, useSectionStore as s, PageActionsProvider as t, resolveLucideIconName as u, getStoredThemePreference as v, isExternalHref as w, storeLocalePreference as x, localeCookieName as y };
|
|
1957
2068
|
|
|
1958
|
-
//# sourceMappingURL=PageActions-
|
|
2069
|
+
//# sourceMappingURL=PageActions-tmnpzi23.js.map
|