@clarify-labs/renderer 0.9.1 → 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-291_IXxJ.js → ClarifyShell-C38EkErX.js} +199 -159
- package/output/ClarifyShell-C38EkErX.js.map +1 -0
- package/output/{ClarifyShell-DJ4fOVOd.cjs → ClarifyShell-DdYRgrfY.cjs} +199 -159
- package/output/ClarifyShell-DdYRgrfY.cjs.map +1 -0
- package/output/{OpenApiOperation-3DUVruIO.cjs → OpenApiOperation-CP_fxT_F.cjs} +343 -218
- package/output/OpenApiOperation-CP_fxT_F.cjs.map +1 -0
- package/output/{OpenApiOperation-E8lSLsSK.js → OpenApiOperation-DIFaYAe5.js} +343 -218
- package/output/OpenApiOperation-DIFaYAe5.js.map +1 -0
- package/output/{PageActions-GI1t-JrR.cjs → PageActions-B08cDCzq.cjs} +276 -173
- package/output/PageActions-B08cDCzq.cjs.map +1 -0
- package/output/{PageActions-DaXQgMYP.js → PageActions-tmnpzi23.js} +277 -174
- package/output/PageActions-tmnpzi23.js.map +1 -0
- package/output/app/SectionProvider.d.ts +1 -1
- 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-yBo2SUlA.js → render-6gHfrR9h.js} +2 -2
- package/output/{render-yBo2SUlA.js.map → render-6gHfrR9h.js.map} +1 -1
- package/output/{render-r9DclX3Y.cjs → render-Bvf5ZMZb.cjs} +2 -2
- package/output/{render-r9DclX3Y.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-291_IXxJ.js.map +0 -1
- package/output/ClarifyShell-DJ4fOVOd.cjs.map +0 -1
- package/output/OpenApiOperation-3DUVruIO.cjs.map +0 -1
- package/output/OpenApiOperation-E8lSLsSK.js.map +0 -1
- package/output/PageActions-DaXQgMYP.js.map +0 -1
- package/output/PageActions-GI1t-JrR.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,49 +765,93 @@ function createSectionStore(sections) {
|
|
|
765
765
|
} : section) }))
|
|
766
766
|
}));
|
|
767
767
|
}
|
|
768
|
-
function
|
|
769
|
-
const
|
|
770
|
-
return
|
|
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
|
+
};
|
|
771
810
|
}
|
|
772
|
-
function
|
|
773
|
-
const setVisibleSections = useStore(sectionStore, (state) => state.setVisibleSections);
|
|
774
|
-
const sections = useStore(sectionStore, (state) => state.sections);
|
|
811
|
+
function useSectionVisibilityObserver(checkVisibleSections, headerTopAreaRef) {
|
|
775
812
|
useEffect(() => {
|
|
776
|
-
function checkVisibleSections() {
|
|
777
|
-
const { innerHeight, scrollY } = window;
|
|
778
|
-
const viewportTop = getVisibleViewportTop(scrollY, headerRef);
|
|
779
|
-
const viewportBottom = scrollY + innerHeight;
|
|
780
|
-
const newVisibleSections = [];
|
|
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 top = headingRef.current.getBoundingClientRect().top + scrollY;
|
|
786
|
-
if (sectionIndex === 0 && top - offset > viewportTop) newVisibleSections.push("_top");
|
|
787
|
-
if ((sections[sectionIndex + 1]?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY > viewportTop && top < viewportBottom) newVisibleSections.push(id);
|
|
788
|
-
}
|
|
789
|
-
setVisibleSections(newVisibleSections);
|
|
790
|
-
}
|
|
791
813
|
const raf = window.requestAnimationFrame(() => checkVisibleSections());
|
|
792
814
|
window.addEventListener("scroll", checkVisibleSections, { passive: true });
|
|
793
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);
|
|
794
820
|
return () => {
|
|
795
821
|
window.cancelAnimationFrame(raf);
|
|
796
822
|
window.removeEventListener("scroll", checkVisibleSections);
|
|
797
823
|
window.removeEventListener("resize", checkVisibleSections);
|
|
824
|
+
resizeObserver?.disconnect();
|
|
798
825
|
};
|
|
826
|
+
}, [checkVisibleSections, headerTopAreaRef]);
|
|
827
|
+
}
|
|
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);
|
|
799
847
|
}, [
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
sections
|
|
803
|
-
|
|
848
|
+
emitVisibilityDebug,
|
|
849
|
+
headerTopAreaRef,
|
|
850
|
+
sections,
|
|
851
|
+
setVisibleSections
|
|
852
|
+
]), headerTopAreaRef);
|
|
804
853
|
}
|
|
805
|
-
|
|
806
|
-
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
807
|
-
function SectionProvider(arg0) {
|
|
808
|
-
const { sections, headerRef, children } = arg0;
|
|
809
|
-
const [sectionStore] = useState(() => createSectionStore(sections));
|
|
810
|
-
useVisibleSections(sectionStore, headerRef);
|
|
854
|
+
function useSyncSections(sectionStore, sections) {
|
|
811
855
|
useIsomorphicLayoutEffect(() => {
|
|
812
856
|
sectionStore.setState((state) => ({
|
|
813
857
|
sections: sections.map((section) => {
|
|
@@ -821,6 +865,14 @@ function SectionProvider(arg0) {
|
|
|
821
865
|
visibleSections: []
|
|
822
866
|
}));
|
|
823
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);
|
|
824
876
|
return /* @__PURE__ */ jsx(SectionStoreContext.Provider, {
|
|
825
877
|
value: sectionStore,
|
|
826
878
|
children
|
|
@@ -1197,6 +1249,7 @@ function routeGroupTitles(navigation) {
|
|
|
1197
1249
|
function buildSearchItems(routes, navigation) {
|
|
1198
1250
|
const groupTitles = routeGroupTitles(navigation);
|
|
1199
1251
|
return routes.flatMap((route) => {
|
|
1252
|
+
if (route.isBareAlias) return [];
|
|
1200
1253
|
const groupTitle = groupTitles.get(route.path);
|
|
1201
1254
|
return [{
|
|
1202
1255
|
title: route.title,
|
|
@@ -1383,17 +1436,33 @@ function SearchResult(arg0) {
|
|
|
1383
1436
|
}
|
|
1384
1437
|
//#endregion
|
|
1385
1438
|
//#region source/shell/search/SearchDialog.tsx
|
|
1386
|
-
function
|
|
1387
|
-
const { open, setOpen
|
|
1388
|
-
const t = useBuiltInText();
|
|
1389
|
-
const navigate = useNavigate();
|
|
1439
|
+
function useSearchDialogLifecycle(arg0) {
|
|
1440
|
+
const { open, setOpen } = arg0;
|
|
1390
1441
|
const location = useLocation();
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
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;
|
|
1394
1464
|
const [fullTextState, setFullTextState] = useState(null);
|
|
1395
1465
|
const [pagefindState, setPagefindState] = useState(null);
|
|
1396
|
-
const searchItems = useMemo(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1397
1466
|
const quickResults = useMemo(() => {
|
|
1398
1467
|
const normalizedQuery = query.trim().toLowerCase();
|
|
1399
1468
|
if (!normalizedQuery) return [];
|
|
@@ -1410,15 +1479,7 @@ function SearchDialog(arg0) {
|
|
|
1410
1479
|
const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
|
|
1411
1480
|
const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
|
|
1412
1481
|
const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey);
|
|
1413
|
-
const showNoResults = query && results.length === 0 && pagefindAvailable !== null;
|
|
1414
|
-
useEffect(() => {
|
|
1415
|
-
setOpen(false);
|
|
1416
|
-
}, [
|
|
1417
|
-
location.pathname,
|
|
1418
|
-
location.search,
|
|
1419
|
-
location.hash,
|
|
1420
|
-
setOpen
|
|
1421
|
-
]);
|
|
1482
|
+
const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null;
|
|
1422
1483
|
useEffect(() => {
|
|
1423
1484
|
let cancelled = false;
|
|
1424
1485
|
loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
|
|
@@ -1481,17 +1542,30 @@ function SearchDialog(arg0) {
|
|
|
1481
1542
|
routePrefix,
|
|
1482
1543
|
trimmedQuery
|
|
1483
1544
|
]);
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
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
|
+
});
|
|
1495
1569
|
const updateQuery = (value) => {
|
|
1496
1570
|
setQuery(value);
|
|
1497
1571
|
setActiveIndex(0);
|
|
@@ -1506,6 +1580,29 @@ function SearchDialog(arg0) {
|
|
|
1506
1580
|
onNavigate();
|
|
1507
1581
|
closeDialog();
|
|
1508
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
|
+
}
|
|
1509
1606
|
return /* @__PURE__ */ jsxs(Dialog, {
|
|
1510
1607
|
open,
|
|
1511
1608
|
onClose: closeDialog,
|
|
@@ -1535,27 +1632,7 @@ function SearchDialog(arg0) {
|
|
|
1535
1632
|
onClose: closeDialog,
|
|
1536
1633
|
onSubmit: () => selectResult(),
|
|
1537
1634
|
loading: searchInputLoading
|
|
1538
|
-
}),
|
|
1539
|
-
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",
|
|
1540
|
-
children: [showNoResults ? /* @__PURE__ */ jsxs("div", {
|
|
1541
|
-
className: "p-6 text-center",
|
|
1542
|
-
children: [/* @__PURE__ */ jsx(SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ jsx("p", {
|
|
1543
|
-
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1544
|
-
children: t("search.noResults", { query })
|
|
1545
|
-
})]
|
|
1546
|
-
}) : null, results.length ? /* @__PURE__ */ jsx("ul", {
|
|
1547
|
-
id: "clarify-search-results",
|
|
1548
|
-
className: "clarify-search-results",
|
|
1549
|
-
role: "listbox",
|
|
1550
|
-
children: results.map((result, resultIndex) => /* @__PURE__ */ jsx(SearchResult, {
|
|
1551
|
-
result,
|
|
1552
|
-
query,
|
|
1553
|
-
active: resultIndex === activeIndex,
|
|
1554
|
-
onActive: () => setActiveIndex(resultIndex),
|
|
1555
|
-
onSelect: () => selectResult(result)
|
|
1556
|
-
}, result.type === "full-text" ? result.id : result.url))
|
|
1557
|
-
}) : null]
|
|
1558
|
-
})]
|
|
1635
|
+
}), renderResultsPanel()]
|
|
1559
1636
|
})
|
|
1560
1637
|
})]
|
|
1561
1638
|
});
|
|
@@ -1798,6 +1875,7 @@ function ProductTabs(arg0) {
|
|
|
1798
1875
|
const pathname = normalizeRoutePath(useLocation().pathname);
|
|
1799
1876
|
if (!tabs?.length) return null;
|
|
1800
1877
|
return /* @__PURE__ */ jsx("div", {
|
|
1878
|
+
"data-clarify-header-tabs": true,
|
|
1801
1879
|
className: "clarify-product-tabs hidden h-14 border-t border-(--clarify-theme-tokens-colors-border) lg:block dark:border-white/10",
|
|
1802
1880
|
children: /* @__PURE__ */ jsx("nav", {
|
|
1803
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",
|
|
@@ -1830,7 +1908,7 @@ function ProductTabs(arg0) {
|
|
|
1830
1908
|
});
|
|
1831
1909
|
}
|
|
1832
1910
|
var Header = forwardRef(function Header(arg0, ref) {
|
|
1833
|
-
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
|
|
1911
|
+
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, topAreaRef, className, ...props } = arg0;
|
|
1834
1912
|
const t = useBuiltInText();
|
|
1835
1913
|
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1836
1914
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
@@ -1839,7 +1917,121 @@ var Header = forwardRef(function Header(arg0, ref) {
|
|
|
1839
1917
|
const { scrollY } = useScroll();
|
|
1840
1918
|
const bgOpacityLight = useTransform(scrollY, [0, 72], ["70%", "95%"]);
|
|
1841
1919
|
const bgOpacityDark = useTransform(scrollY, [0, 72], ["60%", "92%"]);
|
|
1842
|
-
|
|
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, {
|
|
1843
2035
|
...props,
|
|
1844
2036
|
ref,
|
|
1845
2037
|
"data-pagefind-ignore": true,
|
|
@@ -1848,96 +2040,7 @@ var Header = forwardRef(function Header(arg0, ref) {
|
|
|
1848
2040
|
"--bg-opacity-light": bgOpacityLight,
|
|
1849
2041
|
"--bg-opacity-dark": bgOpacityDark
|
|
1850
2042
|
},
|
|
1851
|
-
children:
|
|
1852
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1853
|
-
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"),
|
|
1854
|
-
children: [
|
|
1855
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1856
|
-
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1857
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1858
|
-
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
1859
|
-
children: /* @__PURE__ */ jsx(MobileNavigation, {
|
|
1860
|
-
config,
|
|
1861
|
-
navigation,
|
|
1862
|
-
tabs,
|
|
1863
|
-
routes,
|
|
1864
|
-
currentLocale,
|
|
1865
|
-
currentRoute
|
|
1866
|
-
})
|
|
1867
|
-
}), homeExternal ? /* @__PURE__ */ jsxs(CloseButton, {
|
|
1868
|
-
as: "a",
|
|
1869
|
-
href: homeHref,
|
|
1870
|
-
"aria-label": t("navbar.home"),
|
|
1871
|
-
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1872
|
-
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1873
|
-
logo: config.logo,
|
|
1874
|
-
className: "h-6 w-auto shrink-0 object-contain"
|
|
1875
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1876
|
-
className: "clarify-brand-title truncate font-semibold",
|
|
1877
|
-
children: config.title
|
|
1878
|
-
})]
|
|
1879
|
-
}) : /* @__PURE__ */ jsxs(CloseButton, {
|
|
1880
|
-
as: Link,
|
|
1881
|
-
to: homeHref,
|
|
1882
|
-
"aria-label": t("navbar.home"),
|
|
1883
|
-
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1884
|
-
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1885
|
-
logo: config.logo,
|
|
1886
|
-
className: "h-6 w-auto shrink-0 object-contain"
|
|
1887
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1888
|
-
className: "clarify-brand-title truncate font-semibold",
|
|
1889
|
-
children: config.title
|
|
1890
|
-
})]
|
|
1891
|
-
})]
|
|
1892
|
-
}),
|
|
1893
|
-
/* @__PURE__ */ jsx("div", {
|
|
1894
|
-
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
1895
|
-
children: /* @__PURE__ */ jsx(Search$1, {
|
|
1896
|
-
routes,
|
|
1897
|
-
navigation,
|
|
1898
|
-
routePrefix: config.routePrefix,
|
|
1899
|
-
currentLocale
|
|
1900
|
-
})
|
|
1901
|
-
}),
|
|
1902
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1903
|
-
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1904
|
-
children: [
|
|
1905
|
-
config.navbar?.links?.length ? /* @__PURE__ */ jsx("nav", {
|
|
1906
|
-
className: "clarify-top-nav hidden md:block",
|
|
1907
|
-
children: /* @__PURE__ */ jsx("ul", {
|
|
1908
|
-
role: "list",
|
|
1909
|
-
className: "flex items-center gap-8",
|
|
1910
|
-
children: config.navbar.links.map((link) => /* @__PURE__ */ jsx(TopLevelNavItem, {
|
|
1911
|
-
href: localizeHref(link.href, config, currentLocale),
|
|
1912
|
-
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1913
|
-
}, link.href))
|
|
1914
|
-
})
|
|
1915
|
-
}) : null,
|
|
1916
|
-
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,
|
|
1917
|
-
/* @__PURE__ */ jsx(MobileSearch, {
|
|
1918
|
-
routes,
|
|
1919
|
-
navigation,
|
|
1920
|
-
routePrefix: config.routePrefix,
|
|
1921
|
-
currentLocale
|
|
1922
|
-
}),
|
|
1923
|
-
/* @__PURE__ */ jsx(LanguageSwitcher, {
|
|
1924
|
-
config,
|
|
1925
|
-
currentLocale,
|
|
1926
|
-
currentRoute
|
|
1927
|
-
}),
|
|
1928
|
-
/* @__PURE__ */ jsx(ThemeToggle, {}),
|
|
1929
|
-
/* @__PURE__ */ jsx(MobileNavbarMenu, {
|
|
1930
|
-
links: config.navbar?.links,
|
|
1931
|
-
config,
|
|
1932
|
-
currentLocale
|
|
1933
|
-
})
|
|
1934
|
-
]
|
|
1935
|
-
})
|
|
1936
|
-
]
|
|
1937
|
-
}),
|
|
1938
|
-
banner,
|
|
1939
|
-
/* @__PURE__ */ jsx(ProductTabs, { tabs })
|
|
1940
|
-
]
|
|
2043
|
+
children: renderTopArea()
|
|
1941
2044
|
});
|
|
1942
2045
|
});
|
|
1943
2046
|
//#endregion
|
|
@@ -1963,4 +2066,4 @@ function PageTitleActions() {
|
|
|
1963
2066
|
//#endregion
|
|
1964
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 };
|
|
1965
2068
|
|
|
1966
|
-
//# sourceMappingURL=PageActions-
|
|
2069
|
+
//# sourceMappingURL=PageActions-tmnpzi23.js.map
|