@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
|
@@ -81,6 +81,7 @@ var builtInText = {
|
|
|
81
81
|
"openapi.language": "Language",
|
|
82
82
|
"openapi.client": "Client",
|
|
83
83
|
"openapi.mediaType": "Media type",
|
|
84
|
+
"openapi.none": "None",
|
|
84
85
|
"openapi.openApiReference": "OpenAPI Reference",
|
|
85
86
|
"openapi.operationParameter": "Operation parameter.",
|
|
86
87
|
"openapi.optional": "Optional.",
|
|
@@ -89,6 +90,7 @@ var builtInText = {
|
|
|
89
90
|
"openapi.queryParameters": "Query parameters",
|
|
90
91
|
"openapi.request": "Request",
|
|
91
92
|
"openapi.requestBody": "Request body",
|
|
93
|
+
"openapi.responseBodyProperties": "Response body properties",
|
|
92
94
|
"openapi.required": "Required.",
|
|
93
95
|
"openapi.requiredBadge": "required",
|
|
94
96
|
"openapi.response": "Response",
|
|
@@ -178,6 +180,7 @@ var builtInText = {
|
|
|
178
180
|
"openapi.language": "语言",
|
|
179
181
|
"openapi.client": "客户端",
|
|
180
182
|
"openapi.mediaType": "媒体类型",
|
|
183
|
+
"openapi.none": "无",
|
|
181
184
|
"openapi.openApiReference": "OpenAPI 参考",
|
|
182
185
|
"openapi.operationParameter": "操作参数。",
|
|
183
186
|
"openapi.optional": "可选。",
|
|
@@ -186,6 +189,7 @@ var builtInText = {
|
|
|
186
189
|
"openapi.queryParameters": "查询参数",
|
|
187
190
|
"openapi.request": "请求",
|
|
188
191
|
"openapi.requestBody": "请求体",
|
|
192
|
+
"openapi.responseBodyProperties": "响应体属性",
|
|
189
193
|
"openapi.required": "必填。",
|
|
190
194
|
"openapi.requiredBadge": "必填",
|
|
191
195
|
"openapi.response": "响应",
|
|
@@ -767,49 +771,93 @@ function createSectionStore(sections) {
|
|
|
767
771
|
} : section) }))
|
|
768
772
|
}));
|
|
769
773
|
}
|
|
770
|
-
function
|
|
771
|
-
const
|
|
772
|
-
return
|
|
774
|
+
function getHeaderBlockedTop(innerHeight, headerTopAreaRef) {
|
|
775
|
+
const blockedTop = headerTopAreaRef?.current?.offsetHeight ?? 0;
|
|
776
|
+
return Math.max(0, Math.min(innerHeight, blockedTop));
|
|
777
|
+
}
|
|
778
|
+
function getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef) {
|
|
779
|
+
return scrollY + getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
780
|
+
}
|
|
781
|
+
function getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef) {
|
|
782
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
783
|
+
return scrollY + Math.max(0, innerHeight - blockedTop);
|
|
784
|
+
}
|
|
785
|
+
function computeVisibleSections(sections, scrollY, viewportTop, viewportBottom) {
|
|
786
|
+
const visibleSections = [];
|
|
787
|
+
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
788
|
+
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
789
|
+
if (!headingRef?.current) continue;
|
|
790
|
+
const offset = remToPx(offsetRem);
|
|
791
|
+
const sectionTop = headingRef.current.getBoundingClientRect().top + scrollY - offset;
|
|
792
|
+
if (sectionIndex === 0 && sectionTop > viewportTop) visibleSections.push("_top");
|
|
793
|
+
const nextSection = sections[sectionIndex + 1];
|
|
794
|
+
const nextOffset = remToPx(nextSection?.offsetRem ?? offsetRem);
|
|
795
|
+
if ((nextSection?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY - nextOffset > viewportTop && sectionTop < viewportBottom) visibleSections.push(id);
|
|
796
|
+
}
|
|
797
|
+
return visibleSections;
|
|
798
|
+
}
|
|
799
|
+
function useSectionVisibilityDebug(headerTopAreaRef) {
|
|
800
|
+
const lastDebugSignatureRef = (0, react.useRef)("");
|
|
801
|
+
return (snapshot) => {
|
|
802
|
+
const { scrollY, innerHeight, blockedTop, visibleSections } = snapshot;
|
|
803
|
+
const debugSignature = [
|
|
804
|
+
Math.round(scrollY),
|
|
805
|
+
innerHeight,
|
|
806
|
+
Math.round(blockedTop),
|
|
807
|
+
visibleSections.join(",")
|
|
808
|
+
].join("|");
|
|
809
|
+
if (lastDebugSignatureRef.current === debugSignature) return;
|
|
810
|
+
lastDebugSignatureRef.current = debugSignature;
|
|
811
|
+
console.info("[clarify][section-visibility]", {
|
|
812
|
+
...snapshot,
|
|
813
|
+
topAreaHeight: headerTopAreaRef?.current?.offsetHeight ?? 0
|
|
814
|
+
});
|
|
815
|
+
};
|
|
773
816
|
}
|
|
774
|
-
function
|
|
775
|
-
const setVisibleSections = (0, zustand.useStore)(sectionStore, (state) => state.setVisibleSections);
|
|
776
|
-
const sections = (0, zustand.useStore)(sectionStore, (state) => state.sections);
|
|
817
|
+
function useSectionVisibilityObserver(checkVisibleSections, headerTopAreaRef) {
|
|
777
818
|
(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
819
|
const raf = window.requestAnimationFrame(() => checkVisibleSections());
|
|
794
820
|
window.addEventListener("scroll", checkVisibleSections, { passive: true });
|
|
795
821
|
window.addEventListener("resize", checkVisibleSections);
|
|
822
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver(() => {
|
|
823
|
+
checkVisibleSections();
|
|
824
|
+
});
|
|
825
|
+
if (resizeObserver && headerTopAreaRef?.current) resizeObserver.observe(headerTopAreaRef.current);
|
|
796
826
|
return () => {
|
|
797
827
|
window.cancelAnimationFrame(raf);
|
|
798
828
|
window.removeEventListener("scroll", checkVisibleSections);
|
|
799
829
|
window.removeEventListener("resize", checkVisibleSections);
|
|
830
|
+
resizeObserver?.disconnect();
|
|
800
831
|
};
|
|
832
|
+
}, [checkVisibleSections, headerTopAreaRef]);
|
|
833
|
+
}
|
|
834
|
+
function useVisibleSections(sectionStore, headerTopAreaRef) {
|
|
835
|
+
const setVisibleSections = (0, zustand.useStore)(sectionStore, (state) => state.setVisibleSections);
|
|
836
|
+
const sections = (0, zustand.useStore)(sectionStore, (state) => state.sections);
|
|
837
|
+
const emitVisibilityDebug = useSectionVisibilityDebug(headerTopAreaRef);
|
|
838
|
+
useSectionVisibilityObserver((0, react.useCallback)(() => {
|
|
839
|
+
const { innerHeight, scrollY } = window;
|
|
840
|
+
const viewportTop = getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef);
|
|
841
|
+
const viewportBottom = getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef);
|
|
842
|
+
const blockedTop = getHeaderBlockedTop(innerHeight, headerTopAreaRef);
|
|
843
|
+
const newVisibleSections = computeVisibleSections(sections, scrollY, viewportTop, viewportBottom);
|
|
844
|
+
emitVisibilityDebug({
|
|
845
|
+
scrollY,
|
|
846
|
+
innerHeight,
|
|
847
|
+
blockedTop,
|
|
848
|
+
viewportTop,
|
|
849
|
+
viewportBottom,
|
|
850
|
+
visibleSections: newVisibleSections
|
|
851
|
+
});
|
|
852
|
+
setVisibleSections(newVisibleSections);
|
|
801
853
|
}, [
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
sections
|
|
805
|
-
|
|
854
|
+
emitVisibilityDebug,
|
|
855
|
+
headerTopAreaRef,
|
|
856
|
+
sections,
|
|
857
|
+
setVisibleSections
|
|
858
|
+
]), headerTopAreaRef);
|
|
806
859
|
}
|
|
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);
|
|
860
|
+
function useSyncSections(sectionStore, sections) {
|
|
813
861
|
useIsomorphicLayoutEffect(() => {
|
|
814
862
|
sectionStore.setState((state) => ({
|
|
815
863
|
sections: sections.map((section) => {
|
|
@@ -823,6 +871,14 @@ function SectionProvider(arg0) {
|
|
|
823
871
|
visibleSections: []
|
|
824
872
|
}));
|
|
825
873
|
}, [sectionStore, sections]);
|
|
874
|
+
}
|
|
875
|
+
var SectionStoreContext = (0, react.createContext)(null);
|
|
876
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
877
|
+
function SectionProvider(arg0) {
|
|
878
|
+
const { sections, headerTopAreaRef, children } = arg0;
|
|
879
|
+
const [sectionStore] = (0, react.useState)(() => createSectionStore(sections));
|
|
880
|
+
useVisibleSections(sectionStore, headerTopAreaRef);
|
|
881
|
+
useSyncSections(sectionStore, sections);
|
|
826
882
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionStoreContext.Provider, {
|
|
827
883
|
value: sectionStore,
|
|
828
884
|
children
|
|
@@ -834,15 +890,6 @@ function useSectionStore(selector) {
|
|
|
834
890
|
return (0, zustand.useStore)(store, selector);
|
|
835
891
|
}
|
|
836
892
|
//#endregion
|
|
837
|
-
//#region source/utils/hash.ts
|
|
838
|
-
function safeDecodeURIComponent(value) {
|
|
839
|
-
try {
|
|
840
|
-
return decodeURIComponent(value);
|
|
841
|
-
} catch {
|
|
842
|
-
return value;
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
//#endregion
|
|
846
893
|
//#region source/shell/Navigation.tsx
|
|
847
894
|
function useInitialValue(value, condition = true) {
|
|
848
895
|
const [initialValue] = (0, react.useState)(value);
|
|
@@ -884,23 +931,10 @@ function SectionBadge(arg0) {
|
|
|
884
931
|
}
|
|
885
932
|
function NavLink(arg0) {
|
|
886
933
|
const { href, children, badge, icon, active = false, isAnchorLink = false, level } = arg0;
|
|
887
|
-
function handleClick() {
|
|
888
|
-
if (!isAnchorLink) return;
|
|
889
|
-
const hashIndex = href.indexOf("#");
|
|
890
|
-
if (hashIndex === -1) return;
|
|
891
|
-
const targetId = safeDecodeURIComponent(href.slice(hashIndex + 1));
|
|
892
|
-
window.requestAnimationFrame(() => {
|
|
893
|
-
document.getElementById(targetId)?.scrollIntoView();
|
|
894
|
-
window.requestAnimationFrame(() => {
|
|
895
|
-
window.dispatchEvent(new Event("scroll"));
|
|
896
|
-
});
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
934
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.CloseButton, {
|
|
900
935
|
as: react_router_dom.Link,
|
|
901
936
|
to: href,
|
|
902
937
|
"aria-current": active ? "page" : void 0,
|
|
903
|
-
onClick: handleClick,
|
|
904
938
|
className: (0, clsx.default)("clarify-navigation-link flex h-8 items-center justify-between gap-2 pr-3 transition", isAnchorLink ? "clarify-navigation-anchor-link" : "pl-4"),
|
|
905
939
|
style: isAnchorLink ? { paddingLeft: `${1.75 + Math.max(0, (level ?? 2) - 2) * .75}rem` } : void 0,
|
|
906
940
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
@@ -1199,6 +1233,7 @@ function routeGroupTitles(navigation) {
|
|
|
1199
1233
|
function buildSearchItems(routes, navigation) {
|
|
1200
1234
|
const groupTitles = routeGroupTitles(navigation);
|
|
1201
1235
|
return routes.flatMap((route) => {
|
|
1236
|
+
if (route.isBareAlias) return [];
|
|
1202
1237
|
const groupTitle = groupTitles.get(route.path);
|
|
1203
1238
|
return [{
|
|
1204
1239
|
title: route.title,
|
|
@@ -1385,17 +1420,33 @@ function SearchResult(arg0) {
|
|
|
1385
1420
|
}
|
|
1386
1421
|
//#endregion
|
|
1387
1422
|
//#region source/shell/search/SearchDialog.tsx
|
|
1388
|
-
function
|
|
1389
|
-
const { open, setOpen
|
|
1390
|
-
const t = useBuiltInText();
|
|
1391
|
-
const navigate = (0, react_router_dom.useNavigate)();
|
|
1423
|
+
function useSearchDialogLifecycle(arg0) {
|
|
1424
|
+
const { open, setOpen } = arg0;
|
|
1392
1425
|
const location = (0, react_router_dom.useLocation)();
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1426
|
+
(0, react.useEffect)(() => {
|
|
1427
|
+
setOpen(false);
|
|
1428
|
+
}, [
|
|
1429
|
+
location.pathname,
|
|
1430
|
+
location.search,
|
|
1431
|
+
location.hash,
|
|
1432
|
+
setOpen
|
|
1433
|
+
]);
|
|
1434
|
+
(0, react.useEffect)(() => {
|
|
1435
|
+
if (open) return void 0;
|
|
1436
|
+
function onKeyDown(event) {
|
|
1437
|
+
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
1438
|
+
event.preventDefault();
|
|
1439
|
+
setOpen(true);
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1443
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1444
|
+
}, [open, setOpen]);
|
|
1445
|
+
}
|
|
1446
|
+
function useSearchData(arg0) {
|
|
1447
|
+
const { query, searchItems, routePrefix, currentLocale } = arg0;
|
|
1396
1448
|
const [fullTextState, setFullTextState] = (0, react.useState)(null);
|
|
1397
1449
|
const [pagefindState, setPagefindState] = (0, react.useState)(null);
|
|
1398
|
-
const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1399
1450
|
const quickResults = (0, react.useMemo)(() => {
|
|
1400
1451
|
const normalizedQuery = query.trim().toLowerCase();
|
|
1401
1452
|
if (!normalizedQuery) return [];
|
|
@@ -1412,15 +1463,7 @@ function SearchDialog(arg0) {
|
|
|
1412
1463
|
const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
|
|
1413
1464
|
const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
|
|
1414
1465
|
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
|
-
]);
|
|
1466
|
+
const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null;
|
|
1424
1467
|
(0, react.useEffect)(() => {
|
|
1425
1468
|
let cancelled = false;
|
|
1426
1469
|
loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
|
|
@@ -1483,17 +1526,30 @@ function SearchDialog(arg0) {
|
|
|
1483
1526
|
routePrefix,
|
|
1484
1527
|
trimmedQuery
|
|
1485
1528
|
]);
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1529
|
+
return {
|
|
1530
|
+
results,
|
|
1531
|
+
searchInputLoading,
|
|
1532
|
+
showNoResults
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1535
|
+
function SearchDialog(arg0) {
|
|
1536
|
+
const { open, setOpen, routes, navigation, routePrefix = "/", currentLocale, className, onNavigate = () => {} } = arg0;
|
|
1537
|
+
const t = useBuiltInText();
|
|
1538
|
+
const navigate = (0, react_router_dom.useNavigate)();
|
|
1539
|
+
const inputRef = (0, react.useRef)(null);
|
|
1540
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
1541
|
+
const [activeIndex, setActiveIndex] = (0, react.useState)(0);
|
|
1542
|
+
const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1543
|
+
useSearchDialogLifecycle({
|
|
1544
|
+
open,
|
|
1545
|
+
setOpen
|
|
1546
|
+
});
|
|
1547
|
+
const { results, searchInputLoading, showNoResults } = useSearchData({
|
|
1548
|
+
query,
|
|
1549
|
+
searchItems,
|
|
1550
|
+
routePrefix,
|
|
1551
|
+
currentLocale
|
|
1552
|
+
});
|
|
1497
1553
|
const updateQuery = (value) => {
|
|
1498
1554
|
setQuery(value);
|
|
1499
1555
|
setActiveIndex(0);
|
|
@@ -1508,6 +1564,29 @@ function SearchDialog(arg0) {
|
|
|
1508
1564
|
onNavigate();
|
|
1509
1565
|
closeDialog();
|
|
1510
1566
|
}
|
|
1567
|
+
function renderResultsPanel() {
|
|
1568
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1569
|
+
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",
|
|
1570
|
+
children: [showNoResults ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1571
|
+
className: "p-6 text-center",
|
|
1572
|
+
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", {
|
|
1573
|
+
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1574
|
+
children: t("search.noResults", { query })
|
|
1575
|
+
})]
|
|
1576
|
+
}) : null, results.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1577
|
+
id: "clarify-search-results",
|
|
1578
|
+
className: "clarify-search-results",
|
|
1579
|
+
role: "listbox",
|
|
1580
|
+
children: results.map((result, resultIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResult, {
|
|
1581
|
+
result,
|
|
1582
|
+
query,
|
|
1583
|
+
active: resultIndex === activeIndex,
|
|
1584
|
+
onActive: () => setActiveIndex(resultIndex),
|
|
1585
|
+
onSelect: () => selectResult(result)
|
|
1586
|
+
}, result.type === "full-text" ? result.id : result.url))
|
|
1587
|
+
}) : null]
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1511
1590
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Dialog, {
|
|
1512
1591
|
open,
|
|
1513
1592
|
onClose: closeDialog,
|
|
@@ -1537,27 +1616,7 @@ function SearchDialog(arg0) {
|
|
|
1537
1616
|
onClose: closeDialog,
|
|
1538
1617
|
onSubmit: () => selectResult(),
|
|
1539
1618
|
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
|
-
})]
|
|
1619
|
+
}), renderResultsPanel()]
|
|
1561
1620
|
})
|
|
1562
1621
|
})]
|
|
1563
1622
|
});
|
|
@@ -1800,6 +1859,7 @@ function ProductTabs(arg0) {
|
|
|
1800
1859
|
const pathname = normalizeRoutePath((0, react_router_dom.useLocation)().pathname);
|
|
1801
1860
|
if (!tabs?.length) return null;
|
|
1802
1861
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1862
|
+
"data-clarify-header-tabs": true,
|
|
1803
1863
|
className: "clarify-product-tabs hidden h-14 border-t border-(--clarify-theme-tokens-colors-border) lg:block dark:border-white/10",
|
|
1804
1864
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1805
1865
|
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 +1892,7 @@ function ProductTabs(arg0) {
|
|
|
1832
1892
|
});
|
|
1833
1893
|
}
|
|
1834
1894
|
var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
1835
|
-
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
|
|
1895
|
+
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, topAreaRef, className, ...props } = arg0;
|
|
1836
1896
|
const t = useBuiltInText();
|
|
1837
1897
|
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1838
1898
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
@@ -1841,7 +1901,121 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
|
1841
1901
|
const { scrollY } = (0, framer_motion.useScroll)();
|
|
1842
1902
|
const bgOpacityLight = (0, framer_motion.useTransform)(scrollY, [0, 72], ["70%", "95%"]);
|
|
1843
1903
|
const bgOpacityDark = (0, framer_motion.useTransform)(scrollY, [0, 72], ["60%", "92%"]);
|
|
1844
|
-
|
|
1904
|
+
const hasNavbarLinks = Boolean(config.navbar?.links?.length);
|
|
1905
|
+
function renderBrand() {
|
|
1906
|
+
if (homeExternal) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1907
|
+
as: "a",
|
|
1908
|
+
href: homeHref,
|
|
1909
|
+
"aria-label": t("navbar.home"),
|
|
1910
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1911
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1912
|
+
logo: config.logo,
|
|
1913
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1914
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1915
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1916
|
+
children: config.title
|
|
1917
|
+
})]
|
|
1918
|
+
});
|
|
1919
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1920
|
+
as: react_router_dom.Link,
|
|
1921
|
+
to: homeHref,
|
|
1922
|
+
"aria-label": t("navbar.home"),
|
|
1923
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
1924
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1925
|
+
logo: config.logo,
|
|
1926
|
+
className: "h-6 w-auto shrink-0 object-contain"
|
|
1927
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1928
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
1929
|
+
children: config.title
|
|
1930
|
+
})]
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
function renderTopLinks() {
|
|
1934
|
+
if (!hasNavbarLinks) return null;
|
|
1935
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1936
|
+
className: "clarify-top-nav hidden md:block",
|
|
1937
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1938
|
+
role: "list",
|
|
1939
|
+
className: "flex items-center gap-8",
|
|
1940
|
+
children: config.navbar?.links?.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
|
|
1941
|
+
href: localizeHref(link.href, config, currentLocale),
|
|
1942
|
+
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1943
|
+
}, link.href))
|
|
1944
|
+
})
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
function renderHeaderActions() {
|
|
1948
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1949
|
+
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
1950
|
+
children: [
|
|
1951
|
+
renderTopLinks(),
|
|
1952
|
+
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,
|
|
1953
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSearch, {
|
|
1954
|
+
routes,
|
|
1955
|
+
navigation,
|
|
1956
|
+
routePrefix: config.routePrefix,
|
|
1957
|
+
currentLocale
|
|
1958
|
+
}),
|
|
1959
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
|
|
1960
|
+
config,
|
|
1961
|
+
currentLocale,
|
|
1962
|
+
currentRoute
|
|
1963
|
+
}),
|
|
1964
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {}),
|
|
1965
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavbarMenu, {
|
|
1966
|
+
links: config.navbar?.links,
|
|
1967
|
+
config,
|
|
1968
|
+
currentLocale
|
|
1969
|
+
})
|
|
1970
|
+
]
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
function renderHeaderMain() {
|
|
1974
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1975
|
+
"data-clarify-header-main": true,
|
|
1976
|
+
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"),
|
|
1977
|
+
children: [
|
|
1978
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1979
|
+
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
1980
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1981
|
+
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
1982
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
|
|
1983
|
+
config,
|
|
1984
|
+
navigation,
|
|
1985
|
+
tabs,
|
|
1986
|
+
routes,
|
|
1987
|
+
currentLocale,
|
|
1988
|
+
currentRoute
|
|
1989
|
+
})
|
|
1990
|
+
}), renderBrand()]
|
|
1991
|
+
}),
|
|
1992
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1993
|
+
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
1994
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
1995
|
+
routes,
|
|
1996
|
+
navigation,
|
|
1997
|
+
routePrefix: config.routePrefix,
|
|
1998
|
+
currentLocale
|
|
1999
|
+
})
|
|
2000
|
+
}),
|
|
2001
|
+
renderHeaderActions()
|
|
2002
|
+
]
|
|
2003
|
+
});
|
|
2004
|
+
}
|
|
2005
|
+
function renderTopArea() {
|
|
2006
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2007
|
+
ref: topAreaRef,
|
|
2008
|
+
children: [
|
|
2009
|
+
renderHeaderMain(),
|
|
2010
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2011
|
+
"data-clarify-header-banner": true,
|
|
2012
|
+
children: banner
|
|
2013
|
+
}),
|
|
2014
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, { tabs })
|
|
2015
|
+
]
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.header, {
|
|
1845
2019
|
...props,
|
|
1846
2020
|
ref,
|
|
1847
2021
|
"data-pagefind-ignore": true,
|
|
@@ -1850,96 +2024,7 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
|
1850
2024
|
"--bg-opacity-light": bgOpacityLight,
|
|
1851
2025
|
"--bg-opacity-dark": bgOpacityDark
|
|
1852
2026
|
},
|
|
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
|
-
]
|
|
2027
|
+
children: renderTopArea()
|
|
1943
2028
|
});
|
|
1944
2029
|
});
|
|
1945
2030
|
//#endregion
|
|
@@ -2107,12 +2192,6 @@ Object.defineProperty(exports, "resolveLucideIconName", {
|
|
|
2107
2192
|
return resolveLucideIconName;
|
|
2108
2193
|
}
|
|
2109
2194
|
});
|
|
2110
|
-
Object.defineProperty(exports, "safeDecodeURIComponent", {
|
|
2111
|
-
enumerable: true,
|
|
2112
|
-
get: function() {
|
|
2113
|
-
return safeDecodeURIComponent;
|
|
2114
|
-
}
|
|
2115
|
-
});
|
|
2116
2195
|
Object.defineProperty(exports, "storeLocalePreference", {
|
|
2117
2196
|
enumerable: true,
|
|
2118
2197
|
get: function() {
|
|
@@ -2168,4 +2247,4 @@ Object.defineProperty(exports, "useTheme", {
|
|
|
2168
2247
|
}
|
|
2169
2248
|
});
|
|
2170
2249
|
|
|
2171
|
-
//# sourceMappingURL=PageActions-
|
|
2250
|
+
//# sourceMappingURL=PageActions-DEuFHgyB.cjs.map
|