@clarify-labs/renderer 0.11.6 → 0.11.8

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 (66) hide show
  1. package/output/{ClarifyShell-CKvXZj0f.js → ClarifyShell-CGoRrkn1.js} +120 -68
  2. package/output/ClarifyShell-CGoRrkn1.js.map +1 -0
  3. package/output/{ClarifyShell-CukbPOAd.cjs → ClarifyShell-D8OGIUWq.cjs} +120 -68
  4. package/output/ClarifyShell-D8OGIUWq.cjs.map +1 -0
  5. package/output/{MermaidViewer-FOg263MO.cjs → MermaidViewer-CFqy0BnO.cjs} +3 -3
  6. package/output/{MermaidViewer-FOg263MO.cjs.map → MermaidViewer-CFqy0BnO.cjs.map} +1 -1
  7. package/output/{MermaidViewer-_tpH0JNn.js → MermaidViewer-TdU3sRfy.js} +3 -3
  8. package/output/{MermaidViewer-_tpH0JNn.js.map → MermaidViewer-TdU3sRfy.js.map} +1 -1
  9. package/output/{OpenApiOperation-c-I6Nw9j.cjs → OpenApiOperation-Bd68uxXq.cjs} +9 -8
  10. package/output/{OpenApiOperation-c-I6Nw9j.cjs.map → OpenApiOperation-Bd68uxXq.cjs.map} +1 -1
  11. package/output/{OpenApiOperation-Dv9u2GEJ.js → OpenApiOperation-vCuIKI4O.js} +9 -8
  12. package/output/{OpenApiOperation-Dv9u2GEJ.js.map → OpenApiOperation-vCuIKI4O.js.map} +1 -1
  13. package/output/{PageActions-DviEypf6.js → PageActions-CqXr0SyW.js} +112 -75
  14. package/output/PageActions-CqXr0SyW.js.map +1 -0
  15. package/output/{PageActions-ob2OJusG.cjs → PageActions-DPYXFL6N.cjs} +117 -74
  16. package/output/PageActions-DPYXFL6N.cjs.map +1 -0
  17. package/output/{SearchDialog-89JAjQMh.js → SearchDialog-BQcbGNvl.js} +29 -20
  18. package/output/SearchDialog-BQcbGNvl.js.map +1 -0
  19. package/output/{SearchDialog-CTiUIKeo.cjs → SearchDialog-CExM6Bxd.cjs} +29 -20
  20. package/output/SearchDialog-CExM6Bxd.cjs.map +1 -0
  21. package/output/app/AppShell.d.ts +1 -2
  22. package/output/app/BuiltInNotFoundPage.d.ts +1 -0
  23. package/output/app/PageActions.d.ts +0 -1
  24. package/output/client.cjs +3 -3
  25. package/output/client.js +3 -3
  26. package/output/context.d.ts +2 -1
  27. package/output/core/context.d.ts +9 -0
  28. package/output/core/types.d.ts +4 -0
  29. package/output/{i18n-Cff810G_.js → i18n-D4O3z-sP.js} +24 -3
  30. package/output/i18n-D4O3z-sP.js.map +1 -0
  31. package/output/{i18n-Cjfk1N7i.cjs → i18n-Dw4Jlho-.cjs} +36 -3
  32. package/output/i18n-Dw4Jlho-.cjs.map +1 -0
  33. package/output/index.cjs +11 -7
  34. package/output/index.cjs.map +1 -1
  35. package/output/index.d.ts +3 -2
  36. package/output/index.js +8 -8
  37. package/output/index.js.map +1 -1
  38. package/output/preview.cjs +6 -6
  39. package/output/preview.cjs.map +1 -1
  40. package/output/preview.js +6 -6
  41. package/output/preview.js.map +1 -1
  42. package/output/{render-BxiVlY6q.cjs → render-CqBz1q82.cjs} +2 -2
  43. package/output/{render-BxiVlY6q.cjs.map → render-CqBz1q82.cjs.map} +1 -1
  44. package/output/{render-B41PHjt8.js → render-DQRifjrn.js} +2 -2
  45. package/output/{render-B41PHjt8.js.map → render-DQRifjrn.js.map} +1 -1
  46. package/output/renderer.css +4 -0
  47. package/output/server.cjs +2 -2
  48. package/output/server.js +2 -2
  49. package/output/shell/ContentActions.d.ts +0 -1
  50. package/output/shell/Header.d.ts +1 -2
  51. package/output/shell/Search.d.ts +3 -6
  52. package/output/shell/mobile.d.ts +1 -2
  53. package/output/shell/search/SearchDialog.d.ts +2 -1
  54. package/output/shell/search/pagefind.d.ts +3 -2
  55. package/output/theme/ThemeRoot.d.ts +0 -2
  56. package/output/theme/randomTheme.d.ts +2 -1
  57. package/output/utils/href.d.ts +2 -0
  58. package/package.json +1 -1
  59. package/output/ClarifyShell-CKvXZj0f.js.map +0 -1
  60. package/output/ClarifyShell-CukbPOAd.cjs.map +0 -1
  61. package/output/PageActions-DviEypf6.js.map +0 -1
  62. package/output/PageActions-ob2OJusG.cjs.map +0 -1
  63. package/output/SearchDialog-89JAjQMh.js.map +0 -1
  64. package/output/SearchDialog-CTiUIKeo.cjs.map +0 -1
  65. package/output/i18n-Cff810G_.js.map +0 -1
  66. package/output/i18n-Cjfk1N7i.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- const require_i18n = require("./i18n-Cjfk1N7i.cjs");
