@clarify-labs/renderer 0.6.7 → 0.7.1

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.
Files changed (76) hide show
  1. package/output/{OpenApiOperation-CxQQyEHK.cjs → OpenApiOperation-C4xZu4i0.cjs} +154 -79
  2. package/output/OpenApiOperation-C4xZu4i0.cjs.map +1 -0
  3. package/output/{OpenApiOperation-CI_PeMSy.js → OpenApiOperation-LIL7bqxW.js} +129 -60
  4. package/output/OpenApiOperation-LIL7bqxW.js.map +1 -0
  5. package/output/{shell-D4tS8Jts.cjs → PageActions-1RDCHcUY.cjs} +597 -160
  6. package/output/PageActions-1RDCHcUY.cjs.map +1 -0
  7. package/output/{shell-DvTfFx6M.js → PageActions-yoDRjkq8.js} +531 -148
  8. package/output/PageActions-yoDRjkq8.js.map +1 -0
  9. package/output/{ThemeRoot-DErmHskn.js → ThemeRoot-CLa0yvRQ.js} +302 -106
  10. package/output/ThemeRoot-CLa0yvRQ.js.map +1 -0
  11. package/output/{ThemeRoot-BhP5M3Hd.cjs → ThemeRoot-DYS-lcK-.cjs} +349 -129
  12. package/output/ThemeRoot-DYS-lcK-.cjs.map +1 -0
  13. package/output/app/AppShell.d.ts +5 -2
  14. package/output/app/PageActions.d.ts +12 -0
  15. package/output/app/PageBanner.d.ts +7 -0
  16. package/output/app/PageFooter.d.ts +5 -1
  17. package/output/app/SectionProvider.d.ts +1 -0
  18. package/output/client.cjs +14 -4
  19. package/output/client.d.ts +4 -1
  20. package/output/client.js +4 -3
  21. package/output/components/LocalizedLink.d.ts +6 -0
  22. package/output/components/WebFrame.d.ts +11 -0
  23. package/output/components/index.d.ts +4 -0
  24. package/output/context.d.ts +1 -1
  25. package/output/core/context.d.ts +5 -5
  26. package/output/core/index.d.ts +1 -1
  27. package/output/core/types.d.ts +74 -59
  28. package/output/index.cjs +57 -28
  29. package/output/index.cjs.map +1 -1
  30. package/output/index.d.ts +9 -7
  31. package/output/index.js +37 -12
  32. package/output/index.js.map +1 -1
  33. package/output/mdx/components.d.ts +2 -0
  34. package/output/mdx/primitives.d.ts +3 -2
  35. package/output/preview.cjs +66 -28
  36. package/output/preview.cjs.map +1 -1
  37. package/output/preview.js +63 -25
  38. package/output/preview.js.map +1 -1
  39. package/output/{render-C_NHO3rz.cjs → render-CRTqZzyY.cjs} +10 -8
  40. package/output/render-CRTqZzyY.cjs.map +1 -0
  41. package/output/{render-HeCAMIGm.js → render-D0ls3d2j.js} +8 -6
  42. package/output/render-D0ls3d2j.js.map +1 -0
  43. package/output/renderer.css +575 -280
  44. package/output/server.cjs +10 -8
  45. package/output/server.cjs.map +1 -1
  46. package/output/server.js +7 -5
  47. package/output/server.js.map +1 -1
  48. package/output/shell/ContentActions.d.ts +0 -1
  49. package/output/shell/Header.d.ts +3 -2
  50. package/output/shell/Search.d.ts +4 -0
  51. package/output/shell/SiteLogo.d.ts +2 -2
  52. package/output/shell/mobile.d.ts +2 -2
  53. package/output/shell/search/Highlight.d.ts +11 -0
  54. package/output/shell/search/SearchDialog.d.ts +13 -0
  55. package/output/shell/search/SearchInput.d.ts +8 -0
  56. package/output/shell/search/SearchResult.d.ts +10 -0
  57. package/output/shell/search/items.d.ts +3 -0
  58. package/output/shell/search/pagefind.d.ts +5 -0
  59. package/output/shell/search/types.d.ts +37 -0
  60. package/output/shell/search/useSearchProps.d.ts +10 -0
  61. package/output/theme/ThemeEditor.d.ts +53 -17
  62. package/output/theme/ThemeProvider.d.ts +2 -1
  63. package/output/theme/ThemeRoot.d.ts +2 -2
  64. package/output/theme/cookies.d.ts +11 -0
  65. package/output/theme/randomTheme.d.ts +2 -2
  66. package/output/theme/variables.d.ts +58 -18
  67. package/output/utils/href.d.ts +3 -3
  68. package/package.json +1 -1
  69. package/output/OpenApiOperation-CI_PeMSy.js.map +0 -1
  70. package/output/OpenApiOperation-CxQQyEHK.cjs.map +0 -1
  71. package/output/ThemeRoot-BhP5M3Hd.cjs.map +0 -1
  72. package/output/ThemeRoot-DErmHskn.js.map +0 -1
  73. package/output/render-C_NHO3rz.cjs.map +0 -1
  74. package/output/render-HeCAMIGm.js.map +0 -1
  75. package/output/shell-D4tS8Jts.cjs.map +0 -1
  76. package/output/shell-DvTfFx6M.js.map +0 -1
@@ -10,14 +10,17 @@ let react_jsx_runtime = require("react/jsx-runtime");
10
10
  let framer_motion = require("framer-motion");
11
11
  let zustand = require("zustand");
12
12
  //#region source/core/context.tsx
13
- var ClarifyConfigContext = (0, react.createContext)(null);
14
- var ClarifyLocaleContext = (0, react.createContext)(void 0);
13
+ var ConfigContext = (0, react.createContext)(null);
14
+ var LocaleContext = (0, react.createContext)(void 0);
15
15
  var OpenApisContext = (0, react.createContext)({});
