@clarify-labs/renderer 0.10.0 → 0.10.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-CxhXBtsR.js → ClarifyShell-1LuBliwt.js} +124 -40
- package/output/ClarifyShell-1LuBliwt.js.map +1 -0
- package/output/{ClarifyShell-DjLRRW8T.cjs → ClarifyShell-C6li72Ce.cjs} +136 -52
- package/output/ClarifyShell-C6li72Ce.cjs.map +1 -0
- package/output/MermaidViewer-B6-BMCJG.cjs +101 -0
- package/output/MermaidViewer-B6-BMCJG.cjs.map +1 -0
- package/output/MermaidViewer-dXsomvM7.js +98 -0
- package/output/MermaidViewer-dXsomvM7.js.map +1 -0
- package/output/{OpenApiOperation-qp5tFaWP.cjs → OpenApiOperation-B52IWlKb.cjs} +405 -243
- package/output/OpenApiOperation-B52IWlKb.cjs.map +1 -0
- package/output/{OpenApiOperation-CyBkzvob.js → OpenApiOperation-DgrqzeiS.js} +377 -228
- package/output/OpenApiOperation-DgrqzeiS.js.map +1 -0
- package/output/{PageActions-GS_cxeJN.cjs → PageActions-BjB6PYmL.cjs} +73 -734
- package/output/PageActions-BjB6PYmL.cjs.map +1 -0
- package/output/{PageActions-Dn8IGWoL.js → PageActions-D7K9LDGf.js} +67 -680
- package/output/PageActions-D7K9LDGf.js.map +1 -0
- package/output/SearchDialog-CIPvXMT3.cjs +414 -0
- package/output/SearchDialog-CIPvXMT3.cjs.map +1 -0
- package/output/SearchDialog-CxYLjRi5.js +411 -0
- package/output/SearchDialog-CxYLjRi5.js.map +1 -0
- package/output/app/AppShell.d.ts +2 -2
- package/output/app/SectionHashSync.d.ts +6 -0
- package/output/client.cjs +3 -3
- package/output/client.js +3 -3
- package/output/components/HighlightedCode.d.ts +7 -0
- package/output/components/MermaidViewer.d.ts +7 -0
- package/output/context.d.ts +1 -1
- package/output/core/context.d.ts +3 -4
- package/output/core/i18n.d.ts +1 -1
- package/output/core/index.d.ts +1 -1
- package/output/core/types.d.ts +36 -19
- package/output/i18n-DnqZHFT7.js +247 -0
- package/output/i18n-DnqZHFT7.js.map +1 -0
- package/output/i18n-b4iTLeia.cjs +294 -0
- package/output/i18n-b4iTLeia.cjs.map +1 -0
- package/output/index.cjs +91 -94
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +7 -7
- package/output/index.js +83 -87
- package/output/index.js.map +1 -1
- package/output/markdown.cjs +2 -1
- package/output/markdown.d.ts +1 -1
- package/output/markdown.js +2 -2
- package/output/mdx/remark.d.ts +1 -0
- package/output/openapi/components/EndpointSections.d.ts +3 -1
- package/output/openapi/components/ExamplePanels.d.ts +5 -2
- package/output/openapi/components/OpenApiOperation.d.ts +3 -1
- package/output/openapi/components/OpenApiOperation.state.d.ts +3 -3
- package/output/openapi/components/SchemaProperties.d.ts +1 -0
- package/output/openapi/components/helpers.d.ts +2 -2
- package/output/openapi/entry.d.ts +0 -1
- package/output/openapi/lib/helpers.d.ts +5 -3
- package/output/openapi/lib/request-code.d.ts +2 -1
- package/output/openapi/lib/spec-path.d.ts +6 -1
- package/output/openapi/lib/utils.d.ts +10 -4
- package/output/preview.cjs +7 -5
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +5 -3
- package/output/preview.js.map +1 -1
- package/output/{remark-Dd2WU50s.js → remark-C9iRQM0R.js} +4 -3
- package/output/remark-C9iRQM0R.js.map +1 -0
- package/output/{remark-zSQT0MBv.cjs → remark-DTLbG8PK.cjs} +9 -2
- package/output/remark-DTLbG8PK.cjs.map +1 -0
- package/output/{render-CV0a-qtD.js → render-DKj24Jqw.js} +15 -8
- package/output/render-DKj24Jqw.js.map +1 -0
- package/output/{render-CCCoUWDP.cjs → render-Di5B6Zc0.cjs} +15 -8
- package/output/render-Di5B6Zc0.cjs.map +1 -0
- package/output/renderer.css +234 -20
- package/output/runtime/ClarifyShell.d.ts +5 -6
- package/output/server.cjs +4 -4
- package/output/server.cjs.map +1 -1
- package/output/server.js +4 -4
- package/output/server.js.map +1 -1
- package/output/shell/Navigation.d.ts +1 -0
- package/output/shell/search/SearchDialog.d.ts +1 -1
- package/output/slots/RuntimeSlot.d.ts +7 -7
- package/output/slots/context.d.ts +5 -5
- package/output/slots/index.d.ts +2 -2
- package/output/slots/types.d.ts +1 -1
- package/output/utils/path.d.ts +1 -1
- package/package.json +3 -1
- package/output/ClarifyShell-CxhXBtsR.js.map +0 -1
- package/output/ClarifyShell-DjLRRW8T.cjs.map +0 -1
- package/output/OpenApiOperation-CyBkzvob.js.map +0 -1
- package/output/OpenApiOperation-qp5tFaWP.cjs.map +0 -1
- package/output/PageActions-Dn8IGWoL.js.map +0 -1
- package/output/PageActions-GS_cxeJN.cjs.map +0 -1
- package/output/remark-Dd2WU50s.js.map +0 -1
- package/output/remark-zSQT0MBv.cjs.map +0 -1
- package/output/render-CCCoUWDP.cjs.map +0 -1
- package/output/render-CV0a-qtD.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
|
|
2
|
-
const
|
|
2
|
+
const require_i18n = require("./i18n-b4iTLeia.cjs");
|
|
3
|
+
const require_PageActions = require("./PageActions-BjB6PYmL.cjs");
|
|
3
4
|
let clsx = require("clsx");
|
|
4
5
|
clsx = require_rolldown_runtime.__toESM(clsx, 1);
|
|
5
6
|
let react = require("react");
|
|
@@ -7,14 +8,14 @@ let react_router_dom = require("react-router-dom");
|
|
|
7
8
|
let lucide_react = require("lucide-react");
|
|
8
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
10
|
//#region source/slots/context.tsx
|
|
10
|
-
var
|
|
11
|
+
var UISlotContextValue = (0, react.createContext)(null);
|
|
11
12
|
/**
|
|
12
|
-
* Provides an isolated {@link
|
|
13
|
+
* Provides an isolated {@link UISlotContext} for a single slot component.
|
|
13
14
|
* `RuntimeSlot` wraps every rendered slot component with this provider.
|
|
14
15
|
*/
|
|
15
16
|
function SlotProvider(arg0) {
|
|
16
17
|
const { value, children } = arg0;
|
|
17
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
18
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UISlotContextValue.Provider, {
|
|
18
19
|
value,
|
|
19
20
|
children
|
|
20
21
|
});
|
|
@@ -27,7 +28,7 @@ function SlotProvider(arg0) {
|
|
|
27
28
|
* not mounted through a Clarify slot.
|
|
28
29
|
*/
|
|
29
30
|
function useSlot() {
|
|
30
|
-
const context = (0, react.useContext)(
|
|
31
|
+
const context = (0, react.useContext)(UISlotContextValue);
|
|
31
32
|
if (!context) throw new Error("[clarify] useSlot must be called inside a slot component");
|
|
32
33
|
return context;
|
|
33
34
|
}
|
|
@@ -38,8 +39,8 @@ var RuntimeSlotsContext = (0, react.createContext)({ slots: {} });
|
|
|
38
39
|
* Makes the compiled slot registry and the current route available to every
|
|
39
40
|
* {@link RuntimeSlot} in the tree. Mounted once near the top of `AppShell`.
|
|
40
41
|
*/
|
|
41
|
-
function RuntimeSlotsProvider(
|
|
42
|
-
const { slots, route, children } =
|
|
42
|
+
function RuntimeSlotsProvider(props) {
|
|
43
|
+
const { slots, route, children } = props;
|
|
43
44
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuntimeSlotsContext.Provider, {
|
|
44
45
|
value: {
|
|
45
46
|
slots: slots ?? {},
|
|
@@ -60,10 +61,10 @@ function RuntimeSlotsProvider(arg0) {
|
|
|
60
61
|
* compatibility with `renderToString`. Otherwise, `React.lazy` + `Suspense`
|
|
61
62
|
* is used for client-side code-splitting.
|
|
62
63
|
*/
|
|
63
|
-
function RuntimeSlot(
|
|
64
|
-
const { name, default: DefaultComponent } =
|
|
64
|
+
function RuntimeSlot(props) {
|
|
65
|
+
const { name, default: DefaultComponent } = props;
|
|
65
66
|
const { slots, route } = (0, react.useContext)(RuntimeSlotsContext);
|
|
66
|
-
const locale =
|
|
67
|
+
const locale = require_i18n.useLocale();
|
|
67
68
|
const entries = slots[name];
|
|
68
69
|
if (!entries || entries.length === 0) return DefaultComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DefaultComponent, {}) : null;
|
|
69
70
|
if (name.endsWith(".replace")) {
|
|
@@ -92,7 +93,7 @@ function RuntimeSlot(arg0) {
|
|
|
92
93
|
function SlotEntryRenderer(props) {
|
|
93
94
|
const { entry } = props;
|
|
94
95
|
if (entry._resolved) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(entry._resolved, {});
|
|
95
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LazySlotComponent, { loader: entry.
|
|
96
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LazySlotComponent, { loader: entry.loadComponent });
|
|
96
97
|
}
|
|
97
98
|
function LazySlotComponent(props) {
|
|
98
99
|
const { loader } = props;
|
|
@@ -124,7 +125,7 @@ var clarify_default = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UT
|
|
|
124
125
|
//#endregion
|
|
125
126
|
//#region source/app/BuiltWithClarify.tsx
|
|
126
127
|
function BuiltWithClarify() {
|
|
127
|
-
const t =
|
|
128
|
+
const t = require_i18n.useBuiltInText();
|
|
128
129
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
129
130
|
href: "https://clarify.pub",
|
|
130
131
|
target: "_blank",
|
|
@@ -149,8 +150,8 @@ function BuiltWithClarify() {
|
|
|
149
150
|
//#region source/app/RenderErrorPanel.tsx
|
|
150
151
|
function RenderErrorPanel(props) {
|
|
151
152
|
const { title, description, eyebrowLabel = "Render error", action, metadata = [], detailsLabel, detailsHeaderAction, detailsContent, titleId = "clarify-render-error-title", refreshLabel, onRefresh } = props;
|
|
152
|
-
const t =
|
|
153
|
-
const config =
|
|
153
|
+
const t = require_i18n.useBuiltInText();
|
|
154
|
+
const config = require_i18n.useConfigOptional();
|
|
154
155
|
const resolvedRefreshLabel = refreshLabel ?? t("renderError.reload");
|
|
155
156
|
const resolvedVersion = config?.version ?? "0.0.0";
|
|
156
157
|
const resolvedMetadata = [...metadata, {
|
|
@@ -245,13 +246,15 @@ function PageErrorPanel(props) {
|
|
|
245
246
|
async function copyStack() {
|
|
246
247
|
if (!await require_PageActions.copyTextToClipboard(stackText)) return;
|
|
247
248
|
setCopiedStack(true);
|
|
248
|
-
|
|
249
|
+
setTimeout(() => setCopiedStack(false), 1600);
|
|
249
250
|
}
|
|
250
251
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RenderErrorPanel, {
|
|
251
252
|
title,
|
|
252
253
|
description,
|
|
253
254
|
refreshLabel: reloadLabel,
|
|
254
|
-
onRefresh: () =>
|
|
255
|
+
onRefresh: () => {
|
|
256
|
+
if (typeof window !== "undefined") window.location.reload();
|
|
257
|
+
},
|
|
255
258
|
metadata: [[pathLabel, path], [typeLabel, error.name]].map(([label, value]) => ({
|
|
256
259
|
label,
|
|
257
260
|
value: String(value)
|
|
@@ -345,7 +348,7 @@ function PageBannerLink(props) {
|
|
|
345
348
|
}
|
|
346
349
|
function PageBanner(props) {
|
|
347
350
|
const { currentLocale, onDismiss } = props;
|
|
348
|
-
const config =
|
|
351
|
+
const config = require_i18n.useConfig();
|
|
349
352
|
const banner = config.banner;
|
|
350
353
|
const content = banner ? require_PageActions.resolveLocalizedText(banner.content, currentLocale, config.i18n?.defaultLocale) : "";
|
|
351
354
|
const storageKey = (0, react.useMemo)(() => {
|
|
@@ -387,7 +390,7 @@ function PageBanner(props) {
|
|
|
387
390
|
className: "clarify-banner-dismiss absolute right-3 inline-flex size-8 items-center justify-center rounded-full text-(--clarify-ui-text-soft) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-ui-text-strong)",
|
|
388
391
|
"aria-label": "Dismiss announcement",
|
|
389
392
|
onClick: () => {
|
|
390
|
-
if (storageKey) window.localStorage.setItem(storageKey, "1");
|
|
393
|
+
if (storageKey && typeof window !== "undefined") window.localStorage.setItem(storageKey, "1");
|
|
391
394
|
setDismissed(true);
|
|
392
395
|
},
|
|
393
396
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
|
|
@@ -435,7 +438,7 @@ function SocialLink(arg0) {
|
|
|
435
438
|
});
|
|
436
439
|
}
|
|
437
440
|
function PageFooter() {
|
|
438
|
-
const config =
|
|
441
|
+
const config = require_i18n.useConfig();
|
|
439
442
|
const locale = localeForPath(config, (0, react_router_dom.useLocation)().pathname);
|
|
440
443
|
const footer = config.footer;
|
|
441
444
|
const links = footer?.links ?? [];
|
|
@@ -473,7 +476,7 @@ function flattenNavigation(nodes) {
|
|
|
473
476
|
}
|
|
474
477
|
function PageNavigation(arg0) {
|
|
475
478
|
const { navigation, currentRoute } = arg0;
|
|
476
|
-
const t =
|
|
479
|
+
const t = require_i18n.useBuiltInText();
|
|
477
480
|
if (!currentRoute) return null;
|
|
478
481
|
const pageRoutes = flattenNavigation(navigation);
|
|
479
482
|
const currentIndex = pageRoutes.findIndex((route) => require_PageActions.isSameRoutePath(route.path, currentRoute.path));
|
|
@@ -495,7 +498,7 @@ function PageNavigation(arg0) {
|
|
|
495
498
|
}
|
|
496
499
|
function PageNavigationLink(arg0) {
|
|
497
500
|
const { direction, route } = arg0;
|
|
498
|
-
const t =
|
|
501
|
+
const t = require_i18n.useBuiltInText();
|
|
499
502
|
if (!route) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "hidden @3xl:block" });
|
|
500
503
|
const isNext = direction === "next";
|
|
501
504
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
|
|
@@ -621,6 +624,71 @@ function PageSkeleton() {
|
|
|
621
624
|
});
|
|
622
625
|
}
|
|
623
626
|
//#endregion
|
|
627
|
+
//#region source/app/SectionHashSync.tsx
|
|
628
|
+
var HASH_UPDATE_DEBOUNCE_MS = 120;
|
|
629
|
+
function replaceHash(sectionId) {
|
|
630
|
+
if (typeof window === "undefined") return;
|
|
631
|
+
const nextHash = sectionId ? `#${encodeURIComponent(sectionId)}` : "";
|
|
632
|
+
if (window.location.hash === nextHash) return;
|
|
633
|
+
window.history.replaceState(window.history.state, "", `${window.location.pathname}${window.location.search}${nextHash}`);
|
|
634
|
+
}
|
|
635
|
+
function useReleaseHashSyncOnManualScroll(hashScrollSuppressedUntilRef) {
|
|
636
|
+
(0, react.useEffect)(() => {
|
|
637
|
+
if (typeof window === "undefined") return;
|
|
638
|
+
const release = () => {
|
|
639
|
+
hashScrollSuppressedUntilRef.current = 0;
|
|
640
|
+
};
|
|
641
|
+
const releaseOnScrollKey = (event) => {
|
|
642
|
+
if ([
|
|
643
|
+
"ArrowDown",
|
|
644
|
+
"ArrowUp",
|
|
645
|
+
"End",
|
|
646
|
+
"Home",
|
|
647
|
+
"PageDown",
|
|
648
|
+
"PageUp",
|
|
649
|
+
" "
|
|
650
|
+
].includes(event.key)) release();
|
|
651
|
+
};
|
|
652
|
+
window.addEventListener("wheel", release, { passive: true });
|
|
653
|
+
window.addEventListener("touchmove", release, { passive: true });
|
|
654
|
+
window.addEventListener("keydown", releaseOnScrollKey);
|
|
655
|
+
return () => {
|
|
656
|
+
window.removeEventListener("wheel", release);
|
|
657
|
+
window.removeEventListener("touchmove", release);
|
|
658
|
+
window.removeEventListener("keydown", releaseOnScrollKey);
|
|
659
|
+
};
|
|
660
|
+
}, [hashScrollSuppressedUntilRef]);
|
|
661
|
+
}
|
|
662
|
+
function SectionHashSync(arg0) {
|
|
663
|
+
const { hashScrollSuppressedUntilRef } = arg0;
|
|
664
|
+
const location = (0, react_router_dom.useLocation)();
|
|
665
|
+
const hashUpdateTimeoutRef = (0, react.useRef)(void 0);
|
|
666
|
+
const sections = require_PageActions.useSectionStore((state) => state.sections);
|
|
667
|
+
const visibleSections = require_PageActions.useSectionStore((state) => state.visibleSections);
|
|
668
|
+
useReleaseHashSyncOnManualScroll(hashScrollSuppressedUntilRef);
|
|
669
|
+
(0, react.useEffect)(() => {
|
|
670
|
+
if (!sections.length || !visibleSections.length) return;
|
|
671
|
+
const visibleSectionId = visibleSections.find((id) => id !== "_top" && sections.some((section) => section.id === id));
|
|
672
|
+
const hashSectionId = location.hash ? safeDecodeURIComponent(location.hash.slice(1)) : void 0;
|
|
673
|
+
if (hashSectionId && Date.now() < hashScrollSuppressedUntilRef.current && !visibleSections.includes(hashSectionId)) return;
|
|
674
|
+
hashUpdateTimeoutRef.current = setTimeout(() => {
|
|
675
|
+
replaceHash(visibleSections[0] === "_top" ? void 0 : visibleSectionId);
|
|
676
|
+
}, HASH_UPDATE_DEBOUNCE_MS);
|
|
677
|
+
return () => {
|
|
678
|
+
if (hashUpdateTimeoutRef.current !== void 0) {
|
|
679
|
+
clearTimeout(hashUpdateTimeoutRef.current);
|
|
680
|
+
hashUpdateTimeoutRef.current = void 0;
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
}, [
|
|
684
|
+
hashScrollSuppressedUntilRef,
|
|
685
|
+
location.hash,
|
|
686
|
+
sections,
|
|
687
|
+
visibleSections
|
|
688
|
+
]);
|
|
689
|
+
return null;
|
|
690
|
+
}
|
|
691
|
+
//#endregion
|
|
624
692
|
//#region source/app/AppShell.tsx
|
|
625
693
|
function BannerSlot(props) {
|
|
626
694
|
const { activeBannerKey, dismissedBannerKey, bannerResolved, onDismiss, config, locale } = props;
|
|
@@ -661,6 +729,7 @@ function resolveRouteComponent(route) {
|
|
|
661
729
|
return route.component;
|
|
662
730
|
}
|
|
663
731
|
function scrollToHash(hash) {
|
|
732
|
+
if (typeof window === "undefined" || typeof document === "undefined") return;
|
|
664
733
|
if (!hash) return;
|
|
665
734
|
const targetId = safeDecodeURIComponent(hash.slice(1));
|
|
666
735
|
const tryScrollToTarget = (attempt = 0) => {
|
|
@@ -698,25 +767,22 @@ function storedLocaleForConfig(config) {
|
|
|
698
767
|
function isDefaultLocale(config, locale) {
|
|
699
768
|
return Boolean(locale && config.i18n?.defaultLocale === locale);
|
|
700
769
|
}
|
|
701
|
-
function
|
|
702
|
-
return
|
|
703
|
-
}
|
|
704
|
-
function hasPath(nodes, pathname) {
|
|
705
|
-
return nodes.some((node) => require_PageActions.isSameRoutePath(node.path, pathname) || hasPath(node.children ?? [], pathname));
|
|
770
|
+
function hasPath(nodes, pathname, locale) {
|
|
771
|
+
return nodes.some((node) => require_PageActions.isSameRoutePath(node.path, pathname, locale) || hasPath(node.children ?? [], pathname, locale));
|
|
706
772
|
}
|
|
707
|
-
function navigationFromTabs(
|
|
773
|
+
function navigationFromTabs(tabs, pathname, locale) {
|
|
708
774
|
return {
|
|
709
|
-
items:
|
|
710
|
-
tabs
|
|
775
|
+
items: tabs.find((tab) => require_PageActions.isSameRoutePath(tab.path, pathname, locale) || hasPath(tab.children, pathname, locale))?.children ?? tabs[0]?.children ?? [],
|
|
776
|
+
tabs
|
|
711
777
|
};
|
|
712
778
|
}
|
|
713
779
|
function navigationForLocale(navigation, locale, pathname) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
780
|
+
switch (navigation.kind) {
|
|
781
|
+
case "flat": return { items: navigation.nodes };
|
|
782
|
+
case "tabbed": return navigationFromTabs(navigation.tabs, pathname, locale);
|
|
783
|
+
case "localized": return { items: locale ? navigation.locales[locale] ?? [] : [] };
|
|
784
|
+
case "localized-tabbed": return locale && navigation.locales[locale] ? navigationFromTabs(navigation.locales[locale].tabs, pathname, locale) : { items: [] };
|
|
785
|
+
}
|
|
720
786
|
}
|
|
721
787
|
function pageTitle(config, route) {
|
|
722
788
|
const routeTitle = route?.title?.trim();
|
|
@@ -769,7 +835,7 @@ function emptySubscribe() {
|
|
|
769
835
|
return () => {};
|
|
770
836
|
}
|
|
771
837
|
function useStoredBannerDismissed(storageKey) {
|
|
772
|
-
return (0, react.useSyncExternalStore)(emptySubscribe, () => Boolean(storageKey && window.localStorage.getItem(storageKey) === "1"), () => true);
|
|
838
|
+
return (0, react.useSyncExternalStore)(emptySubscribe, () => Boolean(storageKey && typeof window !== "undefined" && window.localStorage.getItem(storageKey) === "1"), () => true);
|
|
773
839
|
}
|
|
774
840
|
function useBannerState(config, currentLocale) {
|
|
775
841
|
const banner = config.banner;
|
|
@@ -787,7 +853,7 @@ function useBannerState(config, currentLocale) {
|
|
|
787
853
|
};
|
|
788
854
|
}
|
|
789
855
|
function useAppShellNavigationEffects(arg0) {
|
|
790
|
-
const { config, currentRoute, explicitLocale, location, navigate, pathname, storedLocale } = arg0;
|
|
856
|
+
const { config, currentRoute, explicitLocale, hashScrollSuppressedUntilRef, location, navigate, pathname, storedLocale } = arg0;
|
|
791
857
|
(0, react.useEffect)(() => {
|
|
792
858
|
if (explicitLocale) require_PageActions.storeLocalePreference(explicitLocale);
|
|
793
859
|
}, [explicitLocale]);
|
|
@@ -807,7 +873,9 @@ function useAppShellNavigationEffects(arg0) {
|
|
|
807
873
|
storedLocale
|
|
808
874
|
]);
|
|
809
875
|
(0, react.useEffect)(() => {
|
|
876
|
+
if (typeof window === "undefined") return;
|
|
810
877
|
if (location.hash) {
|
|
878
|
+
hashScrollSuppressedUntilRef.current = Date.now() + 1200;
|
|
811
879
|
scrollToHash(location.hash);
|
|
812
880
|
return;
|
|
813
881
|
}
|
|
@@ -818,7 +886,11 @@ function useAppShellNavigationEffects(arg0) {
|
|
|
818
886
|
window.requestAnimationFrame(() => {
|
|
819
887
|
window.dispatchEvent(new Event("scroll"));
|
|
820
888
|
});
|
|
821
|
-
}, [
|
|
889
|
+
}, [
|
|
890
|
+
hashScrollSuppressedUntilRef,
|
|
891
|
+
location.hash,
|
|
892
|
+
location.pathname
|
|
893
|
+
]);
|
|
822
894
|
}
|
|
823
895
|
function useAppShellDocumentEffects(arg0) {
|
|
824
896
|
const { currentLocale, currentLocaleConfig, config, route } = arg0;
|
|
@@ -864,7 +936,7 @@ function getAppShellLayoutConfig(hasTabs, hasBanner) {
|
|
|
864
936
|
return appShellLayoutConfig[getLayoutVariant(hasTabs, hasBanner)];
|
|
865
937
|
}
|
|
866
938
|
function BuiltInNotFoundPage() {
|
|
867
|
-
const text =
|
|
939
|
+
const text = require_i18n.useBuiltInText();
|
|
868
940
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
869
941
|
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)",
|
|
870
942
|
"aria-labelledby": "clarify-not-found-title",
|
|
@@ -905,8 +977,9 @@ function AppShell(arg0) {
|
|
|
905
977
|
const pathname = require_PageActions.normalizeRoutePath(location.pathname);
|
|
906
978
|
const headerRef = (0, react.useRef)(null);
|
|
907
979
|
const headerTopAreaRef = (0, react.useRef)(null);
|
|
980
|
+
const hashScrollSuppressedUntilRef = (0, react.useRef)(0);
|
|
908
981
|
const { currentRoute, explicitLocale, storedLocale, currentLocale, currentLocaleConfig, notFoundRoute, currentNavigation, sections } = useRouteState(config, routes, navigation, pathname);
|
|
909
|
-
const text =
|
|
982
|
+
const text = require_i18n.useBuiltInText(currentLocale);
|
|
910
983
|
const { activeBannerKey, bannerResolved, dismissedBannerKey, hasBanner, dismissBanner } = useBannerState(config, currentLocale);
|
|
911
984
|
const layoutConfig = getAppShellLayoutConfig(Boolean(currentNavigation.tabs?.length), hasBanner);
|
|
912
985
|
const { renderRoutes, NotFoundRouteComponent } = useRenderedRoutes(routes, notFoundRoute);
|
|
@@ -914,6 +987,7 @@ function AppShell(arg0) {
|
|
|
914
987
|
config,
|
|
915
988
|
currentRoute,
|
|
916
989
|
explicitLocale,
|
|
990
|
+
hashScrollSuppressedUntilRef,
|
|
917
991
|
location,
|
|
918
992
|
navigate,
|
|
919
993
|
pathname,
|
|
@@ -955,7 +1029,10 @@ function AppShell(arg0) {
|
|
|
955
1029
|
className: "clarify-sidebar hidden lg:block lg:self-stretch lg:bg-(--clarify-theme-tokens-colors-background) lg:px-5 xl:px-6",
|
|
956
1030
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
957
1031
|
className: (0, clsx.default)("clarify-sidebar-scroll lg:sticky lg:z-30 lg:overflow-y-auto lg:pb-8", layoutConfig.sidebarScrollClassName),
|
|
958
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.Navigation, {
|
|
1032
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.Navigation, {
|
|
1033
|
+
navigation: currentNavigation.items,
|
|
1034
|
+
currentLocale
|
|
1035
|
+
})
|
|
959
1036
|
})
|
|
960
1037
|
});
|
|
961
1038
|
}
|
|
@@ -1029,7 +1106,7 @@ function AppShell(arg0) {
|
|
|
1029
1106
|
children: [renderSidebar(), renderContent()]
|
|
1030
1107
|
});
|
|
1031
1108
|
}
|
|
1032
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1109
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.LocaleContext.Provider, {
|
|
1033
1110
|
value: currentLocale,
|
|
1034
1111
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RuntimeSlotsProvider, {
|
|
1035
1112
|
slots: runtimeSlots,
|
|
@@ -1037,7 +1114,11 @@ function AppShell(arg0) {
|
|
|
1037
1114
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_PageActions.SectionProvider, {
|
|
1038
1115
|
sections,
|
|
1039
1116
|
headerTopAreaRef,
|
|
1040
|
-
children: [
|
|
1117
|
+
children: [
|
|
1118
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionHashSync, { hashScrollSuppressedUntilRef }),
|
|
1119
|
+
renderHeader(),
|
|
1120
|
+
renderLayout()
|
|
1121
|
+
]
|
|
1041
1122
|
})
|
|
1042
1123
|
})
|
|
1043
1124
|
});
|
|
@@ -2147,10 +2228,10 @@ function useThemeEditorState(arg0) {
|
|
|
2147
2228
|
try {
|
|
2148
2229
|
await navigator.clipboard.writeText(configSource);
|
|
2149
2230
|
setCopyState("copied");
|
|
2150
|
-
|
|
2231
|
+
setTimeout(() => setCopyState("idle"), 1400);
|
|
2151
2232
|
} catch {
|
|
2152
2233
|
setCopyState("failed");
|
|
2153
|
-
|
|
2234
|
+
setTimeout(() => setCopyState("idle"), 1400);
|
|
2154
2235
|
}
|
|
2155
2236
|
}
|
|
2156
2237
|
return {
|
|
@@ -2329,25 +2410,28 @@ function ThemeRoot(props) {
|
|
|
2329
2410
|
//#region source/runtime/ClarifyShell.tsx
|
|
2330
2411
|
/**
|
|
2331
2412
|
* Shared provider chain used by both client-side render and server-side
|
|
2332
|
-
* renderToHTML. Wraps AppShell with ConfigContext →
|
|
2413
|
+
* renderToHTML. Wraps AppShell with ConfigContext → OpenApiSpecsContext →
|
|
2333
2414
|
* ThemeProvider → ThemeRoot.
|
|
2334
2415
|
*
|
|
2335
2416
|
* The outer Router (BrowserRouter / StaticRouter) is left to the caller
|
|
2336
2417
|
* so each entry point can supply the correct router variant.
|
|
2337
2418
|
*/
|
|
2338
2419
|
function ClarifyShell(props) {
|
|
2339
|
-
const { config, routes, navigation,
|
|
2340
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2420
|
+
const { config, routes, navigation, openApiSpecs, runtimeSlots, themeEditor = false } = props;
|
|
2421
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.ConfigContext.Provider, {
|
|
2341
2422
|
value: config,
|
|
2342
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2343
|
-
value:
|
|
2423
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_i18n.OpenApiSpecsContext.Provider, {
|
|
2424
|
+
value: openApiSpecs,
|
|
2344
2425
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.ThemeProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeRoot, {
|
|
2345
2426
|
theme: config.theme,
|
|
2346
2427
|
themeEditor,
|
|
2347
2428
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AppShell, {
|
|
2348
2429
|
config,
|
|
2349
2430
|
routes,
|
|
2350
|
-
navigation: navigation ??
|
|
2431
|
+
navigation: navigation ?? {
|
|
2432
|
+
kind: "flat",
|
|
2433
|
+
nodes: []
|
|
2434
|
+
},
|
|
2351
2435
|
runtimeSlots
|
|
2352
2436
|
})
|
|
2353
2437
|
}) })
|
|
@@ -2452,4 +2536,4 @@ Object.defineProperty(exports, "useSlot", {
|
|
|
2452
2536
|
}
|
|
2453
2537
|
});
|
|
2454
2538
|
|
|
2455
|
-
//# sourceMappingURL=ClarifyShell-
|
|
2539
|
+
//# sourceMappingURL=ClarifyShell-C6li72Ce.cjs.map
|