@clarify-labs/renderer 0.2.0 → 0.5.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/output/AppShell-D3FsVHQK.js +390 -0
- package/output/AppShell-D3FsVHQK.js.map +1 -0
- package/output/AppShell-DeaJ-rgo.cjs +409 -0
- package/output/AppShell-DeaJ-rgo.cjs.map +1 -0
- package/output/OpenApiOperation-DYXG-6Rw.js +1772 -0
- package/output/OpenApiOperation-DYXG-6Rw.js.map +1 -0
- package/output/OpenApiOperation-mhoi-s4N.cjs +1840 -0
- package/output/OpenApiOperation-mhoi-s4N.cjs.map +1 -0
- package/output/app/PageNavigation.d.ts +7 -0
- package/output/app/PageSkeleton.d.ts +1 -0
- package/output/{components → app}/SectionProvider.d.ts +3 -2
- package/output/chunk-DakpK96I.cjs +43 -0
- package/output/client.cjs +1 -1
- package/output/client.js +1 -1
- package/output/components/Button.d.ts +18 -0
- package/output/components/Code.d.ts +11 -7
- package/output/components/Collapse.d.ts +9 -0
- package/output/components/Heading.d.ts +10 -0
- package/output/components/Logo.d.ts +2 -0
- package/output/components/Prose.d.ts +7 -0
- package/output/components/Tag.d.ts +34 -0
- package/output/components/index.d.ts +9 -79
- package/output/components/patterns.d.ts +4 -2
- package/output/context.d.ts +1 -6
- package/output/core/context.d.ts +8 -0
- package/output/core/i18n.d.ts +5 -0
- package/output/core/index.d.ts +3 -0
- package/output/core/types.d.ts +174 -0
- package/output/i18n.d.ts +1 -0
- package/output/index.cjs +135 -766
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +15 -4
- package/output/index.js +108 -751
- package/output/index.js.map +1 -1
- package/output/markdown.cjs +3 -0
- package/output/markdown.d.ts +1 -0
- package/output/markdown.js +2 -0
- package/output/mdx/DocShell.d.ts +7 -0
- package/output/mdx/Markdown.d.ts +7 -0
- package/output/mdx/components.d.ts +7 -7
- package/output/mdx/primitives.d.ts +18 -12
- package/output/mdx/remark.d.ts +2 -0
- package/output/openapi/components/ExamplePanels.d.ts +36 -0
- package/output/openapi/components/OpenApiOperation.d.ts +33 -0
- package/output/openapi/components/SchemaProperties.d.ts +20 -0
- package/output/openapi/entry.d.ts +13 -0
- package/output/openapi/index.d.ts +3 -20
- package/output/openapi/lib/helpers.d.ts +25 -0
- package/output/openapi/lib/request-code.d.ts +18 -0
- package/output/openapi/lib/spec-path.d.ts +2 -0
- package/output/openapi/types.d.ts +70 -0
- package/output/preview/openapi.d.ts +28 -0
- package/output/preview.cjs +734 -0
- package/output/preview.cjs.map +1 -0
- package/output/preview.d.ts +19 -0
- package/output/preview.js +731 -0
- package/output/preview.js.map +1 -0
- package/output/remark-DNOdJz5i.cjs +14 -0
- package/output/remark-DNOdJz5i.cjs.map +1 -0
- package/output/remark-o5sg9Ilv.js +7 -0
- package/output/remark-o5sg9Ilv.js.map +1 -0
- package/output/{render-bPMMBoDH.js → render-BpavVnAe.js} +3 -2
- package/output/render-BpavVnAe.js.map +1 -0
- package/output/{render-z9rSQ00n.cjs → render-CjZt3edL.cjs} +6 -5
- package/output/render-CjZt3edL.cjs.map +1 -0
- package/output/renderer.css +1702 -591
- package/output/server.cjs +7 -5
- package/output/server.cjs.map +1 -1
- package/output/server.js +4 -2
- package/output/server.js.map +1 -1
- package/output/shell/ContentActions.d.ts +1 -0
- package/output/shell/Header.d.ts +4 -3
- package/output/shell/Navigation.d.ts +3 -2
- package/output/shell/Search.d.ts +6 -4
- package/output/{components → shell}/SiteLogo.d.ts +1 -1
- package/output/shell/icons.d.ts +5 -0
- package/output/shell/mobile.d.ts +5 -3
- package/output/{AppShell-Ci894P_0.js → shell-BlMMdTpZ.js} +1228 -867
- package/output/shell-BlMMdTpZ.js.map +1 -0
- package/output/{AppShell-4KB3lU-n.cjs → shell-_MyLsMUI.cjs} +1403 -1036
- package/output/shell-_MyLsMUI.cjs.map +1 -0
- package/output/{components → theme}/ThemeProvider.d.ts +3 -2
- package/output/types.d.ts +1 -121
- package/output/utils/clipboard.d.ts +1 -0
- package/output/utils/hash.d.ts +1 -0
- package/output/utils/href.d.ts +5 -0
- package/output/utils/lucide.d.ts +17 -0
- package/output/utils/path.d.ts +2 -0
- package/package.json +24 -10
- package/output/AppShell-4KB3lU-n.cjs.map +0 -1
- package/output/AppShell-Ci894P_0.js.map +0 -1
- package/output/render-bPMMBoDH.js.map +0 -1
- package/output/render-z9rSQ00n.cjs.map +0 -1
- /package/output/{components → app}/BuiltWithClarify.d.ts +0 -0
- /package/output/{components → app}/PageFooter.d.ts +0 -0
- /package/output/openapi/{utils.d.ts → lib/utils.d.ts} +0 -0
- /package/output/{components → theme}/ThemeToggle.d.ts +0 -0
|
@@ -1,18 +1,580 @@
|
|
|
1
|
-
import { AnimatePresence, motion, useInView, useIsPresent, useScroll, useTransform } from "framer-motion";
|
|
2
|
-
import { Children, Fragment, Suspense, createContext, forwardRef, isValidElement, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { Link, Route, Routes, useLocation, useNavigate } from "react-router-dom";
|
|
4
|
-
import { create, createStore, useStore } from "zustand";
|
|
5
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
1
|
import clsx from "clsx";
|
|
2
|
+
import { Children, Fragment, Suspense, createContext, forwardRef, isValidElement, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { Link, useLocation, useNavigate } from "react-router-dom";
|
|
7
4
|
import { CloseButton, Dialog, DialogBackdrop, DialogPanel, Menu, MenuButton, MenuItem, MenuItems, Tab, TabGroup, TabList, TabPanel, TabPanels, Transition, TransitionChild } from "@headlessui/react";
|
|
8
5
|
import * as LucideIcons from "lucide-react";
|
|
9
|
-
import { AlertTriangle, Check, CheckCircle2, ChevronDown, Copy, Info, Lightbulb, Link2, XCircle } from "lucide-react";
|
|
6
|
+
import { AlertTriangle, Check, CheckCircle2, ChevronDown, Copy, ExternalLink, FileText, Info, Lightbulb, Link2, MoreHorizontal, XCircle } from "lucide-react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { AnimatePresence, motion, useInView, useIsPresent, useScroll, useTransform } from "framer-motion";
|
|
9
|
+
import { create, createStore, useStore } from "zustand";
|
|
10
|
+
//#region source/core/context.tsx
|
|
11
|
+
var ClarifyConfigContext = createContext(null);
|
|
12
|
+
var ClarifyLocaleContext = createContext(void 0);
|
|
13
|
+
var OpenApisContext = createContext({});
|
|
14
|
+
function useClarifyConfig() {
|
|
15
|
+
const config = useContext(ClarifyConfigContext);
|
|
16
|
+
if (!config) throw new Error("[clarify] useClarifyConfig must be used within a ClarifyConfigContext.Provider");
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
19
|
+
function useOpenApis() {
|
|
20
|
+
return useContext(OpenApisContext);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region source/core/i18n.ts
|
|
24
|
+
var builtInText = {
|
|
25
|
+
en: {
|
|
26
|
+
"actions.code": "Code",
|
|
27
|
+
"actions.copy": "Copy",
|
|
28
|
+
"actions.copied": "Copied!",
|
|
29
|
+
"builtWith.label": "Built with Clarify",
|
|
30
|
+
"builtWith.prefix": "Built with",
|
|
31
|
+
"callout.danger": "Danger",
|
|
32
|
+
"callout.info": "Info",
|
|
33
|
+
"callout.note": "Note",
|
|
34
|
+
"callout.success": "Success",
|
|
35
|
+
"callout.tip": "Tip",
|
|
36
|
+
"callout.warning": "Warning",
|
|
37
|
+
"contentActions.copyContent": "Copy page",
|
|
38
|
+
"contentActions.copyContentDescription": "Copy this page as {contentType} for LLMs",
|
|
39
|
+
"contentActions.copyLink": "Copy {contentType} link",
|
|
40
|
+
"contentActions.copyLinkDescription": "Copy the raw {contentType} content link for this page",
|
|
41
|
+
"contentActions.copyLlms": "Copy llms.txt",
|
|
42
|
+
"contentActions.copyLlmsDescription": "Copy the llms.txt link for this site",
|
|
43
|
+
"contentActions.copiedLlms": "Copied llms.txt",
|
|
44
|
+
"contentActions.copyOptions": "Choose copy option",
|
|
45
|
+
"contentActions.copiedContent": "Copied page",
|
|
46
|
+
"contentActions.copiedLink": "Copied link",
|
|
47
|
+
"contentActions.viewMarkdown": "View as Markdown",
|
|
48
|
+
"contentActions.viewMarkdownDescription": "View this page as plain text",
|
|
49
|
+
"contentActions.viewOpenApi": "View raw OpenAPI",
|
|
50
|
+
"contentActions.viewOpenApiDescription": "Open the API description file in a new tab",
|
|
51
|
+
"feedback.no": "No",
|
|
52
|
+
"feedback.prompt": "Was this page helpful?",
|
|
53
|
+
"feedback.thanks": "Thanks for your feedback!",
|
|
54
|
+
"feedback.yes": "Yes",
|
|
55
|
+
"navigation.documentation": "Documentation",
|
|
56
|
+
"navigation.next": "Next",
|
|
57
|
+
"navigation.previous": "Previous",
|
|
58
|
+
"navigation.previousNext": "Previous and next pages",
|
|
59
|
+
"navigation.toggle": "Toggle navigation",
|
|
60
|
+
"navbar.home": "Home",
|
|
61
|
+
"navbar.openLinks": "Open navigation links",
|
|
62
|
+
"navbar.sections": "Documentation sections",
|
|
63
|
+
"openapi.apiDocumentation": "API Documentation",
|
|
64
|
+
"openapi.bodyProperties": "Body properties",
|
|
65
|
+
"openapi.collapse": "Collapse",
|
|
66
|
+
"openapi.endpointNotFound": "Endpoint not found: {endpoint}",
|
|
67
|
+
"openapi.example": "Example",
|
|
68
|
+
"openapi.expand": "Expand",
|
|
69
|
+
"openapi.headers": "Headers",
|
|
70
|
+
"openapi.language": "Language",
|
|
71
|
+
"openapi.client": "Client",
|
|
72
|
+
"openapi.mediaType": "Media type",
|
|
73
|
+
"openapi.openApiReference": "OpenAPI Reference",
|
|
74
|
+
"openapi.operationParameter": "Operation parameter.",
|
|
75
|
+
"openapi.optional": "Optional.",
|
|
76
|
+
"openapi.parameter": "parameter",
|
|
77
|
+
"openapi.pathParameters": "Path parameters",
|
|
78
|
+
"openapi.queryParameters": "Query parameters",
|
|
79
|
+
"openapi.request": "Request",
|
|
80
|
+
"openapi.requestBody": "Request body",
|
|
81
|
+
"openapi.required": "Required.",
|
|
82
|
+
"openapi.requiredBadge": "required",
|
|
83
|
+
"openapi.response": "Response",
|
|
84
|
+
"openapi.responses": "Responses",
|
|
85
|
+
"openapi.schemaExample": "Schema example",
|
|
86
|
+
"openapi.scrollExamplesLeft": "Scroll examples left",
|
|
87
|
+
"openapi.scrollExamplesRight": "Scroll examples right",
|
|
88
|
+
"openapi.specNotFound": "OpenAPI spec not found: {specPath}",
|
|
89
|
+
"openapi.specPathMissing": "spec or specPath was not provided",
|
|
90
|
+
"openapi.status": "Status",
|
|
91
|
+
"openapi.version": "Version {version}",
|
|
92
|
+
"search.button": "Search...",
|
|
93
|
+
"search.noResults": "Nothing found for {query}.",
|
|
94
|
+
"search.placeholder": "Find something...",
|
|
95
|
+
"search.shortcutCtrl": "Ctrl ",
|
|
96
|
+
"theme.switchToDark": "Switch to dark theme",
|
|
97
|
+
"theme.switchToLight": "Switch to light theme",
|
|
98
|
+
"language.switch": "Switch language"
|
|
99
|
+
},
|
|
100
|
+
"zh-CN": {
|
|
101
|
+
"actions.code": "代码",
|
|
102
|
+
"actions.copy": "复制",
|
|
103
|
+
"actions.copied": "已复制!",
|
|
104
|
+
"builtWith.label": "由 Clarify 构建",
|
|
105
|
+
"builtWith.prefix": "构建来自",
|
|
106
|
+
"callout.danger": "危险",
|
|
107
|
+
"callout.info": "信息",
|
|
108
|
+
"callout.note": "注意",
|
|
109
|
+
"callout.success": "成功",
|
|
110
|
+
"callout.tip": "提示",
|
|
111
|
+
"callout.warning": "警告",
|
|
112
|
+
"contentActions.copyContent": "复制页面",
|
|
113
|
+
"contentActions.copyContentDescription": "将页面以 {contentType} 格式复制给 LLMs",
|
|
114
|
+
"contentActions.copyLink": "复制 {contentType} 链接",
|
|
115
|
+
"contentActions.copyLinkDescription": "复制当前页面的 {contentType} 原始内容链接",
|
|
116
|
+
"contentActions.copyLlms": "复制 llms.txt",
|
|
117
|
+
"contentActions.copyLlmsDescription": "复制此站点的 llms.txt 链接",
|
|
118
|
+
"contentActions.copiedLlms": "已复制 llms.txt",
|
|
119
|
+
"contentActions.copyOptions": "选择复制选项",
|
|
120
|
+
"contentActions.copiedContent": "已复制页面",
|
|
121
|
+
"contentActions.copiedLink": "已复制链接",
|
|
122
|
+
"contentActions.viewMarkdown": "以 Markdown 格式查看",
|
|
123
|
+
"contentActions.viewMarkdownDescription": "以纯文本查看此页面",
|
|
124
|
+
"contentActions.viewOpenApi": "查看 OpenAPI 原始内容",
|
|
125
|
+
"contentActions.viewOpenApiDescription": "在新标签页打开 API 描述文件",
|
|
126
|
+
"feedback.no": "否",
|
|
127
|
+
"feedback.prompt": "这个页面有帮助吗?",
|
|
128
|
+
"feedback.thanks": "感谢你的反馈!",
|
|
129
|
+
"feedback.yes": "是",
|
|
130
|
+
"navigation.documentation": "文档",
|
|
131
|
+
"navigation.next": "下一页",
|
|
132
|
+
"navigation.previous": "上一页",
|
|
133
|
+
"navigation.previousNext": "上一页和下一页",
|
|
134
|
+
"navigation.toggle": "切换导航",
|
|
135
|
+
"navbar.home": "首页",
|
|
136
|
+
"navbar.openLinks": "打开导航链接",
|
|
137
|
+
"navbar.sections": "文档栏目",
|
|
138
|
+
"openapi.apiDocumentation": "API 文档",
|
|
139
|
+
"openapi.bodyProperties": "请求体属性",
|
|
140
|
+
"openapi.collapse": "收起",
|
|
141
|
+
"openapi.endpointNotFound": "未找到端点:{endpoint}",
|
|
142
|
+
"openapi.example": "示例",
|
|
143
|
+
"openapi.expand": "展开",
|
|
144
|
+
"openapi.headers": "请求头",
|
|
145
|
+
"openapi.language": "语言",
|
|
146
|
+
"openapi.client": "客户端",
|
|
147
|
+
"openapi.mediaType": "媒体类型",
|
|
148
|
+
"openapi.openApiReference": "OpenAPI 参考",
|
|
149
|
+
"openapi.operationParameter": "操作参数。",
|
|
150
|
+
"openapi.optional": "可选。",
|
|
151
|
+
"openapi.parameter": "参数",
|
|
152
|
+
"openapi.pathParameters": "路径参数",
|
|
153
|
+
"openapi.queryParameters": "查询参数",
|
|
154
|
+
"openapi.request": "请求",
|
|
155
|
+
"openapi.requestBody": "请求体",
|
|
156
|
+
"openapi.required": "必填。",
|
|
157
|
+
"openapi.requiredBadge": "必填",
|
|
158
|
+
"openapi.response": "响应",
|
|
159
|
+
"openapi.responses": "响应",
|
|
160
|
+
"openapi.schemaExample": "Schema 示例",
|
|
161
|
+
"openapi.scrollExamplesLeft": "向左滚动示例",
|
|
162
|
+
"openapi.scrollExamplesRight": "向右滚动示例",
|
|
163
|
+
"openapi.specNotFound": "未找到 OpenAPI 描述文件:{specPath}",
|
|
164
|
+
"openapi.specPathMissing": "未提供 spec 或 specPath",
|
|
165
|
+
"openapi.status": "状态",
|
|
166
|
+
"openapi.version": "版本 {version}",
|
|
167
|
+
"search.button": "搜索...",
|
|
168
|
+
"search.noResults": "没有找到与 {query} 相关的结果。",
|
|
169
|
+
"search.placeholder": "搜索内容...",
|
|
170
|
+
"search.shortcutCtrl": "Ctrl ",
|
|
171
|
+
"theme.switchToDark": "切换到深色主题",
|
|
172
|
+
"theme.switchToLight": "切换到浅色主题",
|
|
173
|
+
"language.switch": "切换语言"
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
function resolveBuiltInLocale(locale) {
|
|
177
|
+
return locale === "zh-CN" || locale?.toLowerCase().startsWith("zh") ? "zh-CN" : "en";
|
|
178
|
+
}
|
|
179
|
+
function translateBuiltInText(locale, key, replacements = {}) {
|
|
180
|
+
let value = builtInText[resolveBuiltInLocale(locale)]?.[key] ?? builtInText.en[key];
|
|
181
|
+
for (const [name, replacement] of Object.entries(replacements)) value = value.replaceAll(`{${name}}`, replacement);
|
|
182
|
+
return value;
|
|
183
|
+
}
|
|
184
|
+
function useBuiltInText(locale) {
|
|
185
|
+
const config = useContext(ClarifyConfigContext);
|
|
186
|
+
const currentLocale = useContext(ClarifyLocaleContext);
|
|
187
|
+
const resolvedLocale = locale ?? currentLocale ?? config?.i18n?.defaultLocale;
|
|
188
|
+
return (key, replacements) => translateBuiltInText(resolvedLocale, key, replacements);
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region source/utils/clipboard.ts
|
|
192
|
+
async function copyTextToClipboard(text) {
|
|
193
|
+
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) try {
|
|
194
|
+
await navigator.clipboard.writeText(text);
|
|
195
|
+
return true;
|
|
196
|
+
} catch {}
|
|
197
|
+
if (typeof document === "undefined") return false;
|
|
198
|
+
const textarea = document.createElement("textarea");
|
|
199
|
+
textarea.value = text;
|
|
200
|
+
textarea.setAttribute("readonly", "");
|
|
201
|
+
textarea.style.position = "fixed";
|
|
202
|
+
textarea.style.top = "-9999px";
|
|
203
|
+
textarea.style.opacity = "0";
|
|
204
|
+
document.body.appendChild(textarea);
|
|
205
|
+
try {
|
|
206
|
+
textarea.select();
|
|
207
|
+
return document.execCommand("copy");
|
|
208
|
+
} catch {
|
|
209
|
+
return false;
|
|
210
|
+
} finally {
|
|
211
|
+
textarea.remove();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region source/utils/href.ts
|
|
216
|
+
function isExternalHref(href) {
|
|
217
|
+
return /^[a-z][a-z\d+.-]*:/i.test(href) || href.startsWith("//");
|
|
218
|
+
}
|
|
219
|
+
function hasLocalePrefix(href, config) {
|
|
220
|
+
const firstSegment = href.replace(/^\/+/, "").split("/")[0];
|
|
221
|
+
return Boolean(firstSegment && config.i18n?.locales.some((locale) => locale.code === firstSegment));
|
|
222
|
+
}
|
|
223
|
+
function localizeHref(href, config, locale) {
|
|
224
|
+
if (!locale || !config.i18n || isExternalHref(href) || href.startsWith("#")) return href;
|
|
225
|
+
if (locale === config.i18n.defaultLocale || hasLocalePrefix(href, config)) return href;
|
|
226
|
+
const cleanHref = href === "/" ? "" : href.replace(/^\/+/, "");
|
|
227
|
+
return `/${locale}${cleanHref ? `/${cleanHref}` : ""}`;
|
|
228
|
+
}
|
|
229
|
+
function prefixHref(href, routePrefix = "/") {
|
|
230
|
+
if (isExternalHref(href) || href.startsWith("#")) return href;
|
|
231
|
+
if (!routePrefix || routePrefix === "/") return href.startsWith("/") ? href : `/${href}`;
|
|
232
|
+
const prefix = routePrefix.replace(/^\/+|\/+$/g, "");
|
|
233
|
+
const path = href.replace(/^\/+/, "");
|
|
234
|
+
if (!path) return `/${prefix}`;
|
|
235
|
+
if (path === prefix || path.startsWith(`${prefix}/`)) return `/${path}`;
|
|
236
|
+
return `/${prefix}/${path}`;
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region source/shell/ContentActions.tsx
|
|
240
|
+
function resolveContentArtifactUrl(contentArtifactUrl, routePrefix = "/") {
|
|
241
|
+
return prefixHref(contentArtifactUrl, routePrefix);
|
|
242
|
+
}
|
|
243
|
+
function getAbsoluteUrl(path) {
|
|
244
|
+
if (typeof window === "undefined") return path;
|
|
245
|
+
return new URL(path, window.location.href).href;
|
|
246
|
+
}
|
|
247
|
+
function ContentActions(arg0) {
|
|
248
|
+
const { hasTabs = false, route, routePrefix } = arg0;
|
|
249
|
+
const t = useBuiltInText();
|
|
250
|
+
const [copied, setCopied] = useState("idle");
|
|
251
|
+
if (!route?.contentArtifactUrl) return null;
|
|
252
|
+
const contentArtifactUrl = resolveContentArtifactUrl(route.contentArtifactUrl, routePrefix);
|
|
253
|
+
const isOpenApi = route.kind === "openapi";
|
|
254
|
+
const replacements = { contentType: isOpenApi ? "OpenAPI" : "Markdown" };
|
|
255
|
+
const viewLabel = isOpenApi ? t("contentActions.viewOpenApi") : t("contentActions.viewMarkdown");
|
|
256
|
+
const viewDescription = isOpenApi ? t("contentActions.viewOpenApiDescription") : t("contentActions.viewMarkdownDescription");
|
|
257
|
+
function markCopied(state) {
|
|
258
|
+
setCopied(state);
|
|
259
|
+
window.setTimeout(() => setCopied("idle"), 1600);
|
|
260
|
+
}
|
|
261
|
+
async function handleCopyContent() {
|
|
262
|
+
if (await copyTextToClipboard(await (await fetch(contentArtifactUrl)).text())) markCopied("content");
|
|
263
|
+
}
|
|
264
|
+
const llmsArtifactUrl = resolveContentArtifactUrl("/llms.txt", routePrefix);
|
|
265
|
+
async function handleCopyLink() {
|
|
266
|
+
if (await copyTextToClipboard(getAbsoluteUrl(contentArtifactUrl))) markCopied("link");
|
|
267
|
+
}
|
|
268
|
+
async function handleCopyLlms() {
|
|
269
|
+
if (await copyTextToClipboard(getAbsoluteUrl(llmsArtifactUrl))) markCopied("llms");
|
|
270
|
+
}
|
|
271
|
+
const actions = [{
|
|
272
|
+
key: "content",
|
|
273
|
+
label: t("contentActions.copyContent"),
|
|
274
|
+
description: t("contentActions.copyContentDescription", replacements),
|
|
275
|
+
icon: Copy,
|
|
276
|
+
run: handleCopyContent,
|
|
277
|
+
copiedLabel: t("contentActions.copiedContent")
|
|
278
|
+
}, {
|
|
279
|
+
key: "link",
|
|
280
|
+
label: t("contentActions.copyLink", replacements),
|
|
281
|
+
description: t("contentActions.copyLinkDescription", replacements),
|
|
282
|
+
icon: Link2,
|
|
283
|
+
run: handleCopyLink,
|
|
284
|
+
copiedLabel: t("contentActions.copiedLink")
|
|
285
|
+
}];
|
|
286
|
+
const llmsAction = {
|
|
287
|
+
key: "llms",
|
|
288
|
+
label: t("contentActions.copyLlms"),
|
|
289
|
+
description: t("contentActions.copyLlmsDescription"),
|
|
290
|
+
icon: FileText,
|
|
291
|
+
run: handleCopyLlms,
|
|
292
|
+
copiedLabel: t("contentActions.copiedLlms")
|
|
293
|
+
};
|
|
294
|
+
const primaryAction = actions[0];
|
|
295
|
+
const PrimaryIcon = copied === primaryAction.key ? Check : primaryAction.icon;
|
|
296
|
+
return /* @__PURE__ */ jsx("div", {
|
|
297
|
+
className: `clarify-content-actions sticky z-20 flex justify-end py-4 ${hasTabs ? "top-16 lg:top-30" : "top-16"}`,
|
|
298
|
+
children: /* @__PURE__ */ jsxs(Menu, {
|
|
299
|
+
as: "div",
|
|
300
|
+
className: "clarify-content-actions-menu relative inline-flex text-sm font-medium",
|
|
301
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
302
|
+
className: "clarify-content-actions-group inline-flex overflow-hidden rounded-full border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface)/90 shadow-sm shadow-zinc-900/5 backdrop-blur dark:border-white/10 dark:bg-zinc-900/80 dark:shadow-none",
|
|
303
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
304
|
+
type: "button",
|
|
305
|
+
onClick: primaryAction.run,
|
|
306
|
+
className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 items-center gap-1.5 px-3 transition",
|
|
307
|
+
children: [/* @__PURE__ */ jsx(PrimaryIcon, { className: "h-3.5 w-3.5" }), copied === primaryAction.key ? t("actions.copied") : primaryAction.label]
|
|
308
|
+
}), /* @__PURE__ */ jsx(MenuButton, {
|
|
309
|
+
className: "clarify-content-actions-trigger clarify-ui-control inline-flex h-8 w-8 items-center justify-center border-l border-(--clarify-theme-tokens-colors-border) transition dark:border-white/10",
|
|
310
|
+
"aria-label": t("contentActions.copyOptions"),
|
|
311
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5" })
|
|
312
|
+
})]
|
|
313
|
+
}), /* @__PURE__ */ jsxs(MenuItems, {
|
|
314
|
+
anchor: "bottom end",
|
|
315
|
+
className: "clarify-content-actions-list clarify-ui-menu z-30 mt-2 w-(--clarify-ui-action-menu-width) origin-top-right rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-1.5 shadow-xl shadow-zinc-900/5 transition [--anchor-gap:--spacing(2)] focus:outline-none data-closed:scale-95 data-closed:opacity-0 dark:border-white/10 dark:bg-zinc-900 dark:shadow-none",
|
|
316
|
+
children: [
|
|
317
|
+
actions.slice(0, 1).map((action) => {
|
|
318
|
+
const Icon = action.icon;
|
|
319
|
+
const isCopied = copied === action.key;
|
|
320
|
+
return /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsxs("button", {
|
|
321
|
+
type: "button",
|
|
322
|
+
onClick: action.run,
|
|
323
|
+
className: "clarify-content-actions-item clarify-ui-menu-item group flex w-full items-center gap-2 rounded-(--clarify-theme-tokens-radius-lg) px-1.5 py-1.5 text-left transition",
|
|
324
|
+
children: [
|
|
325
|
+
/* @__PURE__ */ jsx("span", {
|
|
326
|
+
className: "clarify-ui-menu-icon flex shrink-0 rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) p-1.5 dark:border-white/10",
|
|
327
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" })
|
|
328
|
+
}),
|
|
329
|
+
/* @__PURE__ */ jsxs("span", {
|
|
330
|
+
className: "flex min-w-0 flex-1 flex-col px-1",
|
|
331
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
332
|
+
className: "clarify-ui-menu-title",
|
|
333
|
+
children: isCopied ? t("contentActions.copiedContent") : action.label
|
|
334
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
335
|
+
className: "clarify-ui-menu-description truncate",
|
|
336
|
+
children: action.description
|
|
337
|
+
})]
|
|
338
|
+
}),
|
|
339
|
+
/* @__PURE__ */ jsx(Check, { className: `h-3.5 w-3.5 shrink-0 text-(--clarify-theme-tokens-colors-primary) transition ${isCopied ? "opacity-100" : "opacity-0"}` })
|
|
340
|
+
]
|
|
341
|
+
}) }, action.key);
|
|
342
|
+
}),
|
|
343
|
+
/* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsxs("a", {
|
|
344
|
+
href: contentArtifactUrl,
|
|
345
|
+
target: "_blank",
|
|
346
|
+
rel: "noreferrer",
|
|
347
|
+
className: "clarify-content-actions-item clarify-ui-menu-item group flex w-full items-center gap-2 rounded-(--clarify-theme-tokens-radius-lg) px-1.5 py-1.5 text-left no-underline transition",
|
|
348
|
+
children: [
|
|
349
|
+
/* @__PURE__ */ jsx("span", {
|
|
350
|
+
className: "clarify-ui-menu-icon flex shrink-0 rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) p-1.5 dark:border-white/10",
|
|
351
|
+
children: /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" })
|
|
352
|
+
}),
|
|
353
|
+
/* @__PURE__ */ jsxs("span", {
|
|
354
|
+
className: "flex min-w-0 flex-1 flex-col px-1",
|
|
355
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
356
|
+
className: "clarify-ui-menu-title flex items-center gap-1",
|
|
357
|
+
children: [viewLabel, /* @__PURE__ */ jsx(ExternalLink, { className: "clarify-ui-menu-icon h-3 w-3" })]
|
|
358
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
359
|
+
className: "clarify-ui-menu-description truncate",
|
|
360
|
+
children: viewDescription
|
|
361
|
+
})]
|
|
362
|
+
}),
|
|
363
|
+
/* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 shrink-0 text-(--clarify-theme-tokens-colors-primary) opacity-0" })
|
|
364
|
+
]
|
|
365
|
+
}) }),
|
|
366
|
+
actions.slice(1).map((action) => {
|
|
367
|
+
const Icon = action.icon;
|
|
368
|
+
const isCopied = copied === action.key;
|
|
369
|
+
return /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsxs("button", {
|
|
370
|
+
type: "button",
|
|
371
|
+
onClick: action.run,
|
|
372
|
+
className: "clarify-content-actions-item clarify-ui-menu-item group flex w-full items-center gap-2 rounded-(--clarify-theme-tokens-radius-lg) px-1.5 py-1.5 text-left transition",
|
|
373
|
+
children: [
|
|
374
|
+
/* @__PURE__ */ jsx("span", {
|
|
375
|
+
className: "clarify-ui-menu-icon flex shrink-0 rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) p-1.5 dark:border-white/10",
|
|
376
|
+
children: /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" })
|
|
377
|
+
}),
|
|
378
|
+
/* @__PURE__ */ jsxs("span", {
|
|
379
|
+
className: "flex min-w-0 flex-1 flex-col px-1",
|
|
380
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
381
|
+
className: "clarify-ui-menu-title",
|
|
382
|
+
children: isCopied ? action.copiedLabel ?? action.label : action.label
|
|
383
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
384
|
+
className: "clarify-ui-menu-description truncate",
|
|
385
|
+
children: action.description
|
|
386
|
+
})]
|
|
387
|
+
}),
|
|
388
|
+
/* @__PURE__ */ jsx(Check, { className: `h-3.5 w-3.5 shrink-0 text-(--clarify-theme-tokens-colors-primary) transition ${isCopied ? "opacity-100" : "opacity-0"}` })
|
|
389
|
+
]
|
|
390
|
+
}) }, action.key);
|
|
391
|
+
}),
|
|
392
|
+
/* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsxs("button", {
|
|
393
|
+
type: "button",
|
|
394
|
+
onClick: llmsAction.run,
|
|
395
|
+
className: "clarify-content-actions-item clarify-ui-menu-item group flex w-full items-center gap-2 rounded-(--clarify-theme-tokens-radius-lg) px-1.5 py-1.5 text-left transition",
|
|
396
|
+
children: [
|
|
397
|
+
/* @__PURE__ */ jsx("span", {
|
|
398
|
+
className: "clarify-ui-menu-icon flex shrink-0 rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) p-1.5 dark:border-white/10",
|
|
399
|
+
children: /* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" })
|
|
400
|
+
}),
|
|
401
|
+
/* @__PURE__ */ jsxs("span", {
|
|
402
|
+
className: "flex min-w-0 flex-1 flex-col px-1",
|
|
403
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
404
|
+
className: "clarify-ui-menu-title",
|
|
405
|
+
children: copied === llmsAction.key ? llmsAction.copiedLabel ?? llmsAction.label : llmsAction.label
|
|
406
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
407
|
+
className: "clarify-ui-menu-description truncate",
|
|
408
|
+
children: llmsAction.description
|
|
409
|
+
})]
|
|
410
|
+
}),
|
|
411
|
+
/* @__PURE__ */ jsx(Check, { className: `h-3.5 w-3.5 shrink-0 text-(--clarify-theme-tokens-colors-primary) transition ${copied === llmsAction.key ? "opacity-100" : "opacity-0"}` })
|
|
412
|
+
]
|
|
413
|
+
}) }, llmsAction.key)
|
|
414
|
+
]
|
|
415
|
+
})]
|
|
416
|
+
})
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region source/theme/ThemeProvider.tsx
|
|
421
|
+
var ThemeContext = createContext(null);
|
|
422
|
+
var storageKey = "clarify:theme";
|
|
423
|
+
function getSystemTheme() {
|
|
424
|
+
if (typeof window === "undefined") return "light";
|
|
425
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
426
|
+
}
|
|
427
|
+
function getStoredTheme() {
|
|
428
|
+
if (typeof window === "undefined") return "system";
|
|
429
|
+
try {
|
|
430
|
+
const storedTheme = window.localStorage.getItem(storageKey);
|
|
431
|
+
return storedTheme === "light" || storedTheme === "dark" || storedTheme === "system" ? storedTheme : "system";
|
|
432
|
+
} catch {
|
|
433
|
+
return "system";
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
function storeTheme(theme) {
|
|
437
|
+
if (typeof window === "undefined") return;
|
|
438
|
+
try {
|
|
439
|
+
window.localStorage.setItem(storageKey, theme);
|
|
440
|
+
} catch {}
|
|
441
|
+
}
|
|
442
|
+
function applyTheme(resolvedTheme) {
|
|
443
|
+
if (typeof document === "undefined") return;
|
|
444
|
+
document.documentElement.classList.toggle("dark", resolvedTheme === "dark");
|
|
445
|
+
document.documentElement.style.colorScheme = resolvedTheme;
|
|
446
|
+
}
|
|
447
|
+
function ThemeProvider(arg0) {
|
|
448
|
+
const { children } = arg0;
|
|
449
|
+
const [theme, setThemeState] = useState(() => getStoredTheme());
|
|
450
|
+
const [systemTheme, setSystemTheme] = useState(() => getSystemTheme());
|
|
451
|
+
const resolvedTheme = theme === "system" ? systemTheme : theme;
|
|
452
|
+
useEffect(() => {
|
|
453
|
+
applyTheme(resolvedTheme);
|
|
454
|
+
}, [resolvedTheme]);
|
|
455
|
+
useEffect(() => {
|
|
456
|
+
if (typeof window === "undefined") return;
|
|
457
|
+
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
458
|
+
function updateSystemTheme() {
|
|
459
|
+
setSystemTheme(mediaQuery.matches ? "dark" : "light");
|
|
460
|
+
}
|
|
461
|
+
updateSystemTheme();
|
|
462
|
+
mediaQuery.addEventListener("change", updateSystemTheme);
|
|
463
|
+
return () => mediaQuery.removeEventListener("change", updateSystemTheme);
|
|
464
|
+
}, []);
|
|
465
|
+
const value = useMemo(() => ({
|
|
466
|
+
theme,
|
|
467
|
+
resolvedTheme,
|
|
468
|
+
setTheme(nextTheme) {
|
|
469
|
+
setThemeState(nextTheme);
|
|
470
|
+
storeTheme(nextTheme);
|
|
471
|
+
}
|
|
472
|
+
}), [resolvedTheme, theme]);
|
|
473
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
474
|
+
value,
|
|
475
|
+
children
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
function useTheme() {
|
|
479
|
+
const context = useContext(ThemeContext);
|
|
480
|
+
if (!context) throw new Error("[clarify] useTheme must be used within ThemeProvider");
|
|
481
|
+
return context;
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region source/theme/ThemeToggle.tsx
|
|
485
|
+
function SunIcon(props) {
|
|
486
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
487
|
+
viewBox: "0 0 20 20",
|
|
488
|
+
fill: "none",
|
|
489
|
+
"aria-hidden": "true",
|
|
490
|
+
...props,
|
|
491
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M12.5 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z" }), /* @__PURE__ */ jsx("path", {
|
|
492
|
+
strokeLinecap: "round",
|
|
493
|
+
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"
|
|
494
|
+
})]
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
function MoonIcon(props) {
|
|
498
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
499
|
+
viewBox: "0 0 20 20",
|
|
500
|
+
fill: "none",
|
|
501
|
+
"aria-hidden": "true",
|
|
502
|
+
...props,
|
|
503
|
+
children: /* @__PURE__ */ 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" })
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
function ThemeToggle() {
|
|
507
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
508
|
+
const t = useBuiltInText();
|
|
509
|
+
const otherTheme = resolvedTheme === "dark" ? "light" : "dark";
|
|
510
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
511
|
+
type: "button",
|
|
512
|
+
className: "clarify-theme-toggle relative flex size-8 items-center justify-center rounded-(--clarify-theme-tokens-radius-md) transition hover:bg-[color-mix(in_srgb,var(--clarify-theme-tokens-colors-foreground)_5%,transparent)] dark:hover:bg-white/5",
|
|
513
|
+
"aria-label": otherTheme === "dark" ? t("theme.switchToDark") : t("theme.switchToLight"),
|
|
514
|
+
onClick: () => setTheme(otherTheme),
|
|
515
|
+
children: [
|
|
516
|
+
/* @__PURE__ */ jsx("span", { className: "absolute size-12 pointer-fine:hidden" }),
|
|
517
|
+
/* @__PURE__ */ jsx(SunIcon, { className: "h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:hidden" }),
|
|
518
|
+
/* @__PURE__ */ jsx(MoonIcon, { className: "hidden h-5 w-5 stroke-white dark:block" })
|
|
519
|
+
]
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
//#endregion
|
|
523
|
+
//#region source/utils/path.ts
|
|
524
|
+
function normalizeRoutePath(path) {
|
|
525
|
+
const [pathname, suffix = ""] = path.split(/([?#].*)/, 2);
|
|
526
|
+
return `${pathname.replace(/^\/+/, "/").replace(/\/+$/, "") || "/"}${suffix}`;
|
|
527
|
+
}
|
|
528
|
+
function isSameRoutePath(a, b) {
|
|
529
|
+
if (!a || !b) return false;
|
|
530
|
+
return normalizeRoutePath(a) === normalizeRoutePath(b);
|
|
531
|
+
}
|
|
532
|
+
//#endregion
|
|
533
|
+
//#region source/utils/lucide.ts
|
|
534
|
+
/**
|
|
535
|
+
* Registry of all Lucide icon components keyed by their PascalCase export name.
|
|
536
|
+
*
|
|
537
|
+
* Access icons via index lookup (e.g. `lucideIconRegistry[name]`) so React
|
|
538
|
+
* tooling does not mistake the access for a component created during render.
|
|
539
|
+
*/
|
|
540
|
+
var lucideIconRegistry = LucideIcons;
|
|
541
|
+
function toPascalCase(value) {
|
|
542
|
+
return value.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join("");
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Resolve an icon name into the matching Lucide registry key.
|
|
546
|
+
*
|
|
547
|
+
* Accepts both the exact PascalCase export name (e.g. `ArrowRight`) and
|
|
548
|
+
* kebab/space/snake variants (e.g. `arrow-right`), returning `undefined`
|
|
549
|
+
* when no matching icon exists.
|
|
550
|
+
*/
|
|
551
|
+
function resolveLucideIconName(name) {
|
|
552
|
+
if (!name) return void 0;
|
|
553
|
+
if (lucideIconRegistry[name]) return name;
|
|
554
|
+
const pascalName = toPascalCase(name);
|
|
555
|
+
return lucideIconRegistry[pascalName] ? pascalName : void 0;
|
|
556
|
+
}
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region source/shell/icons.tsx
|
|
559
|
+
function NavigationIcon(arg0) {
|
|
560
|
+
const { name, className } = arg0;
|
|
561
|
+
if (!name) return null;
|
|
562
|
+
const iconName = resolveLucideIconName(name);
|
|
563
|
+
if (!iconName) return null;
|
|
564
|
+
const Icon = lucideIconRegistry[iconName];
|
|
565
|
+
if (!Icon) return null;
|
|
566
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
567
|
+
className: clsx("shrink-0 stroke-current", className),
|
|
568
|
+
"aria-hidden": "true"
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
//#endregion
|
|
10
572
|
//#region source/utils/remToPx.ts
|
|
11
573
|
function remToPx(remValue) {
|
|
12
574
|
return remValue * (typeof window === "undefined" ? 16 : Number.parseFloat(window.getComputedStyle(document.documentElement).fontSize));
|
|
13
575
|
}
|
|
14
576
|
//#endregion
|
|
15
|
-
//#region source/
|
|
577
|
+
//#region source/app/SectionProvider.tsx
|
|
16
578
|
function createSectionStore(sections) {
|
|
17
579
|
return createStore()((set) => ({
|
|
18
580
|
sections,
|
|
@@ -31,16 +593,16 @@ function useVisibleSections(sectionStore) {
|
|
|
31
593
|
useEffect(() => {
|
|
32
594
|
function checkVisibleSections() {
|
|
33
595
|
const { innerHeight, scrollY } = window;
|
|
596
|
+
const viewportTop = scrollY;
|
|
597
|
+
const viewportBottom = scrollY + innerHeight;
|
|
34
598
|
const newVisibleSections = [];
|
|
35
599
|
for (let sectionIndex = 0; sectionIndex < sections.length; sectionIndex += 1) {
|
|
36
600
|
const { id, headingRef, offsetRem = 0 } = sections[sectionIndex];
|
|
37
601
|
if (!headingRef?.current) continue;
|
|
38
602
|
const offset = remToPx(offsetRem);
|
|
39
603
|
const top = headingRef.current.getBoundingClientRect().top + scrollY;
|
|
40
|
-
if (sectionIndex === 0 && top - offset >
|
|
41
|
-
|
|
42
|
-
const bottom = (nextSection?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY - remToPx(nextSection?.offsetRem ?? 0);
|
|
43
|
-
if (top > scrollY && top < scrollY + innerHeight || bottom > scrollY && bottom < scrollY + innerHeight || top <= scrollY && bottom >= scrollY + innerHeight) newVisibleSections.push(id);
|
|
604
|
+
if (sectionIndex === 0 && top - offset > viewportTop) newVisibleSections.push("_top");
|
|
605
|
+
if ((sections[sectionIndex + 1]?.headingRef?.current?.getBoundingClientRect().top ?? Infinity) + scrollY > viewportTop && top < viewportBottom) newVisibleSections.push(id);
|
|
44
606
|
}
|
|
45
607
|
setVisibleSections(newVisibleSections);
|
|
46
608
|
}
|
|
@@ -61,7 +623,17 @@ function SectionProvider(arg0) {
|
|
|
61
623
|
const [sectionStore] = useState(() => createSectionStore(sections));
|
|
62
624
|
useVisibleSections(sectionStore);
|
|
63
625
|
useIsomorphicLayoutEffect(() => {
|
|
64
|
-
sectionStore.setState(
|
|
626
|
+
sectionStore.setState((state) => ({
|
|
627
|
+
sections: sections.map((section) => {
|
|
628
|
+
const registeredSection = state.sections.find((item) => item.id === section.id);
|
|
629
|
+
return {
|
|
630
|
+
...section,
|
|
631
|
+
headingRef: registeredSection?.headingRef,
|
|
632
|
+
offsetRem: registeredSection?.offsetRem ?? section.offsetRem
|
|
633
|
+
};
|
|
634
|
+
}),
|
|
635
|
+
visibleSections: []
|
|
636
|
+
}));
|
|
65
637
|
}, [sectionStore, sections]);
|
|
66
638
|
return /* @__PURE__ */ jsx(SectionStoreContext.Provider, {
|
|
67
639
|
value: sectionStore,
|
|
@@ -74,151 +646,46 @@ function useSectionStore(selector) {
|
|
|
74
646
|
return useStore(store, selector);
|
|
75
647
|
}
|
|
76
648
|
//#endregion
|
|
77
|
-
//#region source/components/
|
|
78
|
-
function
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
src: lightLogo,
|
|
91
|
-
alt: "",
|
|
92
|
-
className: clsx("clarify-logo", className)
|
|
649
|
+
//#region source/components/Button.tsx
|
|
650
|
+
function ArrowIcon(props) {
|
|
651
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
652
|
+
viewBox: "0 0 20 20",
|
|
653
|
+
fill: "none",
|
|
654
|
+
"aria-hidden": "true",
|
|
655
|
+
...props,
|
|
656
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
657
|
+
stroke: "currentColor",
|
|
658
|
+
strokeLinecap: "round",
|
|
659
|
+
strokeLinejoin: "round",
|
|
660
|
+
d: "m11.5 6.5 3 3.5m0 0-3 3.5m3-3.5h-9"
|
|
661
|
+
})
|
|
93
662
|
});
|
|
94
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("img", {
|
|
95
|
-
src: lightLogo,
|
|
96
|
-
alt: "",
|
|
97
|
-
className: clsx("clarify-logo clarify-logo-light", className, "dark:hidden")
|
|
98
|
-
}), /* @__PURE__ */ jsx("img", {
|
|
99
|
-
src: darkLogo,
|
|
100
|
-
alt: "",
|
|
101
|
-
className: clsx("clarify-logo clarify-logo-dark", className, "hidden dark:block")
|
|
102
|
-
})] });
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region source/shell/ContentActions.tsx
|
|
106
|
-
function resolveRawContentUrl(rawContentUrl, routePrefix = "/") {
|
|
107
|
-
if (!routePrefix || routePrefix === "/") return rawContentUrl;
|
|
108
|
-
return `/${routePrefix.replace(/^\/+|\/+$/g, "")}${rawContentUrl}`;
|
|
109
|
-
}
|
|
110
|
-
function getAbsoluteUrl(path) {
|
|
111
|
-
if (typeof window === "undefined") return path;
|
|
112
|
-
return new URL(path, window.location.href).href;
|
|
113
663
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
async function handleCopyLink() {
|
|
134
|
-
await copyText(getAbsoluteUrl(rawContentUrl));
|
|
135
|
-
markCopied("link");
|
|
136
|
-
}
|
|
137
|
-
const actions = [{
|
|
138
|
-
key: "content",
|
|
139
|
-
label: contentLabel,
|
|
140
|
-
icon: Copy,
|
|
141
|
-
run: handleCopyContent
|
|
142
|
-
}, {
|
|
143
|
-
key: "link",
|
|
144
|
-
label: linkLabel,
|
|
145
|
-
icon: Link2,
|
|
146
|
-
run: handleCopyLink
|
|
147
|
-
}];
|
|
148
|
-
const primaryAction = actions[0];
|
|
149
|
-
return /* @__PURE__ */ jsx("div", {
|
|
150
|
-
className: "clarify-content-actions sticky top-16 z-20 flex justify-end py-4",
|
|
151
|
-
children: /* @__PURE__ */ jsxs(Menu, {
|
|
152
|
-
as: "div",
|
|
153
|
-
className: "clarify-content-actions-menu relative inline-flex text-xs font-medium",
|
|
154
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
155
|
-
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",
|
|
156
|
-
children: [/* @__PURE__ */ jsxs("button", {
|
|
157
|
-
type: "button",
|
|
158
|
-
onClick: primaryAction.run,
|
|
159
|
-
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",
|
|
160
|
-
children: [copied === primaryAction.key ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ jsx(primaryAction.icon, { className: "h-3.5 w-3.5" }), copied === primaryAction.key ? "已复制" : "复制页面"]
|
|
161
|
-
}), /* @__PURE__ */ jsx(MenuButton, {
|
|
162
|
-
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",
|
|
163
|
-
"aria-label": "选择复制选项",
|
|
164
|
-
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-3.5 w-3.5" })
|
|
165
|
-
})]
|
|
166
|
-
}), /* @__PURE__ */ jsx(MenuItems, {
|
|
167
|
-
anchor: "bottom end",
|
|
168
|
-
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",
|
|
169
|
-
children: actions.map((action) => {
|
|
170
|
-
const Icon = copied === action.key ? Check : action.icon;
|
|
171
|
-
return /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsxs("button", {
|
|
172
|
-
type: "button",
|
|
173
|
-
onClick: action.run,
|
|
174
|
-
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",
|
|
175
|
-
children: [/* @__PURE__ */ jsx(Icon, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ jsx("span", { children: copied === action.key ? "已复制" : action.label })]
|
|
176
|
-
}) }, action.key);
|
|
177
|
-
})
|
|
178
|
-
})]
|
|
179
|
-
})
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
//#endregion
|
|
183
|
-
//#region source/components/BuiltWithClarify.tsx
|
|
184
|
-
function ClarifyMark(props) {
|
|
185
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
186
|
-
viewBox: "0 0 279 200",
|
|
187
|
-
"aria-hidden": "true",
|
|
664
|
+
var buttonVariantStyles = {
|
|
665
|
+
primary: "rounded-full bg-(--clarify-theme-tokens-colors-foreground) px-3 py-1 text-white hover:opacity-80 dark:bg-(--clarify-theme-tokens-colors-primary)/10 dark:text-(--clarify-theme-tokens-colors-primary) dark:ring-1 dark:ring-inset dark:ring-(--clarify-theme-tokens-colors-primary)/20 dark:hover:opacity-80",
|
|
666
|
+
secondary: "rounded-full bg-(--clarify-theme-tokens-colors-code-background) px-3 py-1 text-(--clarify-theme-tokens-colors-foreground) hover:opacity-80 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",
|
|
667
|
+
filled: "rounded-full bg-(--clarify-theme-tokens-colors-foreground) px-3 py-1 text-white hover:opacity-80 dark:bg-(--clarify-theme-tokens-colors-primary) dark:hover:opacity-80",
|
|
668
|
+
outline: "rounded-full px-3 py-1 text-(--clarify-theme-tokens-colors-muted) ring-1 ring-inset ring-(--clarify-theme-tokens-colors-border) hover:bg-[color-mix(in_srgb,var(--clarify-theme-tokens-colors-foreground)_2.5%,transparent)] hover:text-(--clarify-theme-tokens-colors-foreground) dark:text-zinc-400 dark:ring-white/10 dark:hover:bg-white/5 dark:hover:text-white",
|
|
669
|
+
text: "text-(--clarify-theme-tokens-colors-primary) hover:opacity-80 dark:text-(--clarify-theme-tokens-colors-primary) dark:hover:opacity-80"
|
|
670
|
+
};
|
|
671
|
+
function Button(arg0) {
|
|
672
|
+
const { variant = "primary", className, children, arrow, ...props } = arg0;
|
|
673
|
+
const classes = clsx("clarify-button inline-flex justify-center gap-0.5 overflow-hidden text-sm font-medium transition", buttonVariantStyles[variant], className);
|
|
674
|
+
const arrowIcon = /* @__PURE__ */ jsx(ArrowIcon, { className: clsx("mt-0.5 h-5 w-5", variant === "text" && "relative top-px", arrow === "left" && "-ml-1 rotate-180", arrow === "right" && "-mr-1") });
|
|
675
|
+
const inner = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
676
|
+
arrow === "left" ? arrowIcon : null,
|
|
677
|
+
children,
|
|
678
|
+
arrow === "right" ? arrowIcon : null
|
|
679
|
+
] });
|
|
680
|
+
if (typeof props.href === "undefined") return /* @__PURE__ */ jsx("button", {
|
|
681
|
+
className: classes,
|
|
188
682
|
...props,
|
|
189
|
-
children:
|
|
190
|
-
/* @__PURE__ */ jsx("path", {
|
|
191
|
-
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",
|
|
192
|
-
fill: "#00D492"
|
|
193
|
-
}),
|
|
194
|
-
/* @__PURE__ */ jsx("path", {
|
|
195
|
-
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",
|
|
196
|
-
fill: "#00F6C9",
|
|
197
|
-
fillOpacity: "0.6",
|
|
198
|
-
transform: "rotate(-90 179 100)"
|
|
199
|
-
}),
|
|
200
|
-
/* @__PURE__ */ jsx("path", {
|
|
201
|
-
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",
|
|
202
|
-
fill: "#00F692"
|
|
203
|
-
})
|
|
204
|
-
]
|
|
683
|
+
children: inner
|
|
205
684
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
target: "_blank",
|
|
211
|
-
rel: "noreferrer",
|
|
212
|
-
"aria-label": "Built with Clarify",
|
|
213
|
-
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",
|
|
214
|
-
children: [
|
|
215
|
-
/* @__PURE__ */ jsx("span", { children: "Built with" }),
|
|
216
|
-
/* @__PURE__ */ jsx(ClarifyMark, { className: "clarify-built-with-logo h-3.5 w-5 flex-none" }),
|
|
217
|
-
/* @__PURE__ */ jsx("span", {
|
|
218
|
-
className: "font-semibold text-zinc-700 dark:text-zinc-300",
|
|
219
|
-
children: "Clarify"
|
|
220
|
-
})
|
|
221
|
-
]
|
|
685
|
+
return /* @__PURE__ */ jsx("a", {
|
|
686
|
+
className: classes,
|
|
687
|
+
...props,
|
|
688
|
+
children: inner
|
|
222
689
|
});
|
|
223
690
|
}
|
|
224
691
|
//#endregion
|
|
@@ -261,21 +728,22 @@ var calloutStyles = {
|
|
|
261
728
|
Icon: CheckCircle2
|
|
262
729
|
}
|
|
263
730
|
};
|
|
264
|
-
var
|
|
265
|
-
info: "
|
|
266
|
-
note: "
|
|
267
|
-
tip: "
|
|
268
|
-
warning: "
|
|
269
|
-
danger: "
|
|
270
|
-
success: "
|
|
731
|
+
var defaultTitleKeys = {
|
|
732
|
+
info: "callout.info",
|
|
733
|
+
note: "callout.note",
|
|
734
|
+
tip: "callout.tip",
|
|
735
|
+
warning: "callout.warning",
|
|
736
|
+
danger: "callout.danger",
|
|
737
|
+
success: "callout.success"
|
|
271
738
|
};
|
|
272
739
|
function Callout(arg0) {
|
|
273
740
|
const { children, type = "info", title, icon = true, className, ...props } = arg0;
|
|
741
|
+
const t = useBuiltInText();
|
|
274
742
|
const style = calloutStyles[type];
|
|
275
743
|
const Icon = style.Icon;
|
|
276
|
-
const resolvedTitle = title === void 0 ?
|
|
744
|
+
const resolvedTitle = title === void 0 ? t(defaultTitleKeys[type]) : title;
|
|
277
745
|
return /* @__PURE__ */ jsxs("div", {
|
|
278
|
-
className: clsx("clarify-callout my-6 flex gap-3 rounded-
|
|
746
|
+
className: clsx("clarify-callout my-6 flex gap-3 rounded-(--clarify-theme-tokens-radius-xl) border p-4 text-sm/6", style.container, className),
|
|
279
747
|
...props,
|
|
280
748
|
children: [icon ? /* @__PURE__ */ jsx(Icon, {
|
|
281
749
|
className: clsx("mt-1 size-4 flex-none", style.icon),
|
|
@@ -294,16 +762,15 @@ function Callout(arg0) {
|
|
|
294
762
|
}
|
|
295
763
|
//#endregion
|
|
296
764
|
//#region source/components/Card.tsx
|
|
297
|
-
function toPascalCase(value) {
|
|
298
|
-
return value.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`).join("");
|
|
299
|
-
}
|
|
300
765
|
function CardIcon(arg0) {
|
|
301
766
|
const { name } = arg0;
|
|
302
767
|
if (!name) return null;
|
|
303
|
-
const
|
|
768
|
+
const iconName = resolveLucideIconName(name);
|
|
769
|
+
if (!iconName) return null;
|
|
770
|
+
const Icon = lucideIconRegistry[iconName];
|
|
304
771
|
if (!Icon) return null;
|
|
305
772
|
return /* @__PURE__ */ jsx("span", {
|
|
306
|
-
className: "flex size-9 flex-none items-center justify-center rounded-lg bg-
|
|
773
|
+
className: "flex size-9 flex-none items-center justify-center rounded-(--clarify-theme-tokens-radius-lg) bg-(--clarify-ui-accent-background) text-(--clarify-ui-accent-text) ring-1 ring-(--clarify-ui-accent-border)",
|
|
307
774
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
308
775
|
className: "size-5",
|
|
309
776
|
"aria-hidden": "true"
|
|
@@ -330,18 +797,18 @@ function Card(arg0) {
|
|
|
330
797
|
children: [/* @__PURE__ */ jsx(CardIcon, { name: icon }), /* @__PURE__ */ jsxs("div", {
|
|
331
798
|
className: "min-w-0 flex-1",
|
|
332
799
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
333
|
-
className: "m-0 text-base font-semibold text-
|
|
800
|
+
className: "m-0 text-base font-semibold text-(--clarify-theme-tokens-colors-foreground) dark:text-white",
|
|
334
801
|
children: title
|
|
335
802
|
}), children ? /* @__PURE__ */ jsx("div", {
|
|
336
|
-
className: "mt-2 text-sm/6 text-
|
|
803
|
+
className: "mt-2 text-sm/6 text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400 *:m-0",
|
|
337
804
|
children
|
|
338
805
|
}) : null]
|
|
339
806
|
})]
|
|
340
807
|
}), href ? /* @__PURE__ */ jsx("span", {
|
|
341
|
-
className: "absolute inset-0 rounded-
|
|
808
|
+
className: "absolute inset-0 rounded-(--clarify-theme-tokens-radius-xl)",
|
|
342
809
|
"aria-hidden": "true"
|
|
343
810
|
}) : null] });
|
|
344
|
-
const classes = clsx("group relative block rounded-
|
|
811
|
+
const classes = clsx("group relative block rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-(--clarify-ui-accent-glow) transition hover:border-(--clarify-ui-accent-border) hover:shadow-md dark:bg-zinc-900/50", className);
|
|
345
812
|
if (!href) return /* @__PURE__ */ jsx("div", {
|
|
346
813
|
className: classes,
|
|
347
814
|
children: content
|
|
@@ -378,10 +845,10 @@ var languageNames = {
|
|
|
378
845
|
json: "JSON"
|
|
379
846
|
};
|
|
380
847
|
function getPanelTitle(arg0) {
|
|
381
|
-
const { title, language } = arg0;
|
|
848
|
+
const { title, language, fallbackTitle = "Code" } = arg0;
|
|
382
849
|
if (title) return title;
|
|
383
850
|
if (language && language in languageNames) return languageNames[language];
|
|
384
|
-
return
|
|
851
|
+
return fallbackTitle;
|
|
385
852
|
}
|
|
386
853
|
function getNodeText(node) {
|
|
387
854
|
if (typeof node === "string" || typeof node === "number") return String(node);
|
|
@@ -389,7 +856,7 @@ function getNodeText(node) {
|
|
|
389
856
|
if (isValidElement(node)) return getNodeText(node.props.children);
|
|
390
857
|
return "";
|
|
391
858
|
}
|
|
392
|
-
function ClipboardIcon(props) {
|
|
859
|
+
function ClipboardIcon$1(props) {
|
|
393
860
|
return /* @__PURE__ */ jsxs("svg", {
|
|
394
861
|
viewBox: "0 0 20 20",
|
|
395
862
|
"aria-hidden": "true",
|
|
@@ -406,6 +873,7 @@ function ClipboardIcon(props) {
|
|
|
406
873
|
}
|
|
407
874
|
function CopyButton(arg0) {
|
|
408
875
|
const { code } = arg0;
|
|
876
|
+
const t = useBuiltInText();
|
|
409
877
|
const [copyCount, setCopyCount] = useState(0);
|
|
410
878
|
const copied = copyCount > 0;
|
|
411
879
|
useEffect(() => {
|
|
@@ -416,20 +884,20 @@ function CopyButton(arg0) {
|
|
|
416
884
|
if (!code) return null;
|
|
417
885
|
return /* @__PURE__ */ jsxs("button", {
|
|
418
886
|
type: "button",
|
|
419
|
-
className: clsx("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-
|
|
887
|
+
className: clsx("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-[color-mix(in_srgb,var(--clarify-theme-tokens-colors-primary)_12%,transparent)] ring-1 ring-[color-mix(in_srgb,var(--clarify-theme-tokens-colors-primary)_24%,transparent)] ring-inset" : "bg-white/5 hover:bg-white/7.5 dark:bg-white/2.5 dark:hover:bg-white/5"),
|
|
420
888
|
onClick: () => {
|
|
421
|
-
|
|
422
|
-
setCopyCount((count) => count + 1);
|
|
889
|
+
copyTextToClipboard(code).then((ok) => {
|
|
890
|
+
if (ok) setCopyCount((count) => count + 1);
|
|
423
891
|
});
|
|
424
892
|
},
|
|
425
893
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
426
894
|
"aria-hidden": copied,
|
|
427
895
|
className: clsx("pointer-events-none flex items-center gap-0.5 text-zinc-400 transition duration-300", copied && "-translate-y-1.5 opacity-0"),
|
|
428
|
-
children: [/* @__PURE__ */ jsx(ClipboardIcon, { className: "h-5 w-5 fill-zinc-500/20 stroke-zinc-500 transition-colors group-hover/button:stroke-zinc-400" }), "
|
|
896
|
+
children: [/* @__PURE__ */ jsx(ClipboardIcon$1, { className: "h-5 w-5 fill-zinc-500/20 stroke-zinc-500 transition-colors group-hover/button:stroke-zinc-400" }), t("actions.copy")]
|
|
429
897
|
}), /* @__PURE__ */ jsx("span", {
|
|
430
898
|
"aria-hidden": !copied,
|
|
431
|
-
className: clsx("pointer-events-none absolute inset-0 flex items-center justify-center text-
|
|
432
|
-
children: "
|
|
899
|
+
className: clsx("pointer-events-none absolute inset-0 flex items-center justify-center text-(--clarify-theme-tokens-colors-primary) transition duration-300", !copied && "translate-y-1.5 opacity-0"),
|
|
900
|
+
children: t("actions.copied")
|
|
433
901
|
})]
|
|
434
902
|
});
|
|
435
903
|
}
|
|
@@ -440,12 +908,12 @@ function CodePanelHeader(arg0) {
|
|
|
440
908
|
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",
|
|
441
909
|
children: [
|
|
442
910
|
tag ? /* @__PURE__ */ jsx("span", {
|
|
443
|
-
className: "
|
|
911
|
+
className: "clarify-code-panel-tag font-semibold text-(--clarify-theme-tokens-colors-primary)",
|
|
444
912
|
children: tag
|
|
445
913
|
}) : null,
|
|
446
914
|
tag && label ? /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-zinc-500" }) : null,
|
|
447
915
|
label ? /* @__PURE__ */ jsx("span", {
|
|
448
|
-
className: "
|
|
916
|
+
className: "text-xs text-zinc-400",
|
|
449
917
|
children: label
|
|
450
918
|
}) : null
|
|
451
919
|
]
|
|
@@ -478,6 +946,7 @@ function CodePanel(arg0) {
|
|
|
478
946
|
}
|
|
479
947
|
function CodeGroupHeader(arg0) {
|
|
480
948
|
const { title, children, selectedIndex } = arg0;
|
|
949
|
+
const t = useBuiltInText();
|
|
481
950
|
const hasTabs = Children.count(children) > 1;
|
|
482
951
|
if (!title && !hasTabs) return null;
|
|
483
952
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -488,8 +957,11 @@ function CodeGroupHeader(arg0) {
|
|
|
488
957
|
}) : null, hasTabs ? /* @__PURE__ */ jsx(TabList, {
|
|
489
958
|
className: "clarify-code-tabs -mb-px flex gap-4 text-xs font-medium",
|
|
490
959
|
children: Children.map(children, (child, childIndex) => /* @__PURE__ */ jsx(Tab, {
|
|
491
|
-
className: clsx("clarify-code-tab border-b py-3 transition data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "border-
|
|
492
|
-
children: getPanelTitle(
|
|
960
|
+
className: clsx("clarify-code-tab border-b py-3 transition data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "border-(--clarify-theme-tokens-colors-primary) text-(--clarify-theme-tokens-colors-primary)" : "border-transparent text-zinc-400 hover:text-zinc-300"),
|
|
961
|
+
children: getPanelTitle({
|
|
962
|
+
...isValidElement(child) ? child.props : {},
|
|
963
|
+
fallbackTitle: t("actions.code")
|
|
964
|
+
})
|
|
493
965
|
}))
|
|
494
966
|
}) : null]
|
|
495
967
|
});
|
|
@@ -533,16 +1005,19 @@ var usePreferredLanguageStore = create()((set) => ({
|
|
|
533
1005
|
function useTabGroupProps(availableLanguages) {
|
|
534
1006
|
const { preferredLanguages, addPreferredLanguage } = usePreferredLanguageStore();
|
|
535
1007
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
1008
|
+
if (new Set(availableLanguages).size === availableLanguages.length) {
|
|
1009
|
+
const activeLanguage = [...availableLanguages].sort((a, z) => preferredLanguages.indexOf(z) - preferredLanguages.indexOf(a))[0];
|
|
1010
|
+
const languageIndex = availableLanguages.indexOf(activeLanguage);
|
|
1011
|
+
const newSelectedIndex = languageIndex === -1 ? selectedIndex : languageIndex;
|
|
1012
|
+
if (newSelectedIndex !== selectedIndex) setSelectedIndex(newSelectedIndex);
|
|
1013
|
+
}
|
|
540
1014
|
const { positionRef, preventLayoutShift } = usePreventLayoutShift();
|
|
541
1015
|
return {
|
|
542
1016
|
as: "div",
|
|
543
1017
|
ref: positionRef,
|
|
544
1018
|
selectedIndex,
|
|
545
1019
|
onChange: (nextSelectedIndex) => {
|
|
1020
|
+
setSelectedIndex(nextSelectedIndex);
|
|
546
1021
|
preventLayoutShift(() => addPreferredLanguage(availableLanguages[nextSelectedIndex]));
|
|
547
1022
|
}
|
|
548
1023
|
};
|
|
@@ -550,7 +1025,11 @@ function useTabGroupProps(availableLanguages) {
|
|
|
550
1025
|
var CodeGroupContext = createContext(false);
|
|
551
1026
|
function CodeGroup(arg0) {
|
|
552
1027
|
const { children, title, ...props } = arg0;
|
|
553
|
-
const
|
|
1028
|
+
const t = useBuiltInText();
|
|
1029
|
+
const tabGroupProps = useTabGroupProps(Children.map(children, (child) => getPanelTitle({
|
|
1030
|
+
...isValidElement(child) ? child.props : {},
|
|
1031
|
+
fallbackTitle: t("actions.code")
|
|
1032
|
+
})) ?? []);
|
|
554
1033
|
const hasTabs = Children.count(children) > 1;
|
|
555
1034
|
const containerClassName = "clarify-code-group my-6 overflow-hidden rounded-2xl bg-zinc-900 shadow-md dark:ring-1 dark:ring-white/10";
|
|
556
1035
|
const header = /* @__PURE__ */ jsx(CodeGroupHeader, {
|
|
@@ -600,6 +1079,47 @@ function Pre(arg0) {
|
|
|
600
1079
|
});
|
|
601
1080
|
}
|
|
602
1081
|
//#endregion
|
|
1082
|
+
//#region source/components/Collapse.tsx
|
|
1083
|
+
function Collapse(arg0) {
|
|
1084
|
+
const { children, title, summary, defaultOpen = false, className, ...props } = arg0;
|
|
1085
|
+
const [open, setOpen] = useState(defaultOpen);
|
|
1086
|
+
const contentRef = useRef(null);
|
|
1087
|
+
const [maxHeight, setMaxHeight] = useState("0px");
|
|
1088
|
+
const summaryLabel = title ?? summary ?? "Details";
|
|
1089
|
+
const contentId = useId();
|
|
1090
|
+
useLayoutEffect(() => {
|
|
1091
|
+
if (!contentRef.current) return;
|
|
1092
|
+
setMaxHeight(open ? `${contentRef.current.scrollHeight}px` : "0px");
|
|
1093
|
+
}, [open, children]);
|
|
1094
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1095
|
+
className: clsx("clarify-collapse my-6 overflow-hidden rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) shadow-sm dark:border-white/10 dark:bg-zinc-950", className),
|
|
1096
|
+
...props,
|
|
1097
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
1098
|
+
type: "button",
|
|
1099
|
+
className: "flex w-full cursor-pointer items-center justify-between gap-3 px-4 py-3 text-left text-sm font-semibold text-(--clarify-theme-tokens-colors-foreground) transition hover:bg-(--clarify-ui-hover-background) dark:text-white dark:hover:bg-white/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2 focus-visible:ring-offset-(--clarify-theme-tokens-colors-background) dark:focus-visible:ring-offset-zinc-950",
|
|
1100
|
+
"aria-expanded": open,
|
|
1101
|
+
"aria-controls": contentId,
|
|
1102
|
+
onClick: () => setOpen((value) => !value),
|
|
1103
|
+
children: [/* @__PURE__ */ jsx("span", { children: summaryLabel }), /* @__PURE__ */ jsx(ChevronDown, {
|
|
1104
|
+
className: clsx("h-4 w-4 text-(--clarify-theme-tokens-colors-muted) transition-transform duration-200", open && "rotate-180"),
|
|
1105
|
+
"aria-hidden": "true"
|
|
1106
|
+
})]
|
|
1107
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1108
|
+
id: contentId,
|
|
1109
|
+
className: "overflow-hidden border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) transition-[max-height,opacity,transform] duration-200 ease-out dark:border-white/10 dark:bg-zinc-950/95",
|
|
1110
|
+
style: {
|
|
1111
|
+
maxHeight,
|
|
1112
|
+
willChange: "max-height, opacity, transform"
|
|
1113
|
+
},
|
|
1114
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1115
|
+
ref: contentRef,
|
|
1116
|
+
className: clsx("px-4 py-4 text-sm/6 text-(--clarify-theme-tokens-colors-foreground) transition-opacity duration-200 ease-out", open ? "opacity-100 translate-y-0" : "opacity-0 -translate-y-1"),
|
|
1117
|
+
children
|
|
1118
|
+
})
|
|
1119
|
+
})]
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
//#endregion
|
|
603
1123
|
//#region source/components/Feedback.tsx
|
|
604
1124
|
function CheckIcon$1(props) {
|
|
605
1125
|
return /* @__PURE__ */ jsxs("svg", {
|
|
@@ -629,6 +1149,7 @@ function FeedbackButton(props) {
|
|
|
629
1149
|
}
|
|
630
1150
|
var FeedbackForm = forwardRef(function FeedbackForm(arg0, ref) {
|
|
631
1151
|
const { onSubmit, className, ...props } = arg0;
|
|
1152
|
+
const t = useBuiltInText();
|
|
632
1153
|
return /* @__PURE__ */ jsxs("form", {
|
|
633
1154
|
...props,
|
|
634
1155
|
ref,
|
|
@@ -636,18 +1157,18 @@ var FeedbackForm = forwardRef(function FeedbackForm(arg0, ref) {
|
|
|
636
1157
|
className: clsx(className, "clarify-feedback-form absolute inset-0 flex items-center justify-center gap-6 md:justify-start"),
|
|
637
1158
|
children: [/* @__PURE__ */ jsx("p", {
|
|
638
1159
|
className: "text-sm text-zinc-600 dark:text-zinc-400",
|
|
639
|
-
children: "
|
|
1160
|
+
children: t("feedback.prompt")
|
|
640
1161
|
}), /* @__PURE__ */ jsxs("div", {
|
|
641
1162
|
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",
|
|
642
1163
|
children: [
|
|
643
1164
|
/* @__PURE__ */ jsx(FeedbackButton, {
|
|
644
1165
|
"data-response": "yes",
|
|
645
|
-
children: "
|
|
1166
|
+
children: t("feedback.yes")
|
|
646
1167
|
}),
|
|
647
1168
|
/* @__PURE__ */ jsx("div", { className: "bg-zinc-900/10 dark:bg-white/10" }),
|
|
648
1169
|
/* @__PURE__ */ jsx(FeedbackButton, {
|
|
649
1170
|
"data-response": "no",
|
|
650
|
-
children: "
|
|
1171
|
+
children: t("feedback.no")
|
|
651
1172
|
})
|
|
652
1173
|
]
|
|
653
1174
|
})]
|
|
@@ -655,13 +1176,14 @@ var FeedbackForm = forwardRef(function FeedbackForm(arg0, ref) {
|
|
|
655
1176
|
});
|
|
656
1177
|
var FeedbackThanks = forwardRef(function FeedbackThanks(arg0, ref) {
|
|
657
1178
|
const { className, ...props } = arg0;
|
|
1179
|
+
const t = useBuiltInText();
|
|
658
1180
|
return /* @__PURE__ */ jsx("div", {
|
|
659
1181
|
...props,
|
|
660
1182
|
ref,
|
|
661
1183
|
className: clsx(className, "clarify-feedback-thanks absolute inset-0 flex justify-center md:justify-start"),
|
|
662
1184
|
children: /* @__PURE__ */ jsxs("div", {
|
|
663
|
-
className: "flex items-center gap-3 rounded-full bg-
|
|
664
|
-
children: [/* @__PURE__ */ jsx(CheckIcon$1, { className: "h-5 w-5 flex-none fill-
|
|
1185
|
+
className: "flex items-center gap-3 rounded-full bg-(--clarify-ui-accent-background) py-1 pr-3 pl-1.5 text-sm text-(--clarify-ui-accent-text) ring-1 ring-(--clarify-ui-accent-border) ring-inset",
|
|
1186
|
+
children: [/* @__PURE__ */ jsx(CheckIcon$1, { className: "h-5 w-5 flex-none fill-(--clarify-ui-accent-text) stroke-white dark:fill-(--clarify-ui-accent-background) dark:stroke-(--clarify-ui-accent-text)" }), t("feedback.thanks")]
|
|
665
1187
|
})
|
|
666
1188
|
});
|
|
667
1189
|
});
|
|
@@ -686,297 +1208,7 @@ function Feedback() {
|
|
|
686
1208
|
});
|
|
687
1209
|
}
|
|
688
1210
|
//#endregion
|
|
689
|
-
//#region source/components/
|
|
690
|
-
function GridPattern(arg0) {
|
|
691
|
-
const { width, height, x, y, squares, ...props } = arg0;
|
|
692
|
-
const patternId = useId();
|
|
693
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
694
|
-
"aria-hidden": "true",
|
|
695
|
-
...props,
|
|
696
|
-
children: [
|
|
697
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", {
|
|
698
|
-
id: patternId,
|
|
699
|
-
width,
|
|
700
|
-
height,
|
|
701
|
-
patternUnits: "userSpaceOnUse",
|
|
702
|
-
x,
|
|
703
|
-
y,
|
|
704
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
705
|
-
d: `M.5 ${height}V.5H${width}`,
|
|
706
|
-
fill: "none"
|
|
707
|
-
})
|
|
708
|
-
}) }),
|
|
709
|
-
/* @__PURE__ */ jsx("rect", {
|
|
710
|
-
width: "100%",
|
|
711
|
-
height: "100%",
|
|
712
|
-
strokeWidth: 0,
|
|
713
|
-
fill: `url(#${patternId})`
|
|
714
|
-
}),
|
|
715
|
-
squares ? /* @__PURE__ */ jsx("svg", {
|
|
716
|
-
x,
|
|
717
|
-
y,
|
|
718
|
-
className: "overflow-visible",
|
|
719
|
-
children: squares.map(([squareX, squareY]) => /* @__PURE__ */ jsx("rect", {
|
|
720
|
-
width: width + 1,
|
|
721
|
-
height: height + 1,
|
|
722
|
-
x: squareX * width,
|
|
723
|
-
y: squareY * height,
|
|
724
|
-
strokeWidth: "0"
|
|
725
|
-
}, `${squareX}-${squareY}`))
|
|
726
|
-
}) : null
|
|
727
|
-
]
|
|
728
|
-
});
|
|
729
|
-
}
|
|
730
|
-
function HeroPattern() {
|
|
731
|
-
return /* @__PURE__ */ jsx("div", {
|
|
732
|
-
className: "absolute inset-0 -z-10 mx-0 max-w-none overflow-hidden",
|
|
733
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
734
|
-
className: "absolute top-0 left-1/2 -ml-152 h-100 w-325 dark:mask-[linear-gradient(white,transparent)]",
|
|
735
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
736
|
-
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",
|
|
737
|
-
children: /* @__PURE__ */ jsx(GridPattern, {
|
|
738
|
-
width: 72,
|
|
739
|
-
height: 56,
|
|
740
|
-
x: -12,
|
|
741
|
-
y: 4,
|
|
742
|
-
squares: [
|
|
743
|
-
[4, 3],
|
|
744
|
-
[2, 1],
|
|
745
|
-
[7, 3],
|
|
746
|
-
[10, 6]
|
|
747
|
-
],
|
|
748
|
-
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"
|
|
749
|
-
})
|
|
750
|
-
}), /* @__PURE__ */ jsx("svg", {
|
|
751
|
-
viewBox: "0 0 1113 440",
|
|
752
|
-
"aria-hidden": "true",
|
|
753
|
-
className: "absolute top-0 left-1/2 -ml-76 w-278.25 fill-white blur-[26px] dark:hidden",
|
|
754
|
-
children: /* @__PURE__ */ jsx("path", { d: "M.016 439.5s-9.5-300 434-300S882.516 20 882.516 20V0h230.004v439.5H.016Z" })
|
|
755
|
-
})]
|
|
756
|
-
})
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
//#endregion
|
|
760
|
-
//#region source/context.tsx
|
|
761
|
-
var ClarifyConfigContext = createContext(null);
|
|
762
|
-
var OpenApisContext = createContext({});
|
|
763
|
-
function useClarifyConfig() {
|
|
764
|
-
const config = useContext(ClarifyConfigContext);
|
|
765
|
-
if (!config) throw new Error("[clarify] useClarifyConfig must be used within a ClarifyConfigContext.Provider");
|
|
766
|
-
return config;
|
|
767
|
-
}
|
|
768
|
-
function useOpenApis() {
|
|
769
|
-
return useContext(OpenApisContext);
|
|
770
|
-
}
|
|
771
|
-
//#endregion
|
|
772
|
-
//#region source/components/PageFooter.tsx
|
|
773
|
-
function resolveLocalizedText$1(text, locale, fallbackLocale) {
|
|
774
|
-
if (typeof text === "string") return text;
|
|
775
|
-
return (locale ? text[locale] : void 0) ?? (fallbackLocale ? text[fallbackLocale] : void 0) ?? Object.values(text)[0] ?? "";
|
|
776
|
-
}
|
|
777
|
-
function isExternalHref$1(href) {
|
|
778
|
-
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
779
|
-
}
|
|
780
|
-
function localeForPath$1(config, pathname) {
|
|
781
|
-
const i18n = config.i18n;
|
|
782
|
-
if (!i18n) return void 0;
|
|
783
|
-
const firstSegment = pathname.split("/").filter(Boolean)[0];
|
|
784
|
-
return i18n.locales.find((locale) => locale.code === firstSegment)?.code ?? i18n.defaultLocale;
|
|
785
|
-
}
|
|
786
|
-
function localizeHref$1(href, config, locale) {
|
|
787
|
-
if (!locale || !config.i18n || isExternalHref$1(href) || href.startsWith("#")) return href;
|
|
788
|
-
if (locale === config.i18n.defaultLocale) return href;
|
|
789
|
-
const cleanHref = href === "/" ? "" : href.replace(/^\/+/, "");
|
|
790
|
-
return `/${locale}${cleanHref ? `/${cleanHref}` : ""}`;
|
|
791
|
-
}
|
|
792
|
-
function FooterLink(arg0) {
|
|
793
|
-
const { link, locale, config } = arg0;
|
|
794
|
-
const external = link.external ?? isExternalHref$1(link.href);
|
|
795
|
-
return /* @__PURE__ */ jsx("a", {
|
|
796
|
-
href: external ? link.href : localizeHref$1(link.href, config, locale),
|
|
797
|
-
target: external ? "_blank" : void 0,
|
|
798
|
-
rel: external ? "noreferrer" : void 0,
|
|
799
|
-
className: "clarify-footer-link text-sm text-zinc-500 no-underline transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white",
|
|
800
|
-
children: resolveLocalizedText$1(link.label, locale, config.i18n?.defaultLocale)
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
function SocialLink(arg0) {
|
|
804
|
-
const { name, href } = arg0;
|
|
805
|
-
return /* @__PURE__ */ jsx("a", {
|
|
806
|
-
href,
|
|
807
|
-
target: "_blank",
|
|
808
|
-
rel: "noreferrer",
|
|
809
|
-
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",
|
|
810
|
-
children: name
|
|
811
|
-
});
|
|
812
|
-
}
|
|
813
|
-
function PageFooter() {
|
|
814
|
-
const config = useClarifyConfig();
|
|
815
|
-
const locale = localeForPath$1(config, useLocation().pathname);
|
|
816
|
-
const footer = config.footer;
|
|
817
|
-
const links = footer?.links ?? [];
|
|
818
|
-
const socials = Object.entries(footer?.socials ?? {});
|
|
819
|
-
const copyright = footer?.copyright ? resolveLocalizedText$1(footer.copyright, locale, config.i18n?.defaultLocale) : void 0;
|
|
820
|
-
const hasCustomFooter = Boolean(copyright || links.length > 0 || socials.length > 0);
|
|
821
|
-
return /* @__PURE__ */ jsxs("footer", {
|
|
822
|
-
className: clsx("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"),
|
|
823
|
-
children: [hasCustomFooter ? /* @__PURE__ */ jsxs("div", {
|
|
824
|
-
className: "clarify-footer-content flex flex-col gap-3 text-right sm:text-left",
|
|
825
|
-
children: [copyright ? /* @__PURE__ */ jsx("p", {
|
|
826
|
-
className: "clarify-footer-copyright m-0 text-sm text-zinc-500 dark:text-zinc-400",
|
|
827
|
-
children: copyright
|
|
828
|
-
}) : null, links.length > 0 || socials.length > 0 ? /* @__PURE__ */ jsxs("div", {
|
|
829
|
-
className: "clarify-footer-links flex flex-wrap justify-end gap-x-4 gap-y-2 sm:justify-start",
|
|
830
|
-
children: [links.map((link) => /* @__PURE__ */ jsx(FooterLink, {
|
|
831
|
-
link,
|
|
832
|
-
locale,
|
|
833
|
-
config
|
|
834
|
-
}, `${link.href}-${resolveLocalizedText$1(link.label, locale, config.i18n?.defaultLocale)}`)), socials.map(([name, href]) => /* @__PURE__ */ jsx(SocialLink, {
|
|
835
|
-
name,
|
|
836
|
-
href
|
|
837
|
-
}, name))]
|
|
838
|
-
}) : null]
|
|
839
|
-
}) : null, /* @__PURE__ */ jsx("div", {
|
|
840
|
-
className: "clarify-footer-brand flex justify-end",
|
|
841
|
-
children: /* @__PURE__ */ jsx(BuiltWithClarify, {})
|
|
842
|
-
})]
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
//#endregion
|
|
846
|
-
//#region source/components/ThemeProvider.tsx
|
|
847
|
-
var ThemeContext = createContext(null);
|
|
848
|
-
var storageKey = "clarify:theme";
|
|
849
|
-
function getSystemTheme() {
|
|
850
|
-
if (typeof window === "undefined") return "light";
|
|
851
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
852
|
-
}
|
|
853
|
-
function getStoredTheme() {
|
|
854
|
-
if (typeof window === "undefined") return "system";
|
|
855
|
-
const storedTheme = window.localStorage.getItem(storageKey);
|
|
856
|
-
return storedTheme === "light" || storedTheme === "dark" || storedTheme === "system" ? storedTheme : "system";
|
|
857
|
-
}
|
|
858
|
-
function applyTheme(resolvedTheme) {
|
|
859
|
-
if (typeof document === "undefined") return;
|
|
860
|
-
document.documentElement.classList.toggle("dark", resolvedTheme === "dark");
|
|
861
|
-
document.documentElement.style.colorScheme = resolvedTheme;
|
|
862
|
-
}
|
|
863
|
-
function ThemeProvider(arg0) {
|
|
864
|
-
const { children } = arg0;
|
|
865
|
-
const [theme, setThemeState] = useState(() => getStoredTheme());
|
|
866
|
-
const [systemTheme, setSystemTheme] = useState(() => getSystemTheme());
|
|
867
|
-
const resolvedTheme = theme === "system" ? systemTheme : theme;
|
|
868
|
-
useEffect(() => {
|
|
869
|
-
applyTheme(resolvedTheme);
|
|
870
|
-
}, [resolvedTheme]);
|
|
871
|
-
useEffect(() => {
|
|
872
|
-
if (typeof window === "undefined") return;
|
|
873
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
874
|
-
function updateSystemTheme() {
|
|
875
|
-
setSystemTheme(mediaQuery.matches ? "dark" : "light");
|
|
876
|
-
}
|
|
877
|
-
updateSystemTheme();
|
|
878
|
-
mediaQuery.addEventListener("change", updateSystemTheme);
|
|
879
|
-
return () => mediaQuery.removeEventListener("change", updateSystemTheme);
|
|
880
|
-
}, []);
|
|
881
|
-
const value = useMemo(() => ({
|
|
882
|
-
theme,
|
|
883
|
-
resolvedTheme,
|
|
884
|
-
setTheme(nextTheme) {
|
|
885
|
-
setThemeState(nextTheme);
|
|
886
|
-
if (typeof window !== "undefined") window.localStorage.setItem(storageKey, nextTheme);
|
|
887
|
-
}
|
|
888
|
-
}), [resolvedTheme, theme]);
|
|
889
|
-
return /* @__PURE__ */ jsx(ThemeContext.Provider, {
|
|
890
|
-
value,
|
|
891
|
-
children
|
|
892
|
-
});
|
|
893
|
-
}
|
|
894
|
-
function useTheme() {
|
|
895
|
-
const context = useContext(ThemeContext);
|
|
896
|
-
if (!context) throw new Error("[clarify] useTheme must be used within ThemeProvider");
|
|
897
|
-
return context;
|
|
898
|
-
}
|
|
899
|
-
//#endregion
|
|
900
|
-
//#region source/components/ThemeToggle.tsx
|
|
901
|
-
function SunIcon(props) {
|
|
902
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
903
|
-
viewBox: "0 0 20 20",
|
|
904
|
-
fill: "none",
|
|
905
|
-
"aria-hidden": "true",
|
|
906
|
-
...props,
|
|
907
|
-
children: [/* @__PURE__ */ jsx("path", { d: "M12.5 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z" }), /* @__PURE__ */ jsx("path", {
|
|
908
|
-
strokeLinecap: "round",
|
|
909
|
-
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"
|
|
910
|
-
})]
|
|
911
|
-
});
|
|
912
|
-
}
|
|
913
|
-
function MoonIcon(props) {
|
|
914
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
915
|
-
viewBox: "0 0 20 20",
|
|
916
|
-
fill: "none",
|
|
917
|
-
"aria-hidden": "true",
|
|
918
|
-
...props,
|
|
919
|
-
children: /* @__PURE__ */ 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" })
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
function ThemeToggle() {
|
|
923
|
-
const { resolvedTheme, setTheme } = useTheme();
|
|
924
|
-
const otherTheme = resolvedTheme === "dark" ? "light" : "dark";
|
|
925
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
926
|
-
type: "button",
|
|
927
|
-
className: "clarify-theme-toggle flex size-6 items-center justify-center rounded-md transition hover:bg-zinc-900/5 dark:hover:bg-white/5",
|
|
928
|
-
"aria-label": `Switch to ${otherTheme} theme`,
|
|
929
|
-
onClick: () => setTheme(otherTheme),
|
|
930
|
-
children: [
|
|
931
|
-
/* @__PURE__ */ jsx("span", { className: "absolute size-12 pointer-fine:hidden" }),
|
|
932
|
-
/* @__PURE__ */ jsx(SunIcon, { className: "h-5 w-5 stroke-zinc-900 dark:hidden" }),
|
|
933
|
-
/* @__PURE__ */ jsx(MoonIcon, { className: "hidden h-5 w-5 stroke-white dark:block" })
|
|
934
|
-
]
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
//#endregion
|
|
938
|
-
//#region source/components/index.tsx
|
|
939
|
-
function ArrowIcon(props) {
|
|
940
|
-
return /* @__PURE__ */ jsx("svg", {
|
|
941
|
-
viewBox: "0 0 20 20",
|
|
942
|
-
fill: "none",
|
|
943
|
-
"aria-hidden": "true",
|
|
944
|
-
...props,
|
|
945
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
946
|
-
stroke: "currentColor",
|
|
947
|
-
strokeLinecap: "round",
|
|
948
|
-
strokeLinejoin: "round",
|
|
949
|
-
d: "m11.5 6.5 3 3.5m0 0-3 3.5m3-3.5h-9"
|
|
950
|
-
})
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
var buttonVariantStyles = {
|
|
954
|
-
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",
|
|
955
|
-
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",
|
|
956
|
-
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",
|
|
957
|
-
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",
|
|
958
|
-
text: "text-emerald-500 hover:text-emerald-600 dark:text-emerald-400 dark:hover:text-emerald-500"
|
|
959
|
-
};
|
|
960
|
-
function Button(arg0) {
|
|
961
|
-
const { variant = "primary", className, children, arrow, ...props } = arg0;
|
|
962
|
-
const classes = clsx("clarify-button inline-flex justify-center gap-0.5 overflow-hidden text-sm font-medium transition", buttonVariantStyles[variant], className);
|
|
963
|
-
const arrowIcon = /* @__PURE__ */ jsx(ArrowIcon, { className: clsx("mt-0.5 h-5 w-5", variant === "text" && "relative top-px", arrow === "left" && "-ml-1 rotate-180", arrow === "right" && "-mr-1") });
|
|
964
|
-
const inner = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
965
|
-
arrow === "left" ? arrowIcon : null,
|
|
966
|
-
children,
|
|
967
|
-
arrow === "right" ? arrowIcon : null
|
|
968
|
-
] });
|
|
969
|
-
if (typeof props.href === "undefined") return /* @__PURE__ */ jsx("button", {
|
|
970
|
-
className: classes,
|
|
971
|
-
...props,
|
|
972
|
-
children: inner
|
|
973
|
-
});
|
|
974
|
-
return /* @__PURE__ */ jsx("a", {
|
|
975
|
-
className: classes,
|
|
976
|
-
...props,
|
|
977
|
-
children: inner
|
|
978
|
-
});
|
|
979
|
-
}
|
|
1211
|
+
//#region source/components/Tag.tsx
|
|
980
1212
|
var tagVariantStyles = {
|
|
981
1213
|
small: "",
|
|
982
1214
|
medium: "rounded-lg px-1.5 ring-1 ring-inset"
|
|
@@ -998,49 +1230,29 @@ var tagColorStyles = {
|
|
|
998
1230
|
small: "text-red-500 dark:text-rose-500",
|
|
999
1231
|
medium: "bg-rose-50 text-red-500 ring-rose-200 dark:bg-rose-400/10 dark:text-rose-400 dark:ring-rose-500/20"
|
|
1000
1232
|
},
|
|
1001
|
-
zinc: {
|
|
1002
|
-
small: "text-
|
|
1003
|
-
medium: "bg-
|
|
1004
|
-
}
|
|
1005
|
-
};
|
|
1006
|
-
var tagValueColorMap = {
|
|
1007
|
-
GET: "emerald",
|
|
1008
|
-
POST: "sky",
|
|
1009
|
-
PUT: "amber",
|
|
1010
|
-
PATCH: "amber",
|
|
1011
|
-
DELETE: "rose"
|
|
1012
|
-
};
|
|
1013
|
-
function Tag(arg0) {
|
|
1014
|
-
const { children, variant = "medium", color } = arg0;
|
|
1015
|
-
const value = typeof children === "string" ? children.toUpperCase() : "";
|
|
1016
|
-
const resolvedColor = color ?? tagValueColorMap[value] ?? "emerald";
|
|
1017
|
-
return /* @__PURE__ */ jsx("span", {
|
|
1018
|
-
className: clsx("clarify-tag font-
|
|
1019
|
-
children
|
|
1020
|
-
});
|
|
1021
|
-
}
|
|
1022
|
-
function Logo(props) {
|
|
1023
|
-
return /* @__PURE__ */ jsxs("svg", {
|
|
1024
|
-
viewBox: "0 0 99 24",
|
|
1025
|
-
"aria-hidden": "true",
|
|
1026
|
-
...props,
|
|
1027
|
-
className: clsx("clarify-logo", props.className),
|
|
1028
|
-
children: [/* @__PURE__ */ jsx("path", {
|
|
1029
|
-
className: "fill-emerald-400",
|
|
1030
|
-
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"
|
|
1031
|
-
}), /* @__PURE__ */ jsx("path", {
|
|
1032
|
-
className: "fill-zinc-900 dark:fill-white",
|
|
1033
|
-
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"
|
|
1034
|
-
})]
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
function Prose(arg0) {
|
|
1038
|
-
const { as, className, ...props } = arg0;
|
|
1039
|
-
return /* @__PURE__ */ jsx(as ?? "div", {
|
|
1040
|
-
className: clsx(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]"),
|
|
1041
|
-
...props
|
|
1233
|
+
zinc: {
|
|
1234
|
+
small: "text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-500",
|
|
1235
|
+
medium: "bg-(--clarify-theme-tokens-colors-code-background) text-(--clarify-theme-tokens-colors-muted) ring-(--clarify-theme-tokens-colors-border) dark:bg-zinc-400/10 dark:text-zinc-400 dark:ring-zinc-500/20"
|
|
1236
|
+
}
|
|
1237
|
+
};
|
|
1238
|
+
var tagValueColorMap = {
|
|
1239
|
+
GET: "emerald",
|
|
1240
|
+
POST: "sky",
|
|
1241
|
+
PUT: "amber",
|
|
1242
|
+
PATCH: "amber",
|
|
1243
|
+
DELETE: "rose"
|
|
1244
|
+
};
|
|
1245
|
+
function Tag(arg0) {
|
|
1246
|
+
const { children, variant = "medium", color } = arg0;
|
|
1247
|
+
const value = typeof children === "string" ? children.toUpperCase() : "";
|
|
1248
|
+
const resolvedColor = color ?? tagValueColorMap[value] ?? "emerald";
|
|
1249
|
+
return /* @__PURE__ */ jsx("span", {
|
|
1250
|
+
className: clsx("clarify-tag font-bold", tagVariantStyles[variant], tagColorStyles[resolvedColor][variant]),
|
|
1251
|
+
children
|
|
1042
1252
|
});
|
|
1043
1253
|
}
|
|
1254
|
+
//#endregion
|
|
1255
|
+
//#region source/components/Heading.tsx
|
|
1044
1256
|
function AnchorIcon(props) {
|
|
1045
1257
|
return /* @__PURE__ */ jsx("svg", {
|
|
1046
1258
|
viewBox: "0 0 20 20",
|
|
@@ -1060,7 +1272,7 @@ function Eyebrow(arg0) {
|
|
|
1060
1272
|
tag ? /* @__PURE__ */ jsx(Tag, { children: tag }) : null,
|
|
1061
1273
|
tag && label ? /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 rounded-full bg-zinc-300 dark:bg-zinc-600" }) : null,
|
|
1062
1274
|
label ? /* @__PURE__ */ jsx("span", {
|
|
1063
|
-
className: "
|
|
1275
|
+
className: "text-xs text-zinc-400",
|
|
1064
1276
|
children: label
|
|
1065
1277
|
}) : null
|
|
1066
1278
|
]
|
|
@@ -1081,7 +1293,7 @@ function Anchor(arg0) {
|
|
|
1081
1293
|
});
|
|
1082
1294
|
}
|
|
1083
1295
|
function Heading(arg0) {
|
|
1084
|
-
const { children, tag, label, level, anchor = true, ...props } = arg0;
|
|
1296
|
+
const { children, className, tag, label, level, anchor = true, ...props } = arg0;
|
|
1085
1297
|
const resolvedLevel = level ?? 2;
|
|
1086
1298
|
const Component = `h${resolvedLevel}`;
|
|
1087
1299
|
const ref = useRef(null);
|
|
@@ -1108,7 +1320,7 @@ function Heading(arg0) {
|
|
|
1108
1320
|
label
|
|
1109
1321
|
}), /* @__PURE__ */ jsx(Component, {
|
|
1110
1322
|
ref,
|
|
1111
|
-
className: clsx("clarify-heading", tag || label ? "mt-2 scroll-mt-32" : "scroll-mt-24"),
|
|
1323
|
+
className: clsx("clarify-heading", tag || label ? "mt-2 scroll-mt-32" : "scroll-mt-24", className),
|
|
1112
1324
|
...props,
|
|
1113
1325
|
children: anchor ? /* @__PURE__ */ jsx(Anchor, {
|
|
1114
1326
|
id: props.id,
|
|
@@ -1117,54 +1329,114 @@ function Heading(arg0) {
|
|
|
1117
1329
|
}) : children
|
|
1118
1330
|
})] });
|
|
1119
1331
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
}), /* @__PURE__ */ jsx(Prose, { children })]
|
|
1136
|
-
})
|
|
1332
|
+
//#endregion
|
|
1333
|
+
//#region source/components/Logo.tsx
|
|
1334
|
+
function Logo(props) {
|
|
1335
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
1336
|
+
viewBox: "0 0 99 24",
|
|
1337
|
+
"aria-hidden": "true",
|
|
1338
|
+
...props,
|
|
1339
|
+
className: clsx("clarify-logo", props.className),
|
|
1340
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
1341
|
+
className: "fill-(--clarify-theme-tokens-colors-primary)",
|
|
1342
|
+
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"
|
|
1343
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
1344
|
+
className: "fill-(--clarify-theme-tokens-colors-foreground) dark:fill-white",
|
|
1345
|
+
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"
|
|
1346
|
+
})]
|
|
1137
1347
|
});
|
|
1138
1348
|
}
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1349
|
+
//#endregion
|
|
1350
|
+
//#region source/components/patterns.tsx
|
|
1351
|
+
function GridPattern(arg0) {
|
|
1352
|
+
const { width, height, x, y, squares, ...props } = arg0;
|
|
1353
|
+
const patternId = useId();
|
|
1354
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
1355
|
+
"aria-hidden": "true",
|
|
1356
|
+
...props,
|
|
1357
|
+
children: [
|
|
1358
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", {
|
|
1359
|
+
id: patternId,
|
|
1360
|
+
width,
|
|
1361
|
+
height,
|
|
1362
|
+
patternUnits: "userSpaceOnUse",
|
|
1363
|
+
x,
|
|
1364
|
+
y,
|
|
1365
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1366
|
+
d: `M.5 ${height}V.5H${width}`,
|
|
1367
|
+
fill: "none"
|
|
1368
|
+
})
|
|
1369
|
+
}) }),
|
|
1370
|
+
/* @__PURE__ */ jsx("rect", {
|
|
1371
|
+
width: "100%",
|
|
1372
|
+
height: "100%",
|
|
1373
|
+
strokeWidth: 0,
|
|
1374
|
+
fill: `url(#${patternId})`
|
|
1375
|
+
}),
|
|
1376
|
+
squares ? /* @__PURE__ */ jsx("svg", {
|
|
1377
|
+
x,
|
|
1378
|
+
y,
|
|
1379
|
+
className: "overflow-visible",
|
|
1380
|
+
children: squares.map(([squareX, squareY]) => /* @__PURE__ */ jsx("rect", {
|
|
1381
|
+
width: width + 1,
|
|
1382
|
+
height: height + 1,
|
|
1383
|
+
x: squareX * width,
|
|
1384
|
+
y: squareY * height,
|
|
1385
|
+
strokeWidth: "0"
|
|
1386
|
+
}, `${squareX}-${squareY}`))
|
|
1387
|
+
}) : null
|
|
1388
|
+
]
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
function HeroPattern() {
|
|
1392
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1393
|
+
className: "absolute inset-0 -z-10 mx-0 max-w-none overflow-hidden",
|
|
1394
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1395
|
+
className: "absolute top-0 left-1/2 -ml-152 h-100 w-325 dark:mask-[linear-gradient(white,transparent)]",
|
|
1396
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1397
|
+
className: "absolute inset-0 bg-[linear-gradient(to_right,var(--clarify-theme-tokens-colors-primary),var(--clarify-theme-tokens-colors-accent))] opacity-35 mask-[radial-gradient(farthest-side_at_top,white,transparent)] dark:opacity-55",
|
|
1398
|
+
children: /* @__PURE__ */ jsx(GridPattern, {
|
|
1399
|
+
width: 72,
|
|
1400
|
+
height: 56,
|
|
1401
|
+
x: -12,
|
|
1402
|
+
y: 4,
|
|
1403
|
+
squares: [
|
|
1404
|
+
[4, 3],
|
|
1405
|
+
[2, 1],
|
|
1406
|
+
[7, 3],
|
|
1407
|
+
[10, 6]
|
|
1408
|
+
],
|
|
1409
|
+
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"
|
|
1410
|
+
})
|
|
1411
|
+
}), /* @__PURE__ */ jsx("svg", {
|
|
1412
|
+
viewBox: "0 0 1113 440",
|
|
1413
|
+
"aria-hidden": "true",
|
|
1414
|
+
className: "absolute top-0 left-1/2 -ml-76 w-278.25 fill-white blur-[26px] dark:hidden",
|
|
1415
|
+
children: /* @__PURE__ */ jsx("path", { d: "M.016 439.5s-9.5-300 434-300S882.516 20 882.516 20V0h230.004v439.5H.016Z" })
|
|
1149
1416
|
})]
|
|
1150
|
-
})
|
|
1151
|
-
className: "mt-3 text-sm text-zinc-600 dark:text-zinc-400",
|
|
1152
|
-
children: description
|
|
1153
|
-
}) : null]
|
|
1417
|
+
})
|
|
1154
1418
|
});
|
|
1155
1419
|
}
|
|
1156
1420
|
//#endregion
|
|
1157
|
-
//#region source/
|
|
1158
|
-
function
|
|
1159
|
-
const {
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
return /* @__PURE__ */ jsx(Icon, {
|
|
1164
|
-
className: clsx("shrink-0 stroke-current", className),
|
|
1165
|
-
"aria-hidden": "true"
|
|
1421
|
+
//#region source/components/Prose.tsx
|
|
1422
|
+
function Prose(arg0) {
|
|
1423
|
+
const { as, className, ...props } = arg0;
|
|
1424
|
+
return /* @__PURE__ */ jsx(as ?? "div", {
|
|
1425
|
+
className: clsx(className, "clarify-prose prose max-w-none dark:prose-invert", "[html_:where(&>*)]:w-full [html_:where(&>*)]:min-w-0 [html_:where(&>*)]:max-w-full"),
|
|
1426
|
+
...props
|
|
1166
1427
|
});
|
|
1167
1428
|
}
|
|
1429
|
+
//#endregion
|
|
1430
|
+
//#region source/utils/hash.ts
|
|
1431
|
+
function safeDecodeURIComponent(value) {
|
|
1432
|
+
try {
|
|
1433
|
+
return decodeURIComponent(value);
|
|
1434
|
+
} catch {
|
|
1435
|
+
return value;
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
//#endregion
|
|
1439
|
+
//#region source/shell/Navigation.tsx
|
|
1168
1440
|
function useInitialValue(value, condition = true) {
|
|
1169
1441
|
const [initialValue] = useState(value);
|
|
1170
1442
|
return condition ? initialValue : value;
|
|
@@ -1172,11 +1444,11 @@ function useInitialValue(value, condition = true) {
|
|
|
1172
1444
|
function normalizePath(path) {
|
|
1173
1445
|
return path === "" ? "/" : path;
|
|
1174
1446
|
}
|
|
1175
|
-
function navigationToGroups(navigation) {
|
|
1447
|
+
function navigationToGroups(navigation, defaultTitle) {
|
|
1176
1448
|
return navigation.map((node) => {
|
|
1177
1449
|
const children = node.children?.length ? node.children : [node];
|
|
1178
1450
|
return {
|
|
1179
|
-
title: node.children?.length ? node.title :
|
|
1451
|
+
title: node.children?.length ? node.title : defaultTitle,
|
|
1180
1452
|
icon: node.icon,
|
|
1181
1453
|
links: children.map((child) => ({
|
|
1182
1454
|
title: child.title,
|
|
@@ -1186,18 +1458,6 @@ function navigationToGroups(navigation) {
|
|
|
1186
1458
|
};
|
|
1187
1459
|
});
|
|
1188
1460
|
}
|
|
1189
|
-
function TopLevelNavItem$1(arg0) {
|
|
1190
|
-
const { href, children } = arg0;
|
|
1191
|
-
return /* @__PURE__ */ jsx("li", {
|
|
1192
|
-
className: "md:hidden",
|
|
1193
|
-
children: /* @__PURE__ */ jsx(CloseButton, {
|
|
1194
|
-
as: Link,
|
|
1195
|
-
to: href,
|
|
1196
|
-
className: "block py-1 text-sm text-zinc-600 transition hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-white",
|
|
1197
|
-
children
|
|
1198
|
-
})
|
|
1199
|
-
});
|
|
1200
|
-
}
|
|
1201
1461
|
var sectionBadgeColorStyles = {
|
|
1202
1462
|
GET: "text-emerald-500 dark:text-emerald-400",
|
|
1203
1463
|
POST: "text-sky-500 dark:text-sky-400",
|
|
@@ -1211,7 +1471,7 @@ var sectionBadgeColorStyles = {
|
|
|
1211
1471
|
function SectionBadge(arg0) {
|
|
1212
1472
|
const { children } = arg0;
|
|
1213
1473
|
return /* @__PURE__ */ jsx("span", {
|
|
1214
|
-
className: clsx("inline-flex shrink-0 justify-end font-
|
|
1474
|
+
className: clsx("clarify-navigation-section-badge inline-flex shrink-0 justify-end font-semibold uppercase tracking-wide", sectionBadgeColorStyles[children.toUpperCase()] ?? "clarify-ui-menu-description"),
|
|
1215
1475
|
children
|
|
1216
1476
|
});
|
|
1217
1477
|
}
|
|
@@ -1221,9 +1481,12 @@ function NavLink(arg0) {
|
|
|
1221
1481
|
if (!isAnchorLink) return;
|
|
1222
1482
|
const hashIndex = href.indexOf("#");
|
|
1223
1483
|
if (hashIndex === -1) return;
|
|
1224
|
-
const targetId =
|
|
1484
|
+
const targetId = safeDecodeURIComponent(href.slice(hashIndex + 1));
|
|
1225
1485
|
window.requestAnimationFrame(() => {
|
|
1226
1486
|
document.getElementById(targetId)?.scrollIntoView();
|
|
1487
|
+
window.requestAnimationFrame(() => {
|
|
1488
|
+
window.dispatchEvent(new Event("scroll"));
|
|
1489
|
+
});
|
|
1227
1490
|
});
|
|
1228
1491
|
}
|
|
1229
1492
|
return /* @__PURE__ */ jsxs(CloseButton, {
|
|
@@ -1231,7 +1494,7 @@ function NavLink(arg0) {
|
|
|
1231
1494
|
to: href,
|
|
1232
1495
|
"aria-current": active ? "page" : void 0,
|
|
1233
1496
|
onClick: handleClick,
|
|
1234
|
-
className: clsx("clarify-navigation-link flex justify-between gap-2
|
|
1497
|
+
className: clsx("clarify-navigation-link flex h-8 items-center justify-between gap-2 pr-3 transition", isAnchorLink ? "clarify-navigation-anchor-link pl-7" : "pl-4"),
|
|
1235
1498
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
1236
1499
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
1237
1500
|
children: [
|
|
@@ -1241,7 +1504,7 @@ function NavLink(arg0) {
|
|
|
1241
1504
|
}) : null,
|
|
1242
1505
|
badge ? /* @__PURE__ */ jsx(SectionBadge, { children: badge }) : null,
|
|
1243
1506
|
/* @__PURE__ */ jsx("span", {
|
|
1244
|
-
className: "min-w-0 truncate",
|
|
1507
|
+
className: "min-w-0 truncate whitespace-nowrap",
|
|
1245
1508
|
children
|
|
1246
1509
|
})
|
|
1247
1510
|
]
|
|
@@ -1262,18 +1525,32 @@ function VisibleSectionHighlight(arg0) {
|
|
|
1262
1525
|
const firstVisibleSectionIndex = Math.max(0, [{ id: "_top" }, ...sections].findIndex((section) => section.id === visibleSections[0]));
|
|
1263
1526
|
const itemHeight = remToPx(2);
|
|
1264
1527
|
const height = isPresent ? Math.max(1, visibleSections.length) * itemHeight : itemHeight;
|
|
1265
|
-
const top = group.links.findIndex((link) => link.href
|
|
1528
|
+
const top = group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) * itemHeight + firstVisibleSectionIndex * itemHeight;
|
|
1266
1529
|
return /* @__PURE__ */ jsx(motion.div, {
|
|
1267
|
-
|
|
1268
|
-
|
|
1530
|
+
initial: {
|
|
1531
|
+
opacity: 0,
|
|
1532
|
+
height: 0
|
|
1533
|
+
},
|
|
1269
1534
|
animate: {
|
|
1270
1535
|
opacity: 1,
|
|
1271
|
-
|
|
1536
|
+
top,
|
|
1537
|
+
height,
|
|
1538
|
+
transition: {
|
|
1539
|
+
duration: .2,
|
|
1540
|
+
ease: "easeOut"
|
|
1541
|
+
}
|
|
1542
|
+
},
|
|
1543
|
+
exit: {
|
|
1544
|
+
opacity: 0,
|
|
1545
|
+
height: 0,
|
|
1546
|
+
transition: {
|
|
1547
|
+
duration: .15,
|
|
1548
|
+
ease: "easeIn"
|
|
1549
|
+
}
|
|
1272
1550
|
},
|
|
1273
|
-
|
|
1274
|
-
className: "absolute inset-x-0 top-0 bg-zinc-800/2.5 will-change-transform dark:bg-white/2.5",
|
|
1551
|
+
className: "clarify-navigation-section-highlight absolute inset-x-0 top-0 will-change-transform",
|
|
1275
1552
|
style: {
|
|
1276
|
-
borderRadius:
|
|
1553
|
+
borderRadius: "var(--clarify-theme-tokens-radius-sm)",
|
|
1277
1554
|
height,
|
|
1278
1555
|
top
|
|
1279
1556
|
}
|
|
@@ -1282,32 +1559,43 @@ function VisibleSectionHighlight(arg0) {
|
|
|
1282
1559
|
function ActivePageMarker(arg0) {
|
|
1283
1560
|
const { group, pathname } = arg0;
|
|
1284
1561
|
const itemHeight = remToPx(2);
|
|
1285
|
-
const top = remToPx(.25) + group.links.findIndex((link) => link.href
|
|
1562
|
+
const top = remToPx(.25) + group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) * itemHeight;
|
|
1286
1563
|
return /* @__PURE__ */ jsx(motion.div, {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1564
|
+
className: "absolute left-2 h-6 w-px bg-(--clarify-theme-tokens-colors-primary)",
|
|
1565
|
+
initial: {
|
|
1566
|
+
opacity: 0,
|
|
1567
|
+
top
|
|
1568
|
+
},
|
|
1290
1569
|
animate: {
|
|
1291
1570
|
opacity: 1,
|
|
1292
|
-
|
|
1571
|
+
top,
|
|
1572
|
+
transition: {
|
|
1573
|
+
duration: .2,
|
|
1574
|
+
ease: "easeOut"
|
|
1575
|
+
}
|
|
1576
|
+
},
|
|
1577
|
+
exit: {
|
|
1578
|
+
opacity: 0,
|
|
1579
|
+
transition: {
|
|
1580
|
+
duration: .15,
|
|
1581
|
+
ease: "easeIn"
|
|
1582
|
+
}
|
|
1293
1583
|
},
|
|
1294
|
-
exit: { opacity: 0 },
|
|
1295
1584
|
style: { top }
|
|
1296
1585
|
});
|
|
1297
1586
|
}
|
|
1298
1587
|
function NavigationGroup(arg0) {
|
|
1299
1588
|
const { group, className } = arg0;
|
|
1300
1589
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1301
|
-
const [pathname, sections] = useInitialValue([useLocation().pathname, useSectionStore((s) => s.sections)], isInsideMobileNavigation);
|
|
1302
|
-
const isActiveGroup = group.links.findIndex((link) => link.href
|
|
1590
|
+
const [pathname, sections] = useInitialValue([normalizeRoutePath(useLocation().pathname), useSectionStore((s) => s.sections)], isInsideMobileNavigation);
|
|
1591
|
+
const isActiveGroup = group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) !== -1;
|
|
1303
1592
|
return /* @__PURE__ */ jsxs("li", {
|
|
1304
1593
|
className: clsx("clarify-navigation-group relative mt-6", className),
|
|
1305
|
-
children: [/* @__PURE__ */ jsxs(
|
|
1306
|
-
|
|
1307
|
-
className: "clarify-navigation-group-title flex items-center gap-2 text-xs font-semibold text-zinc-900 dark:text-white",
|
|
1594
|
+
children: [/* @__PURE__ */ jsxs("h2", {
|
|
1595
|
+
className: "clarify-navigation-group-title flex items-center gap-2",
|
|
1308
1596
|
children: [/* @__PURE__ */ jsx(NavigationIcon, {
|
|
1309
1597
|
name: group.icon,
|
|
1310
|
-
className: "h-3.5 w-3.5"
|
|
1598
|
+
className: "clarify-navigation-group-title-icon h-3.5 w-3.5"
|
|
1311
1599
|
}), /* @__PURE__ */ jsx("span", { children: group.title })]
|
|
1312
1600
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1313
1601
|
className: "relative mt-3 pl-2",
|
|
@@ -1319,10 +1607,7 @@ function NavigationGroup(arg0) {
|
|
|
1319
1607
|
pathname
|
|
1320
1608
|
}) : null
|
|
1321
1609
|
}),
|
|
1322
|
-
/* @__PURE__ */ jsx(
|
|
1323
|
-
layout: true,
|
|
1324
|
-
className: "absolute inset-y-0 left-2 w-px bg-zinc-900/10 dark:bg-white/5"
|
|
1325
|
-
}),
|
|
1610
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-2 w-px bg-(--clarify-theme-tokens-colors-border) dark:bg-white/5" }),
|
|
1326
1611
|
/* @__PURE__ */ jsx(AnimatePresence, {
|
|
1327
1612
|
initial: false,
|
|
1328
1613
|
children: isActiveGroup ? /* @__PURE__ */ jsx(ActivePageMarker, {
|
|
@@ -1333,38 +1618,39 @@ function NavigationGroup(arg0) {
|
|
|
1333
1618
|
/* @__PURE__ */ jsx("ul", {
|
|
1334
1619
|
role: "list",
|
|
1335
1620
|
className: "border-l border-transparent",
|
|
1336
|
-
children: group.links.map((link) =>
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1621
|
+
children: group.links.map((link) => {
|
|
1622
|
+
const active = isSameRoutePath(link.href, pathname);
|
|
1623
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
1624
|
+
className: "relative",
|
|
1625
|
+
children: [/* @__PURE__ */ jsx(NavLink, {
|
|
1626
|
+
href: link.href,
|
|
1627
|
+
icon: link.icon,
|
|
1628
|
+
active,
|
|
1629
|
+
children: link.title
|
|
1630
|
+
}), /* @__PURE__ */ jsx(AnimatePresence, {
|
|
1631
|
+
initial: false,
|
|
1632
|
+
children: active && sections.length > 0 ? /* @__PURE__ */ jsx(motion.ul, {
|
|
1633
|
+
role: "list",
|
|
1634
|
+
initial: { opacity: 0 },
|
|
1635
|
+
animate: {
|
|
1636
|
+
opacity: 1,
|
|
1637
|
+
transition: { delay: .1 }
|
|
1638
|
+
},
|
|
1639
|
+
exit: {
|
|
1640
|
+
opacity: 0,
|
|
1641
|
+
transition: { duration: .15 }
|
|
1642
|
+
},
|
|
1643
|
+
children: sections.map((section) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(NavLink, {
|
|
1644
|
+
href: `${link.href}#${section.id}`,
|
|
1645
|
+
badge: section.badge,
|
|
1646
|
+
tags: section.tags,
|
|
1647
|
+
isAnchorLink: true,
|
|
1648
|
+
children: section.title
|
|
1649
|
+
}) }, section.id))
|
|
1650
|
+
}) : null
|
|
1651
|
+
})]
|
|
1652
|
+
}, link.href);
|
|
1653
|
+
})
|
|
1368
1654
|
})
|
|
1369
1655
|
]
|
|
1370
1656
|
})]
|
|
@@ -1372,19 +1658,16 @@ function NavigationGroup(arg0) {
|
|
|
1372
1658
|
}
|
|
1373
1659
|
function Navigation(arg0) {
|
|
1374
1660
|
const { navigation, className } = arg0;
|
|
1375
|
-
const groups = navigationToGroups(navigation);
|
|
1661
|
+
const groups = navigationToGroups(navigation, useBuiltInText()("navigation.documentation"));
|
|
1376
1662
|
return /* @__PURE__ */ jsx("nav", {
|
|
1377
1663
|
className: clsx("clarify-navigation", className),
|
|
1378
|
-
children: /* @__PURE__ */
|
|
1664
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
1379
1665
|
role: "list",
|
|
1380
1666
|
className: "clarify-navigation-list",
|
|
1381
|
-
children:
|
|
1382
|
-
href: "/",
|
|
1383
|
-
children: "Home"
|
|
1384
|
-
}), groups.map((group, groupIndex) => /* @__PURE__ */ jsx(NavigationGroup, {
|
|
1667
|
+
children: groups.map((group, groupIndex) => /* @__PURE__ */ jsx(NavigationGroup, {
|
|
1385
1668
|
group,
|
|
1386
|
-
className: groupIndex === 0 ? "
|
|
1387
|
-
}, group.title))
|
|
1669
|
+
className: groupIndex === 0 ? "mt-0" : ""
|
|
1670
|
+
}, group.title))
|
|
1388
1671
|
})
|
|
1389
1672
|
});
|
|
1390
1673
|
}
|
|
@@ -1411,8 +1694,84 @@ function XIcon(props) {
|
|
|
1411
1694
|
});
|
|
1412
1695
|
}
|
|
1413
1696
|
var IsInsideMobileNavigationContext = createContext(false);
|
|
1697
|
+
function hasPath$1(nodes, pathname) {
|
|
1698
|
+
return nodes.some((node) => isSameRoutePath(node.path, pathname) || hasPath$1(node.children ?? [], pathname));
|
|
1699
|
+
}
|
|
1700
|
+
function isActiveTab$1(tab, pathname) {
|
|
1701
|
+
return isSameRoutePath(tab.path, pathname) || hasPath$1(tab.children, pathname);
|
|
1702
|
+
}
|
|
1703
|
+
function MobileTabsSelect(arg0) {
|
|
1704
|
+
const { tabs } = arg0;
|
|
1705
|
+
const pathname = normalizeRoutePath(useLocation().pathname);
|
|
1706
|
+
const { close } = useMobileNavigationStore();
|
|
1707
|
+
if (!tabs?.length) return null;
|
|
1708
|
+
const activeTab = tabs.find((tab) => isActiveTab$1(tab, pathname)) ?? tabs[0];
|
|
1709
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
1710
|
+
as: "div",
|
|
1711
|
+
className: "clarify-mobile-tabs-select mb-6",
|
|
1712
|
+
children: [/* @__PURE__ */ jsxs(MenuButton, {
|
|
1713
|
+
className: "clarify-mobile-tabs-select-trigger clarify-ui-control group flex h-10 w-full items-center justify-between gap-2 rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) px-4 text-left font-semibold shadow-xs shadow-zinc-900/5 transition dark:border-white/10",
|
|
1714
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
1715
|
+
className: "flex min-w-0 items-center gap-2",
|
|
1716
|
+
children: [/* @__PURE__ */ jsx(NavigationIcon, {
|
|
1717
|
+
name: activeTab.icon,
|
|
1718
|
+
className: "h-4 w-4 shrink-0 text-(--clarify-theme-tokens-colors-primary)"
|
|
1719
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1720
|
+
className: "truncate",
|
|
1721
|
+
children: activeTab.title
|
|
1722
|
+
})]
|
|
1723
|
+
}), /* @__PURE__ */ jsx("svg", {
|
|
1724
|
+
width: "8",
|
|
1725
|
+
height: "24",
|
|
1726
|
+
viewBox: "0 -9 3 24",
|
|
1727
|
+
"aria-hidden": "true",
|
|
1728
|
+
className: "shrink-0 overflow-visible text-(--clarify-theme-tokens-colors-muted) transition-transform group-aria-expanded:rotate-180",
|
|
1729
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1730
|
+
d: "M0 0L3 3L0 6",
|
|
1731
|
+
fill: "none",
|
|
1732
|
+
stroke: "currentColor",
|
|
1733
|
+
strokeWidth: "1.5",
|
|
1734
|
+
strokeLinecap: "round"
|
|
1735
|
+
})
|
|
1736
|
+
})]
|
|
1737
|
+
}), /* @__PURE__ */ jsx(MenuItems, {
|
|
1738
|
+
className: "clarify-mobile-tabs-select-list clarify-ui-menu mt-2 flex flex-col gap-1 rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-1 shadow-lg shadow-zinc-900/5 focus:outline-none dark:border-white/10 dark:bg-zinc-900 dark:shadow-none",
|
|
1739
|
+
children: tabs.map((tab) => {
|
|
1740
|
+
const active = isActiveTab$1(tab, pathname);
|
|
1741
|
+
return /* @__PURE__ */ jsx(MenuItem, { children: /* @__PURE__ */ jsxs(Link, {
|
|
1742
|
+
to: tab.path,
|
|
1743
|
+
onClick: close,
|
|
1744
|
+
className: clsx("clarify-mobile-tabs-select-item clarify-ui-menu-item flex items-center justify-between gap-3 rounded-(--clarify-theme-tokens-radius-lg) px-3 py-2.5 no-underline transition", active && "clarify-ui-menu-item-active"),
|
|
1745
|
+
"aria-current": active ? "page" : void 0,
|
|
1746
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
1747
|
+
className: "flex min-w-0 items-start gap-2",
|
|
1748
|
+
children: [/* @__PURE__ */ jsx(NavigationIcon, {
|
|
1749
|
+
name: tab.icon,
|
|
1750
|
+
className: "mt-0.5 h-4 w-4 shrink-0"
|
|
1751
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1752
|
+
className: "min-w-0 whitespace-normal wrap-anywhere font-medium leading-5",
|
|
1753
|
+
children: tab.title
|
|
1754
|
+
})]
|
|
1755
|
+
}), active ? /* @__PURE__ */ jsx("svg", {
|
|
1756
|
+
viewBox: "0 0 20 20",
|
|
1757
|
+
fill: "none",
|
|
1758
|
+
"aria-hidden": "true",
|
|
1759
|
+
className: "mt-0.5 h-4 w-4 shrink-0",
|
|
1760
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
1761
|
+
d: "m5 10 3 3 7-7",
|
|
1762
|
+
stroke: "currentColor",
|
|
1763
|
+
strokeWidth: "1.8",
|
|
1764
|
+
strokeLinecap: "round",
|
|
1765
|
+
strokeLinejoin: "round"
|
|
1766
|
+
})
|
|
1767
|
+
}) : null]
|
|
1768
|
+
}) }, `${tab.title}-${tab.path}`);
|
|
1769
|
+
})
|
|
1770
|
+
})]
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1414
1773
|
function MobileNavigationDialog(arg0) {
|
|
1415
|
-
const { config, isOpen, navigation, routes, currentLocale, currentRoute, close } = arg0;
|
|
1774
|
+
const { config, isOpen, navigation, tabs, routes, currentLocale, currentRoute, close } = arg0;
|
|
1416
1775
|
return /* @__PURE__ */ jsxs(Dialog, {
|
|
1417
1776
|
transition: true,
|
|
1418
1777
|
open: isOpen,
|
|
@@ -1420,18 +1779,19 @@ function MobileNavigationDialog(arg0) {
|
|
|
1420
1779
|
className: "clarify-mobile-navigation-dialog fixed inset-0 z-50 lg:hidden",
|
|
1421
1780
|
children: [/* @__PURE__ */ jsx(DialogBackdrop, {
|
|
1422
1781
|
transition: true,
|
|
1423
|
-
className: "clarify-mobile-navigation-backdrop fixed inset-0 top-14
|
|
1782
|
+
className: "clarify-mobile-navigation-backdrop clarify-ui-backdrop fixed inset-0 top-14 backdrop-blur-xs data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"
|
|
1424
1783
|
}), /* @__PURE__ */ jsxs(DialogPanel, { children: [/* @__PURE__ */ jsx(TransitionChild, { children: /* @__PURE__ */ jsx(Header, {
|
|
1425
1784
|
config,
|
|
1426
1785
|
navigation,
|
|
1786
|
+
tabs,
|
|
1427
1787
|
routes,
|
|
1428
1788
|
currentLocale,
|
|
1429
1789
|
currentRoute,
|
|
1430
1790
|
className: "data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"
|
|
1431
|
-
}) }), /* @__PURE__ */ jsx(TransitionChild, { children: /* @__PURE__ */
|
|
1791
|
+
}) }), /* @__PURE__ */ jsx(TransitionChild, { children: /* @__PURE__ */ jsxs(motion.div, {
|
|
1432
1792
|
layoutScroll: true,
|
|
1433
|
-
className: "clarify-mobile-navigation-panel fixed top-14 bottom-0 left-0 w-full overflow-y-auto bg-
|
|
1434
|
-
children: /* @__PURE__ */ jsx(Navigation, { navigation })
|
|
1793
|
+
className: "clarify-mobile-navigation-panel fixed top-14 bottom-0 left-0 w-full overflow-y-auto bg-(--clarify-theme-tokens-colors-background) px-4 pt-6 pb-4 shadow-lg ring-1 shadow-zinc-900/10 ring-(--clarify-theme-tokens-colors-border) 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",
|
|
1794
|
+
children: [/* @__PURE__ */ jsx(MobileTabsSelect, { tabs }), /* @__PURE__ */ jsx(Navigation, { navigation })]
|
|
1435
1795
|
}) })] })]
|
|
1436
1796
|
});
|
|
1437
1797
|
}
|
|
@@ -1445,23 +1805,25 @@ var useMobileNavigationStore = create()((set) => ({
|
|
|
1445
1805
|
toggle: () => set((state) => ({ isOpen: !state.isOpen }))
|
|
1446
1806
|
}));
|
|
1447
1807
|
function MobileNavigation(arg0) {
|
|
1448
|
-
const { config, navigation, routes, currentLocale, currentRoute } = arg0;
|
|
1808
|
+
const { config, navigation, tabs, routes, currentLocale, currentRoute } = arg0;
|
|
1449
1809
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1450
1810
|
const { isOpen, toggle, close } = useMobileNavigationStore();
|
|
1811
|
+
const t = useBuiltInText();
|
|
1451
1812
|
const ToggleIcon = isOpen ? XIcon : MenuIcon;
|
|
1452
1813
|
return /* @__PURE__ */ jsxs(IsInsideMobileNavigationContext.Provider, {
|
|
1453
1814
|
value: true,
|
|
1454
1815
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
1455
1816
|
type: "button",
|
|
1456
|
-
className: "clarify-mobile-navigation-button relative flex size-6 items-center justify-center rounded-md transition
|
|
1457
|
-
"aria-label": "
|
|
1817
|
+
className: "clarify-mobile-navigation-button clarify-ui-icon-button relative flex size-6 items-center justify-center rounded-(--clarify-theme-tokens-radius-md) transition",
|
|
1818
|
+
"aria-label": t("navigation.toggle"),
|
|
1458
1819
|
onClick: toggle,
|
|
1459
|
-
children: [/* @__PURE__ */ jsx("span", { className: "absolute size-12 pointer-fine:hidden" }), /* @__PURE__ */ jsx(ToggleIcon, { className: "w-2.5 stroke-
|
|
1820
|
+
children: [/* @__PURE__ */ jsx("span", { className: "absolute size-12 pointer-fine:hidden" }), /* @__PURE__ */ jsx(ToggleIcon, { className: "w-2.5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-white" })]
|
|
1460
1821
|
}), !isInsideMobileNavigation ? /* @__PURE__ */ jsx(Suspense, {
|
|
1461
1822
|
fallback: null,
|
|
1462
1823
|
children: /* @__PURE__ */ jsx(MobileNavigationDialog, {
|
|
1463
1824
|
config,
|
|
1464
1825
|
navigation,
|
|
1826
|
+
tabs,
|
|
1465
1827
|
routes,
|
|
1466
1828
|
currentLocale,
|
|
1467
1829
|
currentRoute,
|
|
@@ -1542,7 +1904,7 @@ function HighlightQuery(arg0) {
|
|
|
1542
1904
|
const { text, query } = arg0;
|
|
1543
1905
|
if (!query) return text;
|
|
1544
1906
|
return /* @__PURE__ */ jsx(Fragment$1, { children: text.split(new RegExp(`(${escapeRegExp(query)})`, "ig")).map((part, index) => part.toLowerCase() === query.toLowerCase() ? /* @__PURE__ */ jsx("mark", {
|
|
1545
|
-
className: "bg-transparent text-
|
|
1907
|
+
className: "bg-transparent text-(--clarify-theme-tokens-colors-primary) underline",
|
|
1546
1908
|
children: part
|
|
1547
1909
|
}, index) : /* @__PURE__ */ jsx(Fragment, { children: part }, index)) });
|
|
1548
1910
|
}
|
|
@@ -1552,25 +1914,25 @@ function SearchResult(arg0) {
|
|
|
1552
1914
|
const hierarchy = [result.sectionTitle, result.pageTitle].filter((value) => typeof value === "string");
|
|
1553
1915
|
return /* @__PURE__ */ jsxs("li", {
|
|
1554
1916
|
id,
|
|
1555
|
-
className: clsx("clarify-search-result group block cursor-default px-4 py-3
|
|
1917
|
+
className: clsx("clarify-search-result group block cursor-default px-4 py-3", active && "clarify-search-result-active"),
|
|
1556
1918
|
"aria-selected": active,
|
|
1557
1919
|
onMouseDown: (event) => {
|
|
1558
1920
|
event.preventDefault();
|
|
1559
1921
|
onSelect();
|
|
1560
1922
|
},
|
|
1561
1923
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1562
|
-
className: "
|
|
1924
|
+
className: "clarify-search-result-title",
|
|
1563
1925
|
children: /* @__PURE__ */ jsx(HighlightQuery, {
|
|
1564
1926
|
text: result.title,
|
|
1565
1927
|
query
|
|
1566
1928
|
})
|
|
1567
1929
|
}), hierarchy.length > 0 ? /* @__PURE__ */ jsx("div", {
|
|
1568
|
-
className: "mt-1 truncate
|
|
1930
|
+
className: "clarify-search-result-hierarchy mt-1 truncate whitespace-nowrap",
|
|
1569
1931
|
children: hierarchy.map((item, itemIndex, items) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(HighlightQuery, {
|
|
1570
1932
|
text: item,
|
|
1571
1933
|
query
|
|
1572
1934
|
}), /* @__PURE__ */ jsx("span", {
|
|
1573
|
-
className: itemIndex === items.length - 1 ? "sr-only" : "
|
|
1935
|
+
className: itemIndex === items.length - 1 ? "sr-only" : "clarify-search-result-separator mx-2",
|
|
1574
1936
|
children: "/"
|
|
1575
1937
|
})] }, `${item}-${itemIndex}`))
|
|
1576
1938
|
}) : null]
|
|
@@ -1578,9 +1940,10 @@ function SearchResult(arg0) {
|
|
|
1578
1940
|
}
|
|
1579
1941
|
var SearchInput = forwardRef(function SearchInput(arg0, inputRef) {
|
|
1580
1942
|
const { query, setQuery, onClose, onSubmit, activeDescendantId } = arg0;
|
|
1943
|
+
const t = useBuiltInText();
|
|
1581
1944
|
return /* @__PURE__ */ jsxs("div", {
|
|
1582
1945
|
className: "clarify-search-input group relative flex h-12",
|
|
1583
|
-
children: [/* @__PURE__ */ jsx(SearchIcon, { className: "pointer-events-none absolute top-0 left-3 h-full w-5 stroke-
|
|
1946
|
+
children: [/* @__PURE__ */ jsx(SearchIcon, { className: "pointer-events-none absolute top-0 left-3 h-full w-5 stroke-(--clarify-theme-tokens-colors-muted)" }), /* @__PURE__ */ jsx("input", {
|
|
1584
1947
|
ref: inputRef,
|
|
1585
1948
|
"data-autofocus": true,
|
|
1586
1949
|
role: "combobox",
|
|
@@ -1597,13 +1960,14 @@ var SearchInput = forwardRef(function SearchInput(arg0, inputRef) {
|
|
|
1597
1960
|
onSubmit();
|
|
1598
1961
|
}
|
|
1599
1962
|
},
|
|
1600
|
-
placeholder: "
|
|
1601
|
-
className: "flex-auto appearance-none bg-transparent pr-4 pl-10
|
|
1963
|
+
placeholder: t("search.placeholder"),
|
|
1964
|
+
className: "clarify-search-field flex-auto appearance-none bg-transparent pr-4 pl-10 outline-hidden focus:w-full focus:flex-none [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden"
|
|
1602
1965
|
})]
|
|
1603
1966
|
});
|
|
1604
1967
|
});
|
|
1605
1968
|
function SearchDialog(arg0) {
|
|
1606
1969
|
const { open, setOpen, routes, navigation, className, onNavigate = () => {} } = arg0;
|
|
1970
|
+
const t = useBuiltInText();
|
|
1607
1971
|
const navigate = useNavigate();
|
|
1608
1972
|
const location = useLocation();
|
|
1609
1973
|
const inputRef = useRef(null);
|
|
@@ -1654,12 +2018,12 @@ function SearchDialog(arg0) {
|
|
|
1654
2018
|
className: clsx("clarify-search-dialog fixed inset-0 z-50", className),
|
|
1655
2019
|
children: [/* @__PURE__ */ jsx(DialogBackdrop, {
|
|
1656
2020
|
transition: true,
|
|
1657
|
-
className: "clarify-search-backdrop fixed inset-0
|
|
2021
|
+
className: "clarify-search-backdrop clarify-ui-backdrop fixed inset-0 backdrop-blur-xs data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in"
|
|
1658
2022
|
}), /* @__PURE__ */ jsx("div", {
|
|
1659
2023
|
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]",
|
|
1660
2024
|
children: /* @__PURE__ */ jsxs(DialogPanel, {
|
|
1661
2025
|
transition: true,
|
|
1662
|
-
className: "clarify-search-panel mx-auto transform-gpu overflow-hidden rounded-lg bg-
|
|
2026
|
+
className: "clarify-search-panel mx-auto transform-gpu overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) bg-(--clarify-theme-tokens-colors-surface) shadow-xl ring-1 ring-(--clarify-theme-tokens-colors-border) 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",
|
|
1663
2027
|
onKeyDown: (event) => {
|
|
1664
2028
|
if (event.key === "ArrowDown") {
|
|
1665
2029
|
event.preventDefault();
|
|
@@ -1677,24 +2041,12 @@ function SearchDialog(arg0) {
|
|
|
1677
2041
|
onClose: closeDialog,
|
|
1678
2042
|
onSubmit: () => selectResult()
|
|
1679
2043
|
}), /* @__PURE__ */ jsxs("div", {
|
|
1680
|
-
className: "border-t border-
|
|
2044
|
+
className: "border-t border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background) empty:hidden dark:border-zinc-100/5 dark:bg-white/2.5",
|
|
1681
2045
|
children: [query && results.length === 0 ? /* @__PURE__ */ jsxs("div", {
|
|
1682
2046
|
className: "p-6 text-center",
|
|
1683
|
-
children: [/* @__PURE__ */ jsx(NoResultsIcon, { className: "mx-auto h-5 w-5 stroke-
|
|
1684
|
-
className: "mt-2 text-xs text-
|
|
1685
|
-
children:
|
|
1686
|
-
"Nothing found for",
|
|
1687
|
-
" ",
|
|
1688
|
-
/* @__PURE__ */ jsxs("strong", {
|
|
1689
|
-
className: "font-semibold wrap-break-word text-zinc-900 dark:text-white",
|
|
1690
|
-
children: [
|
|
1691
|
-
"‘",
|
|
1692
|
-
query,
|
|
1693
|
-
"’"
|
|
1694
|
-
]
|
|
1695
|
-
}),
|
|
1696
|
-
"."
|
|
1697
|
-
]
|
|
2047
|
+
children: [/* @__PURE__ */ jsx(NoResultsIcon, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ jsx("p", {
|
|
2048
|
+
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
2049
|
+
children: t("search.noResults", { query })
|
|
1698
2050
|
})]
|
|
1699
2051
|
}) : null, results.length ? /* @__PURE__ */ jsx("ul", {
|
|
1700
2052
|
id: "clarify-search-results",
|
|
@@ -1734,19 +2086,20 @@ function getModifierKey() {
|
|
|
1734
2086
|
}
|
|
1735
2087
|
function Search(arg0) {
|
|
1736
2088
|
const { routes, navigation } = arg0;
|
|
2089
|
+
const t = useBuiltInText();
|
|
1737
2090
|
const modifierKey = getModifierKey();
|
|
1738
2091
|
const { buttonProps, dialogProps } = useSearchProps();
|
|
1739
2092
|
return /* @__PURE__ */ jsxs("div", {
|
|
1740
|
-
className: "clarify-search hidden
|
|
2093
|
+
className: "clarify-search hidden w-80 max-w-[36vw] lg:block",
|
|
1741
2094
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
1742
2095
|
type: "button",
|
|
1743
|
-
className: "clarify-search-button hidden h-
|
|
2096
|
+
className: "clarify-search-button hidden h-9 w-full items-center gap-2 rounded-(--clarify-theme-tokens-radius-lg) bg-(--clarify-theme-tokens-colors-surface) pr-3 pl-2.5 font-medium ring-1 ring-(--clarify-theme-tokens-colors-border) transition hover:bg-(--clarify-theme-tokens-colors-background) lg:flex dark:bg-white/5 dark:ring-white/10 dark:ring-inset dark:hover:bg-white/10",
|
|
1744
2097
|
...buttonProps,
|
|
1745
2098
|
children: [
|
|
1746
2099
|
/* @__PURE__ */ jsx(SearchIcon, { className: "h-5 w-5 stroke-current" }),
|
|
1747
|
-
"
|
|
2100
|
+
t("search.button"),
|
|
1748
2101
|
/* @__PURE__ */ jsxs("kbd", {
|
|
1749
|
-
className: "ml-auto
|
|
2102
|
+
className: "clarify-search-shortcut ml-auto rounded-(--clarify-theme-tokens-radius-sm) bg-(--clarify-theme-tokens-colors-background) px-1.5 py-0.5 ring-1 ring-(--clarify-theme-tokens-colors-border) dark:bg-white/5 dark:ring-white/10",
|
|
1750
2103
|
children: [/* @__PURE__ */ jsx("kbd", {
|
|
1751
2104
|
className: "font-sans",
|
|
1752
2105
|
children: modifierKey
|
|
@@ -1769,15 +2122,16 @@ function Search(arg0) {
|
|
|
1769
2122
|
}
|
|
1770
2123
|
function MobileSearch(arg0) {
|
|
1771
2124
|
const { routes, navigation, onNavigate } = arg0;
|
|
2125
|
+
const t = useBuiltInText();
|
|
1772
2126
|
const { buttonProps, dialogProps } = useSearchProps();
|
|
1773
2127
|
return /* @__PURE__ */ jsxs("div", {
|
|
1774
2128
|
className: "clarify-mobile-search contents lg:hidden",
|
|
1775
2129
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
1776
2130
|
type: "button",
|
|
1777
|
-
className: "clarify-mobile-search-button relative flex size-6 items-center justify-center rounded-md transition
|
|
1778
|
-
"aria-label": "
|
|
2131
|
+
className: "clarify-mobile-search-button clarify-ui-control relative flex size-6 items-center justify-center rounded-(--clarify-theme-tokens-radius-md) transition lg:hidden",
|
|
2132
|
+
"aria-label": t("search.placeholder"),
|
|
1779
2133
|
...buttonProps,
|
|
1780
|
-
children: [/* @__PURE__ */ jsx("span", { className: "absolute size-12 pointer-fine:hidden" }), /* @__PURE__ */ jsx(SearchIcon, { className: "h-5 w-5 stroke-
|
|
2134
|
+
children: [/* @__PURE__ */ jsx("span", { className: "absolute size-12 pointer-fine:hidden" }), /* @__PURE__ */ jsx(SearchIcon, { className: "h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-white" })]
|
|
1781
2135
|
}), /* @__PURE__ */ jsx(Suspense, {
|
|
1782
2136
|
fallback: null,
|
|
1783
2137
|
children: /* @__PURE__ */ jsx(SearchDialog, {
|
|
@@ -1791,20 +2145,39 @@ function MobileSearch(arg0) {
|
|
|
1791
2145
|
});
|
|
1792
2146
|
}
|
|
1793
2147
|
//#endregion
|
|
2148
|
+
//#region source/shell/SiteLogo.tsx
|
|
2149
|
+
function SiteLogo(arg0) {
|
|
2150
|
+
const { logo, className } = arg0;
|
|
2151
|
+
if (!logo) return null;
|
|
2152
|
+
if (typeof logo === "string") return /* @__PURE__ */ jsx("img", {
|
|
2153
|
+
src: logo,
|
|
2154
|
+
alt: "",
|
|
2155
|
+
className: clsx("clarify-logo", className)
|
|
2156
|
+
});
|
|
2157
|
+
const lightLogo = logo.light ?? logo.dark;
|
|
2158
|
+
const darkLogo = logo.dark ?? logo.light;
|
|
2159
|
+
if (!lightLogo || !darkLogo) return null;
|
|
2160
|
+
if (lightLogo === darkLogo) return /* @__PURE__ */ jsx("img", {
|
|
2161
|
+
src: lightLogo,
|
|
2162
|
+
alt: "",
|
|
2163
|
+
className: clsx("clarify-logo", className)
|
|
2164
|
+
});
|
|
2165
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("img", {
|
|
2166
|
+
src: lightLogo,
|
|
2167
|
+
alt: "",
|
|
2168
|
+
className: clsx("clarify-logo clarify-logo-light", className, "dark:hidden")
|
|
2169
|
+
}), /* @__PURE__ */ jsx("img", {
|
|
2170
|
+
src: darkLogo,
|
|
2171
|
+
alt: "",
|
|
2172
|
+
className: clsx("clarify-logo clarify-logo-dark", className, "hidden dark:block")
|
|
2173
|
+
})] });
|
|
2174
|
+
}
|
|
2175
|
+
//#endregion
|
|
1794
2176
|
//#region source/shell/Header.tsx
|
|
1795
2177
|
function resolveLocalizedText(text, locale, fallbackLocale) {
|
|
1796
2178
|
if (typeof text === "string") return text;
|
|
1797
2179
|
return (locale ? text[locale] : void 0) ?? (fallbackLocale ? text[fallbackLocale] : void 0) ?? Object.values(text)[0] ?? "";
|
|
1798
2180
|
}
|
|
1799
|
-
function isExternalHref(href) {
|
|
1800
|
-
return /^[a-z][a-z0-9+.-]*:/i.test(href) || href.startsWith("//");
|
|
1801
|
-
}
|
|
1802
|
-
function localizeHref(href, config, locale) {
|
|
1803
|
-
if (!locale || !config.i18n || isExternalHref(href) || href.startsWith("#")) return href;
|
|
1804
|
-
if (locale === config.i18n.defaultLocale) return href;
|
|
1805
|
-
const cleanHref = href === "/" ? "" : href.replace(/^\/+/, "");
|
|
1806
|
-
return `/${locale}${cleanHref ? `/${cleanHref}` : ""}`;
|
|
1807
|
-
}
|
|
1808
2181
|
function localizedRoutePath(config, locale, route) {
|
|
1809
2182
|
const alternatePath = route?.alternates?.[locale];
|
|
1810
2183
|
if (alternatePath) return alternatePath;
|
|
@@ -1822,6 +2195,7 @@ function LanguageIcon(props) {
|
|
|
1822
2195
|
}
|
|
1823
2196
|
function LanguageSwitcher(arg0) {
|
|
1824
2197
|
const { config, currentLocale, currentRoute } = arg0;
|
|
2198
|
+
const t = useBuiltInText();
|
|
1825
2199
|
const location = useLocation();
|
|
1826
2200
|
const i18n = config.i18n;
|
|
1827
2201
|
if (!i18n || i18n.locales.length < 2) return null;
|
|
@@ -1832,8 +2206,8 @@ function LanguageSwitcher(arg0) {
|
|
|
1832
2206
|
as: "div",
|
|
1833
2207
|
className: "clarify-language-switcher relative",
|
|
1834
2208
|
children: [/* @__PURE__ */ jsxs(MenuButton, {
|
|
1835
|
-
className: "clarify-language-switcher-button flex h-7 items-center gap-1.5 rounded-md px-1.5
|
|
1836
|
-
"aria-label": "
|
|
2209
|
+
className: "clarify-language-switcher-button clarify-ui-control flex h-7 items-center gap-1.5 rounded-(--clarify-theme-tokens-radius-md) px-1.5 transition",
|
|
2210
|
+
"aria-label": t("language.switch"),
|
|
1837
2211
|
children: [
|
|
1838
2212
|
/* @__PURE__ */ jsx("span", { className: "absolute size-12 pointer-fine:hidden" }),
|
|
1839
2213
|
/* @__PURE__ */ jsx(LanguageIcon, { className: "h-5 w-5 stroke-current" }),
|
|
@@ -1844,19 +2218,19 @@ function LanguageSwitcher(arg0) {
|
|
|
1844
2218
|
]
|
|
1845
2219
|
}), /* @__PURE__ */ jsx(MenuItems, {
|
|
1846
2220
|
transition: true,
|
|
1847
|
-
className: "clarify-language-switcher-menu absolute right-0 z-50 mt-2 w-
|
|
2221
|
+
className: "clarify-language-switcher-menu clarify-ui-menu absolute right-0 z-50 mt-2 w-(--clarify-ui-menu-width) rounded-(--clarify-theme-tokens-radius-xl) bg-(--clarify-theme-tokens-colors-surface) p-1 shadow-lg ring-1 shadow-zinc-900/5 ring-(--clarify-theme-tokens-colors-border) 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",
|
|
1848
2222
|
children: i18n.locales.flatMap((locale) => {
|
|
1849
2223
|
const localizedPath = localizedRoutePath(config, locale.code, currentRoute);
|
|
1850
2224
|
if (!localizedPath) return [];
|
|
1851
2225
|
const selected = locale.code === selectedLocale;
|
|
1852
2226
|
return [/* @__PURE__ */ jsx(MenuItem, { children: ({ focus }) => /* @__PURE__ */ jsxs(Link, {
|
|
1853
2227
|
to: `${localizedPath}${suffix}`,
|
|
1854
|
-
className: clsx("clarify-language-switcher-item flex items-center justify-between rounded-lg px-3 py-2 no-underline transition", focus && "
|
|
2228
|
+
className: clsx("clarify-language-switcher-item clarify-ui-menu-item flex items-center justify-between rounded-(--clarify-theme-tokens-radius-lg) px-3 py-2 no-underline transition", focus && "clarify-ui-menu-item-focus", selected && "clarify-ui-menu-item-active"),
|
|
1855
2229
|
"aria-current": selected ? "true" : void 0,
|
|
1856
2230
|
lang: locale.code,
|
|
1857
2231
|
dir: locale.dir,
|
|
1858
2232
|
children: [/* @__PURE__ */ jsx("span", { children: locale.label }), /* @__PURE__ */ jsx("span", {
|
|
1859
|
-
className: "
|
|
2233
|
+
className: "clarify-ui-menu-code",
|
|
1860
2234
|
children: locale.code
|
|
1861
2235
|
})]
|
|
1862
2236
|
}) }, locale.code)];
|
|
@@ -1868,199 +2242,186 @@ function TopLevelNavItem(arg0) {
|
|
|
1868
2242
|
const { href, children } = arg0;
|
|
1869
2243
|
if (isExternalHref(href)) return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
|
|
1870
2244
|
href,
|
|
1871
|
-
className: "
|
|
2245
|
+
className: "clarify-ui-top-link transition",
|
|
1872
2246
|
target: "_blank",
|
|
1873
2247
|
rel: "noreferrer",
|
|
1874
2248
|
children
|
|
1875
2249
|
}) });
|
|
1876
2250
|
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Link, {
|
|
1877
2251
|
to: href,
|
|
1878
|
-
className: "
|
|
2252
|
+
className: "clarify-ui-top-link transition",
|
|
1879
2253
|
children
|
|
1880
2254
|
}) });
|
|
1881
2255
|
}
|
|
2256
|
+
function MobileNavbarMenu(arg0) {
|
|
2257
|
+
const { links, config, currentLocale } = arg0;
|
|
2258
|
+
const t = useBuiltInText();
|
|
2259
|
+
if (!links?.length) return null;
|
|
2260
|
+
return /* @__PURE__ */ jsxs(Menu, {
|
|
2261
|
+
as: "div",
|
|
2262
|
+
className: "clarify-mobile-navbar-menu relative md:hidden",
|
|
2263
|
+
children: [/* @__PURE__ */ jsxs(MenuButton, {
|
|
2264
|
+
className: "clarify-mobile-navbar-menu-button clarify-ui-control relative flex size-8 items-center justify-center rounded-(--clarify-theme-tokens-radius-md) transition",
|
|
2265
|
+
"aria-label": t("navbar.openLinks"),
|
|
2266
|
+
children: [/* @__PURE__ */ jsx("span", { className: "absolute size-12 pointer-fine:hidden" }), /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-5 w-5" })]
|
|
2267
|
+
}), /* @__PURE__ */ jsx(MenuItems, {
|
|
2268
|
+
transition: true,
|
|
2269
|
+
anchor: "bottom end",
|
|
2270
|
+
className: "clarify-mobile-navbar-menu-list clarify-ui-menu z-50 mt-2 w-(--clarify-ui-menu-width) rounded-(--clarify-theme-tokens-radius-xl) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-1 shadow-lg transition [--anchor-gap:--spacing(2)] focus:outline-none data-closed:scale-95 data-closed:opacity-0 dark:border-white/10 dark:bg-zinc-900",
|
|
2271
|
+
children: links.map((link) => {
|
|
2272
|
+
const label = resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale);
|
|
2273
|
+
const href = localizeHref(link.href, config, currentLocale);
|
|
2274
|
+
const external = isExternalHref(href);
|
|
2275
|
+
return /* @__PURE__ */ jsx(MenuItem, { children: ({ focus }) => {
|
|
2276
|
+
const className = clsx("clarify-mobile-navbar-menu-item clarify-ui-menu-item block rounded-(--clarify-theme-tokens-radius-lg) px-3 py-2 no-underline transition", focus && "clarify-ui-menu-item-focus");
|
|
2277
|
+
return external ? /* @__PURE__ */ jsx("a", {
|
|
2278
|
+
href,
|
|
2279
|
+
target: "_blank",
|
|
2280
|
+
rel: "noreferrer",
|
|
2281
|
+
className,
|
|
2282
|
+
children: label
|
|
2283
|
+
}) : /* @__PURE__ */ jsx(Link, {
|
|
2284
|
+
to: href,
|
|
2285
|
+
className,
|
|
2286
|
+
children: label
|
|
2287
|
+
});
|
|
2288
|
+
} }, link.href);
|
|
2289
|
+
})
|
|
2290
|
+
})]
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
function hasPath(nodes, pathname) {
|
|
2294
|
+
return nodes.some((node) => isSameRoutePath(node.path, pathname) || hasPath(node.children ?? [], pathname));
|
|
2295
|
+
}
|
|
2296
|
+
function isActiveTab(tab, pathname) {
|
|
2297
|
+
return isSameRoutePath(tab.path, pathname) || hasPath(tab.children, pathname);
|
|
2298
|
+
}
|
|
2299
|
+
function ProductTabs(arg0) {
|
|
2300
|
+
const { tabs } = arg0;
|
|
2301
|
+
const t = useBuiltInText();
|
|
2302
|
+
const pathname = normalizeRoutePath(useLocation().pathname);
|
|
2303
|
+
if (!tabs?.length) return null;
|
|
2304
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2305
|
+
className: "clarify-product-tabs hidden h-14 border-t border-(--clarify-theme-tokens-colors-border) lg:block dark:border-white/10",
|
|
2306
|
+
children: /* @__PURE__ */ jsx("nav", {
|
|
2307
|
+
className: "clarify-product-tabs-nav mx-auto flex h-full w-full max-w-(--clarify-theme-layout-max-width) items-stretch gap-6 overflow-x-auto px-5",
|
|
2308
|
+
"aria-label": t("navbar.sections"),
|
|
2309
|
+
children: tabs.map((tab) => {
|
|
2310
|
+
const active = isActiveTab(tab, pathname);
|
|
2311
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
2312
|
+
to: tab.path,
|
|
2313
|
+
"aria-current": active ? "page" : void 0,
|
|
2314
|
+
className: clsx("clarify-product-tab clarify-ui-tab relative inline-flex h-full shrink-0 items-center gap-2 px-0 transition", active && "clarify-ui-tab-active"),
|
|
2315
|
+
children: [
|
|
2316
|
+
/* @__PURE__ */ jsx(NavigationIcon, {
|
|
2317
|
+
name: tab.icon,
|
|
2318
|
+
className: "h-4 w-4"
|
|
2319
|
+
}),
|
|
2320
|
+
/* @__PURE__ */ jsx("span", { children: tab.title }),
|
|
2321
|
+
active ? /* @__PURE__ */ jsx(motion.span, {
|
|
2322
|
+
layoutId: "clarify-product-tab-indicator",
|
|
2323
|
+
className: "absolute inset-x-0 bottom-0 h-0.5 rounded-full bg-(--clarify-theme-tokens-colors-foreground) dark:bg-white",
|
|
2324
|
+
transition: {
|
|
2325
|
+
type: "tween",
|
|
2326
|
+
duration: .16,
|
|
2327
|
+
ease: "easeOut"
|
|
2328
|
+
}
|
|
2329
|
+
}) : null
|
|
2330
|
+
]
|
|
2331
|
+
}, `${tab.title}-${tab.path}`);
|
|
2332
|
+
})
|
|
2333
|
+
})
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
1882
2336
|
var Header = forwardRef(function Header(arg0, ref) {
|
|
1883
|
-
const { config, navigation, routes, currentLocale, currentRoute, className, ...props } = arg0;
|
|
2337
|
+
const { config, navigation, tabs, routes, currentLocale, currentRoute, className, ...props } = arg0;
|
|
2338
|
+
const t = useBuiltInText();
|
|
1884
2339
|
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1885
2340
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1886
2341
|
const { scrollY } = useScroll();
|
|
1887
|
-
const bgOpacityLight = useTransform(scrollY, [0, 72], ["
|
|
1888
|
-
const bgOpacityDark = useTransform(scrollY, [0, 72], ["
|
|
1889
|
-
return /* @__PURE__ */ jsxs(motion.
|
|
2342
|
+
const bgOpacityLight = useTransform(scrollY, [0, 72], ["70%", "95%"]);
|
|
2343
|
+
const bgOpacityDark = useTransform(scrollY, [0, 72], ["60%", "92%"]);
|
|
2344
|
+
return /* @__PURE__ */ jsxs(motion.header, {
|
|
1890
2345
|
...props,
|
|
1891
2346
|
ref,
|
|
1892
|
-
className: clsx(className, "clarify-header fixed inset-x-0 top-0 z-50
|
|
2347
|
+
className: clsx(className, "clarify-header fixed inset-x-0 top-0 z-50 border-b border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background)/(--bg-opacity-light) backdrop-blur-xs transition dark:border-white/10 dark:bg-zinc-950/(--bg-opacity-dark) dark:backdrop-blur-sm", isInsideMobileNavigation && "bg-(--clarify-theme-tokens-colors-background) dark:bg-zinc-950"),
|
|
1893
2348
|
style: {
|
|
1894
2349
|
"--bg-opacity-light": bgOpacityLight,
|
|
1895
2350
|
"--bg-opacity-dark": bgOpacityDark
|
|
1896
2351
|
},
|
|
1897
|
-
children: [
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
"aria-label": "Home",
|
|
1912
|
-
className: "clarify-brand flex items-center gap-2 no-underline",
|
|
1913
|
-
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
1914
|
-
logo: config.logo,
|
|
1915
|
-
className: "h-6 w-6"
|
|
1916
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1917
|
-
className: "sr-only",
|
|
1918
|
-
children: config.title
|
|
1919
|
-
})]
|
|
1920
|
-
}) : null]
|
|
1921
|
-
}),
|
|
1922
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1923
|
-
className: "clarify-header-actions flex items-center gap-5",
|
|
1924
|
-
children: [
|
|
1925
|
-
/* @__PURE__ */ jsx(Search, {
|
|
1926
|
-
routes,
|
|
1927
|
-
navigation
|
|
1928
|
-
}),
|
|
1929
|
-
config.navbar?.links?.length ? /* @__PURE__ */ jsx("nav", {
|
|
1930
|
-
className: "clarify-top-nav hidden md:block",
|
|
1931
|
-
children: /* @__PURE__ */ jsx("ul", {
|
|
1932
|
-
role: "list",
|
|
1933
|
-
className: "flex items-center gap-8",
|
|
1934
|
-
children: config.navbar.links.map((link) => /* @__PURE__ */ jsx(TopLevelNavItem, {
|
|
1935
|
-
href: localizeHref(link.href, config, currentLocale),
|
|
1936
|
-
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
1937
|
-
}, link.href))
|
|
2352
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2353
|
+
className: clsx("clarify-header-main relative mx-auto flex h-14 w-full max-w-(--clarify-theme-layout-max-width) items-center justify-between gap-6 px-4 sm:px-6 lg:px-5", (isInsideMobileNavigation || !mobileNavIsOpen) && "shadow-none"),
|
|
2354
|
+
children: [
|
|
2355
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2356
|
+
className: "clarify-header-left flex min-w-0 items-center gap-5",
|
|
2357
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2358
|
+
className: "clarify-mobile-brand flex items-center gap-5 lg:hidden",
|
|
2359
|
+
children: /* @__PURE__ */ jsx(MobileNavigation, {
|
|
2360
|
+
config,
|
|
2361
|
+
navigation,
|
|
2362
|
+
tabs,
|
|
2363
|
+
routes,
|
|
2364
|
+
currentLocale,
|
|
2365
|
+
currentRoute
|
|
1938
2366
|
})
|
|
1939
|
-
})
|
|
1940
|
-
|
|
1941
|
-
|
|
2367
|
+
}), /* @__PURE__ */ jsxs(CloseButton, {
|
|
2368
|
+
as: Link,
|
|
2369
|
+
to: localizeHref("/", config, currentLocale),
|
|
2370
|
+
"aria-label": t("navbar.home"),
|
|
2371
|
+
className: "clarify-brand flex min-w-0 items-center gap-2 no-underline",
|
|
2372
|
+
children: [/* @__PURE__ */ jsx(SiteLogo, {
|
|
2373
|
+
logo: config.logo,
|
|
2374
|
+
className: "h-6 w-6 shrink-0"
|
|
2375
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2376
|
+
className: "clarify-brand-title truncate font-semibold",
|
|
2377
|
+
children: config.title
|
|
2378
|
+
})]
|
|
2379
|
+
})]
|
|
2380
|
+
}),
|
|
2381
|
+
/* @__PURE__ */ jsx("div", {
|
|
2382
|
+
className: "clarify-header-center absolute left-1/2 hidden -translate-x-1/2 lg:block",
|
|
2383
|
+
children: /* @__PURE__ */ jsx(Search, {
|
|
1942
2384
|
routes,
|
|
1943
2385
|
navigation
|
|
1944
|
-
})
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
currentRoute
|
|
1949
|
-
}),
|
|
1950
|
-
/* @__PURE__ */ jsx(ThemeToggle, {})
|
|
1951
|
-
]
|
|
1952
|
-
})
|
|
1953
|
-
]
|
|
1954
|
-
});
|
|
1955
|
-
});
|
|
1956
|
-
//#endregion
|
|
1957
|
-
//#region source/app/AppShell.tsx
|
|
1958
|
-
function routeForPath(routes, pathname) {
|
|
1959
|
-
return routes.find((route) => route.path === pathname || `/${route.path}` === pathname);
|
|
1960
|
-
}
|
|
1961
|
-
function sectionsForRoute(route) {
|
|
1962
|
-
return route?.sections?.map((section) => ({
|
|
1963
|
-
id: section.id,
|
|
1964
|
-
title: section.title,
|
|
1965
|
-
badge: section.badge,
|
|
1966
|
-
tags: section.tags
|
|
1967
|
-
})) ?? [];
|
|
1968
|
-
}
|
|
1969
|
-
function scrollToHash(hash) {
|
|
1970
|
-
if (!hash) return;
|
|
1971
|
-
const targetId = decodeURIComponent(hash.slice(1));
|
|
1972
|
-
window.requestAnimationFrame(() => {
|
|
1973
|
-
document.getElementById(targetId)?.scrollIntoView();
|
|
1974
|
-
});
|
|
1975
|
-
}
|
|
1976
|
-
function localeForPath(config, pathname, route) {
|
|
1977
|
-
if (route?.locale) return route.locale;
|
|
1978
|
-
const i18n = config.i18n;
|
|
1979
|
-
if (!i18n) return void 0;
|
|
1980
|
-
const firstSegment = pathname.split("/").filter(Boolean)[0];
|
|
1981
|
-
return i18n.locales.find((locale) => locale.code === firstSegment)?.code ?? i18n.defaultLocale;
|
|
1982
|
-
}
|
|
1983
|
-
function navigationForLocale(navigation, locale) {
|
|
1984
|
-
if (Array.isArray(navigation)) return navigation;
|
|
1985
|
-
if (!locale) return [];
|
|
1986
|
-
return navigation[locale] ?? [];
|
|
1987
|
-
}
|
|
1988
|
-
function homePathForLocale(config, locale) {
|
|
1989
|
-
if (!locale || !config.i18n || locale === config.i18n.defaultLocale) return "/";
|
|
1990
|
-
return `/${locale}`;
|
|
1991
|
-
}
|
|
1992
|
-
function AppShell(arg0) {
|
|
1993
|
-
const { config, routes, navigation } = arg0;
|
|
1994
|
-
const location = useLocation();
|
|
1995
|
-
const currentRoute = routeForPath(routes, location.pathname);
|
|
1996
|
-
const currentLocale = localeForPath(config, location.pathname, currentRoute);
|
|
1997
|
-
const currentLocaleConfig = config.i18n?.locales.find((locale) => locale.code === currentLocale);
|
|
1998
|
-
const currentNavigation = navigationForLocale(navigation, currentLocale);
|
|
1999
|
-
const sections = sectionsForRoute(currentRoute);
|
|
2000
|
-
useEffect(() => {
|
|
2001
|
-
scrollToHash(location.hash);
|
|
2002
|
-
}, [location.hash, location.pathname]);
|
|
2003
|
-
useEffect(() => {
|
|
2004
|
-
if (!currentLocale) return;
|
|
2005
|
-
document.documentElement.lang = currentLocale;
|
|
2006
|
-
if (currentLocaleConfig?.dir) document.documentElement.dir = currentLocaleConfig.dir;
|
|
2007
|
-
else document.documentElement.removeAttribute("dir");
|
|
2008
|
-
}, [currentLocale, currentLocaleConfig?.dir]);
|
|
2009
|
-
return /* @__PURE__ */ jsx(SectionProvider, {
|
|
2010
|
-
sections,
|
|
2011
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
2012
|
-
className: "clarify-app h-full min-h-screen bg-white lg:ml-72 xl:ml-80 dark:bg-zinc-950",
|
|
2013
|
-
children: [/* @__PURE__ */ jsx(motion.header, {
|
|
2014
|
-
layoutScroll: true,
|
|
2015
|
-
className: "clarify-shell contents lg:pointer-events-none lg:fixed lg:inset-0 lg:z-40 lg:flex",
|
|
2016
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
2017
|
-
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",
|
|
2386
|
+
})
|
|
2387
|
+
}),
|
|
2388
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2389
|
+
className: "clarify-header-actions flex shrink-0 items-center gap-5",
|
|
2018
2390
|
children: [
|
|
2019
|
-
/* @__PURE__ */ jsx("
|
|
2020
|
-
className: "clarify-
|
|
2021
|
-
children: /* @__PURE__ */
|
|
2022
|
-
|
|
2023
|
-
"
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
2029
|
-
className: "clarify-brand-title text-sm font-semibold text-zinc-900 dark:text-white",
|
|
2030
|
-
children: config.title
|
|
2031
|
-
})]
|
|
2391
|
+
config.navbar?.links?.length ? /* @__PURE__ */ jsx("nav", {
|
|
2392
|
+
className: "clarify-top-nav hidden md:block",
|
|
2393
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
2394
|
+
role: "list",
|
|
2395
|
+
className: "flex items-center gap-8",
|
|
2396
|
+
children: config.navbar.links.map((link) => /* @__PURE__ */ jsx(TopLevelNavItem, {
|
|
2397
|
+
href: localizeHref(link.href, config, currentLocale),
|
|
2398
|
+
children: resolveLocalizedText(link.label, currentLocale, config.i18n?.defaultLocale)
|
|
2399
|
+
}, link.href))
|
|
2032
2400
|
})
|
|
2401
|
+
}) : null,
|
|
2402
|
+
config.navbar?.links?.length ? /* @__PURE__ */ jsx("div", { className: "hidden md:block md:h-5 md:w-px md:bg-(--clarify-theme-tokens-colors-border) md:dark:bg-white/15" }) : null,
|
|
2403
|
+
/* @__PURE__ */ jsx(MobileSearch, {
|
|
2404
|
+
routes,
|
|
2405
|
+
navigation
|
|
2033
2406
|
}),
|
|
2034
|
-
/* @__PURE__ */ jsx(
|
|
2407
|
+
/* @__PURE__ */ jsx(LanguageSwitcher, {
|
|
2035
2408
|
config,
|
|
2036
|
-
navigation: currentNavigation,
|
|
2037
|
-
routes,
|
|
2038
2409
|
currentLocale,
|
|
2039
2410
|
currentRoute
|
|
2040
2411
|
}),
|
|
2041
|
-
/* @__PURE__ */ jsx(
|
|
2042
|
-
|
|
2043
|
-
|
|
2412
|
+
/* @__PURE__ */ jsx(ThemeToggle, {}),
|
|
2413
|
+
/* @__PURE__ */ jsx(MobileNavbarMenu, {
|
|
2414
|
+
links: config.navbar?.links,
|
|
2415
|
+
config,
|
|
2416
|
+
currentLocale
|
|
2044
2417
|
})
|
|
2045
2418
|
]
|
|
2046
2419
|
})
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
children: [/* @__PURE__ */ jsx(ContentActions, {
|
|
2050
|
-
route: currentRoute,
|
|
2051
|
-
routePrefix: config.routePrefix
|
|
2052
|
-
}), /* @__PURE__ */ jsx("main", {
|
|
2053
|
-
className: "clarify-main flex-auto",
|
|
2054
|
-
children: /* @__PURE__ */ jsx(Routes, { children: routes.map((route) => /* @__PURE__ */ jsx(Route, {
|
|
2055
|
-
path: route.path,
|
|
2056
|
-
element: /* @__PURE__ */ jsx(route.component, {})
|
|
2057
|
-
}, route.path)) })
|
|
2058
|
-
})]
|
|
2059
|
-
})]
|
|
2060
|
-
})
|
|
2420
|
+
]
|
|
2421
|
+
}), /* @__PURE__ */ jsx(ProductTabs, { tabs })]
|
|
2061
2422
|
});
|
|
2062
|
-
}
|
|
2423
|
+
});
|
|
2063
2424
|
//#endregion
|
|
2064
|
-
export {
|
|
2425
|
+
export { prefixHref as A, normalizeRoutePath as C, ContentActions as D, useTheme as E, OpenApisContext as F, useClarifyConfig as I, useOpenApis as L, useBuiltInText as M, ClarifyConfigContext as N, isExternalHref as O, ClarifyLocaleContext as P, isSameRoutePath as S, ThemeProvider as T, Callout as _, GridPattern as a, useSectionStore as b, Heading as c, Collapse as d, Code as f, CardGroup as g, Card as h, Prose as i, copyTextToClipboard as j, localizeHref as k, Tag as l, Pre as m, Navigation as n, HeroPattern as o, CodeGroup as p, safeDecodeURIComponent as r, Logo as s, Header as t, Feedback as u, Button as v, ThemeToggle as w, remToPx as x, SectionProvider as y };
|
|
2065
2426
|
|
|
2066
|
-
//# sourceMappingURL=
|
|
2427
|
+
//# sourceMappingURL=shell-BlMMdTpZ.js.map
|