16
- function useClarifyConfig() {
17
- const config = (0, react.useContext)(ClarifyConfigContext);
18
- if (!config) throw new Error("[clarify] useClarifyConfig must be used within a ClarifyConfigContext.Provider");
16
+ function useConfig() {
17
+ const config = (0, react.useContext)(ConfigContext);
18
+ if (!config) throw new Error("[clarify] useConfig must be used within a ConfigContext.Provider");
19
19
  return config;
20
20
  }
21
+ function useLocale() {
22
+ return (0, react.useContext)(LocaleContext);
23
+ }
21
24
  function useOpenApis() {
22
25
  return (0, react.useContext)(OpenApisContext);
23
26
  }
@@ -216,8 +219,8 @@ function translateBuiltInText(locale, key, replacements = {}) {
216
219
  return value;
217
220
  }
218
221
  function useBuiltInText(locale) {
219
- const config = (0, react.useContext)(ClarifyConfigContext);
220
- const currentLocale = (0, react.useContext)(ClarifyLocaleContext);
222
+ const config = (0, react.useContext)(ConfigContext);
223
+ const currentLocale = (0, react.useContext)(LocaleContext);
221
224
  const resolvedLocale = locale ?? currentLocale ?? config?.i18n?.defaultLocale;
222
225
  return (key, replacements) => translateBuiltInText(resolvedLocale, key, replacements);
223
226
  }
@@ -279,7 +282,7 @@ function getAbsoluteUrl(path) {
279
282
  return new URL(path, window.location.href).href;
280
283
  }
281
284
  function ContentActions(arg0) {
282
- const { hasTabs = false, route, routePrefix } = arg0;
285
+ const { route, routePrefix } = arg0;
283
286
  const t = useBuiltInText();
284
287
  const [copied, setCopied] = (0, react.useState)("idle");
285
288
  if (!route?.contentArtifactUrl && !route?.sourceUrl) return null;
@@ -330,29 +333,36 @@ function ContentActions(arg0) {
330
333
  const primaryAction = actions[0];
331
334
  const PrimaryIcon = primaryAction && copied === primaryAction.key ? lucide_react.Check : primaryAction?.icon ?? lucide_react.PencilLine;
332
335
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
333
- className: `clarify-content-actions sticky z-20 flex justify-end py-4 ${hasTabs ? "top-16 lg:top-30" : "top-16"}`,
336
+ className: "clarify-content-actions not-prose flex shrink-0 justify-start sm:justify-end",
334
337
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Menu, {
335
338
  as: "div",
336
- className: "clarify-content-actions-menu relative inline-flex text-sm font-medium",
339
+ className: "clarify-content-actions-menu relative inline-flex min-w-0 text-sm font-medium",
337
340
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
338
- className: "clarify-content-actions-group inline-flex overflow-hidden rounded-full border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface)/90 shadow-sm shadow-zinc-900/5 backdrop-blur",
341
+ className: "clarify-content-actions-group inline-flex min-w-0 overflow-hidden rounded-full border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) shadow-sm shadow-zinc-900/5",
339
342
  children: [primaryAction ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
340
343
  type: "button",
341
344
  onClick: primaryAction.run,
342
- className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 items-center gap-1.5 px-3 transition",
343
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrimaryIcon, { className: "h-3.5 w-3.5" }), copied === primaryAction.key ? t("actions.copied") : primaryAction.label]
345
+ className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 min-w-0 items-center gap-1.5 px-2.5 transition sm:px-3",
346
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrimaryIcon, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
347
+ className: "truncate",
348
+ children: copied === primaryAction.key ? t("actions.copied") : primaryAction.label
349
+ })]
344
350
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
345
351
  href: route.sourceUrl,
346
352
  target: "_blank",
347
353
  rel: "noreferrer",
348
- className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 items-center gap-1.5 px-3 no-underline transition",
349
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrimaryIcon, { className: "h-3.5 w-3.5" }), t("contentActions.editPage")]
354
+ className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 min-w-0 items-center gap-1.5 px-2.5 no-underline transition sm:px-3",
355
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PrimaryIcon, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
356
+ className: "truncate",
357
+ children: t("contentActions.editPage")
358
+ })]
350
359
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuButton, {
351
360
  className: "clarify-content-actions-trigger clarify-ui-control inline-flex h-8 w-8 items-center justify-center border-l border-(--clarify-theme-tokens-colors-border) transition",
352
361
  "aria-label": t("contentActions.copyOptions"),
353
362
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "h-3.5 w-3.5" })
354
363
  })]
355
364
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.MenuItems, {
365
+ modal: false,
356
366
  anchor: "bottom end",
357
367
  className: "clarify-content-actions-list clarify-ui-menu z-30 mt-2 w-(--clarify-ui-action-menu-width) origin-top-right rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-1.5 shadow-xl shadow-zinc-900/5 transition [--anchor-gap:--spacing(2)] focus:outline-none data-closed:scale-95 data-closed:opacity-0",
358
368
  children: [
@@ -482,27 +492,116 @@ function ContentActions(arg0) {
482
492
  });
483
493
  }
484
494
  //#endregion
