@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,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-DakpK96I.cjs");
2
- const require_PageActions = require("./PageActions-GI1t-JrR.cjs");
2
+ const require_PageActions = require("./PageActions-B08cDCzq.cjs");
3
3
  let clsx = require("clsx");
4
4
  clsx = require_chunk.__toESM(clsx, 1);
5
5
  let react = require("react");
@@ -715,7 +715,7 @@ function emptySubscribe() {
715
715
  return () => {};
716
716
  }
717
717
  function useStoredBannerDismissed(storageKey) {
718
- return (0, react.useSyncExternalStore)(emptySubscribe, () => Boolean(storageKey && window.localStorage.getItem(storageKey) === "1"), () => false);
718
+ return (0, react.useSyncExternalStore)(emptySubscribe, () => Boolean(storageKey && window.localStorage.getItem(storageKey) === "1"), () => true);
719
719
  }
720
720
  function useBannerState(config, currentLocale) {
721
721
  const banner = config.banner;
@@ -732,13 +732,11 @@ function useBannerState(config, currentLocale) {
732
732
  dismissBanner: () => setDismissedBannerKey(activeBannerKey)
733
733
  };
734
734
  }
735
- function useStoredLocalePreference(explicitLocale) {
735
+ function useAppShellNavigationEffects(arg0) {
736
+ const { config, currentRoute, explicitLocale, location, navigate, pathname, storedLocale } = arg0;
736
737
  (0, react.useEffect)(() => {
737
738
  if (explicitLocale) require_PageActions.storeLocalePreference(explicitLocale);
738
739
  }, [explicitLocale]);
739
- }
740
- function useStoredLocaleRedirect(arg0) {
741
- const { config, currentRoute, explicitLocale, location, navigate, pathname, storedLocale } = arg0;
742
740
  (0, react.useEffect)(() => {
743
741
  if (explicitLocale || !storedLocale || isDefaultLocale(config, storedLocale)) return;
744
742
  const localizedPath = currentRoute?.alternates?.[storedLocale];
@@ -754,8 +752,6 @@ function useStoredLocaleRedirect(arg0) {
754
752
  pathname,
755
753
  storedLocale
756
754
  ]);
757
- }
758
- function useRouteScroll(location) {
759
755
  (0, react.useEffect)(() => {
760
756
  if (location.hash) {
761
757
  scrollToHash(location.hash);
@@ -770,40 +766,48 @@ function useRouteScroll(location) {
770
766
  });
771
767
  }, [location.hash, location.pathname]);
772
768
  }
773
- function useDocumentLanguage(currentLocale, currentLocaleConfig) {
769
+ function useAppShellDocumentEffects(arg0) {
770
+ const { currentLocale, currentLocaleConfig, config, route } = arg0;
774
771
  (0, react.useEffect)(() => {
775
772
  if (!currentLocale) return;
776
773
  document.documentElement.lang = currentLocale;
777
774
  if (currentLocaleConfig?.dir) document.documentElement.dir = currentLocaleConfig.dir;
778
775
  else document.documentElement.removeAttribute("dir");
779
776
  }, [currentLocale, currentLocaleConfig?.dir]);
780
- }
781
- function useDocumentMetadata(config, route) {
782
777
  (0, react.useEffect)(() => {
783
778
  applyDocumentMetadata(config, route);
784
779
  }, [config, route]);
785
780
  }
786
- function headerOffsetForLayout(hasTabs, hasBanner) {
787
- if (hasTabs && hasBanner) return "10rem";
788
- if (hasTabs) return "7rem";
789
- if (hasBanner) return "6.5rem";
790
- return "3.5rem";
791
- }
792
- function sidebarScrollClassName(hasTabs, hasBanner) {
793
- const classNames = ["clarify-sidebar-scroll lg:sticky lg:z-30 lg:overflow-y-auto lg:pb-8"];
794
- if (hasTabs && hasBanner) classNames.push("lg:top-40 lg:h-(--clarify-sidebar-height-with-tabs-and-banner) lg:pt-10");
795
- else if (hasTabs) classNames.push("lg:top-28 lg:h-(--clarify-sidebar-height-with-tabs) lg:pt-10");
796
- else if (hasBanner) classNames.push("lg:top-26 lg:h-(--clarify-sidebar-height-with-banner) lg:pt-10");
797
- else classNames.push("lg:top-14 lg:h-(--clarify-sidebar-height) lg:pt-10");
798
- return (0, clsx.default)(classNames);
799
- }
800
- function contentClassName(hasTabs, hasBanner) {
801
- 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"];
802
- if (hasTabs && hasBanner) classNames.push("pt-26 lg:pt-40");
803
- else if (hasTabs) classNames.push("pt-14 lg:pt-28");
804
- else if (hasBanner) classNames.push("pt-26");
805
- else classNames.push("pt-14");
806
- return (0, clsx.default)(classNames);
781
+ var appShellLayoutConfig = {
782
+ base: {
783
+ headerOffset: "3.5rem",
784
+ sidebarScrollClassName: "lg:top-14 lg:h-(--clarify-sidebar-height) lg:pt-10",
785
+ contentClassName: "pt-14"
786
+ },
787
+ banner: {
788
+ headerOffset: "6.5rem",
789
+ sidebarScrollClassName: "lg:top-26 lg:h-(--clarify-sidebar-height-with-banner) lg:pt-10",
790
+ contentClassName: "pt-26"
791
+ },
792
+ tabs: {
793
+ headerOffset: "7rem",
794
+ sidebarScrollClassName: "lg:top-28 lg:h-(--clarify-sidebar-height-with-tabs) lg:pt-10",
795
+ contentClassName: "pt-14 lg:pt-28"
796
+ },
797
+ "tabs-banner": {
798
+ headerOffset: "10rem",
799
+ sidebarScrollClassName: "lg:top-40 lg:h-(--clarify-sidebar-height-with-tabs-and-banner) lg:pt-10",
800
+ contentClassName: "pt-26 lg:pt-40"
801
+ }
802
+ };
803
+ function getLayoutVariant(hasTabs, hasBanner) {
804
+ if (hasTabs && hasBanner) return "tabs-banner";
805
+ if (hasTabs) return "tabs";
806
+ if (hasBanner) return "banner";
807
+ return "base";
808
+ }
809
+ function getAppShellLayoutConfig(hasTabs, hasBanner) {
810
+ return appShellLayoutConfig[getLayoutVariant(hasTabs, hasBanner)];
807
811
  }
808
812
  function BuiltInNotFoundPage() {
809
813
  const text = require_PageActions.useBuiltInText();
@@ -846,13 +850,13 @@ function AppShell(arg0) {
846
850
  const navigate = (0, react_router_dom.useNavigate)();
847
851
  const pathname = require_PageActions.normalizeRoutePath(location.pathname);
848
852
  const headerRef = (0, react.useRef)(null);
853
+ const headerTopAreaRef = (0, react.useRef)(null);
849
854
  const { currentRoute, explicitLocale, storedLocale, currentLocale, currentLocaleConfig, notFoundRoute, currentNavigation, sections } = useRouteState(config, routes, navigation, pathname);
850
855
  const text = require_PageActions.useBuiltInText(currentLocale);
851
856
  const { activeBannerKey, bannerResolved, dismissedBannerKey, hasBanner, dismissBanner } = useBannerState(config, currentLocale);
852
- const hasTabs = Boolean(currentNavigation.tabs?.length);
857
+ const layoutConfig = getAppShellLayoutConfig(Boolean(currentNavigation.tabs?.length), hasBanner);
853
858
  const { renderRoutes, NotFoundRouteComponent } = useRenderedRoutes(routes, notFoundRoute);
854
- useStoredLocalePreference(explicitLocale);
855
- useStoredLocaleRedirect({
859
+ useAppShellNavigationEffects({
856
860
  config,
857
861
  currentRoute,
858
862
  explicitLocale,
@@ -861,10 +865,13 @@ function AppShell(arg0) {
861
865
  pathname,
862
866
  storedLocale
863
867
  });
864
- useRouteScroll(location);
865
- useDocumentLanguage(currentLocale, currentLocaleConfig);
866
- useDocumentMetadata(config, currentRoute ?? notFoundRoute);
867
- const layoutStyle = { "--clarify-header-offset": headerOffsetForLayout(hasTabs, hasBanner) };
868
+ useAppShellDocumentEffects({
869
+ currentLocale,
870
+ currentLocaleConfig,
871
+ config,
872
+ route: currentRoute ?? notFoundRoute
873
+ });
874
+ const layoutStyle = { "--clarify-header-offset": layoutConfig.headerOffset };
868
875
  function renderBannerSlot() {
869
876
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerSlot, {
870
877
  activeBannerKey,
@@ -878,6 +885,7 @@ function AppShell(arg0) {
878
885
  function renderHeader() {
879
886
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.Header, {
880
887
  ref: headerRef,
888
+ topAreaRef: headerTopAreaRef,
881
889
  config,
882
890
  navigation: currentNavigation.items,
883
891
  tabs: currentNavigation.tabs,
@@ -892,7 +900,7 @@ function AppShell(arg0) {
892
900
  "data-pagefind-ignore": true,
893
901
  className: "clarify-sidebar hidden lg:block lg:self-stretch lg:bg-(--clarify-theme-tokens-colors-background) lg:px-5 xl:px-6",
894
902
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
895
- className: sidebarScrollClassName(hasTabs, hasBanner),
903
+ className: (0, clsx.default)("clarify-sidebar-scroll lg:sticky lg:z-30 lg:overflow-y-auto lg:pb-8", layoutConfig.sidebarScrollClassName),
896
904
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.Navigation, { navigation: currentNavigation.items })
897
905
  })
898
906
  });
@@ -946,7 +954,7 @@ function AppShell(arg0) {
946
954
  }
947
955
  function renderContent() {
948
956
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
949
- className: contentClassName(hasTabs, hasBanner),
957
+ className: (0, clsx.default)("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),
950
958
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_PageActions.PageActionsProvider, {
951
959
  route: currentRoute,
952
960
  routePrefix: config.routePrefix,
@@ -975,7 +983,7 @@ function AppShell(arg0) {
975
983
  route: currentRoute,
976
984
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_PageActions.SectionProvider, {
977
985
  sections,
978
- headerRef,
986
+ headerTopAreaRef,
979
987
  children: [renderHeader(), renderLayout()]
980
988
  })
981
989
  })
@@ -2032,10 +2040,8 @@ function themeToConfigSource(theme) {
2032
2040
  layout: theme.layout
2033
2041
  } }, null, 2);
2034
2042
  }
2035
- function ThemeEditor(props) {
2036
- const { initialTheme, onChange, target, defaultOpen = false, className } = props;
2037
- const { resolvedTheme } = require_PageActions.useTheme();
2038
- const [isOpen, setIsOpen] = (0, react.useState)(defaultOpen);
2043
+ function useThemeEditorState(arg0) {
2044
+ const { initialTheme, onChange, target, resolvedTheme } = arg0;
2039
2045
  const [theme, setTheme] = (0, react.useState)(() => cloneTheme(initialTheme ?? themeEditorPresets.default));
2040
2046
  const [copyState, setCopyState] = (0, react.useState)("idle");
2041
2047
  const configSource = (0, react.useMemo)(() => themeToConfigSource(theme), [theme]);
@@ -2094,122 +2100,156 @@ function ThemeEditor(props) {
2094
2100
  window.setTimeout(() => setCopyState("idle"), 1400);
2095
2101
  }
2096
2102
  }
2097
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2098
- className: (0, clsx.default)("clarify-theme-editor fixed right-4 bottom-4 z-50 text-(--clarify-theme-tokens-colors-foreground)", className),
2099
- children: [isOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
2103
+ return {
2104
+ theme,
2105
+ copyState,
2106
+ commit,
2107
+ updatePreset,
2108
+ updateColorToken,
2109
+ updateRadiusToken,
2110
+ updateLayoutToken,
2111
+ copyConfig
2112
+ };
2113
+ }
2114
+ function ThemeEditor(props) {
2115
+ const { initialTheme, onChange, target, defaultOpen = false, className } = props;
2116
+ const { resolvedTheme } = require_PageActions.useTheme();
2117
+ const [isOpen, setIsOpen] = (0, react.useState)(defaultOpen);
2118
+ const { theme, copyState, commit, updatePreset, updateColorToken, updateRadiusToken, updateLayoutToken, copyConfig } = useThemeEditorState({
2119
+ initialTheme,
2120
+ onChange,
2121
+ target,
2122
+ resolvedTheme
2123
+ });
2124
+ function renderPanelHeader() {
2125
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
2126
+ className: "shrink-0 flex items-start justify-between gap-4 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3",
2127
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
2128
+ className: "text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2129
+ children: "Theme editor"
2130
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2131
+ className: "mt-0.5 text-xs/5 text-(--clarify-ui-text-soft)",
2132
+ children: "Live CSS variable preview for Clarify theme tokens."
2133
+ })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2134
+ type: "button",
2135
+ 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)",
2136
+ "aria-label": "Close theme editor",
2137
+ onClick: () => setIsOpen(false),
2138
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "size-4 stroke-current stroke-2" })
2139
+ })]
2140
+ });
2141
+ }
2142
+ function renderPanelBody() {
2143
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2144
+ className: "min-h-0 flex-1 overflow-y-auto px-4 py-4",
2145
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2146
+ className: "grid gap-5",
2147
+ children: [
2148
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2149
+ htmlFor: "clarify-theme-editor-preset",
2150
+ className: "grid gap-1.5 text-xs/5 font-medium text-(--clarify-ui-text)",
2151
+ children: ["Preset", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2152
+ className: "relative block",
2153
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
2154
+ id: "clarify-theme-editor-preset",
2155
+ value: theme.preset,
2156
+ 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)",
2157
+ onChange: (event) => updatePreset(event.target.value),
2158
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2159
+ value: "default",
2160
+ children: "default"
2161
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2162
+ value: "base",
2163
+ children: "base"
2164
+ })]
2165
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.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)" })]
2166
+ })]
2167
+ }),
2168
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
2169
+ className: "grid gap-3",
2170
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
2171
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2172
+ children: "Colors"
2173
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2174
+ className: "grid grid-cols-1 gap-3",
2175
+ children: colorTokenFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorField, {
2176
+ id: `clarify-theme-editor-color-${field.key}`,
2177
+ label: field.label,
2178
+ value: theme.tokens.colors[field.key],
2179
+ onChange: (mode, value) => updateColorToken(field.key, mode, value)
2180
+ }, field.key))
2181
+ })]
2182
+ }),
2183
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
2184
+ className: "grid gap-3",
2185
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
2186
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2187
+ children: "Radius"
2188
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2189
+ className: "grid grid-cols-2 gap-3",
2190
+ children: radiusTokenFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2191
+ id: `clarify-theme-editor-radius-${field.key}`,
2192
+ label: field.label,
2193
+ value: theme.tokens.radius[field.key],
2194
+ onChange: (value) => updateRadiusToken(field.key, value)
2195
+ }, field.key))
2196
+ })]
2197
+ }),
2198
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
2199
+ className: "grid gap-3",
2200
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
2201
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2202
+ children: "Layout"
2203
+ }), layoutFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2204
+ id: `clarify-theme-editor-layout-${field.key}`,
2205
+ label: field.label,
2206
+ value: theme.layout[field.key],
2207
+ onChange: (value) => updateLayoutToken(field.key, value)
2208
+ }, field.key))]
2209
+ })
2210
+ ]
2211
+ })
2212
+ });
2213
+ }
2214
+ function renderPanelFooter() {
2215
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
2216
+ 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",
2217
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2218
+ className: "flex items-center gap-1.5",
2219
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2220
+ type: "button",
2221
+ 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)",
2222
+ onClick: () => updatePreset(theme.preset),
2223
+ children: "Reset preset"
2224
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2225
+ type: "button",
2226
+ 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)",
2227
+ onClick: () => commit(createRandomTheme()),
2228
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.WandSparkles, { className: "size-3.5 stroke-current stroke-2" }), "Random"]
2229
+ })]
2230
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2231
+ type: "button",
2232
+ 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",
2233
+ onClick: copyConfig,
2234
+ children: copyState === "copied" ? "Copied" : copyState === "failed" ? "Copy failed" : "Copy config"
2235
+ })]
2236
+ });
2237
+ }
2238
+ function renderEditorPanel() {
2239
+ if (!isOpen) return null;
2240
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
2100
2241
  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",
2101
2242
  "aria-label": "Clarify theme editor",
2102
2243
  children: [
2103
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
2104
- className: "shrink-0 flex items-start justify-between gap-4 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3",
2105
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
2106
- className: "text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2107
- children: "Theme editor"
2108
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2109
- className: "mt-0.5 text-xs/5 text-(--clarify-ui-text-soft)",
2110
- children: "Live CSS variable preview for Clarify theme tokens."
2111
- })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2112
- type: "button",
2113
- 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)",
2114
- "aria-label": "Close theme editor",
2115
- onClick: () => setIsOpen(false),
2116
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "size-4 stroke-current stroke-2" })
2117
- })]
2118
- }),
2119
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2120
- className: "min-h-0 flex-1 overflow-y-auto px-4 py-4",
2121
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2122
- className: "grid gap-5",
2123
- children: [
2124
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2125
- htmlFor: "clarify-theme-editor-preset",
2126
- className: "grid gap-1.5 text-xs/5 font-medium text-(--clarify-ui-text)",
2127
- children: ["Preset", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2128
- className: "relative block",
2129
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
2130
- id: "clarify-theme-editor-preset",
2131
- value: theme.preset,
2132
- 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)",
2133
- onChange: (event) => updatePreset(event.target.value),
2134
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2135
- value: "default",
2136
- children: "default"
2137
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2138
- value: "base",
2139
- children: "base"
2140
- })]
2141
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.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)" })]
2142
- })]
2143
- }),
2144
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
2145
- className: "grid gap-3",
2146
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
2147
- className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2148
- children: "Colors"
2149
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2150
- className: "grid grid-cols-1 gap-3",
2151
- children: colorTokenFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorField, {
2152
- id: `clarify-theme-editor-color-${field.key}`,
2153
- label: field.label,
2154
- value: theme.tokens.colors[field.key],
2155
- onChange: (mode, value) => updateColorToken(field.key, mode, value)
2156
- }, field.key))
2157
- })]
2158
- }),
2159
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
2160
- className: "grid gap-3",
2161
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
2162
- className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2163
- children: "Radius"
2164
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2165
- className: "grid grid-cols-2 gap-3",
2166
- children: radiusTokenFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2167
- id: `clarify-theme-editor-radius-${field.key}`,
2168
- label: field.label,
2169
- value: theme.tokens.radius[field.key],
2170
- onChange: (value) => updateRadiusToken(field.key, value)
2171
- }, field.key))
2172
- })]
2173
- }),
2174
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
2175
- className: "grid gap-3",
2176
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
2177
- className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2178
- children: "Layout"
2179
- }), layoutFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2180
- id: `clarify-theme-editor-layout-${field.key}`,
2181
- label: field.label,
2182
- value: theme.layout[field.key],
2183
- onChange: (value) => updateLayoutToken(field.key, value)
2184
- }, field.key))]
2185
- })
2186
- ]
2187
- })
2188
- }),
2189
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
2190
- 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",
2191
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2192
- className: "flex items-center gap-1.5",
2193
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2194
- type: "button",
2195
- 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)",
2196
- onClick: () => updatePreset(theme.preset),
2197
- children: "Reset preset"
2198
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2199
- type: "button",
2200
- 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)",
2201
- onClick: () => commit(createRandomTheme()),
2202
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.WandSparkles, { className: "size-3.5 stroke-current stroke-2" }), "Random"]
2203
- })]
2204
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2205
- type: "button",
2206
- 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",
2207
- onClick: copyConfig,
2208
- children: copyState === "copied" ? "Copied" : copyState === "failed" ? "Copy failed" : "Copy config"
2209
- })]
2210
- })
2244
+ renderPanelHeader(),
2245
+ renderPanelBody(),
2246
+ renderPanelFooter()
2211
2247
  ]
2212
- }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2248
+ });
2249
+ }
2250
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2251
+ className: (0, clsx.default)("clarify-theme-editor fixed right-4 bottom-4 z-50 text-(--clarify-theme-tokens-colors-foreground)", className),
2252
+ children: [renderEditorPanel(), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
2213
2253
  type: "button",
2214
2254
  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)",
2215
2255
  "aria-label": isOpen ? "Close Clarify theme editor" : "Open Clarify theme editor",
@@ -2353,4 +2393,4 @@ Object.defineProperty(exports, "useSlot", {
2353
2393
  }
2354
2394
  });
2355
2395
 
2356
- //# sourceMappingURL=ClarifyShell-DJ4fOVOd.cjs.map
2396
+ //# sourceMappingURL=ClarifyShell-DdYRgrfY.cjs.map