@clarify-labs/renderer 0.9.1 → 0.9.3
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-BQ29N8P5.js} +223 -161
- package/output/ClarifyShell-BQ29N8P5.js.map +1 -0
- package/output/{ClarifyShell-DJ4fOVOd.cjs → ClarifyShell-Dm--LZco.cjs} +224 -162
- package/output/ClarifyShell-Dm--LZco.cjs.map +1 -0
- package/output/{OpenApiOperation-E8lSLsSK.js → OpenApiOperation-C9xyRo5a.js} +597 -292
- package/output/OpenApiOperation-C9xyRo5a.js.map +1 -0
- package/output/{OpenApiOperation-3DUVruIO.cjs → OpenApiOperation-DIWGdw29.cjs} +595 -290
- package/output/OpenApiOperation-DIWGdw29.cjs.map +1 -0
- package/output/{PageActions-DaXQgMYP.js → PageActions-B_tSec1f.js} +282 -197
- package/output/PageActions-B_tSec1f.js.map +1 -0
- package/output/{PageActions-GI1t-JrR.cjs → PageActions-DEuFHgyB.cjs} +280 -201
- package/output/PageActions-DEuFHgyB.cjs.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/components/Tabs.d.ts +16 -0
- package/output/components/index.d.ts +1 -0
- package/output/core/i18n.d.ts +1 -1
- 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 +6 -0
- package/output/openapi/components/ExamplePanels.d.ts +10 -17
- package/output/openapi/components/OpenApiOperation.d.ts +6 -0
- package/output/openapi/components/OpenApiOperation.state.d.ts +43 -0
- package/output/openapi/components/SchemaProperties.d.ts +2 -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-r9DclX3Y.cjs → render-BCGK1WpS.cjs} +2 -2
- package/output/{render-r9DclX3Y.cjs.map → render-BCGK1WpS.cjs.map} +1 -1
- package/output/{render-yBo2SUlA.js → render-CEWLJSmt.js} +2 -2
- package/output/{render-yBo2SUlA.js.map → render-CEWLJSmt.js.map} +1 -1
- package/output/renderer.css +207 -104
- 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";
|
|
@@ -79,6 +79,7 @@ var builtInText = {
|
|
|
79
79
|
"openapi.language": "Language",
|
|
80
80
|
"openapi.client": "Client",
|
|
81
81
|
"openapi.mediaType": "Media type",
|
|
82
|
+
"openapi.none": "None",
|
|
82
83
|
"openapi.openApiReference": "OpenAPI Reference",
|
|
83
84
|
"openapi.operationParameter": "Operation parameter.",
|
|
84
85
|
"openapi.optional": "Optional.",
|
|
@@ -87,6 +88,7 @@ var builtInText = {
|
|
|
87
88
|
"openapi.queryParameters": "Query parameters",
|
|
88
89
|
"openapi.request": "Request",
|
|
89
90
|
"openapi.requestBody": "Request body",
|
|
91
|
+
"openapi.responseBodyProperties": "Response body properties",
|
|
90
92
|
"openapi.required": "Required.",
|
|
91
93
|
"openapi.requiredBadge": "required",
|
|
92
94
|
"openapi.response": "Response",
|
|
@@ -176,6 +178,7 @@ var builtInText = {
|
|
|
176
178
|
"openapi.language": "语言",
|
|
177
179
|
"openapi.client": "客户端",
|
|
178
180
|
"openapi.mediaType": "媒体类型",
|
|
181
|
+
"openapi.none": "无",
|
|
179
182
|
"openapi.openApiReference": "OpenAPI 参考",
|
|
180
183
|
"openapi.operationParameter": "操作参数。",
|
|
181
184
|
"openapi.optional": "可选。",
|
|
@@ -184,6 +187,7 @@ var builtInText = {
|
|
|
184
187
|
"openapi.queryParameters": "查询参数",
|
|
185
188
|
"openapi.request": "请求",
|
|
186
189
|
"openapi.requestBody": "请求体",
|
|
190
|
+
"openapi.responseBodyProperties": "响应体属性",
|
|
187
191
|
"openapi.required": "必填。",
|
|
188
192
|
"openapi.requiredBadge": "必填",
|
|
189
193
|
"openapi.response": "响应",
|
|
@@ -765,49 +769,93 @@ function createSectionStore(sections) {
|
|
|
765
769
|
} : section) }))
|
|
766
770
|
}));
|
|
767
771
|
}
|
|
768
|
-
function
|
|
769
|
-
const
|
|
770
|
-
return
|
|
772
|
+
function getHeaderBlockedTop(innerHeight, headerTopAreaRef) {
|
|
773
|
+
const blockedTop = headerTopAreaRef?.current?.offsetHeight ?? 0;
|
|
774
|
+
return Math.max(0, Math.min(innerHeight, blockedTop));
|
|
775
|
+
}
|
|
776
|
+
function getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef) {
|
|
777
|
+
return scrollY + getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
778
|
+
}
|
|
779
|
+
function getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef) {
|
|
780
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
781
|
+
return scrollY + Math.max(0, innerHeight - blockedTop);
|
|
782
|
+
}
|
|
783
|
+
function computeVisibleSections(sections, scrollY, viewportTop, viewportBottom) {
|
|
784
|
+
const visibleSections = [];
|
|
785
|
+
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
786
|
+
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
787
|
+
if (!headingRef?.current) continue;
|
|
788
|
+
const offset = remToPx(offsetRem);
|
|
789
|
+
const sectionTop = headingRef.current.getBoundingClientRect().top + scrollY - offset;
|
|
790
|
+
if (sectionIndex === 0 && sectionTop > viewportTop) visibleSections.push("_top");
|
|
791
|
+
const nextSection = sections[sectionIndex + 1];
|
|
792
|
+
const nextOffset = remToPx(nextSection?.offsetRem ?? offsetRem);
|
|
793
|
+
if ((nextSection?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY - nextOffset > viewportTop && sectionTop < viewportBottom) visibleSections.push(id);
|
|
794
|
+
}
|
|
795
|
+
return visibleSections;
|
|
796
|
+
}
|
|
797
|
+
function useSectionVisibilityDebug(headerTopAreaRef) {
|
|
798
|
+
const lastDebugSignatureRef = useRef("");
|
|
799
|
+
return (snapshot) => {
|
|
800
|
+
const { scrollY, innerHeight, blockedTop, visibleSections } = snapshot;
|
|
801
|
+
const debugSignature = [
|
|
802
|
+
Math.round(scrollY),
|
|
803
|
+
innerHeight,
|
|
804
|
+
Math.round(blockedTop),
|
|
805
|
+
visibleSections.join(",")
|
|
806
|
+
].join("|");
|
|
807
|
+
if (lastDebugSignatureRef.current === debugSignature) return;
|
|
808
|
+
lastDebugSignatureRef.current = debugSignature;
|
|
809
|
+
console.info("[clarify][section-visibility]", {
|
|
810
|
+
...snapshot,
|
|
811
|
+
topAreaHeight: headerTopAreaRef?.current?.offsetHeight ?? 0
|
|
812
|
+
});
|
|
813
|
+
};
|
|
771
814
|
}
|
|
772
|
-
function
|
|
773
|
-
const setVisibleSections = useStore(sectionStore, (state) => state.setVisibleSections);
|
|
774
|
-
const sections = useStore(sectionStore, (state) => state.sections);
|
|
815
|
+
function useSectionVisibilityObserver(checkVisibleSections, headerTopAreaRef) {
|
|
775
816
|
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
817
|
const raf = window.requestAnimationFrame(() => checkVisibleSections());
|
|
792
818
|
window.addEventListener("scroll", checkVisibleSections, { passive: true });
|
|
793
819
|
window.addEventListener("resize", checkVisibleSections);
|
|
820
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(() => {
|
|
821
|
+
checkVisibleSections();
|
|
822
|
+
});
|
|
823
|
+
if (resizeObserver && headerTopAreaRef?.current) resizeObserver.observe(headerTopAreaRef.current);
|
|
794
824
|
return () => {
|
|
795
825
|
window.cancelAnimationFrame(raf);
|
|
796
826
|
window.removeEventListener("scroll", checkVisibleSections);
|
|
797
827
|
window.removeEventListener("resize", checkVisibleSections);
|
|
828
|
+
resizeObserver?.disconnect();
|
|
798
829
|
};
|
|
830
|
+
}, [checkVisibleSections, headerTopAreaRef]);
|
|
831
|
+
}
|
|
832
|
+
function useVisibleSections(sectionStore, headerTopAreaRef) {
|
|
833
|
+
const setVisibleSections = useStore(sectionStore, (state) => state.setVisibleSections);
|
|
834
|
+
const sections = useStore(sectionStore, (state) => state.sections);
|
|
835
|
+
const emitVisibilityDebug = useSectionVisibilityDebug(headerTopAreaRef);
|
|
836
|
+
useSectionVisibilityObserver(useCallback(() => {
|
|
837
|
+
const { innerHeight, scrollY } = window;
|
|
838
|
+
const viewportTop = getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef);
|
|
839
|
+
const viewportBottom = getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef);
|
|
840
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
841
|
+
const newVisibleSections = computeVisibleSections(sections, scrollY, viewportTop, viewportBottom);
|
|
842
|
+
emitVisibilityDebug({
|
|
843
|
+
scrollY,
|
|
844
|
+
innerHeight,
|
|
845
|
+
blockedTop,
|
|
846
|
+
viewportTop,
|
|
847
|
+
viewportBottom,
|
|
848
|
+
visibleSections: newVisibleSections
|
|
849
|
+
});
|
|
850
|
+
setVisibleSections(newVisibleSections);
|
|
799
851
|
}, [
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
sections
|
|
803
|
-
|
|
852
|
+
emitVisibilityDebug,
|
|
853
|
+
headerTopAreaRef,
|
|
854
|
+
sections,
|
|
855
|
+
setVisibleSections
|
|
856
|
+
]), headerTopAreaRef);
|
|
804
857
|
}
|
|
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);
|
|
858
|
+
function useSyncSections(sectionStore, sections) {
|
|
811
859
|
useIsomorphicLayoutEffect(() => {
|
|
812
860
|
sectionStore.setState((state) => ({
|
|
813
861
|
sections: sections.map((section) => {
|
|
@@ -821,6 +869,14 @@ function SectionProvider(arg0) {
|
|
|
821
869
|
visibleSections: []
|
|
822
870
|
}));
|
|
823
871
|
}, [sectionStore, sections]);
|
|
872
|
+
}
|
|
873
|
+
var SectionStoreContext = createContext(null);
|
|
874
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
|
|
875
|
+
function SectionProvider(arg0) {
|
|
876
|
+
const { sections, headerTopAreaRef, children } = arg0;
|
|
877
|
+
const [sectionStore] = useState(() => createSectionStore(sections));
|
|
878
|
+
useVisibleSections(sectionStore, headerTopAreaRef);
|
|
879
|
+
useSyncSections(sectionStore, sections);
|
|
824
880
|
return /* @__PURE__ */ jsx(SectionStoreContext.Provider, {
|
|
825
881
|
value: sectionStore,
|
|
826
882
|
children
|
|
@@ -832,15 +888,6 @@ function useSectionStore(selector) {
|
|
|
832
888
|
return useStore(store, selector);
|
|
833
889
|
}
|
|
834
890
|
//#endregion
|
|
835
|
-
//#region source/utils/hash.ts
|
|
836
|
-
function safeDecodeURIComponent(value) {
|
|
837
|
-
try {
|
|
838
|
-
return decodeURIComponent(value);
|
|
839
|
-
} catch {
|
|
840
|
-
return value;
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
//#endregion
|
|
844
891
|
//#region source/shell/Navigation.tsx
|
|
845
892
|
function useInitialValue(value, condition = true) {
|
|
846
893
|
const [initialValue] = useState(value);
|
|
@@ -882,23 +929,10 @@ function SectionBadge(arg0) {
|
|
|
882
929
|
}
|
|
883
930
|
function NavLink(arg0) {
|
|
884
931
|
const { href, children, badge, icon, active = false, isAnchorLink = false, level } = arg0;
|
|
885
|
-
function handleClick() {
|
|
886
|
-
if (!isAnchorLink) return;
|
|
887
|
-
const hashIndex = href.indexOf("#");
|
|
888
|
-
if (hashIndex === -1) return;
|
|
889
|
-
const targetId = safeDecodeURIComponent(href.slice(hashIndex + 1));
|
|
890
|
-
window.requestAnimationFrame(() => {
|
|
891
|
-
document.getElementById(targetId)?.scrollIntoView();
|
|
892
|
-
window.requestAnimationFrame(() => {
|
|
893
|
-
window.dispatchEvent(new Event("scroll"));
|
|
894
|
-
});
|
|
895
|
-
});
|
|
896
|
-
}
|
|
897
932
|
return /* @__PURE__ */ jsx(CloseButton, {
|
|
898
933
|
as: Link,
|
|
899
934
|
to: href,
|
|
900
935
|
"aria-current": active ? "page" : void 0,
|
|
901
|
-
onClick: handleClick,
|
|
902
936
|
className: clsx("clarify-navigation-link flex h-8 items-center justify-between gap-2 pr-3 transition", isAnchorLink ? "clarify-navigation-anchor-link" : "pl-4"),
|
|
903
937
|
style: isAnchorLink ? { paddingLeft: `${1.75 + Math.max(0, (level ?? 2) - 2) * .75}rem` } : void 0,
|
|
904
938
|
children: /* @__PURE__ */ jsxs("span", {
|
|
@@ -1197,6 +1231,7 @@ function routeGroupTitles(navigation) {
|
|
|
1197
1231
|
function buildSearchItems(routes, navigation) {
|
|
1198
1232
|
const groupTitles = routeGroupTitles(navigation);
|
|
1199
1233
|
return routes.flatMap((route) => {
|
|
1234
|
+
if (route.isBareAlias) return [];
|
|
1200
1235
|
const groupTitle = groupTitles.get(route.path);
|
|
1201
1236
|
return [{
|
|
1202
1237
|
title: route.title,
|
|
@@ -1383,17 +1418,33 @@ function SearchResult(arg0) {
|
|
|
1383
1418
|
}
|
|
1384
1419
|
//#endregion
|
|
1385
1420
|
//#region source/shell/search/SearchDialog.tsx
|
|
1386
|
-
function
|
|
1387
|
-
const { open, setOpen
|
|
1388
|
-
const t = useBuiltInText();
|
|
1389
|
-
const navigate = useNavigate();
|
|
1421
|
+
function useSearchDialogLifecycle(arg0) {
|
|
1422
|
+
const { open, setOpen } = arg0;
|
|
1390
1423
|
const location = useLocation();
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1424
|
+
useEffect(() => {
|
|
1425
|
+
setOpen(false);
|
|
1426
|
+
}, [
|
|
1427
|
+
location.pathname,
|
|
1428
|
+
location.search,
|
|
1429
|
+
location.hash,
|
|
1430
|
+
setOpen
|
|
1431
|
+
]);
|
|
1432
|
+
useEffect(() => {
|
|
1433
|
+
if (open) return void 0;
|
|
1434
|
+
function onKeyDown(event) {
|
|
1435
|
+
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
1436
|
+
event.preventDefault();
|
|
1437
|
+
setOpen(true);
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1441
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1442
|
+
}, [open, setOpen]);
|
|
1443
|
+
}
|
|
1444
|
+
function useSearchData(arg0) {
|
|
1445
|
+
const { query, searchItems, routePrefix, currentLocale } = arg0;
|
|
1394
1446
|
const [fullTextState, setFullTextState] = useState(null);
|
|
1395
1447
|
const [pagefindState, setPagefindState] = useState(null);
|
|
1396
|
-
const searchItems = useMemo(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1397
1448
|
const quickResults = useMemo(() => {
|
|
1398
1449
|
const normalizedQuery = query.trim().toLowerCase();
|
|
1399
1450
|
if (!normalizedQuery) return [];
|
|
@@ -1410,15 +1461,7 @@ function SearchDialog(arg0) {
|
|
|
1410
1461
|
const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
|
|
1411
1462
|
const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
|
|
1412
1463
|
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
|
-
]);
|
|
1464
|
+
const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null;
|
|
1422
1465
|
useEffect(() => {
|
|
1423
1466
|
let cancelled = false;
|
|
1424
1467
|
loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
|
|
@@ -1481,17 +1524,30 @@ function SearchDialog(arg0) {
|
|
|
1481
1524
|
routePrefix,
|
|
1482
1525
|
trimmedQuery
|
|
1483
1526
|
]);
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1527
|
+
return {
|
|
1528
|
+
results,
|
|
1529
|
+
searchInputLoading,
|
|
1530
|
+
showNoResults
|
|
1531
|
+
};
|
|
1532
|
+
}
|
|
1533
|
+
function SearchDialog(arg0) {
|
|
1534
|
+
const { open, setOpen, routes, navigation, routePrefix = "/", currentLocale, className, onNavigate = () => {} } = arg0;
|
|
1535
|
+
const t = useBuiltInText();
|
|
1536
|
+
const navigate = useNavigate();
|
|
1537
|
+
const inputRef = useRef(null);
|
|
1538
|
+
const [query, setQuery] = useState("");
|
|
1539
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
1540
|
+
const searchItems = useMemo(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1541
|
+
useSearchDialogLifecycle({
|
|
1542
|
+
open,
|
|
1543
|
+
setOpen
|
|
1544
|
+
});
|
|
1545
|
+
const { results, searchInputLoading, showNoResults } = useSearchData({
|
|
1546
|
+
query,
|
|
1547
|
+
searchItems,
|
|
1548
|
+
routePrefix,
|
|
1549
|
+
currentLocale
|
|
1550
|
+
});
|
|
1495
1551
|
const updateQuery = (value) => {
|
|
1496
1552
|
setQuery(value);
|
|
1497
1553
|
setActiveIndex(0);
|
|
@@ -1506,6 +1562,29 @@ function SearchDialog(arg0) {
|
|
|
1506
1562
|
onNavigate();
|
|
1507
1563
|
closeDialog();
|
|
1508
1564
|
}
|
|
1565
|
+
function renderResultsPanel() {
|
|
1566
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1567
|
+
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",
|
|
1568
|
+
children: [showNoResults ? /* @__PURE__ */ jsxs("div", {
|
|
1569
|
+
className: "p-6 text-center",
|
|
1570
|
+
children: [/* @__PURE__ */ jsx(SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ jsx("p", {
|
|
1571
|
+
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1572
|
+
children: t("search.noResults", { query })
|
|
1573
|
+
})]
|
|
1574
|
+
}) : null, results.length ? /* @__PURE__ */ jsx("ul", {
|
|
1575
|
+
id: "clarify-search-results",
|
|
1576
|
+
className: "clarify-search-results",
|
|
1577
|
+
role: "listbox",
|
|
1578
|
+
children: results.map((result, resultIndex) => /* @__PURE__ */ jsx(SearchResult, {
|
|
1579
|
+
result,
|
|
1580
|
+
query,
|
|
1581
|
+
active: resultIndex === activeIndex,
|
|
1582
|
+
onActive: () => setActiveIndex(resultIndex),
|
|
1583
|
+
onSelect: () => selectResult(result)
|
|
1584
|
+
}, result.type === "full-text" ? result.id : result.url))
|
|
1585
|
+
}) : null]
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1509
1588
|
return /* @__PURE__ */ jsxs(Dialog, {
|
|
1510
1589
|
open,
|
|
1511
1590
|
onClose: closeDialog,
|
|
@@ -1535,27 +1614,7 @@ function SearchDialog(arg0) {
|
|
|
1535
1614
|
onClose: closeDialog,
|
|
1536
1615
|
onSubmit: () => selectResult(),
|
|
1537
1616
|
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
|
-
})]
|
|
1617
|
+
}), renderResultsPanel()]
|
|
1559
1618
|
})
|
|
1560
1619
|
})]
|
|
1561
1620
|
});
|
|
@@ -1798,6 +1857,7 @@ function ProductTabs(arg0) {
|
|
|
1798
1857
|
const pathname = normalizeRoutePath(useLocation().pathname);
|
|
1799
1858
|
if (!tabs?.length) return null;
|
|
1800
1859
|
return /* @__PURE__ */ jsx("div", {
|
|
1860
|
+
"data-clarify-header-tabs": true,
|
|
1801
1861
|
className: "clarify-product-tabs hidden h-14 border-t border-(--clarify-theme-tokens-colors-border) lg:block dark:border-white/10",
|
|
1802
1862
|
children: /* @__PURE__ */ jsx("nav", {
|
|
1803
1863
|
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 +1890,7 @@ function ProductTabs(arg0) {
|
|
|
1830
1890
|
});
|
|
1831
1891
|
}
|
|
1832
1892
|
var Header = forwardRef(function Header(arg0, ref) {
|
|
1833
|
-
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
|
|
1893
|
+
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, topAreaRef, className, ...props } = arg0;
|
|
1834
1894
|
const t = useBuiltInText();
|
|
1835
1895
|
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1836
1896
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
@@ -1839,7 +1899,121 @@ var Header = forwardRef(function Header(arg0, ref) {
|
|
|
1839
1899
|
const { scrollY } = useScroll();
|
|
1840
1900
|
const bgOpacityLight = useTransform(scrollY, [0, 72], ["70%", "95%"]);
|
|
1841
1901
|
const bgOpacityDark = useTransform(scrollY, [0, 72], ["60%", "92%"]);
|
|
1842
|
-
|
|
1902
|
+
const hasNavbarLinks = Boolean(config.navbar?.links?.length);
|
|
1903
|
+
function renderBrand() {
|
|
1904
|
+
if (homeExternal) return /* @__PURE__ */ jsxs(CloseButton, {
|
|
1905
|
+
as: "a",
|
|
1906
|
+
href: homeHref,
|
|
1907
|
+
"aria-label": t("navbar.home"),
|
|
1908
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1909
|
+
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1910
|
+
logo: config.logo,
|
|
1911
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1912
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1913
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1914
|
+
children: config.title
|
|
1915
|
+
})]
|
|
1916
|
+
});
|
|
1917
|
+
return /* @__PURE__ */ jsxs(CloseButton, {
|
|
1918
|
+
as: Link,
|
|
1919
|
+
to: homeHref,
|
|
1920
|
+
"aria-label": t("navbar.home"),
|
|
1921
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1922
|
+
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1923
|
+
logo: config.logo,
|
|
1924
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1925
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1926
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1927
|
+
children: config.title
|
|
1928
|
+
})]
|
|
1929
|
+
});
|
|
1930
|
+
}
|
|
1931
|
+
function renderTopLinks() {
|
|
1932
|
+
if (!hasNavbarLinks) return null;
|
|
1933
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
1934
|
+
className: "clarify-top-nav hidden md:block",
|
|
1935
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
1936
|
+
role: "list",
|
|
1937
|
+
className: "flex items-center gap-8",
|
|
1938
|
+
children: config.navbar?.links?.map((link) => /* @__PURE__ */ jsx(TopLevelNavItem, {
|
|
1939
|
+
href: localizeHref(link.href, config, currentLocale),
|
|
1940
|
+
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1941
|
+
}, link.href))
|
|
1942
|
+
})
|
|
1943
|
+
});
|
|
1944
|
+
}
|
|
1945
|
+
function renderHeaderActions() {
|
|
1946
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1947
|
+
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1948
|
+
children: [
|
|
1949
|
+
renderTopLinks(),
|
|
1950
|
+
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,
|
|
1951
|
+
/* @__PURE__ */ jsx(MobileSearch, {
|
|
1952
|
+
routes,
|
|
1953
|
+
navigation,
|
|
1954
|
+
routePrefix: config.routePrefix,
|
|
1955
|
+
currentLocale
|
|
1956
|
+
}),
|
|
1957
|
+
/* @__PURE__ */ jsx(LanguageSwitcher, {
|
|
1958
|
+
config,
|
|
1959
|
+
currentLocale,
|
|
1960
|
+
currentRoute
|
|
1961
|
+
}),
|
|
1962
|
+
/* @__PURE__ */ jsx(ThemeToggle, {}),
|
|
1963
|
+
/* @__PURE__ */ jsx(MobileNavbarMenu, {
|
|
1964
|
+
links: config.navbar?.links,
|
|
1965
|
+
config,
|
|
1966
|
+
currentLocale
|
|
1967
|
+
})
|
|
1968
|
+
]
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
1971
|
+
function renderHeaderMain() {
|
|
1972
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1973
|
+
"data-clarify-header-main": true,
|
|
1974
|
+
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"),
|
|
1975
|
+
children: [
|
|
1976
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1977
|
+
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1978
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1979
|
+
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
1980
|
+
children: /* @__PURE__ */ jsx(MobileNavigation, {
|
|
1981
|
+
config,
|
|
1982
|
+
navigation,
|
|
1983
|
+
tabs,
|
|
1984
|
+
routes,
|
|
1985
|
+
currentLocale,
|
|
1986
|
+
currentRoute
|
|
1987
|
+
})
|
|
1988
|
+
}), renderBrand()]
|
|
1989
|
+
}),
|
|
1990
|
+
/* @__PURE__ */ jsx("div", {
|
|
1991
|
+
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
1992
|
+
children: /* @__PURE__ */ jsx(Search$1, {
|
|
1993
|
+
routes,
|
|
1994
|
+
navigation,
|
|
1995
|
+
routePrefix: config.routePrefix,
|
|
1996
|
+
currentLocale
|
|
1997
|
+
})
|
|
1998
|
+
}),
|
|
1999
|
+
renderHeaderActions()
|
|
2000
|
+
]
|
|
2001
|
+
});
|
|
2002
|
+
}
|
|
2003
|
+
function renderTopArea() {
|
|
2004
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2005
|
+
ref: topAreaRef,
|
|
2006
|
+
children: [
|
|
2007
|
+
renderHeaderMain(),
|
|
2008
|
+
/* @__PURE__ */ jsx("div", {
|
|
2009
|
+
"data-clarify-header-banner": true,
|
|
2010
|
+
children: banner
|
|
2011
|
+
}),
|
|
2012
|
+
/* @__PURE__ */ jsx(ProductTabs, { tabs })
|
|
2013
|
+
]
|
|
2014
|
+
});
|
|
2015
|
+
}
|
|
2016
|
+
return /* @__PURE__ */ jsx(motion.header, {
|
|
1843
2017
|
...props,
|
|
1844
2018
|
ref,
|
|
1845
2019
|
"data-pagefind-ignore": true,
|
|
@@ -1848,96 +2022,7 @@ var Header = forwardRef(function Header(arg0, ref) {
|
|
|
1848
2022
|
"--bg-opacity-light": bgOpacityLight,
|
|
1849
2023
|
"--bg-opacity-dark": bgOpacityDark
|
|
1850
2024
|
},
|
|
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
|
-
]
|
|
2025
|
+
children: renderTopArea()
|
|
1941
2026
|
});
|
|
1942
2027
|
});
|
|
1943
2028
|
//#endregion
|
|
@@ -1961,6 +2046,6 @@ function PageTitleActions() {
|
|
|
1961
2046
|
});
|
|
1962
2047
|
}
|
|
1963
2048
|
//#endregion
|
|
1964
|
-
export {
|
|
2049
|
+
export { OpenApisContext as A, isExternalHref as C, useBuiltInText as D, copyTextToClipboard as E, useLocale as M, useOpenApis as N, ConfigContext as O, themeCookieName as S, prefixHref as T, getStoredThemePreference as _, SectionProvider as a, storeLocalePreference as b, lucideIconRegistry as c, normalizeRoutePath as d, resolveLocalizedText as f, getStoredLocalePreference as g, useTheme as h, Navigation as i, useConfig as j, LocaleContext as k, resolveLucideIconName as l, ThemeProvider as m, PageTitleActions as n, useSectionStore as o, ThemeToggle as p, Header as r, remToPx as s, PageActionsProvider as t, isSameRoutePath as u, localeCookieName as v, localizeHref as w, storeThemePreference as x, readLocaleCookie as y };
|
|
1965
2050
|
|
|
1966
|
-
//# sourceMappingURL=PageActions-
|
|
2051
|
+
//# sourceMappingURL=PageActions-B_tSec1f.js.map
|