@unterberg/nivel 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -0
- package/dist/{chunk-73NPVCDQ.js → chunk-D7IAGT53.js} +56 -26
- package/dist/chunk-D7IAGT53.js.map +1 -0
- package/dist/{chunk-3JJ6TYWL.js → chunk-G37565OX.js} +18 -26
- package/dist/chunk-G37565OX.js.map +1 -0
- package/dist/chunk-G7X2IWYG.js +1596 -0
- package/dist/chunk-G7X2IWYG.js.map +1 -0
- package/dist/{chunk-PHHK2BAF.js → chunk-HXZEI3YF.js} +38 -29
- package/dist/chunk-HXZEI3YF.js.map +1 -0
- package/dist/{chunk-4WTEOEV2.js → chunk-L6ZVB6XH.js} +3 -3
- package/dist/chunk-L6ZVB6XH.js.map +1 -0
- package/dist/{chunk-FLO5CJZH.js → chunk-PYYPYIBD.js} +10 -3
- package/dist/chunk-PYYPYIBD.js.map +1 -0
- package/dist/{chunk-45CLUNJW.js → chunk-UWP3C7JT.js} +12 -12
- package/dist/chunk-UWP3C7JT.js.map +1 -0
- package/dist/client.d.ts +4 -8
- package/dist/client.js +4 -4
- package/dist/index.d.ts +7 -12
- package/dist/index.js +4 -8
- package/dist/{code-blocks.js → mdx/code-blocks.js} +1 -1
- package/dist/mdx.js +4 -4
- package/dist/mdx.js.map +1 -1
- package/dist/runtime/client.d.ts +1 -1
- package/dist/runtime/client.js +4 -4
- package/dist/runtime/{index.d.ts → node.d.ts} +4 -2
- package/dist/runtime/{index.js → node.js} +4 -4
- package/dist/{types-mvLNHHrf.d.ts → types-j0kEkMA4.d.ts} +47 -24
- package/dist/{config.js → vike.js} +8 -8
- package/dist/vike.js.map +1 -0
- package/package.json +15 -14
- package/assets/nivel/decorators/pattern-light.png +0 -0
- package/assets/nivel/decorators/pattern.png +0 -0
- package/dist/chunk-3JJ6TYWL.js.map +0 -1
- package/dist/chunk-45CLUNJW.js.map +0 -1
- package/dist/chunk-4WTEOEV2.js.map +0 -1
- package/dist/chunk-62MBEYU7.js +0 -1091
- package/dist/chunk-62MBEYU7.js.map +0 -1
- package/dist/chunk-73NPVCDQ.js.map +0 -1
- package/dist/chunk-FLO5CJZH.js.map +0 -1
- package/dist/chunk-PHHK2BAF.js.map +0 -1
- package/dist/config.js.map +0 -1
- /package/dist/{code-blocks.d.ts → mdx/code-blocks.d.ts} +0 -0
- /package/dist/{code-blocks.js.map → mdx/code-blocks.js.map} +0 -0
- /package/dist/runtime/{index.js.map → node.js.map} +0 -0
- /package/dist/{config.d.ts → vike.d.ts} +0 -0
|
@@ -0,0 +1,1596 @@
|
|
|
1
|
+
import {
|
|
2
|
+
UniversalMdxProvider,
|
|
3
|
+
renderInlineMarkdown
|
|
4
|
+
} from "./chunk-L6ZVB6XH.js";
|
|
5
|
+
import {
|
|
6
|
+
createHeadingSlugger,
|
|
7
|
+
getActiveSectionByPathname,
|
|
8
|
+
getResolvedPageByPathname,
|
|
9
|
+
getResolvedSectionById,
|
|
10
|
+
isSamePagePathname,
|
|
11
|
+
normalizeHeadingTitle
|
|
12
|
+
} from "./chunk-D7IAGT53.js";
|
|
13
|
+
import {
|
|
14
|
+
withSiteBaseUrl
|
|
15
|
+
} from "./chunk-PYYPYIBD.js";
|
|
16
|
+
|
|
17
|
+
// src/runtime/client/AppLayout.tsx
|
|
18
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
19
|
+
import { useState as useState5 } from "react";
|
|
20
|
+
import { usePageContext as usePageContext3 } from "vike-react/usePageContext";
|
|
21
|
+
|
|
22
|
+
// src/runtime/client/components/Navbar/index.tsx
|
|
23
|
+
import cm2, { cmMerge as cmMerge4 } from "@classmatejs/react";
|
|
24
|
+
import { ChevronDown } from "lucide-react";
|
|
25
|
+
import { useCallback, useEffect as useEffect4, useMemo, useRef as useRef2, useState as useState4 } from "react";
|
|
26
|
+
import { usePageContext as usePageContext2 } from "vike-react/usePageContext";
|
|
27
|
+
|
|
28
|
+
// src/runtime/client/docsGlobalContext.ts
|
|
29
|
+
import { usePageContext } from "vike-react/usePageContext";
|
|
30
|
+
var getDocsGlobalContext = (pageContext) => {
|
|
31
|
+
const docs = pageContext.globalContext?.docs;
|
|
32
|
+
if (!docs) {
|
|
33
|
+
throw new Error("Missing docs global context data.");
|
|
34
|
+
}
|
|
35
|
+
return docs;
|
|
36
|
+
};
|
|
37
|
+
var useDocsGlobalContext = () => {
|
|
38
|
+
return getDocsGlobalContext(usePageContext());
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/runtime/client/components/Brand.tsx
|
|
42
|
+
import { cmMerge } from "@classmatejs/react";
|
|
43
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
44
|
+
var Brand = ({ brand, noText = false }) => {
|
|
45
|
+
const defaultLogo = brand.logoLight ?? brand.logoDark;
|
|
46
|
+
return /* @__PURE__ */ jsxs("a", { href: brand.href, className: "flex items-center gap-3 text-base-content no-underline", children: [
|
|
47
|
+
defaultLogo && /* @__PURE__ */ jsxs("span", { className: "relative block h-7 w-7 shrink-0", children: [
|
|
48
|
+
brand.logoLight && /* @__PURE__ */ jsx(
|
|
49
|
+
"img",
|
|
50
|
+
{
|
|
51
|
+
src: brand.logoLight,
|
|
52
|
+
alt: brand.logoAlt,
|
|
53
|
+
className: cmMerge("h-7 w-7 object-contain", brand.logoDark ? "block dark:hidden" : "block")
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
brand.logoDark && /* @__PURE__ */ jsx(
|
|
57
|
+
"img",
|
|
58
|
+
{
|
|
59
|
+
src: brand.logoDark,
|
|
60
|
+
alt: brand.logoAlt,
|
|
61
|
+
className: cmMerge("h-7 w-7 object-contain", brand.logoLight ? "hidden dark:block" : "block")
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] }),
|
|
65
|
+
!noText && /* @__PURE__ */ jsx("span", { className: "text-xl font-semibold tracking-tight", children: brand.text })
|
|
66
|
+
] });
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// src/runtime/client/components/LayoutComponent.tsx
|
|
70
|
+
import cm from "@classmatejs/react";
|
|
71
|
+
var LayoutSize = {
|
|
72
|
+
xxs: "xxs",
|
|
73
|
+
xs: "xs",
|
|
74
|
+
sm: "sm",
|
|
75
|
+
md: "md",
|
|
76
|
+
lg: "lg",
|
|
77
|
+
xl: "xl",
|
|
78
|
+
full: "full"
|
|
79
|
+
};
|
|
80
|
+
var layoutComponentSizeMapping = {
|
|
81
|
+
xxs: "max-w-[480px]",
|
|
82
|
+
xs: "max-w-[768px]",
|
|
83
|
+
sm: "max-w-5xl",
|
|
84
|
+
md: "max-w-6xl",
|
|
85
|
+
lg: "max-w-7xl",
|
|
86
|
+
xl: "max-w-[1440px]",
|
|
87
|
+
full: "max-w-full"
|
|
88
|
+
};
|
|
89
|
+
var LayoutComponent = cm.div.variants({
|
|
90
|
+
base: ({ $noGrow }) => `px-4 ${$noGrow ? "" : "mx-auto w-full"} relative`,
|
|
91
|
+
variants: {
|
|
92
|
+
$size: layoutComponentSizeMapping
|
|
93
|
+
},
|
|
94
|
+
defaultVariants: {
|
|
95
|
+
$size: LayoutSize.xl
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// src/runtime/client/components/Search.tsx
|
|
100
|
+
import { cmMerge as cmMerge2 } from "@classmatejs/react";
|
|
101
|
+
import { useQuery } from "@tanstack/react-query";
|
|
102
|
+
import { ArrowRightFromLine, MessageCircleQuestion, Search as SearchIcon, TriangleAlert } from "lucide-react";
|
|
103
|
+
import { useEffect, useRef, useState } from "react";
|
|
104
|
+
import { createPortal } from "react-dom";
|
|
105
|
+
|
|
106
|
+
// src/runtime/client/search.ts
|
|
107
|
+
var hierarchyLevels = ["lvl0", "lvl1", "lvl2", "lvl3", "lvl4", "lvl5", "lvl6"];
|
|
108
|
+
var stripHtml = (value) => value.replace(/<[^>]+>/g, "");
|
|
109
|
+
var normalizeString = (value) => {
|
|
110
|
+
if (typeof value === "string") {
|
|
111
|
+
const normalized = stripHtml(value).replace(/\s+/g, " ").trim();
|
|
112
|
+
return normalized || void 0;
|
|
113
|
+
}
|
|
114
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
115
|
+
return String(value);
|
|
116
|
+
}
|
|
117
|
+
return void 0;
|
|
118
|
+
};
|
|
119
|
+
var getValueAtPath = (value, path) => {
|
|
120
|
+
if (!path) {
|
|
121
|
+
return void 0;
|
|
122
|
+
}
|
|
123
|
+
const segments = path.split(".").filter(Boolean);
|
|
124
|
+
let currentValue = value;
|
|
125
|
+
for (const segment of segments) {
|
|
126
|
+
if (!currentValue || typeof currentValue !== "object" || Array.isArray(currentValue)) {
|
|
127
|
+
return void 0;
|
|
128
|
+
}
|
|
129
|
+
currentValue = currentValue[segment];
|
|
130
|
+
}
|
|
131
|
+
return currentValue;
|
|
132
|
+
};
|
|
133
|
+
var getMappedString = (value, path) => {
|
|
134
|
+
return normalizeString(getValueAtPath(value, path));
|
|
135
|
+
};
|
|
136
|
+
var buildSearchUrl = (appId, indexName) => {
|
|
137
|
+
return `https://${appId}-dsn.algolia.net/1/indexes/${encodeURIComponent(indexName)}/query`;
|
|
138
|
+
};
|
|
139
|
+
var getDocSearchHierarchyValue = (hierarchy, level) => {
|
|
140
|
+
if (!hierarchy || typeof hierarchy !== "object") {
|
|
141
|
+
return void 0;
|
|
142
|
+
}
|
|
143
|
+
return normalizeString(hierarchy[level]);
|
|
144
|
+
};
|
|
145
|
+
var getDocSearchTitleLevel = (hit) => {
|
|
146
|
+
const levelFromType = typeof hit.type === "string" && /^lvl[0-6]$/.test(hit.type) ? hit.type : null;
|
|
147
|
+
if (levelFromType && getDocSearchHierarchyValue(hit.hierarchy, levelFromType)) {
|
|
148
|
+
return levelFromType;
|
|
149
|
+
}
|
|
150
|
+
return [...hierarchyLevels].reverse().find((level) => level !== "lvl0" && getDocSearchHierarchyValue(hit.hierarchy, level));
|
|
151
|
+
};
|
|
152
|
+
var getDocSearchFallbackResult = (hit) => {
|
|
153
|
+
const docSearchHit = hit;
|
|
154
|
+
const titleLevel = getDocSearchTitleLevel(docSearchHit);
|
|
155
|
+
const title = titleLevel ? getDocSearchHierarchyValue(docSearchHit.hierarchy, titleLevel) : void 0;
|
|
156
|
+
const titleLevelIndex = titleLevel ? hierarchyLevels.indexOf(titleLevel) : -1;
|
|
157
|
+
const sectionTitle = hierarchyLevels.slice(0, Math.max(titleLevelIndex, 0)).reverse().map((level) => getDocSearchHierarchyValue(docSearchHit.hierarchy, level)).find(Boolean) ?? normalizeString(docSearchHit.category);
|
|
158
|
+
return {
|
|
159
|
+
href: normalizeString(docSearchHit.url) ?? normalizeString(docSearchHit.url_without_anchor),
|
|
160
|
+
title: title ?? normalizeString(docSearchHit.category),
|
|
161
|
+
excerpt: normalizeString(docSearchHit._snippetResult?.content?.value) ?? normalizeString(docSearchHit.content) ?? normalizeString(docSearchHit._highlightResult?.content?.value),
|
|
162
|
+
sectionTitle
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
var mapHitToSearchResult = (hit, config) => {
|
|
166
|
+
const docSearchFallback = getDocSearchFallbackResult(hit);
|
|
167
|
+
const href = getMappedString(hit, config.fields.href) ?? docSearchFallback.href;
|
|
168
|
+
const title = getMappedString(hit, config.fields.title) ?? docSearchFallback.title;
|
|
169
|
+
if (!href || !title) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
const excerpt = getMappedString(hit, config.fields.excerpt) ?? docSearchFallback.excerpt;
|
|
173
|
+
const sectionTitle = getMappedString(hit, config.fields.sectionTitle) ?? docSearchFallback.sectionTitle;
|
|
174
|
+
return {
|
|
175
|
+
href,
|
|
176
|
+
title,
|
|
177
|
+
excerpt,
|
|
178
|
+
sectionTitle
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
var searchAlgoliaIndex = async (options) => {
|
|
182
|
+
const { config, query, signal } = options;
|
|
183
|
+
const response = await fetch(buildSearchUrl(config.appId, config.indexName), {
|
|
184
|
+
method: "POST",
|
|
185
|
+
signal,
|
|
186
|
+
headers: {
|
|
187
|
+
accept: "application/json",
|
|
188
|
+
"content-type": "application/json",
|
|
189
|
+
"x-algolia-api-key": config.apiKey,
|
|
190
|
+
"x-algolia-application-id": config.appId
|
|
191
|
+
},
|
|
192
|
+
body: JSON.stringify({
|
|
193
|
+
query,
|
|
194
|
+
...config.searchParams
|
|
195
|
+
})
|
|
196
|
+
});
|
|
197
|
+
if (!response.ok) {
|
|
198
|
+
throw new Error(`Algolia search request failed with status ${response.status}.`);
|
|
199
|
+
}
|
|
200
|
+
const data = await response.json();
|
|
201
|
+
return (data.hits ?? []).map((hit) => mapHitToSearchResult(hit, config)).filter((result) => result !== null);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// src/runtime/client/components/Search.tsx
|
|
205
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
206
|
+
var MIN_QUERY_LENGTH = 2;
|
|
207
|
+
var QUERY_DEBOUNCE_MS = 150;
|
|
208
|
+
var useDebouncedValue = (value, delayMs) => {
|
|
209
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
const timeoutId = window.setTimeout(() => {
|
|
212
|
+
setDebouncedValue(value);
|
|
213
|
+
}, delayMs);
|
|
214
|
+
return () => {
|
|
215
|
+
window.clearTimeout(timeoutId);
|
|
216
|
+
};
|
|
217
|
+
}, [delayMs, value]);
|
|
218
|
+
return debouncedValue;
|
|
219
|
+
};
|
|
220
|
+
var Search = ({ algolia }) => {
|
|
221
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
222
|
+
const [query, setQuery] = useState("");
|
|
223
|
+
const [isSearchHovered, setIsSearchHovered] = useState(false);
|
|
224
|
+
const containerRef = useRef(null);
|
|
225
|
+
const suggestionBoxRef = useRef(null);
|
|
226
|
+
const debouncedQuery = useDebouncedValue(query, QUERY_DEBOUNCE_MS);
|
|
227
|
+
const normalizedQuery = debouncedQuery.trim();
|
|
228
|
+
const canSearch = Boolean(algolia) && normalizedQuery.length >= MIN_QUERY_LENGTH;
|
|
229
|
+
const searchQuery = useQuery({
|
|
230
|
+
queryKey: ["nivel-algolia-search", algolia?.appId, algolia?.indexName, normalizedQuery],
|
|
231
|
+
queryFn: ({ signal }) => searchAlgoliaIndex({ config: algolia, query: normalizedQuery, signal }),
|
|
232
|
+
enabled: isOpen && canSearch,
|
|
233
|
+
retry: false
|
|
234
|
+
});
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
if (!isOpen) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const handlePointerDown = (event) => {
|
|
240
|
+
const target = event.target;
|
|
241
|
+
if (!containerRef.current?.contains(target) && !suggestionBoxRef.current?.contains(target)) {
|
|
242
|
+
setIsOpen(false);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
const handleKeyDown = (event) => {
|
|
246
|
+
if (event.key === "Escape") {
|
|
247
|
+
setIsOpen(false);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
251
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
252
|
+
return () => {
|
|
253
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
254
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
255
|
+
};
|
|
256
|
+
}, [isOpen]);
|
|
257
|
+
if (!algolia) {
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
return /* @__PURE__ */ jsxs2("div", { ref: containerRef, className: "relative", children: [
|
|
261
|
+
/* @__PURE__ */ jsx2("div", { className: "hidden md:block", children: /* @__PURE__ */ jsxs2(
|
|
262
|
+
"label",
|
|
263
|
+
{
|
|
264
|
+
className: cmMerge2(
|
|
265
|
+
"input input-sm w-56 transition-all",
|
|
266
|
+
isSearchHovered ? "border-primary-muted shadow-lg shadow-primary-muted-light" : "shadow-transparent"
|
|
267
|
+
),
|
|
268
|
+
onMouseEnter: () => setIsSearchHovered(true),
|
|
269
|
+
onMouseLeave: () => setIsSearchHovered(false),
|
|
270
|
+
children: [
|
|
271
|
+
/* @__PURE__ */ jsx2("span", { className: "label", children: /* @__PURE__ */ jsx2(SearchIcon, { className: "h-4 w-4 shrink-0" }) }),
|
|
272
|
+
/* @__PURE__ */ jsx2(
|
|
273
|
+
"input",
|
|
274
|
+
{
|
|
275
|
+
type: "text",
|
|
276
|
+
value: query,
|
|
277
|
+
placeholder: "Search docs",
|
|
278
|
+
className: cmMerge2(
|
|
279
|
+
"w-full placeholder:text-base-muted-medium transition-colors",
|
|
280
|
+
isSearchHovered && "placeholder:text-base-muted"
|
|
281
|
+
),
|
|
282
|
+
onFocus: () => {
|
|
283
|
+
setIsOpen(true);
|
|
284
|
+
},
|
|
285
|
+
onChange: (event) => {
|
|
286
|
+
setQuery(event.target.value);
|
|
287
|
+
setIsOpen(true);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
) }),
|
|
294
|
+
/* @__PURE__ */ jsx2(
|
|
295
|
+
"button",
|
|
296
|
+
{
|
|
297
|
+
type: "button",
|
|
298
|
+
className: "btn btn-ghost btn-square md:hidden",
|
|
299
|
+
"aria-label": "Search docs",
|
|
300
|
+
onClick: () => {
|
|
301
|
+
setIsOpen(true);
|
|
302
|
+
},
|
|
303
|
+
children: /* @__PURE__ */ jsx2(SearchIcon, { className: "h-4 w-4" })
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
/* @__PURE__ */ jsx2(
|
|
307
|
+
SearchSuggestionBox,
|
|
308
|
+
{
|
|
309
|
+
contentRef: suggestionBoxRef,
|
|
310
|
+
isError: searchQuery.isError,
|
|
311
|
+
isLoading: searchQuery.isFetching,
|
|
312
|
+
isOpen,
|
|
313
|
+
onClose: () => {
|
|
314
|
+
setIsOpen(false);
|
|
315
|
+
},
|
|
316
|
+
onQueryChange: (nextQuery) => {
|
|
317
|
+
setQuery(nextQuery);
|
|
318
|
+
setIsOpen(true);
|
|
319
|
+
},
|
|
320
|
+
query,
|
|
321
|
+
results: searchQuery.data ?? []
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] });
|
|
325
|
+
};
|
|
326
|
+
var SearchSuggestionBox = ({
|
|
327
|
+
contentRef,
|
|
328
|
+
isError,
|
|
329
|
+
isLoading,
|
|
330
|
+
isOpen,
|
|
331
|
+
onClose,
|
|
332
|
+
onQueryChange,
|
|
333
|
+
query,
|
|
334
|
+
results
|
|
335
|
+
}) => {
|
|
336
|
+
const inputRef = useRef(null);
|
|
337
|
+
const normalizedQuery = query.trim();
|
|
338
|
+
const canSearch = normalizedQuery.length >= MIN_QUERY_LENGTH;
|
|
339
|
+
useEffect(() => {
|
|
340
|
+
if (!isOpen) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const frameId = window.requestAnimationFrame(() => {
|
|
344
|
+
inputRef.current?.focus();
|
|
345
|
+
inputRef.current?.setSelectionRange(query.length, query.length);
|
|
346
|
+
});
|
|
347
|
+
return () => {
|
|
348
|
+
window.cancelAnimationFrame(frameId);
|
|
349
|
+
};
|
|
350
|
+
}, [isOpen, query.length]);
|
|
351
|
+
if (!isOpen || typeof document === "undefined") {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
return createPortal(
|
|
355
|
+
/* @__PURE__ */ jsxs2("div", { className: "fixed inset-0 z-30 h-full w-full bg-base-100/50 backdrop-blur-lg", children: [
|
|
356
|
+
/* @__PURE__ */ jsx2("div", { className: "absolute inset-0 z-1 bg-linear-to-b from-base-100 via-base-100 via-25% to-primary-muted-superlight dark:bg-linear-to-t" }),
|
|
357
|
+
/* @__PURE__ */ jsxs2(
|
|
358
|
+
LayoutComponent,
|
|
359
|
+
{
|
|
360
|
+
ref: contentRef,
|
|
361
|
+
$size: "sm",
|
|
362
|
+
className: "mt-5 relative z-2 pt-6 p-6 bg-base-100/70 rounded-box shadow-lg shadow-primary-muted-light",
|
|
363
|
+
children: [
|
|
364
|
+
/* @__PURE__ */ jsx2(
|
|
365
|
+
"input",
|
|
366
|
+
{
|
|
367
|
+
placeholder: "Search docs",
|
|
368
|
+
ref: inputRef,
|
|
369
|
+
type: "text",
|
|
370
|
+
className: "input input-primary input-xl w-full",
|
|
371
|
+
value: query,
|
|
372
|
+
onChange: (event) => onQueryChange(event.target.value)
|
|
373
|
+
}
|
|
374
|
+
),
|
|
375
|
+
/* @__PURE__ */ jsx2("div", { className: "flex h-7 items-center px-4 text-xs text-base-muted", children: isLoading ? /* @__PURE__ */ jsxs2("span", { className: "flex items-center gap-1", children: [
|
|
376
|
+
/* @__PURE__ */ jsx2("span", { className: "loading loading-dots loading-xs" }),
|
|
377
|
+
"Searching..."
|
|
378
|
+
] }) : normalizedQuery ? null : /* @__PURE__ */ jsxs2("span", { className: "flex items-center gap-1", children: [
|
|
379
|
+
/* @__PURE__ */ jsx2(MessageCircleQuestion, { className: "h-3 w-3 shrink-0" }),
|
|
380
|
+
"Type at least ",
|
|
381
|
+
MIN_QUERY_LENGTH,
|
|
382
|
+
" characters."
|
|
383
|
+
] }) }),
|
|
384
|
+
normalizedQuery ? isError ? /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 rounded-box border border-warning/40 bg-base-100 p-4 text-sm text-base-muted shadow-md shadow-primary-muted-light", children: [
|
|
385
|
+
/* @__PURE__ */ jsx2(TriangleAlert, { className: "h-4 w-4 shrink-0 text-warning" }),
|
|
386
|
+
"Search is temporarily unavailable."
|
|
387
|
+
] }) : !canSearch ? /* @__PURE__ */ jsx2("div", { className: "text-sm text-base-muted", children: "Keep typing to search." }) : !isLoading && results.length === 0 ? /* @__PURE__ */ jsx2("div", { className: "text-sm text-base-muted", children: "No results found." }) : /* @__PURE__ */ jsx2("div", { className: "max-h-80 overflow-y-auto -mx-2 p-2", children: /* @__PURE__ */ jsx2("ul", { className: "flex flex-col gap-2", children: results.map((result) => /* @__PURE__ */ jsx2("li", { children: /* @__PURE__ */ jsxs2(
|
|
388
|
+
"a",
|
|
389
|
+
{
|
|
390
|
+
href: withSiteBaseUrl(result.href),
|
|
391
|
+
className: "block rounded-box border border-base-muted-medium bg-base-100 p-4 hover:border-primary-muted hover:bg-base-200 shadow-md",
|
|
392
|
+
onClick: onClose,
|
|
393
|
+
children: [
|
|
394
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-2 flex items-center justify-start gap-2", children: [
|
|
395
|
+
/* @__PURE__ */ jsx2("div", { className: "text-base-content font-bold", children: result.title }),
|
|
396
|
+
result.sectionTitle ? /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1 text-sm text-base-muted-medium", children: [
|
|
397
|
+
/* @__PURE__ */ jsx2(ArrowRightFromLine, { className: "h-3 w-3" }),
|
|
398
|
+
" ",
|
|
399
|
+
result.sectionTitle
|
|
400
|
+
] }) : null
|
|
401
|
+
] }),
|
|
402
|
+
result.excerpt ? /* @__PURE__ */ jsx2("p", { className: "text-xs leading-5 text-base-muted", children: result.excerpt }) : null
|
|
403
|
+
]
|
|
404
|
+
}
|
|
405
|
+
) }, result.href)) }) }) : null
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
)
|
|
409
|
+
] }),
|
|
410
|
+
document.body
|
|
411
|
+
);
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
// src/runtime/client/components/ThemeSwitch.tsx
|
|
415
|
+
import { Moon, Sun } from "lucide-react";
|
|
416
|
+
|
|
417
|
+
// src/runtime/client/store/settings-store.ts
|
|
418
|
+
import { create } from "zustand";
|
|
419
|
+
import { createJSONStorage, persist } from "zustand/middleware";
|
|
420
|
+
|
|
421
|
+
// src/runtime/client/store/settings-storage.ts
|
|
422
|
+
var USER_SETTINGS_STORAGE_KEY = "nivel-user-settings";
|
|
423
|
+
var LEGACY_CODE_BLOCK_CHOICE_STORAGE_KEY_PREFIX = "vike-docpress:choice:";
|
|
424
|
+
var readLegacyCodeBlockChoice = (choiceGroupName) => {
|
|
425
|
+
if (typeof window === "undefined") {
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
try {
|
|
429
|
+
const value = window.localStorage.getItem(`${LEGACY_CODE_BLOCK_CHOICE_STORAGE_KEY_PREFIX}${choiceGroupName}`);
|
|
430
|
+
return value || null;
|
|
431
|
+
} catch {
|
|
432
|
+
return null;
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
// src/runtime/client/store/settings-store.ts
|
|
437
|
+
var useDocsUserSettingsStore = create()(
|
|
438
|
+
persist(
|
|
439
|
+
(set) => ({
|
|
440
|
+
codeBlockChoices: {},
|
|
441
|
+
themePreference: null,
|
|
442
|
+
setCodeBlockChoice: (choiceGroupName, choice) => set((state) => ({
|
|
443
|
+
codeBlockChoices: {
|
|
444
|
+
...state.codeBlockChoices,
|
|
445
|
+
[choiceGroupName]: choice
|
|
446
|
+
}
|
|
447
|
+
})),
|
|
448
|
+
setThemePreference: (themePreference) => set({ themePreference })
|
|
449
|
+
}),
|
|
450
|
+
{
|
|
451
|
+
name: USER_SETTINGS_STORAGE_KEY,
|
|
452
|
+
storage: createJSONStorage(() => localStorage),
|
|
453
|
+
partialize: ({ codeBlockChoices, themePreference }) => ({
|
|
454
|
+
codeBlockChoices,
|
|
455
|
+
themePreference
|
|
456
|
+
})
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
);
|
|
460
|
+
var docsCodeBlockChoiceStore = {
|
|
461
|
+
subscribe: (listener) => useDocsUserSettingsStore.subscribe(listener),
|
|
462
|
+
getChoice: (choiceGroupName) => useDocsUserSettingsStore.getState().codeBlockChoices[choiceGroupName] ?? null,
|
|
463
|
+
setChoice: (choiceGroupName, choice) => useDocsUserSettingsStore.getState().setCodeBlockChoice(choiceGroupName, choice),
|
|
464
|
+
getLegacyChoice: readLegacyCodeBlockChoice
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// src/runtime/client/theme.ts
|
|
468
|
+
var DEFAULT_THEME_PREFERENCE = "light";
|
|
469
|
+
var DARK_THEME_MEDIA_QUERY = "(prefers-color-scheme: dark)";
|
|
470
|
+
var getDataTheme = (themePreference, themeConfig) => {
|
|
471
|
+
return themePreference === "dark" ? themeConfig.dark : themeConfig.light;
|
|
472
|
+
};
|
|
473
|
+
var isThemePreference = (value) => {
|
|
474
|
+
return value === "light" || value === "dark";
|
|
475
|
+
};
|
|
476
|
+
var getSystemThemePreference = (fallbackThemePreference) => {
|
|
477
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
478
|
+
return fallbackThemePreference;
|
|
479
|
+
}
|
|
480
|
+
return window.matchMedia(DARK_THEME_MEDIA_QUERY).matches ? "dark" : "light";
|
|
481
|
+
};
|
|
482
|
+
var resolveThemePreference = (themePreference, themeConfig) => {
|
|
483
|
+
if (isThemePreference(themePreference)) {
|
|
484
|
+
return themePreference;
|
|
485
|
+
}
|
|
486
|
+
return getSystemThemePreference(themeConfig.defaultPreference);
|
|
487
|
+
};
|
|
488
|
+
var applyThemePreference = (themePreference, themeConfig) => {
|
|
489
|
+
if (typeof document === "undefined") {
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
document.documentElement.setAttribute(
|
|
493
|
+
"data-theme",
|
|
494
|
+
getDataTheme(resolveThemePreference(themePreference, themeConfig), themeConfig)
|
|
495
|
+
);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
// src/runtime/client/components/ThemeSwitch.tsx
|
|
499
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
500
|
+
var ThemeSwitch = ({ theme }) => {
|
|
501
|
+
const themePreference = useDocsUserSettingsStore((state) => state.themePreference);
|
|
502
|
+
const setThemePreference = useDocsUserSettingsStore((state) => state.setThemePreference);
|
|
503
|
+
const effectiveThemePreference = resolveThemePreference(themePreference, theme);
|
|
504
|
+
return /* @__PURE__ */ jsxs3(
|
|
505
|
+
"button",
|
|
506
|
+
{
|
|
507
|
+
type: "button",
|
|
508
|
+
"aria-label": "Toggle theme",
|
|
509
|
+
onClick: () => setThemePreference(effectiveThemePreference === "light" ? "dark" : "light"),
|
|
510
|
+
className: "relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border border-base-muted-light bg-base-200",
|
|
511
|
+
children: [
|
|
512
|
+
/* @__PURE__ */ jsx3(Sun, { className: "h-4 w-4 dark:hidden" }),
|
|
513
|
+
/* @__PURE__ */ jsx3(Moon, { className: "hidden h-4 w-4 dark:block" })
|
|
514
|
+
]
|
|
515
|
+
}
|
|
516
|
+
);
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
// src/runtime/client/components/Navbar/MegaMenu/index.tsx
|
|
520
|
+
import { cmMerge as cmMerge3 } from "@classmatejs/react";
|
|
521
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
522
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
523
|
+
var MegaMenu = ({
|
|
524
|
+
isActive,
|
|
525
|
+
onOpen,
|
|
526
|
+
onClose,
|
|
527
|
+
sections,
|
|
528
|
+
activeSectionId,
|
|
529
|
+
hoveredSectionId
|
|
530
|
+
}) => {
|
|
531
|
+
const visibleSectionId = hoveredSectionId ?? activeSectionId ?? sections[0]?.id;
|
|
532
|
+
const [visibleSectionElement, setVisibleSectionElement] = useState2(null);
|
|
533
|
+
const [contentHeight, setContentHeight] = useState2(0);
|
|
534
|
+
useEffect2(() => {
|
|
535
|
+
if (!visibleSectionId || visibleSectionElement === null) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
const updateContentHeight = () => {
|
|
539
|
+
setContentHeight(visibleSectionElement.offsetHeight);
|
|
540
|
+
};
|
|
541
|
+
updateContentHeight();
|
|
542
|
+
if (typeof ResizeObserver === "undefined") {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
546
|
+
updateContentHeight();
|
|
547
|
+
});
|
|
548
|
+
resizeObserver.observe(visibleSectionElement);
|
|
549
|
+
return () => {
|
|
550
|
+
resizeObserver.disconnect();
|
|
551
|
+
};
|
|
552
|
+
}, [visibleSectionElement, visibleSectionId]);
|
|
553
|
+
return (
|
|
554
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: ok
|
|
555
|
+
/* @__PURE__ */ jsxs4(
|
|
556
|
+
"div",
|
|
557
|
+
{
|
|
558
|
+
className: cmMerge3(
|
|
559
|
+
"fixed top-13 left-0 z-3 w-full pt-3",
|
|
560
|
+
isActive ? "pointer-events-auto" : "pointer-events-none"
|
|
561
|
+
),
|
|
562
|
+
onPointerEnter: () => onOpen(visibleSectionId),
|
|
563
|
+
onPointerLeave: onClose,
|
|
564
|
+
children: [
|
|
565
|
+
/* @__PURE__ */ jsx4(
|
|
566
|
+
"div",
|
|
567
|
+
{
|
|
568
|
+
className: cmMerge3(
|
|
569
|
+
isActive ? "opacity-100" : "opacity-0",
|
|
570
|
+
"pointer-events-none absolute top-0 left-0 h-svh w-full bg-linear-to-t from-base-100/60 to-base-100 transition-opacity duration-200 backdrop-blur-md"
|
|
571
|
+
)
|
|
572
|
+
}
|
|
573
|
+
),
|
|
574
|
+
/* @__PURE__ */ jsx4(
|
|
575
|
+
"div",
|
|
576
|
+
{
|
|
577
|
+
className: cmMerge3(
|
|
578
|
+
"relative z-4 overflow-hidden bg-base-100 transition-[height] duration-300 ease-out border-b border-base-muted-light"
|
|
579
|
+
),
|
|
580
|
+
style: { height: isActive ? contentHeight : 0 },
|
|
581
|
+
children: /* @__PURE__ */ jsx4(LayoutComponent, { $size: "sm", children: /* @__PURE__ */ jsx4(
|
|
582
|
+
"div",
|
|
583
|
+
{
|
|
584
|
+
className: cmMerge3(
|
|
585
|
+
isActive ? "translate-y-0 opacity-100" : "-translate-y-10 opacity-0",
|
|
586
|
+
"relative z-4 transition-all duration-300"
|
|
587
|
+
),
|
|
588
|
+
children: sections.map((section) => /* @__PURE__ */ jsx4(
|
|
589
|
+
"div",
|
|
590
|
+
{
|
|
591
|
+
ref: section.id === visibleSectionId ? setVisibleSectionElement : void 0,
|
|
592
|
+
className: cmMerge3(
|
|
593
|
+
section.id === visibleSectionId ? "opacity-100" : "opacity-0 pointer-events-none",
|
|
594
|
+
"transition-all absolute w-full duration-300"
|
|
595
|
+
),
|
|
596
|
+
children: section.items.length > 0 && /* @__PURE__ */ jsx4("ul", { className: "mt-2 flex ", children: section.items.map(
|
|
597
|
+
(child) => child.showInNav !== false && /* @__PURE__ */ jsxs4("li", { className: "flex-1 py-3 mb-6 px-4", children: [
|
|
598
|
+
child.href ? /* @__PURE__ */ jsx4(
|
|
599
|
+
"a",
|
|
600
|
+
{
|
|
601
|
+
className: "mb-4 block text-lg font-semibold tracking-tight",
|
|
602
|
+
href: withSiteBaseUrl(child.href),
|
|
603
|
+
children: child.title
|
|
604
|
+
}
|
|
605
|
+
) : /* @__PURE__ */ jsx4("span", { className: "mb-4 block text-lg font-semibold tracking-tight", children: child.title }),
|
|
606
|
+
child.kind === "group" && child.items.length > 0 && /* @__PURE__ */ jsx4("ul", { className: "menu border-l border-base-muted-light py-0 w-full", children: child.items.map((subChild) => /* @__PURE__ */ jsx4("li", { children: subChild.href ? /* @__PURE__ */ jsx4("a", { href: withSiteBaseUrl(subChild.href), onClick: onClose, children: renderInlineMarkdown(subChild.title) }) : /* @__PURE__ */ jsx4("span", { children: renderInlineMarkdown(subChild.title) }) }, subChild.id)) })
|
|
607
|
+
] }, child.id)
|
|
608
|
+
) })
|
|
609
|
+
},
|
|
610
|
+
section.id
|
|
611
|
+
))
|
|
612
|
+
}
|
|
613
|
+
) })
|
|
614
|
+
}
|
|
615
|
+
)
|
|
616
|
+
]
|
|
617
|
+
}
|
|
618
|
+
)
|
|
619
|
+
);
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
// src/runtime/client/components/Navbar/useNavbarScroll.ts
|
|
623
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
624
|
+
var useNavbarScroll = (isLandingPage) => {
|
|
625
|
+
const [isLandingPageScrolled, setIsLandingPageScrolled] = useState3(false);
|
|
626
|
+
useEffect3(() => {
|
|
627
|
+
if (!isLandingPage) {
|
|
628
|
+
setIsLandingPageScrolled(false);
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
const handleScroll = () => {
|
|
632
|
+
setIsLandingPageScrolled(window.scrollY > 20);
|
|
633
|
+
};
|
|
634
|
+
handleScroll();
|
|
635
|
+
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
636
|
+
return () => {
|
|
637
|
+
window.removeEventListener("scroll", handleScroll);
|
|
638
|
+
};
|
|
639
|
+
}, [isLandingPage]);
|
|
640
|
+
return {
|
|
641
|
+
isLandingPageScrolled
|
|
642
|
+
};
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
// src/runtime/client/components/Navbar/index.tsx
|
|
646
|
+
import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
647
|
+
var Navbar = ({ brand, algolia, navbarItems, theme, sections }) => {
|
|
648
|
+
const { urlPathname } = usePageContext2();
|
|
649
|
+
const isLandingPage = urlPathname === "/";
|
|
650
|
+
const { isLandingPageScrolled } = useNavbarScroll(isLandingPage);
|
|
651
|
+
const [isMegaMenuOpen, setIsMegaMenuOpen] = useState4(false);
|
|
652
|
+
const megaMenuCloseTimeoutRef = useRef2(null);
|
|
653
|
+
const pageContext = usePageContext2();
|
|
654
|
+
const docs = getDocsGlobalContext(pageContext);
|
|
655
|
+
const activeSection = getActiveSectionByPathname(docs, pageContext.urlPathname);
|
|
656
|
+
const [hoveredSectionId, setHoveredSectionId] = useState4(activeSection?.id ?? sections[0]?.id);
|
|
657
|
+
const showChrome = useMemo(
|
|
658
|
+
() => !isLandingPage || isLandingPageScrolled || !isMegaMenuOpen,
|
|
659
|
+
[isLandingPage, isLandingPageScrolled, isMegaMenuOpen]
|
|
660
|
+
);
|
|
661
|
+
const clearMegaMenuCloseTimeout = useCallback(() => {
|
|
662
|
+
if (megaMenuCloseTimeoutRef.current === null) {
|
|
663
|
+
return;
|
|
664
|
+
}
|
|
665
|
+
window.clearTimeout(megaMenuCloseTimeoutRef.current);
|
|
666
|
+
megaMenuCloseTimeoutRef.current = null;
|
|
667
|
+
}, []);
|
|
668
|
+
const openMegaMenu = (currentSectionId) => {
|
|
669
|
+
if (currentSectionId !== void 0) {
|
|
670
|
+
setHoveredSectionId(currentSectionId);
|
|
671
|
+
}
|
|
672
|
+
clearMegaMenuCloseTimeout();
|
|
673
|
+
setIsMegaMenuOpen(true);
|
|
674
|
+
};
|
|
675
|
+
const closeMegaMenu = () => {
|
|
676
|
+
clearMegaMenuCloseTimeout();
|
|
677
|
+
setIsMegaMenuOpen(false);
|
|
678
|
+
};
|
|
679
|
+
const scheduleMegaMenuClose = () => {
|
|
680
|
+
clearMegaMenuCloseTimeout();
|
|
681
|
+
megaMenuCloseTimeoutRef.current = window.setTimeout(() => {
|
|
682
|
+
setIsMegaMenuOpen(false);
|
|
683
|
+
megaMenuCloseTimeoutRef.current = null;
|
|
684
|
+
}, 120);
|
|
685
|
+
};
|
|
686
|
+
useEffect4(() => {
|
|
687
|
+
return () => {
|
|
688
|
+
clearMegaMenuCloseTimeout();
|
|
689
|
+
};
|
|
690
|
+
}, [clearMegaMenuCloseTimeout]);
|
|
691
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
692
|
+
/* @__PURE__ */ jsx5(StyledNavbar, { $border: showChrome, children: /* @__PURE__ */ jsx5(LayoutComponent, { className: "h-full", children: isLandingPage ? /* @__PURE__ */ jsxs5("div", { className: "relative z-3 flex h-full items-center justify-between py-4", children: [
|
|
693
|
+
/* @__PURE__ */ jsx5("div", { className: "flex flex-1 items-center gap-4", children: /* @__PURE__ */ jsx5(Brand, { brand }) }),
|
|
694
|
+
/* @__PURE__ */ jsx5(
|
|
695
|
+
"nav",
|
|
696
|
+
{
|
|
697
|
+
"aria-label": "Primary",
|
|
698
|
+
className: "top-0 left-0 flex min-w-0 flex-1 items-center justify-center gap-4 overflow-x-auto",
|
|
699
|
+
children: /* @__PURE__ */ jsx5("ul", { className: "flex items-center font-semibold", children: navbarItems.map((item) => /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsx5(
|
|
700
|
+
"a",
|
|
701
|
+
{
|
|
702
|
+
href: withSiteBaseUrl(item.href),
|
|
703
|
+
className: "h-full block py-3.25",
|
|
704
|
+
onPointerEnter: () => openMegaMenu(item.id),
|
|
705
|
+
onPointerLeave: scheduleMegaMenuClose,
|
|
706
|
+
onFocus: () => openMegaMenu(item.id),
|
|
707
|
+
onBlur: scheduleMegaMenuClose,
|
|
708
|
+
onClick: closeMegaMenu,
|
|
709
|
+
children: /* @__PURE__ */ jsxs5(
|
|
710
|
+
"span",
|
|
711
|
+
{
|
|
712
|
+
className: cmMerge4("btn text-lg btn-ghost min-w-30 px-2 whitespace-nowrap tracking-tight"),
|
|
713
|
+
children: [
|
|
714
|
+
renderInlineMarkdown(item.title),
|
|
715
|
+
/* @__PURE__ */ jsx5(ChevronDown, { className: "h-4 w-4 shrink-0" })
|
|
716
|
+
]
|
|
717
|
+
}
|
|
718
|
+
)
|
|
719
|
+
}
|
|
720
|
+
) }, item.id)) })
|
|
721
|
+
}
|
|
722
|
+
),
|
|
723
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-1 items-center justify-end gap-2", children: [
|
|
724
|
+
/* @__PURE__ */ jsx5(Search, { algolia }),
|
|
725
|
+
/* @__PURE__ */ jsx5(ThemeSwitch, { theme })
|
|
726
|
+
] })
|
|
727
|
+
] }) : /* @__PURE__ */ jsxs5("div", { className: "relative z-3 flex h-full items-center justify-between py-4", children: [
|
|
728
|
+
/* @__PURE__ */ jsx5("div", { className: "flex w-80 flex-1 items-center justify-between gap-2 lg:flex-none", children: /* @__PURE__ */ jsx5(Brand, { brand }) }),
|
|
729
|
+
/* @__PURE__ */ jsxs5(
|
|
730
|
+
"nav",
|
|
731
|
+
{
|
|
732
|
+
"aria-label": "Primary",
|
|
733
|
+
className: "top-0 left-0 flex flex-1 items-center justify-start gap-4 overflow-x-auto lg:pl-6 xl:pl-10",
|
|
734
|
+
children: [
|
|
735
|
+
/* @__PURE__ */ jsx5("ul", { className: "flex items-center gap-2 font-semibold", children: navbarItems.map((item) => /* @__PURE__ */ jsx5("li", { children: /* @__PURE__ */ jsx5(
|
|
736
|
+
"a",
|
|
737
|
+
{
|
|
738
|
+
href: withSiteBaseUrl(item.href),
|
|
739
|
+
onPointerEnter: () => openMegaMenu(item.id),
|
|
740
|
+
onPointerLeave: scheduleMegaMenuClose,
|
|
741
|
+
onFocus: () => openMegaMenu(item.id),
|
|
742
|
+
onBlur: scheduleMegaMenuClose,
|
|
743
|
+
onClick: closeMegaMenu,
|
|
744
|
+
className: cmMerge4(
|
|
745
|
+
"btn btn-sm px-2 whitespace-nowrap text-base tracking-tight",
|
|
746
|
+
item.id === activeSection?.id ? "btn-primary btn-soft" : "btn-ghost"
|
|
747
|
+
),
|
|
748
|
+
children: renderInlineMarkdown(item.title)
|
|
749
|
+
}
|
|
750
|
+
) }, item.id)) }),
|
|
751
|
+
/* @__PURE__ */ jsx5(Search, { algolia })
|
|
752
|
+
]
|
|
753
|
+
}
|
|
754
|
+
),
|
|
755
|
+
/* @__PURE__ */ jsx5("div", { className: "flex w-78 flex-1 items-center justify-end gap-2 lg:flex-none", children: /* @__PURE__ */ jsx5(ThemeSwitch, { theme }) })
|
|
756
|
+
] }) }) }),
|
|
757
|
+
/* @__PURE__ */ jsx5(
|
|
758
|
+
MegaMenu,
|
|
759
|
+
{
|
|
760
|
+
sections,
|
|
761
|
+
activeSectionId: activeSection?.id,
|
|
762
|
+
hoveredSectionId,
|
|
763
|
+
isActive: isMegaMenuOpen,
|
|
764
|
+
onOpen: openMegaMenu,
|
|
765
|
+
onClose: scheduleMegaMenuClose
|
|
766
|
+
}
|
|
767
|
+
)
|
|
768
|
+
] });
|
|
769
|
+
};
|
|
770
|
+
var StyledNavbar = cm2.header`
|
|
771
|
+
fixed top-0 left-0 z-20 h-16 w-full bg-base-100
|
|
772
|
+
`;
|
|
773
|
+
|
|
774
|
+
// src/runtime/client/components/UserSettingsSync.tsx
|
|
775
|
+
import { useEffect as useEffect5 } from "react";
|
|
776
|
+
var UserSettingsSync = ({ theme }) => {
|
|
777
|
+
const themePreference = useDocsUserSettingsStore((state) => state.themePreference);
|
|
778
|
+
const lightTheme = theme?.light ?? "consumer-light";
|
|
779
|
+
const darkTheme = theme?.dark ?? "consumer-dark";
|
|
780
|
+
const defaultThemePreference = theme?.defaultPreference ?? "light";
|
|
781
|
+
const resolvedTheme = { light: lightTheme, dark: darkTheme, defaultPreference: defaultThemePreference };
|
|
782
|
+
const effectiveThemePreference = resolveThemePreference(themePreference, resolvedTheme);
|
|
783
|
+
useEffect5(() => {
|
|
784
|
+
applyThemePreference(effectiveThemePreference, resolvedTheme);
|
|
785
|
+
}, [darkTheme, defaultThemePreference, effectiveThemePreference, lightTheme]);
|
|
786
|
+
return null;
|
|
787
|
+
};
|
|
788
|
+
|
|
789
|
+
// src/runtime/client/AppLayout.tsx
|
|
790
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
791
|
+
var AppLayout = ({ children }) => {
|
|
792
|
+
const pageContext = usePageContext3();
|
|
793
|
+
const docs = getDocsGlobalContext(pageContext);
|
|
794
|
+
const [queryClient] = useState5(() => new QueryClient());
|
|
795
|
+
return (
|
|
796
|
+
// todo: we should try vike-react-query instead
|
|
797
|
+
/* @__PURE__ */ jsxs6(QueryClientProvider, { client: queryClient, children: [
|
|
798
|
+
/* @__PURE__ */ jsx6(UserSettingsSync, { theme: docs.theme }),
|
|
799
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-h-screen bg-base-100 text-base-content", children: [
|
|
800
|
+
/* @__PURE__ */ jsx6(
|
|
801
|
+
Navbar,
|
|
802
|
+
{
|
|
803
|
+
brand: docs.brand,
|
|
804
|
+
algolia: docs.algolia,
|
|
805
|
+
navbarItems: docs.navbarItems,
|
|
806
|
+
sections: docs.sidebarSections,
|
|
807
|
+
theme: docs.theme
|
|
808
|
+
}
|
|
809
|
+
),
|
|
810
|
+
/* @__PURE__ */ jsx6("div", { className: "pt-16", children })
|
|
811
|
+
] })
|
|
812
|
+
] })
|
|
813
|
+
);
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
// src/runtime/client/components/MetaHead/FaviconLinks.tsx
|
|
817
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
818
|
+
var FaviconLinks = ({ head }) => {
|
|
819
|
+
const { appleTouchIcon, faviconIco, faviconSvg } = head;
|
|
820
|
+
return /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
821
|
+
appleTouchIcon && /* @__PURE__ */ jsx7("link", { rel: "apple-touch-icon", href: appleTouchIcon }),
|
|
822
|
+
faviconSvg && /* @__PURE__ */ jsx7("link", { rel: "icon", type: "image/svg+xml", href: faviconSvg }),
|
|
823
|
+
faviconIco && /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
824
|
+
/* @__PURE__ */ jsx7("link", { rel: "shortcut icon", type: "image/x-icon", href: faviconIco }),
|
|
825
|
+
/* @__PURE__ */ jsx7("link", { rel: "icon", type: "image/x-icon", href: faviconIco })
|
|
826
|
+
] })
|
|
827
|
+
] });
|
|
828
|
+
};
|
|
829
|
+
|
|
830
|
+
// src/runtime/client/components/MetaHead/FontLinks.tsx
|
|
831
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
832
|
+
var FontLinks = ({ head }) => {
|
|
833
|
+
const { fontStylesheetHref, fontPreloadHrefs } = head;
|
|
834
|
+
const effectivePreloadHrefs = fontPreloadHrefs ?? [];
|
|
835
|
+
return /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
836
|
+
effectivePreloadHrefs.map((href) => /* @__PURE__ */ jsx8("link", { rel: "preload", href, as: "font", type: "font/woff2", crossOrigin: "anonymous" }, href)),
|
|
837
|
+
fontStylesheetHref && /* @__PURE__ */ jsx8("link", { rel: "stylesheet", href: fontStylesheetHref })
|
|
838
|
+
] });
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
// src/runtime/client/components/MetaHead/ThemeBootstrap.tsx
|
|
842
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
843
|
+
var getThemeBootstrapScript = (theme) => {
|
|
844
|
+
return `(() => {
|
|
845
|
+
const storageKey = ${JSON.stringify(USER_SETTINGS_STORAGE_KEY)};
|
|
846
|
+
const darkThemeMediaQuery = ${JSON.stringify(DARK_THEME_MEDIA_QUERY)};
|
|
847
|
+
const defaultThemePreference = ${JSON.stringify(theme.defaultPreference)};
|
|
848
|
+
const themes = {
|
|
849
|
+
light: ${JSON.stringify(theme.light)},
|
|
850
|
+
dark: ${JSON.stringify(theme.dark)}
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
try {
|
|
854
|
+
const persistedValue = window.localStorage.getItem(storageKey);
|
|
855
|
+
const parsedValue = persistedValue ? JSON.parse(persistedValue) : null;
|
|
856
|
+
const storedThemePreference = parsedValue?.state?.themePreference;
|
|
857
|
+
const themePreference =
|
|
858
|
+
storedThemePreference === 'light' || storedThemePreference === 'dark'
|
|
859
|
+
? storedThemePreference
|
|
860
|
+
: typeof window.matchMedia === 'function'
|
|
861
|
+
? window.matchMedia(darkThemeMediaQuery).matches
|
|
862
|
+
? 'dark'
|
|
863
|
+
: 'light'
|
|
864
|
+
: defaultThemePreference;
|
|
865
|
+
|
|
866
|
+
document.documentElement.setAttribute('data-theme', themes[themePreference]);
|
|
867
|
+
} catch {
|
|
868
|
+
const themePreference =
|
|
869
|
+
typeof window.matchMedia === 'function'
|
|
870
|
+
? window.matchMedia(darkThemeMediaQuery).matches
|
|
871
|
+
? 'dark'
|
|
872
|
+
: 'light'
|
|
873
|
+
: defaultThemePreference;
|
|
874
|
+
|
|
875
|
+
document.documentElement.setAttribute('data-theme', themes[themePreference]);
|
|
876
|
+
}
|
|
877
|
+
})();`;
|
|
878
|
+
};
|
|
879
|
+
var ThemeBootstrap = ({ theme }) => {
|
|
880
|
+
return /* @__PURE__ */ jsx9(
|
|
881
|
+
"script",
|
|
882
|
+
{
|
|
883
|
+
dangerouslySetInnerHTML: {
|
|
884
|
+
__html: getThemeBootstrapScript(theme)
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
);
|
|
888
|
+
};
|
|
889
|
+
|
|
890
|
+
// src/runtime/client/components/MetaHead/index.tsx
|
|
891
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
892
|
+
var MetaHead = () => {
|
|
893
|
+
const docs = useDocsGlobalContext();
|
|
894
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
895
|
+
/* @__PURE__ */ jsx10(ThemeBootstrap, { theme: docs.theme }),
|
|
896
|
+
/* @__PURE__ */ jsx10(FaviconLinks, { head: docs.head }),
|
|
897
|
+
/* @__PURE__ */ jsx10(FontLinks, { head: docs.head })
|
|
898
|
+
] });
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
// src/runtime/client/components/ProseContainer.tsx
|
|
902
|
+
import cm3 from "@classmatejs/react";
|
|
903
|
+
var ProseContainer = cm3.section`
|
|
904
|
+
prose
|
|
905
|
+
prose-neutral
|
|
906
|
+
max-w-none
|
|
907
|
+
dark:prose-invert
|
|
908
|
+
prose-a:text-primary
|
|
909
|
+
|
|
910
|
+
prose-pre:bg-base-200!
|
|
911
|
+
|
|
912
|
+
prose-code:rounded!
|
|
913
|
+
prose-code:dark:inset-shadow-2xs
|
|
914
|
+
|
|
915
|
+
prose-code:bg-primary/5!
|
|
916
|
+
prose-code:border-primary/15!
|
|
917
|
+
|
|
918
|
+
prose-code:dark:bg-primary/10!
|
|
919
|
+
prose-code:dark:border-primary/20!
|
|
920
|
+
|
|
921
|
+
prose-p:leading-[200%]
|
|
922
|
+
prose-li:leading-[200%]
|
|
923
|
+
prose-table:my-8
|
|
924
|
+
prose-table:w-full
|
|
925
|
+
prose-table:text-sm
|
|
926
|
+
prose-th:align-top
|
|
927
|
+
prose-th:font-semibold
|
|
928
|
+
prose-td:align-top
|
|
929
|
+
|
|
930
|
+
prose-table:bg-base-200
|
|
931
|
+
prose-table:rounded-box
|
|
932
|
+
prose-thead:rounded-t-box
|
|
933
|
+
prose-table:shadow
|
|
934
|
+
prose-thead:overflow-hidden
|
|
935
|
+
prose-thead:border-base-muted-light
|
|
936
|
+
prose-tr:border-base-muted-light
|
|
937
|
+
|
|
938
|
+
[&_table_code]:whitespace-nowrap
|
|
939
|
+
|
|
940
|
+
prose-td:p-3
|
|
941
|
+
prose-th:p-3
|
|
942
|
+
|
|
943
|
+
prose-p:after:content-none
|
|
944
|
+
prose-p:before:content-none
|
|
945
|
+
prose-blockquote:not-italic
|
|
946
|
+
prose-blockquote:bg-base-200
|
|
947
|
+
prose-blockquote:py-2
|
|
948
|
+
prose-li:my-1
|
|
949
|
+
prose-figure:mb-0
|
|
950
|
+
[&_figure_*]:mb-0
|
|
951
|
+
[&_blockquote_p]:mt-0
|
|
952
|
+
[&_blockquote_p]:mb-2
|
|
953
|
+
[&_blockquote_ul]:mb-0
|
|
954
|
+
|
|
955
|
+
[&_blockquote_ul]:pl-4
|
|
956
|
+
[&_blockquote_ul]:mt-2
|
|
957
|
+
[&_blockquote_li]:mt-2
|
|
958
|
+
[&_blockquote_blockquote]:mt-2
|
|
959
|
+
[&_blockquote_blockquote]:mb-0
|
|
960
|
+
[&_blockquote_blockquote]:bg-base-300/40
|
|
961
|
+
[&_blockquote_blockquote]:pt-2
|
|
962
|
+
[&_blockquote_blockquote]:pb-1
|
|
963
|
+
`;
|
|
964
|
+
|
|
965
|
+
// src/runtime/client/DocsPage.tsx
|
|
966
|
+
import { useData as useData2 } from "vike-react/useData";
|
|
967
|
+
import { usePageContext as usePageContext4 } from "vike-react/usePageContext";
|
|
968
|
+
|
|
969
|
+
// src/runtime/client/components/DocsPagination.tsx
|
|
970
|
+
import { cmMerge as cmMerge5 } from "@classmatejs/react";
|
|
971
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
972
|
+
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
973
|
+
var PaginationCard = ({ item, direction, isOffset }) => {
|
|
974
|
+
const isPrevious = direction === "previous";
|
|
975
|
+
return /* @__PURE__ */ jsx11(
|
|
976
|
+
"a",
|
|
977
|
+
{
|
|
978
|
+
href: withSiteBaseUrl(item.href),
|
|
979
|
+
className: cmMerge5(
|
|
980
|
+
"group rounded-box border border-base-muted-light bg-base-100 p-5 no-underline hover:border-primary-muted-medium hover:bg-base-200",
|
|
981
|
+
isPrevious ? "text-left" : "text-right",
|
|
982
|
+
isOffset && "sm:col-start-2"
|
|
983
|
+
),
|
|
984
|
+
"aria-label": `${isPrevious ? "Previous" : "Next"}: ${item.title}`,
|
|
985
|
+
children: /* @__PURE__ */ jsxs10("div", { className: "flex flex-col justify-between gap-2", children: [
|
|
986
|
+
/* @__PURE__ */ jsx11("p", { className: "text-lg font-semibold text-base-content", children: renderInlineMarkdown(item.title) }),
|
|
987
|
+
/* @__PURE__ */ jsxs10(
|
|
988
|
+
"div",
|
|
989
|
+
{
|
|
990
|
+
className: cmMerge5(
|
|
991
|
+
"flex items-center gap-1 text-base-muted group-hover:text-base-content",
|
|
992
|
+
isPrevious ? "justify-start" : "justify-end"
|
|
993
|
+
),
|
|
994
|
+
children: [
|
|
995
|
+
isPrevious && /* @__PURE__ */ jsx11(ChevronLeft, { className: "h-4 w-4" }),
|
|
996
|
+
/* @__PURE__ */ jsx11("span", { children: isPrevious ? "Previous" : "Next" }),
|
|
997
|
+
!isPrevious && /* @__PURE__ */ jsx11(ChevronRight, { className: "h-4 w-4" })
|
|
998
|
+
]
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
] })
|
|
1002
|
+
}
|
|
1003
|
+
);
|
|
1004
|
+
};
|
|
1005
|
+
var DocsPagination = ({ previousPage, nextPage }) => {
|
|
1006
|
+
if (!previousPage && !nextPage) {
|
|
1007
|
+
return null;
|
|
1008
|
+
}
|
|
1009
|
+
return /* @__PURE__ */ jsx11("nav", { className: "mb-10 mt-16", "aria-label": "Previous Next", children: /* @__PURE__ */ jsxs10("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
1010
|
+
previousPage && /* @__PURE__ */ jsx11(PaginationCard, { item: previousPage, direction: "previous" }),
|
|
1011
|
+
nextPage && /* @__PURE__ */ jsx11(PaginationCard, { isOffset: !previousPage, item: nextPage, direction: "next" })
|
|
1012
|
+
] }) });
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
// src/runtime/client/components/Footer.tsx
|
|
1016
|
+
import { Bug, Pencil } from "lucide-react";
|
|
1017
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1018
|
+
var DocsFooter = ({ brand }) => {
|
|
1019
|
+
return /* @__PURE__ */ jsxs11("footer", { className: "mb-8 mt-12 text-sm border-t border-base-muted-light pt-10", children: [
|
|
1020
|
+
/* @__PURE__ */ jsxs11("div", { className: "mb-16 flex items-center gap-2", children: [
|
|
1021
|
+
/* @__PURE__ */ jsxs11("a", { href: "edit", className: "btn btn-sm btn-primary btn-soft", children: [
|
|
1022
|
+
/* @__PURE__ */ jsx12(Pencil, { className: "w-3 h-3" }),
|
|
1023
|
+
" Edit this page"
|
|
1024
|
+
] }),
|
|
1025
|
+
/* @__PURE__ */ jsxs11("a", { href: "edit", className: "btn btn-sm btn-primary btn-soft", children: [
|
|
1026
|
+
/* @__PURE__ */ jsx12(Bug, { className: "w-3 h-3" }),
|
|
1027
|
+
" Report Issue"
|
|
1028
|
+
] })
|
|
1029
|
+
] }),
|
|
1030
|
+
/* @__PURE__ */ jsx12("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsx12("div", { className: "flex gap-2 items-center", children: brand && /* @__PURE__ */ jsx12(Brand, { brand, noText: true }) }) })
|
|
1031
|
+
] });
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
// src/runtime/client/components/Sidebar.tsx
|
|
1035
|
+
import { cmMerge as cmMerge6 } from "@classmatejs/react";
|
|
1036
|
+
import { useEffect as useEffect6 } from "react";
|
|
1037
|
+
import { create as create2 } from "zustand";
|
|
1038
|
+
|
|
1039
|
+
// src/runtime/client/components/docsNavigation.ts
|
|
1040
|
+
var containsActiveHref = (items, currentHref) => {
|
|
1041
|
+
return items.some((item) => {
|
|
1042
|
+
if (item.kind === "page") {
|
|
1043
|
+
return item.href === currentHref;
|
|
1044
|
+
}
|
|
1045
|
+
return item.href === currentHref || containsActiveHref(item.items, currentHref);
|
|
1046
|
+
});
|
|
1047
|
+
};
|
|
1048
|
+
var hasActiveItem = (items, activeHref) => containsActiveHref(items, activeHref);
|
|
1049
|
+
var getVisibleNavItems = (items) => items.filter((item) => item.showInNav);
|
|
1050
|
+
var getVisibleGroupItems = (group) => {
|
|
1051
|
+
const visibleItems = getVisibleNavItems(group.items);
|
|
1052
|
+
if (!group.href) {
|
|
1053
|
+
return visibleItems;
|
|
1054
|
+
}
|
|
1055
|
+
return visibleItems.filter((item) => {
|
|
1056
|
+
if (item.kind !== "page") {
|
|
1057
|
+
return true;
|
|
1058
|
+
}
|
|
1059
|
+
return item.href !== group.href;
|
|
1060
|
+
});
|
|
1061
|
+
};
|
|
1062
|
+
var getGroupHref = (group) => group.href ?? null;
|
|
1063
|
+
|
|
1064
|
+
// src/runtime/client/components/Sidebar.tsx
|
|
1065
|
+
import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1066
|
+
var useSidebarDisclosureStore = create2()((set) => ({
|
|
1067
|
+
openNodes: {},
|
|
1068
|
+
setNodeOpen: (nodeId, isOpen) => set((state) => {
|
|
1069
|
+
if (state.openNodes[nodeId] === isOpen) {
|
|
1070
|
+
return state;
|
|
1071
|
+
}
|
|
1072
|
+
return {
|
|
1073
|
+
openNodes: {
|
|
1074
|
+
...state.openNodes,
|
|
1075
|
+
[nodeId]: isOpen
|
|
1076
|
+
}
|
|
1077
|
+
};
|
|
1078
|
+
})
|
|
1079
|
+
}));
|
|
1080
|
+
var useAutoOpenDetails = (nodeId, isOpenByDefault, hasActiveDescendant) => {
|
|
1081
|
+
const storedOpen = useSidebarDisclosureStore((state) => state.openNodes[nodeId]);
|
|
1082
|
+
const setNodeOpen = useSidebarDisclosureStore((state) => state.setNodeOpen);
|
|
1083
|
+
const isOpen = storedOpen === void 0 ? isOpenByDefault || hasActiveDescendant : storedOpen || hasActiveDescendant;
|
|
1084
|
+
useEffect6(() => {
|
|
1085
|
+
if (hasActiveDescendant) {
|
|
1086
|
+
setNodeOpen(nodeId, true);
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
if (storedOpen === void 0 && isOpenByDefault) {
|
|
1090
|
+
setNodeOpen(nodeId, true);
|
|
1091
|
+
}
|
|
1092
|
+
}, [hasActiveDescendant, isOpenByDefault, nodeId, setNodeOpen, storedOpen]);
|
|
1093
|
+
return {
|
|
1094
|
+
isOpen,
|
|
1095
|
+
setIsOpen: (nextOpen) => setNodeOpen(nodeId, nextOpen)
|
|
1096
|
+
};
|
|
1097
|
+
};
|
|
1098
|
+
var SidebarPageLink = ({ title, href, currentHref }) => {
|
|
1099
|
+
return /* @__PURE__ */ jsx13("li", { children: /* @__PURE__ */ jsx13(
|
|
1100
|
+
"a",
|
|
1101
|
+
{
|
|
1102
|
+
href: withSiteBaseUrl(href),
|
|
1103
|
+
className: cmMerge6(
|
|
1104
|
+
"text-base-muted hover:text-base-content justify-start hover:bg-base-200",
|
|
1105
|
+
href === currentHref && "text-primary! font-semibold bg-base-200"
|
|
1106
|
+
),
|
|
1107
|
+
children: renderInlineMarkdown(title, { codeClassName: "text-sm!" })
|
|
1108
|
+
}
|
|
1109
|
+
) });
|
|
1110
|
+
};
|
|
1111
|
+
var SidebarGroupDivider = ({ title }) => {
|
|
1112
|
+
return /* @__PURE__ */ jsx13("li", { className: "ml-3 mt-2 mb-2 border-b border-base-muted-light text-xs text-base-muted-medium pointer-events-none font-semibold", children: /* @__PURE__ */ jsx13("span", { className: "-ml-3", children: renderInlineMarkdown(title, { codeClassName: "text-sm!" }) }) });
|
|
1113
|
+
};
|
|
1114
|
+
var SidebarGroupTitle = ({ title, href, isActive, allowNavigation = false }) => {
|
|
1115
|
+
const content = /* @__PURE__ */ jsx13(
|
|
1116
|
+
"span",
|
|
1117
|
+
{
|
|
1118
|
+
className: cmMerge6(
|
|
1119
|
+
allowNavigation ? "font-medium" : "font-semibold",
|
|
1120
|
+
isActive && allowNavigation && "text-primary!"
|
|
1121
|
+
),
|
|
1122
|
+
children: title ? renderInlineMarkdown(title, { codeClassName: "text-sm!" }) : null
|
|
1123
|
+
}
|
|
1124
|
+
);
|
|
1125
|
+
if (allowNavigation && href) {
|
|
1126
|
+
return /* @__PURE__ */ jsx13(
|
|
1127
|
+
"a",
|
|
1128
|
+
{
|
|
1129
|
+
href: withSiteBaseUrl(href),
|
|
1130
|
+
className: cmMerge6(
|
|
1131
|
+
"flex items-center gap-2 text-base-muted hover:text-base-content no-underline",
|
|
1132
|
+
isActive && "text-primary! font-semibold"
|
|
1133
|
+
),
|
|
1134
|
+
children: content
|
|
1135
|
+
}
|
|
1136
|
+
);
|
|
1137
|
+
}
|
|
1138
|
+
return /* @__PURE__ */ jsx13("span", { className: "flex items-center gap-2 text-base-content", children: content });
|
|
1139
|
+
};
|
|
1140
|
+
var renderSidebarItems = (items, currentHref) => {
|
|
1141
|
+
return items.map((item) => {
|
|
1142
|
+
if (item.kind === "page") {
|
|
1143
|
+
return /* @__PURE__ */ jsx13(SidebarPageLink, { title: item.navTitle, href: item.href, currentHref }, item.id);
|
|
1144
|
+
}
|
|
1145
|
+
return /* @__PURE__ */ jsx13(SidebarNestedGroup, { group: item, currentHref }, item.id);
|
|
1146
|
+
});
|
|
1147
|
+
};
|
|
1148
|
+
var SidebarItemList = ({ items, currentHref }) => {
|
|
1149
|
+
const visibleItems = getVisibleNavItems(items);
|
|
1150
|
+
return /* @__PURE__ */ jsx13("ul", { className: "menu w-full", children: renderSidebarItems(visibleItems, currentHref) });
|
|
1151
|
+
};
|
|
1152
|
+
var SidebarNestedGroup = ({ group, currentHref }) => {
|
|
1153
|
+
const groupHref = getGroupHref(group);
|
|
1154
|
+
const visibleItems = getVisibleGroupItems(group);
|
|
1155
|
+
const isCollapsible = group.collapsible !== void 0;
|
|
1156
|
+
const isOpenByDefault = group.collapsible?.isDefaultOpen ?? true;
|
|
1157
|
+
const nestedHasActiveItem = groupHref === currentHref || hasActiveItem(group.items, currentHref);
|
|
1158
|
+
const { isOpen, setIsOpen } = useAutoOpenDetails(`group:${group.id}`, isOpenByDefault, nestedHasActiveItem);
|
|
1159
|
+
if (!isCollapsible) {
|
|
1160
|
+
if (!group.title) {
|
|
1161
|
+
return /* @__PURE__ */ jsx13(Fragment5, { children: renderSidebarItems(visibleItems, currentHref) });
|
|
1162
|
+
}
|
|
1163
|
+
return /* @__PURE__ */ jsxs12(Fragment5, { children: [
|
|
1164
|
+
/* @__PURE__ */ jsx13(SidebarGroupDivider, { title: group.title }),
|
|
1165
|
+
renderSidebarItems(visibleItems, currentHref)
|
|
1166
|
+
] });
|
|
1167
|
+
}
|
|
1168
|
+
return /* @__PURE__ */ jsx13("li", { children: /* @__PURE__ */ jsxs12(
|
|
1169
|
+
"details",
|
|
1170
|
+
{
|
|
1171
|
+
open: isOpen,
|
|
1172
|
+
onToggle: (event) => {
|
|
1173
|
+
setIsOpen(event.currentTarget.open);
|
|
1174
|
+
},
|
|
1175
|
+
children: [
|
|
1176
|
+
/* @__PURE__ */ jsx13("summary", { children: /* @__PURE__ */ jsx13(
|
|
1177
|
+
SidebarGroupTitle,
|
|
1178
|
+
{
|
|
1179
|
+
title: group.title,
|
|
1180
|
+
href: groupHref ?? void 0,
|
|
1181
|
+
isActive: nestedHasActiveItem,
|
|
1182
|
+
allowNavigation: Boolean(groupHref)
|
|
1183
|
+
}
|
|
1184
|
+
) }),
|
|
1185
|
+
visibleItems.length > 0 ? /* @__PURE__ */ jsx13(SidebarItemList, { items: visibleItems, currentHref }) : null
|
|
1186
|
+
]
|
|
1187
|
+
}
|
|
1188
|
+
) });
|
|
1189
|
+
};
|
|
1190
|
+
var SidebarSectionGroup = ({ section, currentHref, activeSectionId }) => {
|
|
1191
|
+
const sectionHasActiveItem = section.id === activeSectionId || containsActiveHref(section.items, currentHref);
|
|
1192
|
+
const { isOpen, setIsOpen } = useAutoOpenDetails(
|
|
1193
|
+
`section:${section.id}`,
|
|
1194
|
+
section.id === activeSectionId,
|
|
1195
|
+
sectionHasActiveItem
|
|
1196
|
+
);
|
|
1197
|
+
return /* @__PURE__ */ jsx13("li", { className: "pb-4", children: /* @__PURE__ */ jsxs12(
|
|
1198
|
+
"details",
|
|
1199
|
+
{
|
|
1200
|
+
open: isOpen,
|
|
1201
|
+
onToggle: (event) => {
|
|
1202
|
+
setIsOpen(event.currentTarget.open);
|
|
1203
|
+
},
|
|
1204
|
+
children: [
|
|
1205
|
+
/* @__PURE__ */ jsx13("summary", { children: /* @__PURE__ */ jsx13(SidebarGroupTitle, { title: section.title, isActive: sectionHasActiveItem }) }),
|
|
1206
|
+
/* @__PURE__ */ jsx13(SidebarItemList, { items: section.items, currentHref })
|
|
1207
|
+
]
|
|
1208
|
+
}
|
|
1209
|
+
) });
|
|
1210
|
+
};
|
|
1211
|
+
var Sidebar = ({ sections, activeSectionId, currentHref, horizontal }) => {
|
|
1212
|
+
return /* @__PURE__ */ jsx13("aside", { className: "hidden basis-76 shrink-0 lg:block", children: /* @__PURE__ */ jsxs12("div", { className: "-ml-3 sticky top-16", children: [
|
|
1213
|
+
/* @__PURE__ */ jsx13("div", { className: "absolute h-full w-px right-0 top-0 bg-linear-to-t to-base-muted-light via-base-muted-light pointer-events-none z-1" }),
|
|
1214
|
+
/* @__PURE__ */ jsx13("div", { className: "pr-4 h-[calc(100svh-16*var(--spacing))] overflow-y-scroll overflow-x-hidden relative z-10", children: /* @__PURE__ */ jsx13("ul", { className: cmMerge6("menu w-full px-0 py-5 li:last-child:border-0"), children: sections.map((section) => /* @__PURE__ */ jsx13(
|
|
1215
|
+
SidebarSectionGroup,
|
|
1216
|
+
{
|
|
1217
|
+
section,
|
|
1218
|
+
currentHref,
|
|
1219
|
+
activeSectionId
|
|
1220
|
+
},
|
|
1221
|
+
section.id
|
|
1222
|
+
)) }) })
|
|
1223
|
+
] }) });
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1226
|
+
// src/runtime/client/components/TableOfContents.tsx
|
|
1227
|
+
import cm4, { cmMerge as cmMerge7 } from "@classmatejs/react";
|
|
1228
|
+
import { TableOfContentsIcon } from "lucide-react";
|
|
1229
|
+
import { useEffect as useEffect7, useState as useState6 } from "react";
|
|
1230
|
+
import { useData } from "vike-react/useData";
|
|
1231
|
+
import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1232
|
+
var getCurrentHash = () => {
|
|
1233
|
+
try {
|
|
1234
|
+
return decodeURIComponent(window.location.hash);
|
|
1235
|
+
} catch {
|
|
1236
|
+
return window.location.hash;
|
|
1237
|
+
}
|
|
1238
|
+
};
|
|
1239
|
+
var getHeadingElements = () => {
|
|
1240
|
+
const root = document.querySelector("[data-doc-content]");
|
|
1241
|
+
if (!(root instanceof HTMLElement)) {
|
|
1242
|
+
return [];
|
|
1243
|
+
}
|
|
1244
|
+
return Array.from(root.querySelectorAll("h2, h3, h4")).filter(
|
|
1245
|
+
(element) => element instanceof HTMLHeadingElement
|
|
1246
|
+
);
|
|
1247
|
+
};
|
|
1248
|
+
var areHeadingsEqual = (left, right) => {
|
|
1249
|
+
if (left.length !== right.length) {
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1252
|
+
return left.every((heading, index) => {
|
|
1253
|
+
const other = right[index];
|
|
1254
|
+
return other !== void 0 && heading.depth === other.depth && heading.id === other.id && heading.title === other.title;
|
|
1255
|
+
});
|
|
1256
|
+
};
|
|
1257
|
+
var syncHeadingsFromDom = (setDomHeadings) => {
|
|
1258
|
+
const root = document.querySelector("[data-doc-content]");
|
|
1259
|
+
if (!(root instanceof HTMLElement)) {
|
|
1260
|
+
return;
|
|
1261
|
+
}
|
|
1262
|
+
const slugify = createHeadingSlugger();
|
|
1263
|
+
const nextHeadings = Array.from(root.querySelectorAll("h2, h3, h4")).map((element) => {
|
|
1264
|
+
const title = normalizeHeadingTitle(element.textContent ?? "");
|
|
1265
|
+
if (!title) {
|
|
1266
|
+
return null;
|
|
1267
|
+
}
|
|
1268
|
+
element.classList.add("scroll-mt-24");
|
|
1269
|
+
const id = element.id || slugify(title);
|
|
1270
|
+
if (!element.id) {
|
|
1271
|
+
element.id = id;
|
|
1272
|
+
}
|
|
1273
|
+
return {
|
|
1274
|
+
depth: Number(element.tagName.slice(1)),
|
|
1275
|
+
id,
|
|
1276
|
+
title
|
|
1277
|
+
};
|
|
1278
|
+
}).filter((heading) => heading !== null);
|
|
1279
|
+
setDomHeadings((currentHeadings) => {
|
|
1280
|
+
if (areHeadingsEqual(currentHeadings, nextHeadings)) {
|
|
1281
|
+
return currentHeadings;
|
|
1282
|
+
}
|
|
1283
|
+
return nextHeadings;
|
|
1284
|
+
});
|
|
1285
|
+
};
|
|
1286
|
+
var updateActiveHeadingFromScroll = (setActiveHeadingId) => {
|
|
1287
|
+
const headingElements = getHeadingElements();
|
|
1288
|
+
if (headingElements.length === 0) {
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
const activationOffset = 144;
|
|
1292
|
+
let nextActiveHeadingId = headingElements[0]?.id ?? "";
|
|
1293
|
+
for (const heading of headingElements) {
|
|
1294
|
+
if (!heading.id) {
|
|
1295
|
+
continue;
|
|
1296
|
+
}
|
|
1297
|
+
if (heading.getBoundingClientRect().top <= activationOffset) {
|
|
1298
|
+
nextActiveHeadingId = heading.id;
|
|
1299
|
+
continue;
|
|
1300
|
+
}
|
|
1301
|
+
break;
|
|
1302
|
+
}
|
|
1303
|
+
const lastHeading = headingElements.at(-1);
|
|
1304
|
+
if (lastHeading?.id && window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 8) {
|
|
1305
|
+
nextActiveHeadingId = lastHeading.id;
|
|
1306
|
+
}
|
|
1307
|
+
setActiveHeadingId(nextActiveHeadingId);
|
|
1308
|
+
};
|
|
1309
|
+
var TableOfContents = ({ headings, partners }) => {
|
|
1310
|
+
const [activeHeadingId, setActiveHeadingId] = useState6("");
|
|
1311
|
+
const [domHeadings, setDomHeadings] = useState6(headings);
|
|
1312
|
+
const effectiveHeadings = domHeadings.length > 0 ? domHeadings : headings;
|
|
1313
|
+
const { page } = useData();
|
|
1314
|
+
useEffect7(() => {
|
|
1315
|
+
let scrollFrame = 0;
|
|
1316
|
+
const syncActiveHeading = () => {
|
|
1317
|
+
if (scrollFrame) {
|
|
1318
|
+
return;
|
|
1319
|
+
}
|
|
1320
|
+
scrollFrame = window.requestAnimationFrame(() => {
|
|
1321
|
+
scrollFrame = 0;
|
|
1322
|
+
updateActiveHeadingFromScroll(setActiveHeadingId);
|
|
1323
|
+
});
|
|
1324
|
+
};
|
|
1325
|
+
const updateHash = () => {
|
|
1326
|
+
const currentHash = getCurrentHash().replace(/^#/, "");
|
|
1327
|
+
if (currentHash !== "") {
|
|
1328
|
+
setActiveHeadingId(currentHash);
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
syncActiveHeading();
|
|
1332
|
+
};
|
|
1333
|
+
updateHash();
|
|
1334
|
+
queueMicrotask(() => {
|
|
1335
|
+
syncHeadingsFromDom(setDomHeadings);
|
|
1336
|
+
syncActiveHeading();
|
|
1337
|
+
});
|
|
1338
|
+
window.addEventListener("hashchange", updateHash);
|
|
1339
|
+
window.addEventListener("scroll", syncActiveHeading, { passive: true });
|
|
1340
|
+
window.addEventListener("resize", syncActiveHeading);
|
|
1341
|
+
return () => {
|
|
1342
|
+
if (scrollFrame) {
|
|
1343
|
+
window.cancelAnimationFrame(scrollFrame);
|
|
1344
|
+
}
|
|
1345
|
+
window.removeEventListener("hashchange", updateHash);
|
|
1346
|
+
window.removeEventListener("scroll", syncActiveHeading);
|
|
1347
|
+
window.removeEventListener("resize", syncActiveHeading);
|
|
1348
|
+
};
|
|
1349
|
+
}, []);
|
|
1350
|
+
useEffect7(() => {
|
|
1351
|
+
if (typeof window === "undefined") {
|
|
1352
|
+
return;
|
|
1353
|
+
}
|
|
1354
|
+
setDomHeadings((currentHeadings) => {
|
|
1355
|
+
if (areHeadingsEqual(currentHeadings, headings)) {
|
|
1356
|
+
return currentHeadings;
|
|
1357
|
+
}
|
|
1358
|
+
return headings;
|
|
1359
|
+
});
|
|
1360
|
+
setActiveHeadingId("");
|
|
1361
|
+
queueMicrotask(() => {
|
|
1362
|
+
syncHeadingsFromDom(setDomHeadings);
|
|
1363
|
+
updateActiveHeadingFromScroll(setActiveHeadingId);
|
|
1364
|
+
});
|
|
1365
|
+
}, [headings]);
|
|
1366
|
+
return /* @__PURE__ */ jsx14("aside", { className: cmMerge7(page.tableOfContents ? "w-64" : "w-32", "hidden shrink-0 xl:block"), children: /* @__PURE__ */ jsx14("div", { className: "sticky top-16", children: /* @__PURE__ */ jsxs13("div", { className: "relative h-[calc(100svh-16*var(--spacing))] overflow-y-auto overflow-x-hidden pt-10 pb-8", children: [
|
|
1367
|
+
page.tableOfContents ? effectiveHeadings.length > 0 && /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
1368
|
+
/* @__PURE__ */ jsxs13("p", { className: "mb-4 flex items-center gap-2 text-xs font-semibold uppercase tracking-widest text-base-muted", children: [
|
|
1369
|
+
/* @__PURE__ */ jsx14(TableOfContentsIcon, { className: "h-3 w-3" }),
|
|
1370
|
+
"On this page"
|
|
1371
|
+
] }),
|
|
1372
|
+
/* @__PURE__ */ jsx14("nav", { "aria-label": "On this page", className: "mb-12", children: /* @__PURE__ */ jsx14("ul", { children: effectiveHeadings.map((heading, index) => /* @__PURE__ */ jsx14("li", { children: /* @__PURE__ */ jsx14(
|
|
1373
|
+
"a",
|
|
1374
|
+
{
|
|
1375
|
+
href: `#${heading.id}`,
|
|
1376
|
+
"aria-current": activeHeadingId === heading.id ? "location" : void 0,
|
|
1377
|
+
onClick: () => setActiveHeadingId(heading.id),
|
|
1378
|
+
className: cmMerge7(
|
|
1379
|
+
"cursor-pointer block border-l border-base-muted-light py-1.5 text-sm text-base-muted hover:border-primary-muted hover:text-base-content",
|
|
1380
|
+
heading.depth > 2 ? "pl-6" : "pl-4",
|
|
1381
|
+
activeHeadingId ? activeHeadingId === heading.id ? "border-l-2 border-primary font-semibold text-base-content" : "" : index === 0 ? "border-l-2 border-primary font-semibold text-base-content" : ""
|
|
1382
|
+
),
|
|
1383
|
+
children: heading.title
|
|
1384
|
+
}
|
|
1385
|
+
) }, heading.id)) }) })
|
|
1386
|
+
] }) : null,
|
|
1387
|
+
/* @__PURE__ */ jsx14(Adbar, { partners })
|
|
1388
|
+
] }) }) });
|
|
1389
|
+
};
|
|
1390
|
+
var Adbar = ({ partners }) => {
|
|
1391
|
+
if (partners.primary.length === 0 && partners.gold.length === 0) {
|
|
1392
|
+
return null;
|
|
1393
|
+
}
|
|
1394
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
1395
|
+
/* @__PURE__ */ jsxs13("ul", { className: "grid grid-cols-[repeat(auto-fit,minmax(5.5rem,1fr))] gap-3 opacity-90", children: [
|
|
1396
|
+
partners.primary.map((partner) => /* @__PURE__ */ jsx14(AdbarItem, { className: "col-span-full", children: /* @__PURE__ */ jsx14(AdbarLink, { href: partner.href, title: partner.name, children: /* @__PURE__ */ jsx14(PartnerLogo, { partner }) }) }, partner.name)),
|
|
1397
|
+
partners.gold.map((partner) => /* @__PURE__ */ jsx14(AdbarItem, { children: /* @__PURE__ */ jsx14(AdbarLink, { href: partner.href, title: partner.name, children: /* @__PURE__ */ jsx14(PartnerLogo, { partner }) }) }, partner.name))
|
|
1398
|
+
] }),
|
|
1399
|
+
/* @__PURE__ */ jsxs13(AdbarItem, { className: "col-span-full p-2 text-left mt-3 block!", children: [
|
|
1400
|
+
/* @__PURE__ */ jsx14("strong", { className: "text-sm tracking-tighter leading-tight mb-1 block", children: "Your company name here! \u{1F48E} " }),
|
|
1401
|
+
/* @__PURE__ */ jsxs13("p", { className: "text-xs text-base-muted", children: [
|
|
1402
|
+
"Hey, this is a classic text ad here!",
|
|
1403
|
+
" ",
|
|
1404
|
+
/* @__PURE__ */ jsx14("a", { href: "#adlink", className: "text-info", children: "link" }),
|
|
1405
|
+
" ",
|
|
1406
|
+
"to some thing"
|
|
1407
|
+
] })
|
|
1408
|
+
] })
|
|
1409
|
+
] });
|
|
1410
|
+
};
|
|
1411
|
+
var PartnerLogo = ({
|
|
1412
|
+
partner
|
|
1413
|
+
}) => {
|
|
1414
|
+
return /* @__PURE__ */ jsxs13(Fragment6, { children: [
|
|
1415
|
+
/* @__PURE__ */ jsx14(
|
|
1416
|
+
Image,
|
|
1417
|
+
{
|
|
1418
|
+
src: partner.logoLight,
|
|
1419
|
+
width: 200,
|
|
1420
|
+
height: 100,
|
|
1421
|
+
alt: partner.logoAlt,
|
|
1422
|
+
className: cmMerge7("block", partner.logoDark ? "dark:hidden" : "dark:invert")
|
|
1423
|
+
}
|
|
1424
|
+
),
|
|
1425
|
+
partner.logoDark ? /* @__PURE__ */ jsx14(Image, { src: partner.logoDark, width: 200, height: 100, alt: partner.logoAlt, className: "hidden dark:block" }) : null
|
|
1426
|
+
] });
|
|
1427
|
+
};
|
|
1428
|
+
var AdbarItem = cm4.div`
|
|
1429
|
+
px-5
|
|
1430
|
+
py-5
|
|
1431
|
+
bg-base-200
|
|
1432
|
+
text-center
|
|
1433
|
+
flex
|
|
1434
|
+
items-center
|
|
1435
|
+
justify-center
|
|
1436
|
+
rounded-field
|
|
1437
|
+
`;
|
|
1438
|
+
var AdbarLink = cm4.a`
|
|
1439
|
+
block
|
|
1440
|
+
w-full
|
|
1441
|
+
transition-opacity
|
|
1442
|
+
hover:opacity-100
|
|
1443
|
+
focus-visible:opacity-100
|
|
1444
|
+
`;
|
|
1445
|
+
var Image = cm4.img`
|
|
1446
|
+
mx-auto
|
|
1447
|
+
w-24
|
|
1448
|
+
`;
|
|
1449
|
+
|
|
1450
|
+
// src/runtime/client/getMdxRuntimeValue.tsx
|
|
1451
|
+
var isExternalHref = (href) => {
|
|
1452
|
+
return /^(?:[a-z]+:)?\/\//i.test(href) || href.startsWith("mailto:") || href.startsWith("tel:");
|
|
1453
|
+
};
|
|
1454
|
+
var splitHref = (href) => {
|
|
1455
|
+
const [pathname, hash = ""] = href.split("#");
|
|
1456
|
+
return {
|
|
1457
|
+
pathname,
|
|
1458
|
+
hash: hash ? `#${hash}` : ""
|
|
1459
|
+
};
|
|
1460
|
+
};
|
|
1461
|
+
var toDocsPathname = (basePath, href) => {
|
|
1462
|
+
if (!href.startsWith("/")) {
|
|
1463
|
+
return null;
|
|
1464
|
+
}
|
|
1465
|
+
if (href === basePath || href.startsWith(`${basePath}/`)) {
|
|
1466
|
+
return href;
|
|
1467
|
+
}
|
|
1468
|
+
const normalizedPath = href.replace(/^\/+/, "");
|
|
1469
|
+
if (!normalizedPath) {
|
|
1470
|
+
return null;
|
|
1471
|
+
}
|
|
1472
|
+
return `${basePath}/${normalizedPath}`;
|
|
1473
|
+
};
|
|
1474
|
+
var resolveDocLink = (options) => {
|
|
1475
|
+
const { currentPathname, href } = options;
|
|
1476
|
+
if (href.startsWith("#") || isExternalHref(href)) {
|
|
1477
|
+
return null;
|
|
1478
|
+
}
|
|
1479
|
+
const { pathname, hash } = splitHref(href);
|
|
1480
|
+
const docsPathname = toDocsPathname(options.docs.basePath, pathname);
|
|
1481
|
+
if (!docsPathname) {
|
|
1482
|
+
return null;
|
|
1483
|
+
}
|
|
1484
|
+
const page = getResolvedPageByPathname(options.docs, docsPathname);
|
|
1485
|
+
if (!page) {
|
|
1486
|
+
return null;
|
|
1487
|
+
}
|
|
1488
|
+
const section = getResolvedSectionById(options.docs, page.sectionId);
|
|
1489
|
+
return {
|
|
1490
|
+
href: withSiteBaseUrl(`${page.href}${hash}`),
|
|
1491
|
+
title: page.title,
|
|
1492
|
+
breadcrumb: section ? [section.navTitle] : [],
|
|
1493
|
+
isCurrentPage: isSamePagePathname(page, currentPathname)
|
|
1494
|
+
};
|
|
1495
|
+
};
|
|
1496
|
+
var resolveOverviewItem = (options) => {
|
|
1497
|
+
const page = options.docs.pages.find((candidate) => candidate.id === options.id);
|
|
1498
|
+
if (!page) {
|
|
1499
|
+
return null;
|
|
1500
|
+
}
|
|
1501
|
+
return {
|
|
1502
|
+
title: page.title,
|
|
1503
|
+
href: withSiteBaseUrl(page.href),
|
|
1504
|
+
excerpt: page.description ?? null
|
|
1505
|
+
};
|
|
1506
|
+
};
|
|
1507
|
+
var getMdxRuntimeValue = (options) => {
|
|
1508
|
+
const { currentPathname, docs } = options;
|
|
1509
|
+
const activeSection = getActiveSectionByPathname(docs, currentPathname);
|
|
1510
|
+
const currentPage = getResolvedPageByPathname(docs, currentPathname);
|
|
1511
|
+
return {
|
|
1512
|
+
locale: "en",
|
|
1513
|
+
codeBlockChoices: docsCodeBlockChoiceStore,
|
|
1514
|
+
localizeHref: (href) => {
|
|
1515
|
+
if (href.startsWith("#") || isExternalHref(href)) {
|
|
1516
|
+
return href;
|
|
1517
|
+
}
|
|
1518
|
+
const { pathname, hash } = splitHref(href);
|
|
1519
|
+
const docsPathname = toDocsPathname(docs.basePath, pathname);
|
|
1520
|
+
const page = docsPathname ? getResolvedPageByPathname(docs, docsPathname) : null;
|
|
1521
|
+
if (!page) {
|
|
1522
|
+
return withSiteBaseUrl(href);
|
|
1523
|
+
}
|
|
1524
|
+
return withSiteBaseUrl(`${page.href}${hash}`);
|
|
1525
|
+
},
|
|
1526
|
+
resolveDocLink: ({ href }) => resolveDocLink({
|
|
1527
|
+
docs,
|
|
1528
|
+
currentPathname,
|
|
1529
|
+
href
|
|
1530
|
+
}),
|
|
1531
|
+
resolveOverviewItem: (id) => resolveOverviewItem({
|
|
1532
|
+
docs,
|
|
1533
|
+
id
|
|
1534
|
+
}),
|
|
1535
|
+
t: (group, key) => {
|
|
1536
|
+
if (group === "docs" && key === "onThisPage") {
|
|
1537
|
+
return "On this page";
|
|
1538
|
+
}
|
|
1539
|
+
if (group === "docs" && key === "previous") {
|
|
1540
|
+
return "Previous";
|
|
1541
|
+
}
|
|
1542
|
+
if (group === "docs" && key === "next") {
|
|
1543
|
+
return "Next";
|
|
1544
|
+
}
|
|
1545
|
+
if (group === "docs" && key === "currentSection") {
|
|
1546
|
+
return activeSection?.navTitle ?? currentPage?.title ?? "Docs";
|
|
1547
|
+
}
|
|
1548
|
+
return key;
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
};
|
|
1552
|
+
|
|
1553
|
+
// src/runtime/client/DocsPage.tsx
|
|
1554
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1555
|
+
var DocsPage = ({ Content }) => {
|
|
1556
|
+
const pageContext = usePageContext4();
|
|
1557
|
+
const docs = getDocsGlobalContext(pageContext);
|
|
1558
|
+
const { page, headings, previousPage, nextPage } = useData2();
|
|
1559
|
+
return /* @__PURE__ */ jsxs14(
|
|
1560
|
+
UniversalMdxProvider,
|
|
1561
|
+
{
|
|
1562
|
+
value: getMdxRuntimeValue({
|
|
1563
|
+
docs,
|
|
1564
|
+
currentPathname: pageContext.urlPathname
|
|
1565
|
+
}),
|
|
1566
|
+
children: [
|
|
1567
|
+
/* @__PURE__ */ jsx15("div", { className: "absolute top-0 left-0 w-full h-[60svh] bg-radial-[at_65%_-85%] from-primary-muted-light to-65%" }),
|
|
1568
|
+
/* @__PURE__ */ jsx15(LayoutComponent, { children: /* @__PURE__ */ jsxs14("div", { className: "lg:flex lg:gap-10 xl:gap-14", children: [
|
|
1569
|
+
/* @__PURE__ */ jsx15(Sidebar, { sections: docs.sidebarSections, activeSectionId: page.sectionId, currentHref: page.href }),
|
|
1570
|
+
/* @__PURE__ */ jsxs14("main", { className: "mt-10 min-w-0 flex-1 basis-auto shrink", children: [
|
|
1571
|
+
/* @__PURE__ */ jsxs14(ProseContainer, { "data-doc-content": "", children: [
|
|
1572
|
+
/* @__PURE__ */ jsx15("h1", { className: "scroll-mt-24", children: renderInlineMarkdown(page.title) }),
|
|
1573
|
+
/* @__PURE__ */ jsx15(Content, {})
|
|
1574
|
+
] }),
|
|
1575
|
+
docs.footer.pagination ? /* @__PURE__ */ jsx15(DocsPagination, { previousPage, nextPage }) : null,
|
|
1576
|
+
/* @__PURE__ */ jsx15(DocsFooter, { brand: docs.brand })
|
|
1577
|
+
] }),
|
|
1578
|
+
/* @__PURE__ */ jsx15(TableOfContents, { headings, partners: docs.partners })
|
|
1579
|
+
] }) })
|
|
1580
|
+
]
|
|
1581
|
+
}
|
|
1582
|
+
);
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
export {
|
|
1586
|
+
LayoutComponent,
|
|
1587
|
+
useDocsUserSettingsStore,
|
|
1588
|
+
DEFAULT_THEME_PREFERENCE,
|
|
1589
|
+
applyThemePreference,
|
|
1590
|
+
UserSettingsSync,
|
|
1591
|
+
AppLayout,
|
|
1592
|
+
MetaHead,
|
|
1593
|
+
ProseContainer,
|
|
1594
|
+
DocsPage
|
|
1595
|
+
};
|
|
1596
|
+
//# sourceMappingURL=chunk-G7X2IWYG.js.map
|