3
- const require_PageActions = require("./PageActions-ob2OJusG.cjs");
2
+ const require_i18n = require("./i18n-Dw4Jlho-.cjs");
3
+ const require_PageActions = require("./PageActions-DPYXFL6N.cjs");
4
4
  let clsx = require("clsx");
5
5
  clsx = require_rolldown_runtime.__toESM(clsx, 1);
6
6
  let react = require("react");
7
7
  let react_router_dom = require("react-router-dom");
8
- let lucide_react = require("lucide-react");
9
8
  let react_jsx_runtime = require("react/jsx-runtime");
9
+ let lucide_react = require("lucide-react");
10
10
  //#region source/slots/context.tsx
11
11
  var UISlotContextValue = (0, react.createContext)(null);
12
12
  /**
@@ -120,6 +120,39 @@ function safeDecodeURIComponent(value) {
120
120
  }
121
121
  }
122
122
  //#endregion
123
+ //#region source/app/BuiltInNotFoundPage.tsx
124
+ function BuiltInNotFoundPage() {
125
+ const text = require_i18n.useBuiltInText();
126
+ const homeHref = require_PageActions.resolveHomeHref(require_i18n.useConfig(), require_i18n.useLocale());
127
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
128
+ className: "mx-auto flex min-h-(--clarify-error-page-min-height) max-w-2xl flex-col justify-center py-16 text-(--clarify-theme-tokens-colors-foreground)",
129
+ "aria-labelledby": "clarify-not-found-title",
130
+ children: [
131
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
132
+ className: "text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-primary)",
133
+ children: text("notFound.label")
134
+ }),
135
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
136
+ id: "clarify-not-found-title",
137
+ className: "mt-3 text-3xl/9 font-semibold tracking-tight text-(--clarify-theme-tokens-colors-foreground)",
138
+ children: text("notFound.title")
139
+ }),
140
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
141
+ className: "mt-4 text-sm/6 text-(--clarify-theme-tokens-colors-muted)",
142
+ children: text("notFound.description")
143
+ }),
144
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
145
+ className: "mt-8",
146
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Link, {
147
+ className: "inline-flex items-center rounded-(--clarify-theme-tokens-radius-md) bg-(--clarify-theme-tokens-colors-primary) px-3 py-2 text-sm/5 font-semibold text-white shadow-xs transition hover:opacity-90",
148
+ to: homeHref,
149
+ children: text("notFound.home")
150
+ })
151
+ })
152
+ ]
153
+ });
154
+ }
155
+ //#endregion
123
156
  //#region source/assets/clarify.svg?url
124
157
  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";
125
158
  //#endregion
@@ -480,12 +513,6 @@ function PageBanner(props) {
480
513
  }
481
514
  //#endregion
482
515
  //#region source/app/PageFooter.tsx
483
- function localeForPath(config, pathname) {
484
- const locales = config.locales;
485
- if (!locales) return void 0;
486
- const firstSegment = pathname.split("/").filter(Boolean)[0];
487
- return locales.locales.find((locale) => locale.code === firstSegment)?.code ?? locales.default;
488
- }
489
516
  function FooterLink(arg0) {
490
517
  const { link, locale, config } = arg0;
491
518
  const external = link.external ?? require_PageActions.isExternalHref(link.href);
@@ -517,7 +544,7 @@ function SocialLink(arg0) {
517
544
  }
518
545
  function PageFooter() {
519
546
  const config = require_i18n.useConfig();
520
- const locale = localeForPath(config, (0, react_router_dom.useLocation)().pathname);
547
+ const locale = require_i18n.useLocale() ?? config.locales?.default;
521
548
  const footer = config.footer;
522
549
  const links = footer?.links ?? [];
523
550
  const socials = Object.entries(footer?.socials ?? {});
@@ -1049,43 +1076,14 @@ function getLayoutVariant(hasTabs, hasBanner) {
1049
1076
  function getAppShellLayoutConfig(hasTabs, hasBanner) {
1050
1077
  return appShellLayoutConfig[getLayoutVariant(hasTabs, hasBanner)];
1051
1078
  }
1052
- function BuiltInNotFoundPage() {
1053
- const text = require_i18n.useBuiltInText();
1054
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1055
- className: "mx-auto flex min-h-(--clarify-error-page-min-height) max-w-2xl flex-col justify-center py-16 text-(--clarify-theme-tokens-colors-foreground)",
1056
- "aria-labelledby": "clarify-not-found-title",
1057
- children: [
1058
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1059
- className: "text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-primary)",
1060
- children: text("notFound.label")
1061
- }),
1062
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
1063
- id: "clarify-not-found-title",
1064
- className: "mt-3 text-3xl/9 font-semibold tracking-tight text-(--clarify-theme-tokens-colors-foreground)",
1065
- children: text("notFound.title")
1066
- }),
1067
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1068
- className: "mt-4 text-sm/6 text-(--clarify-theme-tokens-colors-muted)",
1069
- children: text("notFound.description")
1070
- }),
1071
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1072
- className: "mt-8",
1073
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Link, {
1074
- className: "inline-flex items-center rounded-(--clarify-theme-tokens-radius-md) bg-(--clarify-theme-tokens-colors-primary) px-3 py-2 text-sm/5 font-semibold text-white shadow-xs transition hover:opacity-90",
1075
- to: "/",
1076
- children: text("notFound.home")
1077
- })
1078
- })
1079
- ]
1080
- });
1081
- }
1082
1079
  function NotFoundRouteElement(props) {
1083
1080
  const { component: RouteComponent } = props;
1084
1081
  if (!RouteComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BuiltInNotFoundPage, {});
1085
1082
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RouteComponent, {});
1086
1083
  }
1087
1084
  function AppShell(arg0) {
1088
- const { config, routes, navigation, runtimeSlots } = arg0;
1085
+ const { routes, navigation, runtimeSlots } = arg0;
1086
+ const config = require_i18n.useConfig();
1089
1087
  const location = (0, react_router_dom.useLocation)();
1090
1088
  const navigate = (0, react_router_dom.useNavigate)();
1091
1089
  const pathname = require_PageActions.normalizeRoutePath(location.pathname);
@@ -1095,7 +1093,7 @@ function AppShell(arg0) {
1095
1093
  const { currentRoute, explicitLocale, storedLocale, currentLocale, currentLocaleConfig, notFoundRoute, currentNavigation, sections } = useRouteState(config, routes, navigation, pathname);
1096
1094
  const text = require_i18n.useBuiltInText(currentLocale);
1097
1095
  const { activeBannerKey, bannerResolved, dismissedBannerKey, hasBanner, dismissBanner } = useBannerState(config, currentLocale);
1098
- const layoutConfig = getAppShellLayoutConfig(Boolean(currentNavigation.tabs?.length), hasBanner);
1096
+ const layoutConfig = getAppShellLayoutConfig(Boolean(currentNavigation.tabs?.length) && config.layout?.tabs !== "navbar", hasBanner);
1099
1097
  const { renderRoutes, NotFoundRouteComponent } = useRenderedRoutes(routes, notFoundRoute);
1100
1098
  useAppShellNavigationEffects({
1101
1099
  config,
@@ -1128,7 +1126,6 @@ function AppShell(arg0) {
1128
1126
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.Header, {
1129
1127
  ref: headerRef,
1130
1128
  topAreaRef: headerTopAreaRef,
1131
- config,
1132
1129
  navigation: currentNavigation.items,
1133
1130
  tabs: currentNavigation.tabs,
1134
1131
  routes,
@@ -1203,7 +1200,6 @@ function AppShell(arg0) {
1203
1200
  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),
1204
1201
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_PageActions.PageActionsProvider, {
1205
1202
  route: currentRoute,
1206
- routePrefix: config.routePrefix,
1207
1203
  children: [
1208
1204
  renderMain(),
1209
1205
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageNavigation, {
@@ -1856,6 +1852,7 @@ var randomLayoutWidths = [
1856
1852
  "128rem",
1857
1853
  "144rem"
1858
1854
  ];
1855
+ var randomTabsLayouts = ["subnav", "navbar"];
1859
1856
  var randomDarkAccentPairs = [
1860
1857
  {
1861
1858
  primary: "#34d399",
@@ -1942,6 +1939,9 @@ function createRandomTheme() {
1942
1939
  layout: { maxWidth: selection.maxWidth }
1943
1940
  };
1944
1941
  }
1942
+ function createRandomTabsLayout() {
1943
+ return randomItem(randomTabsLayouts);
1944
+ }
1945
1945
  //#endregion
1946
1946
  //#region source/theme/variables.ts
1947
1947
  var themeStorageKey = require_PageActions.themeCookieName;
@@ -2285,18 +2285,22 @@ function ColorModeInput(props) {
2285
2285
  })]
2286
2286
  });
2287
2287
  }
2288
- function themeToConfigSource(theme) {
2289
- return JSON.stringify({ theme: {
2290
- preset: theme.preset,
2291
- tokens: theme.tokens,
2292
- layout: theme.layout
2293
- } }, null, 2);
2288
+ function configToSource(theme, tabs = "subnav") {
2289
+ return JSON.stringify({
2290
+ theme: {
2291
+ preset: theme.preset,
2292
+ tokens: theme.tokens,
2293
+ layout: theme.layout
2294
+ },
2295
+ layout: { tabs }
2296
+ }, null, 2);
2294
2297
  }
2295
2298
  function useThemeEditorState(arg0) {
2296
2299
  const { initialTheme, onChange, target, resolvedTheme } = arg0;
2297
2300
  const [theme, setTheme] = (0, react.useState)(() => cloneTheme(initialTheme ?? themeEditorPresets.default));
2298
2301
  const [copyState, setCopyState] = (0, react.useState)("idle");
2299
- const configSource = (0, react.useMemo)(() => themeToConfigSource(theme), [theme]);
2302
+ const config = require_i18n.useConfigOptional();
2303
+ const configSource = (0, react.useMemo)(() => configToSource(theme, config?.layout?.tabs), [config?.layout?.tabs, theme]);
2300
2304
  (0, react.useEffect)(() => applyThemeCssVariables(themeToCssVariables(theme, resolvedTheme), resolveThemeVariableTargets(target)), [
2301
2305
  resolvedTheme,
2302
2306
  target,
@@ -2365,6 +2369,8 @@ function useThemeEditorState(arg0) {
2365
2369
  }
2366
2370
  function ThemeEditor(props) {
2367
2371
  const { initialTheme, onChange, target, defaultOpen = false, className } = props;
2372
+ const config = require_i18n.useConfigOptional();
2373
+ const updateConfig = require_i18n.useConfigUpdaterOptional();
2368
2374
  const { resolvedTheme } = require_PageActions.useTheme();
2369
2375
  const [isOpen, setIsOpen] = (0, react.useState)(defaultOpen);
2370
2376
  const { theme, copyState, commit, updatePreset, updateColorToken, updateRadiusToken, updateLayoutToken, copyConfig } = useThemeEditorState({
@@ -2373,6 +2379,16 @@ function ThemeEditor(props) {
2373
2379
  target,
2374
2380
  resolvedTheme
2375
2381
  });
2382
+ function randomize() {
2383
+ commit(createRandomTheme());
2384
+ updateConfig?.((currentConfig) => ({
2385
+ ...currentConfig,
2386
+ layout: {
2387
+ ...currentConfig.layout,
2388
+ tabs: createRandomTabsLayout()
2389
+ }
2390
+ }));
2391
+ }
2376
2392
  function renderPanelHeader() {
2377
2393
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
2378
2394
  className: "shrink-0 flex items-start justify-between gap-4 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3",
@@ -2449,15 +2465,44 @@ function ThemeEditor(props) {
2449
2465
  }),
2450
2466
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
2451
2467
  className: "grid gap-3",
2452
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
2453
- className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2454
- children: "Layout"
2455
- }), layoutFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2456
- id: `clarify-theme-editor-layout-${field.key}`,
2457
- label: field.label,
2458
- value: theme.layout[field.key],
2459
- onChange: (value) => updateLayoutToken(field.key, value)
2460
- }, field.key))]
2468
+ children: [
2469
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
2470
+ className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
2471
+ children: "Layout"
2472
+ }),
2473
+ config && updateConfig ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
2474
+ htmlFor: "clarify-theme-editor-tabs-position",
2475
+ className: "grid gap-1.5 text-xs/5 font-medium text-(--clarify-ui-text)",
2476
+ children: ["Tabs position", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2477
+ className: "relative block",
2478
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
2479
+ id: "clarify-theme-editor-tabs-position",
2480
+ value: config.layout?.tabs ?? "subnav",
2481
+ 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)",
2482
+ onChange: (event) => updateConfig((currentConfig) => ({
2483
+ ...currentConfig,
2484
+ layout: {
2485
+ ...currentConfig.layout,
2486
+ tabs: event.target.value
2487
+ }
2488
+ })),
2489
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2490
+ value: "subnav",
2491
+ children: "Below navbar"
2492
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
2493
+ value: "navbar",
2494
+ children: "Inside navbar"
2495
+ })]
2496
+ }), /* @__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)" })]
2497
+ })]
2498
+ }) : null,
2499
+ layoutFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
2500
+ id: `clarify-theme-editor-layout-${field.key}`,
2501
+ label: field.label,
2502
+ value: theme.layout[field.key],
2503
+ onChange: (value) => updateLayoutToken(field.key, value)
2504
+ }, field.key))
2505
+ ]
2461
2506
  })
2462
2507
  ]
2463
2508
  })
@@ -2476,7 +2521,7 @@ function ThemeEditor(props) {
2476
2521
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
2477
2522
  type: "button",
2478
2523
  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)",
2479
- onClick: () => commit(createRandomTheme()),
2524
+ onClick: randomize,
2480
2525
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.WandSparkles, { className: "size-3.5 stroke-current stroke-2" }), "Random"]
2481
2526
  })]
2482
2527
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -2514,14 +2559,23 @@ function ThemeEditor(props) {
2514
2559
  //#endregion
2515
2560
  //#region source/theme/ThemeRoot.tsx
2516
2561
  function ThemeRoot(props) {
2517
- const { children, theme, themeEditor = false } = props;
2562
+ const { children, themeEditor = false } = props;
2563
+ const config = require_i18n.useConfig();
2564
+ const updateConfig = require_i18n.useConfigUpdater();
2565
+ const theme = config.theme;
2518
2566
  const { resolvedTheme } = require_PageActions.useTheme();
2519
2567
  const themeVariables = (0, react.useMemo)(() => themeToCssVariables(theme, resolvedTheme), [resolvedTheme, theme]);
2520
2568
  (0, react.useEffect)(() => applyThemeCssVariables(themeVariables, resolveThemeVariableTargets(":root")), [themeVariables]);
2521
2569
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2522
2570
  className: "clarify-app h-full min-h-screen bg-(--clarify-theme-tokens-colors-background) text-(--clarify-theme-tokens-colors-foreground)",
2523
2571
  "data-theme-preset": theme.preset,
2524
- children: [children, themeEditor ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeEditor, { initialTheme: theme }) : null]
2572
+ children: [children, themeEditor ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeEditor, {
2573
+ initialTheme: theme,
2574
+ onChange: (nextTheme) => updateConfig((currentConfig) => ({
2575
+ ...currentConfig,
2576
+ theme: nextTheme
2577
+ }))
2578
+ }) : null]
2525
2579
  });
2526
2580
  }
2527
2581
  //#endregion
@@ -2536,15 +2590,13 @@ function ThemeRoot(props) {
2536
2590
  */
2537
2591
  function ClarifyShell(props) {
2538
2592
  const { config, routes, navigation, openApiSpecs, runtimeSlots, themeEditor = false } = props;
2539
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.ConfigContext.Provider, {
2540
- value: config,
2593
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.ConfigProvider, {
2594
+ config,
2541
2595
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.OpenApiSpecsContext.Provider, {
2542
2596
  value: openApiSpecs,
2543
2597
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.ThemeProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeRoot, {
2544
- theme: config.theme,
2545
2598
  themeEditor,
2546
2599
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppShell, {
2547
- config,
2548
2600
  routes,
2549
2601
  navigation: navigation ?? {
2550
2602
  kind: "flat",
@@ -2654,4 +2706,4 @@ Object.defineProperty(exports, "useSlot", {
2654
2706
  }
2655
2707
  });
2656
2708
 
2657
- //# sourceMappingURL=ClarifyShell-CukbPOAd.cjs.map
2709
+ //# sourceMappingURL=ClarifyShell-D8OGIUWq.cjs.map