495
+ //#region source/theme/cookies.ts
496
+ var themeCookieName = "clarify-theme";
497
+ var localeCookieName = "clarify-locale";
498
+ var preferenceCookieMaxAge = 3600 * 24 * 365;
499
+ var cookiePath = "/";
500
+ function isThemePreference(value) {
501
+ return value === "light" || value === "dark" || value === "system";
502
+ }
503
+ function readThemeCookie() {
504
+ if (typeof document === "undefined") return null;
505
+ const value = readCookieValue(themeCookieName);
506
+ return isThemePreference(value) ? value : null;
507
+ }
508
+ function getStoredThemePreference() {
509
+ return readThemeCookie() ?? "system";
510
+ }
511
+ function storeThemePreference(theme) {
512
+ storeSharedPreferenceCookie(themeCookieName, theme);
513
+ }
514
+ function readLocaleCookie() {
515
+ if (typeof document === "undefined") return null;
516
+ return readCookieValue(localeCookieName);
517
+ }
518
+ function getStoredLocalePreference(locales) {
519
+ const locale = readLocaleCookie();
520
+ if (!locale) return null;
521
+ return locales && !locales.includes(locale) ? null : locale;
522
+ }
523
+ function storeLocalePreference(locale) {
524
+ storeSharedPreferenceCookie(localeCookieName, locale);
525
+ }
526
+ function storeSharedPreferenceCookie(name, value) {
527
+ if (typeof document === "undefined") return;
528
+ const domains = resolveSharedCookieDomains();
529
+ const domain = resolveWritableSharedCookieDomain(domains, name);
530
+ deleteCookie(name);
531
+ for (const candidateDomain of domains) deleteCookie(name, { domain: candidateDomain });
532
+ writeCookie(name, value, {
533
+ domain: domain ?? void 0,
534
+ maxAge: preferenceCookieMaxAge
535
+ });
536
+ }
537
+ function resolveSharedCookieDomains(hostname = typeof window !== "undefined" ? window.location.hostname : "") {
538
+ const normalizedHostname = hostname.toLowerCase().replace(/\.$/, "");
539
+ if (!normalizedHostname || normalizedHostname === "localhost" || normalizedHostname.endsWith(".localhost") || isIpAddress(normalizedHostname)) return [];
540
+ const parts = normalizedHostname.split(".");
541
+ if (parts.length < 2) return [];
542
+ const domains = [];
543
+ for (let index = parts.length - 2; index >= 0; index -= 1) domains.push(parts.slice(index).join("."));
544
+ return domains;
545
+ }
546
+ function resolveWritableSharedCookieDomain(domains, probePrefix = themeCookieName) {
547
+ for (const domain of domains) {
548
+ const probeName = `${probePrefix}-probe-${Date.now()}-${Math.random().toString(36).slice(2)}`;
549
+ const probeValue = "1";
550
+ writeCookie(probeName, probeValue, {
551
+ domain,
552
+ maxAge: 60
553
+ });
554
+ const isWritable = readCookieValue(probeName) === probeValue;
555
+ deleteCookie(probeName, { domain });
556
+ if (isWritable) return domain;
557
+ }
558
+ return null;
559
+ }
560
+ function readCookieValue(cookieName) {
561
+ const cookies = document.cookie ? document.cookie.split("; ") : [];
562
+ for (const cookie of cookies) {
563
+ const separatorIndex = cookie.indexOf("=");
564
+ const name = separatorIndex === -1 ? cookie : cookie.slice(0, separatorIndex);
565
+ if (decodeURIComponent(name) !== cookieName) continue;
566
+ return separatorIndex === -1 ? "" : decodeURIComponent(cookie.slice(separatorIndex + 1));
567
+ }
568
+ return null;
569
+ }
570
+ function deleteCookie(name, options = {}) {
571
+ writeCookie(name, "", {
572
+ domain: options.domain,
573
+ maxAge: 0
574
+ });
575
+ }
576
+ function writeCookie(name, value, options) {
577
+ const attributes = [
578
+ `${encodeURIComponent(name)}=${encodeURIComponent(value)}`,
579
+ `Path=${cookiePath}`,
580
+ `Max-Age=${options.maxAge}`,
581
+ "SameSite=Lax"
582
+ ];
583
+ if (options.domain) attributes.push(`Domain=.${options.domain}`);
584
+ if (typeof window !== "undefined" && window.location.protocol === "https:") attributes.push("Secure");
585
+ try {
586
+ document.cookie = attributes.join("; ");
587
+ } catch {}
588
+ }
589
+ function isIpAddress(hostname) {
590
+ return /^\d{1,3}(?:\.\d{1,3}){3}$/.test(hostname) || hostname.includes(":");
591
+ }
592
+ //#endregion
485
593
  //#region source/theme/ThemeProvider.tsx
486
594
  var ThemeContext = (0, react.createContext)(null);
487
- var storageKey = "clarify:theme";
488
595
  function getSystemTheme() {
489
596
  if (typeof window === "undefined") return "light";
490
597
  return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
491
598
  }
492
599
  function getStoredTheme() {
493
600
  if (typeof window === "undefined") return "system";
494
- try {
495
- const storedTheme = window.localStorage.getItem(storageKey);
496
- return storedTheme === "light" || storedTheme === "dark" || storedTheme === "system" ? storedTheme : "system";
497
- } catch {
498
- return "system";
499
- }
601
+ return getStoredThemePreference();
500
602
  }
501
603
  function storeTheme(theme) {
502
- if (typeof window === "undefined") return;
503
- try {
504
- window.localStorage.setItem(storageKey, theme);
505
- } catch {}
604
+ storeThemePreference(theme);
506
605
  }
507
606
  function applyTheme(resolvedTheme) {
508
607
  if (typeof document === "undefined") return;
@@ -739,7 +838,7 @@ function SectionBadge(arg0) {
739
838
  });
740
839
  }
741
840
  function NavLink(arg0) {
742
- const { href, children, badge, icon, active = false, isAnchorLink = false } = arg0;
841
+ const { href, children, badge, icon, active = false, isAnchorLink = false, level } = arg0;
743
842
  function handleClick() {
744
843
  if (!isAnchorLink) return;
745
844
  const hashIndex = href.indexOf("#");
@@ -757,7 +856,8 @@ function NavLink(arg0) {
757
856
  to: href,
758
857
  "aria-current": active ? "page" : void 0,
759
858
  onClick: handleClick,
760
- 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-7" : "pl-4"),
859
+ 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"),
860
+ style: isAnchorLink ? { paddingLeft: `${1.75 + Math.max(0, (level ?? 2) - 2) * .75}rem` } : void 0,
761
861
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
762
862
  className: "flex min-w-0 flex-1 items-center gap-2",
763
863
  children: [
@@ -846,7 +946,7 @@ function NavigationGroup(arg0) {
846
946
  const [pathname, sections] = useInitialValue([normalizeRoutePath((0, react_router_dom.useLocation)().pathname), useSectionStore((s) => s.sections)], isInsideMobileNavigation);
847
947
  const isActiveGroup = group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) !== -1;
848
948
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
849
- className: (0, clsx.default)("clarify-navigation-group relative mt-6", className),
949
+ className: (0, clsx.default)("clarify-navigation-group relative mb-6", className),
850
950
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", {
851
951
  className: "clarify-navigation-group-title flex items-center gap-2",
852
952
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationIcon, {
@@ -901,6 +1001,7 @@ function NavigationGroup(arg0) {
901
1001
  badge: section.badge,
902
1002
  tags: section.tags,
903
1003
  isAnchorLink: true,
1004
+ level: section.level,
904
1005
  children: section.title
905
1006
  }) }, section.id))
906
1007
  }) : null
@@ -1045,7 +1146,7 @@ function MobileNavigation(arg0) {
1045
1146
  });
1046
1147
  }
1047
1148
  //#endregion
1048
- //#region source/shell/Search.tsx
1149
+ //#region source/shell/search/items.ts
1049
1150
  function routeGroupTitles(navigation) {
1050
1151
  const titles = /* @__PURE__ */ new Map();
1051
1152
  for (const node of navigation) if (node.children?.length) for (const child of node.children) titles.set(child.path, node.title);
@@ -1082,53 +1183,85 @@ function buildSearchItems(routes, navigation) {
1082
1183
  })) ?? []];
1083
1184
  });
1084
1185
  }
