@clarify-labs/renderer 0.7.0 → 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 (63) hide show
  1. package/output/{OpenApiOperation-ZXToVSFC.cjs → OpenApiOperation-C4xZu4i0.cjs} +69 -65
  2. package/output/OpenApiOperation-C4xZu4i0.cjs.map +1 -0
  3. package/output/{OpenApiOperation-CWSOhUVa.js → OpenApiOperation-LIL7bqxW.js} +48 -44
  4. package/output/OpenApiOperation-LIL7bqxW.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-CLa0yvRQ.js} +406 -53
  10. package/output/ThemeRoot-CLa0yvRQ.js.map +1 -0
  11. package/output/{ThemeRoot-CEvwrGp5.cjs → ThemeRoot-DYS-lcK-.cjs} +457 -80
  12. package/output/ThemeRoot-DYS-lcK-.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 +1 -0
  30. package/output/mdx/primitives.d.ts +1 -0
  31. package/output/preview.cjs +7 -7
  32. package/output/preview.cjs.map +1 -1
  33. package/output/preview.js +4 -4
  34. package/output/preview.js.map +1 -1
  35. package/output/{render-zHU25Nm9.cjs → render-CRTqZzyY.cjs} +8 -7
  36. package/output/render-CRTqZzyY.cjs.map +1 -0
  37. package/output/{render-CnUd0XwZ.js → render-D0ls3d2j.js} +6 -5
  38. package/output/render-D0ls3d2j.js.map +1 -0
  39. package/output/renderer.css +365 -261
  40. package/output/server.cjs +8 -7
  41. package/output/server.cjs.map +1 -1
  42. package/output/server.js +5 -4
  43. package/output/server.js.map +1 -1
  44. package/output/shell/ContentActions.d.ts +0 -1
  45. package/output/shell/Header.d.ts +3 -2
  46. package/output/shell/SiteLogo.d.ts +2 -2
  47. package/output/shell/mobile.d.ts +2 -2
  48. package/output/theme/ThemeEditor.d.ts +53 -17
  49. package/output/theme/ThemeProvider.d.ts +2 -1
  50. package/output/theme/ThemeRoot.d.ts +2 -2
  51. package/output/theme/cookies.d.ts +11 -0
  52. package/output/theme/randomTheme.d.ts +2 -2
  53. package/output/theme/variables.d.ts +58 -20
  54. package/output/utils/href.d.ts +3 -3
  55. package/package.json +1 -1
  56. package/output/OpenApiOperation-CWSOhUVa.js.map +0 -1
  57. package/output/OpenApiOperation-ZXToVSFC.cjs.map +0 -1
  58. package/output/ThemeRoot-CEvwrGp5.cjs.map +0 -1
  59. package/output/ThemeRoot-C_ZdzSMu.js.map +0 -1
  60. package/output/render-CnUd0XwZ.js.map +0 -1
  61. package/output/render-zHU25Nm9.cjs.map +0 -1
  62. package/output/shell-CumiARRe.js.map +0 -1
  63. package/output/shell-xxhV0p7k.cjs.map +0 -1
