@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
|
@@ -767,49 +767,93 @@ function createSectionStore(sections) {
|
|
|
767
767
|
} : section) }))
|
|
768
768
|
}));
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
const
|
|
772
|
-
return
|
|
770
|
+
function getHeaderBlockedTop(innerHeight, headerTopAreaRef) {
|
|
771
|
+
const blockedTop = headerTopAreaRef?.current?.offsetHeight ?? 0;
|
|
772
|
+
return Math.max(0, Math.min(innerHeight, blockedTop));
|
|
773
|
+
}
|
|
774
|
+
function getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef) {
|
|
775
|
+
return scrollY + getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
776
|
+
}
|
|
777
|
+
function getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef) {
|
|
778
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
779
|
+
return scrollY + Math.max(0, innerHeight - blockedTop);
|
|
780
|
+
}
|
|
781
|
+
function computeVisibleSections(sections, scrollY, viewportTop, viewportBottom) {
|
|
782
|
+
const visibleSections = [];
|
|
783
|
+
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
784
|
+
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
785
|
+
if (!headingRef?.current) continue;
|
|
786
|
+
const offset = remToPx(offsetRem);
|
|
787
|
+
const sectionTop = headingRef.current.getBoundingClientRect().top + scrollY - offset;
|
|
788
|
+
if (sectionIndex === 0 && sectionTop > viewportTop) visibleSections.push("_top");
|
|
789
|
+
const nextSection = sections[sectionIndex + 1];
|
|
790
|
+
const nextOffset = remToPx(nextSection?.offsetRem ?? offsetRem);
|
|
791
|
+
if ((nextSection?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY - nextOffset > viewportTop && sectionTop < viewportBottom) visibleSections.push(id);
|
|
792
|
+
}
|
|
793
|
+
return visibleSections;
|
|
794
|
+
}
|
|
795
|
+
function useSectionVisibilityDebug(headerTopAreaRef) {
|
|
796
|
+
const lastDebugSignatureRef = (0, react.useRef)("");
|
|
797
|
+
return (snapshot) => {
|
|
798
|
+
const { scrollY, innerHeight, blockedTop, visibleSections } = snapshot;
|
|
799
|
+
const debugSignature = [
|
|
800
|
+
Math.round(scrollY),
|
|
801
|
+
innerHeight,
|
|
802
|
+
Math.round(blockedTop),
|
|
803
|
+
visibleSections.join(",")
|
|
804
|
+
].join("|");
|
|
805
|
+
if (lastDebugSignatureRef.current === debugSignature) return;
|
|
806
|
+
lastDebugSignatureRef.current = debugSignature;
|
|
807
|
+
console.info("[clarify][section-visibility]", {
|
|
808
|
+
...snapshot,
|
|
809
|
+
topAreaHeight: headerTopAreaRef?.current?.offsetHeight ?? 0
|
|
810
|
+
});
|
|
811
|
+
};
|
|
773
812
|
}
|
|
774
|
-
function
|
|
775
|
-
const setVisibleSections = (0, zustand.useStore)(sectionStore, (state) => state.setVisibleSections);
|
|
776
|
-
const sections = (0, zustand.useStore)(sectionStore, (state) => state.sections);
|
|
813
|
+
function useSectionVisibilityObserver(checkVisibleSections, headerTopAreaRef) {
|
|
777
814
|
(0, react.useEffect)(() => {
|
|
778
|
-
function checkVisibleSections() {
|
|
779
|
-
const { innerHeight, scrollY } = window;
|
|
780
|
-
const viewportTop = getVisibleViewportTop(scrollY, headerRef);
|
|
781
|
-
const viewportBottom = scrollY + innerHeight;
|
|
782
|
-
const newVisibleSections = [];
|
|
783
|
-
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
784
|
-
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
785
|
-
if (!headingRef?.current) continue;
|
|
786
|
-
const offset = remToPx(offsetRem);
|
|
787
|
-
const top = headingRef.current.getBoundingClientRect().top + scrollY;
|
|
788
|
-
if (sectionIndex === 0 && top - offset > viewportTop) newVisibleSections.push("_top");
|
|
789
|
-
if ((sections[sectionIndex + 1]?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY > viewportTop && top < viewportBottom) newVisibleSections.push(id);
|
|
790
|
-
}
|
|
791
|
-
setVisibleSections(newVisibleSections);
|
|
792
|
-
}
|
|
793
815
|
const raf = window.requestAnimationFrame(() => checkVisibleSections());
|
|
794
816
|
window.addEventListener("scroll", checkVisibleSections, { passive: true });
|
|
795
817
|
window.addEventListener("resize", checkVisibleSections);
|
|
818
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(() => {
|
|
819
|
+
checkVisibleSections();
|
|
820
|
+
});
|
|
821
|
+
if (resizeObserver && headerTopAreaRef?.current) resizeObserver.observe(headerTopAreaRef.current);
|
|
796
822
|
return () => {
|
|
797
823
|
window.cancelAnimationFrame(raf);
|
|
798
824
|
window.removeEventListener("scroll", checkVisibleSections);
|
|
799
825
|
window.removeEventListener("resize", checkVisibleSections);
|
|
826
|
+
resizeObserver?.disconnect();
|
|
800
827
|
};
|
|
828
|
+
}, [checkVisibleSections, headerTopAreaRef]);
|
|
829
|
+
}
|
|
830
|
+
function useVisibleSections(sectionStore, headerTopAreaRef) {
|
|
831
|
+
const setVisibleSections = (0, zustand.useStore)(sectionStore, (state) => state.setVisibleSections);
|
|
832
|
+
const sections = (0, zustand.useStore)(sectionStore, (state) => state.sections);
|
|
833
|
+
const emitVisibilityDebug = useSectionVisibilityDebug(headerTopAreaRef);
|
|
834
|
+
useSectionVisibilityObserver((0, react.useCallback)(() => {
|
|
835
|
+
const { innerHeight, scrollY } = window;
|
|
836
|
+
const viewportTop = getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef);
|
|
837
|
+
const viewportBottom = getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef);
|
|
838
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
839
|
+
const newVisibleSections = computeVisibleSections(sections, scrollY, viewportTop, viewportBottom);
|
|
840
|
+
emitVisibilityDebug({
|
|
841
|
+
scrollY,
|
|
842
|
+
innerHeight,
|
|
843
|
+
blockedTop,
|
|
844
|
+
viewportTop,
|
|
845
|
+
viewportBottom,
|
|
846
|
+
visibleSections: newVisibleSections
|
|
847
|
+
});
|
|
848
|
+
setVisibleSections(newVisibleSections);
|
|
801
849
|
}, [
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
sections
|
|
805
|
-
|
|
850
|
+
emitVisibilityDebug,
|
|
851
|
+
headerTopAreaRef,
|
|
852
|
+
sections,
|
|
853
|
+
setVisibleSections
|
|
854
|
+
]), headerTopAreaRef);
|
|
806
855
|
}
|
|
807
|
-
|
|
808
|
-
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
809
|
-
function SectionProvider(arg0) {
|
|
810
|
-
const { sections, headerRef, children } = arg0;
|
|
811
|
-
const [sectionStore] = (0, react.useState)(() => createSectionStore(sections));
|
|
812
|
-
useVisibleSections(sectionStore, headerRef);
|
|
856
|
+
function useSyncSections(sectionStore, sections) {
|
|
813
857
|
useIsomorphicLayoutEffect(() => {
|
|
814
858
|
sectionStore.setState((state) => ({
|
|
815
859
|
sections: sections.map((section) => {
|
|
@@ -823,6 +867,14 @@ function SectionProvider(arg0) {
|
|
|
823
867
|
visibleSections: []
|
|
824
868
|
}));
|
|
825
869
|
}, [sectionStore, sections]);
|
|
870
|
+
}
|
|
871
|
+
var SectionStoreContext = (0, react.createContext)(null);
|
|
872
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
873
|
+
function SectionProvider(arg0) {
|
|
874
|
+
const { sections, headerTopAreaRef, children } = arg0;
|
|
875
|
+
const [sectionStore] = (0, react.useState)(() => createSectionStore(sections));
|
|
876
|
+
useVisibleSections(sectionStore, headerTopAreaRef);
|
|
877
|
+
useSyncSections(sectionStore, sections);
|
|
826
878
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionStoreContext.Provider, {
|
|
827
879
|
value: sectionStore,
|
|
828
880
|
children
|
|
@@ -1199,6 +1251,7 @@ function routeGroupTitles(navigation) {
|
|
|
1199
1251
|
function buildSearchItems(routes, navigation) {
|
|
1200
1252
|
const groupTitles = routeGroupTitles(navigation);
|
|
1201
1253
|
return routes.flatMap((route) => {
|
|
1254
|
+
if (route.isBareAlias) return [];
|
|
1202
1255
|
const groupTitle = groupTitles.get(route.path);
|
|
1203
1256
|
return [{
|
|
1204
1257
|
title: route.title,
|
|
@@ -1385,17 +1438,33 @@ function SearchResult(arg0) {
|
|
|
1385
1438
|
}
|
|
1386
1439
|
//#endregion
|
|
1387
1440
|
//#region source/shell/search/SearchDialog.tsx
|
|
1388
|
-
function
|
|
1389
|
-
const { open, setOpen
|
|
1390
|
-
const t = useBuiltInText();
|
|
1391
|
-
const navigate = (0, react_router_dom.useNavigate)();
|
|
1441
|
+
function useSearchDialogLifecycle(arg0) {
|
|
1442
|
+
const { open, setOpen } = arg0;
|
|
1392
1443
|
const location = (0, react_router_dom.useLocation)();
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1444
|
+
(0, react.useEffect)(() => {
|
|
1445
|
+
setOpen(false);
|
|
1446
|
+
}, [
|
|
1447
|
+
location.pathname,
|
|
1448
|
+
location.search,
|
|
1449
|
+
location.hash,
|
|
1450
|
+
setOpen
|
|
1451
|
+
]);
|
|
1452
|
+
(0, react.useEffect)(() => {
|
|
1453
|
+
if (open) return void 0;
|
|
1454
|
+
function onKeyDown(event) {
|
|
1455
|
+
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
1456
|
+
event.preventDefault();
|
|
1457
|
+
setOpen(true);
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1461
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1462
|
+
}, [open, setOpen]);
|
|
1463
|
+
}
|
|
1464
|
+
function useSearchData(arg0) {
|
|
1465
|
+
const { query, searchItems, routePrefix, currentLocale } = arg0;
|
|
1396
1466
|
const [fullTextState, setFullTextState] = (0, react.useState)(null);
|
|
1397
1467
|
const [pagefindState, setPagefindState] = (0, react.useState)(null);
|
|
1398
|
-
const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1399
1468
|
const quickResults = (0, react.useMemo)(() => {
|
|
1400
1469
|
const normalizedQuery = query.trim().toLowerCase();
|
|
1401
1470
|
if (!normalizedQuery) return [];
|
|
@@ -1412,15 +1481,7 @@ function SearchDialog(arg0) {
|
|
|
1412
1481
|
const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
|
|
1413
1482
|
const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
|
|
1414
1483
|
const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey);
|
|
1415
|
-
const showNoResults = query && results.length === 0 && pagefindAvailable !== null;
|
|
1416
|
-
(0, react.useEffect)(() => {
|
|
1417
|
-
setOpen(false);
|
|
1418
|
-
}, [
|
|
1419
|
-
location.pathname,
|
|
1420
|
-
location.search,
|
|
1421
|
-
location.hash,
|
|
1422
|
-
setOpen
|
|
1423
|
-
]);
|
|
1484
|
+
const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null;
|
|
1424
1485
|
(0, react.useEffect)(() => {
|
|
1425
1486
|
let cancelled = false;
|
|
1426
1487
|
loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
|
|
@@ -1483,17 +1544,30 @@ function SearchDialog(arg0) {
|
|
|
1483
1544
|
routePrefix,
|
|
1484
1545
|
trimmedQuery
|
|
1485
1546
|
]);
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1547
|
+
return {
|
|
1548
|
+
results,
|
|
1549
|
+
searchInputLoading,
|
|
1550
|
+
showNoResults
|
|
1551
|
+
};
|
|
1552
|
+
}
|
|
1553
|
+
function SearchDialog(arg0) {
|
|
1554
|
+
const { open, setOpen, routes, navigation, routePrefix = "/", currentLocale, className, onNavigate = () => {} } = arg0;
|
|
1555
|
+
const t = useBuiltInText();
|
|
1556
|
+
const navigate = (0, react_router_dom.useNavigate)();
|
|
1557
|
+
const inputRef = (0, react.useRef)(null);
|
|
1558
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
1559
|
+
const [activeIndex, setActiveIndex] = (0, react.useState)(0);
|
|
1560
|
+
const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1561
|
+
useSearchDialogLifecycle({
|
|
1562
|
+
open,
|
|
1563
|
+
setOpen
|
|
1564
|
+
});
|
|
1565
|
+
const { results, searchInputLoading, showNoResults } = useSearchData({
|
|
1566
|
+
query,
|
|
1567
|
+
searchItems,
|
|
1568
|
+
routePrefix,
|
|
1569
|
+
currentLocale
|
|
1570
|
+
});
|
|
1497
1571
|
const updateQuery = (value) => {
|
|
1498
1572
|
setQuery(value);
|
|
1499
1573
|
setActiveIndex(0);
|
|
@@ -1508,6 +1582,29 @@ function SearchDialog(arg0) {
|
|
|
1508
1582
|
onNavigate();
|
|
1509
1583
|
closeDialog();
|
|
1510
1584
|
}
|
|
1585
|
+
function renderResultsPanel() {
|
|
1586
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1587
|
+
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",
|
|
1588
|
+
children: [showNoResults ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1589
|
+
className: "p-6 text-center",
|
|
1590
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1591
|
+
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1592
|
+
children: t("search.noResults", { query })
|
|
1593
|
+
})]
|
|
1594
|
+
}) : null, results.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1595
|
+
id: "clarify-search-results",
|
|
1596
|
+
className: "clarify-search-results",
|
|
1597
|
+
role: "listbox",
|
|
1598
|
+
children: results.map((result, resultIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResult, {
|
|
1599
|
+
result,
|
|
1600
|
+
query,
|
|
1601
|
+
active: resultIndex === activeIndex,
|
|
1602
|
+
onActive: () => setActiveIndex(resultIndex),
|
|
1603
|
+
onSelect: () => selectResult(result)
|
|
1604
|
+
}, result.type === "full-text" ? result.id : result.url))
|
|
1605
|
+
}) : null]
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1511
1608
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Dialog, {
|
|
1512
1609
|
open,
|
|
1513
1610
|
onClose: closeDialog,
|
|
@@ -1537,27 +1634,7 @@ function SearchDialog(arg0) {
|
|
|
1537
1634
|
onClose: closeDialog,
|
|
1538
1635
|
onSubmit: () => selectResult(),
|
|
1539
1636
|
loading: searchInputLoading
|
|
1540
|
-
}),
|
|
1541
|
-
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",
|
|
1542
|
-
children: [showNoResults ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1543
|
-
className: "p-6 text-center",
|
|
1544
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1545
|
-
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1546
|
-
children: t("search.noResults", { query })
|
|
1547
|
-
})]
|
|
1548
|
-
}) : null, results.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1549
|
-
id: "clarify-search-results",
|
|
1550
|
-
className: "clarify-search-results",
|
|
1551
|
-
role: "listbox",
|
|
1552
|
-
children: results.map((result, resultIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResult, {
|
|
1553
|
-
result,
|
|
1554
|
-
query,
|
|
1555
|
-
active: resultIndex === activeIndex,
|
|
1556
|
-
onActive: () => setActiveIndex(resultIndex),
|
|
1557
|
-
onSelect: () => selectResult(result)
|
|
1558
|
-
}, result.type === "full-text" ? result.id : result.url))
|
|
1559
|
-
}) : null]
|
|
1560
|
-
})]
|
|
1637
|
+
}), renderResultsPanel()]
|
|
1561
1638
|
})
|
|
1562
1639
|
})]
|
|
1563
1640
|
});
|
|
@@ -1800,6 +1877,7 @@ function ProductTabs(arg0) {
|
|
|
1800
1877
|
const pathname = normalizeRoutePath((0, react_router_dom.useLocation)().pathname);
|
|
1801
1878
|
if (!tabs?.length) return null;
|
|
1802
1879
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1880
|
+
"data-clarify-header-tabs": true,
|
|
1803
1881
|
className: "clarify-product-tabs hidden h-14 border-t border-(--clarify-theme-tokens-colors-border) lg:block dark:border-white/10",
|
|
1804
1882
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1805
1883
|
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",
|
|
@@ -1832,7 +1910,7 @@ function ProductTabs(arg0) {
|
|
|
1832
1910
|
});
|
|
1833
1911
|
}
|
|
1834
1912
|
var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
1835
|
-
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
|
|
1913
|
+
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, topAreaRef, className, ...props } = arg0;
|
|
1836
1914
|
const t = useBuiltInText();
|
|
1837
1915
|
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1838
1916
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
@@ -1841,7 +1919,121 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
|
1841
1919
|
const { scrollY } = (0, framer_motion.useScroll)();
|
|
1842
1920
|
const bgOpacityLight = (0, framer_motion.useTransform)(scrollY, [0, 72], ["70%", "95%"]);
|
|
1843
1921
|
const bgOpacityDark = (0, framer_motion.useTransform)(scrollY, [0, 72], ["60%", "92%"]);
|
|
1844
|
-
|
|
1922
|
+
const hasNavbarLinks = Boolean(config.navbar?.links?.length);
|
|
1923
|
+
function renderBrand() {
|
|
1924
|
+
if (homeExternal) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1925
|
+
as: "a",
|
|
1926
|
+
href: homeHref,
|
|
1927
|
+
"aria-label": t("navbar.home"),
|
|
1928
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1929
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1930
|
+
logo: config.logo,
|
|
1931
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1932
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1933
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1934
|
+
children: config.title
|
|
1935
|
+
})]
|
|
1936
|
+
});
|
|
1937
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1938
|
+
as: react_router_dom.Link,
|
|
1939
|
+
to: homeHref,
|
|
1940
|
+
"aria-label": t("navbar.home"),
|
|
1941
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1942
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1943
|
+
logo: config.logo,
|
|
1944
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1945
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1946
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1947
|
+
children: config.title
|
|
1948
|
+
})]
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
function renderTopLinks() {
|
|
1952
|
+
if (!hasNavbarLinks) return null;
|
|
1953
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1954
|
+
className: "clarify-top-nav hidden md:block",
|
|
1955
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1956
|
+
role: "list",
|
|
1957
|
+
className: "flex items-center gap-8",
|
|
1958
|
+
children: config.navbar?.links?.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
|
|
1959
|
+
href: localizeHref(link.href, config, currentLocale),
|
|
1960
|
+
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1961
|
+
}, link.href))
|
|
1962
|
+
})
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
function renderHeaderActions() {
|
|
1966
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1967
|
+
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1968
|
+
children: [
|
|
1969
|
+
renderTopLinks(),
|
|
1970
|
+
hasNavbarLinks ? /* @__PURE__ */ (0, react_jsx_runtime.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,
|
|
1971
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSearch, {
|
|
1972
|
+
routes,
|
|
1973
|
+
navigation,
|
|
1974
|
+
routePrefix: config.routePrefix,
|
|
1975
|
+
currentLocale
|
|
1976
|
+
}),
|
|
1977
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
|
|
1978
|
+
config,
|
|
1979
|
+
currentLocale,
|
|
1980
|
+
currentRoute
|
|
1981
|
+
}),
|
|
1982
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {}),
|
|
1983
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavbarMenu, {
|
|
1984
|
+
links: config.navbar?.links,
|
|
1985
|
+
config,
|
|
1986
|
+
currentLocale
|
|
1987
|
+
})
|
|
1988
|
+
]
|
|
1989
|
+
});
|
|
1990
|
+
}
|
|
1991
|
+
function renderHeaderMain() {
|
|
1992
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1993
|
+
"data-clarify-header-main": true,
|
|
1994
|
+
className: (0, clsx.default)("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"),
|
|
1995
|
+
children: [
|
|
1996
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1997
|
+
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1998
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1999
|
+
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
2000
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
|
|
2001
|
+
config,
|
|
2002
|
+
navigation,
|
|
2003
|
+
tabs,
|
|
2004
|
+
routes,
|
|
2005
|
+
currentLocale,
|
|
2006
|
+
currentRoute
|
|
2007
|
+
})
|
|
2008
|
+
}), renderBrand()]
|
|
2009
|
+
}),
|
|
2010
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2011
|
+
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
2012
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
2013
|
+
routes,
|
|
2014
|
+
navigation,
|
|
2015
|
+
routePrefix: config.routePrefix,
|
|
2016
|
+
currentLocale
|
|
2017
|
+
})
|
|
2018
|
+
}),
|
|
2019
|
+
renderHeaderActions()
|
|
2020
|
+
]
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
function renderTopArea() {
|
|
2024
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2025
|
+
ref: topAreaRef,
|
|
2026
|
+
children: [
|
|
2027
|
+
renderHeaderMain(),
|
|
2028
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2029
|
+
"data-clarify-header-banner": true,
|
|
2030
|
+
children: banner
|
|
2031
|
+
}),
|
|
2032
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, { tabs })
|
|
2033
|
+
]
|
|
2034
|
+
});
|
|
2035
|
+
}
|
|
2036
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.header, {
|
|
1845
2037
|
...props,
|
|
1846
2038
|
ref,
|
|
1847
2039
|
"data-pagefind-ignore": true,
|
|
@@ -1850,96 +2042,7 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
|
1850
2042
|
"--bg-opacity-light": bgOpacityLight,
|
|
1851
2043
|
"--bg-opacity-dark": bgOpacityDark
|
|
1852
2044
|
},
|
|
1853
|
-
children:
|
|
1854
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1855
|
-
className: (0, clsx.default)("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"),
|
|
1856
|
-
children: [
|
|
1857
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1858
|
-
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1859
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1860
|
-
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
1861
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
|
|
1862
|
-
config,
|
|
1863
|
-
navigation,
|
|
1864
|
-
tabs,
|
|
1865
|
-
routes,
|
|
1866
|
-
currentLocale,
|
|
1867
|
-
currentRoute
|
|
1868
|
-
})
|
|
1869
|
-
}), homeExternal ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1870
|
-
as: "a",
|
|
1871
|
-
href: homeHref,
|
|
1872
|
-
"aria-label": t("navbar.home"),
|
|
1873
|
-
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1874
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1875
|
-
logo: config.logo,
|
|
1876
|
-
className: "h-6 w-auto shrink-0 object-contain"
|
|
1877
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1878
|
-
className: "clarify-brand-title truncate font-semibold",
|
|
1879
|
-
children: config.title
|
|
1880
|
-
})]
|
|
1881
|
-
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1882
|
-
as: react_router_dom.Link,
|
|
1883
|
-
to: homeHref,
|
|
1884
|
-
"aria-label": t("navbar.home"),
|
|
1885
|
-
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1886
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1887
|
-
logo: config.logo,
|
|
1888
|
-
className: "h-6 w-auto shrink-0 object-contain"
|
|
1889
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1890
|
-
className: "clarify-brand-title truncate font-semibold",
|
|
1891
|
-
children: config.title
|
|
1892
|
-
})]
|
|
1893
|
-
})]
|
|
1894
|
-
}),
|
|
1895
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1896
|
-
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
1897
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
1898
|
-
routes,
|
|
1899
|
-
navigation,
|
|
1900
|
-
routePrefix: config.routePrefix,
|
|
1901
|
-
currentLocale
|
|
1902
|
-
})
|
|
1903
|
-
}),
|
|
1904
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1905
|
-
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1906
|
-
children: [
|
|
1907
|
-
config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1908
|
-
className: "clarify-top-nav hidden md:block",
|
|
1909
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1910
|
-
role: "list",
|
|
1911
|
-
className: "flex items-center gap-8",
|
|
1912
|
-
children: config.navbar.links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
|
|
1913
|
-
href: localizeHref(link.href, config, currentLocale),
|
|
1914
|
-
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1915
|
-
}, link.href))
|
|
1916
|
-
})
|
|
1917
|
-
}) : null,
|
|
1918
|
-
config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.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,
|
|
1919
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSearch, {
|
|
1920
|
-
routes,
|
|
1921
|
-
navigation,
|
|
1922
|
-
routePrefix: config.routePrefix,
|
|
1923
|
-
currentLocale
|
|
1924
|
-
}),
|
|
1925
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
|
|
1926
|
-
config,
|
|
1927
|
-
currentLocale,
|
|
1928
|
-
currentRoute
|
|
1929
|
-
}),
|
|
1930
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {}),
|
|
1931
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavbarMenu, {
|
|
1932
|
-
links: config.navbar?.links,
|
|
1933
|
-
config,
|
|
1934
|
-
currentLocale
|
|
1935
|
-
})
|
|
1936
|
-
]
|
|
1937
|
-
})
|
|
1938
|
-
]
|
|
1939
|
-
}),
|
|
1940
|
-
banner,
|
|
1941
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, { tabs })
|
|
1942
|
-
]
|
|
2045
|
+
children: renderTopArea()
|
|
1943
2046
|
});
|
|
1944
2047
|
});
|
|
1945
2048
|
//#endregion
|
|
@@ -2168,4 +2271,4 @@ Object.defineProperty(exports, "useTheme", {
|
|
|
2168
2271
|
}
|
|
2169
2272
|
});
|
|
2170
2273
|
|
|
2171
|
-
//# sourceMappingURL=PageActions-
|
|
2274
|
+
//# sourceMappingURL=PageActions-B08cDCzq.cjs.map
|