1085
- function escapeRegExp(value) {
1086
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1087
- }
1088
- function HighlightQuery(arg0) {
1089
- const { text, query } = arg0;
1090
- if (!query) return text;
1091
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: text.split(new RegExp(`(${escapeRegExp(query)})`, "ig")).map((part, index) => part.toLowerCase() === query.toLowerCase() ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
1092
- className: "bg-transparent text-(--clarify-theme-tokens-colors-primary) underline",
1093
- children: part
1094
- }, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: part }, index)) });
1186
+ //#endregion
1187
+ //#region source/shell/search/pagefind.ts
1188
+ var pagefindPromises = /* @__PURE__ */ new Map();
1189
+ function pagefindCacheKey(routePrefix, locale) {
1190
+ return `${routePrefix || "/"}:${locale || "default"}`;
1095
1191
  }
1096
- function SearchResult(arg0) {
1097
- const { result, query, active, onSelect } = arg0;
1098
- const id = (0, react.useId)();
1099
- const hierarchy = [result.sectionTitle, result.pageTitle].filter((value) => typeof value === "string");
1100
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1101
- id,
1102
- className: (0, clsx.default)("clarify-search-result group block cursor-default px-4 py-3", active && "clarify-search-result-active"),
1103
- "aria-selected": active,
1104
- onMouseDown: (event) => {
1105
- event.preventDefault();
1106
- onSelect();
1107
- },
1108
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1109
- className: "clarify-search-result-title",
1110
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
1111
- text: result.title,
1112
- query
1113
- })
1114
- }), hierarchy.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1115
- className: "clarify-search-result-hierarchy mt-1 truncate whitespace-nowrap",
1116
- children: hierarchy.map((item, itemIndex, items) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
1117
- text: item,
1118
- query
1119
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1120
- className: itemIndex === items.length - 1 ? "sr-only" : "clarify-search-result-separator mx-2",
1121
- children: "/"
1122
- })] }, `${item}-${itemIndex}`))
1123
- }) : null]
1192
+ function logSearchDebug(message, data) {
1193
+ if (typeof window === "undefined") return;
1194
+ console.info(`[clarify:search] ${message}`, data ?? "");
1195
+ }
1196
+ function loadPagefind(routePrefix, locale) {
1197
+ if (typeof window === "undefined") return Promise.resolve(null);
1198
+ const language = locale ?? document.documentElement.lang;
1199
+ const cacheKey = pagefindCacheKey(routePrefix, language);
1200
+ const cachedPagefind = pagefindPromises.get(cacheKey);
1201
+ if (cachedPagefind) {
1202
+ logSearchDebug("reuse Pagefind instance promise", {
1203
+ cacheKey,
1204
+ language,
1205
+ routePrefix
1206
+ });
1207
+ return cachedPagefind;
1208
+ }
1209
+ const pagefindUrl = prefixHref("/pagefind/pagefind.js", routePrefix);
1210
+ logSearchDebug("create Pagefind instance promise", {
1211
+ cacheKey,
1212
+ language,
1213
+ pagefindUrl,
1214
+ routePrefix
1215
+ });
1216
+ const pagefindPromise = import(
1217
+ /* @vite-ignore */
1218
+ pagefindUrl
1219
+ ).then(async (module) => {
1220
+ const previousLanguage = document.documentElement.lang;
1221
+ if (language) document.documentElement.lang = language;
1222
+ logSearchDebug("create Pagefind instance", {
1223
+ cacheKey,
1224
+ detectedLanguage: document.documentElement.lang,
1225
+ previousLanguage
1226
+ });
1227
+ const pagefind = module.createInstance();
1228
+ if (previousLanguage && previousLanguage !== language) document.documentElement.lang = previousLanguage;
1229
+ await pagefind.init?.();
1230
+ logSearchDebug("Pagefind instance ready", {
1231
+ cacheKey,
1232
+ language
1233
+ });
1234
+ return pagefind;
1235
+ }).catch((error) => {
1236
+ pagefindPromises.delete(cacheKey);
1237
+ console.warn("[clarify:search] Pagefind instance failed", {
1238
+ cacheKey,
1239
+ language,
1240
+ error
1241
+ });
1242
+ return null;
1124
1243
  });
1244
+ pagefindPromises.set(cacheKey, pagefindPromise);
1245
+ return pagefindPromise;
1246
+ }
1247
+ function normalizePagefindUrl(url, routePrefix) {
1248
+ const parsedUrl = new URL(url, window.location.origin);
1249
+ let pathname = parsedUrl.pathname;
1250
+ const prefix = routePrefix && routePrefix !== "/" ? `/${routePrefix.replace(/^\/+|\/+$/g, "")}` : "";
1251
+ if (prefix && (pathname === prefix || pathname.startsWith(`${prefix}/`))) pathname = pathname.slice(prefix.length) || "/";
1252
+ return `${pathname}${parsedUrl.search}${parsedUrl.hash}`;
1125
1253
  }
1254
+ //#endregion
1255
+ //#region source/shell/search/SearchInput.tsx
1126
1256
  var SearchInput = (0, react.forwardRef)(function SearchInput(arg0, inputRef) {
1127
- const { query, setQuery, onClose, onSubmit, activeDescendantId } = arg0;
1257
+ const { query, setQuery, onClose, onSubmit, activeDescendantId, loading = false } = arg0;
1128
1258
  const t = useBuiltInText();
1129
1259
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1130
1260
  className: "clarify-search-input group relative flex h-12",
1131
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Search, { className: "pointer-events-none absolute top-0 left-3 h-full w-5 stroke-(--clarify-theme-tokens-colors-muted)" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1261
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(loading ? lucide_react.LoaderCircle : lucide_react.Search, {
1262
+ "aria-hidden": "true",
1263
+ className: (0, clsx.default)("pointer-events-none absolute top-0 left-3 h-full w-5 stroke-(--clarify-theme-tokens-colors-muted)", loading && "animate-spin")
1264
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1132
1265
  ref: inputRef,
1133
1266
  "data-autofocus": true,
1134
1267
  role: "combobox",
@@ -1150,20 +1283,120 @@ var SearchInput = (0, react.forwardRef)(function SearchInput(arg0, inputRef) {
1150
1283
  })]
1151
1284
  });
1152
1285
  });
