@clarify-labs/renderer 0.9.1 → 0.9.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 (43) hide show
  1. package/output/{ClarifyShell-291_IXxJ.js → ClarifyShell-C38EkErX.js} +199 -159
  2. package/output/ClarifyShell-C38EkErX.js.map +1 -0
  3. package/output/{ClarifyShell-DJ4fOVOd.cjs → ClarifyShell-DdYRgrfY.cjs} +199 -159
  4. package/output/ClarifyShell-DdYRgrfY.cjs.map +1 -0
  5. package/output/{OpenApiOperation-3DUVruIO.cjs → OpenApiOperation-CP_fxT_F.cjs} +343 -218
  6. package/output/OpenApiOperation-CP_fxT_F.cjs.map +1 -0
  7. package/output/{OpenApiOperation-E8lSLsSK.js → OpenApiOperation-DIFaYAe5.js} +343 -218
  8. package/output/OpenApiOperation-DIFaYAe5.js.map +1 -0
  9. package/output/{PageActions-GI1t-JrR.cjs → PageActions-B08cDCzq.cjs} +276 -173
  10. package/output/PageActions-B08cDCzq.cjs.map +1 -0
  11. package/output/{PageActions-DaXQgMYP.js → PageActions-tmnpzi23.js} +277 -174
  12. package/output/PageActions-tmnpzi23.js.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/core/types.d.ts +1 -0
  17. package/output/index.cjs +4 -4
  18. package/output/index.js +4 -4
  19. package/output/openapi/components/CodeDisplay.d.ts +25 -0
  20. package/output/openapi/components/EndpointSections.d.ts +4 -0
  21. package/output/openapi/components/ExamplePanels.d.ts +8 -17
  22. package/output/openapi/components/OpenApiOperation.state.d.ts +43 -0
  23. package/output/openapi/components/SelectControl.d.ts +15 -0
  24. package/output/openapi/components/helpers.d.ts +22 -0
  25. package/output/preview.cjs +114 -67
  26. package/output/preview.cjs.map +1 -1
  27. package/output/preview.js +114 -67
  28. package/output/preview.js.map +1 -1
  29. package/output/{render-yBo2SUlA.js → render-6gHfrR9h.js} +2 -2
  30. package/output/{render-yBo2SUlA.js.map → render-6gHfrR9h.js.map} +1 -1
  31. package/output/{render-r9DclX3Y.cjs → render-Bvf5ZMZb.cjs} +2 -2
  32. package/output/{render-r9DclX3Y.cjs.map → render-Bvf5ZMZb.cjs.map} +1 -1
  33. package/output/renderer.css +168 -107
  34. package/output/server.cjs +2 -2
  35. package/output/server.js +2 -2
  36. package/output/shell/Header.d.ts +2 -0
  37. package/package.json +1 -1
  38. package/output/ClarifyShell-291_IXxJ.js.map +0 -1
  39. package/output/ClarifyShell-DJ4fOVOd.cjs.map +0 -1
  40. package/output/OpenApiOperation-3DUVruIO.cjs.map +0 -1
  41. package/output/OpenApiOperation-E8lSLsSK.js.map +0 -1
  42. package/output/PageActions-DaXQgMYP.js.map +0 -1
  43. 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 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-tmnpzi23.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";
@@ -713,7 +713,7 @@ function emptySubscribe() {
713
713
  return () => {};
714
714
  }
715
715
  function useStoredBannerDismissed(storageKey) {
716
- return useSyncExternalStore(emptySubscribe, () => Boolean(storageKey && window.localStorage.getItem(storageKey) === "1"), () => false);
716
+ return useSyncExternalStore(emptySubscribe, () => Boolean(storageKey && window.localStorage.getItem(storageKey) === "1"), () => true);
717
717
  }
718
718
  function useBannerState(config, currentLocale) {
719
719
  const banner = config.banner;
@@ -730,13 +730,11 @@ function useBannerState(config, currentLocale) {
730
730
  dismissBanner: () => setDismissedBannerKey(activeBannerKey)
731
731
  };
732
732
  }