@@ -10,16 +10,16 @@ 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 useClarifyLocale() {
22
- return (0, react.useContext)(ClarifyLocaleContext);
21
+ function useLocale() {
22
+ return (0, react.useContext)(LocaleContext);
23
23
  }
24
24
  function useOpenApis() {
25
25
  return (0, react.useContext)(OpenApisContext);
@@ -219,8 +219,8 @@ function translateBuiltInText(locale, key, replacements = {}) {
219
219
  return value;
220
220
  }
221
221
  function useBuiltInText(locale) {
222
- const config = (0, react.useContext)(ClarifyConfigContext);
223
- const currentLocale = (0, react.useContext)(ClarifyLocaleContext);
222
+ const config = (0, react.useContext)(ConfigContext);
223
+ const currentLocale = (0, react.useContext)(LocaleContext);
224
224
  const resolvedLocale = locale ?? currentLocale ?? config?.i18n?.defaultLocale;
225
225
  return (key, replacements) => translateBuiltInText(resolvedLocale, key, replacements);
226
226
  }
@@ -282,7 +282,7 @@ function getAbsoluteUrl(path) {
282
282
  return new URL(path, window.location.href).href;
283
283
  }
284
284
  function ContentActions(arg0) {
285
- const { hasTabs = false, route, routePrefix } = arg0;
285
+ const { route, routePrefix } = arg0;
286
286
  const t = useBuiltInText();
287
287
  const [copied, setCopied] = (0, react.useState)("idle");
288
288
  if (!route?.contentArtifactUrl && !route?.sourceUrl) return null;
@@ -333,29 +333,36 @@ function ContentActions(arg0) {
333
333
  const primaryAction = actions[0];
334
334
  const PrimaryIcon = primaryAction && copied === primaryAction.key ? lucide_react.Check : primaryAction?.icon ?? lucide_react.PencilLine;
335
335
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
336
- className: `clarify-content-actions pointer-events-none 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",
337
337
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Menu, {
338
338
  as: "div",
339
- className: "clarify-content-actions-menu pointer-events-auto relative inline-flex text-sm font-medium",
339
+ className: "clarify-content-actions-menu relative inline-flex min-w-0 text-sm font-medium",
340
340
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
341
- 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",
342
342
  children: [primaryAction ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
343
343
  type: "button",
344
344
  onClick: primaryAction.run,
345
- className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 items-center gap-1.5 px-3 transition",
346
- 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
+ })]
347
350
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
348
351
  href: route.sourceUrl,
349
352
  target: "_blank",
350
353
  rel: "noreferrer",
351
- className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 items-center gap-1.5 px-3 no-underline transition",
352
- 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
+ })]
353
359
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuButton, {
354
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",
355
361
  "aria-label": t("contentActions.copyOptions"),
356
362
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "h-3.5 w-3.5" })
357
363
  })]
358
364
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.MenuItems, {
365
+ modal: false,
359
366
  anchor: "bottom end",
360
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",
361
368
  children: [
@@ -485,174 +492,102 @@ function ContentActions(arg0) {
485
492
  });
486
493
  }
487
494
  //#endregion
488
- //#region source/theme/variables.ts
489
- var themeStorageKey = "clarify:theme";
490
- var clarifyThemePresets = {
491
- default: {
492
- preset: "default",
493
- tokens: {
494
- colors: {
495
- primary: "#047857",
496
- accent: "#0D9488",
497
- background: "#ffffff",
498
- foreground: "#111827",
499
- surface: "#ffffff",
500
- muted: "#64748b",
501
- border: "rgb(15 23 42 / 0.12)",
502
- codeBackground: "#f6fbf8"
503
- },
504
- radius: {
505
- sm: "6px",
506
- md: "10px",
507
- lg: "14px",
508
- xl: "18px"
509
- }
510
- },
511
- layout: { maxWidth: "82rem" },
512
- editor: false
513
- },
514
- base: {
515
- preset: "base",
516
- tokens: {
517
- colors: {
518
- primary: "#18181b",
519
- accent: "#52525b",
520
- background: "#ffffff",
521
- foreground: "#18181b",
522
- surface: "#ffffff",
523
- muted: "#71717a",
524
- border: "rgb(24 24 27 / 0.12)",
525
- codeBackground: "#f4f4f5"
526
- },
527
- radius: {
528
- sm: "6px",
529
- md: "8px",
530
- lg: "12px",
531
- xl: "16px"
532
- }
533
- },
534
- layout: { maxWidth: "80rem" },
535
- editor: false
536
- }
537
- };
538
- function cloneThemeColorValue(value) {
539
- return typeof value === "string" ? value : { ...value };
540
- }
541
- function cloneTheme(theme) {
542
- return {
543
- preset: theme.preset,
544
- tokens: {
545
- colors: {
546
- primary: cloneThemeColorValue(theme.tokens.colors.primary),
547
- accent: cloneThemeColorValue(theme.tokens.colors.accent),
548
- background: cloneThemeColorValue(theme.tokens.colors.background),
549
- foreground: cloneThemeColorValue(theme.tokens.colors.foreground),
550
- surface: cloneThemeColorValue(theme.tokens.colors.surface),
551
- muted: cloneThemeColorValue(theme.tokens.colors.muted),
552
- border: cloneThemeColorValue(theme.tokens.colors.border),
553
- codeBackground: cloneThemeColorValue(theme.tokens.colors.codeBackground)
554
- },
555
- radius: { ...theme.tokens.radius }
556
- },
557
- layout: { ...theme.layout },
558
- editor: theme.editor
559
- };
560
- }
561
- function isModeColorValue(value) {
562
- return typeof value === "object" && value !== null;
563
- }
564
- function resolveThemeColorValue(value, resolvedTheme = "light") {
565
- if (!isModeColorValue(value)) return value;
566
- return value[resolvedTheme] ?? value.light ?? value.dark ?? "";
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
+ });
567
536
  }
568
- function resolveThemeColors(colors, resolvedTheme = "light") {
569
- return {
570
- primary: resolveThemeColorValue(colors.primary, resolvedTheme),
571
- accent: resolveThemeColorValue(colors.accent, resolvedTheme),
572
- background: resolveThemeColorValue(colors.background, resolvedTheme),
573
- foreground: resolveThemeColorValue(colors.foreground, resolvedTheme),
574
- surface: resolveThemeColorValue(colors.surface, resolvedTheme),
575
- muted: resolveThemeColorValue(colors.muted, resolvedTheme),
576
- border: resolveThemeColorValue(colors.border, resolvedTheme),
577
- codeBackground: resolveThemeColorValue(colors.codeBackground, resolvedTheme)
578
- };
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;
579
569
  }
580
- function matchesPresetTheme(theme) {
581
- const preset = clarifyThemePresets[theme.preset];
582
- return JSON.stringify({
583
- tokens: theme.tokens,
584
- layout: theme.layout
585
- }) === JSON.stringify({
586
- tokens: preset.tokens,
587
- layout: preset.layout
570
+ function deleteCookie(name, options = {}) {
571
+ writeCookie(name, "", {
572
+ domain: options.domain,
573
+ maxAge: 0
588
574
  });
589
575
  }
590
- function effectiveTheme(theme, resolvedTheme) {
591
- if (resolvedTheme !== "dark" || !matchesPresetTheme(theme)) return theme;
592
- return {
593
- ...theme,
594
- tokens: {
595
- ...theme.tokens,
596
- colors: {
597
- ...theme.tokens.colors,
598
- background: "#09090b",
599
- foreground: "#ffffff",
600
- surface: "#18181b",
601
- muted: "#a1a1aa",
602
- border: "rgb(255 255 255 / 0.1)",
603
- codeBackground: "#18181b"
604
- }
605
- }
606
- };
607
- }
608
- function themeToCssVariables(theme, resolvedTheme) {
609
- const resolved = effectiveTheme(theme, resolvedTheme);
610
- const colors = resolveThemeColors(resolved.tokens.colors, resolvedTheme);
611
- const { radius } = resolved.tokens;
612
- return {
613
- "--clarify-theme-tokens-colors-primary": colors.primary,
614
- "--clarify-theme-tokens-colors-accent": colors.accent,
615
- "--clarify-theme-tokens-colors-background": colors.background,
616
- "--clarify-theme-tokens-colors-foreground": colors.foreground,
617
- "--clarify-theme-tokens-colors-surface": colors.surface,
618
- "--clarify-theme-tokens-colors-muted": colors.muted,
619
- "--clarify-theme-tokens-colors-border": colors.border,
620
- "--clarify-theme-tokens-colors-code-background": colors.codeBackground,
621
- "--clarify-theme-tokens-radius-sm": radius.sm,
622
- "--clarify-theme-tokens-radius-md": radius.md,
623
- "--clarify-theme-tokens-radius-lg": radius.lg,
624
- "--clarify-theme-tokens-radius-xl": radius.xl,
625
- "--clarify-theme-layout-max-width": resolved.layout.maxWidth
626
- };
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 {}
627
588
  }
628
- function themeBootstrapScript(theme = clarifyThemePresets.default) {
629
- const darkVariables = themeToCssVariables(theme, "dark");
630
- const lightVariables = themeToCssVariables(theme, "light");
631
- 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){}})();`;
632
- }
633
- function uniqueElements(elements) {
634
- return Array.from(new Set(elements));
635
- }
636
- function resolveThemeVariableTargets(target) {
637
- if (typeof document === "undefined") return [];
638
- if (target instanceof HTMLElement) return [target];
639
- if (typeof target === "string") return Array.from(document.querySelectorAll(target));
640
- return uniqueElements([document.documentElement, ...Array.from(document.querySelectorAll(".clarify-app"))]);
641
- }
642
- function applyThemeCssVariables(variables, targets) {
643
- const previousValues = /* @__PURE__ */ new Map();
644
- for (const element of targets) {
645
- const elementPreviousValues = /* @__PURE__ */ new Map();
646
- for (const [property, value] of Object.entries(variables)) {
647
- elementPreviousValues.set(property, element.style.getPropertyValue(property));
648
- element.style.setProperty(property, value);
649
- }
650
- previousValues.set(element, elementPreviousValues);
651
- }
652
- return () => {
653
- for (const [element, elementPreviousValues] of previousValues) for (const [property, previousValue] of elementPreviousValues) if (previousValue) element.style.setProperty(property, previousValue);
654
- else element.style.removeProperty(property);
655
- };
589
+ function isIpAddress(hostname) {
590
+ return /^\d{1,3}(?:\.\d{1,3}){3}$/.test(hostname) || hostname.includes(":");
656
591
  }
657
592
  //#endregion
658
593
  //#region source/theme/ThemeProvider.tsx
@@ -663,18 +598,10 @@ function getSystemTheme() {
663
598
  }
664
599
  function getStoredTheme() {
665
600
  if (typeof window === "undefined") return "system";
666
- try {
667
- const storedTheme = window.localStorage.getItem(themeStorageKey);
668
- return storedTheme === "light" || storedTheme === "dark" || storedTheme === "system" ? storedTheme : "system";
669
- } catch {
670
- return "system";
671
- }
601
+ return getStoredThemePreference();
672
602
  }
673
603
  function storeTheme(theme) {
674
- if (typeof window === "undefined") return;
675
- try {
676
- window.localStorage.setItem(themeStorageKey, theme);
677
- } catch {}
604
+ storeThemePreference(theme);
678
605
  }
679
606
  function applyTheme(resolvedTheme) {
680
607
  if (typeof document === "undefined") return;
@@ -911,7 +838,7 @@ function SectionBadge(arg0) {
911
838
  });
912
839
  }
913
840
  function NavLink(arg0) {
914
- const { href, children, badge, icon, active = false, isAnchorLink = false } = arg0;
841
+ const { href, children, badge, icon, active = false, isAnchorLink = false, level } = arg0;
915
842
  function handleClick() {
916
843
  if (!isAnchorLink) return;
917
844
  const hashIndex = href.indexOf("#");
@@ -929,7 +856,8 @@ function NavLink(arg0) {
929
856
  to: href,
930
857
  "aria-current": active ? "page" : void 0,
931
858
  onClick: handleClick,
932
- 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,
933
861
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
934
862
  className: "flex min-w-0 flex-1 items-center gap-2",
935
863
  children: [
@@ -1073,6 +1001,7 @@ function NavigationGroup(arg0) {
1073
1001
  badge: section.badge,
1074
1002
  tags: section.tags,
1075
1003
  isAnchorLink: true,
1004
+ level: section.level,
1076
1005
  children: section.title
1077
1006
  }) }, section.id))
1078
1007
  }) : null
@@ -1807,6 +1736,7 @@ function LanguageSwitcher(arg0) {
1807
1736
  const selected = locale.code === selectedLocale;
1808
1737
  return [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: ({ focus }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
1809
1738
  to: `${localizedPath}${suffix}`,
1739
+ onClick: () => storeLocalePreference(locale.code),
1810
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"),
1811
1741
  "aria-current": selected ? "true" : void 0,
1812
1742
  lang: locale.code,
@@ -1835,6 +1765,10 @@ function TopLevelNavItem(arg0) {
1835
1765
  children
1836
1766
  }) });
1837
1767
  }