1286
+ //#endregion
1287
+ //#region source/shell/search/Highlight.tsx
1288
+ function stripHtml(value) {
1289
+ if (typeof document === "undefined") return value.replace(/<[^>]*>/g, "");
1290
+ const template = document.createElement("template");
1291
+ template.innerHTML = value;
1292
+ return template.content.textContent ?? "";
1293
+ }
1294
+ function escapeRegExp(value) {
1295
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1296
+ }
1297
+ function HighlightQuery(arg0) {
1298
+ const { text, query } = arg0;
1299
+ if (!query) return text;
1300
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: text.split(new RegExp(`(${escapeRegExp(query)})`, "ig")).map((part, index) => part.toLowerCase() === query.toLowerCase() ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
1301
+ className: "bg-transparent text-(--clarify-theme-tokens-colors-primary) underline",
1302
+ children: part
1303
+ }, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: part }, index)) });
1304
+ }
1305
+ function renderExcerptNode(node, key) {
1306
+ if (node.nodeType === Node.TEXT_NODE) return node.textContent;
1307
+ if (node.nodeType !== Node.ELEMENT_NODE) return null;
1308
+ const element = node;
1309
+ const children = Array.from(element.childNodes).map((child, index) => renderExcerptNode(child, `${key}-${index}`));
1310
+ if (element.tagName.toLowerCase() === "mark") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
1311
+ className: "bg-transparent text-(--clarify-theme-tokens-colors-primary) underline",
1312
+ children
1313
+ }, key);
1314
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children }, key);
1315
+ }
1316
+ function HighlightExcerpt(arg0) {
1317
+ const { excerpt, query } = arg0;
1318
+ if (typeof document === "undefined" || !excerpt.includes("<mark")) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
1319
+ text: stripHtml(excerpt),
1320
+ query
1321
+ });
1322
+ const template = document.createElement("template");
1323
+ template.innerHTML = excerpt;
1324
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: Array.from(template.content.childNodes).map((node, index) => renderExcerptNode(node, String(index))) });
1325
+ }
1326
+ //#endregion
1327
+ //#region source/shell/search/SearchResult.tsx
1328
+ function SearchResult(arg0) {
1329
+ const { result, query, active, onActive, onSelect } = arg0;
1330
+ const id = (0, react.useId)();
1331
+ const hierarchy = result.type === "quick" ? [result.sectionTitle, result.pageTitle].filter((value) => typeof value === "string") : [];
1332
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1333
+ id,
1334
+ className: (0, clsx.default)("clarify-search-result group block cursor-pointer px-4 py-3", active && "clarify-search-result-active"),
1335
+ "aria-selected": active,
1336
+ onMouseEnter: onActive,
1337
+ onMouseMove: onActive,
1338
+ onMouseDown: (event) => {
1339
+ event.preventDefault();
1340
+ onSelect();
1341
+ },
1342
+ children: [
1343
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1344
+ className: "clarify-search-result-title",
1345
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
1346
+ text: result.title,
1347
+ query
1348
+ })
1349
+ }),
1350
+ hierarchy.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1351
+ className: "clarify-search-result-hierarchy mt-1 truncate whitespace-nowrap",
1352
+ children: hierarchy.map((item, itemIndex, items) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
1353
+ text: item,
1354
+ query
1355
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1356
+ className: itemIndex === items.length - 1 ? "sr-only" : "clarify-search-result-separator mx-2",
1357
+ children: "/"
1358
+ })] }, `${item}-${itemIndex}`))
1359
+ }) : null,
1360
+ result.type === "full-text" && result.excerpt ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1361
+ className: "clarify-search-result-excerpt mt-1 line-clamp-2 text-xs leading-5 text-(--clarify-theme-tokens-colors-muted)",
1362
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightExcerpt, {
1363
+ excerpt: result.excerpt,
1364
+ query
1365
+ })
1366
+ }) : null
1367
+ ]
1368
+ });
1369
+ }
1370
+ //#endregion
1371
+ //#region source/shell/search/SearchDialog.tsx
1153
1372
  function SearchDialog(arg0) {
1154
- const { open, setOpen, routes, navigation, className, onNavigate = () => {} } = arg0;
1373
+ const { open, setOpen, routes, navigation, routePrefix = "/", currentLocale, className, onNavigate = () => {} } = arg0;
1155
1374
  const t = useBuiltInText();
1156
1375
  const navigate = (0, react_router_dom.useNavigate)();
1157
1376
  const location = (0, react_router_dom.useLocation)();
1158
1377
  const inputRef = (0, react.useRef)(null);
1159
1378
  const [query, setQuery] = (0, react.useState)("");
1160
1379
  const [activeIndex, setActiveIndex] = (0, react.useState)(0);
1380
+ const [fullTextState, setFullTextState] = (0, react.useState)(null);
1381
+ const [pagefindState, setPagefindState] = (0, react.useState)(null);
1161
1382
  const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
1162
- const results = (0, react.useMemo)(() => {
1383
+ const quickResults = (0, react.useMemo)(() => {
1163
1384
  const normalizedQuery = query.trim().toLowerCase();
1164
1385
  if (!normalizedQuery) return [];
1165
- return searchItems.filter((item) => item.keywords.includes(normalizedQuery)).slice(0, 8);
1386
+ return searchItems.filter((item) => item.keywords.includes(normalizedQuery)).slice(0, 8).map((item) => ({
1387
+ ...item,
1388
+ type: "quick"
1389
+ }));
1166
1390
  }, [query, searchItems]);
1391
+ const pagefindKey = pagefindCacheKey(routePrefix, currentLocale);
1392
+ const activePagefindState = pagefindState?.key === pagefindKey ? pagefindState : null;
1393
+ const pagefind = activePagefindState?.pagefind ?? null;
1394
+ const pagefindAvailable = activePagefindState?.available ?? null;
1395
+ const trimmedQuery = query.trim();
1396
+ const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
1397
+ const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
1398
+ const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey);
1399
+ const showNoResults = query && results.length === 0 && pagefindAvailable !== null;
1167
1400
  (0, react.useEffect)(() => {
1168
1401
  setOpen(false);
1169
1402
  }, [
@@ -1172,6 +1405,98 @@ function SearchDialog(arg0) {
1172
1405
  location.hash,
1173
1406
  setOpen
1174
1407
  ]);
1408
+ (0, react.useEffect)(() => {
1409
+ let cancelled = false;
1410
+ logSearchDebug("locale or route prefix changed; reload Pagefind", {
1411
+ currentLocale,
1412
+ routePrefix,
1413
+ documentLanguage: document.documentElement.lang
1414
+ });
1415
+ loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
1416
+ if (cancelled) {
1417
+ logSearchDebug("ignore stale Pagefind load", {
1418
+ currentLocale,
1419
+ routePrefix
1420
+ });
1421
+ return;
1422
+ }
1423
+ logSearchDebug("Pagefind load applied", {
1424
+ currentLocale,
1425
+ routePrefix,
1426
+ available: Boolean(loadedPagefind)
1427
+ });
1428
+ setPagefindState({
1429
+ key: pagefindKey,
1430
+ pagefind: loadedPagefind,
1431
+ available: Boolean(loadedPagefind)
1432
+ });
1433
+ });
1434
+ return () => {
1435
+ cancelled = true;
1436
+ logSearchDebug("cancel Pagefind load effect", {
1437
+ currentLocale,
1438
+ routePrefix
1439
+ });
1440
+ };
1441
+ }, [
1442
+ currentLocale,
1443
+ pagefindKey,
1444
+ routePrefix
1445
+ ]);
1446
+ (0, react.useEffect)(() => {
1447
+ let cancelled = false;
1448
+ if (!trimmedQuery || !pagefind) return void 0;
1449
+ Promise.resolve().then(async () => {
1450
+ if (cancelled) return;
1451
+ try {
1452
+ logSearchDebug("run Pagefind search", {
1453
+ currentLocale,
1454
+ query: trimmedQuery,
1455
+ routePrefix
1456
+ });
1457
+ const search = await pagefind.search(trimmedQuery, { limit: 8 });
1458
+ const data = await Promise.all(search.results.map(async (result) => ({
1459
+ id: result.id,
1460
+ data: await result.data()
1461
+ })));
1462
+ if (cancelled) return;
1463
+ logSearchDebug("Pagefind search results", {
1464
+ currentLocale,
1465
+ query: trimmedQuery,
1466
+ count: data.length
1467
+ });
1468
+ setFullTextState({
1469
+ key: fullTextKey,
1470
+ results: data.map(({ id, data }) => ({
1471
+ type: "full-text",
1472
+ id,
1473
+ title: data.meta.title || data.url,
1474
+ url: normalizePagefindUrl(data.url, routePrefix),
1475
+ excerpt: data.excerpt
1476
+ }))
1477
+ });
1478
+ } catch (error) {
1479
+ console.warn("[clarify:search] Pagefind search failed", {
1480
+ currentLocale,
1481
+ query: trimmedQuery,
1482
+ error
1483
+ });
1484
+ if (!cancelled) setFullTextState({
1485
+ key: fullTextKey,
1486
+ results: null
1487
+ });
1488
+ }
1489
+ });
1490
+ return () => {
1491
+ cancelled = true;
1492
+ };
1493
+ }, [
1494
+ currentLocale,
1495
+ fullTextKey,
1496
+ pagefind,
1497
+ routePrefix,
1498
+ trimmedQuery
1499
+ ]);
1175
1500
  (0, react.useEffect)(() => {
1176
1501
  if (open) return void 0;
1177
1502
  function onKeyDown(event) {
@@ -1224,10 +1549,11 @@ function SearchDialog(arg0) {
1224
1549
  query,
1225
1550
  setQuery: updateQuery,
1226
1551
  onClose: closeDialog,
1227
- onSubmit: () => selectResult()
1552
+ onSubmit: () => selectResult(),
1553
+ loading: searchInputLoading
1228
1554
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1229
1555
  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",
1230
- children: [query && results.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1556
+ children: [showNoResults ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1231
1557
  className: "p-6 text-center",
1232
1558
  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", {
1233
1559
  className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
@@ -1241,14 +1567,17 @@ function SearchDialog(arg0) {
1241
1567
  result,
1242
1568
  query,
1243
1569
  active: resultIndex === activeIndex,
1570
+ onActive: () => setActiveIndex(resultIndex),
1244
1571
  onSelect: () => selectResult(result)
1245
- }, result.url))
1572
+ }, result.type === "full-text" ? result.id : result.url))
1246
1573
  }) : null]
