@clarify-labs/renderer 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/output/{OpenApiOperation-ZXToVSFC.cjs → OpenApiOperation-BcyW_ULy.cjs} +186 -140
  2. package/output/OpenApiOperation-BcyW_ULy.cjs.map +1 -0
  3. package/output/{OpenApiOperation-CWSOhUVa.js → OpenApiOperation-tUKf7lZ4.js} +166 -120
  4. package/output/OpenApiOperation-tUKf7lZ4.js.map +1 -0
  5. package/output/{shell-xxhV0p7k.cjs → PageActions-1RDCHcUY.cjs} +280 -308
  6. package/output/PageActions-1RDCHcUY.cjs.map +1 -0
  7. package/output/{shell-CumiARRe.js → PageActions-yoDRjkq8.js} +235 -263
  8. package/output/PageActions-yoDRjkq8.js.map +1 -0
  9. package/output/{ThemeRoot-C_ZdzSMu.js → ThemeRoot-QULrwQf6.js} +407 -53
  10. package/output/ThemeRoot-QULrwQf6.js.map +1 -0
  11. package/output/{ThemeRoot-CEvwrGp5.cjs → ThemeRoot-UWj0iK1X.cjs} +458 -80
  12. package/output/ThemeRoot-UWj0iK1X.cjs.map +1 -0
  13. package/output/app/AppShell.d.ts +3 -2
  14. package/output/app/PageActions.d.ts +12 -0
  15. package/output/app/PageBanner.d.ts +7 -0
  16. package/output/app/SectionProvider.d.ts +1 -0
  17. package/output/client.cjs +14 -7
  18. package/output/client.d.ts +4 -2
  19. package/output/client.js +4 -4
  20. package/output/context.d.ts +1 -1
  21. package/output/core/context.d.ts +5 -5
  22. package/output/core/index.d.ts +1 -1
  23. package/output/core/types.d.ts +70 -61
  24. package/output/index.cjs +56 -28
  25. package/output/index.cjs.map +1 -1
  26. package/output/index.d.ts +7 -5
  27. package/output/index.js +37 -12
  28. package/output/index.js.map +1 -1
  29. package/output/mdx/components.d.ts +2 -0
  30. package/output/mdx/primitives.d.ts +2 -0
  31. package/output/openapi/components/EndpointSections.d.ts +30 -0
  32. package/output/preview.cjs +7 -7
  33. package/output/preview.cjs.map +1 -1
  34. package/output/preview.js +4 -4
  35. package/output/preview.js.map +1 -1
  36. package/output/{render-zHU25Nm9.cjs → render-ByWbJbrA.cjs} +8 -7
  37. package/output/render-ByWbJbrA.cjs.map +1 -0
  38. package/output/{render-CnUd0XwZ.js → render-psutGbsg.js} +6 -5
  39. package/output/render-psutGbsg.js.map +1 -0
  40. package/output/renderer.css +371 -269
  41. package/output/server.cjs +8 -7
  42. package/output/server.cjs.map +1 -1
  43. package/output/server.js +5 -4
  44. package/output/server.js.map +1 -1
  45. package/output/shell/ContentActions.d.ts +0 -1
  46. package/output/shell/Header.d.ts +3 -2
  47. package/output/shell/SiteLogo.d.ts +2 -2
  48. package/output/shell/mobile.d.ts +2 -2
  49. package/output/theme/ThemeEditor.d.ts +53 -17
  50. package/output/theme/ThemeProvider.d.ts +2 -1
  51. package/output/theme/ThemeRoot.d.ts +2 -2
  52. package/output/theme/cookies.d.ts +11 -0
  53. package/output/theme/randomTheme.d.ts +2 -2
  54. package/output/theme/variables.d.ts +58 -20
  55. package/output/utils/href.d.ts +3 -3
  56. package/package.json +1 -1
  57. package/output/OpenApiOperation-CWSOhUVa.js.map +0 -1
  58. package/output/OpenApiOperation-ZXToVSFC.cjs.map +0 -1
  59. package/output/ThemeRoot-CEvwrGp5.cjs.map +0 -1
  60. package/output/ThemeRoot-C_ZdzSMu.js.map +0 -1
  61. package/output/render-CnUd0XwZ.js.map +0 -1
  62. package/output/render-zHU25Nm9.cjs.map +0 -1
  63. package/output/shell-CumiARRe.js.map +0 -1
  64. package/output/shell-xxhV0p7k.cjs.map +0 -1
