@clarify-labs/renderer 0.9.4 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/output/{ClarifyShell-D2P0iZ_m.js → ClarifyShell-1LuBliwt.js} +124 -40
- package/output/ClarifyShell-1LuBliwt.js.map +1 -0
- package/output/{ClarifyShell-7r92MZg9.cjs → ClarifyShell-C6li72Ce.cjs} +138 -54
- package/output/ClarifyShell-C6li72Ce.cjs.map +1 -0
- package/output/MermaidViewer-B6-BMCJG.cjs +101 -0
- package/output/MermaidViewer-B6-BMCJG.cjs.map +1 -0
- package/output/MermaidViewer-dXsomvM7.js +98 -0
- package/output/MermaidViewer-dXsomvM7.js.map +1 -0
- package/output/{OpenApiOperation-Dhlz3JSx.js → OpenApiOperation-CqNM-no4.js} +274 -206
- package/output/OpenApiOperation-CqNM-no4.js.map +1 -0
- package/output/{OpenApiOperation-CyyPlZL6.cjs → OpenApiOperation-DK46w2dq.cjs} +305 -225
- package/output/OpenApiOperation-DK46w2dq.cjs.map +1 -0
- package/output/{PageActions-CTn2XkPg.cjs → PageActions-BjB6PYmL.cjs} +76 -735
- package/output/PageActions-BjB6PYmL.cjs.map +1 -0
- package/output/{PageActions-D0PA8Zv5.js → PageActions-D7K9LDGf.js} +67 -678
- package/output/PageActions-D7K9LDGf.js.map +1 -0
- package/output/SearchDialog-CIPvXMT3.cjs +414 -0
- package/output/SearchDialog-CIPvXMT3.cjs.map +1 -0
- package/output/SearchDialog-CxYLjRi5.js +411 -0
- package/output/SearchDialog-CxYLjRi5.js.map +1 -0
- package/output/app/AppShell.d.ts +2 -2
- package/output/app/SectionHashSync.d.ts +6 -0
- package/output/client.cjs +3 -3
- package/output/client.js +3 -3
- package/output/components/MermaidViewer.d.ts +7 -0
- package/output/context.d.ts +1 -1
- package/output/core/context.d.ts +3 -4
- package/output/core/i18n.d.ts +1 -1
- package/output/core/index.d.ts +1 -1
- package/output/core/types.d.ts +36 -19
- package/output/i18n-DnqZHFT7.js +247 -0
- package/output/i18n-DnqZHFT7.js.map +1 -0
- package/output/i18n-b4iTLeia.cjs +294 -0
- package/output/i18n-b4iTLeia.cjs.map +1 -0
- package/output/index.cjs +91 -94
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +5 -5
- package/output/index.js +83 -86
- package/output/index.js.map +1 -1
- package/output/markdown.cjs +1 -1
- package/output/openapi/components/EndpointSections.d.ts +3 -1
- package/output/openapi/components/ExamplePanels.d.ts +3 -1
- package/output/openapi/components/OpenApiOperation.d.ts +3 -1
- package/output/openapi/components/OpenApiOperation.state.d.ts +3 -3
- package/output/openapi/components/SchemaProperties.d.ts +1 -0
- package/output/openapi/components/helpers.d.ts +2 -2
- package/output/openapi/entry.d.ts +0 -1
- package/output/openapi/lib/helpers.d.ts +5 -3
- package/output/openapi/lib/request-code.d.ts +2 -1
- package/output/openapi/lib/spec-path.d.ts +6 -1
- package/output/openapi/lib/utils.d.ts +10 -4
- package/output/preview.cjs +7 -5
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +5 -3
- package/output/preview.js.map +1 -1
- package/output/remark-Dd2WU50s.js.map +1 -1
- package/output/{remark-Dv3owbSH.cjs → remark-zSQT0MBv.cjs} +3 -3
- package/output/{remark-Dv3owbSH.cjs.map → remark-zSQT0MBv.cjs.map} +1 -1
- package/output/{render-CwSsfrs7.js → render-DKj24Jqw.js} +15 -8
- package/output/render-DKj24Jqw.js.map +1 -0
- package/output/{render-DXDSIfZ8.cjs → render-Di5B6Zc0.cjs} +15 -8
- package/output/render-Di5B6Zc0.cjs.map +1 -0
- package/output/renderer.css +55 -1
- package/output/runtime/ClarifyShell.d.ts +5 -6
- package/output/server.cjs +4 -4
- package/output/server.cjs.map +1 -1
- package/output/server.js +4 -4
- package/output/server.js.map +1 -1
- package/output/shell/Navigation.d.ts +1 -0
- package/output/shell/search/SearchDialog.d.ts +1 -1
- package/output/slots/RuntimeSlot.d.ts +7 -7
- package/output/slots/context.d.ts +5 -5
- package/output/slots/index.d.ts +2 -2
- package/output/slots/types.d.ts +1 -1
- package/output/utils/path.d.ts +1 -1
- package/package.json +10 -10
- package/output/ClarifyShell-7r92MZg9.cjs.map +0 -1
- package/output/ClarifyShell-D2P0iZ_m.js.map +0 -1
- package/output/OpenApiOperation-CyyPlZL6.cjs.map +0 -1
- package/output/OpenApiOperation-Dhlz3JSx.js.map +0 -1
- package/output/PageActions-CTn2XkPg.cjs.map +0 -1
- package/output/PageActions-D0PA8Zv5.js.map +0 -1
- package/output/render-CwSsfrs7.js.map +0 -1
- package/output/render-DXDSIfZ8.cjs.map +0 -1
- /package/output/{chunk-DakpK96I.cjs → rolldown-runtime-DakpK96I.cjs} +0 -0
|
@@ -1,249 +1,15 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
|
|
2
|
+
const require_i18n = require("./i18n-b4iTLeia.cjs");
|
|
2
3
|
let clsx = require("clsx");
|
|
3
|
-
clsx =
|
|
4
|
+
clsx = require_rolldown_runtime.__toESM(clsx, 1);
|
|
4
5
|
let react = require("react");
|
|
5
6
|
let react_router_dom = require("react-router-dom");
|
|
6
7
|
let _headlessui_react = require("@headlessui/react");
|
|
7
8
|
let lucide_react = require("lucide-react");
|
|
8
|
-
lucide_react =
|
|
9
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react, 1);
|
|
9
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
11
|
let framer_motion = require("framer-motion");
|
|
11
12
|
let zustand = require("zustand");
|
|
12
|
-
//#region source/core/context.tsx
|
|
13
|
-
var ConfigContext = (0, react.createContext)(null);
|
|
14
|
-
var LocaleContext = (0, react.createContext)(void 0);
|
|
15
|
-
var OpenApisContext = (0, react.createContext)({});
|
|
16
|
-
function useConfig() {
|
|
17
|
-
const config = (0, react.useContext)(ConfigContext);
|
|
18
|
-
if (!config) throw new Error("[clarify] useConfig must be used within a ConfigContext.Provider");
|
|
19
|
-
return config;
|
|
20
|
-
}
|
|
21
|
-
function useConfigOptional() {
|
|
22
|
-
return (0, react.useContext)(ConfigContext);
|
|
23
|
-
}
|
|
24
|
-
function useLocale() {
|
|
25
|
-
return (0, react.useContext)(LocaleContext);
|
|
26
|
-
}
|
|
27
|
-
function useOpenApis() {
|
|
28
|
-
return (0, react.useContext)(OpenApisContext);
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region source/core/i18n.ts
|
|
32
|
-
var builtInText = {
|
|
33
|
-
en: {
|
|
34
|
-
"actions.code": "Code",
|
|
35
|
-
"actions.copy": "Copy",
|
|
36
|
-
"actions.copied": "Copied!",
|
|
37
|
-
"builtWith.label": "Built with Clarify",
|
|
38
|
-
"builtWith.prefix": "Built with",
|
|
39
|
-
"callout.danger": "Danger",
|
|
40
|
-
"callout.info": "Info",
|
|
41
|
-
"callout.note": "Note",
|
|
42
|
-
"callout.success": "Success",
|
|
43
|
-
"callout.tip": "Tip",
|
|
44
|
-
"callout.warning": "Warning",
|
|
45
|
-
"contentActions.copyContent": "Copy page",
|
|
46
|
-
"contentActions.copyContentDescription": "Copy this page as {contentType} for LLMs",
|
|
47
|
-
"contentActions.copyLink": "Copy {contentType} link",
|
|
48
|
-
"contentActions.copyLinkDescription": "Copy the raw {contentType} content link for this page",
|
|
49
|
-
"contentActions.copyLlms": "Copy llms.txt",
|
|
50
|
-
"contentActions.copyLlmsDescription": "Copy the llms.txt link for this site",
|
|
51
|
-
"contentActions.copiedLlms": "Copied llms.txt",
|
|
52
|
-
"contentActions.editPage": "Edit this page",
|
|
53
|
-
"contentActions.editPageDescription": "Open the source file for this page",
|
|
54
|
-
"contentActions.copyOptions": "Choose copy option",
|
|
55
|
-
"contentActions.copiedContent": "Copied page",
|
|
56
|
-
"contentActions.copiedLink": "Copied link",
|
|
57
|
-
"contentActions.viewMarkdown": "View as Markdown",
|
|
58
|
-
"contentActions.viewMarkdownDescription": "View this page as plain text",
|
|
59
|
-
"contentActions.viewOpenApi": "View raw OpenAPI",
|
|
60
|
-
"contentActions.viewOpenApiDescription": "Open the API description file in a new tab",
|
|
61
|
-
"feedback.no": "No",
|
|
62
|
-
"feedback.prompt": "Was this page helpful?",
|
|
63
|
-
"feedback.thanks": "Thanks for your feedback!",
|
|
64
|
-
"feedback.yes": "Yes",
|
|
65
|
-
"navigation.documentation": "Documentation",
|
|
66
|
-
"navigation.next": "Next",
|
|
67
|
-
"navigation.previous": "Previous",
|
|
68
|
-
"navigation.previousNext": "Previous and next pages",
|
|
69
|
-
"navigation.toggle": "Toggle navigation",
|
|
70
|
-
"navbar.home": "Home",
|
|
71
|
-
"navbar.openLinks": "Open navigation links",
|
|
72
|
-
"navbar.sections": "Documentation sections",
|
|
73
|
-
"notFound.description": "The page may have moved, been renamed, or never existed. Check the address or return to the homepage.",
|
|
74
|
-
"notFound.home": "Back to homepage",
|
|
75
|
-
"notFound.label": "404",
|
|
76
|
-
"notFound.title": "Page not found",
|
|
77
|
-
"openapi.apiDocumentation": "API Documentation",
|
|
78
|
-
"openapi.bodyProperties": "Body properties",
|
|
79
|
-
"openapi.collapse": "Collapse",
|
|
80
|
-
"openapi.endpointNotFound": "Endpoint not found: {endpoint}",
|
|
81
|
-
"openapi.example": "Example",
|
|
82
|
-
"openapi.expand": "Expand",
|
|
83
|
-
"openapi.headers": "Headers",
|
|
84
|
-
"openapi.language": "Language",
|
|
85
|
-
"openapi.client": "Client",
|
|
86
|
-
"openapi.mediaType": "Media type",
|
|
87
|
-
"openapi.none": "None",
|
|
88
|
-
"openapi.openApiReference": "OpenAPI Reference",
|
|
89
|
-
"openapi.operationParameter": "Operation parameter.",
|
|
90
|
-
"openapi.optional": "Optional.",
|
|
91
|
-
"openapi.parameter": "parameter",
|
|
92
|
-
"openapi.pathParameters": "Path parameters",
|
|
93
|
-
"openapi.queryParameters": "Query parameters",
|
|
94
|
-
"openapi.request": "Request",
|
|
95
|
-
"openapi.requestBody": "Request body",
|
|
96
|
-
"openapi.responseBodyProperties": "Response body properties",
|
|
97
|
-
"openapi.required": "Required.",
|
|
98
|
-
"openapi.requiredBadge": "required",
|
|
99
|
-
"openapi.response": "Response",
|
|
100
|
-
"openapi.responses": "Responses",
|
|
101
|
-
"openapi.schemaExample": "Schema example",
|
|
102
|
-
"openapi.scrollExamplesLeft": "Scroll examples left",
|
|
103
|
-
"openapi.scrollExamplesRight": "Scroll examples right",
|
|
104
|
-
"openapi.specNotFound": "OpenAPI spec not found: {specPath}",
|
|
105
|
-
"openapi.specPathMissing": "spec or specPath was not provided",
|
|
106
|
-
"openapi.status": "Status",
|
|
107
|
-
"openapi.version": "Version {version}",
|
|
108
|
-
"search.button": "Search...",
|
|
109
|
-
"search.noResults": "Nothing found for {query}.",
|
|
110
|
-
"search.placeholder": "Find something...",
|
|
111
|
-
"search.shortcutCtrl": "Ctrl ",
|
|
112
|
-
"renderError.componentStack": "React component stack",
|
|
113
|
-
"renderError.description": "Clarify stopped rendering this route to keep the rest of the shell responsive. Review the diagnostics below, fix the page source, then reload the route.",
|
|
114
|
-
"renderError.details": "Runtime diagnostics",
|
|
115
|
-
"renderError.message": "Message",
|
|
116
|
-
"renderError.path": "Route",
|
|
117
|
-
"renderError.reload": "Reload route",
|
|
118
|
-
"renderError.stack": "JavaScript stack trace",
|
|
119
|
-
"renderError.title": "Route render failed",
|
|
120
|
-
"renderError.type": "Error type",
|
|
121
|
-
"renderError.version": "Clarify version",
|
|
122
|
-
"theme.switchToDark": "Switch to dark theme",
|
|
123
|
-
"theme.switchToLight": "Switch to light theme",
|
|
124
|
-
"theme.switchToSystem": "Follow system theme",
|
|
125
|
-
"language.switch": "Switch language",
|
|
126
|
-
"mermaid.zoomIn": "Zoom in",
|
|
127
|
-
"mermaid.zoomOut": "Zoom out",
|
|
128
|
-
"mermaid.resetZoom": "Reset zoom",
|
|
129
|
-
"mermaid.renderError": "Mermaid render error",
|
|
130
|
-
"mermaid.scrollHint": "Click the diagram to enable scroll-to-zoom"
|
|
131
|
-
},
|
|
132
|
-
"zh-CN": {
|
|
133
|
-
"actions.code": "代码",
|
|
134
|
-
"actions.copy": "复制",
|
|
135
|
-
"actions.copied": "已复制!",
|
|
136
|
-
"builtWith.label": "由 Clarify 构建",
|
|
137
|
-
"builtWith.prefix": "构建来自",
|
|
138
|
-
"callout.danger": "危险",
|
|
139
|
-
"callout.info": "信息",
|
|
140
|
-
"callout.note": "注意",
|
|
141
|
-
"callout.success": "成功",
|
|
142
|
-
"callout.tip": "提示",
|
|
143
|
-
"callout.warning": "警告",
|
|
144
|
-
"contentActions.copyContent": "复制页面",
|
|
145
|
-
"contentActions.copyContentDescription": "将页面以 {contentType} 格式复制给 LLMs",
|
|
146
|
-
"contentActions.copyLink": "复制 {contentType} 链接",
|
|
147
|
-
"contentActions.copyLinkDescription": "复制当前页面的 {contentType} 原始内容链接",
|
|
148
|
-
"contentActions.copyLlms": "复制 llms.txt",
|
|
149
|
-
"contentActions.copyLlmsDescription": "复制此站点的 llms.txt 链接",
|
|
150
|
-
"contentActions.copiedLlms": "已复制 llms.txt",
|
|
151
|
-
"contentActions.editPage": "编辑此页面",
|
|
152
|
-
"contentActions.editPageDescription": "打开当前页面的源文件",
|
|
153
|
-
"contentActions.copyOptions": "选择复制选项",
|
|
154
|
-
"contentActions.copiedContent": "已复制页面",
|
|
155
|
-
"contentActions.copiedLink": "已复制链接",
|
|
156
|
-
"contentActions.viewMarkdown": "以 Markdown 格式查看",
|
|
157
|
-
"contentActions.viewMarkdownDescription": "以纯文本查看此页面",
|
|
158
|
-
"contentActions.viewOpenApi": "查看 OpenAPI 原始内容",
|
|
159
|
-
"contentActions.viewOpenApiDescription": "在新标签页打开 API 描述文件",
|
|
160
|
-
"feedback.no": "否",
|
|
161
|
-
"feedback.prompt": "这个页面有帮助吗?",
|
|
162
|
-
"feedback.thanks": "感谢你的反馈!",
|
|
163
|
-
"feedback.yes": "是",
|
|
164
|
-
"navigation.documentation": "文档",
|
|
165
|
-
"navigation.next": "下一页",
|
|
166
|
-
"navigation.previous": "上一页",
|
|
167
|
-
"navigation.previousNext": "上一页和下一页",
|
|
168
|
-
"navigation.toggle": "切换导航",
|
|
169
|
-
"navbar.home": "首页",
|
|
170
|
-
"navbar.openLinks": "打开导航链接",
|
|
171
|
-
"navbar.sections": "文档栏目",
|
|
172
|
-
"notFound.description": "页面可能已移动、重命名或不存在。请检查地址,或返回首页继续浏览。",
|
|
173
|
-
"notFound.home": "返回首页",
|
|
174
|
-
"notFound.label": "404",
|
|
175
|
-
"notFound.title": "页面未找到",
|
|
176
|
-
"openapi.apiDocumentation": "API 文档",
|
|
177
|
-
"openapi.bodyProperties": "请求体属性",
|
|
178
|
-
"openapi.collapse": "收起",
|
|
179
|
-
"openapi.endpointNotFound": "未找到端点:{endpoint}",
|
|
180
|
-
"openapi.example": "示例",
|
|
181
|
-
"openapi.expand": "展开",
|
|
182
|
-
"openapi.headers": "请求头",
|
|
183
|
-
"openapi.language": "语言",
|
|
184
|
-
"openapi.client": "客户端",
|
|
185
|
-
"openapi.mediaType": "媒体类型",
|
|
186
|
-
"openapi.none": "无",
|
|
187
|
-
"openapi.openApiReference": "OpenAPI 参考",
|
|
188
|
-
"openapi.operationParameter": "操作参数。",
|
|
189
|
-
"openapi.optional": "可选。",
|
|
190
|
-
"openapi.parameter": "参数",
|
|
191
|
-
"openapi.pathParameters": "路径参数",
|
|
192
|
-
"openapi.queryParameters": "查询参数",
|
|
193
|
-
"openapi.request": "请求",
|
|
194
|
-
"openapi.requestBody": "请求体",
|
|
195
|
-
"openapi.responseBodyProperties": "响应体属性",
|
|
196
|
-
"openapi.required": "必填。",
|
|
197
|
-
"openapi.requiredBadge": "必填",
|
|
198
|
-
"openapi.response": "响应",
|
|
199
|
-
"openapi.responses": "响应",
|
|
200
|
-
"openapi.schemaExample": "Schema 示例",
|
|
201
|
-
"openapi.scrollExamplesLeft": "向左滚动示例",
|
|
202
|
-
"openapi.scrollExamplesRight": "向右滚动示例",
|
|
203
|
-
"openapi.specNotFound": "未找到 OpenAPI 描述文件:{specPath}",
|
|
204
|
-
"openapi.specPathMissing": "未提供 spec 或 specPath",
|
|
205
|
-
"openapi.status": "状态",
|
|
206
|
-
"openapi.version": "版本 {version}",
|
|
207
|
-
"search.button": "搜索...",
|
|
208
|
-
"search.noResults": "没有找到与 {query} 相关的结果。",
|
|
209
|
-
"search.placeholder": "搜索内容...",
|
|
210
|
-
"search.shortcutCtrl": "Ctrl ",
|
|
211
|
-
"renderError.componentStack": "React 组件栈",
|
|
212
|
-
"renderError.description": "Clarify 已停止渲染此路由,以保证文档 Shell 仍可响应。请查看下方诊断信息,修复页面源码后重新加载路由。",
|
|
213
|
-
"renderError.details": "运行时诊断",
|
|
214
|
-
"renderError.message": "错误消息",
|
|
215
|
-
"renderError.path": "路由",
|
|
216
|
-
"renderError.reload": "重新加载路由",
|
|
217
|
-
"renderError.stack": "JavaScript 堆栈",
|
|
218
|
-
"renderError.title": "路由渲染失败",
|
|
219
|
-
"renderError.type": "错误类型",
|
|
220
|
-
"renderError.version": "Clarify 版本",
|
|
221
|
-
"theme.switchToDark": "切换到深色主题",
|
|
222
|
-
"theme.switchToLight": "切换到浅色主题",
|
|
223
|
-
"theme.switchToSystem": "跟随系统主题",
|
|
224
|
-
"language.switch": "切换语言",
|
|
225
|
-
"mermaid.zoomIn": "放大",
|
|
226
|
-
"mermaid.zoomOut": "缩小",
|
|
227
|
-
"mermaid.resetZoom": "重置缩放",
|
|
228
|
-
"mermaid.renderError": "Mermaid 渲染错误",
|
|
229
|
-
"mermaid.scrollHint": "点击图表后即可滚轮缩放"
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
function resolveBuiltInLocale(locale) {
|
|
233
|
-
return locale === "zh-CN" || locale?.toLowerCase().startsWith("zh") ? "zh-CN" : "en";
|
|
234
|
-
}
|
|
235
|
-
function translateBuiltInText(locale, key, replacements = {}) {
|
|
236
|
-
let value = builtInText[resolveBuiltInLocale(locale)]?.[key] ?? builtInText.en[key];
|
|
237
|
-
for (const [name, replacement] of Object.entries(replacements)) value = value.replaceAll(`{${name}}`, replacement);
|
|
238
|
-
return value;
|
|
239
|
-
}
|
|
240
|
-
function useBuiltInText(locale) {
|
|
241
|
-
const config = (0, react.useContext)(ConfigContext);
|
|
242
|
-
const currentLocale = (0, react.useContext)(LocaleContext);
|
|
243
|
-
const resolvedLocale = locale ?? currentLocale ?? config?.i18n?.defaultLocale;
|
|
244
|
-
return (key, replacements) => translateBuiltInText(resolvedLocale, key, replacements);
|
|
245
|
-
}
|
|
246
|
-
//#endregion
|
|
247
13
|
//#region source/utils/clipboard.ts
|
|
248
14
|
async function copyTextToClipboard(text) {
|
|
249
15
|
if (typeof navigator !== "undefined" && navigator.clipboard?.writeText) try {
|
|
@@ -303,9 +69,9 @@ function getAbsoluteUrl(path) {
|
|
|
303
69
|
}
|
|
304
70
|
function ContentActions(arg0) {
|
|
305
71
|
const { route, routePrefix } = arg0;
|
|
306
|
-
const t = useBuiltInText();
|
|
72
|
+
const t = require_i18n.useBuiltInText();
|
|
307
73
|
const [copied, setCopied] = (0, react.useState)("idle");
|
|
308
|
-
if (!route?.contentArtifactUrl && !route?.
|
|
74
|
+
if (!route?.contentArtifactUrl && !route?.sourceEditUrl) return null;
|
|
309
75
|
const contentArtifactUrl = route.contentArtifactUrl ? resolveContentArtifactUrl(route.contentArtifactUrl, routePrefix) : void 0;
|
|
310
76
|
const isOpenApi = route.kind === "openapi";
|
|
311
77
|
const replacements = { contentType: isOpenApi ? "OpenAPI" : "Markdown" };
|
|
@@ -313,7 +79,7 @@ function ContentActions(arg0) {
|
|
|
313
79
|
const viewDescription = isOpenApi ? t("contentActions.viewOpenApiDescription") : t("contentActions.viewMarkdownDescription");
|
|
314
80
|
function markCopied(state) {
|
|
315
81
|
setCopied(state);
|
|
316
|
-
|
|
82
|
+
setTimeout(() => setCopied("idle"), 1600);
|
|
317
83
|
}
|
|
318
84
|
async function handleCopyContent() {
|
|
319
85
|
if (!contentArtifactUrl) return;
|
|
@@ -368,7 +134,7 @@ function ContentActions(arg0) {
|
|
|
368
134
|
children: copied === primaryAction.key ? t("actions.copied") : primaryAction.label
|
|
369
135
|
})]
|
|
370
136
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
371
|
-
href: route.
|
|
137
|
+
href: route.sourceEditUrl,
|
|
372
138
|
target: "_blank",
|
|
373
139
|
rel: "noreferrer",
|
|
374
140
|
className: "clarify-content-actions-primary clarify-ui-control inline-flex h-8 min-w-0 items-center gap-1.5 px-2.5 no-underline transition sm:px-3",
|
|
@@ -386,8 +152,8 @@ function ContentActions(arg0) {
|
|
|
386
152
|
anchor: "bottom end",
|
|
387
153
|
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",
|
|
388
154
|
children: [
|
|
389
|
-
route.
|
|
390
|
-
href: route.
|
|
155
|
+
route.sourceEditUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
156
|
+
href: route.sourceEditUrl,
|
|
391
157
|
target: "_blank",
|
|
392
158
|
rel: "noreferrer",
|
|
393
159
|
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",
|
|
@@ -668,7 +434,7 @@ function useTheme() {
|
|
|
668
434
|
//#region source/theme/ThemeToggle.tsx
|
|
669
435
|
function ThemeToggle() {
|
|
670
436
|
const { theme, setTheme } = useTheme();
|
|
671
|
-
const t = useBuiltInText();
|
|
437
|
+
const t = require_i18n.useBuiltInText();
|
|
672
438
|
const nextTheme = getNextTheme(theme);
|
|
673
439
|
const label = getThemeLabel(nextTheme, t);
|
|
674
440
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
@@ -712,9 +478,19 @@ function normalizeRoutePath(path) {
|
|
|
712
478
|
const [pathname, suffix = ""] = path.split(/([?#].*)/, 2);
|
|
713
479
|
return `${pathname.replace(/^\/+/, "/").replace(/\/+$/, "") || "/"}${suffix}`;
|
|
714
480
|
}
|
|
715
|
-
function
|
|
481
|
+
function stripLocalePathPrefix(path, locale) {
|
|
482
|
+
if (!locale) return normalizeRoutePath(path);
|
|
483
|
+
const [pathname, suffix = ""] = normalizeRoutePath(path).split(/([?#].*)/, 2);
|
|
484
|
+
const localePrefix = `/${locale}`;
|
|
485
|
+
if (pathname === localePrefix) return `/${suffix}`.replace(/^\/$/, "/");
|
|
486
|
+
if (!pathname.startsWith(`${localePrefix}/`)) return `${pathname}${suffix}`;
|
|
487
|
+
return `${pathname.slice(localePrefix.length) || "/"}${suffix}`;
|
|
488
|
+
}
|
|
489
|
+
function isSameRoutePath(a, b, locale) {
|
|
716
490
|
if (!a || !b) return false;
|
|
717
|
-
|
|
491
|
+
const normalizedA = normalizeRoutePath(a);
|
|
492
|
+
const normalizedB = normalizeRoutePath(b);
|
|
493
|
+
return normalizedA === normalizedB || stripLocalePathPrefix(normalizedA, locale) === normalizedB || normalizedA === stripLocalePathPrefix(normalizedB, locale);
|
|
718
494
|
}
|
|
719
495
|
//#endregion
|
|
720
496
|
//#region source/utils/lucide.ts
|
|
@@ -799,7 +575,7 @@ function computeVisibleSections(sections, scrollY, viewportTop, viewportBottom)
|
|
|
799
575
|
}
|
|
800
576
|
return visibleSections;
|
|
801
577
|
}
|
|
802
|
-
function useSectionVisibilityDebug(
|
|
578
|
+
function useSectionVisibilityDebug(_headerTopAreaRef) {
|
|
803
579
|
const lastDebugSignatureRef = (0, react.useRef)("");
|
|
804
580
|
return (snapshot) => {
|
|
805
581
|
const { scrollY, innerHeight, blockedTop, visibleSections } = snapshot;
|
|
@@ -811,14 +587,11 @@ function useSectionVisibilityDebug(headerTopAreaRef) {
|
|
|
811
587
|
].join("|");
|
|
812
588
|
if (lastDebugSignatureRef.current === debugSignature) return;
|
|
813
589
|
lastDebugSignatureRef.current = debugSignature;
|
|
814
|
-
console.info("[clarify][section-visibility]", {
|
|
815
|
-
...snapshot,
|
|
816
|
-
topAreaHeight: headerTopAreaRef?.current?.offsetHeight ?? 0
|
|
817
|
-
});
|
|
818
590
|
};
|
|
819
591
|
}
|
|
820
592
|
function useSectionVisibilityObserver(checkVisibleSections, headerTopAreaRef) {
|
|
821
593
|
(0, react.useEffect)(() => {
|
|
594
|
+
if (typeof window === "undefined") return void 0;
|
|
822
595
|
const raf = window.requestAnimationFrame(() => checkVisibleSections());
|
|
823
596
|
window.addEventListener("scroll", checkVisibleSections, { passive: true });
|
|
824
597
|
window.addEventListener("resize", checkVisibleSections);
|
|
@@ -839,6 +612,7 @@ function useVisibleSections(sectionStore, headerTopAreaRef) {
|
|
|
839
612
|
const sections = (0, zustand.useStore)(sectionStore, (state) => state.sections);
|
|
840
613
|
const emitVisibilityDebug = useSectionVisibilityDebug(headerTopAreaRef);
|
|
841
614
|
useSectionVisibilityObserver((0, react.useCallback)(() => {
|
|
615
|
+
if (typeof window === "undefined") return;
|
|
842
616
|
const { innerHeight, scrollY } = window;
|
|
843
617
|
const viewportTop = getVisibleViewportTop(scrollY, innerHeight, headerTopAreaRef);
|
|
844
618
|
const viewportBottom = getVisibleViewportBottom(scrollY, innerHeight, headerTopAreaRef);
|
|
@@ -923,7 +697,8 @@ var sectionBadgeColorStyles = {
|
|
|
923
697
|
DELETE: "text-red-500 dark:text-rose-500",
|
|
924
698
|
OPTIONS: "text-violet-500 dark:text-violet-400",
|
|
925
699
|
HEAD: "text-zinc-500 dark:text-zinc-400",
|
|
926
|
-
TRACE: "text-fuchsia-500 dark:text-fuchsia-400"
|
|
700
|
+
TRACE: "text-fuchsia-500 dark:text-fuchsia-400",
|
|
701
|
+
WEBHOOK: "text-violet-500 dark:text-violet-400"
|
|
927
702
|
};
|
|
928
703
|
function SectionBadge(arg0) {
|
|
929
704
|
const { children } = arg0;
|
|
@@ -957,13 +732,13 @@ function NavLink(arg0) {
|
|
|
957
732
|
});
|
|
958
733
|
}
|
|
959
734
|
function VisibleSectionHighlight(arg0) {
|
|
960
|
-
const { group, pathname } = arg0;
|
|
735
|
+
const { group, pathname, currentLocale } = arg0;
|
|
961
736
|
const [sections, visibleSections] = useInitialValue([useSectionStore((s) => s.sections), useSectionStore((s) => s.visibleSections)], useIsInsideMobileNavigation());
|
|
962
737
|
const isPresent = (0, framer_motion.useIsPresent)();
|
|
963
738
|
const firstVisibleSectionIndex = Math.max(0, [{ id: "_top" }, ...sections].findIndex((section) => section.id === visibleSections[0]));
|
|
964
739
|
const itemHeight = remToPx(2);
|
|
965
740
|
const height = isPresent ? Math.max(1, visibleSections.length) * itemHeight : itemHeight;
|
|
966
|
-
const top = group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) * itemHeight + firstVisibleSectionIndex * itemHeight;
|
|
741
|
+
const top = group.links.findIndex((link) => isSameRoutePath(link.href, pathname, currentLocale)) * itemHeight + firstVisibleSectionIndex * itemHeight;
|
|
967
742
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
968
743
|
initial: {
|
|
969
744
|
opacity: 0,
|
|
@@ -995,9 +770,9 @@ function VisibleSectionHighlight(arg0) {
|
|
|
995
770
|
});
|
|
996
771
|
}
|
|
997
772
|
function ActivePageMarker(arg0) {
|
|
998
|
-
const { group, pathname } = arg0;
|
|
773
|
+
const { group, pathname, currentLocale } = arg0;
|
|
999
774
|
const itemHeight = remToPx(2);
|
|
1000
|
-
const top = remToPx(.25) + group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) * itemHeight;
|
|
775
|
+
const top = remToPx(.25) + group.links.findIndex((link) => isSameRoutePath(link.href, pathname, currentLocale)) * itemHeight;
|
|
1001
776
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
1002
777
|
className: "absolute left-2 h-6 w-px bg-(--clarify-theme-tokens-colors-primary)",
|
|
1003
778
|
initial: {
|
|
@@ -1023,10 +798,10 @@ function ActivePageMarker(arg0) {
|
|
|
1023
798
|
});
|
|
1024
799
|
}
|
|
1025
800
|
function NavigationGroup(arg0) {
|
|
1026
|
-
const { group, className } = arg0;
|
|
801
|
+
const { group, className, currentLocale } = arg0;
|
|
1027
802
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1028
803
|
const [pathname, sections] = useInitialValue([normalizeRoutePath((0, react_router_dom.useLocation)().pathname), useSectionStore((s) => s.sections)], isInsideMobileNavigation);
|
|
1029
|
-
const isActiveGroup = group.links.findIndex((link) => isSameRoutePath(link.href, pathname)) !== -1;
|
|
804
|
+
const isActiveGroup = group.links.findIndex((link) => isSameRoutePath(link.href, pathname, currentLocale)) !== -1;
|
|
1030
805
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
1031
806
|
className: (0, clsx.default)("clarify-navigation-group relative mb-6", className),
|
|
1032
807
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("h2", {
|
|
@@ -1042,7 +817,8 @@ function NavigationGroup(arg0) {
|
|
|
1042
817
|
initial: !isInsideMobileNavigation,
|
|
1043
818
|
children: isActiveGroup ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VisibleSectionHighlight, {
|
|
1044
819
|
group,
|
|
1045
|
-
pathname
|
|
820
|
+
pathname,
|
|
821
|
+
currentLocale
|
|
1046
822
|
}) : null
|
|
1047
823
|
}),
|
|
1048
824
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "absolute inset-y-0 left-2 w-px bg-(--clarify-theme-tokens-colors-border) dark:bg-white/5" }),
|
|
@@ -1050,14 +826,15 @@ function NavigationGroup(arg0) {
|
|
|
1050
826
|
initial: false,
|
|
1051
827
|
children: isActiveGroup ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActivePageMarker, {
|
|
1052
828
|
group,
|
|
1053
|
-
pathname
|
|
829
|
+
pathname,
|
|
830
|
+
currentLocale
|
|
1054
831
|
}) : null
|
|
1055
832
|
}),
|
|
1056
833
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1057
834
|
role: "list",
|
|
1058
835
|
className: "border-l border-transparent",
|
|
1059
836
|
children: group.links.map((link) => {
|
|
1060
|
-
const active = isSameRoutePath(link.href, pathname);
|
|
837
|
+
const active = isSameRoutePath(link.href, pathname, currentLocale);
|
|
1061
838
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
1062
839
|
className: "relative",
|
|
1063
840
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavLink, {
|
|
@@ -1096,8 +873,8 @@ function NavigationGroup(arg0) {
|
|
|
1096
873
|
});
|
|
1097
874
|
}
|
|
1098
875
|
function Navigation(arg0) {
|
|
1099
|
-
const { navigation, className } = arg0;
|
|
1100
|
-
const groups = navigationToGroups(navigation, useBuiltInText()("navigation.documentation"));
|
|
876
|
+
const { navigation, className, currentLocale } = arg0;
|
|
877
|
+
const groups = navigationToGroups(navigation, require_i18n.useBuiltInText()("navigation.documentation"));
|
|
1101
878
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("nav", {
|
|
1102
879
|
className: (0, clsx.default)("clarify-navigation", className),
|
|
1103
880
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
@@ -1105,7 +882,8 @@ function Navigation(arg0) {
|
|
|
1105
882
|
className: "clarify-navigation-list",
|
|
1106
883
|
children: groups.map((group, groupIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavigationGroup, {
|
|
1107
884
|
group,
|
|
1108
|
-
className: groupIndex === 0 ? "mt-0" : ""
|
|
885
|
+
className: groupIndex === 0 ? "mt-0" : "",
|
|
886
|
+
currentLocale
|
|
1109
887
|
}, group.title))
|
|
1110
888
|
})
|
|
1111
889
|
});
|
|
@@ -1113,17 +891,17 @@ function Navigation(arg0) {
|
|
|
1113
891
|
//#endregion
|
|
1114
892
|
//#region source/shell/mobile.tsx
|
|
1115
893
|
var IsInsideMobileNavigationContext = (0, react.createContext)(false);
|
|
1116
|
-
function hasPath$1(nodes, pathname) {
|
|
1117
|
-
return nodes.some((node) => isSameRoutePath(node.path, pathname) || hasPath$1(node.children ?? [], pathname));
|
|
894
|
+
function hasPath$1(nodes, pathname, currentLocale) {
|
|
895
|
+
return nodes.some((node) => isSameRoutePath(node.path, pathname, currentLocale) || hasPath$1(node.children ?? [], pathname, currentLocale));
|
|
1118
896
|
}
|
|
1119
|
-
function isActiveTab$1(tab, pathname) {
|
|
1120
|
-
return isSameRoutePath(tab.path, pathname) || hasPath$1(tab.children, pathname);
|
|
897
|
+
function isActiveTab$1(tab, pathname, currentLocale) {
|
|
898
|
+
return isSameRoutePath(tab.path, pathname, currentLocale) || hasPath$1(tab.children, pathname, currentLocale);
|
|
1121
899
|
}
|
|
1122
900
|
function MobileTabsSelect(arg0) {
|
|
1123
|
-
const { tabs } = arg0;
|
|
901
|
+
const { tabs, currentLocale } = arg0;
|
|
1124
902
|
const pathname = normalizeRoutePath((0, react_router_dom.useLocation)().pathname);
|
|
1125
903
|
if (!tabs?.length) return null;
|
|
1126
|
-
const activeTab = tabs.find((tab) => isActiveTab$1(tab, pathname)) ?? tabs[0];
|
|
904
|
+
const activeTab = tabs.find((tab) => isActiveTab$1(tab, pathname, currentLocale)) ?? tabs[0];
|
|
1127
905
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Menu, {
|
|
1128
906
|
as: "div",
|
|
1129
907
|
className: "clarify-mobile-tabs-select mb-6",
|
|
@@ -1142,7 +920,7 @@ function MobileTabsSelect(arg0) {
|
|
|
1142
920
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItems, {
|
|
1143
921
|
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",
|
|
1144
922
|
children: tabs.map((tab) => {
|
|
1145
|
-
const active = isActiveTab$1(tab, pathname);
|
|
923
|
+
const active = isActiveTab$1(tab, pathname, currentLocale);
|
|
1146
924
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.MenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
|
|
1147
925
|
to: tab.path,
|
|
1148
926
|
className: (0, clsx.default)("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"),
|
|
@@ -1183,7 +961,13 @@ function MobileNavigationDialog(arg0) {
|
|
|
1183
961
|
}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TransitionChild, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
|
|
1184
962
|
layoutScroll: true,
|
|
1185
963
|
className: "clarify-mobile-navigation-panel fixed top-14 bottom-0 left-0 w-full max-w-sm 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 sm:px-6 sm:pb-10 dark:bg-zinc-950 dark:ring-zinc-800",
|
|
1186
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileTabsSelect, {
|
|
964
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MobileTabsSelect, {
|
|
965
|
+
tabs,
|
|
966
|
+
currentLocale
|
|
967
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Navigation, {
|
|
968
|
+
navigation,
|
|
969
|
+
currentLocale
|
|
970
|
+
})]
|
|
1187
971
|
}) })] })]
|
|
1188
972
|
});
|
|
1189
973
|
}
|
|
@@ -1200,7 +984,7 @@ function MobileNavigation(arg0) {
|
|
|
1200
984
|
const { config, navigation, tabs, routes, currentLocale, currentRoute } = arg0;
|
|
1201
985
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1202
986
|
const { isOpen, toggle, close } = useMobileNavigationStore();
|
|
1203
|
-
const t = useBuiltInText();
|
|
987
|
+
const t = require_i18n.useBuiltInText();
|
|
1204
988
|
const ToggleIcon = isOpen ? lucide_react.X : lucide_react.Menu;
|
|
1205
989
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(IsInsideMobileNavigationContext.Provider, {
|
|
1206
990
|
value: true,
|
|
@@ -1226,405 +1010,6 @@ function MobileNavigation(arg0) {
|
|
|
1226
1010
|
});
|
|
1227
1011
|
}
|
|
1228
1012
|
//#endregion
|
|
1229
|
-
//#region source/shell/search/items.ts
|
|
1230
|
-
function routeGroupTitles(navigation) {
|
|
1231
|
-
const titles = /* @__PURE__ */ new Map();
|
|
1232
|
-
for (const node of navigation) if (node.children?.length) for (const child of node.children) titles.set(child.path, node.title);
|
|
1233
|
-
else titles.set(node.path, node.title);
|
|
1234
|
-
return titles;
|
|
1235
|
-
}
|
|
1236
|
-
function buildSearchItems(routes, navigation) {
|
|
1237
|
-
const groupTitles = routeGroupTitles(navigation);
|
|
1238
|
-
return routes.flatMap((route) => {
|
|
1239
|
-
if (route.isBareAlias) return [];
|
|
1240
|
-
const groupTitle = groupTitles.get(route.path);
|
|
1241
|
-
return [{
|
|
1242
|
-
title: route.title,
|
|
1243
|
-
pageTitle: route.title,
|
|
1244
|
-
sectionTitle: groupTitle,
|
|
1245
|
-
url: route.path,
|
|
1246
|
-
keywords: [
|
|
1247
|
-
groupTitle,
|
|
1248
|
-
route.title,
|
|
1249
|
-
route.path,
|
|
1250
|
-
route.kind
|
|
1251
|
-
].filter(Boolean).join(" ").toLowerCase()
|
|
1252
|
-
}, ...route.sections?.map((section) => ({
|
|
1253
|
-
title: section.title,
|
|
1254
|
-
pageTitle: route.title,
|
|
1255
|
-
sectionTitle: groupTitle,
|
|
1256
|
-
url: `${route.path}#${section.id}`,
|
|
1257
|
-
keywords: [
|
|
1258
|
-
groupTitle,
|
|
1259
|
-
route.title,
|
|
1260
|
-
section.title,
|
|
1261
|
-
route.path,
|
|
1262
|
-
section.id
|
|
1263
|
-
].filter(Boolean).join(" ").toLowerCase()
|
|
1264
|
-
})) ?? []];
|
|
1265
|
-
});
|
|
1266
|
-
}
|
|
1267
|
-
//#endregion
|
|
1268
|
-
//#region source/shell/search/pagefind.ts
|
|
1269
|
-
var pagefindPromises = /* @__PURE__ */ new Map();
|
|
1270
|
-
function pagefindCacheKey(routePrefix, locale) {
|
|
1271
|
-
return `${routePrefix || "/"}:${locale || "default"}`;
|
|
1272
|
-
}
|
|
1273
|
-
function loadPagefind(routePrefix, locale) {
|
|
1274
|
-
if (typeof window === "undefined") return Promise.resolve(null);
|
|
1275
|
-
const language = locale ?? document.documentElement.lang;
|
|
1276
|
-
const cacheKey = pagefindCacheKey(routePrefix, language);
|
|
1277
|
-
const cachedPagefind = pagefindPromises.get(cacheKey);
|
|
1278
|
-
if (cachedPagefind) return cachedPagefind;
|
|
1279
|
-
const pagefindPromise = import(
|
|
1280
|
-
/* @vite-ignore */
|
|
1281
|
-
prefixHref("/pagefind/pagefind.js", routePrefix)
|
|
1282
|
-
).then(async (module) => {
|
|
1283
|
-
const previousLanguage = document.documentElement.lang;
|
|
1284
|
-
if (language) document.documentElement.lang = language;
|
|
1285
|
-
const pagefind = module.createInstance();
|
|
1286
|
-
if (previousLanguage && previousLanguage !== language) document.documentElement.lang = previousLanguage;
|
|
1287
|
-
await pagefind.init?.();
|
|
1288
|
-
return pagefind;
|
|
1289
|
-
}).catch((error) => {
|
|
1290
|
-
pagefindPromises.delete(cacheKey);
|
|
1291
|
-
console.warn("[clarify:search] Pagefind instance failed", {
|
|
1292
|
-
cacheKey,
|
|
1293
|
-
language,
|
|
1294
|
-
error
|
|
1295
|
-
});
|
|
1296
|
-
return null;
|
|
1297
|
-
});
|
|
1298
|
-
pagefindPromises.set(cacheKey, pagefindPromise);
|
|
1299
|
-
return pagefindPromise;
|
|
1300
|
-
}
|
|
1301
|
-
function normalizePagefindUrl(url, routePrefix) {
|
|
1302
|
-
const parsedUrl = new URL(url, window.location.origin);
|
|
1303
|
-
let pathname = parsedUrl.pathname;
|
|
1304
|
-
const prefix = routePrefix && routePrefix !== "/" ? `/${routePrefix.replace(/^\/+|\/+$/g, "")}` : "";
|
|
1305
|
-
if (prefix && (pathname === prefix || pathname.startsWith(`${prefix}/`))) pathname = pathname.slice(prefix.length) || "/";
|
|
1306
|
-
return `${pathname}${parsedUrl.search}${parsedUrl.hash}`;
|
|
1307
|
-
}
|
|
1308
|
-
//#endregion
|
|
1309
|
-
//#region source/shell/search/SearchInput.tsx
|
|
1310
|
-
var SearchInput = (0, react.forwardRef)(function SearchInput(arg0, inputRef) {
|
|
1311
|
-
const { query, setQuery, onClose, onSubmit, activeDescendantId, loading = false } = arg0;
|
|
1312
|
-
const t = useBuiltInText();
|
|
1313
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1314
|
-
className: "clarify-search-input group relative flex h-12",
|
|
1315
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(loading ? lucide_react.LoaderCircle : lucide_react.Search, {
|
|
1316
|
-
"aria-hidden": "true",
|
|
1317
|
-
className: (0, clsx.default)("pointer-events-none absolute top-0 left-3 h-full w-5 stroke-(--clarify-theme-tokens-colors-muted)", loading && "animate-spin")
|
|
1318
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
1319
|
-
ref: inputRef,
|
|
1320
|
-
"data-autofocus": true,
|
|
1321
|
-
role: "combobox",
|
|
1322
|
-
"aria-expanded": query !== "",
|
|
1323
|
-
"aria-controls": "clarify-search-results",
|
|
1324
|
-
"aria-activedescendant": activeDescendantId,
|
|
1325
|
-
value: query,
|
|
1326
|
-
onChange: (event) => setQuery(event.currentTarget.value),
|
|
1327
|
-
onKeyDown: (event) => {
|
|
1328
|
-
if (event.key === "Escape") if (query) setQuery("");
|
|
1329
|
-
else onClose();
|
|
1330
|
-
if (event.key === "Enter") {
|
|
1331
|
-
event.preventDefault();
|
|
1332
|
-
onSubmit();
|
|
1333
|
-
}
|
|
1334
|
-
},
|
|
1335
|
-
placeholder: t("search.placeholder"),
|
|
1336
|
-
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"
|
|
1337
|
-
})]
|
|
1338
|
-
});
|
|
1339
|
-
});
|
|
1340
|
-
//#endregion
|
|
1341
|
-
//#region source/shell/search/Highlight.tsx
|
|
1342
|
-
function stripHtml(value) {
|
|
1343
|
-
if (typeof document === "undefined") return value.replace(/<[^>]*>/g, "");
|
|
1344
|
-
const template = document.createElement("template");
|
|
1345
|
-
template.innerHTML = value;
|
|
1346
|
-
return template.content.textContent ?? "";
|
|
1347
|
-
}
|
|
1348
|
-
function escapeRegExp(value) {
|
|
1349
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1350
|
-
}
|
|
1351
|
-
function HighlightQuery(arg0) {
|
|
1352
|
-
const { text, query } = arg0;
|
|
1353
|
-
if (!query) return text;
|
|
1354
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: text.split(new RegExp(`(${escapeRegExp(query)})`, "ig")).map((part, index) => part.toLowerCase() === query.toLowerCase() ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
|
|
1355
|
-
className: "bg-transparent text-(--clarify-theme-tokens-colors-primary) underline",
|
|
1356
|
-
children: part
|
|
1357
|
-
}, index) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children: part }, index)) });
|
|
1358
|
-
}
|
|
1359
|
-
function renderExcerptNode(node, key) {
|
|
1360
|
-
if (node.nodeType === Node.TEXT_NODE) return node.textContent;
|
|
1361
|
-
if (node.nodeType !== Node.ELEMENT_NODE) return null;
|
|
1362
|
-
const element = node;
|
|
1363
|
-
const children = Array.from(element.childNodes).map((child, index) => renderExcerptNode(child, `${key}-${index}`));
|
|
1364
|
-
if (element.tagName.toLowerCase() === "mark") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", {
|
|
1365
|
-
className: "bg-transparent text-(--clarify-theme-tokens-colors-primary) underline",
|
|
1366
|
-
children
|
|
1367
|
-
}, key);
|
|
1368
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Fragment, { children }, key);
|
|
1369
|
-
}
|
|
1370
|
-
function HighlightExcerpt(arg0) {
|
|
1371
|
-
const { excerpt, query } = arg0;
|
|
1372
|
-
if (typeof document === "undefined" || !excerpt.includes("<mark")) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
|
|
1373
|
-
text: stripHtml(excerpt),
|
|
1374
|
-
query
|
|
1375
|
-
});
|
|
1376
|
-
const template = document.createElement("template");
|
|
1377
|
-
template.innerHTML = excerpt;
|
|
1378
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: Array.from(template.content.childNodes).map((node, index) => renderExcerptNode(node, String(index))) });
|
|
1379
|
-
}
|
|
1380
|
-
//#endregion
|
|
1381
|
-
//#region source/shell/search/SearchResult.tsx
|
|
1382
|
-
function SearchResult(arg0) {
|
|
1383
|
-
const { result, query, active, onActive, onSelect } = arg0;
|
|
1384
|
-
const id = (0, react.useId)();
|
|
1385
|
-
const hierarchy = result.type === "quick" ? [result.sectionTitle, result.pageTitle].filter((value) => typeof value === "string") : [];
|
|
1386
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
1387
|
-
id,
|
|
1388
|
-
className: (0, clsx.default)("clarify-search-result group block cursor-pointer px-4 py-3", active && "clarify-search-result-active"),
|
|
1389
|
-
"aria-selected": active,
|
|
1390
|
-
onMouseEnter: onActive,
|
|
1391
|
-
onMouseMove: onActive,
|
|
1392
|
-
onMouseDown: (event) => {
|
|
1393
|
-
event.preventDefault();
|
|
1394
|
-
onSelect();
|
|
1395
|
-
},
|
|
1396
|
-
children: [
|
|
1397
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1398
|
-
className: "clarify-search-result-title",
|
|
1399
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
|
|
1400
|
-
text: result.title,
|
|
1401
|
-
query
|
|
1402
|
-
})
|
|
1403
|
-
}),
|
|
1404
|
-
hierarchy.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1405
|
-
className: "clarify-search-result-hierarchy mt-1 truncate whitespace-nowrap",
|
|
1406
|
-
children: hierarchy.map((item, itemIndex, items) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightQuery, {
|
|
1407
|
-
text: item,
|
|
1408
|
-
query
|
|
1409
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1410
|
-
className: itemIndex === items.length - 1 ? "sr-only" : "clarify-search-result-separator mx-2",
|
|
1411
|
-
children: "/"
|
|
1412
|
-
})] }, `${item}-${itemIndex}`))
|
|
1413
|
-
}) : null,
|
|
1414
|
-
result.type === "full-text" && result.excerpt ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1415
|
-
className: "clarify-search-result-excerpt mt-1 line-clamp-2 text-xs leading-5 text-(--clarify-theme-tokens-colors-muted)",
|
|
1416
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightExcerpt, {
|
|
1417
|
-
excerpt: result.excerpt,
|
|
1418
|
-
query
|
|
1419
|
-
})
|
|
1420
|
-
}) : null
|
|
1421
|
-
]
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
//#endregion
|
|
1425
|
-
//#region source/shell/search/SearchDialog.tsx
|
|
1426
|
-
function useSearchDialogLifecycle(arg0) {
|
|
1427
|
-
const { open, setOpen } = arg0;
|
|
1428
|
-
const location = (0, react_router_dom.useLocation)();
|
|
1429
|
-
(0, react.useEffect)(() => {
|
|
1430
|
-
setOpen(false);
|
|
1431
|
-
}, [
|
|
1432
|
-
location.pathname,
|
|
1433
|
-
location.search,
|
|
1434
|
-
location.hash,
|
|
1435
|
-
setOpen
|
|
1436
|
-
]);
|
|
1437
|
-
(0, react.useEffect)(() => {
|
|
1438
|
-
if (open) return void 0;
|
|
1439
|
-
function onKeyDown(event) {
|
|
1440
|
-
if (event.key === "k" && (event.metaKey || event.ctrlKey)) {
|
|
1441
|
-
event.preventDefault();
|
|
1442
|
-
setOpen(true);
|
|
1443
|
-
}
|
|
1444
|
-
}
|
|
1445
|
-
window.addEventListener("keydown", onKeyDown);
|
|
1446
|
-
return () => window.removeEventListener("keydown", onKeyDown);
|
|
1447
|
-
}, [open, setOpen]);
|
|
1448
|
-
}
|
|
1449
|
-
function useSearchData(arg0) {
|
|
1450
|
-
const { query, searchItems, routePrefix, currentLocale } = arg0;
|
|
1451
|
-
const [fullTextState, setFullTextState] = (0, react.useState)(null);
|
|
1452
|
-
const [pagefindState, setPagefindState] = (0, react.useState)(null);
|
|
1453
|
-
const quickResults = (0, react.useMemo)(() => {
|
|
1454
|
-
const normalizedQuery = query.trim().toLowerCase();
|
|
1455
|
-
if (!normalizedQuery) return [];
|
|
1456
|
-
return searchItems.filter((item) => item.keywords.includes(normalizedQuery)).slice(0, 8).map((item) => ({
|
|
1457
|
-
...item,
|
|
1458
|
-
type: "quick"
|
|
1459
|
-
}));
|
|
1460
|
-
}, [query, searchItems]);
|
|
1461
|
-
const pagefindKey = pagefindCacheKey(routePrefix, currentLocale);
|
|
1462
|
-
const activePagefindState = pagefindState?.key === pagefindKey ? pagefindState : null;
|
|
1463
|
-
const pagefind = activePagefindState?.pagefind ?? null;
|
|
1464
|
-
const pagefindAvailable = activePagefindState?.available ?? null;
|
|
1465
|
-
const trimmedQuery = query.trim();
|
|
1466
|
-
const fullTextKey = `${pagefindKey}:${trimmedQuery}`;
|
|
1467
|
-
const results = (fullTextState?.key === fullTextKey ? fullTextState.results : null) ?? quickResults;
|
|
1468
|
-
const searchInputLoading = pagefindAvailable === null || Boolean(trimmedQuery && pagefind && fullTextState?.key !== fullTextKey);
|
|
1469
|
-
const showNoResults = Boolean(query.trim()) && results.length === 0 && pagefindAvailable !== null;
|
|
1470
|
-
(0, react.useEffect)(() => {
|
|
1471
|
-
let cancelled = false;
|
|
1472
|
-
loadPagefind(routePrefix, currentLocale).then((loadedPagefind) => {
|
|
1473
|
-
if (cancelled) return;
|
|
1474
|
-
setPagefindState({
|
|
1475
|
-
key: pagefindKey,
|
|
1476
|
-
pagefind: loadedPagefind,
|
|
1477
|
-
available: Boolean(loadedPagefind)
|
|
1478
|
-
});
|
|
1479
|
-
});
|
|
1480
|
-
return () => {
|
|
1481
|
-
cancelled = true;
|
|
1482
|
-
};
|
|
1483
|
-
}, [
|
|
1484
|
-
currentLocale,
|
|
1485
|
-
pagefindKey,
|
|
1486
|
-
routePrefix
|
|
1487
|
-
]);
|
|
1488
|
-
(0, react.useEffect)(() => {
|
|
1489
|
-
let cancelled = false;
|
|
1490
|
-
if (!trimmedQuery || !pagefind) return void 0;
|
|
1491
|
-
Promise.resolve().then(async () => {
|
|
1492
|
-
if (cancelled) return;
|
|
1493
|
-
try {
|
|
1494
|
-
const search = await pagefind.search(trimmedQuery, { limit: 8 });
|
|
1495
|
-
const data = await Promise.all(search.results.map(async (result) => ({
|
|
1496
|
-
id: result.id,
|
|
1497
|
-
data: await result.data()
|
|
1498
|
-
})));
|
|
1499
|
-
if (cancelled) return;
|
|
1500
|
-
setFullTextState({
|
|
1501
|
-
key: fullTextKey,
|
|
1502
|
-
results: data.map(({ id, data }) => ({
|
|
1503
|
-
type: "full-text",
|
|
1504
|
-
id,
|
|
1505
|
-
title: data.meta.title || data.url,
|
|
1506
|
-
url: normalizePagefindUrl(data.url, routePrefix),
|
|
1507
|
-
excerpt: data.excerpt
|
|
1508
|
-
}))
|
|
1509
|
-
});
|
|
1510
|
-
} catch (error) {
|
|
1511
|
-
console.warn("[clarify:search] Pagefind search failed", {
|
|
1512
|
-
currentLocale,
|
|
1513
|
-
query: trimmedQuery,
|
|
1514
|
-
error
|
|
1515
|
-
});
|
|
1516
|
-
if (!cancelled) setFullTextState({
|
|
1517
|
-
key: fullTextKey,
|
|
1518
|
-
results: null
|
|
1519
|
-
});
|
|
1520
|
-
}
|
|
1521
|
-
});
|
|
1522
|
-
return () => {
|
|
1523
|
-
cancelled = true;
|
|
1524
|
-
};
|
|
1525
|
-
}, [
|
|
1526
|
-
currentLocale,
|
|
1527
|
-
fullTextKey,
|
|
1528
|
-
pagefind,
|
|
1529
|
-
routePrefix,
|
|
1530
|
-
trimmedQuery
|
|
1531
|
-
]);
|
|
1532
|
-
return {
|
|
1533
|
-
results,
|
|
1534
|
-
searchInputLoading,
|
|
1535
|
-
showNoResults
|
|
1536
|
-
};
|
|
1537
|
-
}
|
|
1538
|
-
function SearchDialog(arg0) {
|
|
1539
|
-
const { open, setOpen, routes, navigation, routePrefix = "/", currentLocale, className, onNavigate = () => {} } = arg0;
|
|
1540
|
-
const t = useBuiltInText();
|
|
1541
|
-
const navigate = (0, react_router_dom.useNavigate)();
|
|
1542
|
-
const inputRef = (0, react.useRef)(null);
|
|
1543
|
-
const [query, setQuery] = (0, react.useState)("");
|
|
1544
|
-
const [activeIndex, setActiveIndex] = (0, react.useState)(0);
|
|
1545
|
-
const searchItems = (0, react.useMemo)(() => buildSearchItems(routes, navigation), [navigation, routes]);
|
|
1546
|
-
useSearchDialogLifecycle({
|
|
1547
|
-
open,
|
|
1548
|
-
setOpen
|
|
1549
|
-
});
|
|
1550
|
-
const { results, searchInputLoading, showNoResults } = useSearchData({
|
|
1551
|
-
query,
|
|
1552
|
-
searchItems,
|
|
1553
|
-
routePrefix,
|
|
1554
|
-
currentLocale
|
|
1555
|
-
});
|
|
1556
|
-
const updateQuery = (value) => {
|
|
1557
|
-
setQuery(value);
|
|
1558
|
-
setActiveIndex(0);
|
|
1559
|
-
};
|
|
1560
|
-
function closeDialog() {
|
|
1561
|
-
updateQuery("");
|
|
1562
|
-
setOpen(false);
|
|
1563
|
-
}
|
|
1564
|
-
function selectResult(result = results[activeIndex]) {
|
|
1565
|
-
if (!result) return;
|
|
1566
|
-
navigate(result.url);
|
|
1567
|
-
onNavigate();
|
|
1568
|
-
closeDialog();
|
|
1569
|
-
}
|
|
1570
|
-
function renderResultsPanel() {
|
|
1571
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1572
|
-
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",
|
|
1573
|
-
children: [showNoResults ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1574
|
-
className: "p-6 text-center",
|
|
1575
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchX, { className: "mx-auto h-5 w-5 stroke-(--clarify-theme-tokens-colors-foreground) dark:stroke-zinc-600" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1576
|
-
className: "mt-2 text-xs text-(--clarify-theme-tokens-colors-muted) dark:text-zinc-400",
|
|
1577
|
-
children: t("search.noResults", { query })
|
|
1578
|
-
})]
|
|
1579
|
-
}) : null, results.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
1580
|
-
id: "clarify-search-results",
|
|
1581
|
-
className: "clarify-search-results",
|
|
1582
|
-
role: "listbox",
|
|
1583
|
-
children: results.map((result, resultIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchResult, {
|
|
1584
|
-
result,
|
|
1585
|
-
query,
|
|
1586
|
-
active: resultIndex === activeIndex,
|
|
1587
|
-
onActive: () => setActiveIndex(resultIndex),
|
|
1588
|
-
onSelect: () => selectResult(result)
|
|
1589
|
-
}, result.type === "full-text" ? result.id : result.url))
|
|
1590
|
-
}) : null]
|
|
1591
|
-
});
|
|
1592
|
-
}
|
|
1593
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Dialog, {
|
|
1594
|
-
open,
|
|
1595
|
-
onClose: closeDialog,
|
|
1596
|
-
className: (0, clsx.default)("clarify-search-dialog fixed inset-0 z-50", className),
|
|
1597
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.DialogBackdrop, {
|
|
1598
|
-
transition: true,
|
|
1599
|
-
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"
|
|
1600
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1601
|
-
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-(--clarify-search-dialog-padding-block-lg)",
|
|
1602
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.DialogPanel, {
|
|
1603
|
-
transition: true,
|
|
1604
|
-
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",
|
|
1605
|
-
onKeyDown: (event) => {
|
|
1606
|
-
if (event.key === "ArrowDown") {
|
|
1607
|
-
event.preventDefault();
|
|
1608
|
-
setActiveIndex((index) => results.length ? (index + 1) % results.length : 0);
|
|
1609
|
-
}
|
|
1610
|
-
if (event.key === "ArrowUp") {
|
|
1611
|
-
event.preventDefault();
|
|
1612
|
-
setActiveIndex((index) => results.length ? (index - 1 + results.length) % results.length : 0);
|
|
1613
|
-
}
|
|
1614
|
-
},
|
|
1615
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchInput, {
|
|
1616
|
-
ref: inputRef,
|
|
1617
|
-
query,
|
|
1618
|
-
setQuery: updateQuery,
|
|
1619
|
-
onClose: closeDialog,
|
|
1620
|
-
onSubmit: () => selectResult(),
|
|
1621
|
-
loading: searchInputLoading
|
|
1622
|
-
}), renderResultsPanel()]
|
|
1623
|
-
})
|
|
1624
|
-
})]
|
|
1625
|
-
});
|
|
1626
|
-
}
|
|
1627
|
-
//#endregion
|
|
1628
1013
|
//#region source/shell/search/useSearchProps.ts
|
|
1629
1014
|
function useSearchProps() {
|
|
1630
1015
|
const buttonRef = (0, react.useRef)(null);
|
|
@@ -1644,13 +1029,14 @@ function useSearchProps() {
|
|
|
1644
1029
|
}
|
|
1645
1030
|
//#endregion
|
|
1646
1031
|
//#region source/shell/Search.tsx
|
|
1032
|
+
var SearchDialog = (0, react.lazy)(() => Promise.resolve().then(() => require("./SearchDialog-CIPvXMT3.cjs")));
|
|
1647
1033
|
function getModifierKey() {
|
|
1648
1034
|
if (typeof navigator === "undefined") return "Ctrl ";
|
|
1649
1035
|
return /(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? "⌘" : "Ctrl ";
|
|
1650
1036
|
}
|
|
1651
1037
|
function Search(arg0) {
|
|
1652
1038
|
const { routes, navigation, routePrefix, currentLocale } = arg0;
|
|
1653
|
-
const t = useBuiltInText();
|
|
1039
|
+
const t = require_i18n.useBuiltInText();
|
|
1654
1040
|
const modifierKey = getModifierKey();
|
|
1655
1041
|
const { buttonProps, dialogProps } = useSearchProps();
|
|
1656
1042
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1688,7 +1074,7 @@ function Search(arg0) {
|
|
|
1688
1074
|
}
|
|
1689
1075
|
function MobileSearch(arg0) {
|
|
1690
1076
|
const { routes, navigation, routePrefix, currentLocale, onNavigate } = arg0;
|
|
1691
|
-
const t = useBuiltInText();
|
|
1077
|
+
const t = require_i18n.useBuiltInText();
|
|
1692
1078
|
const { buttonProps, dialogProps } = useSearchProps();
|
|
1693
1079
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1694
1080
|
className: "clarify-mobile-search contents lg:hidden",
|
|
@@ -1750,7 +1136,7 @@ function localizedRoutePath(config, locale, route) {
|
|
|
1750
1136
|
}
|
|
1751
1137
|
function LanguageSwitcher(arg0) {
|
|
1752
1138
|
const { config, currentLocale, currentRoute } = arg0;
|
|
1753
|
-
const t = useBuiltInText();
|
|
1139
|
+
const t = require_i18n.useBuiltInText();
|
|
1754
1140
|
const location = (0, react_router_dom.useLocation)();
|
|
1755
1141
|
const i18n = config.i18n;
|
|
1756
1142
|
if (!i18n || i18n.locales.length < 2) return null;
|
|
@@ -1815,7 +1201,7 @@ function resolveHomeHref(config, currentLocale) {
|
|
|
1815
1201
|
}
|
|
1816
1202
|
function MobileNavbarMenu(arg0) {
|
|
1817
1203
|
const { links, config, currentLocale } = arg0;
|
|
1818
|
-
const t = useBuiltInText();
|
|
1204
|
+
const t = require_i18n.useBuiltInText();
|
|
1819
1205
|
if (!links?.length) return null;
|
|
1820
1206
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Menu, {
|
|
1821
1207
|
as: "div",
|
|
@@ -1850,15 +1236,15 @@ function MobileNavbarMenu(arg0) {
|
|
|
1850
1236
|
})]
|
|
1851
1237
|
});
|
|
1852
1238
|
}
|
|
1853
|
-
function hasPath(nodes, pathname) {
|
|
1854
|
-
return nodes.some((node) => isSameRoutePath(node.path, pathname) || hasPath(node.children ?? [], pathname));
|
|
1239
|
+
function hasPath(nodes, pathname, currentLocale) {
|
|
1240
|
+
return nodes.some((node) => isSameRoutePath(node.path, pathname, currentLocale) || hasPath(node.children ?? [], pathname, currentLocale));
|
|
1855
1241
|
}
|
|
1856
|
-
function isActiveTab(tab, pathname) {
|
|
1857
|
-
return isSameRoutePath(tab.path, pathname) || hasPath(tab.children, pathname);
|
|
1242
|
+
function isActiveTab(tab, pathname, currentLocale) {
|
|
1243
|
+
return isSameRoutePath(tab.path, pathname, currentLocale) || hasPath(tab.children, pathname, currentLocale);
|
|
1858
1244
|
}
|
|
1859
1245
|
function ProductTabs(arg0) {
|
|
1860
|
-
const { tabs } = arg0;
|
|
1861
|
-
const t = useBuiltInText();
|
|
1246
|
+
const { tabs, currentLocale } = arg0;
|
|
1247
|
+
const t = require_i18n.useBuiltInText();
|
|
1862
1248
|
const pathname = normalizeRoutePath((0, react_router_dom.useLocation)().pathname);
|
|
1863
1249
|
if (!tabs?.length) return null;
|
|
1864
1250
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -1868,7 +1254,7 @@ function ProductTabs(arg0) {
|
|
|
1868
1254
|
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",
|
|
1869
1255
|
"aria-label": t("navbar.sections"),
|
|
1870
1256
|
children: tabs.map((tab) => {
|
|
1871
|
-
const active = isActiveTab(tab, pathname);
|
|
1257
|
+
const active = isActiveTab(tab, pathname, currentLocale);
|
|
1872
1258
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_router_dom.Link, {
|
|
1873
1259
|
to: tab.path,
|
|
1874
1260
|
"aria-current": active ? "page" : void 0,
|
|
@@ -1896,7 +1282,7 @@ function ProductTabs(arg0) {
|
|
|
1896
1282
|
}
|
|
1897
1283
|
var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
1898
1284
|
const { config, navigation, tabs, routes, currentLocale, currentRoute, banner, topAreaRef, className, ...props } = arg0;
|
|
1899
|
-
const t = useBuiltInText();
|
|
1285
|
+
const t = require_i18n.useBuiltInText();
|
|
1900
1286
|
const { isOpen: mobileNavIsOpen } = useMobileNavigationStore();
|
|
1901
1287
|
const isInsideMobileNavigation = useIsInsideMobileNavigation();
|
|
1902
1288
|
const homeHref = resolveHomeHref(config, currentLocale);
|
|
@@ -2014,7 +1400,10 @@ var Header = (0, react.forwardRef)(function Header(arg0, ref) {
|
|
|
2014
1400
|
"data-clarify-header-banner": true,
|
|
2015
1401
|
children: banner
|
|
2016
1402
|
}),
|
|
2017
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, {
|
|
1403
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ProductTabs, {
|
|
1404
|
+
tabs,
|
|
1405
|
+
currentLocale
|
|
1406
|
+
})
|
|
2018
1407
|
]
|
|
2019
1408
|
});
|
|
2020
1409
|
}
|
|
@@ -2051,36 +1440,18 @@ function PageTitleActions() {
|
|
|
2051
1440
|
});
|
|
2052
1441
|
}
|
|
2053
1442
|
//#endregion
|
|
2054
|
-
Object.defineProperty(exports, "ConfigContext", {
|
|
2055
|
-
enumerable: true,
|
|
2056
|
-
get: function() {
|
|
2057
|
-
return ConfigContext;
|
|
2058
|
-
}
|
|
2059
|
-
});
|
|
2060
1443
|
Object.defineProperty(exports, "Header", {
|
|
2061
1444
|
enumerable: true,
|
|
2062
1445
|
get: function() {
|
|
2063
1446
|
return Header;
|
|
2064
1447
|
}
|
|
2065
1448
|
});
|
|
2066
|
-
Object.defineProperty(exports, "LocaleContext", {
|
|
2067
|
-
enumerable: true,
|
|
2068
|
-
get: function() {
|
|
2069
|
-
return LocaleContext;
|
|
2070
|
-
}
|
|
2071
|
-
});
|
|
2072
1449
|
Object.defineProperty(exports, "Navigation", {
|
|
2073
1450
|
enumerable: true,
|
|
2074
1451
|
get: function() {
|
|
2075
1452
|
return Navigation;
|
|
2076
1453
|
}
|
|
2077
1454
|
});
|
|
2078
|
-
Object.defineProperty(exports, "OpenApisContext", {
|
|
2079
|
-
enumerable: true,
|
|
2080
|
-
get: function() {
|
|
2081
|
-
return OpenApisContext;
|
|
2082
|
-
}
|
|
2083
|
-
});
|
|
2084
1455
|
Object.defineProperty(exports, "PageActionsProvider", {
|
|
2085
1456
|
enumerable: true,
|
|
2086
1457
|
get: function() {
|
|
@@ -2213,36 +1584,6 @@ Object.defineProperty(exports, "themeCookieName", {
|
|
|
2213
1584
|
return themeCookieName;
|
|
2214
1585
|
}
|
|
2215
1586
|
});
|
|
2216
|
-
Object.defineProperty(exports, "useBuiltInText", {
|
|
2217
|
-
enumerable: true,
|
|
2218
|
-
get: function() {
|
|
2219
|
-
return useBuiltInText;
|
|
2220
|
-
}
|
|
2221
|
-
});
|
|
2222
|
-
Object.defineProperty(exports, "useConfig", {
|
|
2223
|
-
enumerable: true,
|
|
2224
|
-
get: function() {
|
|
2225
|
-
return useConfig;
|
|
2226
|
-
}
|
|
2227
|
-
});
|
|
2228
|
-
Object.defineProperty(exports, "useConfigOptional", {
|
|
2229
|
-
enumerable: true,
|
|
2230
|
-
get: function() {
|
|
2231
|
-
return useConfigOptional;
|
|
2232
|
-
}
|
|
2233
|
-
});
|
|
2234
|
-
Object.defineProperty(exports, "useLocale", {
|
|
2235
|
-
enumerable: true,
|
|
2236
|
-
get: function() {
|
|
2237
|
-
return useLocale;
|
|
2238
|
-
}
|
|
2239
|
-
});
|
|
2240
|
-
Object.defineProperty(exports, "useOpenApis", {
|
|
2241
|
-
enumerable: true,
|
|
2242
|
-
get: function() {
|
|
2243
|
-
return useOpenApis;
|
|
2244
|
-
}
|
|
2245
|
-
});
|
|
2246
1587
|
Object.defineProperty(exports, "useSectionStore", {
|
|
2247
1588
|
enumerable: true,
|
|
2248
1589
|
get: function() {
|
|
@@ -2256,4 +1597,4 @@ Object.defineProperty(exports, "useTheme", {
|
|
|
2256
1597
|
}
|
|
2257
1598
|
});
|
|
2258
1599
|
|
|
2259
|
-
//# sourceMappingURL=PageActions-
|
|
1600
|
+
//# sourceMappingURL=PageActions-BjB6PYmL.cjs.map
|