1247
1574
  })]
1248
1575
  })
1249
1576
  })]
1250
1577
  });
1251
1578
  }
1579
+ //#endregion
1580
+ //#region source/shell/search/useSearchProps.ts
1252
1581
  function useSearchProps() {
1253
1582
  const buttonRef = (0, react.useRef)(null);
1254
1583
  const [open, setOpen] = (0, react.useState)(false);
@@ -1265,12 +1594,14 @@ function useSearchProps() {
1265
1594
  }
1266
1595
  };
1267
1596
  }
1597
+ //#endregion
1598
+ //#region source/shell/Search.tsx
1268
1599
  function getModifierKey() {
1269
1600
  if (typeof navigator === "undefined") return "Ctrl ";
1270
1601
  return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? "⌘" : "Ctrl ";
1271
1602
  }
1272
1603
  function Search(arg0) {
1273
- const { routes, navigation } = arg0;
1604
+ const { routes, navigation, routePrefix, currentLocale } = arg0;
1274
1605
  const t = useBuiltInText();
1275
1606
  const modifierKey = getModifierKey();
1276
1607
  const { buttonProps, dialogProps } = useSearchProps();
@@ -1300,13 +1631,15 @@ function Search(arg0) {
1300
1631
  className: "hidden lg:block",
1301
1632
  routes,
1302
1633
  navigation,
1634
+ routePrefix,
1635
+ currentLocale,
1303
1636
  ...dialogProps
1304
1637
  })
1305
1638
  })]
1306
1639
  });
1307
1640
  }
1308
1641
  function MobileSearch(arg0) {
1309
- const { routes, navigation, onNavigate } = arg0;
1642
+ const { routes, navigation, routePrefix, currentLocale, onNavigate } = arg0;
1310
1643
  const t = useBuiltInText();
1311
1644
  const { buttonProps, dialogProps } = useSearchProps();
1312
1645
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
@@ -1323,6 +1656,8 @@ function MobileSearch(arg0) {
1323
1656
  className: "lg:hidden",
1324
1657
  routes,
1325
1658
  navigation,
1659
+ routePrefix,
1660
+ currentLocale,
1326
1661
  onNavigate,
1327
1662
  ...dialogProps
1328
1663
  })
@@ -1401,6 +1736,7 @@ function LanguageSwitcher(arg0) {
1401
1736
  const selected = locale.code === selectedLocale;
1402
1737
  return [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: ({ focus }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
1403
1738
  to: `${localizedPath}${suffix}`,
1739
+ onClick: () => storeLocalePreference(locale.code),
1404
1740
  className: (0, clsx.default)("clarify-language-switcher-item clarify-ui-menu-item flex items-center justify-between rounded-(--clarify-theme-tokens-radius-lg) px-3 py-2 no-underline transition", focus && "clarify-ui-menu-item-focus", selected && "clarify-ui-menu-item-active"),
1405
1741
  "aria-current": selected ? "true" : void 0,
1406
1742
  lang: locale.code,
@@ -1429,6 +1765,10 @@ function TopLevelNavItem(arg0) {
1429
1765
  children
1430
1766
  }) });
