@clarify-labs/renderer 0.1.0
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/LICENSE +661 -0
- package/output/AppShell-C_bj6ZhV.js +1928 -0
- package/output/AppShell-C_bj6ZhV.js.map +1 -0
- package/output/AppShell-DBgUlirU.cjs +2127 -0
- package/output/AppShell-DBgUlirU.cjs.map +1 -0
- package/output/app/AppShell.d.ts +7 -0
- package/output/client.cjs +3 -0
- package/output/client.d.ts +1 -0
- package/output/client.js +2 -0
- package/output/components/BuiltWithClarify.d.ts +1 -0
- package/output/components/Code.d.ts +18 -0
- package/output/components/Feedback.d.ts +1 -0
- package/output/components/PageFooter.d.ts +1 -0
- package/output/components/SectionProvider.d.ts +25 -0
- package/output/components/SiteLogo.d.ts +6 -0
- package/output/components/ThemeProvider.d.ts +13 -0
- package/output/components/ThemeToggle.d.ts +1 -0
- package/output/components/index.d.ts +82 -0
- package/output/components/patterns.d.ts +9 -0
- package/output/context.d.ts +6 -0
- package/output/index.cjs +870 -0
- package/output/index.cjs.map +1 -0
- package/output/index.d.ts +11 -0
- package/output/index.js +850 -0
- package/output/index.js.map +1 -0
- package/output/mdx/components.d.ts +50 -0
- package/output/mdx/primitives.d.ts +42 -0
- package/output/openapi/index.d.ts +20 -0
- package/output/openapi/utils.d.ts +12 -0
- package/output/render-CLI-MnH_.cjs +60 -0
- package/output/render-CLI-MnH_.cjs.map +1 -0
- package/output/render-Ca4Is683.js +55 -0
- package/output/render-Ca4Is683.js.map +1 -0
- package/output/renderer.css +3986 -0
- package/output/runtime/render.d.ts +2 -0
- package/output/runtime/server.d.ts +7 -0
- package/output/server.cjs +34 -0
- package/output/server.cjs.map +1 -0
- package/output/server.d.ts +1 -0
- package/output/server.js +33 -0
- package/output/server.js.map +1 -0
- package/output/shell/ContentActions.d.ts +7 -0
- package/output/shell/Header.d.ts +8 -0
- package/output/shell/Navigation.d.ts +5 -0
- package/output/shell/Search.d.ts +10 -0
- package/output/shell/index.d.ts +5 -0
- package/output/shell/mobile.d.ts +15 -0
- package/output/types.d.ts +121 -0
- package/output/utils/remToPx.d.ts +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,2127 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __exportAll = (all, no_symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
|
+
key = keys[i];
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
+
get: ((k) => from[k]).bind(null, key),
|
|
22
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
//#endregion
|
|
32
|
+
let framer_motion = require("framer-motion");
|
|
33
|
+
let react = require("react");
|
|
34
|
+
let react_router_dom = require("react-router-dom");
|
|
35
|
+
let zustand = require("zustand");
|
|
36
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
let clsx = require("clsx");
|
|
38
|
+
clsx = __toESM(clsx, 1);
|
|
39
|
+
let _headlessui_react = require("@headlessui/react");
|
|
40
|
+
let lucide_react = require("lucide-react");
|
|
41
|
+
lucide_react = __toESM(lucide_react, 1);
|
|
42
|
+
//#region source/utils/remToPx.ts
|
|
43
|
+
function remToPx(remValue) {
|
|
44
|
+
return remValue * (typeof window === "undefined" ? 16 : Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize));
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region source/components/SectionProvider.tsx
|
|
48
|
+
function createSectionStore(sections) {
|
|
49
|
+
return (0, zustand.createStore)()((set) => ({
|
|
50
|
+
sections,
|
|
51
|
+
visibleSections: [],
|
|
52
|
+
setVisibleSections: (visibleSections) => set((state) => state.visibleSections.join() === visibleSections.join() ? {} : { visibleSections }),
|
|
53
|
+
registerHeading: ({ id, ref, offsetRem }) => set((state) => ({ sections: state.sections.map((section) => section.id === id ? {
|
|
54
|
+
...section,
|
|
55
|
+
headingRef: ref,
|
|
56
|
+
offsetRem
|
|
57
|
+
} : section) }))
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
function useVisibleSections(sectionStore) {
|
|
61
|
+
const setVisibleSections = (0, zustand.useStore)(sectionStore, (state) => state.setVisibleSections);
|
|
62
|
+
const sections = (0, zustand.useStore)(sectionStore, (state) => state.sections);
|
|
63
|
+
(0, react.useEffect)(() => {
|
|
64
|
+
function checkVisibleSections() {
|
|
65
|
+
const { innerHeight, scrollY } = window;
|
|
66
|
+
const newVisibleSections = [];
|
|
67
|
+
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
68
|
+
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
69
|
+
if (!headingRef?.current) continue;
|
|
70
|
+
const offset = remToPx(offsetRem);
|
|
71
|
+
const top = headingRef.current.getBoundingClientRect().top + scrollY;
|
|
72
|
+
if (sectionIndex === 0 && top - offset > scrollY) newVisibleSections.push("_top");
|
|
73
|
+
const nextSection = sections[sectionIndex + 1];
|
|
74
|
+
const bottom = (nextSection?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY - remToPx(nextSection?.offsetRem ?? 0);
|
|
75
|
+
if (top > scrollY && top < scrollY + innerHeight || bottom > scrollY && bottom < scrollY + innerHeight || top <= scrollY && bottom >= scrollY + innerHeight) newVisibleSections.push(id);
|
|
76
|
+
}
|
|
77
|
+
setVisibleSections(newVisibleSections);
|
|
78
|
+
}
|
|
79
|
+
const raf = window.requestAnimationFrame(() => checkVisibleSections());
|
|
80
|
+
window.addEventListener("scroll", checkVisibleSections, { passive: true });
|
|
81
|
+
window.addEventListener("resize", checkVisibleSections);
|
|
82
|
+
return () => {
|
|
83
|
+
window.cancelAnimationFrame(raf);
|
|
84
|
+
window.removeEventListener("scroll", checkVisibleSections);
|
|
85
|
+
window.removeEventListener("resize", checkVisibleSections);
|
|
86
|
+
};
|
|
87
|
+
}, [setVisibleSections, sections]);
|
|
88
|
+
}
|
|
89
|
+
var SectionStoreContext = (0, react.createContext)(null);
|
|
90
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
91
|
+
function SectionProvider(arg0) {
|
|
92
|
+
const { sections, children } = arg0;
|
|
93
|
+
const [sectionStore] = (0, react.useState)(() => createSectionStore(sections));
|
|
94
|
+
useVisibleSections(sectionStore);
|
|
95
|
+
useIsomorphicLayoutEffect(() => {
|
|
96
|
+
sectionStore.setState({ sections });
|
|
97
|
+
}, [sectionStore, sections]);
|
|
98
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionStoreContext.Provider, {
|
|
99
|
+
value: sectionStore,
|
|
100
|
+
children
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function useSectionStore(selector) {
|
|
104
|
+
const store = (0, react.useContext)(SectionStoreContext);
|
|
105
|
+
if (!store) throw new Error("[clarify] useSectionStore must be used within SectionProvider");
|
|
106
|
+
return (0, zustand.useStore)(store, selector);
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region source/components/SiteLogo.tsx
|
|
110
|
+
function SiteLogo(arg0) {
|
|
111
|
+
const { logo, className } = arg0;
|
|
112
|
+
if (!logo) return null;
|
|
113
|
+
if (typeof logo === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
114
|
+
src: logo,
|
|
115
|
+
alt: "",
|
|
116
|
+
className: (0, clsx.default)("clarify-logo", className)
|
|
117
|
+
});
|
|
118
|
+
const lightLogo = logo.light ?? logo.dark;
|
|
119
|
+
const darkLogo = logo.dark ?? logo.light;
|
|
120
|
+
if (!lightLogo || !darkLogo) return null;
|
|
121
|
+
if (lightLogo === darkLogo) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
122
|
+
src: lightLogo,
|
|
123
|
+
alt: "",
|
|
124
|
+
className: (0, clsx.default)("clarify-logo", className)
|
|
125
|
+
});
|
|
126
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
127
|
+
src: lightLogo,
|
|
128
|
+
alt: "",
|
|
129
|
+
className: (0, clsx.default)("clarify-logo clarify-logo-light", className, "dark:hidden")
|
|
130
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
131
|
+
src: darkLogo,
|
|
132
|
+
alt: "",
|
|
133
|
+
className: (0, clsx.default)("clarify-logo clarify-logo-dark", className, "hidden dark:block")
|
|
134
|
+
})] });
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region source/shell/ContentActions.tsx
|
|
138
|
+
function resolveRawContentUrl(rawContentUrl, routePrefix = "/") {
|
|
139
|
+
if (!routePrefix || routePrefix === "/") return rawContentUrl;
|
|
140
|
+
return `/${routePrefix.replace(/^\/+|\/+$/g, "")}${rawContentUrl}`;
|
|
141
|
+
}
|
|
142
|
+
function getAbsoluteUrl(path) {
|
|
143
|
+
if (typeof window === "undefined") return path;
|
|
144
|
+
return new URL(path, window.location.href).href;
|
|
145
|
+
}
|
|
146
|
+
async function copyText(text) {
|
|
147
|
+
await navigator.clipboard.writeText(text);
|
|
148
|
+
}
|
|
149
|
+
function ContentActions(arg0) {
|
|
150
|
+
const { route, routePrefix } = arg0;
|
|
151
|
+
const [copied, setCopied] = (0, react.useState)("idle");
|
|
152
|
+
if (!route?.rawContentUrl) return null;
|
|
153
|
+
const rawContentUrl = resolveRawContentUrl(route.rawContentUrl, routePrefix);
|
|
154
|
+
const isOpenApi = route.kind === "openapi";
|
|
155
|
+
const contentLabel = isOpenApi ? "复制 OpenAPI 内容" : "复制 Markdown 内容";
|
|
156
|
+
const linkLabel = isOpenApi ? "复制 OpenAPI 链接" : "复制 Markdown 链接";
|
|
157
|
+
function markCopied(state) {
|
|
158
|
+
setCopied(state);
|
|
159
|
+
window.setTimeout(() => setCopied("idle"), 1600);
|
|
160
|
+
}
|
|
161
|
+
async function handleCopyContent() {
|
|
162
|
+
await copyText(await (await fetch(rawContentUrl)).text());
|
|
163
|
+
markCopied("content");
|
|
164
|
+
}
|
|
165
|
+
async function handleCopyLink() {
|
|
166
|
+
await copyText(getAbsoluteUrl(rawContentUrl));
|
|
167
|
+
markCopied("link");
|
|
168
|
+
}
|
|
169
|
+
const actions = [{
|
|
170
|
+
key: "content",
|
|
171
|
+
label: contentLabel,
|
|
172
|
+
icon: lucide_react.Copy,
|
|
173
|
+
run: handleCopyContent
|
|
174
|
+
}, {
|
|
175
|
+
key: "link",
|
|
176
|
+
label: linkLabel,
|
|
177
|
+
icon: lucide_react.Link2,
|
|
178
|
+
run: handleCopyLink
|
|
179
|
+
}];
|
|
180
|
+
const primaryAction = actions[0];
|
|
181
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
182
|
+
className: "clarify-content-actions sticky top-16 z-20 flex justify-end py-4",
|
|
183
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Menu, {
|
|
184
|
+
as: "div",
|
|
185
|
+
className: "clarify-content-actions-menu relative inline-flex text-xs font-medium",
|
|
186
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
187
|
+
className: "clarify-content-actions-group inline-flex overflow-hidden rounded-full border border-zinc-900/10 bg-white/85 backdrop-blur dark:border-white/10 dark:bg-white/5",
|
|
188
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
189
|
+
type: "button",
|
|
190
|
+
onClick: primaryAction.run,
|
|
191
|
+
className: "clarify-content-actions-primary inline-flex h-8 items-center gap-1.5 px-3 text-zinc-600 transition hover:bg-zinc-100 hover:text-zinc-950 dark:text-zinc-300 dark:hover:bg-white/10 dark:hover:text-white",
|
|
192
|
+
children: [copied === primaryAction.key ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(primaryAction.icon, { className: "h-3.5 w-3.5" }), copied === primaryAction.key ? "已复制" : "复制页面"]
|
|
193
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuButton, {
|
|
194
|
+
className: "clarify-content-actions-trigger inline-flex h-8 w-8 items-center justify-center border-l border-zinc-900/10 text-zinc-500 transition hover:bg-zinc-100 hover:text-zinc-950 dark:border-white/10 dark:text-zinc-400 dark:hover:bg-white/10 dark:hover:text-white",
|
|
195
|
+
"aria-label": "选择复制选项",
|
|
196
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, { className: "h-3.5 w-3.5" })
|
|
197
|
+
})]
|
|
198
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItems, {
|
|
199
|
+
anchor: "bottom end",
|
|
200
|
+
className: "clarify-content-actions-list z-30 mt-2 w-52 origin-top-right rounded-2xl border border-zinc-900/10 bg-white p-1 text-xs shadow-md transition [--anchor-gap:--spacing(2)] focus:outline-none data-closed:scale-95 data-closed:opacity-0 dark:border-white/10 dark:bg-zinc-900",
|
|
201
|
+
children: actions.map((action) => {
|
|
202
|
+
const Icon = copied === action.key ? lucide_react.Check : action.icon;
|
|
203
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
204
|
+
type: "button",
|
|
205
|
+
onClick: action.run,
|
|
206
|
+
className: "clarify-content-actions-item flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-zinc-600 transition data-focus:bg-zinc-100 data-focus:text-zinc-950 dark:text-zinc-300 dark:data-focus:bg-white/10 dark:data-focus:text-white",
|
|
207
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: copied === action.key ? "已复制" : action.label })]
|
|
208
|
+
}) }, action.key);
|
|
209
|
+
})
|
|
210
|
+
})]
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region source/components/BuiltWithClarify.tsx
|
|
216
|
+
function ClarifyMark(props) {
|
|
217
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
218
|
+
viewBox: "0 0 279 200",
|
|
219
|
+
"aria-hidden": "true",
|
|
220
|
+
...props,
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
223
|
+
d: "M44.867217 0.00543761C130.715579 1.00591567 200 70.9091172 200 156.994562L199.986321 155.127494C199.384888 180.009127 179.026368 199.994562 154 199.994562H46C20.5949015 199.994562 0 179.399661 0 153.994562V45.9945624C0 21.0975659 19.7793434 0.820282524 44.4815926 0.0191499894Z",
|
|
224
|
+
fill: "#00D492"
|
|
225
|
+
}),
|
|
226
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
227
|
+
d: "M123.867217 0.00543761C209.715579 1.00591567 279 70.9091172 279 156.994562L278.986321 155.127494C278.384888 180.009127 258.026368 199.994562 233 199.994562H125C99.5949015 199.994562 79 179.399661 79 153.994562V45.9945624C79 21.0975659 98.7793434 0.820282524 123.481593 0.0191499894Z",
|
|
228
|
+
fill: "#00F6C9",
|
|
229
|
+
fillOpacity: "0.6",
|
|
230
|
+
transform: "rotate(-90 179 100)"
|
|
231
|
+
}),
|
|
232
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
233
|
+
d: "M199.979267 154.416906L199.984438 155.157125L199.962366 155.872459C198.977251 180.406837 178.776104 199.994562 154 199.994562L124.372438 199.994125L124.249053 199.994081C99.6939678 199.603921 79.8122712 179.973634 79.01915 155.518407L79.0054376 155.132783C79.5830823 105.566626 103.129768 61.5221348 139.498462 33.1463428C175.69419 61.3871018 199.186123 105.143863 199.979267 154.416906Z",
|
|
234
|
+
fill: "#00F692"
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
function BuiltWithClarify() {
|
|
240
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
241
|
+
href: "https://clarify.pub",
|
|
242
|
+
target: "_blank",
|
|
243
|
+
rel: "noreferrer",
|
|
244
|
+
"aria-label": "Built with Clarify",
|
|
245
|
+
className: "clarify-built-with inline-flex items-center gap-1.5 rounded-full px-2 py-1 text-xs font-medium text-zinc-500 no-underline transition hover:bg-zinc-900/2.5 hover:text-zinc-900 dark:text-zinc-500 dark:hover:bg-white/5 dark:hover:text-white",
|
|
246
|
+
children: [
|
|
247
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Built with" }),
|
|
248
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClarifyMark, { className: "clarify-built-with-logo h-3.5 w-5 flex-none" }),
|
|
249
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
250
|
+
className: "font-semibold text-zinc-700 dark:text-zinc-300",
|
|
251
|
+
children: "Clarify"
|
|
252
|
+
})
|
|
253
|
+
]
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region source/components/Code.tsx
|
|
258
|
+
var languageNames = {
|
|
259
|
+
js: "JavaScript",
|
|
260
|
+
ts: "TypeScript",
|
|
261
|
+
jsx: "React JSX",
|
|
262
|
+
tsx: "React TSX",
|
|
263
|
+
javascript: "JavaScript",
|
|
264
|
+
typescript: "TypeScript",
|
|
265
|
+
php: "PHP",
|
|
266
|
+
python: "Python",
|
|
267
|
+
ruby: "Ruby",
|
|
268
|
+
go: "Go",
|
|
269
|
+
bash: "Shell",
|
|
270
|
+
sh: "Shell",
|
|
271
|
+
shell: "Shell",
|
|
272
|
+
json: "JSON"
|
|
273
|
+
};
|
|
274
|
+
function getPanelTitle(arg0) {
|
|
275
|
+
const { title, language } = arg0;
|
|
276
|
+
if (title) return title;
|
|
277
|
+
if (language && language in languageNames) return languageNames[language];
|
|
278
|
+
return "Code";
|
|
279
|
+
}
|
|
280
|
+
function getNodeText(node) {
|
|
281
|
+
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
282
|
+
if (Array.isArray(node)) return node.map(getNodeText).join("");
|
|
283
|
+
if ((0, react.isValidElement)(node)) return getNodeText(node.props.children);
|
|
284
|
+
return "";
|
|
285
|
+
}
|
|
286
|
+
function ClipboardIcon(props) {
|
|
287
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
288
|
+
viewBox: "0 0 20 20",
|
|
289
|
+
"aria-hidden": "true",
|
|
290
|
+
...props,
|
|
291
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
292
|
+
strokeWidth: "0",
|
|
293
|
+
d: "M5.5 13.5v-5a2 2 0 0 1 2-2l.447-.894A2 2 0 0 1 9.737 4.5h.527a2 2 0 0 1 1.789 1.106l.447.894a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2Z"
|
|
294
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
295
|
+
fill: "none",
|
|
296
|
+
strokeLinejoin: "round",
|
|
297
|
+
d: "M12.5 6.5a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2m5 0-.447-.894a2 2 0 0 0-1.79-1.106h-.527a2 2 0 0 0-1.789 1.106L7.5 6.5m5 0-1 1h-3l-1-1"
|
|
298
|
+
})]
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function CopyButton(arg0) {
|
|
302
|
+
const { code } = arg0;
|
|
303
|
+
const [copyCount, setCopyCount] = (0, react.useState)(0);
|
|
304
|
+
const copied = copyCount > 0;
|
|
305
|
+
(0, react.useEffect)(() => {
|
|
306
|
+
if (copyCount === 0) return void 0;
|
|
307
|
+
const timeout = window.setTimeout(() => setCopyCount(0), 1e3);
|
|
308
|
+
return () => window.clearTimeout(timeout);
|
|
309
|
+
}, [copyCount]);
|
|
310
|
+
if (!code) return null;
|
|
311
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
312
|
+
type: "button",
|
|
313
|
+
className: (0, clsx.default)("clarify-code-copy group/button absolute top-3.5 right-4 overflow-hidden rounded-full py-1 pr-3 pl-2 text-2xs font-medium opacity-0 backdrop-blur-sm transition group-hover:opacity-100 focus:opacity-100", copied ? "bg-emerald-400/10 ring-1 ring-emerald-400/20 ring-inset" : "bg-white/5 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5"),
|
|
314
|
+
onClick: () => {
|
|
315
|
+
window.navigator.clipboard.writeText(code).then(() => {
|
|
316
|
+
setCopyCount((count) => count + 1);
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
320
|
+
"aria-hidden": copied,
|
|
321
|
+
className: (0, clsx.default)("pointer-events-none flex items-center gap-0.5 text-zinc-400 transition duration-300", copied && "-translate-y-1.5 opacity-0"),
|
|
322
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClipboardIcon, { className: "h-5 w-5 fill-zinc-500/20 stroke-zinc-500 transition-colors group-hover/button:stroke-zinc-400" }), "Copy"]
|
|
323
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
324
|
+
"aria-hidden": !copied,
|
|
325
|
+
className: (0, clsx.default)("pointer-events-none absolute inset-0 flex items-center justify-center text-emerald-400 transition duration-300", !copied && "translate-y-1.5 opacity-0"),
|
|
326
|
+
children: "Copied!"
|
|
327
|
+
})]
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
function CodePanelHeader(arg0) {
|
|
331
|
+
const { tag, label } = arg0;
|
|
332
|
+
if (!tag && !label) return null;
|
|
333
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
334
|
+
className: "clarify-code-panel-header flex h-9 items-center gap-2 border-y border-t-transparent border-b-white/7.5 bg-zinc-900 px-4 dark:border-b-white/5 dark:bg-white/1",
|
|
335
|
+
children: [
|
|
336
|
+
tag ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
337
|
+
className: "font-mono text-[0.625rem]/6 font-semibold text-emerald-400",
|
|
338
|
+
children: tag
|
|
339
|
+
}) : null,
|
|
340
|
+
tag && label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-0.5 w-0.5 rounded-full bg-zinc-500" }) : null,
|
|
341
|
+
label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
342
|
+
className: "font-mono text-xs text-zinc-400",
|
|
343
|
+
children: label
|
|
344
|
+
}) : null
|
|
345
|
+
]
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
function CodePanel(arg0) {
|
|
349
|
+
const { children } = arg0;
|
|
350
|
+
let { tag, label, code } = arg0;
|
|
351
|
+
const child = react.Children.only(children);
|
|
352
|
+
if ((0, react.isValidElement)(child)) {
|
|
353
|
+
const props = child.props;
|
|
354
|
+
tag = props.tag ?? tag;
|
|
355
|
+
label = props.label ?? label;
|
|
356
|
+
code = props.code ?? code ?? getNodeText(props.children);
|
|
357
|
+
}
|
|
358
|
+
const copyText = code ?? getNodeText(children);
|
|
359
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
360
|
+
className: "clarify-code-panel group dark:bg-white/2.5",
|
|
361
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodePanelHeader, {
|
|
362
|
+
tag,
|
|
363
|
+
label
|
|
364
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
365
|
+
className: "relative",
|
|
366
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
367
|
+
className: "clarify-code-pre overflow-x-auto p-4 text-xs text-white",
|
|
368
|
+
children
|
|
369
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyButton, { code: copyText })]
|
|
370
|
+
})]
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
function CodeGroupHeader(arg0) {
|
|
374
|
+
const { title, children, selectedIndex } = arg0;
|
|
375
|
+
const hasTabs = react.Children.count(children) > 1;
|
|
376
|
+
if (!title && !hasTabs) return null;
|
|
377
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
378
|
+
className: "clarify-code-group-header flex min-h-[calc(--spacing(12)+1px)] flex-wrap items-start gap-x-4 border-b border-zinc-700 bg-zinc-800 px-4 dark:border-zinc-800 dark:bg-transparent",
|
|
379
|
+
children: [title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
380
|
+
className: "mr-auto pt-3 text-xs font-semibold text-white",
|
|
381
|
+
children: title
|
|
382
|
+
}) : null, hasTabs ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabList, {
|
|
383
|
+
className: "clarify-code-tabs -mb-px flex gap-4 text-xs font-medium",
|
|
384
|
+
children: react.Children.map(children, (child, childIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Tab, {
|
|
385
|
+
className: (0, clsx.default)("clarify-code-tab border-b py-3 transition data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "border-emerald-500 text-emerald-400" : "border-transparent text-zinc-400 hover:text-zinc-300"),
|
|
386
|
+
children: getPanelTitle((0, react.isValidElement)(child) ? child.props : {})
|
|
387
|
+
}))
|
|
388
|
+
}) : null]
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
function CodeGroupPanels(arg0) {
|
|
392
|
+
const { children, ...props } = arg0;
|
|
393
|
+
if (react.Children.count(children) > 1) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabPanels, { children: react.Children.map(children, (child) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabPanel, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodePanel, {
|
|
394
|
+
...props,
|
|
395
|
+
children: child
|
|
396
|
+
}) })) });
|
|
397
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodePanel, {
|
|
398
|
+
...props,
|
|
399
|
+
children
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
function usePreventLayoutShift() {
|
|
403
|
+
const positionRef = (0, react.useRef)(null);
|
|
404
|
+
const rafRef = (0, react.useRef)(void 0);
|
|
405
|
+
(0, react.useEffect)(() => {
|
|
406
|
+
return () => {
|
|
407
|
+
if (typeof rafRef.current !== "undefined") window.cancelAnimationFrame(rafRef.current);
|
|
408
|
+
};
|
|
409
|
+
}, []);
|
|
410
|
+
return {
|
|
411
|
+
positionRef,
|
|
412
|
+
preventLayoutShift(callback) {
|
|
413
|
+
if (!positionRef.current) return;
|
|
414
|
+
const initialTop = positionRef.current.getBoundingClientRect().top;
|
|
415
|
+
callback();
|
|
416
|
+
rafRef.current = window.requestAnimationFrame(() => {
|
|
417
|
+
const newTop = positionRef.current?.getBoundingClientRect().top ?? initialTop;
|
|
418
|
+
window.scrollBy(0, newTop - initialTop);
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
var usePreferredLanguageStore = (0, zustand.create)()((set) => ({
|
|
424
|
+
preferredLanguages: [],
|
|
425
|
+
addPreferredLanguage: (language) => set((state) => ({ preferredLanguages: [...state.preferredLanguages.filter((preferredLanguage) => preferredLanguage !== language), language] }))
|
|
426
|
+
}));
|
|
427
|
+
function useTabGroupProps(availableLanguages) {
|
|
428
|
+
const { preferredLanguages, addPreferredLanguage } = usePreferredLanguageStore();
|
|
429
|
+
const [selectedIndex, setSelectedIndex] = (0, react.useState)(0);
|
|
430
|
+
const activeLanguage = [...availableLanguages].sort((a, z) => preferredLanguages.indexOf(z) - preferredLanguages.indexOf(a))[0];
|
|
431
|
+
const languageIndex = availableLanguages.indexOf(activeLanguage);
|
|
432
|
+
const newSelectedIndex = languageIndex === -1 ? selectedIndex : languageIndex;
|
|
433
|
+
if (newSelectedIndex !== selectedIndex) setSelectedIndex(newSelectedIndex);
|
|
434
|
+
const { positionRef, preventLayoutShift } = usePreventLayoutShift();
|
|
435
|
+
return {
|
|
436
|
+
as: "div",
|
|
437
|
+
ref: positionRef,
|
|
438
|
+
selectedIndex,
|
|
439
|
+
onChange: (nextSelectedIndex) => {
|
|
440
|
+
preventLayoutShift(() => addPreferredLanguage(availableLanguages[nextSelectedIndex]));
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
var CodeGroupContext = (0, react.createContext)(false);
|
|
445
|
+
function CodeGroup(arg0) {
|
|
446
|
+
const { children, title, ...props } = arg0;
|
|
447
|
+
const tabGroupProps = useTabGroupProps(react.Children.map(children, (child) => getPanelTitle((0, react.isValidElement)(child) ? child.props : {})) ?? []);
|
|
448
|
+
const hasTabs = react.Children.count(children) > 1;
|
|
449
|
+
const containerClassName = "clarify-code-group my-6 overflow-hidden rounded-2xl bg-zinc-900 shadow-md dark:ring-1 dark:ring-white/10";
|
|
450
|
+
const header = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroupHeader, {
|
|
451
|
+
title,
|
|
452
|
+
selectedIndex: tabGroupProps.selectedIndex,
|
|
453
|
+
children
|
|
454
|
+
});
|
|
455
|
+
const panels = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroupPanels, {
|
|
456
|
+
...props,
|
|
457
|
+
children
|
|
458
|
+
});
|
|
459
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroupContext.Provider, {
|
|
460
|
+
value: true,
|
|
461
|
+
children: hasTabs ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabGroup, {
|
|
462
|
+
...tabGroupProps,
|
|
463
|
+
className: containerClassName,
|
|
464
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
465
|
+
className: "not-prose",
|
|
466
|
+
children: [header, panels]
|
|
467
|
+
})
|
|
468
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
469
|
+
className: containerClassName,
|
|
470
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
471
|
+
className: "not-prose",
|
|
472
|
+
children: [header, panels]
|
|
473
|
+
})
|
|
474
|
+
})
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
function Code(arg0) {
|
|
478
|
+
const { children, ...props } = arg0;
|
|
479
|
+
if ((0, react.useContext)(CodeGroupContext) && typeof children === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
480
|
+
...props,
|
|
481
|
+
dangerouslySetInnerHTML: { __html: children }
|
|
482
|
+
});
|
|
483
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
484
|
+
...props,
|
|
485
|
+
children
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
function Pre(arg0) {
|
|
489
|
+
const { children, ...props } = arg0;
|
|
490
|
+
if ((0, react.useContext)(CodeGroupContext)) return children;
|
|
491
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroup, {
|
|
492
|
+
...props,
|
|
493
|
+
children
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region source/components/Feedback.tsx
|
|
498
|
+
function CheckIcon(props) {
|
|
499
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
500
|
+
viewBox: "0 0 20 20",
|
|
501
|
+
"aria-hidden": "true",
|
|
502
|
+
...props,
|
|
503
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
|
|
504
|
+
cx: "10",
|
|
505
|
+
cy: "10",
|
|
506
|
+
r: "10",
|
|
507
|
+
strokeWidth: "0"
|
|
508
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
509
|
+
fill: "none",
|
|
510
|
+
strokeLinecap: "round",
|
|
511
|
+
strokeLinejoin: "round",
|
|
512
|
+
strokeWidth: "1.5",
|
|
513
|
+
d: "m6.75 10.813 2.438 2.437c1.218-4.469 4.062-6.5 4.062-6.5"
|
|
514
|
+
})]
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
function FeedbackButton(props) {
|
|
518
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
519
|
+
type: "submit",
|
|
520
|
+
className: "clarify-feedback-button px-3 text-sm font-medium text-zinc-600 transition hover:bg-zinc-900/2.5 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-white/5 dark:hover:text-white",
|
|
521
|
+
...props
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
var FeedbackForm = (0, react.forwardRef)(function FeedbackForm(arg0, ref) {
|
|
525
|
+
const { onSubmit, className, ...props } = arg0;
|
|
526
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
|
|
527
|
+
...props,
|
|
528
|
+
ref,
|
|
529
|
+
onSubmit,
|
|
530
|
+
className: (0, clsx.default)(className, "clarify-feedback-form absolute inset-0 flex items-center justify-center gap-6 md:justify-start"),
|
|
531
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
532
|
+
className: "text-sm text-zinc-600 dark:text-zinc-400",
|
|
533
|
+
children: "Was this page helpful?"
|
|
534
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
535
|
+
className: "clarify-feedback-actions group grid h-8 grid-cols-[1fr_1px_1fr] overflow-hidden rounded-full border border-zinc-900/10 dark:border-white/10",
|
|
536
|
+
children: [
|
|
537
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FeedbackButton, {
|
|
538
|
+
"data-response": "yes",
|
|
539
|
+
children: "Yes"
|
|
540
|
+
}),
|
|
541
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "bg-zinc-900/10 dark:bg-white/10" }),
|
|
542
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(FeedbackButton, {
|
|
543
|
+
"data-response": "no",
|
|
544
|
+
children: "No"
|
|
545
|
+
})
|
|
546
|
+
]
|
|
547
|
+
})]
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
var FeedbackThanks = (0, react.forwardRef)(function FeedbackThanks(arg0, ref) {
|
|
551
|
+
const { className, ...props } = arg0;
|
|
552
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
553
|
+
...props,
|
|
554
|
+
ref,
|
|
555
|
+
className: (0, clsx.default)(className, "clarify-feedback-thanks absolute inset-0 flex justify-center md:justify-start"),
|
|
556
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
557
|
+
className: "flex items-center gap-3 rounded-full bg-emerald-50/50 py-1 pr-3 pl-1.5 text-sm text-emerald-900 ring-1 ring-emerald-500/20 ring-inset dark:bg-emerald-500/5 dark:text-emerald-200 dark:ring-emerald-500/30",
|
|
558
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CheckIcon, { className: "h-5 w-5 flex-none fill-emerald-500 stroke-white dark:fill-emerald-200/20 dark:stroke-emerald-200" }), "Thanks for your feedback!"]
|
|
559
|
+
})
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
function Feedback() {
|
|
563
|
+
const [submitted, setSubmitted] = (0, react.useState)(false);
|
|
564
|
+
function onSubmit(event) {
|
|
565
|
+
event.preventDefault();
|
|
566
|
+
setSubmitted(true);
|
|
567
|
+
}
|
|
568
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
569
|
+
className: "clarify-feedback relative h-8",
|
|
570
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Transition, {
|
|
571
|
+
show: !submitted,
|
|
572
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FeedbackForm, {
|
|
573
|
+
className: "duration-300 data-closed:opacity-0 data-leave:pointer-events-none",
|
|
574
|
+
onSubmit
|
|
575
|
+
})
|
|
576
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Transition, {
|
|
577
|
+
show: submitted,
|
|
578
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FeedbackThanks, { className: "delay-150 duration-300 data-closed:opacity-0" })
|
|
579
|
+
})]
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region source/components/patterns.tsx
|
|
584
|
+
function GridPattern(arg0) {
|
|
585
|
+
const { width, height, x, y, squares, ...props } = arg0;
|
|
586
|
+
const patternId = (0, react.useId)();
|
|
587
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
588
|
+
"aria-hidden": "true",
|
|
589
|
+
...props,
|
|
590
|
+
children: [
|
|
591
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("defs", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pattern", {
|
|
592
|
+
id: patternId,
|
|
593
|
+
width,
|
|
594
|
+
height,
|
|
595
|
+
patternUnits: "userSpaceOnUse",
|
|
596
|
+
x,
|
|
597
|
+
y,
|
|
598
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
599
|
+
d: `M.5 ${height}V.5H${width}`,
|
|
600
|
+
fill: "none"
|
|
601
|
+
})
|
|
602
|
+
}) }),
|
|
603
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
604
|
+
width: "100%",
|
|
605
|
+
height: "100%",
|
|
606
|
+
strokeWidth: 0,
|
|
607
|
+
fill: `url(#${patternId})`
|
|
608
|
+
}),
|
|
609
|
+
squares ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
610
|
+
x,
|
|
611
|
+
y,
|
|
612
|
+
className: "overflow-visible",
|
|
613
|
+
children: squares.map(([squareX, squareY]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
|
|
614
|
+
width: width + 1,
|
|
615
|
+
height: height + 1,
|
|
616
|
+
x: squareX * width,
|
|
617
|
+
y: squareY * height,
|
|
618
|
+
strokeWidth: "0"
|
|
619
|
+
}, `${squareX}-${squareY}`))
|
|
620
|
+
}) : null
|
|
621
|
+
]
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
function HeroPattern() {
|
|
625
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
626
|
+
className: "absolute inset-0 -z-10 mx-0 max-w-none overflow-hidden",
|
|
627
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
628
|
+
className: "absolute top-0 left-1/2 -ml-152 h-100 w-325 dark:mask-[linear-gradient(white,transparent)]",
|
|
629
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
630
|
+
className: "absolute inset-0 bg-linear-to-r from-[#36b49f] to-[#DBFF75] opacity-40 mask-[radial-gradient(farthest-side_at_top,white,transparent)] dark:from-[#36b49f]/30 dark:to-[#DBFF75]/30 dark:opacity-100",
|
|
631
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GridPattern, {
|
|
632
|
+
width: 72,
|
|
633
|
+
height: 56,
|
|
634
|
+
x: -12,
|
|
635
|
+
y: 4,
|
|
636
|
+
squares: [
|
|
637
|
+
[4, 3],
|
|
638
|
+
[2, 1],
|
|
639
|
+
[7, 3],
|
|
640
|
+
[10, 6]
|
|
641
|
+
],
|
|
642
|
+
className: "absolute inset-x-0 inset-y-[-50%] h-[200%] w-full -skew-y-18 fill-black/40 stroke-black/50 mix-blend-overlay dark:fill-white/2.5 dark:stroke-white/5"
|
|
643
|
+
})
|
|
644
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
645
|
+
viewBox: "0 0 1113 440",
|
|
646
|
+
"aria-hidden": "true",
|
|
647
|
+
className: "absolute top-0 left-1/2 -ml-76 w-278.25 fill-white blur-[26px] dark:hidden",
|
|
648
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M.016 439.5s-9.5-300 434-300S882.516 20 882.516 20V0h230.004v439.5H.016Z" })
|
|
649
|
+
})]
|
|
650
|
+
})
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region source/context.tsx
|
|
655
|
+
var ClarifyConfigContext = (0, react.createContext)(null);
|
|
656
|
+
var OpenApisContext = (0, react.createContext)({});
|
|
657
|
+
function useClarifyConfig() {
|
|
658
|
+
const config = (0, react.useContext)(ClarifyConfigContext);
|
|
659
|
+
if (!config) throw new Error("[clarify] useClarifyConfig must be used within a ClarifyConfigContext.Provider");
|
|
660
|
+
return config;
|
|
661
|
+
}
|
|
662
|
+
function useOpenApis() {
|
|
663
|
+
return (0, react.useContext)(OpenApisContext);
|
|
664
|
+
}
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region source/components/PageFooter.tsx
|
|
667
|
+
function resolveLocalizedText$1(text, locale, fallbackLocale) {
|
|
668
|
+
if (typeof text === "string") return text;
|
|
669
|
+
return (locale ? text[locale] : void 0) ?? (fallbackLocale ? text[fallbackLocale] : void 0) ?? Object.values(text)[0] ?? "";
|
|
670
|
+
}
|
|
671
|
+
function isExternalHref$1(href) {
|
|
672
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
673
|
+
}
|
|
674
|
+
function localeForPath$1(config, pathname) {
|
|
675
|
+
const i18n = config.i18n;
|
|
676
|
+
if (!i18n) return void 0;
|
|
677
|
+
const firstSegment = pathname.split("/").filter(Boolean)[0];
|
|
678
|
+
return i18n.locales.find((locale) => locale.code === firstSegment)?.code ?? i18n.defaultLocale;
|
|
679
|
+
}
|
|
680
|
+
function localizeHref$1(href, config, locale) {
|
|
681
|
+
if (!locale || !config.i18n || isExternalHref$1(href) || href.startsWith("#")) return href;
|
|
682
|
+
if (locale === config.i18n.defaultLocale) return href;
|
|
683
|
+
const cleanHref = href === "/" ? "" : href.replace(/^\/+/, "");
|
|
684
|
+
return `/${locale}${cleanHref ? `/${cleanHref}` : ""}`;
|
|
685
|
+
}
|
|
686
|
+
function FooterLink(arg0) {
|
|
687
|
+
const { link, locale, config } = arg0;
|
|
688
|
+
const external = link.external ?? isExternalHref$1(link.href);
|
|
689
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
690
|
+
href: external ? link.href : localizeHref$1(link.href, config, locale),
|
|
691
|
+
target: external ? "_blank" : void 0,
|
|
692
|
+
rel: external ? "noreferrer" : void 0,
|
|
693
|
+
className: "clarify-footer-link text-sm text-zinc-500 no-underline transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white",
|
|
694
|
+
children: resolveLocalizedText$1(link.label, locale, config.i18n?.defaultLocale)
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
function SocialLink(arg0) {
|
|
698
|
+
const { name, href } = arg0;
|
|
699
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
700
|
+
href,
|
|
701
|
+
target: "_blank",
|
|
702
|
+
rel: "noreferrer",
|
|
703
|
+
className: "clarify-footer-social text-sm capitalize text-zinc-500 no-underline transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white",
|
|
704
|
+
children: name
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
function PageFooter() {
|
|
708
|
+
const config = useClarifyConfig();
|
|
709
|
+
const locale = localeForPath$1(config, (0, react_router_dom.useLocation)().pathname);
|
|
710
|
+
const footer = config.footer;
|
|
711
|
+
const links = footer?.links ?? [];
|
|
712
|
+
const socials = Object.entries(footer?.socials ?? {});
|
|
713
|
+
const copyright = footer?.copyright ? resolveLocalizedText$1(footer.copyright, locale, config.i18n?.defaultLocale) : void 0;
|
|
714
|
+
const hasCustomFooter = Boolean(copyright || links.length > 0 || socials.length > 0);
|
|
715
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("footer", {
|
|
716
|
+
className: (0, clsx.default)("clarify-page-footer mx-auto mt-16 flex w-full max-w-3xl flex-col items-end gap-4 border-t border-zinc-900/10 pt-8 xl:max-w-[56rem] 2xl:max-w-[64rem] dark:border-white/10", hasCustomFooter && "sm:flex-row sm:items-center sm:justify-between"),
|
|
717
|
+
children: [hasCustomFooter ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
718
|
+
className: "clarify-footer-content flex flex-col gap-3 text-right sm:text-left",
|
|
719
|
+
children: [copyright ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
720
|
+
className: "clarify-footer-copyright m-0 text-sm text-zinc-500 dark:text-zinc-400",
|
|
721
|
+
children: copyright
|
|
722
|
+
}) : null, links.length > 0 || socials.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
723
|
+
className: "clarify-footer-links flex flex-wrap justify-end gap-x-4 gap-y-2 sm:justify-start",
|
|
724
|
+
children: [links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FooterLink, {
|
|
725
|
+
link,
|
|
726
|
+
locale,
|
|
727
|
+
config
|
|
728
|
+
}, `${link.href}-${resolveLocalizedText$1(link.label, locale, config.i18n?.defaultLocale)}`)), socials.map(([name, href]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SocialLink, {
|
|
729
|
+
name,
|
|
730
|
+
href
|
|
731
|
+
}, name))]
|
|
732
|
+
}) : null]
|
|
733
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
734
|
+
className: "clarify-footer-brand flex justify-end",
|
|
735
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BuiltWithClarify, {})
|
|
736
|
+
})]
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region source/components/ThemeProvider.tsx
|
|
741
|
+
var ThemeContext = (0, react.createContext)(null);
|
|
742
|
+
var storageKey = "clarify:theme";
|
|
743
|
+
function getSystemTheme() {
|
|
744
|
+
if (typeof window === "undefined") return "light";
|
|
745
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
746
|
+
}
|
|
747
|
+
function getStoredTheme() {
|
|
748
|
+
if (typeof window === "undefined") return "system";
|
|
749
|
+
const storedTheme = window.localStorage.getItem(storageKey);
|
|
750
|
+
return storedTheme === "light" || storedTheme === "dark" || storedTheme === "system" ? storedTheme : "system";
|
|
751
|
+
}
|
|
752
|
+
function applyTheme(resolvedTheme) {
|
|
753
|
+
if (typeof document === "undefined") return;
|
|
754
|
+
document.documentElement.classList.toggle("dark", resolvedTheme === "dark");
|
|
755
|
+
document.documentElement.style.colorScheme = resolvedTheme;
|
|
756
|
+
}
|
|
757
|
+
function ThemeProvider(arg0) {
|
|
758
|
+
const { children } = arg0;
|
|
759
|
+
const [theme, setThemeState] = (0, react.useState)(() => getStoredTheme());
|
|
760
|
+
const [systemTheme, setSystemTheme] = (0, react.useState)(() => getSystemTheme());
|
|
761
|
+
const resolvedTheme = theme === "system" ? systemTheme : theme;
|
|
762
|
+
(0, react.useEffect)(() => {
|
|
763
|
+
applyTheme(resolvedTheme);
|
|
764
|
+
}, [resolvedTheme]);
|
|
765
|
+
(0, react.useEffect)(() => {
|
|
766
|
+
if (typeof window === "undefined") return;
|
|
767
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
768
|
+
function updateSystemTheme() {
|
|
769
|
+
setSystemTheme(mediaQuery.matches ? "dark" : "light");
|
|
770
|
+
}
|
|
771
|
+
updateSystemTheme();
|
|
772
|
+
mediaQuery.addEventListener("change", updateSystemTheme);
|
|
773
|
+
return () => mediaQuery.removeEventListener("change", updateSystemTheme);
|
|
774
|
+
}, []);
|
|
775
|
+
const value = (0, react.useMemo)(() => ({
|
|
776
|
+
theme,
|
|
777
|
+
resolvedTheme,
|
|
778
|
+
setTheme(nextTheme) {
|
|
779
|
+
setThemeState(nextTheme);
|
|
780
|
+
if (typeof window !== "undefined") window.localStorage.setItem(storageKey, nextTheme);
|
|
781
|
+
}
|
|
782
|
+
}), [resolvedTheme, theme]);
|
|
783
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeContext.Provider, {
|
|
784
|
+
value,
|
|
785
|
+
children
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
function useTheme() {
|
|
789
|
+
const context = (0, react.useContext)(ThemeContext);
|
|
790
|
+
if (!context) throw new Error("[clarify] useTheme must be used within ThemeProvider");
|
|
791
|
+
return context;
|
|
792
|
+
}
|
|
793
|
+
//#endregion
|
|
794
|
+
//#region source/components/ThemeToggle.tsx
|
|
795
|
+
function SunIcon(props) {
|
|
796
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
797
|
+
viewBox: "0 0 20 20",
|
|
798
|
+
fill: "none",
|
|
799
|
+
"aria-hidden": "true",
|
|
800
|
+
...props,
|
|
801
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12.5 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
802
|
+
strokeLinecap: "round",
|
|
803
|
+
d: "M10 5.5v-1M13.182 6.818l.707-.707M14.5 10h1M13.182 13.182l.707.707M10 15.5v-1M6.11 13.889l.708-.707M4.5 10h1M6.11 6.111l.708.707"
|
|
804
|
+
})]
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
function MoonIcon(props) {
|
|
808
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
809
|
+
viewBox: "0 0 20 20",
|
|
810
|
+
fill: "none",
|
|
811
|
+
"aria-hidden": "true",
|
|
812
|
+
...props,
|
|
813
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M15.224 11.724a5.5 5.5 0 0 1-6.949-6.949 5.5 5.5 0 1 0 6.949 6.949Z" })
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
function ThemeToggle() {
|
|
817
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
818
|
+
const otherTheme = resolvedTheme === "dark" ? "light" : "dark";
|
|
819
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
820
|
+
type: "button",
|
|
821
|
+
className: "clarify-theme-toggle flex size-6 items-center justify-center rounded-md transition hover:bg-zinc-900/5 dark:hover:bg-white/5",
|
|
822
|
+
"aria-label": `Switch to ${otherTheme} theme`,
|
|
823
|
+
onClick: () => setTheme(otherTheme),
|
|
824
|
+
children: [
|
|
825
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "absolute size-12 pointer-fine:hidden" }),
|
|
826
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SunIcon, { className: "h-5 w-5 stroke-zinc-900 dark:hidden" }),
|
|
827
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MoonIcon, { className: "hidden h-5 w-5 stroke-white dark:block" })
|
|
828
|
+
]
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region source/components/index.tsx
|
|
833
|
+
function ArrowIcon(props) {
|
|
834
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
835
|
+
viewBox: "0 0 20 20",
|
|
836
|
+
fill: "none",
|
|
837
|
+
"aria-hidden": "true",
|
|
838
|
+
...props,
|
|
839
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
840
|
+
stroke: "currentColor",
|
|
841
|
+
strokeLinecap: "round",
|
|
842
|
+
strokeLinejoin: "round",
|
|
843
|
+
d: "m11.5 6.5 3 3.5m0 0-3 3.5m3-3.5h-9"
|
|
844
|
+
})
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
var buttonVariantStyles = {
|
|
848
|
+
primary: "rounded-full bg-zinc-900 px-3 py-1 text-white hover:bg-zinc-700 dark:bg-emerald-400/10 dark:text-emerald-400 dark:ring-1 dark:ring-inset dark:ring-emerald-400/20 dark:hover:text-emerald-300 dark:hover:ring-emerald-300",
|
|
849
|
+
secondary: "rounded-full bg-zinc-100 px-3 py-1 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800/40 dark:text-zinc-400 dark:ring-1 dark:ring-inset dark:ring-zinc-800 dark:hover:bg-zinc-800 dark:hover:text-zinc-300",
|
|
850
|
+
filled: "rounded-full bg-zinc-900 px-3 py-1 text-white hover:bg-zinc-700 dark:bg-emerald-500 dark:hover:bg-emerald-400",
|
|
851
|
+
outline: "rounded-full px-3 py-1 text-zinc-700 ring-1 ring-inset ring-zinc-900/10 hover:bg-zinc-900/2.5 hover:text-zinc-900 dark:text-zinc-400 dark:ring-white/10 dark:hover:bg-white/5 dark:hover:text-white",
|
|
852
|
+
text: "text-emerald-500 hover:text-emerald-600 dark:text-emerald-400 dark:hover:text-emerald-500"
|
|
853
|
+
};
|
|
854
|
+
function Button(arg0) {
|
|
855
|
+
const { variant = "primary", className, children, arrow, ...props } = arg0;
|
|
856
|
+
const classes = (0, clsx.default)("clarify-button inline-flex justify-center gap-0.5 overflow-hidden text-sm font-medium transition", buttonVariantStyles[variant], className);
|
|
857
|
+
const arrowIcon = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ArrowIcon, { className: (0, clsx.default)("mt-0.5 h-5 w-5", variant === "text" && "relative top-px", arrow === "left" && "-ml-1 rotate-180", arrow === "right" && "-mr-1") });
|
|
858
|
+
const inner = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
859
|
+
arrow === "left" ? arrowIcon : null,
|
|
860
|
+
children,
|
|
861
|
+
arrow === "right" ? arrowIcon : null
|
|
862
|
+
] });
|
|
863
|
+
if (typeof props.href === "undefined") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
864
|
+
className: classes,
|
|
865
|
+
...props,
|
|
866
|
+
children: inner
|
|
867
|
+
});
|
|
868
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
869
|
+
className: classes,
|
|
870
|
+
...props,
|
|
871
|
+
children: inner
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
var tagVariantStyles = {
|
|
875
|
+
small: "",
|
|
876
|
+
medium: "rounded-lg px-1.5 ring-1 ring-inset"
|
|
877
|
+
};
|
|
878
|
+
var tagColorStyles = {
|
|
879
|
+
emerald: {
|
|
880
|
+
small: "text-emerald-500 dark:text-emerald-400",
|
|
881
|
+
medium: "bg-emerald-400/10 text-emerald-500 ring-emerald-300 dark:text-emerald-400 dark:ring-emerald-400/30"
|
|
882
|
+
},
|
|
883
|
+
sky: {
|
|
884
|
+
small: "text-sky-500 dark:text-sky-400",
|
|
885
|
+
medium: "bg-sky-400/10 text-sky-500 ring-sky-300 dark:text-sky-400 dark:ring-sky-400/30"
|
|
886
|
+
},
|
|
887
|
+
amber: {
|
|
888
|
+
small: "text-amber-500 dark:text-amber-400",
|
|
889
|
+
medium: "bg-amber-400/10 text-amber-500 ring-amber-300 dark:text-amber-400 dark:ring-amber-400/30"
|
|
890
|
+
},
|
|
891
|
+
rose: {
|
|
892
|
+
small: "text-red-500 dark:text-rose-500",
|
|
893
|
+
medium: "bg-rose-50 text-red-500 ring-rose-200 dark:bg-rose-400/10 dark:text-rose-400 dark:ring-rose-500/20"
|
|
894
|
+
},
|
|
895
|
+
zinc: {
|
|
896
|
+
small: "text-zinc-400 dark:text-zinc-500",
|
|
897
|
+
medium: "bg-zinc-50 text-zinc-500 ring-zinc-200 dark:bg-zinc-400/10 dark:text-zinc-400 dark:ring-zinc-500/20"
|
|
898
|
+
}
|
|
899
|
+
};
|
|
900
|
+
var tagValueColorMap = {
|
|
901
|
+
GET: "emerald",
|
|
902
|
+
POST: "sky",
|
|
903
|
+
PUT: "amber",
|
|
904
|
+
PATCH: "amber",
|
|
905
|
+
DELETE: "rose"
|
|
906
|
+
};
|
|
907
|
+
function Tag(arg0) {
|
|
908
|
+
const { children, variant = "medium", color } = arg0;
|
|
909
|
+
const value = typeof children === "string" ? children.toUpperCase() : "";
|
|
910
|
+
const resolvedColor = color ?? tagValueColorMap[value] ?? "emerald";
|
|
911
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
912
|
+
className: (0, clsx.default)("clarify-tag font-mono text-[0.625rem]/6 font-semibold", tagVariantStyles[variant], tagColorStyles[resolvedColor][variant]),
|
|
913
|
+
children
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
function Logo(props) {
|
|
917
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
918
|
+
viewBox: "0 0 99 24",
|
|
919
|
+
"aria-hidden": "true",
|
|
920
|
+
...props,
|
|
921
|
+
className: (0, clsx.default)("clarify-logo", props.className),
|
|
922
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
923
|
+
className: "fill-emerald-400",
|
|
924
|
+
d: "M16 8a5 5 0 0 0-5-5H5a5 5 0 0 0-5 5v13.927a1 1 0 0 0 1.623.782l3.684-2.93a4 4 0 0 1 2.49-.87H11a5 5 0 0 0 5-5V8Z"
|
|
925
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
926
|
+
className: "fill-zinc-900 dark:fill-white",
|
|
927
|
+
d: "M26.538 18h2.654v-3.999h2.576c2.672 0 4.456-1.723 4.456-4.333V9.65c0-2.61-1.784-4.333-4.456-4.333h-5.23V18Zm4.58-10.582c1.52 0 2.416.8 2.416 2.241v.018c0 1.441-.896 2.25-2.417 2.25h-1.925V7.418h1.925ZM38.051 18h2.566v-5.414c0-1.371.923-2.206 2.382-2.206.396 0 .791.061 1.178.15V8.287a3.843 3.843 0 0 0-.958-.123c-1.257 0-2.136.615-2.443 1.661h-.159V8.323h-2.566V18Zm11.55.202c2.979 0 4.772-1.88 4.772-5.036v-.018c0-3.128-1.82-5.036-4.773-5.036-2.953 0-4.772 1.916-4.772 5.036v.018c0 3.146 1.793 5.036 4.772 5.036Zm0-2.013c-1.372 0-2.145-1.116-2.145-3.023v-.018c0-1.89.782-3.023 2.144-3.023 1.354 0 2.145 1.134 2.145 3.023v.018c0 1.907-.782 3.023-2.145 3.023Zm10.52 1.846c.492 0 .967-.053 1.283-.114v-1.907a6.057 6.057 0 0 1-.755.044c-.87 0-1.24-.387-1.24-1.257v-4.544h1.995V8.323H59.41V6.012h-2.592v2.311h-1.495v1.934h1.495v5.133c0 1.88.949 2.645 3.304 2.645Zm7.287.167c2.98 0 4.772-1.88 4.772-5.036v-.018c0-3.128-1.82-5.036-4.772-5.036-2.954 0-4.773 1.916-4.773 5.036v.018c0 3.146 1.793 5.036 4.773 5.036Zm0-2.013c-1.372 0-2.145-1.116-2.145-3.023v-.018c0-1.89.782-3.023 2.145-3.023 1.353 0 2.144 1.134 2.144 3.023v.018c0 1.907-.782 3.023-2.144 3.023Zm10.767 2.013c2.522 0 4.034-1.353 4.297-3.463l.01-.053h-2.374l-.017.036c-.229.966-.853 1.467-1.908 1.467-1.37 0-2.135-1.08-2.135-3.04v-.018c0-1.934.755-3.006 2.135-3.006 1.099 0 1.74.615 1.908 1.556l.008.017h2.391v-.026c-.228-2.162-1.749-3.56-4.315-3.56-3.033 0-4.738 1.837-4.738 5.019v.017c0 3.217 1.714 5.054 4.738 5.054Zm10.257 0c2.98 0 4.772-1.88 4.772-5.036v-.018c0-3.128-1.82-5.036-4.772-5.036-2.953 0-4.773 1.916-4.773 5.036v.018c0 3.146 1.793 5.036 4.773 5.036Zm0-2.013c-1.371 0-2.145-1.116-2.145-3.023v-.018c0-1.89.782-3.023 2.145-3.023 1.353 0 2.144 1.134 2.144 3.023v.018c0 1.907-.782 3.023-2.144 3.023ZM95.025 18h2.566V4.623h-2.566V18Z"
|
|
928
|
+
})]
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
function Prose(arg0) {
|
|
932
|
+
const { as, className, ...props } = arg0;
|
|
933
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(as ?? "div", {
|
|
934
|
+
className: (0, clsx.default)(className, "clarify-prose prose dark:prose-invert", "[html_:where(&>*)]:mx-auto [html_:where(&>*)]:w-full [html_:where(&>*)]:max-w-3xl xl:[html_:where(&>*)]:max-w-[56rem] 2xl:[html_:where(&>*)]:max-w-[64rem] [html_:where(&>.not-prose)]:max-w-5xl 2xl:[html_:where(&>.not-prose)]:max-w-[76rem]"),
|
|
935
|
+
...props
|
|
936
|
+
});
|
|
937
|
+
}
|
|
938
|
+
function AnchorIcon(props) {
|
|
939
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
940
|
+
viewBox: "0 0 20 20",
|
|
941
|
+
fill: "none",
|
|
942
|
+
strokeLinecap: "round",
|
|
943
|
+
"aria-hidden": "true",
|
|
944
|
+
...props,
|
|
945
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6.5 11.5-.964-.964a3.535 3.535 0 1 1 5-5l.964.964m2 2 .964.964a3.536 3.536 0 0 1-5 5L8.5 13.5m0-5 3 3" })
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
function Eyebrow(arg0) {
|
|
949
|
+
const { tag, label } = arg0;
|
|
950
|
+
if (!tag && !label) return null;
|
|
951
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
952
|
+
className: "flex items-center gap-x-3",
|
|
953
|
+
children: [
|
|
954
|
+
tag ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, { children: tag }) : null,
|
|
955
|
+
tag && label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-0.5 w-0.5 rounded-full bg-zinc-300 dark:bg-zinc-600" }) : null,
|
|
956
|
+
label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
957
|
+
className: "font-mono text-xs text-zinc-400",
|
|
958
|
+
children: label
|
|
959
|
+
}) : null
|
|
960
|
+
]
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
function Anchor(arg0) {
|
|
964
|
+
const { id, inView, children } = arg0;
|
|
965
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
966
|
+
href: `#${id}`,
|
|
967
|
+
className: "clarify-anchor group text-inherit no-underline hover:text-inherit",
|
|
968
|
+
children: [inView ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
969
|
+
className: "absolute mt-1 -ml-(--width) hidden w-(--width) opacity-0 transition [--width:calc(2.625rem+0.5px+50%-min(50%,calc(var(--container-lg)+(--spacing(8)))))] group-hover:opacity-100 group-focus:opacity-100 md:block lg:z-50 2xl:[--width:--spacing(10)]",
|
|
970
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
971
|
+
className: "group/anchor block h-5 w-5 rounded-lg bg-zinc-50 ring-1 ring-inset ring-zinc-300 transition hover:ring-zinc-500 dark:bg-zinc-800 dark:ring-zinc-700 dark:hover:bg-zinc-700 dark:hover:ring-zinc-600",
|
|
972
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnchorIcon, { className: "h-5 w-5 stroke-zinc-500 transition dark:stroke-zinc-400 dark:group-hover/anchor:stroke-white" })
|
|
973
|
+
})
|
|
974
|
+
}) : null, children]
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
function Heading(arg0) {
|
|
978
|
+
const { children, tag, label, level, anchor = true, ...props } = arg0;
|
|
979
|
+
const resolvedLevel = level ?? 2;
|
|
980
|
+
const Component = `h${resolvedLevel}`;
|
|
981
|
+
const ref = (0, react.useRef)(null);
|
|
982
|
+
const registerHeading = useSectionStore((state) => state.registerHeading);
|
|
983
|
+
const inView = (0, framer_motion.useInView)(ref, {
|
|
984
|
+
margin: `${remToPx(-3.5)}px 0px 0px 0px`,
|
|
985
|
+
amount: "all"
|
|
986
|
+
});
|
|
987
|
+
(0, react.useEffect)(() => {
|
|
988
|
+
if (resolvedLevel === 2) registerHeading({
|
|
989
|
+
id: props.id,
|
|
990
|
+
ref,
|
|
991
|
+
offsetRem: tag || label ? 8 : 6
|
|
992
|
+
});
|
|
993
|
+
}, [
|
|
994
|
+
label,
|
|
995
|
+
props.id,
|
|
996
|
+
registerHeading,
|
|
997
|
+
resolvedLevel,
|
|
998
|
+
tag
|
|
999
|
+
]);
|
|
1000
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Eyebrow, {
|
|
1001
|
+
tag,
|
|
1002
|
+
label
|
|
1003
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
1004
|
+
ref,
|
|
1005
|
+
className: (0, clsx.default)("clarify-heading", tag || label ? "mt-2 scroll-mt-32" : "scroll-mt-24"),
|
|
1006
|
+
...props,
|
|
1007
|
+
children: anchor ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Anchor, {
|
|
1008
|
+
id: props.id,
|
|
1009
|
+
inView,
|
|
1010
|
+
children
|
|
1011
|
+
}) : children
|
|
1012
|
+
})] });
|
|
1013
|
+
}
|
|
1014
|
+
function DocShell(arg0) {
|
|
1015
|
+
const { title, subtitle, children } = arg0;
|
|
1016
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("main", {
|
|
1017
|
+
className: "clarify-doc-shell min-h-screen bg-white px-6 py-10 text-zinc-900 dark:bg-zinc-950 dark:text-white md:px-10",
|
|
1018
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1019
|
+
className: "mx-auto max-w-6xl",
|
|
1020
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
|
|
1021
|
+
className: "mb-10",
|
|
1022
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
1023
|
+
className: "text-3xl font-bold tracking-tight md:text-5xl",
|
|
1024
|
+
children: title
|
|
1025
|
+
}), subtitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1026
|
+
className: "mt-3 max-w-2xl text-zinc-600 dark:text-zinc-400",
|
|
1027
|
+
children: subtitle
|
|
1028
|
+
}) : null]
|
|
1029
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Prose, { children })]
|
|
1030
|
+
})
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
function ApiEndpointCard(arg0) {
|
|
1034
|
+
const { method, path, description, id } = arg0;
|
|
1035
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
|
|
1036
|
+
id,
|
|
1037
|
+
className: "clarify-api-endpoint-card scroll-mt-20 rounded-2xl border border-zinc-900/10 bg-white p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900",
|
|
1038
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1039
|
+
className: "flex items-center gap-3",
|
|
1040
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, { children: method }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
1041
|
+
className: "text-sm font-medium text-zinc-800 dark:text-zinc-200",
|
|
1042
|
+
children: path
|
|
1043
|
+
})]
|
|
1044
|
+
}), description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1045
|
+
className: "mt-3 text-sm text-zinc-600 dark:text-zinc-400",
|
|
1046
|
+
children: description
|
|
1047
|
+
}) : null]
|
|
1048
|
+
});
|
|
1049
|
+
}
|
|
1050
|
+
//#endregion
|
|
1051
|
+
//#region source/shell/Navigation.tsx
|
|
1052
|
+
function NavigationIcon(arg0) {
|
|
1053
|
+
const { name, className } = arg0;
|
|
1054
|
+
if (!name) return null;
|
|
1055
|
+
const Icon = lucide_react[name];
|
|
1056
|
+
if (!Icon) return null;
|
|
1057
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
1058
|
+
className: (0, clsx.default)("shrink-0 stroke-current", className),
|
|
1059
|
+
"aria-hidden": "true"
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
function useInitialValue(value, condition = true) {
|
|
1063
|
+
const [initialValue] = (0, react.useState)(value);
|
|
1064
|
+
return condition ? initialValue : value;
|
|
1065
|
+
}
|
|
1066
|
+
function normalizePath(path) {
|
|
1067
|
+
return path === "" ? "/" : path;
|
|
1068
|
+
}
|
|
1069
|
+
function navigationToGroups(navigation) {
|
|
1070
|
+
return navigation.map((node) => {
|
|
1071
|
+
const children = node.children?.length ? node.children : [node];
|
|
1072
|
+
return {
|
|
1073
|
+
title: node.children?.length ? node.title : "Documentation",
|
|
1074
|
+
icon: node.icon,
|
|
1075
|
+
links: children.map((child) => ({
|
|
1076
|
+
title: child.title,
|
|
1077
|
+
href: normalizePath(child.path),
|
|
1078
|
+
icon: child.icon
|
|
1079
|
+
}))
|
|
1080
|
+
};
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
function TopLevelNavItem$1(arg0) {
|
|
1084
|
+
const { href, children } = arg0;
|
|
1085
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", {
|
|
1086
|
+
className: "md:hidden",
|
|
1087
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.CloseButton, {
|
|
1088
|
+
as: react_router_dom.Link,
|
|
1089
|
+
to: href,
|
|
1090
|
+
className: "block py-1 text-sm text-zinc-600 transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white",
|
|
1091
|
+
children
|
|
1092
|
+
})
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
var sectionBadgeColorStyles = {
|
|
1096
|
+
GET: "text-emerald-500 dark:text-emerald-400",
|
|
1097
|
+
POST: "text-sky-500 dark:text-sky-400",
|
|
1098
|
+
PUT: "text-amber-500 dark:text-amber-400",
|
|
1099
|
+
PATCH: "text-amber-500 dark:text-amber-400",
|
|
1100
|
+
DELETE: "text-red-500 dark:text-rose-500",
|
|
1101
|
+
OPTIONS: "text-violet-500 dark:text-violet-400",
|
|
1102
|
+
HEAD: "text-zinc-500 dark:text-zinc-400",
|
|
1103
|
+
TRACE: "text-fuchsia-500 dark:text-fuchsia-400"
|
|
1104
|
+
};
|
|
1105
|
+
function SectionBadge(arg0) {
|
|
1106
|
+
const { children } = arg0;
|
|
1107
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1108
|
+
className: (0, clsx.default)("inline-flex shrink-0 justify-end font-mono text-[0.625rem]/6 font-semibold uppercase tracking-wide", sectionBadgeColorStyles[children.toUpperCase()] ?? "text-zinc-500 dark:text-zinc-400"),
|
|
1109
|
+
children
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
function NavLink(arg0) {
|
|
1113
|
+
const { href, children, badge, icon, tags, active = false, isAnchorLink = false } = arg0;
|
|
1114
|
+
function handleClick() {
|
|
1115
|
+
if (!isAnchorLink) return;
|
|
1116
|
+
const hashIndex = href.indexOf("#");
|
|
1117
|
+
if (hashIndex === -1) return;
|
|
1118
|
+
const targetId = decodeURIComponent(href.slice(hashIndex + 1));
|
|
1119
|
+
window.requestAnimationFrame(() => {
|
|
1120
|
+
document.getElementById(targetId)?.scrollIntoView();
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1124
|
+
as: react_router_dom.Link,
|
|
1125
|
+
to: href,
|
|
1126
|
+
"aria-current": active ? "page" : void 0,
|
|
1127
|
+
onClick: handleClick,
|
|
1128
|
+
className: (0, clsx.default)("clarify-navigation-link flex justify-between gap-2 py-1 pr-3 text-sm transition", isAnchorLink ? "clarify-navigation-anchor-link pl-7" : "pl-4", active ? "text-zinc-900 dark:text-white" : "text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white"),
|
|
1129
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1130
|
+
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
1131
|
+
children: [
|
|
1132
|
+
icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationIcon, {
|
|
1133
|
+
name: icon,
|
|
1134
|
+
className: "h-3.5 w-3.5"
|
|
1135
|
+
}) : null,
|
|
1136
|
+
badge ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionBadge, { children: badge }) : null,
|
|
1137
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1138
|
+
className: "min-w-0 truncate",
|
|
1139
|
+
children
|
|
1140
|
+
})
|
|
1141
|
+
]
|
|
1142
|
+
}), tags?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1143
|
+
className: "flex shrink-0 gap-1",
|
|
1144
|
+
children: tags.map((tag) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
|
|
1145
|
+
variant: "small",
|
|
1146
|
+
color: "zinc",
|
|
1147
|
+
children: tag
|
|
1148
|
+
}, tag))
|
|
1149
|
+
}) : null]
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
function VisibleSectionHighlight(arg0) {
|
|
1153
|
+
const { group, pathname } = arg0;
|
|
1154
|
+
const [sections, visibleSections] = useInitialValue([useSectionStore((s) => s.sections), useSectionStore((s) => s.visibleSections)], useIsInsideMobileNavigation());
|
|
1155
|
+
const isPresent = (0, framer_motion.useIsPresent)();
|
|
1156
|
+
const firstVisibleSectionIndex = Math.max(0, [{ id: "_top" }, ...sections].findIndex((section) => section.id === visibleSections[0]));
|
|
1157
|
+
const itemHeight = remToPx(2);
|
|
1158
|
+
const height = isPresent ? Math.max(1, visibleSections.length) * itemHeight : itemHeight;
|
|
1159
|
+
const top = group.links.findIndex((link) => link.href === pathname) * itemHeight + firstVisibleSectionIndex * itemHeight;
|
|
1160
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
1161
|
+
layout: true,
|
|
1162
|
+
initial: { opacity: 0 },
|
|
1163
|
+
animate: {
|
|
1164
|
+
opacity: 1,
|
|
1165
|
+
transition: { delay: .2 }
|
|
1166
|
+
},
|
|
1167
|
+
exit: { opacity: 0 },
|
|
1168
|
+
className: "absolute inset-x-0 top-0 bg-zinc-800/2.5 will-change-transform dark:bg-white/2.5",
|
|
1169
|
+
style: {
|
|
1170
|
+
borderRadius: 8,
|
|
1171
|
+
height,
|
|
1172
|
+
top
|
|
1173
|
+
}
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
function ActivePageMarker(arg0) {
|
|
1177
|
+
const { group, pathname } = arg0;
|
|
1178
|
+
const itemHeight = remToPx(2);
|
|
1179
|
+
const top = remToPx(.25) + group.links.findIndex((link) => link.href === pathname) * itemHeight;
|
|
1180
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
1181
|
+
layout: true,
|
|
1182
|
+
className: "absolute left-2 h-6 w-px bg-emerald-500",
|
|
1183
|
+
initial: { opacity: 0 },
|
|
1184
|
+
animate: {
|
|
1185
|
+
opacity: 1,
|
|
1186
|
+
transition: { delay: .2 }
|
|
1187
|
+
},
|
|
1188
|
+
exit: { opacity: 0 },
|
|
1189
|
+
style: { top }
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
function NavigationGroup(arg0) {
|
|
1193
|
+
const { group, className } = arg0;
|
|
1194
|
+
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1195
|
+
const [pathname, sections] = useInitialValue([(0, react_router_dom.useLocation)().pathname, useSectionStore((s) => s.sections)], isInsideMobileNavigation);
|
|
1196
|
+
const isActiveGroup = group.links.findIndex((link) => link.href === pathname) !== -1;
|
|
1197
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
1198
|
+
className: (0, clsx.default)("clarify-navigation-group relative mt-6", className),
|
|
1199
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.h2, {
|
|
1200
|
+
layout: "position",
|
|
1201
|
+
className: "clarify-navigation-group-title flex items-center gap-2 text-xs font-semibold text-zinc-900 dark:text-white",
|
|
1202
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationIcon, {
|
|
1203
|
+
name: group.icon,
|
|
1204
|
+
className: "h-3.5 w-3.5"
|
|
1205
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: group.title })]
|
|
1206
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1207
|
+
className: "relative mt-3 pl-2",
|
|
1208
|
+
children: [
|
|
1209
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, {
|
|
1210
|
+
initial: !isInsideMobileNavigation,
|
|
1211
|
+
children: isActiveGroup ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VisibleSectionHighlight, {
|
|
1212
|
+
group,
|
|
1213
|
+
pathname
|
|
1214
|
+
}) : null
|
|
1215
|
+
}),
|
|
1216
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
1217
|
+
layout: true,
|
|
1218
|
+
className: "absolute inset-y-0 left-2 w-px bg-zinc-900/10 dark:bg-white/5"
|
|
1219
|
+
}),
|
|
1220
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, {
|
|
1221
|
+
initial: false,
|
|
1222
|
+
children: isActiveGroup ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActivePageMarker, {
|
|
1223
|
+
group,
|
|
1224
|
+
pathname
|
|
1225
|
+
}) : null
|
|
1226
|
+
}),
|
|
1227
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1228
|
+
role: "list",
|
|
1229
|
+
className: "border-l border-transparent",
|
|
1230
|
+
children: group.links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.li, {
|
|
1231
|
+
layout: "position",
|
|
1232
|
+
className: "relative",
|
|
1233
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavLink, {
|
|
1234
|
+
href: link.href,
|
|
1235
|
+
icon: link.icon,
|
|
1236
|
+
active: link.href === pathname,
|
|
1237
|
+
children: link.title
|
|
1238
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, {
|
|
1239
|
+
mode: "popLayout",
|
|
1240
|
+
initial: false,
|
|
1241
|
+
children: link.href === pathname && sections.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.ul, {
|
|
1242
|
+
role: "list",
|
|
1243
|
+
initial: { opacity: 0 },
|
|
1244
|
+
animate: {
|
|
1245
|
+
opacity: 1,
|
|
1246
|
+
transition: { delay: .1 }
|
|
1247
|
+
},
|
|
1248
|
+
exit: {
|
|
1249
|
+
opacity: 0,
|
|
1250
|
+
transition: { duration: .15 }
|
|
1251
|
+
},
|
|
1252
|
+
children: sections.map((section) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavLink, {
|
|
1253
|
+
href: `${link.href}#${section.id}`,
|
|
1254
|
+
badge: section.badge,
|
|
1255
|
+
tags: section.tags,
|
|
1256
|
+
isAnchorLink: true,
|
|
1257
|
+
children: section.title
|
|
1258
|
+
}) }, section.id))
|
|
1259
|
+
}) : null
|
|
1260
|
+
})]
|
|
1261
|
+
}, link.href))
|
|
1262
|
+
})
|
|
1263
|
+
]
|
|
1264
|
+
})]
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
function Navigation(arg0) {
|
|
1268
|
+
const { navigation, className } = arg0;
|
|
1269
|
+
const groups = navigationToGroups(navigation);
|
|
1270
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1271
|
+
className: (0, clsx.default)("clarify-navigation", className),
|
|
1272
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ul", {
|
|
1273
|
+
role: "list",
|
|
1274
|
+
className: "clarify-navigation-list",
|
|
1275
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem$1, {
|
|
1276
|
+
href: "/",
|
|
1277
|
+
children: "Home"
|
|
1278
|
+
}), groups.map((group, groupIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationGroup, {
|
|
1279
|
+
group,
|
|
1280
|
+
className: groupIndex === 0 ? "md:mt-0" : ""
|
|
1281
|
+
}, group.title))]
|
|
1282
|
+
})
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
//#endregion
|
|
1286
|
+
//#region source/shell/mobile.tsx
|
|
1287
|
+
function MenuIcon(props) {
|
|
1288
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1289
|
+
viewBox: "0 0 10 9",
|
|
1290
|
+
fill: "none",
|
|
1291
|
+
strokeLinecap: "round",
|
|
1292
|
+
"aria-hidden": "true",
|
|
1293
|
+
...props,
|
|
1294
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M.5 1h9M.5 8h9M.5 4.5h9" })
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
function XIcon(props) {
|
|
1298
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1299
|
+
viewBox: "0 0 10 9",
|
|
1300
|
+
fill: "none",
|
|
1301
|
+
strokeLinecap: "round",
|
|
1302
|
+
"aria-hidden": "true",
|
|
1303
|
+
...props,
|
|
1304
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m1.5 1 7 7M8.5 1l-7 7" })
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
var IsInsideMobileNavigationContext = (0, react.createContext)(false);
|
|
1308
|
+
function MobileNavigationDialog(arg0) {
|
|
1309
|
+
const { config, isOpen, navigation, routes, currentLocale, currentRoute, close } = arg0;
|
|
1310
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Dialog, {
|
|
1311
|
+
transition: true,
|
|
1312
|
+
open: isOpen,
|
|
1313
|
+
onClose: close,
|
|
1314
|
+
className: "clarify-mobile-navigation-dialog fixed inset-0 z-50 lg:hidden",
|
|
1315
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.DialogBackdrop, {
|
|
1316
|
+
transition: true,
|
|
1317
|
+
className: "clarify-mobile-navigation-backdrop fixed inset-0 top-14 bg-zinc-400/20 backdrop-blur-xs data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in dark:bg-black/40"
|
|
1318
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.DialogPanel, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TransitionChild, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Header, {
|
|
1319
|
+
config,
|
|
1320
|
+
navigation,
|
|
1321
|
+
routes,
|
|
1322
|
+
currentLocale,
|
|
1323
|
+
currentRoute,
|
|
1324
|
+
className: "data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"
|
|
1325
|
+
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TransitionChild, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
1326
|
+
layoutScroll: true,
|
|
1327
|
+
className: "clarify-mobile-navigation-panel fixed top-14 bottom-0 left-0 w-full overflow-y-auto bg-white px-4 pt-6 pb-4 shadow-lg ring-1 shadow-zinc-900/10 ring-zinc-900/7.5 duration-500 ease-in-out data-closed:-translate-x-full min-[416px]:max-w-sm sm:px-6 sm:pb-10 dark:bg-zinc-950 dark:ring-zinc-800",
|
|
1328
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Navigation, { navigation })
|
|
1329
|
+
}) })] })]
|
|
1330
|
+
});
|
|
1331
|
+
}
|
|
1332
|
+
function useIsInsideMobileNavigation() {
|
|
1333
|
+
return (0, react.useContext)(IsInsideMobileNavigationContext);
|
|
1334
|
+
}
|
|
1335
|
+
var useMobileNavigationStore = (0, zustand.create)()((set) => ({
|
|
1336
|
+
isOpen: false,
|
|
1337
|
+
open: () => set({ isOpen: true }),
|
|
1338
|
+
close: () => set({ isOpen: false }),
|
|
1339
|
+
toggle: () => set((state) => ({ isOpen: !state.isOpen }))
|
|
1340
|
+
}));
|
|
1341
|
+
function MobileNavigation(arg0) {
|
|
1342
|
+
const { config, navigation, routes, currentLocale, currentRoute } = arg0;
|
|
1343
|
+
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1344
|
+
const { isOpen, toggle, close } = useMobileNavigationStore();
|
|
1345
|
+
const ToggleIcon = isOpen ? XIcon : MenuIcon;
|
|
1346
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(IsInsideMobileNavigationContext.Provider, {
|
|
1347
|
+
value: true,
|
|
1348
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1349
|
+
type: "button",
|
|
1350
|
+
className: "clarify-mobile-navigation-button relative flex size-6 items-center justify-center rounded-md transition hover:bg-zinc-900/5 dark:hover:bg-white/5",
|
|
1351
|
+
"aria-label": "Toggle navigation",
|
|
1352
|
+
onClick: toggle,
|
|
1353
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "absolute size-12 pointer-fine:hidden" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ToggleIcon, { className: "w-2.5 stroke-zinc-900 dark:stroke-white" })]
|
|
1354
|
+
}), !isInsideMobileNavigation ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
1355
|
+
fallback: null,
|
|
1356
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigationDialog, {
|
|
1357
|
+
config,
|
|
1358
|
+
navigation,
|
|
1359
|
+
routes,
|
|
1360
|
+
currentLocale,
|
|
1361
|
+
currentRoute,
|
|
1362
|
+
isOpen,
|
|
1363
|
+
close
|
|
1364
|
+
})
|
|
1365
|
+
}) : null]
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
//#endregion
|
|
1369
|
+
//#region source/shell/Search.tsx
|
|
1370
|
+
function SearchIcon(props) {
|
|
1371
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1372
|
+
viewBox: "0 0 20 20",
|
|
1373
|
+
fill: "none",
|
|
1374
|
+
"aria-hidden": "true",
|
|
1375
|
+
...props,
|
|
1376
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1377
|
+
strokeLinecap: "round",
|
|
1378
|
+
strokeLinejoin: "round",
|
|
1379
|
+
d: "M12.01 12a4.25 4.25 0 1 0-6.02-6 4.25 4.25 0 0 0 6.02 6Zm0 0 3.24 3.25"
|
|
1380
|
+
})
|
|
1381
|
+
});
|
|
1382
|
+
}
|
|
1383
|
+
function NoResultsIcon(props) {
|
|
1384
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
1385
|
+
viewBox: "0 0 20 20",
|
|
1386
|
+
fill: "none",
|
|
1387
|
+
"aria-hidden": "true",
|
|
1388
|
+
...props,
|
|
1389
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
1390
|
+
strokeLinecap: "round",
|
|
1391
|
+
strokeLinejoin: "round",
|
|
1392
|
+
d: "M12.01 12a4.237 4.237 0 0 0 1.24-3c0-.62-.132-1.207-.37-1.738M12.01 12A4.237 4.237 0 0 1 9 13.25c-.635 0-1.237-.14-1.777-.388M12.01 12l3.24 3.25m-3.715-9.661a4.25 4.25 0 0 0-5.975 5.908M4.5 15.5l11-11"
|
|
1393
|
+
})
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
function routeGroupTitles(navigation) {
|
|
1397
|
+
const titles = /* @__PURE__ */ new Map();
|
|
1398
|
+
for (const node of navigation) if (node.children?.length) for (const child of node.children) titles.set(child.path, node.title);
|
|
1399
|
+
else titles.set(node.path, node.title);
|
|
1400
|
+
return titles;
|
|
1401
|
+
}
|
|
1402
|
+
function buildSearchItems(routes, navigation) {
|
|
1403
|
+
const groupTitles = routeGroupTitles(navigation);
|
|
1404
|
+
return routes.flatMap((route) => {
|
|
1405
|
+
const groupTitle = groupTitles.get(route.path);
|
|
1406
|
+
return [{
|
|
1407
|
+
title: route.title,
|
|
1408
|
+
pageTitle: route.title,
|
|
1409
|
+
sectionTitle: groupTitle,
|
|
1410
|
+
url: route.path,
|
|
1411
|
+
keywords: [
|
|
1412
|
+
groupTitle,
|
|
1413
|
+
route.title,
|
|
1414
|
+
route.path,
|
|
1415
|
+
route.kind
|
|
1416
|
+
].filter(Boolean).join(" ").toLowerCase()
|
|
1417
|
+
}, ...route.sections?.map((section) => ({
|
|
1418
|
+
title: section.title,
|
|
1419
|
+
pageTitle: route.title,
|
|
1420
|
+
sectionTitle: groupTitle,
|
|
1421
|
+
url: `${route.path}#${section.id}`,
|
|
1422
|
+
keywords: [
|
|
1423
|
+
groupTitle,
|
|
1424
|
+
route.title,
|
|
1425
|
+
section.title,
|
|
1426
|
+
route.path,
|
|
1427
|
+
section.id
|
|
1428
|
+
].filter(Boolean).join(" ").toLowerCase()
|
|
1429
|
+
})) ?? []];
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
function escapeRegExp(value) {
|
|
1433
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1434
|
+
}
|
|
1435
|
+
function HighlightQuery(arg0) {
|
|
1436
|
+
const { text, query } = arg0;
|
|
1437
|
+
if (!query) return text;
|
|
1438
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: text.split(new RegExp(`(${escapeRegExp(query)})`, "ig")).map((part, index) => part.toLowerCase() === query.toLowerCase() ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
|
|
1439
|
+
className: "bg-transparent text-emerald-500 underline",
|
|
1440
|
+
children: part
|
|
1441
|
+
}, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: part }, index)) });
|
|
1442
|
+
}
|
|
1443
|
+
function SearchResult(arg0) {
|
|
1444
|
+
const { result, query, active, onSelect } = arg0;
|
|
1445
|
+
const id = (0, react.useId)();
|
|
1446
|
+
const hierarchy = [result.sectionTitle, result.pageTitle].filter((value) => typeof value === "string");
|
|
1447
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
1448
|
+
id,
|
|
1449
|
+
className: (0, clsx.default)("clarify-search-result group block cursor-default px-4 py-3 aria-selected:bg-zinc-50 dark:aria-selected:bg-zinc-800/50", active && "bg-zinc-50 dark:bg-zinc-800/50"),
|
|
1450
|
+
"aria-selected": active,
|
|
1451
|
+
onMouseDown: (event) => {
|
|
1452
|
+
event.preventDefault();
|
|
1453
|
+
onSelect();
|
|
1454
|
+
},
|
|
1455
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1456
|
+
className: "text-sm font-medium text-zinc-900 group-aria-selected:text-emerald-500 dark:text-white",
|
|
1457
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
|
|
1458
|
+
text: result.title,
|
|
1459
|
+
query
|
|
1460
|
+
})
|
|
1461
|
+
}), hierarchy.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1462
|
+
className: "mt-1 truncate text-2xs whitespace-nowrap text-zinc-500",
|
|
1463
|
+
children: hierarchy.map((item, itemIndex, items) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
|
|
1464
|
+
text: item,
|
|
1465
|
+
query
|
|
1466
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1467
|
+
className: itemIndex === items.length - 1 ? "sr-only" : "mx-2 text-zinc-300 dark:text-zinc-700",
|
|
1468
|
+
children: "/"
|
|
1469
|
+
})] }, `${item}-${itemIndex}`))
|
|
1470
|
+
}) : null]
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
var SearchInput = (0, react.forwardRef)(function SearchInput(arg0, inputRef) {
|
|
1474
|
+
const { query, setQuery, onClose, onSubmit, activeDescendantId } = arg0;
|
|
1475
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1476
|
+
className: "clarify-search-input group relative flex h-12",
|
|
1477
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchIcon, { className: "pointer-events-none absolute top-0 left-3 h-full w-5 stroke-zinc-500" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1478
|
+
ref: inputRef,
|
|
1479
|
+
"data-autofocus": true,
|
|
1480
|
+
role: "combobox",
|
|
1481
|
+
"aria-expanded": query !== "",
|
|
1482
|
+
"aria-controls": "clarify-search-results",
|
|
1483
|
+
"aria-activedescendant": activeDescendantId,
|
|
1484
|
+
value: query,
|
|
1485
|
+
onChange: (event) => setQuery(event.currentTarget.value),
|
|
1486
|
+
onKeyDown: (event) => {
|
|
1487
|
+
if (event.key === "Escape") if (query) setQuery("");
|
|
1488
|
+
else onClose();
|
|
1489
|
+
if (event.key === "Enter") {
|
|
1490
|
+
event.preventDefault();
|
|
1491
|
+
onSubmit();
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
placeholder: "Find something...",
|
|
1495
|
+
className: "flex-auto appearance-none bg-transparent pr-4 pl-10 text-zinc-900 outline-hidden placeholder:text-zinc-500 focus:w-full focus:flex-none sm:text-sm dark:text-white [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden"
|
|
1496
|
+
})]
|
|
1497
|
+
});
|
|
1498
|
+
});
|
|
1499
|
+
function SearchDialog(arg0) {
|
|
1500
|
+
const { open, setOpen, routes, navigation, className, onNavigate = () => {} } = arg0;
|
|
1501
|
+
const navigate = (0, react_router_dom.useNavigate)();
|
|
1502
|
+
const location = (0, react_router_dom.useLocation)();
|
|
1503
|
+
const inputRef = (0, react.useRef)(null);
|
|
1504
|
+
const [query, setQuery] = (0, react.useState)("");
|
|
1505
|
+
const [activeIndex, setActiveIndex] = (0, react.useState)(0);
|
|
1506
|
+
const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1507
|
+
const results = (0, react.useMemo)(() => {
|
|
1508
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
1509
|
+
if (!normalizedQuery) return [];
|
|
1510
|
+
return searchItems.filter((item) => item.keywords.includes(normalizedQuery)).slice(0, 8);
|
|
1511
|
+
}, [query, searchItems]);
|
|
1512
|
+
(0, react.useEffect)(() => {
|
|
1513
|
+
setOpen(false);
|
|
1514
|
+
}, [
|
|
1515
|
+
location.pathname,
|
|
1516
|
+
location.search,
|
|
1517
|
+
location.hash,
|
|
1518
|
+
setOpen
|
|
1519
|
+
]);
|
|
1520
|
+
(0, react.useEffect)(() => {
|
|
1521
|
+
if (open) return void 0;
|
|
1522
|
+
function onKeyDown(event) {
|
|
1523
|
+
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
1524
|
+
event.preventDefault();
|
|
1525
|
+
setOpen(true);
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
window.addEventListener("keydown", onKeyDown);
|
|
1529
|
+
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1530
|
+
}, [open, setOpen]);
|
|
1531
|
+
const updateQuery = (value) => {
|
|
1532
|
+
setQuery(value);
|
|
1533
|
+
setActiveIndex(0);
|
|
1534
|
+
};
|
|
1535
|
+
function closeDialog() {
|
|
1536
|
+
updateQuery("");
|
|
1537
|
+
setOpen(false);
|
|
1538
|
+
}
|
|
1539
|
+
function selectResult(result = results[activeIndex]) {
|
|
1540
|
+
if (!result) return;
|
|
1541
|
+
navigate(result.url);
|
|
1542
|
+
onNavigate();
|
|
1543
|
+
closeDialog();
|
|
1544
|
+
}
|
|
1545
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Dialog, {
|
|
1546
|
+
open,
|
|
1547
|
+
onClose: closeDialog,
|
|
1548
|
+
className: (0, clsx.default)("clarify-search-dialog fixed inset-0 z-50", className),
|
|
1549
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.DialogBackdrop, {
|
|
1550
|
+
transition: true,
|
|
1551
|
+
className: "clarify-search-backdrop fixed inset-0 bg-zinc-400/25 backdrop-blur-xs data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in dark:bg-black/40"
|
|
1552
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1553
|
+
className: "fixed inset-0 overflow-y-auto px-4 py-4 sm:px-6 sm:py-20 md:py-32 lg:px-8 lg:py-[15vh]",
|
|
1554
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.DialogPanel, {
|
|
1555
|
+
transition: true,
|
|
1556
|
+
className: "clarify-search-panel mx-auto transform-gpu overflow-hidden rounded-lg bg-zinc-50 shadow-xl ring-1 ring-zinc-900/7.5 data-closed:scale-95 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:max-w-xl dark:bg-zinc-900 dark:ring-zinc-800",
|
|
1557
|
+
onKeyDown: (event) => {
|
|
1558
|
+
if (event.key === "ArrowDown") {
|
|
1559
|
+
event.preventDefault();
|
|
1560
|
+
setActiveIndex((index) => results.length ? (index + 1) % results.length : 0);
|
|
1561
|
+
}
|
|
1562
|
+
if (event.key === "ArrowUp") {
|
|
1563
|
+
event.preventDefault();
|
|
1564
|
+
setActiveIndex((index) => results.length ? (index - 1 + results.length) % results.length : 0);
|
|
1565
|
+
}
|
|
1566
|
+
},
|
|
1567
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
1568
|
+
ref: inputRef,
|
|
1569
|
+
query,
|
|
1570
|
+
setQuery: updateQuery,
|
|
1571
|
+
onClose: closeDialog,
|
|
1572
|
+
onSubmit: () => selectResult()
|
|
1573
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1574
|
+
className: "border-t border-zinc-200 bg-white empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5",
|
|
1575
|
+
children: [query && results.length === 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1576
|
+
className: "p-6 text-center",
|
|
1577
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoResultsIcon, { className: "mx-auto h-5 w-5 stroke-zinc-900 dark:stroke-zinc-600" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
1578
|
+
className: "mt-2 text-xs text-zinc-700 dark:text-zinc-400",
|
|
1579
|
+
children: [
|
|
1580
|
+
"Nothing found for",
|
|
1581
|
+
" ",
|
|
1582
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("strong", {
|
|
1583
|
+
className: "font-semibold wrap-break-word text-zinc-900 dark:text-white",
|
|
1584
|
+
children: [
|
|
1585
|
+
"‘",
|
|
1586
|
+
query,
|
|
1587
|
+
"’"
|
|
1588
|
+
]
|
|
1589
|
+
}),
|
|
1590
|
+
"."
|
|
1591
|
+
]
|
|
1592
|
+
})]
|
|
1593
|
+
}) : null, results.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1594
|
+
id: "clarify-search-results",
|
|
1595
|
+
className: "clarify-search-results",
|
|
1596
|
+
role: "listbox",
|
|
1597
|
+
children: results.map((result, resultIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResult, {
|
|
1598
|
+
result,
|
|
1599
|
+
query,
|
|
1600
|
+
active: resultIndex === activeIndex,
|
|
1601
|
+
onSelect: () => selectResult(result)
|
|
1602
|
+
}, result.url))
|
|
1603
|
+
}) : null]
|
|
1604
|
+
})]
|
|
1605
|
+
})
|
|
1606
|
+
})]
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
function useSearchProps() {
|
|
1610
|
+
const buttonRef = (0, react.useRef)(null);
|
|
1611
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
1612
|
+
return {
|
|
1613
|
+
buttonProps: {
|
|
1614
|
+
ref: buttonRef,
|
|
1615
|
+
onClick() {
|
|
1616
|
+
setOpen(true);
|
|
1617
|
+
}
|
|
1618
|
+
},
|
|
1619
|
+
dialogProps: {
|
|
1620
|
+
open,
|
|
1621
|
+
setOpen
|
|
1622
|
+
}
|
|
1623
|
+
};
|
|
1624
|
+
}
|
|
1625
|
+
function getModifierKey() {
|
|
1626
|
+
if (typeof navigator === "undefined") return "Ctrl ";
|
|
1627
|
+
return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? "⌘" : "Ctrl ";
|
|
1628
|
+
}
|
|
1629
|
+
function Search(arg0) {
|
|
1630
|
+
const { routes, navigation } = arg0;
|
|
1631
|
+
const modifierKey = getModifierKey();
|
|
1632
|
+
const { buttonProps, dialogProps } = useSearchProps();
|
|
1633
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1634
|
+
className: "clarify-search hidden lg:block lg:max-w-md lg:flex-auto",
|
|
1635
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1636
|
+
type: "button",
|
|
1637
|
+
className: "clarify-search-button hidden h-8 w-full items-center gap-2 rounded-full bg-white pr-3 pl-2 text-sm text-zinc-500 ring-1 ring-zinc-900/10 transition hover:ring-zinc-900/20 lg:flex dark:bg-white/5 dark:text-zinc-400 dark:ring-white/10 dark:ring-inset dark:hover:ring-white/20",
|
|
1638
|
+
...buttonProps,
|
|
1639
|
+
children: [
|
|
1640
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchIcon, { className: "h-5 w-5 stroke-current" }),
|
|
1641
|
+
"Find something...",
|
|
1642
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("kbd", {
|
|
1643
|
+
className: "ml-auto text-2xs text-zinc-400 dark:text-zinc-500",
|
|
1644
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("kbd", {
|
|
1645
|
+
className: "font-sans",
|
|
1646
|
+
children: modifierKey
|
|
1647
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("kbd", {
|
|
1648
|
+
className: "font-sans",
|
|
1649
|
+
children: "K"
|
|
1650
|
+
})]
|
|
1651
|
+
})
|
|
1652
|
+
]
|
|
1653
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
1654
|
+
fallback: null,
|
|
1655
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchDialog, {
|
|
1656
|
+
className: "hidden lg:block",
|
|
1657
|
+
routes,
|
|
1658
|
+
navigation,
|
|
1659
|
+
...dialogProps
|
|
1660
|
+
})
|
|
1661
|
+
})]
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
function MobileSearch(arg0) {
|
|
1665
|
+
const { routes, navigation, onNavigate } = arg0;
|
|
1666
|
+
const { buttonProps, dialogProps } = useSearchProps();
|
|
1667
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1668
|
+
className: "clarify-mobile-search contents lg:hidden",
|
|
1669
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1670
|
+
type: "button",
|
|
1671
|
+
className: "clarify-mobile-search-button relative flex size-6 items-center justify-center rounded-md transition hover:bg-zinc-900/5 lg:hidden dark:hover:bg-white/5",
|
|
1672
|
+
"aria-label": "Find something...",
|
|
1673
|
+
...buttonProps,
|
|
1674
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "absolute size-12 pointer-fine:hidden" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchIcon, { className: "h-5 w-5 stroke-zinc-900 dark:stroke-white" })]
|
|
1675
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
1676
|
+
fallback: null,
|
|
1677
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchDialog, {
|
|
1678
|
+
className: "lg:hidden",
|
|
1679
|
+
routes,
|
|
1680
|
+
navigation,
|
|
1681
|
+
onNavigate,
|
|
1682
|
+
...dialogProps
|
|
1683
|
+
})
|
|
1684
|
+
})]
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
//#endregion
|
|
1688
|
+
//#region source/shell/Header.tsx
|
|
1689
|
+
function resolveLocalizedText(text, locale, fallbackLocale) {
|
|
1690
|
+
if (typeof text === "string") return text;
|
|
1691
|
+
return (locale ? text[locale] : void 0) ?? (fallbackLocale ? text[fallbackLocale] : void 0) ?? Object.values(text)[0] ?? "";
|
|
1692
|
+
}
|
|
1693
|
+
function isExternalHref(href) {
|
|
1694
|
+
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
1695
|
+
}
|
|
1696
|
+
function localizeHref(href, config, locale) {
|
|
1697
|
+
if (!locale || !config.i18n || isExternalHref(href) || href.startsWith("#")) return href;
|
|
1698
|
+
if (locale === config.i18n.defaultLocale) return href;
|
|
1699
|
+
const cleanHref = href === "/" ? "" : href.replace(/^\/+/, "");
|
|
1700
|
+
return `/${locale}${cleanHref ? `/${cleanHref}` : ""}`;
|
|
1701
|
+
}
|
|
1702
|
+
function localizedRoutePath(config, locale, route) {
|
|
1703
|
+
const alternatePath = route?.alternates?.[locale];
|
|
1704
|
+
if (alternatePath) return alternatePath;
|
|
1705
|
+
if (route?.alternates) return void 0;
|
|
1706
|
+
return localizeHref(route?.basePath ?? route?.path ?? "/", config, locale);
|
|
1707
|
+
}
|
|
1708
|
+
function LanguageIcon(props) {
|
|
1709
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
1710
|
+
viewBox: "0 0 20 20",
|
|
1711
|
+
fill: "none",
|
|
1712
|
+
"aria-hidden": "true",
|
|
1713
|
+
...props,
|
|
1714
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10 17.5a7.5 7.5 0 1 0 0-15 7.5 7.5 0 0 0 0 15Z" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.5 10h15M10 2.5c2 2.05 3 4.55 3 7.5s-1 5.45-3 7.5c-2-2.05-3-4.55-3-7.5s1-5.45 3-7.5Z" })]
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
function LanguageSwitcher(arg0) {
|
|
1718
|
+
const { config, currentLocale, currentRoute } = arg0;
|
|
1719
|
+
const location = (0, react_router_dom.useLocation)();
|
|
1720
|
+
const i18n = config.i18n;
|
|
1721
|
+
if (!i18n || i18n.locales.length < 2) return null;
|
|
1722
|
+
const selectedLocale = currentLocale ?? i18n.defaultLocale;
|
|
1723
|
+
const selectedLocaleConfig = i18n.locales.find((locale) => locale.code === selectedLocale) ?? i18n.locales[0];
|
|
1724
|
+
const suffix = `${location.search}${location.hash}`;
|
|
1725
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Menu, {
|
|
1726
|
+
as: "div",
|
|
1727
|
+
className: "clarify-language-switcher relative",
|
|
1728
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.MenuButton, {
|
|
1729
|
+
className: "clarify-language-switcher-button flex h-7 items-center gap-1.5 rounded-md px-1.5 text-sm/5 font-medium text-zinc-600 transition hover:bg-zinc-900/5 hover:text-zinc-900 dark:text-zinc-400 dark:hover:bg-white/5 dark:hover:text-white",
|
|
1730
|
+
"aria-label": "Switch language",
|
|
1731
|
+
children: [
|
|
1732
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "absolute size-12 pointer-fine:hidden" }),
|
|
1733
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageIcon, { className: "h-5 w-5 stroke-current" }),
|
|
1734
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1735
|
+
className: "hidden sm:inline",
|
|
1736
|
+
children: selectedLocaleConfig?.label ?? selectedLocale
|
|
1737
|
+
})
|
|
1738
|
+
]
|
|
1739
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItems, {
|
|
1740
|
+
transition: true,
|
|
1741
|
+
className: "clarify-language-switcher-menu absolute right-0 z-50 mt-2 w-44 rounded-xl bg-white p-1 text-sm shadow-lg ring-1 shadow-zinc-900/5 ring-zinc-900/10 transition data-closed:scale-95 data-closed:opacity-0 data-enter:duration-100 data-enter:ease-out data-leave:duration-75 data-leave:ease-in dark:bg-zinc-900 dark:ring-white/10",
|
|
1742
|
+
children: i18n.locales.flatMap((locale) => {
|
|
1743
|
+
const localizedPath = localizedRoutePath(config, locale.code, currentRoute);
|
|
1744
|
+
if (!localizedPath) return [];
|
|
1745
|
+
const selected = locale.code === selectedLocale;
|
|
1746
|
+
return [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: ({ focus }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
|
|
1747
|
+
to: `${localizedPath}${suffix}`,
|
|
1748
|
+
className: (0, clsx.default)("clarify-language-switcher-item flex items-center justify-between rounded-lg px-3 py-2 no-underline transition", focus && "bg-zinc-100 dark:bg-white/5", selected ? "text-zinc-900 dark:text-white" : "text-zinc-600 dark:text-zinc-400"),
|
|
1749
|
+
"aria-current": selected ? "true" : void 0,
|
|
1750
|
+
lang: locale.code,
|
|
1751
|
+
dir: locale.dir,
|
|
1752
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: locale.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1753
|
+
className: "text-xs text-zinc-400 dark:text-zinc-500",
|
|
1754
|
+
children: locale.code
|
|
1755
|
+
})]
|
|
1756
|
+
}) }, locale.code)];
|
|
1757
|
+
})
|
|
1758
|
+
})]
|
|
1759
|
+
});
|
|
1760
|
+
}
|
|
1761
|
+
function TopLevelNavItem(arg0) {
|
|
1762
|
+
const { href, children } = arg0;
|
|
1763
|
+
if (isExternalHref(href)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
1764
|
+
href,
|
|
1765
|
+
className: "text-sm/5 text-zinc-600 transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white",
|
|
1766
|
+
target: "_blank",
|
|
1767
|
+
rel: "noreferrer",
|
|
1768
|
+
children
|
|
1769
|
+
}) });
|
|
1770
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Link, {
|
|
1771
|
+
to: href,
|
|
1772
|
+
className: "text-sm/5 text-zinc-600 transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white",
|
|
1773
|
+
children
|
|
1774
|
+
}) });
|
|
1775
|
+
}
|
|
1776
|
+
var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
1777
|
+
const { config, navigation, routes, currentLocale, currentRoute, className, ...props } = arg0;
|
|
1778
|
+
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1779
|
+
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1780
|
+
const { scrollY } = (0, framer_motion.useScroll)();
|
|
1781
|
+
const bgOpacityLight = (0, framer_motion.useTransform)(scrollY, [0, 72], ["50%", "90%"]);
|
|
1782
|
+
const bgOpacityDark = (0, framer_motion.useTransform)(scrollY, [0, 72], ["20%", "80%"]);
|
|
1783
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
|
|
1784
|
+
...props,
|
|
1785
|
+
ref,
|
|
1786
|
+
className: (0, clsx.default)(className, "clarify-header fixed inset-x-0 top-0 z-50 flex h-14 items-center justify-between gap-12 px-4 transition sm:px-6 lg:left-72 lg:z-30 lg:px-8 xl:left-80", !isInsideMobileNavigation && "backdrop-blur-xs lg:left-72 xl:left-80 dark:backdrop-blur-sm", isInsideMobileNavigation ? "bg-white dark:bg-zinc-950" : "bg-white/(--bg-opacity-light) dark:bg-zinc-950/(--bg-opacity-dark)"),
|
|
1787
|
+
style: {
|
|
1788
|
+
"--bg-opacity-light": bgOpacityLight,
|
|
1789
|
+
"--bg-opacity-dark": bgOpacityDark
|
|
1790
|
+
},
|
|
1791
|
+
children: [
|
|
1792
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: (0, clsx.default)("absolute inset-x-0 top-full h-px transition", (isInsideMobileNavigation || !mobileNavIsOpen) && "bg-zinc-900/7.5 dark:bg-white/7.5") }),
|
|
1793
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "hidden lg:block" }),
|
|
1794
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1795
|
+
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
1796
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileNavigation, {
|
|
1797
|
+
config,
|
|
1798
|
+
navigation,
|
|
1799
|
+
routes,
|
|
1800
|
+
currentLocale,
|
|
1801
|
+
currentRoute
|
|
1802
|
+
}), config.logo ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.CloseButton, {
|
|
1803
|
+
as: react_router_dom.Link,
|
|
1804
|
+
to: localizeHref("/", config, currentLocale),
|
|
1805
|
+
"aria-label": "Home",
|
|
1806
|
+
className: "clarify-brand flex items-center gap-2 no-underline",
|
|
1807
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1808
|
+
logo: config.logo,
|
|
1809
|
+
className: "h-6 w-6"
|
|
1810
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1811
|
+
className: "sr-only",
|
|
1812
|
+
children: config.title
|
|
1813
|
+
})]
|
|
1814
|
+
}) : null]
|
|
1815
|
+
}),
|
|
1816
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1817
|
+
className: "clarify-header-actions flex items-center gap-5",
|
|
1818
|
+
children: [
|
|
1819
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Search, {
|
|
1820
|
+
routes,
|
|
1821
|
+
navigation
|
|
1822
|
+
}),
|
|
1823
|
+
config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1824
|
+
className: "clarify-top-nav hidden md:block",
|
|
1825
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1826
|
+
role: "list",
|
|
1827
|
+
className: "flex items-center gap-8",
|
|
1828
|
+
children: config.navbar.links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TopLevelNavItem, {
|
|
1829
|
+
href: localizeHref(link.href, config, currentLocale),
|
|
1830
|
+
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1831
|
+
}, link.href))
|
|
1832
|
+
})
|
|
1833
|
+
}) : null,
|
|
1834
|
+
config.navbar?.links?.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "hidden md:block md:h-5 md:w-px md:bg-zinc-900/10 md:dark:bg-white/15" }) : null,
|
|
1835
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileSearch, {
|
|
1836
|
+
routes,
|
|
1837
|
+
navigation
|
|
1838
|
+
}),
|
|
1839
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(LanguageSwitcher, {
|
|
1840
|
+
config,
|
|
1841
|
+
currentLocale,
|
|
1842
|
+
currentRoute
|
|
1843
|
+
}),
|
|
1844
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {})
|
|
1845
|
+
]
|
|
1846
|
+
})
|
|
1847
|
+
]
|
|
1848
|
+
});
|
|
1849
|
+
});
|
|
1850
|
+
//#endregion
|
|
1851
|
+
//#region source/app/AppShell.tsx
|
|
1852
|
+
function routeForPath(routes, pathname) {
|
|
1853
|
+
return routes.find((route) => route.path === pathname || `/${route.path}` === pathname);
|
|
1854
|
+
}
|
|
1855
|
+
function sectionsForRoute(route) {
|
|
1856
|
+
return route?.sections?.map((section) => ({
|
|
1857
|
+
id: section.id,
|
|
1858
|
+
title: section.title,
|
|
1859
|
+
badge: section.badge,
|
|
1860
|
+
tags: section.tags
|
|
1861
|
+
})) ?? [];
|
|
1862
|
+
}
|
|
1863
|
+
function scrollToHash(hash) {
|
|
1864
|
+
if (!hash) return;
|
|
1865
|
+
const targetId = decodeURIComponent(hash.slice(1));
|
|
1866
|
+
window.requestAnimationFrame(() => {
|
|
1867
|
+
document.getElementById(targetId)?.scrollIntoView();
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
function localeForPath(config, pathname, route) {
|
|
1871
|
+
if (route?.locale) return route.locale;
|
|
1872
|
+
const i18n = config.i18n;
|
|
1873
|
+
if (!i18n) return void 0;
|
|
1874
|
+
const firstSegment = pathname.split("/").filter(Boolean)[0];
|
|
1875
|
+
return i18n.locales.find((locale) => locale.code === firstSegment)?.code ?? i18n.defaultLocale;
|
|
1876
|
+
}
|
|
1877
|
+
function navigationForLocale(navigation, locale) {
|
|
1878
|
+
if (Array.isArray(navigation)) return navigation;
|
|
1879
|
+
if (!locale) return [];
|
|
1880
|
+
return navigation[locale] ?? [];
|
|
1881
|
+
}
|
|
1882
|
+
function homePathForLocale(config, locale) {
|
|
1883
|
+
if (!locale || !config.i18n || locale === config.i18n.defaultLocale) return "/";
|
|
1884
|
+
return `/${locale}`;
|
|
1885
|
+
}
|
|
1886
|
+
function AppShell(arg0) {
|
|
1887
|
+
const { config, routes, navigation } = arg0;
|
|
1888
|
+
const location = (0, react_router_dom.useLocation)();
|
|
1889
|
+
const currentRoute = routeForPath(routes, location.pathname);
|
|
1890
|
+
const currentLocale = localeForPath(config, location.pathname, currentRoute);
|
|
1891
|
+
const currentLocaleConfig = config.i18n?.locales.find((locale) => locale.code === currentLocale);
|
|
1892
|
+
const currentNavigation = navigationForLocale(navigation, currentLocale);
|
|
1893
|
+
const sections = sectionsForRoute(currentRoute);
|
|
1894
|
+
(0, react.useEffect)(() => {
|
|
1895
|
+
scrollToHash(location.hash);
|
|
1896
|
+
}, [location.hash, location.pathname]);
|
|
1897
|
+
(0, react.useEffect)(() => {
|
|
1898
|
+
if (!currentLocale) return;
|
|
1899
|
+
document.documentElement.lang = currentLocale;
|
|
1900
|
+
if (currentLocaleConfig?.dir) document.documentElement.dir = currentLocaleConfig.dir;
|
|
1901
|
+
else document.documentElement.removeAttribute("dir");
|
|
1902
|
+
}, [currentLocale, currentLocaleConfig?.dir]);
|
|
1903
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SectionProvider, {
|
|
1904
|
+
sections,
|
|
1905
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1906
|
+
className: "clarify-app h-full min-h-screen bg-white lg:ml-72 xl:ml-80 dark:bg-zinc-950",
|
|
1907
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.header, {
|
|
1908
|
+
layoutScroll: true,
|
|
1909
|
+
className: "clarify-shell contents lg:pointer-events-none lg:fixed lg:inset-0 lg:z-40 lg:flex",
|
|
1910
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1911
|
+
className: "clarify-sidebar contents lg:pointer-events-auto lg:block lg:w-72 lg:overflow-y-auto lg:border-r lg:border-zinc-900/10 lg:bg-white lg:px-6 lg:pt-4 lg:pb-8 xl:w-80 lg:dark:border-white/10 lg:dark:bg-zinc-950",
|
|
1912
|
+
children: [
|
|
1913
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1914
|
+
className: "clarify-sidebar-brand hidden lg:flex",
|
|
1915
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
|
|
1916
|
+
to: homePathForLocale(config, currentLocale),
|
|
1917
|
+
"aria-label": "Home",
|
|
1918
|
+
className: "clarify-brand flex items-center gap-2 no-underline",
|
|
1919
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SiteLogo, {
|
|
1920
|
+
logo: config.logo,
|
|
1921
|
+
className: "h-6 w-6"
|
|
1922
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1923
|
+
className: "clarify-brand-title text-sm font-semibold text-zinc-900 dark:text-white",
|
|
1924
|
+
children: config.title
|
|
1925
|
+
})]
|
|
1926
|
+
})
|
|
1927
|
+
}),
|
|
1928
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Header, {
|
|
1929
|
+
config,
|
|
1930
|
+
navigation: currentNavigation,
|
|
1931
|
+
routes,
|
|
1932
|
+
currentLocale,
|
|
1933
|
+
currentRoute
|
|
1934
|
+
}),
|
|
1935
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Navigation, {
|
|
1936
|
+
navigation: currentNavigation,
|
|
1937
|
+
className: "clarify-navigation hidden lg:mt-10 lg:block"
|
|
1938
|
+
})
|
|
1939
|
+
]
|
|
1940
|
+
})
|
|
1941
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1942
|
+
className: "clarify-content relative flex min-h-screen flex-col px-4 pt-14 sm:px-6 lg:px-8",
|
|
1943
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ContentActions, {
|
|
1944
|
+
route: currentRoute,
|
|
1945
|
+
routePrefix: config.routePrefix
|
|
1946
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("main", {
|
|
1947
|
+
className: "clarify-main flex-auto",
|
|
1948
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Routes, { children: routes.map((route) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Route, {
|
|
1949
|
+
path: route.path,
|
|
1950
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(route.component, {})
|
|
1951
|
+
}, route.path)) })
|
|
1952
|
+
})]
|
|
1953
|
+
})]
|
|
1954
|
+
})
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
//#endregion
|
|
1958
|
+
Object.defineProperty(exports, "ApiEndpointCard", {
|
|
1959
|
+
enumerable: true,
|
|
1960
|
+
get: function() {
|
|
1961
|
+
return ApiEndpointCard;
|
|
1962
|
+
}
|
|
1963
|
+
});
|
|
1964
|
+
Object.defineProperty(exports, "AppShell", {
|
|
1965
|
+
enumerable: true,
|
|
1966
|
+
get: function() {
|
|
1967
|
+
return AppShell;
|
|
1968
|
+
}
|
|
1969
|
+
});
|
|
1970
|
+
Object.defineProperty(exports, "BuiltWithClarify", {
|
|
1971
|
+
enumerable: true,
|
|
1972
|
+
get: function() {
|
|
1973
|
+
return BuiltWithClarify;
|
|
1974
|
+
}
|
|
1975
|
+
});
|
|
1976
|
+
Object.defineProperty(exports, "Button", {
|
|
1977
|
+
enumerable: true,
|
|
1978
|
+
get: function() {
|
|
1979
|
+
return Button;
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1982
|
+
Object.defineProperty(exports, "ClarifyConfigContext", {
|
|
1983
|
+
enumerable: true,
|
|
1984
|
+
get: function() {
|
|
1985
|
+
return ClarifyConfigContext;
|
|
1986
|
+
}
|
|
1987
|
+
});
|
|
1988
|
+
Object.defineProperty(exports, "Code", {
|
|
1989
|
+
enumerable: true,
|
|
1990
|
+
get: function() {
|
|
1991
|
+
return Code;
|
|
1992
|
+
}
|
|
1993
|
+
});
|
|
1994
|
+
Object.defineProperty(exports, "CodeGroup", {
|
|
1995
|
+
enumerable: true,
|
|
1996
|
+
get: function() {
|
|
1997
|
+
return CodeGroup;
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
2000
|
+
Object.defineProperty(exports, "DocShell", {
|
|
2001
|
+
enumerable: true,
|
|
2002
|
+
get: function() {
|
|
2003
|
+
return DocShell;
|
|
2004
|
+
}
|
|
2005
|
+
});
|
|
2006
|
+
Object.defineProperty(exports, "Feedback", {
|
|
2007
|
+
enumerable: true,
|
|
2008
|
+
get: function() {
|
|
2009
|
+
return Feedback;
|
|
2010
|
+
}
|
|
2011
|
+
});
|
|
2012
|
+
Object.defineProperty(exports, "GridPattern", {
|
|
2013
|
+
enumerable: true,
|
|
2014
|
+
get: function() {
|
|
2015
|
+
return GridPattern;
|
|
2016
|
+
}
|
|
2017
|
+
});
|
|
2018
|
+
Object.defineProperty(exports, "Heading", {
|
|
2019
|
+
enumerable: true,
|
|
2020
|
+
get: function() {
|
|
2021
|
+
return Heading;
|
|
2022
|
+
}
|
|
2023
|
+
});
|
|
2024
|
+
Object.defineProperty(exports, "HeroPattern", {
|
|
2025
|
+
enumerable: true,
|
|
2026
|
+
get: function() {
|
|
2027
|
+
return HeroPattern;
|
|
2028
|
+
}
|
|
2029
|
+
});
|
|
2030
|
+
Object.defineProperty(exports, "Logo", {
|
|
2031
|
+
enumerable: true,
|
|
2032
|
+
get: function() {
|
|
2033
|
+
return Logo;
|
|
2034
|
+
}
|
|
2035
|
+
});
|
|
2036
|
+
Object.defineProperty(exports, "OpenApisContext", {
|
|
2037
|
+
enumerable: true,
|
|
2038
|
+
get: function() {
|
|
2039
|
+
return OpenApisContext;
|
|
2040
|
+
}
|
|
2041
|
+
});
|
|
2042
|
+
Object.defineProperty(exports, "PageFooter", {
|
|
2043
|
+
enumerable: true,
|
|
2044
|
+
get: function() {
|
|
2045
|
+
return PageFooter;
|
|
2046
|
+
}
|
|
2047
|
+
});
|
|
2048
|
+
Object.defineProperty(exports, "Pre", {
|
|
2049
|
+
enumerable: true,
|
|
2050
|
+
get: function() {
|
|
2051
|
+
return Pre;
|
|
2052
|
+
}
|
|
2053
|
+
});
|
|
2054
|
+
Object.defineProperty(exports, "Prose", {
|
|
2055
|
+
enumerable: true,
|
|
2056
|
+
get: function() {
|
|
2057
|
+
return Prose;
|
|
2058
|
+
}
|
|
2059
|
+
});
|
|
2060
|
+
Object.defineProperty(exports, "SectionProvider", {
|
|
2061
|
+
enumerable: true,
|
|
2062
|
+
get: function() {
|
|
2063
|
+
return SectionProvider;
|
|
2064
|
+
}
|
|
2065
|
+
});
|
|
2066
|
+
Object.defineProperty(exports, "Tag", {
|
|
2067
|
+
enumerable: true,
|
|
2068
|
+
get: function() {
|
|
2069
|
+
return Tag;
|
|
2070
|
+
}
|
|
2071
|
+
});
|
|
2072
|
+
Object.defineProperty(exports, "ThemeProvider", {
|
|
2073
|
+
enumerable: true,
|
|
2074
|
+
get: function() {
|
|
2075
|
+
return ThemeProvider;
|
|
2076
|
+
}
|
|
2077
|
+
});
|
|
2078
|
+
Object.defineProperty(exports, "ThemeToggle", {
|
|
2079
|
+
enumerable: true,
|
|
2080
|
+
get: function() {
|
|
2081
|
+
return ThemeToggle;
|
|
2082
|
+
}
|
|
2083
|
+
});
|
|
2084
|
+
Object.defineProperty(exports, "__exportAll", {
|
|
2085
|
+
enumerable: true,
|
|
2086
|
+
get: function() {
|
|
2087
|
+
return __exportAll;
|
|
2088
|
+
}
|
|
2089
|
+
});
|
|
2090
|
+
Object.defineProperty(exports, "__toESM", {
|
|
2091
|
+
enumerable: true,
|
|
2092
|
+
get: function() {
|
|
2093
|
+
return __toESM;
|
|
2094
|
+
}
|
|
2095
|
+
});
|
|
2096
|
+
Object.defineProperty(exports, "remToPx", {
|
|
2097
|
+
enumerable: true,
|
|
2098
|
+
get: function() {
|
|
2099
|
+
return remToPx;
|
|
2100
|
+
}
|
|
2101
|
+
});
|
|
2102
|
+
Object.defineProperty(exports, "useClarifyConfig", {
|
|
2103
|
+
enumerable: true,
|
|
2104
|
+
get: function() {
|
|
2105
|
+
return useClarifyConfig;
|
|
2106
|
+
}
|
|
2107
|
+
});
|
|
2108
|
+
Object.defineProperty(exports, "useOpenApis", {
|
|
2109
|
+
enumerable: true,
|
|
2110
|
+
get: function() {
|
|
2111
|
+
return useOpenApis;
|
|
2112
|
+
}
|
|
2113
|
+
});
|
|
2114
|
+
Object.defineProperty(exports, "useSectionStore", {
|
|
2115
|
+
enumerable: true,
|
|
2116
|
+
get: function() {
|
|
2117
|
+
return useSectionStore;
|
|
2118
|
+
}
|
|
2119
|
+
});
|
|
2120
|
+
Object.defineProperty(exports, "useTheme", {
|
|
2121
|
+
enumerable: true,
|
|
2122
|
+
get: function() {
|
|
2123
|
+
return useTheme;
|
|
2124
|
+
}
|
|
2125
|
+
});
|
|
2126
|
+
|
|
2127
|
+
//# sourceMappingURL=AppShell-DBgUlirU.cjs.map
|