@clarify-labs/renderer 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/output/{ClarifyShell-291_IXxJ.js → ClarifyShell-BQ29N8P5.js} +223 -161
  2. package/output/ClarifyShell-BQ29N8P5.js.map +1 -0
  3. package/output/{ClarifyShell-DJ4fOVOd.cjs → ClarifyShell-Dm--LZco.cjs} +224 -162
  4. package/output/ClarifyShell-Dm--LZco.cjs.map +1 -0
  5. package/output/{OpenApiOperation-E8lSLsSK.js → OpenApiOperation-C9xyRo5a.js} +597 -292
  6. package/output/OpenApiOperation-C9xyRo5a.js.map +1 -0
  7. package/output/{OpenApiOperation-3DUVruIO.cjs → OpenApiOperation-DIWGdw29.cjs} +595 -290
  8. package/output/OpenApiOperation-DIWGdw29.cjs.map +1 -0
  9. package/output/{PageActions-DaXQgMYP.js → PageActions-B_tSec1f.js} +282 -197
  10. package/output/PageActions-B_tSec1f.js.map +1 -0
  11. package/output/{PageActions-GI1t-JrR.cjs → PageActions-DEuFHgyB.cjs} +280 -201
  12. package/output/PageActions-DEuFHgyB.cjs.map +1 -0
  13. package/output/app/SectionProvider.d.ts +1 -1
  14. package/output/client.cjs +3 -3
  15. package/output/client.js +3 -3
  16. package/output/components/Tabs.d.ts +16 -0
  17. package/output/components/index.d.ts +1 -0
  18. package/output/core/i18n.d.ts +1 -1
  19. package/output/core/types.d.ts +1 -0
  20. package/output/index.cjs +4 -4
  21. package/output/index.js +4 -4
  22. package/output/openapi/components/CodeDisplay.d.ts +25 -0
  23. package/output/openapi/components/EndpointSections.d.ts +6 -0
  24. package/output/openapi/components/ExamplePanels.d.ts +10 -17
  25. package/output/openapi/components/OpenApiOperation.d.ts +6 -0
  26. package/output/openapi/components/OpenApiOperation.state.d.ts +43 -0
  27. package/output/openapi/components/SchemaProperties.d.ts +2 -0
  28. package/output/openapi/components/SelectControl.d.ts +15 -0
  29. package/output/openapi/components/helpers.d.ts +22 -0
  30. package/output/preview.cjs +114 -67
  31. package/output/preview.cjs.map +1 -1
  32. package/output/preview.js +114 -67
  33. package/output/preview.js.map +1 -1
  34. package/output/{render-r9DclX3Y.cjs → render-BCGK1WpS.cjs} +2 -2
  35. package/output/{render-r9DclX3Y.cjs.map → render-BCGK1WpS.cjs.map} +1 -1
  36. package/output/{render-yBo2SUlA.js → render-CEWLJSmt.js} +2 -2
  37. package/output/{render-yBo2SUlA.js.map → render-CEWLJSmt.js.map} +1 -1
  38. package/output/renderer.css +207 -104
  39. package/output/server.cjs +2 -2
  40. package/output/server.js +2 -2
  41. package/output/shell/Header.d.ts +2 -0
  42. package/package.json +1 -1
  43. package/output/ClarifyShell-291_IXxJ.js.map +0 -1
  44. package/output/ClarifyShell-DJ4fOVOd.cjs.map +0 -1
  45. package/output/OpenApiOperation-3DUVruIO.cjs.map +0 -1
  46. package/output/OpenApiOperation-E8lSLsSK.js.map +0 -1
  47. package/output/PageActions-DaXQgMYP.js.map +0 -1
  48. package/output/PageActions-GI1t-JrR.cjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { A as LocaleContext, C as themeCookieName, D as copyTextToClipboard, M as useConfig, N as useLocale, O as useBuiltInText, T as localizeHref, _ as getStoredLocalePreference, a as safeDecodeURIComponent, d as isSameRoutePath, f as normalizeRoutePath, g as useTheme, h as ThemeProvider, i as Navigation, j as OpenApisContext, k as ConfigContext, o as SectionProvider, p as resolveLocalizedText, r as Header, t as PageActionsProvider, w as isExternalHref, x as storeLocalePreference } from "./PageActions-DaXQgMYP.js";
1
+ import { A as OpenApisContext, C as isExternalHref, D as useBuiltInText, E as copyTextToClipboard, M as useLocale, O as ConfigContext, S as themeCookieName, a as SectionProvider, b as storeLocalePreference, d as normalizeRoutePath, f as resolveLocalizedText, g as getStoredLocalePreference, h as useTheme, i as Navigation, j as useConfig, k as LocaleContext, m as ThemeProvider, r as Header, t as PageActionsProvider, u as isSameRoutePath, w as localizeHref } from "./PageActions-B_tSec1f.js";
2
2
  import clsx from "clsx";