733
- function useStoredLocalePreference(explicitLocale) {
733
+ function useAppShellNavigationEffects(arg0) {
734
+ const { config, currentRoute, explicitLocale, location, navigate, pathname, storedLocale } = arg0;
734
735
  useEffect(() => {
735
736
  if (explicitLocale) storeLocalePreference(explicitLocale);
736
737
  }, [explicitLocale]);
737
- }
738
- function useStoredLocaleRedirect(arg0) {
739
- const { config, currentRoute, explicitLocale, location, navigate, pathname, storedLocale } = arg0;
740
738
  useEffect(() => {
741
739
  if (explicitLocale || !storedLocale || isDefaultLocale(config, storedLocale)) return;
742
740
  const localizedPath = currentRoute?.alternates?.[storedLocale];
@@ -752,8 +750,6 @@ function useStoredLocaleRedirect(arg0) {
752
750
  pathname,
753
751
  storedLocale
754
752
  ]);
755
- }
756
- function useRouteScroll(location) {
757
753
  useEffect(() => {
758
754
  if (location.hash) {
759
755
  scrollToHash(location.hash);
@@ -768,40 +764,48 @@ function useRouteScroll(location) {
768
764
  });
769
765
  }, [location.hash, location.pathname]);
770
766
  }
771
- function useDocumentLanguage(currentLocale, currentLocaleConfig) {
767
+ function useAppShellDocumentEffects(arg0) {
768
+ const { currentLocale, currentLocaleConfig, config, route } = arg0;
772
769
  useEffect(() => {
773
770
  if (!currentLocale) return;
774
771
  document.documentElement.lang = currentLocale;
775
772
  if (currentLocaleConfig?.dir) document.documentElement.dir = currentLocaleConfig.dir;
776
773
  else document.documentElement.removeAttribute("dir");
777
774
  }, [currentLocale, currentLocaleConfig?.dir]);
778
- }
779
- function useDocumentMetadata(config, route) {
780
775
  useEffect(() => {
781
776
  applyDocumentMetadata(config, route);
782
777
  }, [config, route]);
783
778
  }
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);
779
+ var appShellLayoutConfig = {
780
+ base: {
781
+ headerOffset: "3.5rem",
782
+ sidebarScrollClassName: "lg:top-14 lg:h-(--clarify-sidebar-height) lg:pt-10",
783
+ contentClassName: "pt-14"
784
+ },
785
+ banner: {
786
+ headerOffset: "6.5rem",
787
+ sidebarScrollClassName: "lg:top-26 lg:h-(--clarify-sidebar-height-with-banner) lg:pt-10",
788
+ contentClassName: "pt-26"
789
+ },
790
+ tabs: {
791
+ headerOffset: "7rem",
792
+ sidebarScrollClassName: "lg:top-28 lg:h-(--clarify-sidebar-height-with-tabs) lg:pt-10",
793
+ contentClassName: "pt-14 lg:pt-28"
794
+ },
795
+ "tabs-banner": {
796
+ headerOffset: "10rem",
797
+ sidebarScrollClassName: "lg:top-40 lg:h-(--clarify-sidebar-height-with-tabs-and-banner) lg:pt-10",
798
+ contentClassName: "pt-26 lg:pt-40"
799
+ }
800
+ };
801
+ function getLayoutVariant(hasTabs, hasBanner) {
802
+ if (hasTabs && hasBanner) return "tabs-banner";
803
+ if (hasTabs) return "tabs";
804
+ if (hasBanner) return "banner";
805
+ return "base";
806
+ }
807
+ function getAppShellLayoutConfig(hasTabs, hasBanner) {
808
+ return appShellLayoutConfig[getLayoutVariant(hasTabs, hasBanner)];
805
809
  }
806
810
  function BuiltInNotFoundPage() {
807
811
  const text = useBuiltInText();
@@ -844,13 +848,13 @@ function AppShell(arg0) {
844
848
  const navigate = useNavigate();
845
849
  const pathname = normalizeRoutePath(location.pathname);
846
850
  const headerRef = useRef(null);
851
+ const headerTopAreaRef = useRef(null);
847
852
  const { currentRoute, explicitLocale, storedLocale, currentLocale, currentLocaleConfig, notFoundRoute, currentNavigation, sections } = useRouteState(config, routes, navigation, pathname);
848
853
  const text = useBuiltInText(currentLocale);
849
854
  const { activeBannerKey, bannerResolved, dismissedBannerKey, hasBanner, dismissBanner } = useBannerState(config, currentLocale);
850
- const hasTabs = Boolean(currentNavigation.tabs?.length);
855
+ const layoutConfig = getAppShellLayoutConfig(Boolean(currentNavigation.tabs?.length), hasBanner);
851
856
  const { renderRoutes, NotFoundRouteComponent } = useRenderedRoutes(routes, notFoundRoute);
852
- useStoredLocalePreference(explicitLocale);
853
- useStoredLocaleRedirect({
857
+ useAppShellNavigationEffects({
854
858
  config,
855
859
  currentRoute,
856
860
  explicitLocale,
@@ -859,10 +863,13 @@ function AppShell(arg0) {
859
863
  pathname,
860
864
  storedLocale
861
865
  });
862
- useRouteScroll(location);
863
- useDocumentLanguage(currentLocale, currentLocaleConfig);
864
- useDocumentMetadata(config, currentRoute ?? notFoundRoute);
865
- const layoutStyle = { "--clarify-header-offset": headerOffsetForLayout(hasTabs, hasBanner) };
866
+ useAppShellDocumentEffects({
867
+ currentLocale,
868
+ currentLocaleConfig,
869
+ config,
870
+ route: currentRoute ?? notFoundRoute
871
+ });
872
+ const layoutStyle = { "--clarify-header-offset": layoutConfig.headerOffset };
866
873
  function renderBannerSlot() {
867
874
  return /* @__PURE__ */ jsx(BannerSlot, {
868
875
  activeBannerKey,
@@ -876,6 +883,7 @@ function AppShell(arg0) {
876
883
  function renderHeader() {
877
884
  return /* @__PURE__ */ jsx(Header, {
878
885
  ref: headerRef,
886
+ topAreaRef: headerTopAreaRef,
879
887
  config,
880
888
  navigation: currentNavigation.items,
881
889
  tabs: currentNavigation.tabs,
@@ -890,7 +898,7 @@ function AppShell(arg0) {
890
898
  "data-pagefind-ignore": true,
891
899
  className: "clarify-sidebar hidden lg:block lg:self-stretch lg:bg-(--clarify-theme-tokens-colors-background) lg:px-5 xl:px-6",
892
900
  children: /* @__PURE__ */ jsx("div", {
893
- className: sidebarScrollClassName(hasTabs, hasBanner),
901
+ className: clsx("clarify-sidebar-scroll lg:sticky lg:z-30 lg:overflow-y-auto lg:pb-8", layoutConfig.sidebarScrollClassName),
894
902
  children: /* @__PURE__ */ jsx(Navigation, { navigation: currentNavigation.items })
895
903
  })
896
904
  });
@@ -944,7 +952,7 @@ function AppShell(arg0) {
944
952
  }
945
953
  function renderContent() {
946
954
  return /* @__PURE__ */ jsx("div", {
947
- className: contentClassName(hasTabs, hasBanner),
955
+ 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
956
  children: /* @__PURE__ */ jsxs(PageActionsProvider, {
949
957
  route: currentRoute,
950
958
  routePrefix: config.routePrefix,
@@ -973,7 +981,7 @@ function AppShell(arg0) {
973
981
  route: currentRoute,
974
982
  children: /* @__PURE__ */ jsxs(SectionProvider, {
975
983
  sections,
976
- headerRef,
984
+ headerTopAreaRef,
977
985
  children: [renderHeader(), renderLayout()]
978
986
  })
979
987
  })
@@ -2030,10 +2038,8 @@ function themeToConfigSource(theme) {
2030
2038
  layout: theme.layout
2031
2039
  } }, null, 2);
2032
2040
  }
2033
- function ThemeEditor(props) {
2034
- const { initialTheme, onChange, target, defaultOpen = false, className } = props;
2035
- const { resolvedTheme } = useTheme();
2036
- const [isOpen, setIsOpen] = useState(defaultOpen);
2041
+ function useThemeEditorState(arg0) {
2042
+ const { initialTheme, onChange, target, resolvedTheme } = arg0;
2037
2043
  const [theme, setTheme] = useState(() => cloneTheme(initialTheme ?? themeEditorPresets.default));
2038
2044
  const [copyState, setCopyState] = useState("idle");
2039
2045
  const configSource = useMemo(() => themeToConfigSource(theme), [theme]);
@@ -2092,122 +2098,156 @@ function ThemeEditor(props) {
2092
2098
  window.setTimeout(() => setCopyState("idle"), 1400);
2093
2099
  }
2094
2100
  }
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", {
2101
+ return {
2102
+ theme,
2103
+ copyState,
2104
+ commit,
2105
+ updatePreset,
2106
+ updateColorToken,
2107
+ updateRadiusToken,
2108
+ updateLayoutToken,
2109
+ copyConfig
2110
+ };
2111
+ }
2112
+ function ThemeEditor(props) {
2113
+ const { initialTheme, onChange, target, defaultOpen = false, className } = props;
2114
+ const { resolvedTheme } = useTheme();
2115
+ const [isOpen, setIsOpen] = useState(defaultOpen);
2116
+ const { theme, copyState, commit, updatePreset, updateColorToken, updateRadiusToken, updateLayoutToken, copyConfig } = useThemeEditorState({
2117
+ initialTheme,
2118
+ onChange,
2119
+ target,
2120
+ resolvedTheme
2121
+ });
2122
+ function renderPanelHeader() {
2123
+ return /* @__PURE__ */ jsxs("header", {
2124
+ className: "shrink-0 flex items-start justify-between gap-4 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3",
2125
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
2126
+ className: "text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2127
+ children: "Theme editor"
2128
+ }), /* @__PURE__ */ jsx("p", {
2129
+ className: "mt-0.5 text-xs/5 text-(--clarify-ui-text-soft)",
2130
+ children: "Live CSS variable preview for Clarify theme tokens."
2131
+ })] }), /* @__PURE__ */ jsx("button", {
2132
+ type: "button",
2133
+ 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)",
2134
+ "aria-label": "Close theme editor",
2135
+ onClick: () => setIsOpen(false),
2136
+ children: /* @__PURE__ */ jsx(X, { className: "size-4 stroke-current stroke-2" })
2137
+ })]
2138
+ });
2139
+ }
2140
+ function renderPanelBody() {
2141
+ return /* @__PURE__ */ jsx("div", {
2142
+ className: "min-h-0 flex-1 overflow-y-auto px-4 py-4",
2143
+ children: /* @__PURE__ */ jsxs("div", {
2144
+ className: "grid gap-5",
2145
+ children: [
2146
+ /* @__PURE__ */ jsxs("label", {
2147
+ htmlFor: "clarify-theme-editor-preset",
2148
+ className: "grid gap-1.5 text-xs/5 font-medium text-(--clarify-ui-text)",
2149
+ children: ["Preset", /* @__PURE__ */ jsxs("span", {
2150
+ className: "relative block",
2151
+ children: [/* @__PURE__ */ jsxs("select", {
2152
+ id: "clarify-theme-editor-preset",
2153
+ value: theme.preset,
2154
+ 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)",
2155
+ onChange: (event) => updatePreset(event.target.value),
2156
+ children: [/* @__PURE__ */ jsx("option", {
2157
+ value: "default",
2158
+ children: "default"
2159
+ }), /* @__PURE__ */ jsx("option", {
2160
+ value: "base",
2161
+ children: "base"
2162
+ })]
2163
+ }), /* @__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)" })]
2164
+ })]
2165
+ }),
2166
+ /* @__PURE__ */ jsxs("fieldset", {
2167
+ className: "grid gap-3",
2168
+ children: [/* @__PURE__ */ jsx("legend", {
2169
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2170
+ children: "Colors"
2171
+ }), /* @__PURE__ */ jsx("div", {
2172
+ className: "grid grid-cols-1 gap-3",
2173
+ children: colorTokenFields.map((field) => /* @__PURE__ */ jsx(ColorField, {
2174
+ id: `clarify-theme-editor-color-${field.key}`,
2175
+ label: field.label,
2176
+ value: theme.tokens.colors[field.key],
2177
+ onChange: (mode, value) => updateColorToken(field.key, mode, value)
2178
+ }, field.key))
2179
+ })]
2180
+ }),
2181
+ /* @__PURE__ */ jsxs("fieldset", {
2182
+ className: "grid gap-3",
2183
+ children: [/* @__PURE__ */ jsx("legend", {
2184
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2185
+ children: "Radius"
2186
+ }), /* @__PURE__ */ jsx("div", {
2187
+ className: "grid grid-cols-2 gap-3",
2188
+ children: radiusTokenFields.map((field) => /* @__PURE__ */ jsx(TextField, {
2189
+ id: `clarify-theme-editor-radius-${field.key}`,
2190
+ label: field.label,
2191
+ value: theme.tokens.radius[field.key],
2192
+ onChange: (value) => updateRadiusToken(field.key, value)
2193
+ }, field.key))
2194
+ })]
2195
+ }),
2196
+ /* @__PURE__ */ jsxs("fieldset", {
2197
+ className: "grid gap-3",
2198
+ children: [/* @__PURE__ */ jsx("legend", {
2199
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2200
+ children: "Layout"
2201
+ }), layoutFields.map((field) => /* @__PURE__ */ jsx(TextField, {
2202
+ id: `clarify-theme-editor-layout-${field.key}`,
2203
+ label: field.label,
2204
+ value: theme.layout[field.key],
2205
+ onChange: (value) => updateLayoutToken(field.key, value)
2206
+ }, field.key))]
2207
+ })
2208
+ ]
2209
+ })
2210
+ });
2211
+ }
2212
+ function renderPanelFooter() {
2213
+ return /* @__PURE__ */ jsxs("footer", {
2214
+ 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",
2215
+ children: [/* @__PURE__ */ jsxs("div", {
2216
+ className: "flex items-center gap-1.5",
2217
+ children: [/* @__PURE__ */ jsx("button", {
2218
+ type: "button",
2219
+ 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)",
2220
+ onClick: () => updatePreset(theme.preset),
2221
+ children: "Reset preset"
2222
+ }), /* @__PURE__ */ jsxs("button", {
2223
+ type: "button",
2224
+ 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)",
2225
+ onClick: () => commit(createRandomTheme()),
2226
+ children: [/* @__PURE__ */ jsx(WandSparkles, { className: "size-3.5 stroke-current stroke-2" }), "Random"]
2227
+ })]
2228
+ }), /* @__PURE__ */ jsx("button", {
2229
+ type: "button",
2230
+ 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",
2231
+ onClick: copyConfig,
2232
+ children: copyState === "copied" ? "Copied" : copyState === "failed" ? "Copy failed" : "Copy config"
2233
+ })]
2234
+ });
2235
+ }
2236
+ function renderEditorPanel() {
2237
+ if (!isOpen) return null;
2238
+ return /* @__PURE__ */ jsxs("section", {
2098
2239
  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
2240
  "aria-label": "Clarify theme editor",
2100
2241
  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
- })
2242
+ renderPanelHeader(),
2243
+ renderPanelBody(),
2244
+ renderPanelFooter()
2209
2245
  ]
2210
- }) : null, /* @__PURE__ */ jsx("button", {
2246
+ });
2247
+ }
2248
+ return /* @__PURE__ */ jsxs("div", {
2249
+ className: clsx("clarify-theme-editor fixed right-4 bottom-4 z-50 text-(--clarify-theme-tokens-colors-foreground)", className),
2250
+ children: [renderEditorPanel(), /* @__PURE__ */ jsx("button", {
2211
2251
  type: "button",
2212
2252
  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
2253
  "aria-label": isOpen ? "Close Clarify theme editor" : "Open Clarify theme editor",
@@ -2262,4 +2302,4 @@ function ClarifyShell(props) {
2262
2302
  //#endregion
2263
2303
  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
2304
 
2265
- //# sourceMappingURL=ClarifyShell-291_IXxJ.js.map
2305
+ //# sourceMappingURL=ClarifyShell-C38EkErX.js.map