1431
1767
  }
1768
+ function resolveHomeHref(config, currentLocale) {
1769
+ const homeUrl = config.homeUrl ?? "/";
1770
+ return isExternalHref(homeUrl) ? homeUrl : localizeHref(homeUrl, config, currentLocale);
1771
+ }
1432
1772
  function MobileNavbarMenu(arg0) {
1433
1773
  const { links, config, currentLocale } = arg0;
1434
1774
  const t = useBuiltInText();
@@ -1510,116 +1850,153 @@ function ProductTabs(arg0) {
1510
1850
  });
1511
1851
  }
1512
1852
  var Header = (0, react.forwardRef)(function Header(arg0, ref) {
1513
- const { config, navigation, tabs, routes, currentLocale, currentRoute, className, ...props } = arg0;
1853
+ const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
1514
1854
  const t = useBuiltInText();
1515
1855
  const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
1516
1856
  const isInsideMobileNavigation = useIsInsideMobileNavigation();
1857
+ const homeHref = resolveHomeHref(config, currentLocale);
1858
+ const homeExternal = isExternalHref(homeHref);
1517
1859
  const { scrollY } = (0, framer_motion.useScroll)();
1518
1860
  const bgOpacityLight = (0, framer_motion.useTransform)(scrollY, [0, 72], ["70%", "95%"]);
1519
1861
  const bgOpacityDark = (0, framer_motion.useTransform)(scrollY, [0, 72], ["60%", "92%"]);
1520
1862
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.header, {
1521
1863
  ...props,
1522
1864
  ref,
1865
+ "data-pagefind-ignore": true,
1523
1866
  className: (0, clsx.default)(className, "clarify-header fixed inset-x-0 top-0 z-50 border-b border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background)/(--bg-opacity-light) backdrop-blur-xs transition dark:border-white/10 dark:bg-zinc-950/(--bg-opacity-dark) dark:backdrop-blur-sm", isInsideMobileNavigation && "bg-(--clarify-theme-tokens-colors-background) dark:bg-zinc-950"),
1524
1867
  style: {
1525
1868
  "--bg-opacity-light": bgOpacityLight,
1526
1869
  "--bg-opacity-dark": bgOpacityDark
1527
1870
  },
1528
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1529
- 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"),
1530
- children: [
1531
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1532
- className: "clarify-header-left flex min-w-0 items-center gap-5",
1533
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1534
- className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
1535
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
1536
- config,
1537
- navigation,
1538
- tabs,
1539
- routes,
1540
- currentLocale,
1541
- currentRoute
1542
- })
1543
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
1544
- as: react_router_dom.Link,
1545
- to: localizeHref("/", config, currentLocale),
1546
- "aria-label": t("navbar.home"),
1547
- className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
1548
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
1549
- logo: config.logo,
1550
- className: "h-6 w-6 shrink-0"
1551
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1552
- className: "clarify-brand-title truncate font-semibold",
1553
- children: config.title
1554
- })]
1555
- })]
1556
- }),
1557
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1558
- className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
1559
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
1560
- routes,
1561
- navigation
1562
- })
1563
- }),
1564
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1565
- className: "clarify-header-actions flex shrink-0 items-center gap-5",
1566
- children: [
1567
- config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
1568
- className: "clarify-top-nav hidden md:block",
1569
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1570
- role: "list",
1571
- className: "flex items-center gap-8",
1572
- children: config.navbar.links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
1573
- href: localizeHref(link.href, config, currentLocale),
1574
- children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
1575
- }, link.href))
1871
+ children: [
1872
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1873
+ 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"),
1874
+ children: [
1875
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1876
+ className: "clarify-header-left flex min-w-0 items-center gap-5",
1877
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1878
+ className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
1879
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
1880
+ config,
1881
+ navigation,
1882
+ tabs,
1883
+ routes,
1884
+ currentLocale,
1885
+ currentRoute
1576
1886
  })
1577
- }) : null,
1578
- 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,
1579
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSearch, {
1887
+ }), homeExternal ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
1888
+ as: "a",
1889
+ href: homeHref,
1890
+ "aria-label": t("navbar.home"),
1891
+ className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
1892
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
1893
+ logo: config.logo,
1894
+ className: "h-6 w-auto shrink-0 object-contain"
1895
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1896
+ className: "clarify-brand-title truncate font-semibold",
1897
+ children: config.title
1898
+ })]
1899
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
1900
+ as: react_router_dom.Link,
1901
+ to: homeHref,
1902
+ "aria-label": t("navbar.home"),
1903
+ className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
1904
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
1905
+ logo: config.logo,
1906
+ className: "h-6 w-auto shrink-0 object-contain"
1907
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1908
+ className: "clarify-brand-title truncate font-semibold",
1909
+ children: config.title
1910
+ })]
1911
+ })]
1912
+ }),
1913
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1914
+ className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
1915
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
1580
1916
  routes,
1581
- navigation
1582
- }),
1583
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
1584
- config,
1585
- currentLocale,
1586
- currentRoute
1587
- }),
1588
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {}),
1589
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavbarMenu, {
1590
- links: config.navbar?.links,
1591
- config,
1917
+ navigation,
1918
+ routePrefix: config.routePrefix,
1592
1919
  currentLocale
1593
1920
  })
1594
- ]
1595
- })
1596
- ]
1597
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, { tabs })]
1921
+ }),
1922
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1923
+ className: "clarify-header-actions flex shrink-0 items-center gap-5",
1924
+ children: [
1925
+ config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
1926
+ className: "clarify-top-nav hidden md:block",
1927
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1928
+ role: "list",
1929
+ className: "flex items-center gap-8",
1930
+ children: config.navbar.links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
1931
+ href: localizeHref(link.href, config, currentLocale),
1932
+ children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
1933
+ }, link.href))
1934
+ })
1935
+ }) : null,
1936
+ 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,
1937
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSearch, {
1938
+ routes,
1939
+ navigation,
1940
+ routePrefix: config.routePrefix,
1941
+ currentLocale
1942
+ }),
1943
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
1944
+ config,
1945
+ currentLocale,
1946
+ currentRoute
1947
+ }),
1948
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {}),
1949
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavbarMenu, {
1950
+ links: config.navbar?.links,
1951
+ config,
1952
+ currentLocale
1953
+ })
1954
+ ]
1955
+ })
1956
+ ]
1957
+ }),
1958
+ banner,
1959
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, { tabs })
1960
+ ]
1598
1961
  });