@@ -8,16 +8,16 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { AnimatePresence, motion, useIsPresent, useScroll, useTransform } from "framer-motion";
9
9
  import { create, createStore, useStore } from "zustand";
10
10
  //#region source/core/context.tsx
11
- var ClarifyConfigContext = createContext(null);
12
- var ClarifyLocaleContext = createContext(void 0);
11
+ var ConfigContext = createContext(null);
12
+ var LocaleContext = createContext(void 0);
13
13
  var OpenApisContext = createContext({});
14
- function useClarifyConfig() {
15
- const config = useContext(ClarifyConfigContext);
16
- if (!config) throw new Error("[clarify] useClarifyConfig must be used within a ClarifyConfigContext.Provider");
14
+ function useConfig() {
15
+ const config = useContext(ConfigContext);
16
+ if (!config) throw new Error("[clarify] useConfig must be used within a ConfigContext.Provider");
17
17
  return config;
18
18
  }
19
- function useClarifyLocale() {
20
- return useContext(ClarifyLocaleContext);
19
+ function useLocale() {
20
+ return useContext(LocaleContext);
21
21
  }
22
22
  function useOpenApis() {
23
23
  return useContext(OpenApisContext);
@@ -217,8 +217,8 @@ function translateBuiltInText(locale, key, replacements = {}) {
217
217
  return value;
218
218
  }
219
219
  function useBuiltInText(locale) {
220
- const config = useContext(ClarifyConfigContext);
221
- const currentLocale = useContext(ClarifyLocaleContext);
220
+ const config = useContext(ConfigContext);
221
+ const currentLocale = useContext(LocaleContext);
222
222
  const resolvedLocale = locale ?? currentLocale ?? config?.i18n?.defaultLocale;
223
223
  return (key, replacements) => translateBuiltInText(resolvedLocale, key, replacements);
224
224
  }
@@ -280,7 +280,7 @@ function getAbsoluteUrl(path) {
280
280
  return new URL(path, window.location.href).href;
281
281
  }
282
282
  function ContentActions(arg0) {
283
- const { hasTabs = false, route, routePrefix } = arg0;
283
+ const { route, routePrefix } = arg0;
284
284
  const t = useBuiltInText();
285
285
  const [copied, setCopied] = useState("idle");
286
286
  if (!route?.contentArtifactUrl && !route?.sourceUrl) return null;
@@ -331,29 +331,36 @@ function ContentActions(arg0) {
331
331
  const primaryAction = actions[0];
332
332
  const PrimaryIcon = primaryAction && copied === primaryAction.key ? Check : primaryAction?.icon ?? PencilLine;
333
333
  return /* @__PURE__ */ jsx("div", {
334
- className: `clarify-content-actions pointer-events-none sticky z-20 flex justify-end py-4 ${hasTabs ? "top-16 lg:top-30" : "top-16"}`,
334
+ className: "clarify-content-actions not-prose flex shrink-0 justify-start sm:justify-end",
335
335
  children: /* @__PURE__ */ jsxs(Menu, {
336
336
  as: "div",
337
- className: "clarify-content-actions-menu pointer-events-auto relative inline-flex text-sm font-medium",
337
+ className: "clarify-content-actions-menu relative inline-flex min-w-0 text-sm font-medium",
338
338
  children: [/* @__PURE__ */ jsxs("div", {
339
- 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",
339
+ 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",
340
340
  children: [primaryAction ? /* @__PURE__ */ jsxs("button", {
341
341
  type: "button",
342
342
  onClick: primaryAction.run,
343
- className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 items-center gap-1.5 px-3 transition",
344
- children: [/* @__PURE__ */ jsx(PrimaryIcon, { className: "h-3.5 w-3.5" }), copied === primaryAction.key ? t("actions.copied") : primaryAction.label]
343
+ 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",
344
+ children: [/* @__PURE__ */ jsx(PrimaryIcon, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ jsx("span", {
345
+ className: "truncate",
346
+ children: copied === primaryAction.key ? t("actions.copied") : primaryAction.label
347
+ })]
345
348
  }) : /* @__PURE__ */ jsxs("a", {
346
349
  href: route.sourceUrl,
347
350
  target: "_blank",
348
351
  rel: "noreferrer",
349
- className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 items-center gap-1.5 px-3 no-underline transition",
350
- children: [/* @__PURE__ */ jsx(PrimaryIcon, { className: "h-3.5 w-3.5" }), t("contentActions.editPage")]
352
+ 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",
353
+ children: [/* @__PURE__ */ jsx(PrimaryIcon, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ jsx("span", {
354
+ className: "truncate",
355
+ children: t("contentActions.editPage")
356
+ })]
351
357
  }), /* @__PURE__ */ jsx(MenuButton, {
352
358
  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",
353
359
  "aria-label": t("contentActions.copyOptions"),
354
360
  children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5" })
355
361
  })]
356
362
  }), /* @__PURE__ */ jsxs(MenuItems, {
363
+ modal: false,
357
364
  anchor: "bottom end",
358
365
  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",
359
366
  children: [
@@ -483,174 +490,102 @@ function ContentActions(arg0) {
483
490
  });
484
491
  }
485
492
  //#endregion
486
- //#region source/theme/variables.ts
487
- var themeStorageKey = "clarify:theme";
488
- var clarifyThemePresets = {
489
- default: {
490
- preset: "default",
491
- tokens: {
492
- colors: {
493
- primary: "#047857",
494
- accent: "#0D9488",
495
- background: "#ffffff",
496
- foreground: "#111827",
497
- surface: "#ffffff",
498
- muted: "#64748b",
499
- border: "rgb(15 23 42 / 0.12)",
500
- codeBackground: "#f6fbf8"
501
- },
502
- radius: {
503
- sm: "6px",
504
- md: "10px",
505
- lg: "14px",
506
- xl: "18px"
507
- }
508
- },
509
- layout: { maxWidth: "82rem" },
510
- editor: false
511
- },
512
- base: {
513
- preset: "base",
514
- tokens: {
515
- colors: {
516
- primary: "#18181b",
517
- accent: "#52525b",
518
- background: "#ffffff",
519
- foreground: "#18181b",
520
- surface: "#ffffff",
521
- muted: "#71717a",
522
- border: "rgb(24 24 27 / 0.12)",
523
- codeBackground: "#f4f4f5"
524
- },
525
- radius: {
526
- sm: "6px",
527
- md: "8px",
528
- lg: "12px",
529
- xl: "16px"
530
- }
531
- },
532
- layout: { maxWidth: "80rem" },
533
- editor: false
534
- }
535
- };
536
- function cloneThemeColorValue(value) {
537
- return typeof value === "string" ? value : { ...value };
538
- }
539
- function cloneTheme(theme) {
540
- return {
541
- preset: theme.preset,
542
- tokens: {
543
- colors: {
544
- primary: cloneThemeColorValue(theme.tokens.colors.primary),
545
- accent: cloneThemeColorValue(theme.tokens.colors.accent),
546
- background: cloneThemeColorValue(theme.tokens.colors.background),
547
- foreground: cloneThemeColorValue(theme.tokens.colors.foreground),
548
- surface: cloneThemeColorValue(theme.tokens.colors.surface),
549
- muted: cloneThemeColorValue(theme.tokens.colors.muted),
550
- border: cloneThemeColorValue(theme.tokens.colors.border),
551
- codeBackground: cloneThemeColorValue(theme.tokens.colors.codeBackground)
552
- },
553
- radius: { ...theme.tokens.radius }
554
- },
555
- layout: { ...theme.layout },
556
- editor: theme.editor
557
- };
558
- }
559
- function isModeColorValue(value) {
560
- return typeof value === "object" && value !== null;
561
- }
562
- function resolveThemeColorValue(value, resolvedTheme = "light") {
563
- if (!isModeColorValue(value)) return value;
564
- return value[resolvedTheme] ?? value.light ?? value.dark ?? "";
493
+ //#region source/theme/cookies.ts
494
+ var themeCookieName = "clarify-theme";
495
+ var localeCookieName = "clarify-locale";
496
+ var preferenceCookieMaxAge = 3600 * 24 * 365;
497
+ var cookiePath = "/";
498
+ function isThemePreference(value) {
499
+ return value === "light" || value === "dark" || value === "system";
500
+ }
501
+ function readThemeCookie() {
502
+ if (typeof document === "undefined") return null;
503
+ const value = readCookieValue(themeCookieName);
504
+ return isThemePreference(value) ? value : null;
505
+ }
506
+ function getStoredThemePreference() {
507
+ return readThemeCookie() ?? "system";
508
+ }
509
+ function storeThemePreference(theme) {
510
+ storeSharedPreferenceCookie(themeCookieName, theme);
511
+ }
512
+ function readLocaleCookie() {
513
+ if (typeof document === "undefined") return null;
514
+ return readCookieValue(localeCookieName);
515
+ }
516
+ function getStoredLocalePreference(locales) {
517
+ const locale = readLocaleCookie();
518
+ if (!locale) return null;
519
+ return locales && !locales.includes(locale) ? null : locale;
520
+ }
521
+ function storeLocalePreference(locale) {
522
+ storeSharedPreferenceCookie(localeCookieName, locale);
523
+ }
524
+ function storeSharedPreferenceCookie(name, value) {
525
+ if (typeof document === "undefined") return;
526
+ const domains = resolveSharedCookieDomains();
527
+ const domain = resolveWritableSharedCookieDomain(domains, name);
528
+ deleteCookie(name);
529
+ for (const candidateDomain of domains) deleteCookie(name, { domain: candidateDomain });
530
+ writeCookie(name, value, {
531
+ domain: domain ?? void 0,
532
+ maxAge: preferenceCookieMaxAge
533
+ });
565
534
  }
566
- function resolveThemeColors(colors, resolvedTheme = "light") {
567
- return {
568
- primary: resolveThemeColorValue(colors.primary, resolvedTheme),
569
- accent: resolveThemeColorValue(colors.accent, resolvedTheme),
570
- background: resolveThemeColorValue(colors.background, resolvedTheme),
571
- foreground: resolveThemeColorValue(colors.foreground, resolvedTheme),
572
- surface: resolveThemeColorValue(colors.surface, resolvedTheme),
573
- muted: resolveThemeColorValue(colors.muted, resolvedTheme),
574
- border: resolveThemeColorValue(colors.border, resolvedTheme),
575
- codeBackground: resolveThemeColorValue(colors.codeBackground, resolvedTheme)
576
- };
535
+ function resolveSharedCookieDomains(hostname = typeof window !== "undefined" ? window.location.hostname : "") {
536
+ const normalizedHostname = hostname.toLowerCase().replace(/\.$/, "");
537
+ if (!normalizedHostname || normalizedHostname === "localhost" || normalizedHostname.endsWith(".localhost") || isIpAddress(normalizedHostname)) return [];
538
+ const parts = normalizedHostname.split(".");
539
+ if (parts.length < 2) return [];
540
+ const domains = [];
541
+ for (let index = parts.length - 2; index >= 0; index -= 1) domains.push(parts.slice(index).join("."));
542
+ return domains;
543
+ }
544
+ function resolveWritableSharedCookieDomain(domains, probePrefix = themeCookieName) {
545
+ for (const domain of domains) {
546
+ const probeName = `${probePrefix}-probe-${Date.now()}-${Math.random().toString(36).slice(2)}`;
547
+ const probeValue = "1";
548
+ writeCookie(probeName, probeValue, {
549
+ domain,
550
+ maxAge: 60
551
+ });
552
+ const isWritable = readCookieValue(probeName) === probeValue;
553
+ deleteCookie(probeName, { domain });
554
+ if (isWritable) return domain;
555
+ }
556
+ return null;
557
+ }
558
+ function readCookieValue(cookieName) {
559
+ const cookies = document.cookie ? document.cookie.split("; ") : [];
560
+ for (const cookie of cookies) {
561
+ const separatorIndex = cookie.indexOf("=");
562
+ const name = separatorIndex === -1 ? cookie : cookie.slice(0, separatorIndex);
563
+ if (decodeURIComponent(name) !== cookieName) continue;
564
+ return separatorIndex === -1 ? "" : decodeURIComponent(cookie.slice(separatorIndex + 1));
565
+ }
566
+ return null;
577
567
  }
578
- function matchesPresetTheme(theme) {
579
- const preset = clarifyThemePresets[theme.preset];
580
- return JSON.stringify({
581
- tokens: theme.tokens,
582
- layout: theme.layout
583
- }) === JSON.stringify({
584
- tokens: preset.tokens,
585
- layout: preset.layout
568
+ function deleteCookie(name, options = {}) {
569
+ writeCookie(name, "", {
570
+ domain: options.domain,
571
+ maxAge: 0
586
572
  });
587
573
  }
588
- function effectiveTheme(theme, resolvedTheme) {
589
- if (resolvedTheme !== "dark" || !matchesPresetTheme(theme)) return theme;
590
- return {
591
- ...theme,
592
- tokens: {
593
- ...theme.tokens,
594
- colors: {
595
- ...theme.tokens.colors,
596
- background: "#09090b",
597
- foreground: "#ffffff",
598
- surface: "#18181b",
599
- muted: "#a1a1aa",
600
- border: "rgb(255 255 255 / 0.1)",
601
- codeBackground: "#18181b"
602
- }
603
- }
604
- };
605
- }
606
- function themeToCssVariables(theme, resolvedTheme) {
607
- const resolved = effectiveTheme(theme, resolvedTheme);
608
- const colors = resolveThemeColors(resolved.tokens.colors, resolvedTheme);
609
- const { radius } = resolved.tokens;
610
- return {
611
- "--clarify-theme-tokens-colors-primary": colors.primary,
612
- "--clarify-theme-tokens-colors-accent": colors.accent,
613
- "--clarify-theme-tokens-colors-background": colors.background,
614
- "--clarify-theme-tokens-colors-foreground": colors.foreground,
615
- "--clarify-theme-tokens-colors-surface": colors.surface,
616
- "--clarify-theme-tokens-colors-muted": colors.muted,
617
- "--clarify-theme-tokens-colors-border": colors.border,
618
- "--clarify-theme-tokens-colors-code-background": colors.codeBackground,
619
- "--clarify-theme-tokens-radius-sm": radius.sm,
620
- "--clarify-theme-tokens-radius-md": radius.md,
621
- "--clarify-theme-tokens-radius-lg": radius.lg,
622
- "--clarify-theme-tokens-radius-xl": radius.xl,
623
- "--clarify-theme-layout-max-width": resolved.layout.maxWidth
624
- };
574
+ function writeCookie(name, value, options) {
575
+ const attributes = [
576
+ `${encodeURIComponent(name)}=${encodeURIComponent(value)}`,
577
+ `Path=${cookiePath}`,
578
+ `Max-Age=${options.maxAge}`,
579
+ "SameSite=Lax"
580
+ ];
581
+ if (options.domain) attributes.push(`Domain=.${options.domain}`);
582
+ if (typeof window !== "undefined" && window.location.protocol === "https:") attributes.push("Secure");
583
+ try {
584
+ document.cookie = attributes.join("; ");
585
+ } catch {}
625
586
  }
626
- function themeBootstrapScript(theme = clarifyThemePresets.default) {
627
- const darkVariables = themeToCssVariables(theme, "dark");
628
- const lightVariables = themeToCssVariables(theme, "light");
629
- return `(function(){try{var e=localStorage.getItem(${JSON.stringify(themeStorageKey)});var t=e==='dark'||e==='light'||e==='system'?e:'system';var r=t==='system'?window.matchMedia('(prefers-color-scheme: dark)').matches:t==='dark';var v=r?${JSON.stringify(darkVariables)}:${JSON.stringify(lightVariables)};var s=document.documentElement.style;for(var k in v)s.setProperty(k,v[k]);document.documentElement.classList.toggle('dark',r);document.documentElement.style.colorScheme=r?'dark':'light'}catch(e){}})();`;
630
- }
631
- function uniqueElements(elements) {
632
- return Array.from(new Set(elements));
633
- }
634
- function resolveThemeVariableTargets(target) {
635
- if (typeof document === "undefined") return [];
636
- if (target instanceof HTMLElement) return [target];
637
- if (typeof target === "string") return Array.from(document.querySelectorAll(target));
638
- return uniqueElements([document.documentElement, ...Array.from(document.querySelectorAll(".clarify-app"))]);
639
- }
640
- function applyThemeCssVariables(variables, targets) {
641
- const previousValues = /* @__PURE__ */ new Map();
642
- for (const element of targets) {
643
- const elementPreviousValues = /* @__PURE__ */ new Map();
644
- for (const [property, value] of Object.entries(variables)) {
645
- elementPreviousValues.set(property, element.style.getPropertyValue(property));
646
- element.style.setProperty(property, value);
647
- }
648
- previousValues.set(element, elementPreviousValues);
649
- }
650
- return () => {
651
- for (const [element, elementPreviousValues] of previousValues) for (const [property, previousValue] of elementPreviousValues) if (previousValue) element.style.setProperty(property, previousValue);
652
- else element.style.removeProperty(property);
653
- };
587
+ function isIpAddress(hostname) {
588
+ return /^\d{1,3}(?:\.\d{1,3}){3}$/.test(hostname) || hostname.includes(":");
654
589
  }
655
590
  //#endregion
656
591
  //#region source/theme/ThemeProvider.tsx
@@ -661,18 +596,10 @@ function getSystemTheme() {
661
596
  }
662
597
  function getStoredTheme() {
663
598
  if (typeof window === "undefined") return "system";
664
- try {
665
- const storedTheme = window.localStorage.getItem(themeStorageKey);
666
- return storedTheme === "light" || storedTheme === "dark" || storedTheme === "system" ? storedTheme : "system";
667
- } catch {
668
- return "system";
669
- }
599
+ return getStoredThemePreference();
670
600
  }
671
601
  function storeTheme(theme) {
672
- if (typeof window === "undefined") return;
673
- try {
674
- window.localStorage.setItem(themeStorageKey, theme);
675
- } catch {}
602
+ storeThemePreference(theme);
676
603
  }
677
604
  function applyTheme(resolvedTheme) {
678
605
  if (typeof document === "undefined") return;
@@ -909,7 +836,7 @@ function SectionBadge(arg0) {
909
836
  });
910
837
  }
911
838
  function NavLink(arg0) {
912
- const { href, children, badge, icon, active = false, isAnchorLink = false } = arg0;
839
+ const { href, children, badge, icon, active = false, isAnchorLink = false, level } = arg0;
913
840
  function handleClick() {
914
841
  if (!isAnchorLink) return;
915
842
  const hashIndex = href.indexOf("#");
@@ -927,7 +854,8 @@ function NavLink(arg0) {
927
854
  to: href,
928
855
  "aria-current": active ? "page" : void 0,
929
856
  onClick: handleClick,
930
- className: clsx("clarify-navigation-link flex h-8 items-center justify-between gap-2 pr-3 transition", isAnchorLink ? "clarify-navigation-anchor-link pl-7" : "pl-4"),
857
+ className: clsx("clarify-navigation-link flex h-8 items-center justify-between gap-2 pr-3 transition", isAnchorLink ? "clarify-navigation-anchor-link" : "pl-4"),
858
+ style: isAnchorLink ? { paddingLeft: `${1.75 + Math.max(0, (level ?? 2) - 2) * .75}rem` } : void 0,
931
859
  children: /* @__PURE__ */ jsxs("span", {
932
860
  className: "flex min-w-0 flex-1 items-center gap-2",
933
861
  children: [
@@ -1071,6 +999,7 @@ function NavigationGroup(arg0) {
1071
999
  badge: section.badge,
1072
1000
  tags: section.tags,
1073
1001
  isAnchorLink: true,
1002
+ level: section.level,
1074
1003
  children: section.title
1075
1004
  }) }, section.id))
1076
1005
  }) : null
@@ -1805,6 +1734,7 @@ function LanguageSwitcher(arg0) {
1805
1734
  const selected = locale.code === selectedLocale;
1806
1735
  return [/* @__PURE__ */ jsx(MenuItem, { children: ({ focus }) => /* @__PURE__ */ jsxs(Link, {
1807
1736
  to: `${localizedPath}${suffix}`,
1737
+ onClick: () => storeLocalePreference(locale.code),
1808
1738
  className: clsx("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"),
1809
1739
  "aria-current": selected ? "true" : void 0,
1810
1740
  lang: locale.code,
@@ -1833,6 +1763,10 @@ function TopLevelNavItem(arg0) {
1833
1763
  children
1834
1764
  }) });
1835
1765
  }
1766
+ function resolveHomeHref(config, currentLocale) {
1767
+ const homeUrl = config.homeUrl ?? "/";
1768
+ return isExternalHref(homeUrl) ? homeUrl : localizeHref(homeUrl, config, currentLocale);
1769
+ }
1836
1770
  function MobileNavbarMenu(arg0) {
1837
1771
  const { links, config, currentLocale } = arg0;
1838
1772
  const t = useBuiltInText();
@@ -1914,10 +1848,12 @@ function ProductTabs(arg0) {
1914
1848
  });
1915
1849
  }
1916
1850
  var Header = forwardRef(function Header(arg0, ref) {
1917
- const { config, navigation, tabs, routes, currentLocale, currentRoute, className, ...props } = arg0;
1851
+ const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
1918
1852
  const t = useBuiltInText();
1919
1853
  const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
1920
1854
  const isInsideMobileNavigation = useIsInsideMobileNavigation();
1855
+ const homeHref = resolveHomeHref(config, currentLocale);
1856
+ const homeExternal = isExternalHref(homeHref);
1921
1857
  const { scrollY } = useScroll();
1922
1858
  const bgOpacityLight = useTransform(scrollY, [0, 72], ["70%", "95%"]);
1923
1859
  const bgOpacityDark = useTransform(scrollY, [0, 72], ["60%", "92%"]);
@@ -1930,83 +1866,119 @@ var Header = forwardRef(function Header(arg0, ref) {
1930
1866
  "--bg-opacity-light": bgOpacityLight,
1931
1867
  "--bg-opacity-dark": bgOpacityDark
1932
1868
  },
1933
- children: [/* @__PURE__ */ jsxs("div", {
1934
- 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"),
1935
- children: [
1936
- /* @__PURE__ */ jsxs("div", {
1937
- className: "clarify-header-left flex min-w-0 items-center gap-5",
1938
- children: [/* @__PURE__ */ jsx("div", {
1939
- className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
1940
- children: /* @__PURE__ */ jsx(MobileNavigation, {
1941
- config,
1942
- navigation,
1943
- tabs,
1944
- routes,
1945
- currentLocale,
1946
- currentRoute
1947
- })
1948
- }), /* @__PURE__ */ jsxs(CloseButton, {
1949
- as: Link,
1950
- to: localizeHref("/", config, currentLocale),
1951
- "aria-label": t("navbar.home"),
1952
- className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
1953
- children: [/* @__PURE__ */ jsx(SiteLogo, {
1954
- logo: config.logo,
1955
- className: "h-6 w-auto shrink-0 object-contain"
1956
- }), /* @__PURE__ */ jsx("span", {
1957
- className: "clarify-brand-title truncate font-semibold",
1958
- children: config.title
1959
- })]
1960
- })]
1961
- }),
1962
- /* @__PURE__ */ jsx("div", {
1963
- className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
1964
- children: /* @__PURE__ */ jsx(Search$1, {
1965
- routes,
1966
- navigation,
1967
- routePrefix: config.routePrefix,
1968
- currentLocale
1969
- })
1970
- }),
1971
- /* @__PURE__ */ jsxs("div", {
1972
- className: "clarify-header-actions flex shrink-0 items-center gap-5",
1973
- children: [
1974
- config.navbar?.links?.length ? /* @__PURE__ */ jsx("nav", {
1975
- className: "clarify-top-nav hidden md:block",
1976
- children: /* @__PURE__ */ jsx("ul", {
1977
- role: "list",
1978
- className: "flex items-center gap-8",
1979
- children: config.navbar.links.map((link) => /* @__PURE__ */ jsx(TopLevelNavItem, {
1980
- href: localizeHref(link.href, config, currentLocale),
1981
- children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
1982
- }, link.href))
1869
+ children: [
1870
+ /* @__PURE__ */ jsxs("div", {
1871
+ 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"),
1872
+ children: [
1873
+ /* @__PURE__ */ jsxs("div", {
1874
+ className: "clarify-header-left flex min-w-0 items-center gap-5",
1875
+ children: [/* @__PURE__ */ jsx("div", {
1876
+ className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
1877
+ children: /* @__PURE__ */ jsx(MobileNavigation, {
1878
+ config,
1879
+ navigation,
1880
+ tabs,
1881
+ routes,
1882
+ currentLocale,
1883
+ currentRoute
1983
1884
  })
1984
- }) : null,
1985
- 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,
1986
- /* @__PURE__ */ jsx(MobileSearch, {
1885
+ }), homeExternal ? /* @__PURE__ */ jsxs(CloseButton, {
1886
+ as: "a",
1887
+ href: homeHref,
1888
+ "aria-label": t("navbar.home"),
1889
+ className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
1890
+ children: [/* @__PURE__ */ jsx(SiteLogo, {
1891
+ logo: config.logo,
1892
+ className: "h-6 w-auto shrink-0 object-contain"
1893
+ }), /* @__PURE__ */ jsx("span", {
1894
+ className: "clarify-brand-title truncate font-semibold",
1895
+ children: config.title
1896
+ })]
1897
+ }) : /* @__PURE__ */ jsxs(CloseButton, {
1898
+ as: Link,
1899
+ to: homeHref,
1900
+ "aria-label": t("navbar.home"),
1901
+ className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
1902
+ children: [/* @__PURE__ */ jsx(SiteLogo, {
1903
+ logo: config.logo,
1904
+ className: "h-6 w-auto shrink-0 object-contain"
1905
+ }), /* @__PURE__ */ jsx("span", {
1906
+ className: "clarify-brand-title truncate font-semibold",
1907
+ children: config.title
1908
+ })]
1909
+ })]
1910
+ }),
1911
+ /* @__PURE__ */ jsx("div", {
1912
+ className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
1913
+ children: /* @__PURE__ */ jsx(Search$1, {
1987
1914
  routes,
1988
1915
  navigation,
1989
1916
  routePrefix: config.routePrefix,
1990
1917
  currentLocale
1991
- }),
1992
- /* @__PURE__ */ jsx(LanguageSwitcher, {
1993
- config,
1994
- currentLocale,
1995
- currentRoute
1996
- }),
1997
- /* @__PURE__ */ jsx(ThemeToggle, {}),
1998
- /* @__PURE__ */ jsx(MobileNavbarMenu, {
1999
- links: config.navbar?.links,
2000
- config,
2001
- currentLocale
2002
1918
  })
2003
- ]
2004
- })
2005
- ]
2006
- }), /* @__PURE__ */ jsx(ProductTabs, { tabs })]
1919
+ }),
1920
+ /* @__PURE__ */ jsxs("div", {
1921
+ className: "clarify-header-actions flex shrink-0 items-center gap-5",
1922
+ children: [
1923
+ config.navbar?.links?.length ? /* @__PURE__ */ jsx("nav", {
1924
+ className: "clarify-top-nav hidden md:block",
1925
+ children: /* @__PURE__ */ jsx("ul", {
1926
+ role: "list",
1927
+ className: "flex items-center gap-8",
1928
+ children: config.navbar.links.map((link) => /* @__PURE__ */ jsx(TopLevelNavItem, {
1929
+ href: localizeHref(link.href, config, currentLocale),
1930
+ children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
1931
+ }, link.href))
1932
+ })
1933
+ }) : null,
1934
+ 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,
1935
+ /* @__PURE__ */ jsx(MobileSearch, {
1936
+ routes,
1937
+ navigation,
1938
+ routePrefix: config.routePrefix,
1939
+ currentLocale
1940
+ }),
1941
+ /* @__PURE__ */ jsx(LanguageSwitcher, {
1942
+ config,
1943
+ currentLocale,
1944
+ currentRoute
1945
+ }),
1946
+ /* @__PURE__ */ jsx(ThemeToggle, {}),
1947
+ /* @__PURE__ */ jsx(MobileNavbarMenu, {
1948
+ links: config.navbar?.links,
1949
+ config,
1950
+ currentLocale
1951
+ })
1952
+ ]
1953
+ })
1954
+ ]
1955
+ }),
1956
+ banner,
1957
+ /* @__PURE__ */ jsx(ProductTabs, { tabs })
1958
+ ]
2007
1959
  });
2008
1960
  });
2009
1961
  //#endregion
2010
- export { OpenApisContext as A, isExternalHref as C, useBuiltInText as D, copyTextToClipboard as E, useClarifyLocale as M, useOpenApis as N, ClarifyConfigContext as O, ContentActions as S, prefixHref as T, resolveThemeColorValue as _, useSectionStore as a, themeStorageKey as b, resolveLucideIconName as c, ThemeToggle as d, ThemeProvider as f, cloneTheme as g, clarifyThemePresets as h, SectionProvider as i, useClarifyConfig as j, ClarifyLocaleContext as k, isSameRoutePath as l, applyThemeCssVariables as m, Navigation as n, remToPx as o, useTheme as p, safeDecodeURIComponent as r, lucideIconRegistry as s, Header as t, normalizeRoutePath as u, resolveThemeVariableTargets as v, localizeHref as w, themeToCssVariables as x, themeBootstrapScript as y };
1962
+ //#region source/app/PageActions.tsx
1963
+ var PageActionsContext = createContext({});
1964
+ function PageActionsProvider(props) {
1965
+ const { children, route, routePrefix } = props;
1966
+ return /* @__PURE__ */ jsx(PageActionsContext.Provider, {
1967
+ value: {
1968
+ route,
1969
+ routePrefix
1970
+ },
1971
+ children
1972
+ });
1973
+ }
1974
+ function PageTitleActions() {
1975
+ const { route, routePrefix } = useContext(PageActionsContext);
1976
+ return /* @__PURE__ */ jsx(ContentActions, {
1977
+ route,
1978
+ routePrefix
1979
+ });
1980
+ }
1981
+ //#endregion
1982
+ 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 _, safeDecodeURIComponent as a, storeLocalePreference as b, remToPx as c, isSameRoutePath as d, normalizeRoutePath as f, getStoredLocalePreference as g, useTheme as h, Navigation as i, useConfig as j, LocaleContext as k, lucideIconRegistry as l, ThemeProvider as m, PageTitleActions as n, SectionProvider as o, ThemeToggle as p, Header as r, useSectionStore as s, PageActionsProvider as t, resolveLucideIconName as u, localeCookieName as v, localizeHref as w, storeThemePreference as x, readLocaleCookie as y };
2011
1983
 
2012
- //# sourceMappingURL=shell-CumiARRe.js.map
1984
+ //# sourceMappingURL=PageActions-yoDRjkq8.js.map