1768
+ function resolveHomeHref(config, currentLocale) {
1769
+ const homeUrl = config.homeUrl ?? "/";
1770
+ return isExternalHref(homeUrl) ? homeUrl : localizeHref(homeUrl, config, currentLocale);
1771
+ }
1838
1772
  function MobileNavbarMenu(arg0) {
1839
1773
  const { links, config, currentLocale } = arg0;
1840
1774
  const t = useBuiltInText();
@@ -1916,10 +1850,12 @@ function ProductTabs(arg0) {
1916
1850
  });
1917
1851
  }
1918
1852
  var Header = (0, react.forwardRef)(function Header(arg0, ref) {
1919
- const { config, navigation, tabs, routes, currentLocale, currentRoute, className, ...props } = arg0;
1853
+ const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, className, ...props } = arg0;
1920
1854
  const t = useBuiltInText();
1921
1855
  const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
1922
1856
  const isInsideMobileNavigation = useIsInsideMobileNavigation();
1857
+ const homeHref = resolveHomeHref(config, currentLocale);
1858
+ const homeExternal = isExternalHref(homeHref);
1923
1859
  const { scrollY } = (0, framer_motion.useScroll)();
1924
1860
  const bgOpacityLight = (0, framer_motion.useTransform)(scrollY, [0, 72], ["70%", "95%"]);
1925
1861
  const bgOpacityDark = (0, framer_motion.useTransform)(scrollY, [0, 72], ["60%", "92%"]);
@@ -1932,105 +1868,135 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
1932
1868
  "--bg-opacity-light": bgOpacityLight,
1933
1869
  "--bg-opacity-dark": bgOpacityDark
1934
1870
  },