1599
1962
  });
1600
1963
  //#endregion
1601
- Object.defineProperty(exports, "ClarifyConfigContext", {
1602
- enumerable: true,
1603
- get: function() {
1604
- return ClarifyConfigContext;
1605
- }
1606
- });
1607
- Object.defineProperty(exports, "ClarifyLocaleContext", {
1964
+ //#region source/app/PageActions.tsx
1965
+ var PageActionsContext = (0, react.createContext)({});
1966
+ function PageActionsProvider(props) {
1967
+ const { children, route, routePrefix } = props;
1968
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageActionsContext.Provider, {
1969
+ value: {
1970
+ route,
1971
+ routePrefix
1972
+ },
1973
+ children
1974
+ });
1975
+ }
1976
+ function PageTitleActions() {
1977
+ const { route, routePrefix } = (0, react.useContext)(PageActionsContext);
1978
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContentActions, {
1979
+ route,
1980
+ routePrefix
1981
+ });
1982
+ }
1983
+ //#endregion
1984
+ Object.defineProperty(exports, "ConfigContext", {
1608
1985
  enumerable: true,
1609
1986
  get: function() {
1610
- return ClarifyLocaleContext;
1987
+ return ConfigContext;
1611
1988
  }
1612
1989
  });
1613
- Object.defineProperty(exports, "ContentActions", {
1990
+ Object.defineProperty(exports, "Header", {
1614
1991
  enumerable: true,
1615
1992
  get: function() {
1616
- return ContentActions;
1993
+ return Header;
1617
1994
  }
1618
1995
  });
1619
- Object.defineProperty(exports, "Header", {
1996
+ Object.defineProperty(exports, "LocaleContext", {
1620
1997
  enumerable: true,
1621
1998
  get: function() {
1622
- return Header;
1999
+ return LocaleContext;
1623
2000
  }
1624
2001
  });
1625
2002
  Object.defineProperty(exports, "Navigation", {
@@ -1634,6 +2011,18 @@ Object.defineProperty(exports, "OpenApisContext", {
1634
2011
  return OpenApisContext;
1635
2012
  }
1636
2013
  });
2014
+ Object.defineProperty(exports, "PageActionsProvider", {
2015
+ enumerable: true,
2016
+ get: function() {
2017
+ return PageActionsProvider;
2018
+ }
2019
+ });
2020
+ Object.defineProperty(exports, "PageTitleActions", {
2021
+ enumerable: true,
2022
+ get: function() {
2023
+ return PageTitleActions;
2024
+ }
2025
+ });
1637
2026
  Object.defineProperty(exports, "SectionProvider", {
1638
2027
  enumerable: true,
1639
2028
  get: function() {
@@ -1658,6 +2047,18 @@ Object.defineProperty(exports, "copyTextToClipboard", {
1658
2047
  return copyTextToClipboard;
1659
2048
  }
1660
2049
  });
2050
+ Object.defineProperty(exports, "getStoredLocalePreference", {
2051
+ enumerable: true,
2052
+ get: function() {
2053
+ return getStoredLocalePreference;
2054
+ }
2055
+ });
2056
+ Object.defineProperty(exports, "getStoredThemePreference", {
2057
+ enumerable: true,
2058
+ get: function() {
2059
+ return getStoredThemePreference;
2060
+ }
2061
+ });
1661
2062
  Object.defineProperty(exports, "isExternalHref", {
1662
2063
  enumerable: true,
1663
2064
  get: function() {
@@ -1670,6 +2071,12 @@ Object.defineProperty(exports, "isSameRoutePath", {
1670
2071
  return isSameRoutePath;
1671
2072
  }
1672
2073
  });
2074
+ Object.defineProperty(exports, "localeCookieName", {
2075
+ enumerable: true,
2076
+ get: function() {
2077
+ return localeCookieName;
2078
+ }
2079
+ });
1673
2080
  Object.defineProperty(exports, "localizeHref", {
1674
2081
  enumerable: true,
1675
2082
  get: function() {
@@ -1694,6 +2101,12 @@ Object.defineProperty(exports, "prefixHref", {
1694
2101
  return prefixHref;
1695
2102
  }
1696
2103
  });
2104
+ Object.defineProperty(exports, "readLocaleCookie", {
2105
+ enumerable: true,
2106
+ get: function() {
2107
+ return readLocaleCookie;
2108
+ }
2109
+ });
1697
2110
  Object.defineProperty(exports, "remToPx", {
1698
2111
  enumerable: true,
1699
2112
  get: function() {
@@ -1712,16 +2125,40 @@ Object.defineProperty(exports, "safeDecodeURIComponent", {
1712
2125
  return safeDecodeURIComponent;
1713
2126
  }
1714
2127
  });
2128
+ Object.defineProperty(exports, "storeLocalePreference", {
2129
+ enumerable: true,
2130
+ get: function() {
2131
+ return storeLocalePreference;
2132
+ }
2133
+ });
2134
+ Object.defineProperty(exports, "storeThemePreference", {
2135
+ enumerable: true,
2136
+ get: function() {
2137
+ return storeThemePreference;
2138
+ }
2139
+ });
2140
+ Object.defineProperty(exports, "themeCookieName", {
2141
+ enumerable: true,
2142
+ get: function() {
2143
+ return themeCookieName;
2144
+ }
2145
+ });
1715
2146
  Object.defineProperty(exports, "useBuiltInText", {
1716
2147
  enumerable: true,
1717
2148
  get: function() {
1718
2149
  return useBuiltInText;
1719
2150
  }
1720
2151
  });
1721
- Object.defineProperty(exports, "useClarifyConfig", {
2152
+ Object.defineProperty(exports, "useConfig", {
2153
+ enumerable: true,
2154
+ get: function() {
2155
+ return useConfig;
2156
+ }
2157
+ });
2158
+ Object.defineProperty(exports, "useLocale", {
1722
2159
  enumerable: true,
1723
2160
  get: function() {
1724
- return useClarifyConfig;
2161
+ return useLocale;
1725
2162
  }
1726
2163
  });
1727
2164
  Object.defineProperty(exports, "useOpenApis", {
@@ -1743,4 +2180,4 @@ Object.defineProperty(exports, "useTheme", {
1743
2180
  }
1744
2181
  });
1745
2182
 
1746
- //# sourceMappingURL=shell-D4tS8Jts.cjs.map
2183
+ //# sourceMappingURL=PageActions-1RDCHcUY.cjs.map