@clarify-labs/renderer 0.9.0 → 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.
- package/output/{ClarifyShell-BPv2bxI4.js → ClarifyShell-C38EkErX.js} +397 -250
- package/output/ClarifyShell-C38EkErX.js.map +1 -0
- package/output/{ClarifyShell-B74Fq4UU.cjs → ClarifyShell-DdYRgrfY.cjs} +396 -249
- package/output/ClarifyShell-DdYRgrfY.cjs.map +1 -0
- package/output/{OpenApiOperation-BMXfV15v.cjs → OpenApiOperation-CP_fxT_F.cjs} +344 -219
- package/output/OpenApiOperation-CP_fxT_F.cjs.map +1 -0
- package/output/{OpenApiOperation-fJ3QQOJX.js → OpenApiOperation-DIFaYAe5.js} +344 -219
- package/output/OpenApiOperation-DIFaYAe5.js.map +1 -0
- package/output/{PageActions-DOKkt2zo.cjs → PageActions-B08cDCzq.cjs} +278 -167
- package/output/PageActions-B08cDCzq.cjs.map +1 -0
- package/output/{PageActions-BwY7ierv.js → PageActions-tmnpzi23.js} +279 -168
- package/output/PageActions-tmnpzi23.js.map +1 -0
- package/output/app/SectionProvider.d.ts +1 -0
- package/output/client.cjs +3 -3
- package/output/client.js +3 -3
- package/output/core/types.d.ts +1 -0
- package/output/index.cjs +4 -4
- package/output/index.js +4 -4
- package/output/openapi/components/CodeDisplay.d.ts +25 -0
- package/output/openapi/components/EndpointSections.d.ts +4 -0
- package/output/openapi/components/ExamplePanels.d.ts +8 -17
- package/output/openapi/components/OpenApiOperation.state.d.ts +43 -0
- package/output/openapi/components/SelectControl.d.ts +15 -0
- package/output/openapi/components/helpers.d.ts +22 -0
- package/output/preview.cjs +114 -67
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +114 -67
- package/output/preview.js.map +1 -1
- package/output/{render-Cghgq1AQ.js → render-6gHfrR9h.js} +2 -2
- package/output/{render-Cghgq1AQ.js.map → render-6gHfrR9h.js.map} +1 -1
- package/output/{render-ZSckbg74.cjs → render-Bvf5ZMZb.cjs} +2 -2
- package/output/{render-ZSckbg74.cjs.map → render-Bvf5ZMZb.cjs.map} +1 -1
- package/output/renderer.css +168 -107
- package/output/server.cjs +2 -2
- package/output/server.js +2 -2
- package/output/shell/Header.d.ts +2 -0
- package/package.json +1 -1
- package/output/ClarifyShell-B74Fq4UU.cjs.map +0 -1
- package/output/ClarifyShell-BPv2bxI4.js.map +0 -1
- package/output/OpenApiOperation-BMXfV15v.cjs.map +0 -1
- package/output/OpenApiOperation-fJ3QQOJX.js.map +0 -1
- package/output/PageActions-BwY7ierv.js.map +0 -1
- package/output/PageActions-DOKkt2zo.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-DakpK96I.cjs");
|
|
2
|
-
const require_PageActions = require("./PageActions-
|
|
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");
|
|
@@ -582,9 +582,9 @@ function PageSkeleton() {
|
|
|
582
582
|
//#endregion
|
|
583
583
|
//#region source/app/AppShell.tsx
|
|
584
584
|
function BannerSlot(props) {
|
|
585
|
-
const { activeBannerKey, dismissedBannerKey, onDismiss, config, locale } = props;
|
|
585
|
+
const { activeBannerKey, dismissedBannerKey, bannerResolved, onDismiss, config, locale } = props;
|
|
586
586
|
function DefaultBannerComponent() {
|
|
587
|
-
if (!(Boolean(config.banner) && dismissedBannerKey !== activeBannerKey)) return null;
|
|
587
|
+
if (!(bannerResolved && Boolean(config.banner) && dismissedBannerKey !== activeBannerKey)) return null;
|
|
588
588
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageBanner, {
|
|
589
589
|
currentLocale: locale,
|
|
590
590
|
onDismiss
|
|
@@ -685,6 +685,130 @@ function applyDocumentMetadata(config, route) {
|
|
|
685
685
|
setNamedMeta("description", route?.description ?? config.description);
|
|
686
686
|
setNamedMeta("keywords", route?.keywords?.join(", "));
|
|
687
687
|
}
|
|
688
|
+
function useRouteState(config, routes, navigation, pathname) {
|
|
689
|
+
const currentRoute = routeForPath(routes, pathname);
|
|
690
|
+
const explicitLocale = explicitLocaleForPath(config, pathname);
|
|
691
|
+
const storedLocale = storedLocaleForConfig(config);
|
|
692
|
+
const currentLocale = explicitLocale ?? storedLocale ?? fallbackLocale(config);
|
|
693
|
+
return {
|
|
694
|
+
currentRoute,
|
|
695
|
+
explicitLocale,
|
|
696
|
+
storedLocale,
|
|
697
|
+
currentLocale,
|
|
698
|
+
currentLocaleConfig: config.i18n?.locales.find((locale) => locale.code === currentLocale),
|
|
699
|
+
notFoundRoute: currentRoute ? void 0 : notFoundRouteForPath(routes, pathname, currentLocale),
|
|
700
|
+
currentNavigation: navigationForLocale(navigation, currentLocale, pathname),
|
|
701
|
+
sections: sectionsForRoute(currentRoute)
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
function useRenderedRoutes(routes, notFoundRoute) {
|
|
705
|
+
const renderRoutes = (0, react.useMemo)(() => routes.map((route) => ({
|
|
706
|
+
...route,
|
|
707
|
+
component: resolveRouteComponent(route)
|
|
708
|
+
})), [routes]);
|
|
709
|
+
return {
|
|
710
|
+
renderRoutes,
|
|
711
|
+
NotFoundRouteComponent: notFoundRoute ? renderRoutes.find((route) => require_PageActions.isSameRoutePath(route.path, notFoundRoute.path))?.component : void 0
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
function emptySubscribe() {
|
|
715
|
+
return () => {};
|
|
716
|
+
}
|
|
717
|
+
function useStoredBannerDismissed(storageKey) {
|
|
718
|
+
return (0, react.useSyncExternalStore)(emptySubscribe, () => Boolean(storageKey && window.localStorage.getItem(storageKey) === "1"), () => true);
|
|
719
|
+
}
|
|
720
|
+
function useBannerState(config, currentLocale) {
|
|
721
|
+
const banner = config.banner;
|
|
722
|
+
const bannerContent = banner ? require_PageActions.resolveLocalizedText(banner.content, currentLocale, config.i18n?.defaultLocale) : "";
|
|
723
|
+
const bannerStorageKey = banner && bannerContent ? `clarify:banner:dismissed:${config.title}:${bannerContent}` : void 0;
|
|
724
|
+
const storedBannerDismissed = useStoredBannerDismissed(banner?.dismissible ? bannerStorageKey : void 0);
|
|
725
|
+
const [dismissedBannerKey, setDismissedBannerKey] = (0, react.useState)();
|
|
726
|
+
const activeBannerKey = banner ? JSON.stringify(banner) : void 0;
|
|
727
|
+
return {
|
|
728
|
+
activeBannerKey,
|
|
729
|
+
bannerResolved: !banner?.dismissible || !storedBannerDismissed,
|
|
730
|
+
dismissedBannerKey,
|
|
731
|
+
hasBanner: Boolean(banner && bannerContent) && !storedBannerDismissed && dismissedBannerKey !== activeBannerKey,
|
|
732
|
+
dismissBanner: () => setDismissedBannerKey(activeBannerKey)
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
function useAppShellNavigationEffects(arg0) {
|
|
736
|
+
const { config, currentRoute, explicitLocale, location, navigate, pathname, storedLocale } = arg0;
|
|
737
|
+
(0, react.useEffect)(() => {
|
|
738
|
+
if (explicitLocale) require_PageActions.storeLocalePreference(explicitLocale);
|
|
739
|
+
}, [explicitLocale]);
|
|
740
|
+
(0, react.useEffect)(() => {
|
|
741
|
+
if (explicitLocale || !storedLocale || isDefaultLocale(config, storedLocale)) return;
|
|
742
|
+
const localizedPath = currentRoute?.alternates?.[storedLocale];
|
|
743
|
+
if (!localizedPath || require_PageActions.isSameRoutePath(localizedPath, pathname)) return;
|
|
744
|
+
navigate(`${localizedPath}${location.search}${location.hash}`, { replace: true });
|
|
745
|
+
}, [
|
|
746
|
+
config,
|
|
747
|
+
currentRoute,
|
|
748
|
+
explicitLocale,
|
|
749
|
+
location.hash,
|
|
750
|
+
location.search,
|
|
751
|
+
navigate,
|
|
752
|
+
pathname,
|
|
753
|
+
storedLocale
|
|
754
|
+
]);
|
|
755
|
+
(0, react.useEffect)(() => {
|
|
756
|
+
if (location.hash) {
|
|
757
|
+
scrollToHash(location.hash);
|
|
758
|
+
return;
|
|
759
|
+
}
|
|
760
|
+
window.scrollTo({
|
|
761
|
+
top: 0,
|
|
762
|
+
left: 0
|
|
763
|
+
});
|
|
764
|
+
window.requestAnimationFrame(() => {
|
|
765
|
+
window.dispatchEvent(new Event("scroll"));
|
|
766
|
+
});
|
|
767
|
+
}, [location.hash, location.pathname]);
|
|
768
|
+
}
|
|
769
|
+
function useAppShellDocumentEffects(arg0) {
|
|
770
|
+
const { currentLocale, currentLocaleConfig, config, route } = arg0;
|
|
771
|
+
(0, react.useEffect)(() => {
|
|
772
|
+
if (!currentLocale) return;
|
|
773
|
+
document.documentElement.lang = currentLocale;
|
|
774
|
+
if (currentLocaleConfig?.dir) document.documentElement.dir = currentLocaleConfig.dir;
|
|
775
|
+
else document.documentElement.removeAttribute("dir");
|
|
776
|
+
}, [currentLocale, currentLocaleConfig?.dir]);
|
|
777
|
+
(0, react.useEffect)(() => {
|
|
778
|
+
applyDocumentMetadata(config, route);
|
|
779
|
+
}, [config, route]);
|
|
780
|
+
}
|
|
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)];
|
|
811
|
+
}
|
|
688
812
|
function BuiltInNotFoundPage() {
|
|
689
813
|
const text = require_PageActions.useBuiltInText();
|
|
690
814
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
@@ -725,68 +849,133 @@ function AppShell(arg0) {
|
|
|
725
849
|
const location = (0, react_router_dom.useLocation)();
|
|
726
850
|
const navigate = (0, react_router_dom.useNavigate)();
|
|
727
851
|
const pathname = require_PageActions.normalizeRoutePath(location.pathname);
|
|
728
|
-
const
|
|
729
|
-
const
|
|
730
|
-
const storedLocale =
|
|
731
|
-
const currentLocale = explicitLocale ?? storedLocale ?? fallbackLocale(config);
|
|
732
|
-
const currentLocaleConfig = config.i18n?.locales.find((locale) => locale.code === currentLocale);
|
|
733
|
-
const notFoundRoute = currentRoute ? void 0 : notFoundRouteForPath(routes, pathname, currentLocale);
|
|
852
|
+
const headerRef = (0, react.useRef)(null);
|
|
853
|
+
const headerTopAreaRef = (0, react.useRef)(null);
|
|
854
|
+
const { currentRoute, explicitLocale, storedLocale, currentLocale, currentLocaleConfig, notFoundRoute, currentNavigation, sections } = useRouteState(config, routes, navigation, pathname);
|
|
734
855
|
const text = require_PageActions.useBuiltInText(currentLocale);
|
|
735
|
-
const
|
|
736
|
-
const
|
|
737
|
-
const
|
|
738
|
-
|
|
739
|
-
const hasBanner = Boolean(config.banner) && dismissedBannerKey !== activeBannerKey;
|
|
740
|
-
const hasTabs = Boolean(currentNavigation.tabs?.length);
|
|
741
|
-
const renderRoutes = (0, react.useMemo)(() => routes.map((route) => ({
|
|
742
|
-
...route,
|
|
743
|
-
component: resolveRouteComponent(route)
|
|
744
|
-
})), [routes]);
|
|
745
|
-
const NotFoundRouteComponent = notFoundRoute ? renderRoutes.find((route) => require_PageActions.isSameRoutePath(route.path, notFoundRoute.path))?.component : void 0;
|
|
746
|
-
(0, react.useEffect)(() => {
|
|
747
|
-
if (explicitLocale) require_PageActions.storeLocalePreference(explicitLocale);
|
|
748
|
-
}, [explicitLocale]);
|
|
749
|
-
(0, react.useEffect)(() => {
|
|
750
|
-
if (explicitLocale || !storedLocale || isDefaultLocale(config, storedLocale)) return;
|
|
751
|
-
const localizedPath = currentRoute?.alternates?.[storedLocale];
|
|
752
|
-
if (!localizedPath || require_PageActions.isSameRoutePath(localizedPath, pathname)) return;
|
|
753
|
-
navigate(`${localizedPath}${location.search}${location.hash}`, { replace: true });
|
|
754
|
-
}, [
|
|
856
|
+
const { activeBannerKey, bannerResolved, dismissedBannerKey, hasBanner, dismissBanner } = useBannerState(config, currentLocale);
|
|
857
|
+
const layoutConfig = getAppShellLayoutConfig(Boolean(currentNavigation.tabs?.length), hasBanner);
|
|
858
|
+
const { renderRoutes, NotFoundRouteComponent } = useRenderedRoutes(routes, notFoundRoute);
|
|
859
|
+
useAppShellNavigationEffects({
|
|
755
860
|
config,
|
|
756
861
|
currentRoute,
|
|
757
862
|
explicitLocale,
|
|
758
|
-
location
|
|
759
|
-
location.search,
|
|
863
|
+
location,
|
|
760
864
|
navigate,
|
|
761
865
|
pathname,
|
|
762
866
|
storedLocale
|
|
763
|
-
|
|
764
|
-
(
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
867
|
+
});
|
|
868
|
+
useAppShellDocumentEffects({
|
|
869
|
+
currentLocale,
|
|
870
|
+
currentLocaleConfig,
|
|
871
|
+
config,
|
|
872
|
+
route: currentRoute ?? notFoundRoute
|
|
873
|
+
});
|
|
874
|
+
const layoutStyle = { "--clarify-header-offset": layoutConfig.headerOffset };
|
|
875
|
+
function renderBannerSlot() {
|
|
876
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerSlot, {
|
|
877
|
+
activeBannerKey,
|
|
878
|
+
dismissedBannerKey,
|
|
879
|
+
bannerResolved,
|
|
880
|
+
onDismiss: dismissBanner,
|
|
881
|
+
config,
|
|
882
|
+
locale: currentLocale
|
|
772
883
|
});
|
|
773
|
-
|
|
774
|
-
|
|
884
|
+
}
|
|
885
|
+
function renderHeader() {
|
|
886
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.Header, {
|
|
887
|
+
ref: headerRef,
|
|
888
|
+
topAreaRef: headerTopAreaRef,
|
|
889
|
+
config,
|
|
890
|
+
navigation: currentNavigation.items,
|
|
891
|
+
tabs: currentNavigation.tabs,
|
|
892
|
+
routes,
|
|
893
|
+
currentLocale,
|
|
894
|
+
currentRoute,
|
|
895
|
+
banner: renderBannerSlot()
|
|
775
896
|
});
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
897
|
+
}
|
|
898
|
+
function renderSidebar() {
|
|
899
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
900
|
+
"data-pagefind-ignore": true,
|
|
901
|
+
className: "clarify-sidebar hidden lg:block lg:self-stretch lg:bg-(--clarify-theme-tokens-colors-background) lg:px-5 xl:px-6",
|
|
902
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
903
|
+
className: (0, clsx.default)("clarify-sidebar-scroll lg:sticky lg:z-30 lg:overflow-y-auto lg:pb-8", layoutConfig.sidebarScrollClassName),
|
|
904
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.Navigation, { navigation: currentNavigation.items })
|
|
905
|
+
})
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
function renderRouteElements() {
|
|
909
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Routes, { children: [renderRoutes.map((route) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Route, {
|
|
910
|
+
path: route.path,
|
|
911
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(route.component, {})
|
|
912
|
+
}, route.path)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Route, {
|
|
913
|
+
path: "*",
|
|
914
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NotFoundRouteElement, { component: NotFoundRouteComponent })
|
|
915
|
+
})] });
|
|
916
|
+
}
|
|
917
|
+
function renderMain() {
|
|
918
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("main", {
|
|
919
|
+
className: "clarify-main min-w-0 flex-auto",
|
|
920
|
+
"data-pagefind-body": true,
|
|
921
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageErrorBoundary, {
|
|
922
|
+
title: text("renderError.title"),
|
|
923
|
+
description: text("renderError.description"),
|
|
924
|
+
reloadLabel: text("renderError.reload"),
|
|
925
|
+
detailsLabel: text("renderError.details"),
|
|
926
|
+
pathLabel: text("renderError.path"),
|
|
927
|
+
typeLabel: text("renderError.type"),
|
|
928
|
+
messageLabel: text("renderError.message"),
|
|
929
|
+
stackLabel: text("renderError.stack"),
|
|
930
|
+
componentStackLabel: text("renderError.componentStack"),
|
|
931
|
+
timestampLabel: text("renderError.timestamp"),
|
|
932
|
+
copyLabel: text("actions.copy"),
|
|
933
|
+
copiedLabel: text("actions.copied"),
|
|
934
|
+
path: pathname,
|
|
935
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
936
|
+
fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageSkeleton, {}),
|
|
937
|
+
children: renderRouteElements()
|
|
938
|
+
})
|
|
939
|
+
}, pathname)
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
function renderFooter() {
|
|
943
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
944
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuntimeSlot, { name: "page.footer.before" }),
|
|
945
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuntimeSlot, {
|
|
946
|
+
name: "page.footer.replace",
|
|
947
|
+
default: DefaultFooterComponent
|
|
948
|
+
}),
|
|
949
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
950
|
+
className: "flex justify-end",
|
|
951
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BuiltWithClarify, {})
|
|
952
|
+
})
|
|
953
|
+
] });
|
|
954
|
+
}
|
|
955
|
+
function renderContent() {
|
|
956
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
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),
|
|
958
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_PageActions.PageActionsProvider, {
|
|
959
|
+
route: currentRoute,
|
|
960
|
+
routePrefix: config.routePrefix,
|
|
961
|
+
children: [
|
|
962
|
+
renderMain(),
|
|
963
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageNavigation, {
|
|
964
|
+
navigation: currentNavigation.items,
|
|
965
|
+
currentRoute
|
|
966
|
+
}),
|
|
967
|
+
renderFooter()
|
|
968
|
+
]
|
|
969
|
+
})
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
function renderLayout() {
|
|
973
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
974
|
+
className: "clarify-layout mx-auto grid w-full max-w-(--clarify-theme-layout-max-width) grid-cols-1 lg:grid-cols-(--clarify-layout-sidebar-grid) xl:grid-cols-(--clarify-layout-sidebar-grid-wide)",
|
|
975
|
+
style: layoutStyle,
|
|
976
|
+
children: [renderSidebar(), renderContent()]
|
|
977
|
+
});
|
|
978
|
+
}
|
|
790
979
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.LocaleContext.Provider, {
|
|
791
980
|
value: currentLocale,
|
|
792
981
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuntimeSlotsProvider, {
|
|
@@ -794,82 +983,8 @@ function AppShell(arg0) {
|
|
|
794
983
|
route: currentRoute,
|
|
795
984
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_PageActions.SectionProvider, {
|
|
796
985
|
sections,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
navigation: currentNavigation.items,
|
|
800
|
-
tabs: currentNavigation.tabs,
|
|
801
|
-
routes,
|
|
802
|
-
currentLocale,
|
|
803
|
-
currentRoute,
|
|
804
|
-
banner: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BannerSlot, {
|
|
805
|
-
activeBannerKey,
|
|
806
|
-
dismissedBannerKey,
|
|
807
|
-
onDismiss: () => setDismissedBannerKey(activeBannerKey),
|
|
808
|
-
config,
|
|
809
|
-
locale: currentLocale
|
|
810
|
-
})
|
|
811
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
812
|
-
className: "clarify-layout mx-auto grid w-full max-w-(--clarify-theme-layout-max-width) grid-cols-1 lg:grid-cols-(--clarify-layout-sidebar-grid) xl:grid-cols-(--clarify-layout-sidebar-grid-wide)",
|
|
813
|
-
style: { "--clarify-header-offset": hasTabs && hasBanner ? "10rem" : hasTabs && !hasBanner ? "7rem" : !hasTabs && hasBanner ? "6.5rem" : "3.5rem" },
|
|
814
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("aside", {
|
|
815
|
-
"data-pagefind-ignore": true,
|
|
816
|
-
className: "clarify-sidebar hidden lg:block lg:self-stretch lg:bg-(--clarify-theme-tokens-colors-background) lg:px-5 xl:px-6",
|
|
817
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
818
|
-
className: (0, clsx.default)("clarify-sidebar-scroll lg:sticky lg:z-30 lg:overflow-y-auto lg:pb-8", hasTabs && hasBanner && "lg:top-40 lg:h-(--clarify-sidebar-height-with-tabs-and-banner) lg:pt-10", hasTabs && !hasBanner && "lg:top-28 lg:h-(--clarify-sidebar-height-with-tabs) lg:pt-10", !hasTabs && hasBanner && "lg:top-26 lg:h-(--clarify-sidebar-height-with-banner) lg:pt-10", !hasTabs && !hasBanner && "lg:top-14 lg:h-(--clarify-sidebar-height) lg:pt-10"),
|
|
819
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.Navigation, { navigation: currentNavigation.items })
|
|
820
|
-
})
|
|
821
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
822
|
-
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", hasTabs && hasBanner && "pt-26 lg:pt-40", hasTabs && !hasBanner && "pt-14 lg:pt-28", !hasTabs && hasBanner && "pt-26", !hasTabs && !hasBanner && "pt-14"),
|
|
823
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_PageActions.PageActionsProvider, {
|
|
824
|
-
route: currentRoute,
|
|
825
|
-
routePrefix: config.routePrefix,
|
|
826
|
-
children: [
|
|
827
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("main", {
|
|
828
|
-
className: "clarify-main min-w-0 flex-auto",
|
|
829
|
-
"data-pagefind-body": true,
|
|
830
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageErrorBoundary, {
|
|
831
|
-
title: text("renderError.title"),
|
|
832
|
-
description: text("renderError.description"),
|
|
833
|
-
reloadLabel: text("renderError.reload"),
|
|
834
|
-
detailsLabel: text("renderError.details"),
|
|
835
|
-
pathLabel: text("renderError.path"),
|
|
836
|
-
typeLabel: text("renderError.type"),
|
|
837
|
-
messageLabel: text("renderError.message"),
|
|
838
|
-
stackLabel: text("renderError.stack"),
|
|
839
|
-
componentStackLabel: text("renderError.componentStack"),
|
|
840
|
-
timestampLabel: text("renderError.timestamp"),
|
|
841
|
-
copyLabel: text("actions.copy"),
|
|
842
|
-
copiedLabel: text("actions.copied"),
|
|
843
|
-
path: pathname,
|
|
844
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
845
|
-
fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageSkeleton, {}),
|
|
846
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Routes, { children: [renderRoutes.map((route) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Route, {
|
|
847
|
-
path: route.path,
|
|
848
|
-
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(route.component, {})
|
|
849
|
-
}, route.path)), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Route, {
|
|
850
|
-
path: "*",
|
|
851
|
-
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NotFoundRouteElement, { component: NotFoundRouteComponent })
|
|
852
|
-
})] })
|
|
853
|
-
})
|
|
854
|
-
}, pathname)
|
|
855
|
-
}),
|
|
856
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageNavigation, {
|
|
857
|
-
navigation: currentNavigation.items,
|
|
858
|
-
currentRoute
|
|
859
|
-
}),
|
|
860
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuntimeSlot, { name: "page.footer.before" }),
|
|
861
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuntimeSlot, {
|
|
862
|
-
name: "page.footer.replace",
|
|
863
|
-
default: DefaultFooterComponent
|
|
864
|
-
}),
|
|
865
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
866
|
-
className: "flex justify-end",
|
|
867
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BuiltWithClarify, {})
|
|
868
|
-
})
|
|
869
|
-
]
|
|
870
|
-
})
|
|
871
|
-
})]
|
|
872
|
-
})]
|
|
986
|
+
headerTopAreaRef,
|
|
987
|
+
children: [renderHeader(), renderLayout()]
|
|
873
988
|
})
|
|
874
989
|
})
|
|
875
990
|
});
|
|
@@ -1925,10 +2040,8 @@ function themeToConfigSource(theme) {
|
|
|
1925
2040
|
layout: theme.layout
|
|
1926
2041
|
} }, null, 2);
|
|
1927
2042
|
}
|
|
1928
|
-
function
|
|
1929
|
-
const { initialTheme, onChange, target,
|
|
1930
|
-
const { resolvedTheme } = require_PageActions.useTheme();
|
|
1931
|
-
const [isOpen, setIsOpen] = (0, react.useState)(defaultOpen);
|
|
2043
|
+
function useThemeEditorState(arg0) {
|
|
2044
|
+
const { initialTheme, onChange, target, resolvedTheme } = arg0;
|
|
1932
2045
|
const [theme, setTheme] = (0, react.useState)(() => cloneTheme(initialTheme ?? themeEditorPresets.default));
|
|
1933
2046
|
const [copyState, setCopyState] = (0, react.useState)("idle");
|
|
1934
2047
|
const configSource = (0, react.useMemo)(() => themeToConfigSource(theme), [theme]);
|
|
@@ -1987,122 +2100,156 @@ function ThemeEditor(props) {
|
|
|
1987
2100
|
window.setTimeout(() => setCopyState("idle"), 1400);
|
|
1988
2101
|
}
|
|
1989
2102
|
}
|
|
1990
|
-
return
|
|
1991
|
-
|
|
1992
|
-
|
|
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", {
|
|
1993
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",
|
|
1994
2242
|
"aria-label": "Clarify theme editor",
|
|
1995
2243
|
children: [
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
className: "text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
2000
|
-
children: "Theme editor"
|
|
2001
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2002
|
-
className: "mt-0.5 text-xs/5 text-(--clarify-ui-text-soft)",
|
|
2003
|
-
children: "Live CSS variable preview for Clarify theme tokens."
|
|
2004
|
-
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2005
|
-
type: "button",
|
|
2006
|
-
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)",
|
|
2007
|
-
"aria-label": "Close theme editor",
|
|
2008
|
-
onClick: () => setIsOpen(false),
|
|
2009
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "size-4 stroke-current stroke-2" })
|
|
2010
|
-
})]
|
|
2011
|
-
}),
|
|
2012
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2013
|
-
className: "min-h-0 flex-1 overflow-y-auto px-4 py-4",
|
|
2014
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2015
|
-
className: "grid gap-5",
|
|
2016
|
-
children: [
|
|
2017
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
|
|
2018
|
-
htmlFor: "clarify-theme-editor-preset",
|
|
2019
|
-
className: "grid gap-1.5 text-xs/5 font-medium text-(--clarify-ui-text)",
|
|
2020
|
-
children: ["Preset", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2021
|
-
className: "relative block",
|
|
2022
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("select", {
|
|
2023
|
-
id: "clarify-theme-editor-preset",
|
|
2024
|
-
value: theme.preset,
|
|
2025
|
-
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)",
|
|
2026
|
-
onChange: (event) => updatePreset(event.target.value),
|
|
2027
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2028
|
-
value: "default",
|
|
2029
|
-
children: "default"
|
|
2030
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
|
|
2031
|
-
value: "base",
|
|
2032
|
-
children: "base"
|
|
2033
|
-
})]
|
|
2034
|
-
}), /* @__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)" })]
|
|
2035
|
-
})]
|
|
2036
|
-
}),
|
|
2037
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
2038
|
-
className: "grid gap-3",
|
|
2039
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
|
|
2040
|
-
className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
|
|
2041
|
-
children: "Colors"
|
|
2042
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2043
|
-
className: "grid grid-cols-1 gap-3",
|
|
2044
|
-
children: colorTokenFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ColorField, {
|
|
2045
|
-
id: `clarify-theme-editor-color-${field.key}`,
|
|
2046
|
-
label: field.label,
|
|
2047
|
-
value: theme.tokens.colors[field.key],
|
|
2048
|
-
onChange: (mode, value) => updateColorToken(field.key, mode, value)
|
|
2049
|
-
}, field.key))
|
|
2050
|
-
})]
|
|
2051
|
-
}),
|
|
2052
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
2053
|
-
className: "grid gap-3",
|
|
2054
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
|
|
2055
|
-
className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
|
|
2056
|
-
children: "Radius"
|
|
2057
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2058
|
-
className: "grid grid-cols-2 gap-3",
|
|
2059
|
-
children: radiusTokenFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
|
|
2060
|
-
id: `clarify-theme-editor-radius-${field.key}`,
|
|
2061
|
-
label: field.label,
|
|
2062
|
-
value: theme.tokens.radius[field.key],
|
|
2063
|
-
onChange: (value) => updateRadiusToken(field.key, value)
|
|
2064
|
-
}, field.key))
|
|
2065
|
-
})]
|
|
2066
|
-
}),
|
|
2067
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
2068
|
-
className: "grid gap-3",
|
|
2069
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("legend", {
|
|
2070
|
-
className: "mb-2 text-xs/5 font-semibold uppercase tracking-wide text-(--clarify-ui-text-faint)",
|
|
2071
|
-
children: "Layout"
|
|
2072
|
-
}), layoutFields.map((field) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextField, {
|
|
2073
|
-
id: `clarify-theme-editor-layout-${field.key}`,
|
|
2074
|
-
label: field.label,
|
|
2075
|
-
value: theme.layout[field.key],
|
|
2076
|
-
onChange: (value) => updateLayoutToken(field.key, value)
|
|
2077
|
-
}, field.key))]
|
|
2078
|
-
})
|
|
2079
|
-
]
|
|
2080
|
-
})
|
|
2081
|
-
}),
|
|
2082
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
2083
|
-
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",
|
|
2084
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2085
|
-
className: "flex items-center gap-1.5",
|
|
2086
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2087
|
-
type: "button",
|
|
2088
|
-
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)",
|
|
2089
|
-
onClick: () => updatePreset(theme.preset),
|
|
2090
|
-
children: "Reset preset"
|
|
2091
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2092
|
-
type: "button",
|
|
2093
|
-
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)",
|
|
2094
|
-
onClick: () => commit(createRandomTheme()),
|
|
2095
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.WandSparkles, { className: "size-3.5 stroke-current stroke-2" }), "Random"]
|
|
2096
|
-
})]
|
|
2097
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
2098
|
-
type: "button",
|
|
2099
|
-
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",
|
|
2100
|
-
onClick: copyConfig,
|
|
2101
|
-
children: copyState === "copied" ? "Copied" : copyState === "failed" ? "Copy failed" : "Copy config"
|
|
2102
|
-
})]
|
|
2103
|
-
})
|
|
2244
|
+
renderPanelHeader(),
|
|
2245
|
+
renderPanelBody(),
|
|
2246
|
+
renderPanelFooter()
|
|
2104
2247
|
]
|
|
2105
|
-
})
|
|
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", {
|
|
2106
2253
|
type: "button",
|
|
2107
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)",
|
|
2108
2255
|
"aria-label": isOpen ? "Close Clarify theme editor" : "Open Clarify theme editor",
|
|
@@ -2246,4 +2393,4 @@ Object.defineProperty(exports, "useSlot", {
|
|
|
2246
2393
|
}
|
|
2247
2394
|
});
|
|
2248
2395
|
|
|
2249
|
-
//# sourceMappingURL=ClarifyShell-
|
|
2396
|
+
//# sourceMappingURL=ClarifyShell-DdYRgrfY.cjs.map
|