1935
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1936
- 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"),
1937
- children: [
1938
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1939
- className: "clarify-header-left flex min-w-0 items-center gap-5",
1940
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1941
- className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
1942
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
1943
- config,
1944
- navigation,
1945
- tabs,
1946
- routes,
1947
- currentLocale,
1948
- currentRoute
1949
- })
1950
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
1951
- as: react_router_dom.Link,
1952
- to: localizeHref("/", config, currentLocale),
1953
- "aria-label": t("navbar.home"),
1954
- className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
1955
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
1956
- logo: config.logo,
1957
- className: "h-6 w-auto shrink-0 object-contain"
1958
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1959
- className: "clarify-brand-title truncate font-semibold",
1960
- children: config.title
1961
- })]
1962
- })]
1963
- }),
1964
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1965
- className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
1966
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
1967
- routes,
1968
- navigation,
1969
- routePrefix: config.routePrefix,
1970
- currentLocale
1971
- })
1972
- }),
1973
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1974
- className: "clarify-header-actions flex shrink-0 items-center gap-5",
1975
- children: [
1976
- config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
1977
- className: "clarify-top-nav hidden md:block",
1978
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1979
- role: "list",
1980
- className: "flex items-center gap-8",
1981
- children: config.navbar.links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
1982
- href: localizeHref(link.href, config, currentLocale),
1983
- children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
1984
- }, 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
1985
1886
  })