3
3
  import { Component, Suspense, createContext, lazy, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { Link, Route, Routes, useLocation, useNavigate } from "react-router-dom";
@@ -108,6 +108,15 @@ function LazySlotComponent(props) {
108
108
  return /* @__PURE__ */ jsx(Component, {});
109
109
  }
110
110
  //#endregion
111
+ //#region source/utils/hash.ts
112
+ function safeDecodeURIComponent(value) {
113
+ try {
114
+ return decodeURIComponent(value);
115
+ } catch {
116
+ return value;
117
+ }
118
+ }
119
+ //#endregion
111
120
  //#region source/assets/clarify.svg?url
112
121
  var clarify_default = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='279px'%20height='200px'%20viewBox='0%200%20279%20200'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eclarify%3c/title%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='clarify'%20transform='translate(-0,%200.0054)'%3e%3cpath%20d='M44.867217,0.0054376148%20C130.715579,1.00591567%20200,70.9091172%20200,156.994562%20L199.986321,155.127494%20C199.384888,180.009127%20179.026368,199.994562%20154,199.994562%20L46,199.994562%20C20.5949015,199.994562%200,179.399661%200,153.994562%20L0,45.9945624%20C0,21.0975659%2019.7793434,0.820282524%2044.4815926,0.0191499894%20Z'%20fill='%2300D492'%3e%3c/path%3e%3cpath%20d='M123.867217,0.0054376148%20C209.715579,1.00591567%20279,70.9091172%20279,156.994562%20L278.986321,155.127494%20C278.384888,180.009127%20258.026368,199.994562%20233,199.994562%20L125,199.994562%20C99.5949015,199.994562%2079,179.399661%2079,153.994562%20L79,45.9945624%20C79,21.0975659%2098.7793434,0.820282524%20123.481593,0.0191499894%20Z'%20id='clarify-right'%20fill-opacity='0.6'%20fill='%2300F6C9'%20transform='translate(179,%20100)%20rotate(-90)%20translate(-179,%20-100)'%3e%3c/path%3e%3cpath%20d='M199.979267,154.416906%20L199.984438,155.157125%20L199.962366,155.872459%20C198.977251,180.406837%20178.776104,199.994562%20154,199.994562%20L124.372438,199.994125%20L124.249053,199.994081%20C99.6939678,199.603921%2079.8122712,179.973634%2079.01915,155.518407%20L79.0054376,155.132783%20C79.5830823,105.566626%20103.129768,61.5221348%20139.498462,33.1463428%20C175.69419,61.3871018%20199.186123,105.143863%20199.979267,154.416906%20Z'%20id='形状结合'%20fill='%2300F692'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e";
113
122
  //#endregion
@@ -620,11 +629,24 @@ function resolveRouteComponent(route) {
620
629
  function scrollToHash(hash) {
621
630
  if (!hash) return;
622
631
  const targetId = safeDecodeURIComponent(hash.slice(1));
623
- window.requestAnimationFrame(() => {
624
- document.getElementById(targetId)?.scrollIntoView();
632
+ const tryScrollToTarget = (attempt = 0) => {
633
+ const target = document.getElementById(targetId);
634
+ if (!target) {
635
+ if (attempt < 12) window.requestAnimationFrame(() => {
636
+ tryScrollToTarget(attempt + 1);
637
+ });
638
+ return;
639
+ }
640
+ target.scrollIntoView({
641
+ behavior: "smooth",
642
+ block: "start"
643
+ });
625
644
  window.requestAnimationFrame(() => {
626
645
  window.dispatchEvent(new Event("scroll"));
627
646
  });
647
+ };
648
+ window.requestAnimationFrame(() => {
649
+ tryScrollToTarget();
628
650
  });
629
651
  }
630
652
  function explicitLocaleForPath(config, pathname) {
@@ -713,7 +735,7 @@ function emptySubscribe() {
713
735
  return () => {};
714
736
  }
715
737
  function useStoredBannerDismissed(storageKey) {
716
- return useSyncExternalStore(emptySubscribe, () => Boolean(storageKey && window.localStorage.getItem(storageKey) === "1"), () => false);
738
+ return useSyncExternalStore(emptySubscribe, () => Boolean(storageKey && window.localStorage.getItem(storageKey) === "1"), () => true);
717
739
  }
718
740
  function useBannerState(config, currentLocale) {
719
741
  const banner = config.banner;
@@ -730,13 +752,11 @@ function useBannerState(config, currentLocale) {
730
752
  dismissBanner: () => setDismissedBannerKey(activeBannerKey)
731
753
  };
732
754
  }
733
- function useStoredLocalePreference(explicitLocale) {
755
+ function useAppShellNavigationEffects(arg0) {
756
+ const { config, currentRoute, explicitLocale, location, navigate, pathname, storedLocale } = arg0;
734
757
  useEffect(() => {
735
758
  if (explicitLocale) storeLocalePreference(explicitLocale);
736
759
  }, [explicitLocale]);
737
- }
738
- function useStoredLocaleRedirect(arg0) {
739
- const { config, currentRoute, explicitLocale, location, navigate, pathname, storedLocale } = arg0;
740
760
  useEffect(() => {
741
761
  if (explicitLocale || !storedLocale || isDefaultLocale(config, storedLocale)) return;
742
762
  const localizedPath = currentRoute?.alternates?.[storedLocale];
@@ -752,8 +772,6 @@ function useStoredLocaleRedirect(arg0) {
752
772
  pathname,
753
773
  storedLocale
754
774
  ]);
755
- }
756
- function useRouteScroll(location) {
757
775
  useEffect(() => {
758
776
  if (location.hash) {
759
777
  scrollToHash(location.hash);
@@ -768,40 +786,48 @@ function useRouteScroll(location) {
768
786
  });
769
787
  }, [location.hash, location.pathname]);
770
788
  }
771
- function useDocumentLanguage(currentLocale, currentLocaleConfig) {
789
+ function useAppShellDocumentEffects(arg0) {
790
+ const { currentLocale, currentLocaleConfig, config, route } = arg0;
772
791
  useEffect(() => {
773
792
  if (!currentLocale) return;
774
793
  document.documentElement.lang = currentLocale;
775
794
  if (currentLocaleConfig?.dir) document.documentElement.dir = currentLocaleConfig.dir;
776
795
  else document.documentElement.removeAttribute("dir");
777
796
  }, [currentLocale, currentLocaleConfig?.dir]);
778
- }
779
- function useDocumentMetadata(config, route) {
780
797
  useEffect(() => {
781
798
  applyDocumentMetadata(config, route);
782
799
  }, [config, route]);
783
800
  }
784
- function headerOffsetForLayout(hasTabs, hasBanner) {
785
- if (hasTabs && hasBanner) return "10rem";
786
- if (hasTabs) return "7rem";
787
- if (hasBanner) return "6.5rem";
788
- return "3.5rem";
789
- }
790
- function sidebarScrollClassName(hasTabs, hasBanner) {
791
- const classNames = ["clarify-sidebar-scroll lg:sticky lg:z-30 lg:overflow-y-auto lg:pb-8"];
792
- if (hasTabs && hasBanner) classNames.push("lg:top-40 lg:h-(--clarify-sidebar-height-with-tabs-and-banner) lg:pt-10");
793
- else if (hasTabs) classNames.push("lg:top-28 lg:h-(--clarify-sidebar-height-with-tabs) lg:pt-10");
794
- else if (hasBanner) classNames.push("lg:top-26 lg:h-(--clarify-sidebar-height-with-banner) lg:pt-10");
795
- else classNames.push("lg:top-14 lg:h-(--clarify-sidebar-height) lg:pt-10");
796
- return clsx(classNames);
797
- }
798
- function contentClassName(hasTabs, hasBanner) {
799
- const classNames = ["clarify-content @container relative flex min-h-screen min-w-0 flex-col px-4 pb-12 sm:px-6 lg:px-8 xl:px-10"];
800
- if (hasTabs && hasBanner) classNames.push("pt-26 lg:pt-40");
801
- else if (hasTabs) classNames.push("pt-14 lg:pt-28");
802
- else if (hasBanner) classNames.push("pt-26");
803
- else classNames.push("pt-14");
804
- return clsx(classNames);
801
+ var appShellLayoutConfig = {
802
+ base: {
803
+ headerOffset: "3.5rem",
804
+ sidebarScrollClassName: "lg:top-14 lg:h-(--clarify-sidebar-height) lg:pt-10",
805
+ contentClassName: "pt-14"
806
+ },
807
+ banner: {
808
+ headerOffset: "6.5rem",
809
+ sidebarScrollClassName: "lg:top-26 lg:h-(--clarify-sidebar-height-with-banner) lg:pt-10",
810
+ contentClassName: "pt-26"
811
+ },
812
+ tabs: {
813
+ headerOffset: "7rem",
814
+ sidebarScrollClassName: "lg:top-28 lg:h-(--clarify-sidebar-height-with-tabs) lg:pt-10",
815
+ contentClassName: "pt-14 lg:pt-28"
816
+ },
817
+ "tabs-banner": {
818
+ headerOffset: "10rem",
819
+ sidebarScrollClassName: "lg:top-40 lg:h-(--clarify-sidebar-height-with-tabs-and-banner) lg:pt-10",
820
+ contentClassName: "pt-26 lg:pt-40"
821
+ }
822
+ };
823
+ function getLayoutVariant(hasTabs, hasBanner) {
824
+ if (hasTabs && hasBanner) return "tabs-banner";
825
+ if (hasTabs) return "tabs";
826
+ if (hasBanner) return "banner";
827
+ return "base";
828
+ }
829
+ function getAppShellLayoutConfig(hasTabs, hasBanner) {
830
+ return appShellLayoutConfig[getLayoutVariant(hasTabs, hasBanner)];
805
831
  }
806
832
  function BuiltInNotFoundPage() {
807
833
  const text = useBuiltInText();
@@ -844,13 +870,13 @@ function AppShell(arg0) {
844
870
  const navigate = useNavigate();
845
871
  const pathname = normalizeRoutePath(location.pathname);
846
872
  const headerRef = useRef(null);
873
+ const headerTopAreaRef = useRef(null);
847
874
  const { currentRoute, explicitLocale, storedLocale, currentLocale, currentLocaleConfig, notFoundRoute, currentNavigation, sections } = useRouteState(config, routes, navigation, pathname);
848
875
  const text = useBuiltInText(currentLocale);
849
876
  const { activeBannerKey, bannerResolved, dismissedBannerKey, hasBanner, dismissBanner } = useBannerState(config, currentLocale);
850
- const hasTabs = Boolean(currentNavigation.tabs?.length);
877
+ const layoutConfig = getAppShellLayoutConfig(Boolean(currentNavigation.tabs?.length), hasBanner);
851
878
  const { renderRoutes, NotFoundRouteComponent } = useRenderedRoutes(routes, notFoundRoute);
852
- useStoredLocalePreference(explicitLocale);
853
- useStoredLocaleRedirect({
879
+ useAppShellNavigationEffects({
854
880
  config,
855
881
  currentRoute,
856
882
  explicitLocale,
@@ -859,10 +885,13 @@ function AppShell(arg0) {
859
885
  pathname,
860
886
  storedLocale
861
887
  });
862
- useRouteScroll(location);
863
- useDocumentLanguage(currentLocale, currentLocaleConfig);
864
- useDocumentMetadata(config, currentRoute ?? notFoundRoute);
865
- const layoutStyle = { "--clarify-header-offset": headerOffsetForLayout(hasTabs, hasBanner) };
888
+ useAppShellDocumentEffects({
889
+ currentLocale,
890
+ currentLocaleConfig,
891
+ config,
892
+ route: currentRoute ?? notFoundRoute
893
+ });
894
+ const layoutStyle = { "--clarify-header-offset": layoutConfig.headerOffset };
866
895
  function renderBannerSlot() {
867
896
  return /* @__PURE__ */ jsx(BannerSlot, {
868
897
  activeBannerKey,
@@ -876,6 +905,7 @@ function AppShell(arg0) {
876
905
  function renderHeader() {
877
906
  return /* @__PURE__ */ jsx(Header, {
878
907
  ref: headerRef,
908
+ topAreaRef: headerTopAreaRef,
879
909
  config,
880
910
  navigation: currentNavigation.items,
881
911
  tabs: currentNavigation.tabs,
@@ -890,7 +920,7 @@ function AppShell(arg0) {
890
920
  "data-pagefind-ignore": true,
891
921
  className: "clarify-sidebar hidden lg:block lg:self-stretch lg:bg-(--clarify-theme-tokens-colors-background) lg:px-5 xl:px-6",
892
922
  children: /* @__PURE__ */ jsx("div", {
893
- className: sidebarScrollClassName(hasTabs, hasBanner),
923
+ className: clsx("clarify-sidebar-scroll lg:sticky lg:z-30 lg:overflow-y-auto lg:pb-8", layoutConfig.sidebarScrollClassName),
894
924
  children: /* @__PURE__ */ jsx(Navigation, { navigation: currentNavigation.items })
895
925
  })
896
926
  });
@@ -944,7 +974,7 @@ function AppShell(arg0) {
944
974
  }
945
975
  function renderContent() {
946
976
  return /* @__PURE__ */ jsx("div", {
947
- className: contentClassName(hasTabs, hasBanner),
977
+ className: clsx("clarify-content @container relative flex min-h-screen min-w-0 flex-col px-4 pb-12 sm:px-6 lg:px-8 xl:px-10", layoutConfig.contentClassName),
948
978
  children: /* @__PURE__ */ jsxs(PageActionsProvider, {
949
979
  route: currentRoute,
950
980
  routePrefix: config.routePrefix,
@@ -973,7 +1003,7 @@ function AppShell(arg0) {
973
1003
  route: currentRoute,
974
1004
  children: /* @__PURE__ */ jsxs(SectionProvider, {
975
1005
  sections,
976
- headerRef,
1006
+ headerTopAreaRef,
977
1007
  children: [renderHeader(), renderLayout()]
978
1008
  })
979
1009
  })
@@ -2030,10 +2060,8 @@ function themeToConfigSource(theme) {
2030
2060
  layout: theme.layout
2031
2061
  } }, null, 2);
2032
2062
  }
2033
- function ThemeEditor(props) {
2034
- const { initialTheme, onChange, target, defaultOpen = false, className } = props;
2035
- const { resolvedTheme } = useTheme();
2036
- const [isOpen, setIsOpen] = useState(defaultOpen);
2063
+ function useThemeEditorState(arg0) {
2064
+ const { initialTheme, onChange, target, resolvedTheme } = arg0;
2037
2065
  const [theme, setTheme] = useState(() => cloneTheme(initialTheme ?? themeEditorPresets.default));
2038
2066
  const [copyState, setCopyState] = useState("idle");
2039
2067
  const configSource = useMemo(() => themeToConfigSource(theme), [theme]);
@@ -2092,122 +2120,156 @@ function ThemeEditor(props) {
2092
2120
  window.setTimeout(() => setCopyState("idle"), 1400);
2093
2121
  }
2094
2122
  }
2095
- return /* @__PURE__ */ jsxs("div", {
2096
- className: clsx("clarify-theme-editor fixed right-4 bottom-4 z-50 text-(--clarify-theme-tokens-colors-foreground)", className),
2097
- children: [isOpen ? /* @__PURE__ */ jsxs("section", {
2123
+ return {
2124
+ theme,
2125
+ copyState,
2126
+ commit,
2127
+ updatePreset,
2128
+ updateColorToken,
2129
+ updateRadiusToken,
2130
+ updateLayoutToken,
2131
+ copyConfig
2132
+ };
2133
+ }
2134
+ function ThemeEditor(props) {
2135
+ const { initialTheme, onChange, target, defaultOpen = false, className } = props;
2136
+ const { resolvedTheme } = useTheme();
2137
+ const [isOpen, setIsOpen] = useState(defaultOpen);
2138
+ const { theme, copyState, commit, updatePreset, updateColorToken, updateRadiusToken, updateLayoutToken, copyConfig } = useThemeEditorState({
2139
+ initialTheme,
2140
+ onChange,
2141
+ target,
2142
+ resolvedTheme
2143
+ });
2144
+ function renderPanelHeader() {
2145
+ return /* @__PURE__ */ jsxs("header", {
2146
+ className: "shrink-0 flex items-start justify-between gap-4 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3",
2147
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
2148
+ className: "text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2149
+ children: "Theme editor"
2150
+ }), /* @__PURE__ */ jsx("p", {
2151
+ className: "mt-0.5 text-xs/5 text-(--clarify-ui-text-soft)",
2152
+ children: "Live CSS variable preview for Clarify theme tokens."
2153
+ })] }), /* @__PURE__ */ jsx("button", {
2154
+ type: "button",
2155
+ className: "-mr-1 flex size-8 items-center justify-center rounded-(--clarify-theme-tokens-radius-md) text-(--clarify-ui-text-soft) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-ui-text-strong)",
2156
+ "aria-label": "Close theme editor",
2157
+ onClick: () => setIsOpen(false),
2158
+ children: /* @__PURE__ */ jsx(X, { className: "size-4 stroke-current stroke-2" })
2159
+ })]
2160
+ });
2161
+ }
2162
+ function renderPanelBody() {
2163
+ return /* @__PURE__ */ jsx("div", {
2164
+ className: "min-h-0 flex-1 overflow-y-auto px-4 py-4",
2165
+ children: /* @__PURE__ */ jsxs("div", {
2166
+ className: "grid gap-5",
2167
+ children: [
2168
+ /* @__PURE__ */ jsxs("label", {
2169
+ htmlFor: "clarify-theme-editor-preset",
2170
+ className: "grid gap-1.5 text-xs/5 font-medium text-(--clarify-ui-text)",
2171
+ children: ["Preset", /* @__PURE__ */ jsxs("span", {
2172
+ className: "relative block",
2173
+ children: [/* @__PURE__ */ jsxs("select", {
2174
+ id: "clarify-theme-editor-preset",
2175
+ value: theme.preset,
2176
+ className: "h-9 w-full appearance-none rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) px-2.5 pr-9 text-sm text-(--clarify-theme-tokens-colors-foreground) shadow-xs outline-none transition focus:border-(--clarify-theme-tokens-colors-primary) focus:ring-2 focus:ring-(--clarify-ui-accent-border)",
2177
+ onChange: (event) => updatePreset(event.target.value),
2178
+ children: [/* @__PURE__ */ jsx("option", {
2179
+ value: "default",
2180
+ children: "default"
2181
+ }), /* @__PURE__ */ jsx("option", {
2182
+ value: "base",
2183
+ children: "base"
2184
+ })]
2185
+ }), /* @__PURE__ */ jsx(ChevronDown, { className: "pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 stroke-current stroke-2 text-(--clarify-ui-text-faint)" })]
2186
+ })]
2187
+ }),
2188
+ /* @__PURE__ */ jsxs("fieldset", {
2189
+ className: "grid gap-3",
2190
+ children: [/* @__PURE__ */ jsx("legend", {
2191
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2192
+ children: "Colors"
2193
+ }), /* @__PURE__ */ jsx("div", {
2194
+ className: "grid grid-cols-1 gap-3",
2195
+ children: colorTokenFields.map((field) => /* @__PURE__ */ jsx(ColorField, {
2196
+ id: `clarify-theme-editor-color-${field.key}`,
2197
+ label: field.label,
2198
+ value: theme.tokens.colors[field.key],
2199
+ onChange: (mode, value) => updateColorToken(field.key, mode, value)
2200
+ }, field.key))
2201
+ })]
2202
+ }),
2203
+ /* @__PURE__ */ jsxs("fieldset", {
2204
+ className: "grid gap-3",
2205
+ children: [/* @__PURE__ */ jsx("legend", {
2206
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2207
+ children: "Radius"
2208
+ }), /* @__PURE__ */ jsx("div", {
2209
+ className: "grid grid-cols-2 gap-3",
2210
+ children: radiusTokenFields.map((field) => /* @__PURE__ */ jsx(TextField, {
2211
+ id: `clarify-theme-editor-radius-${field.key}`,
2212
+ label: field.label,
2213
+ value: theme.tokens.radius[field.key],
2214
+ onChange: (value) => updateRadiusToken(field.key, value)
2215
+ }, field.key))
2216
+ })]
2217
+ }),
2218
+ /* @__PURE__ */ jsxs("fieldset", {
2219
+ className: "grid gap-3",
2220
+ children: [/* @__PURE__ */ jsx("legend", {
2221
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2222
+ children: "Layout"
2223
+ }), layoutFields.map((field) => /* @__PURE__ */ jsx(TextField, {
2224
+ id: `clarify-theme-editor-layout-${field.key}`,
2225
+ label: field.label,
2226
+ value: theme.layout[field.key],
2227
+ onChange: (value) => updateLayoutToken(field.key, value)
2228
+ }, field.key))]
2229
+ })
2230
+ ]
2231
+ })
2232
+ });
2233
+ }
2234
+ function renderPanelFooter() {
2235
+ return /* @__PURE__ */ jsxs("footer", {
2236
+ className: "shrink-0 flex items-center justify-between gap-3 border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-ui-subtle-background) px-4 py-3",
2237
+ children: [/* @__PURE__ */ jsxs("div", {
2238
+ className: "flex items-center gap-1.5",
2239
+ children: [/* @__PURE__ */ jsx("button", {
2240
+ type: "button",
2241
+ className: "rounded-(--clarify-theme-tokens-radius-md) px-2.5 py-1.5 text-xs/5 font-semibold text-(--clarify-ui-text) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-ui-text-strong)",
2242
+ onClick: () => updatePreset(theme.preset),
2243
+ children: "Reset preset"
2244
+ }), /* @__PURE__ */ jsxs("button", {
2245
+ type: "button",
2246
+ className: "inline-flex items-center gap-1.5 rounded-(--clarify-theme-tokens-radius-md) px-2.5 py-1.5 text-xs/5 font-semibold text-(--clarify-ui-text) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-ui-text-strong)",
2247
+ onClick: () => commit(createRandomTheme()),
2248
+ children: [/* @__PURE__ */ jsx(WandSparkles, { className: "size-3.5 stroke-current stroke-2" }), "Random"]
2249
+ })]
2250
+ }), /* @__PURE__ */ jsx("button", {
2251
+ type: "button",
2252
+ className: "rounded-(--clarify-theme-tokens-radius-md) bg-(--clarify-theme-tokens-colors-primary) px-3 py-1.5 text-xs/5 font-semibold text-white shadow-xs transition hover:opacity-90",
2253
+ onClick: copyConfig,
2254
+ children: copyState === "copied" ? "Copied" : copyState === "failed" ? "Copy failed" : "Copy config"
2255
+ })]
2256
+ });
2257
+ }
2258
+ function renderEditorPanel() {
2259
+ if (!isOpen) return null;
2260
+ return /* @__PURE__ */ jsxs("section", {
2098
2261
  className: "mb-3 flex max-h-(--clarify-theme-editor-panel-max-height) w-(--clarify-theme-editor-width) flex-col overflow-hidden rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface)/95 shadow-2xl shadow-zinc-900/15 backdrop-blur",
2099
2262
  "aria-label": "Clarify theme editor",
2100
2263
  children: [
2101
- /* @__PURE__ */ jsxs("header", {
2102
- className: "shrink-0 flex items-start justify-between gap-4 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3",
2103
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
2104
- className: "text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2105
- children: "Theme editor"
2106
- }), /* @__PURE__ */ jsx("p", {
2107
- className: "mt-0.5 text-xs/5 text-(--clarify-ui-text-soft)",
2108
- children: "Live CSS variable preview for Clarify theme tokens."
2109
- })] }), /* @__PURE__ */ jsx("button", {
2110
- type: "button",
2111
- className: "-mr-1 flex size-8 items-center justify-center rounded-(--clarify-theme-tokens-radius-md) text-(--clarify-ui-text-soft) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-ui-text-strong)",
2112
- "aria-label": "Close theme editor",
2113
- onClick: () => setIsOpen(false),
2114
- children: /* @__PURE__ */ jsx(X, { className: "size-4 stroke-current stroke-2" })
2115
- })]
2116
- }),
2117
- /* @__PURE__ */ jsx("div", {
2118
- className: "min-h-0 flex-1 overflow-y-auto px-4 py-4",
2119
- children: /* @__PURE__ */ jsxs("div", {
2120
- className: "grid gap-5",
2121
- children: [
2122
- /* @__PURE__ */ jsxs("label", {
2123
- htmlFor: "clarify-theme-editor-preset",
2124
- className: "grid gap-1.5 text-xs/5 font-medium text-(--clarify-ui-text)",
2125
- children: ["Preset", /* @__PURE__ */ jsxs("span", {
2126
- className: "relative block",
2127
- children: [/* @__PURE__ */ jsxs("select", {
2128
- id: "clarify-theme-editor-preset",
2129
- value: theme.preset,
2130
- className: "h-9 w-full appearance-none rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) px-2.5 pr-9 text-sm text-(--clarify-theme-tokens-colors-foreground) shadow-xs outline-none transition focus:border-(--clarify-theme-tokens-colors-primary) focus:ring-2 focus:ring-(--clarify-ui-accent-border)",
2131
- onChange: (event) => updatePreset(event.target.value),
2132
- children: [/* @__PURE__ */ jsx("option", {
2133
- value: "default",
2134
- children: "default"
2135
- }), /* @__PURE__ */ jsx("option", {
2136
- value: "base",
2137
- children: "base"
2138
- })]
2139
- }), /* @__PURE__ */ jsx(ChevronDown, { className: "pointer-events-none absolute top-1/2 right-3 size-4 -translate-y-1/2 stroke-current stroke-2 text-(--clarify-ui-text-faint)" })]
2140
- })]
2141
- }),
2142
- /* @__PURE__ */ jsxs("fieldset", {
2143
- className: "grid gap-3",
2144
- children: [/* @__PURE__ */ jsx("legend", {
2145
- className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2146
- children: "Colors"
2147
- }), /* @__PURE__ */ jsx("div", {
2148
- className: "grid grid-cols-1 gap-3",
2149
- children: colorTokenFields.map((field) => /* @__PURE__ */ jsx(ColorField, {
2150
- id: `clarify-theme-editor-color-${field.key}`,
2151
- label: field.label,
2152
- value: theme.tokens.colors[field.key],
2153
- onChange: (mode, value) => updateColorToken(field.key, mode, value)
2154
- }, field.key))
2155
- })]
2156
- }),
2157
- /* @__PURE__ */ jsxs("fieldset", {
2158
- className: "grid gap-3",
2159
- children: [/* @__PURE__ */ jsx("legend", {
2160
- className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2161
- children: "Radius"
2162
- }), /* @__PURE__ */ jsx("div", {
2163
- className: "grid grid-cols-2 gap-3",
2164
- children: radiusTokenFields.map((field) => /* @__PURE__ */ jsx(TextField, {
2165
- id: `clarify-theme-editor-radius-${field.key}`,
2166
- label: field.label,
2167
- value: theme.tokens.radius[field.key],
2168
- onChange: (value) => updateRadiusToken(field.key, value)
2169
- }, field.key))
2170
- })]
2171
- }),
2172
- /* @__PURE__ */ jsxs("fieldset", {
2173
- className: "grid gap-3",
2174
- children: [/* @__PURE__ */ jsx("legend", {
2175
- className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2176
- children: "Layout"
2177
- }), layoutFields.map((field) => /* @__PURE__ */ jsx(TextField, {
2178
- id: `clarify-theme-editor-layout-${field.key}`,
2179
- label: field.label,
2180
- value: theme.layout[field.key],
2181
- onChange: (value) => updateLayoutToken(field.key, value)
2182
- }, field.key))]
2183
- })
2184
- ]
2185
- })
2186
- }),
2187
- /* @__PURE__ */ jsxs("footer", {
2188
- className: "shrink-0 flex items-center justify-between gap-3 border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-ui-subtle-background) px-4 py-3",
2189
- children: [/* @__PURE__ */ jsxs("div", {
2190
- className: "flex items-center gap-1.5",
2191
- children: [/* @__PURE__ */ jsx("button", {
2192
- type: "button",
2193
- className: "rounded-(--clarify-theme-tokens-radius-md) px-2.5 py-1.5 text-xs/5 font-semibold text-(--clarify-ui-text) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-ui-text-strong)",
2194
- onClick: () => updatePreset(theme.preset),
2195
- children: "Reset preset"
2196
- }), /* @__PURE__ */ jsxs("button", {
2197
- type: "button",
2198
- className: "inline-flex items-center gap-1.5 rounded-(--clarify-theme-tokens-radius-md) px-2.5 py-1.5 text-xs/5 font-semibold text-(--clarify-ui-text) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-ui-text-strong)",
2199
- onClick: () => commit(createRandomTheme()),
2200
- children: [/* @__PURE__ */ jsx(WandSparkles, { className: "size-3.5 stroke-current stroke-2" }), "Random"]
2201
- })]
2202
- }), /* @__PURE__ */ jsx("button", {
2203
- type: "button",
2204
- className: "rounded-(--clarify-theme-tokens-radius-md) bg-(--clarify-theme-tokens-colors-primary) px-3 py-1.5 text-xs/5 font-semibold text-white shadow-xs transition hover:opacity-90",
2205
- onClick: copyConfig,
2206
- children: copyState === "copied" ? "Copied" : copyState === "failed" ? "Copy failed" : "Copy config"
2207
- })]
2208
- })
2264
+ renderPanelHeader(),
2265
+ renderPanelBody(),
2266
+ renderPanelFooter()
2209
2267
  ]
2210
- }) : null, /* @__PURE__ */ jsx("button", {
2268
+ });
2269
+ }
2270
+ return /* @__PURE__ */ jsxs("div", {
2271
+ className: clsx("clarify-theme-editor fixed right-4 bottom-4 z-50 text-(--clarify-theme-tokens-colors-foreground)", className),
2272
+ children: [renderEditorPanel(), /* @__PURE__ */ jsx("button", {
2211
2273
  type: "button",
2212
2274
  className: "ml-auto flex size-12 items-center justify-center rounded-full border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface)/95 text-(--clarify-theme-tokens-colors-primary) shadow-xl shadow-zinc-900/15 backdrop-blur transition hover:scale-105 hover:bg-(--clarify-ui-accent-background) focus:outline-none focus:ring-2 focus:ring-(--clarify-ui-accent-border)",
2213
2275
  "aria-label": isOpen ? "Close Clarify theme editor" : "Open Clarify theme editor",
@@ -2262,4 +2324,4 @@ function ClarifyShell(props) {
2262
2324
  //#endregion
2263
2325
  export { themeBootstrapScript as a, AppShell as c, BuiltWithClarify as d, RuntimeSlot as f, useSlot as h, themeEditorPresets as i, PageFooter as l, SlotProvider as m, ThemeEditor as n, themePresets as o, RuntimeSlotsProvider as p, applyThemeVariables as r, themeStorageKey as s, ClarifyShell as t, PageBanner as u };
2264
2326
 
2265
- //# sourceMappingURL=ClarifyShell-291_IXxJ.js.map
2327
+ //# sourceMappingURL=ClarifyShell-BQ29N8P5.js.map