1986
- }) : null,
1987
- 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,
1988
- /* @__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, {
1989
1916
  routes,
1990
1917
  navigation,
1991
1918
  routePrefix: config.routePrefix,
1992
1919
  currentLocale
1993
- }),
1994
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
1995
- config,
1996
- currentLocale,
1997
- currentRoute
1998
- }),
1999
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {}),
2000
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavbarMenu, {
2001
- links: config.navbar?.links,
2002
- config,
2003
- currentLocale
2004
1920
  })
2005
- ]
2006
- })
2007
- ]
2008
- }), /* @__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
+ ]
2009
1961
  });
2010
1962
  });
2011
1963
  //#endregion
2012
- Object.defineProperty(exports, "ClarifyConfigContext", {
2013
- enumerable: true,
2014
- get: function() {
2015
- return ClarifyConfigContext;
2016
- }
2017
- });
2018
- 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", {
2019
1985
  enumerable: true,
2020
1986
  get: function() {
2021
- return ClarifyLocaleContext;
1987
+ return ConfigContext;
2022
1988
  }
2023
1989
  });
2024
- Object.defineProperty(exports, "ContentActions", {
1990
+ Object.defineProperty(exports, "Header", {
2025
1991
  enumerable: true,
2026
1992
  get: function() {
2027
- return ContentActions;
1993
+ return Header;
2028
1994
  }
2029
1995
  });
2030
- Object.defineProperty(exports, "Header", {
1996
+ Object.defineProperty(exports, "LocaleContext", {
2031
1997
  enumerable: true,
2032
1998
  get: function() {
2033
- return Header;
1999
+ return LocaleContext;
2034
2000
  }
2035
2001
  });
2036
2002
  Object.defineProperty(exports, "Navigation", {
@@ -2045,6 +2011,18 @@ Object.defineProperty(exports, "OpenApisContext", {
2045
2011
  return OpenApisContext;
2046
2012
  }
2047
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
+ });
2048
2026
  Object.defineProperty(exports, "SectionProvider", {
2049
2027
  enumerable: true,
2050
2028
  get: function() {
@@ -2063,28 +2041,22 @@ Object.defineProperty(exports, "ThemeToggle", {
2063
2041
  return ThemeToggle;
2064
2042
  }
2065
2043
  });
2066
- Object.defineProperty(exports, "applyThemeCssVariables", {
2067
- enumerable: true,
2068
- get: function() {
2069
- return applyThemeCssVariables;
2070
- }
2071
- });
2072
- Object.defineProperty(exports, "clarifyThemePresets", {
2044
+ Object.defineProperty(exports, "copyTextToClipboard", {
2073
2045
  enumerable: true,
2074
2046
  get: function() {
2075
- return clarifyThemePresets;
2047
+ return copyTextToClipboard;
2076
2048
  }
2077
2049
  });
2078
- Object.defineProperty(exports, "cloneTheme", {
2050
+ Object.defineProperty(exports, "getStoredLocalePreference", {
2079
2051
  enumerable: true,
2080
2052
  get: function() {
2081
- return cloneTheme;
2053
+ return getStoredLocalePreference;
2082
2054
  }
2083
2055
  });
2084
- Object.defineProperty(exports, "copyTextToClipboard", {
2056
+ Object.defineProperty(exports, "getStoredThemePreference", {
2085
2057
  enumerable: true,
2086
2058
  get: function() {
2087
- return copyTextToClipboard;
2059
+ return getStoredThemePreference;
2088
2060
  }
2089
2061
  });
2090
2062
  Object.defineProperty(exports, "isExternalHref", {
@@ -2099,6 +2071,12 @@ Object.defineProperty(exports, "isSameRoutePath", {
2099
2071
  return isSameRoutePath;
2100
2072
  }
2101
2073
  });
2074
+ Object.defineProperty(exports, "localeCookieName", {
2075
+ enumerable: true,
2076
+ get: function() {
2077
+ return localeCookieName;
2078
+ }
2079
+ });
2102
2080
  Object.defineProperty(exports, "localizeHref", {
2103
2081
  enumerable: true,
2104
2082
  get: function() {
@@ -2123,28 +2101,22 @@ Object.defineProperty(exports, "prefixHref", {
2123
2101
  return prefixHref;
2124
2102
  }
2125
2103
  });
2126
- Object.defineProperty(exports, "remToPx", {
2104
+ Object.defineProperty(exports, "readLocaleCookie", {
2127
2105
  enumerable: true,
2128
2106
  get: function() {
2129
- return remToPx;
2107
+ return readLocaleCookie;
2130
2108
  }
2131
2109
  });
2132
- Object.defineProperty(exports, "resolveLucideIconName", {
2133
- enumerable: true,
2134
- get: function() {
2135
- return resolveLucideIconName;
2136
- }
2137
- });
2138
- Object.defineProperty(exports, "resolveThemeColorValue", {
2110
+ Object.defineProperty(exports, "remToPx", {
2139
2111
  enumerable: true,
2140
2112
  get: function() {
2141
- return resolveThemeColorValue;
2113
+ return remToPx;
2142
2114
  }
2143
2115
  });
2144
- Object.defineProperty(exports, "resolveThemeVariableTargets", {
2116
+ Object.defineProperty(exports, "resolveLucideIconName", {
2145
2117
  enumerable: true,
2146
2118
  get: function() {
2147
- return resolveThemeVariableTargets;
2119
+ return resolveLucideIconName;
2148
2120
  }
2149
2121
  });
2150
2122
  Object.defineProperty(exports, "safeDecodeURIComponent", {
@@ -2153,22 +2125,22 @@ Object.defineProperty(exports, "safeDecodeURIComponent", {
2153
2125
  return safeDecodeURIComponent;
2154
2126
  }
2155
2127
  });
2156
- Object.defineProperty(exports, "themeBootstrapScript", {
2128
+ Object.defineProperty(exports, "storeLocalePreference", {
2157
2129
  enumerable: true,
2158
2130
  get: function() {
2159
- return themeBootstrapScript;
2131
+ return storeLocalePreference;
2160
2132
  }
2161
2133
  });
2162
- Object.defineProperty(exports, "themeStorageKey", {
2134
+ Object.defineProperty(exports, "storeThemePreference", {
2163
2135
  enumerable: true,
2164
2136
  get: function() {
2165
- return themeStorageKey;
2137
+ return storeThemePreference;
2166
2138
  }
2167
2139
  });
2168
- Object.defineProperty(exports, "themeToCssVariables", {
2140
+ Object.defineProperty(exports, "themeCookieName", {
2169
2141
  enumerable: true,
2170
2142
  get: function() {
2171
- return themeToCssVariables;
2143
+ return themeCookieName;
2172
2144
  }
2173
2145
  });
2174
2146
  Object.defineProperty(exports, "useBuiltInText", {
@@ -2177,16 +2149,16 @@ Object.defineProperty(exports, "useBuiltInText", {
2177
2149
  return useBuiltInText;
2178
2150
  }
2179
2151
  });
2180
- Object.defineProperty(exports, "useClarifyConfig", {
2152
+ Object.defineProperty(exports, "useConfig", {
2181
2153
  enumerable: true,
2182
2154
  get: function() {
2183
- return useClarifyConfig;
2155
+ return useConfig;
2184
2156
  }
2185
2157
  });
2186
- Object.defineProperty(exports, "useClarifyLocale", {
2158
+ Object.defineProperty(exports, "useLocale", {
2187
2159
  enumerable: true,
2188
2160
  get: function() {
2189
- return useClarifyLocale;
2161
+ return useLocale;
2190
2162
  }
2191
2163
  });
2192
2164
  Object.defineProperty(exports, "useOpenApis", {
@@ -2208,4 +2180,4 @@ Object.defineProperty(exports, "useTheme", {
2208
2180
  }
2209
2181
  });
2210
2182
 
2211
- //# sourceMappingURL=shell-xxhV0p7k.cjs.map
2183
+ //# sourceMappingURL=PageActions-1RDCHcUY.cjs.map