@unterberg/nivel 0.0.1 → 0.0.3
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 +115 -0
- package/bin/nivel.mjs +3 -0
- package/dist/{chunk-73NPVCDQ.js → chunk-D7IAGT53.js} +56 -26
- package/dist/chunk-D7IAGT53.js.map +1 -0
- package/dist/chunk-DNCQR5NH.js +231 -0
- package/dist/chunk-DNCQR5NH.js.map +1 -0
- package/dist/{chunk-3JJ6TYWL.js → chunk-FARXFRHG.js} +120 -83
- package/dist/chunk-FARXFRHG.js.map +1 -0
- package/dist/chunk-K5ZYRA3G.js +198 -0
- package/dist/chunk-K5ZYRA3G.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-Q7JU4J6A.js} +69 -33
- package/dist/chunk-Q7JU4J6A.js.map +1 -0
- package/dist/chunk-UDOIFPCZ.js +1538 -0
- package/dist/chunk-UDOIFPCZ.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +78 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +4 -8
- package/dist/client.js +4 -4
- package/dist/index.d.ts +8 -12
- package/dist/index.js +4 -8
- package/dist/{code-blocks.d.ts → mdx/code-blocks.d.ts} +3 -1
- package/dist/{code-blocks.js → mdx/code-blocks.js} +5 -3
- 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/node.d.ts +23 -0
- package/dist/runtime/node.js +24 -0
- package/dist/{types-mvLNHHrf.d.ts → types-j0kEkMA4.d.ts} +47 -24
- package/dist/{config.js → vike.js} +9 -8
- package/dist/vike.js.map +1 -0
- package/package.json +25 -16
- package/tailwind-sources.css +1 -0
- 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 +0 -350
- package/dist/chunk-PHHK2BAF.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/runtime/index.d.ts +0 -15
- package/dist/runtime/index.js +0 -18
- /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
package/dist/chunk-62MBEYU7.js
DELETED
|
@@ -1,1091 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
UniversalMdxProvider,
|
|
3
|
-
renderInlineMarkdown
|
|
4
|
-
} from "./chunk-4WTEOEV2.js";
|
|
5
|
-
import {
|
|
6
|
-
createHeadingSlugger,
|
|
7
|
-
getActiveSectionByPathname,
|
|
8
|
-
getResolvedPageByPathname,
|
|
9
|
-
getResolvedSectionById,
|
|
10
|
-
isSamePagePathname,
|
|
11
|
-
normalizeHeadingTitle,
|
|
12
|
-
resolveDocsConfig
|
|
13
|
-
} from "./chunk-73NPVCDQ.js";
|
|
14
|
-
import {
|
|
15
|
-
baseAssets,
|
|
16
|
-
withSiteBaseUrl
|
|
17
|
-
} from "./chunk-FLO5CJZH.js";
|
|
18
|
-
|
|
19
|
-
// src/runtime/AppLayout.tsx
|
|
20
|
-
import { usePageContext as usePageContext2 } from "vike-react/usePageContext";
|
|
21
|
-
|
|
22
|
-
// src/runtime/components/Navbar.tsx
|
|
23
|
-
import { cmMerge as cmMerge2 } from "@classmatejs/react";
|
|
24
|
-
import { useEffect, useState } from "react";
|
|
25
|
-
import { usePageContext } from "vike-react/usePageContext";
|
|
26
|
-
|
|
27
|
-
// src/runtime/components/Brand.tsx
|
|
28
|
-
import { cmMerge } from "@classmatejs/react";
|
|
29
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
|
-
var Brand = ({ brand, noText = false }) => {
|
|
31
|
-
const defaultLogo = brand.logoLight ?? brand.logoDark;
|
|
32
|
-
return /* @__PURE__ */ jsxs("a", { href: brand.href, className: "flex items-center gap-3 text-base-content no-underline", children: [
|
|
33
|
-
defaultLogo && /* @__PURE__ */ jsxs("span", { className: "relative block h-7 w-7 shrink-0", children: [
|
|
34
|
-
brand.logoLight && /* @__PURE__ */ jsx(
|
|
35
|
-
"img",
|
|
36
|
-
{
|
|
37
|
-
src: brand.logoLight,
|
|
38
|
-
alt: brand.logoAlt,
|
|
39
|
-
className: cmMerge("h-7 w-7 object-contain", brand.logoDark ? "block dark:hidden" : "block")
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
brand.logoDark && /* @__PURE__ */ jsx(
|
|
43
|
-
"img",
|
|
44
|
-
{
|
|
45
|
-
src: brand.logoDark,
|
|
46
|
-
alt: brand.logoAlt,
|
|
47
|
-
className: cmMerge("h-7 w-7 object-contain", brand.logoLight ? "hidden dark:block" : "block")
|
|
48
|
-
}
|
|
49
|
-
)
|
|
50
|
-
] }),
|
|
51
|
-
!noText && /* @__PURE__ */ jsx("span", { className: "text-xl font-semibold tracking-tight", children: brand.text })
|
|
52
|
-
] });
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
// src/runtime/components/LayoutComponent.tsx
|
|
56
|
-
import cm from "@classmatejs/react";
|
|
57
|
-
var LayoutSize = {
|
|
58
|
-
xxs: "xxs",
|
|
59
|
-
xs: "xs",
|
|
60
|
-
sm: "sm",
|
|
61
|
-
md: "md",
|
|
62
|
-
lg: "lg",
|
|
63
|
-
xl: "xl",
|
|
64
|
-
full: "full"
|
|
65
|
-
};
|
|
66
|
-
var layoutComponentSizeMapping = {
|
|
67
|
-
xxs: "max-w-[480px]",
|
|
68
|
-
xs: "max-w-[768px]",
|
|
69
|
-
sm: "max-w-5xl",
|
|
70
|
-
md: "max-w-6xl",
|
|
71
|
-
lg: "max-w-7xl",
|
|
72
|
-
xl: "max-w-[1440px]",
|
|
73
|
-
full: "max-w-full"
|
|
74
|
-
};
|
|
75
|
-
var LayoutComponent = cm.div.variants({
|
|
76
|
-
base: ({ $noGrow }) => `px-4 ${$noGrow ? "" : "mx-auto w-full"} relative`,
|
|
77
|
-
variants: {
|
|
78
|
-
$size: layoutComponentSizeMapping
|
|
79
|
-
},
|
|
80
|
-
defaultVariants: {
|
|
81
|
-
$size: LayoutSize.xl
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// src/runtime/components/ThemeSwitch.tsx
|
|
86
|
-
import { Moon, Sun } from "lucide-react";
|
|
87
|
-
|
|
88
|
-
// src/runtime/store/settings-store.ts
|
|
89
|
-
import { create } from "zustand";
|
|
90
|
-
import { createJSONStorage, persist } from "zustand/middleware";
|
|
91
|
-
|
|
92
|
-
// src/runtime/store/settings-storage.ts
|
|
93
|
-
var USER_SETTINGS_STORAGE_KEY = "nivel-user-settings";
|
|
94
|
-
var LEGACY_CODE_BLOCK_CHOICE_STORAGE_KEY_PREFIX = "vike-docpress:choice:";
|
|
95
|
-
var readLegacyCodeBlockChoice = (choiceGroupName) => {
|
|
96
|
-
if (typeof window === "undefined") {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
try {
|
|
100
|
-
const value = window.localStorage.getItem(`${LEGACY_CODE_BLOCK_CHOICE_STORAGE_KEY_PREFIX}${choiceGroupName}`);
|
|
101
|
-
return value || null;
|
|
102
|
-
} catch {
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
// src/runtime/store/settings-store.ts
|
|
108
|
-
var useDocsUserSettingsStore = create()(
|
|
109
|
-
persist(
|
|
110
|
-
(set) => ({
|
|
111
|
-
codeBlockChoices: {},
|
|
112
|
-
themePreference: null,
|
|
113
|
-
setCodeBlockChoice: (choiceGroupName, choice) => set((state) => ({
|
|
114
|
-
codeBlockChoices: {
|
|
115
|
-
...state.codeBlockChoices,
|
|
116
|
-
[choiceGroupName]: choice
|
|
117
|
-
}
|
|
118
|
-
})),
|
|
119
|
-
setThemePreference: (themePreference) => set({ themePreference })
|
|
120
|
-
}),
|
|
121
|
-
{
|
|
122
|
-
name: USER_SETTINGS_STORAGE_KEY,
|
|
123
|
-
storage: createJSONStorage(() => localStorage),
|
|
124
|
-
partialize: ({ codeBlockChoices, themePreference }) => ({
|
|
125
|
-
codeBlockChoices,
|
|
126
|
-
themePreference
|
|
127
|
-
})
|
|
128
|
-
}
|
|
129
|
-
)
|
|
130
|
-
);
|
|
131
|
-
var docsCodeBlockChoiceStore = {
|
|
132
|
-
subscribe: (listener) => useDocsUserSettingsStore.subscribe(listener),
|
|
133
|
-
getChoice: (choiceGroupName) => useDocsUserSettingsStore.getState().codeBlockChoices[choiceGroupName] ?? null,
|
|
134
|
-
setChoice: (choiceGroupName, choice) => useDocsUserSettingsStore.getState().setCodeBlockChoice(choiceGroupName, choice),
|
|
135
|
-
getLegacyChoice: readLegacyCodeBlockChoice
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// src/runtime/theme.ts
|
|
139
|
-
var DEFAULT_THEME_PREFERENCE = "light";
|
|
140
|
-
var DARK_THEME_MEDIA_QUERY = "(prefers-color-scheme: dark)";
|
|
141
|
-
var getDataTheme = (themePreference, themeConfig) => {
|
|
142
|
-
return themePreference === "dark" ? themeConfig.dark : themeConfig.light;
|
|
143
|
-
};
|
|
144
|
-
var isThemePreference = (value) => {
|
|
145
|
-
return value === "light" || value === "dark";
|
|
146
|
-
};
|
|
147
|
-
var getSystemThemePreference = (fallbackThemePreference) => {
|
|
148
|
-
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
149
|
-
return fallbackThemePreference;
|
|
150
|
-
}
|
|
151
|
-
return window.matchMedia(DARK_THEME_MEDIA_QUERY).matches ? "dark" : "light";
|
|
152
|
-
};
|
|
153
|
-
var resolveThemePreference = (themePreference, themeConfig) => {
|
|
154
|
-
if (isThemePreference(themePreference)) {
|
|
155
|
-
return themePreference;
|
|
156
|
-
}
|
|
157
|
-
return getSystemThemePreference(themeConfig.defaultPreference);
|
|
158
|
-
};
|
|
159
|
-
var applyThemePreference = (themePreference, themeConfig) => {
|
|
160
|
-
if (typeof document === "undefined") {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
document.documentElement.setAttribute(
|
|
164
|
-
"data-theme",
|
|
165
|
-
getDataTheme(resolveThemePreference(themePreference, themeConfig), themeConfig)
|
|
166
|
-
);
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// src/runtime/components/ThemeSwitch.tsx
|
|
170
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
171
|
-
var ThemeSwitch = ({ theme }) => {
|
|
172
|
-
const themePreference = useDocsUserSettingsStore((state) => state.themePreference);
|
|
173
|
-
const setThemePreference = useDocsUserSettingsStore((state) => state.setThemePreference);
|
|
174
|
-
const effectiveThemePreference = resolveThemePreference(themePreference, theme);
|
|
175
|
-
return /* @__PURE__ */ jsxs2(
|
|
176
|
-
"button",
|
|
177
|
-
{
|
|
178
|
-
type: "button",
|
|
179
|
-
"aria-label": "Toggle theme",
|
|
180
|
-
onClick: () => setThemePreference(effectiveThemePreference === "light" ? "dark" : "light"),
|
|
181
|
-
className: "relative flex h-8 w-8 cursor-pointer items-center justify-center rounded-full border border-base-muted-light bg-base-200",
|
|
182
|
-
children: [
|
|
183
|
-
/* @__PURE__ */ jsx2(Sun, { className: "h-4 w-4 dark:hidden" }),
|
|
184
|
-
/* @__PURE__ */ jsx2(Moon, { className: "hidden h-4 w-4 dark:block" })
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
);
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
// src/runtime/components/Navbar.tsx
|
|
191
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
192
|
-
var Navbar = ({ brand, activeSectionId, navbarItems, theme }) => {
|
|
193
|
-
const { urlPathname } = usePageContext();
|
|
194
|
-
const isLandingPage = urlPathname === "/";
|
|
195
|
-
const [isLandingPageScrolled, setIsLandingPageScrolled] = useState(false);
|
|
196
|
-
useEffect(() => {
|
|
197
|
-
if (!isLandingPage) {
|
|
198
|
-
setIsLandingPageScrolled(false);
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
const handleScroll = () => {
|
|
202
|
-
setIsLandingPageScrolled(window.scrollY > 20);
|
|
203
|
-
};
|
|
204
|
-
handleScroll();
|
|
205
|
-
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
206
|
-
return () => {
|
|
207
|
-
window.removeEventListener("scroll", handleScroll);
|
|
208
|
-
};
|
|
209
|
-
}, [isLandingPage]);
|
|
210
|
-
const showChrome = !isLandingPage || isLandingPageScrolled;
|
|
211
|
-
return /* @__PURE__ */ jsxs3(
|
|
212
|
-
"header",
|
|
213
|
-
{
|
|
214
|
-
className: cmMerge2(
|
|
215
|
-
"fixed top-0 left-0 z-20 h-16 w-full border-b border-transparent",
|
|
216
|
-
showChrome && "bg-linear-to-t from-base-100/30 via-base-100/60 to-base-100 backdrop-grayscale border-base-muted-light dark:shadow"
|
|
217
|
-
),
|
|
218
|
-
children: [
|
|
219
|
-
/* @__PURE__ */ jsx3(
|
|
220
|
-
"div",
|
|
221
|
-
{
|
|
222
|
-
className: "absolute inset-0 hidden dark:block",
|
|
223
|
-
style: { backgroundImage: `url(${baseAssets}decorators/pattern.png)` }
|
|
224
|
-
}
|
|
225
|
-
),
|
|
226
|
-
/* @__PURE__ */ jsx3(
|
|
227
|
-
"div",
|
|
228
|
-
{
|
|
229
|
-
className: "absolute inset-0 dark:hidden",
|
|
230
|
-
style: { backgroundImage: `url(${baseAssets}decorators/pattern-light.png)` }
|
|
231
|
-
}
|
|
232
|
-
),
|
|
233
|
-
/* @__PURE__ */ jsx3(LayoutComponent, { className: "h-full", children: isLandingPage ? /* @__PURE__ */ jsxs3("div", { className: "relative z-3 flex h-full items-center justify-between py-4", children: [
|
|
234
|
-
/* @__PURE__ */ jsx3("div", { className: "flex flex-1 items-center gap-4", children: /* @__PURE__ */ jsx3(Brand, { brand }) }),
|
|
235
|
-
/* @__PURE__ */ jsx3(
|
|
236
|
-
"nav",
|
|
237
|
-
{
|
|
238
|
-
"aria-label": "Primary",
|
|
239
|
-
className: "top-0 left-0 flex min-w-0 flex-1 items-center justify-center gap-4 overflow-x-auto",
|
|
240
|
-
children: /* @__PURE__ */ jsx3("ul", { className: "flex items-center gap-2 font-semibold", children: navbarItems.map((item) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsx3(
|
|
241
|
-
"a",
|
|
242
|
-
{
|
|
243
|
-
href: withSiteBaseUrl(item.href),
|
|
244
|
-
className: cmMerge2(
|
|
245
|
-
"btn px-2 whitespace-nowrap",
|
|
246
|
-
item.id === activeSectionId ? "btn-primary btn-soft" : "btn-ghost"
|
|
247
|
-
),
|
|
248
|
-
children: renderInlineMarkdown(item.title)
|
|
249
|
-
}
|
|
250
|
-
) }, item.id)) })
|
|
251
|
-
}
|
|
252
|
-
),
|
|
253
|
-
/* @__PURE__ */ jsx3("div", { className: "flex flex-1 items-center justify-end gap-2", children: /* @__PURE__ */ jsx3(ThemeSwitch, { theme }) })
|
|
254
|
-
] }) : /* @__PURE__ */ jsxs3("div", { className: "relative z-3 flex h-full items-center justify-between py-4", children: [
|
|
255
|
-
/* @__PURE__ */ jsx3("div", { className: "flex w-80 flex-1 items-center justify-between gap-2 lg:flex-none", children: /* @__PURE__ */ jsx3(Brand, { brand }) }),
|
|
256
|
-
/* @__PURE__ */ jsx3(
|
|
257
|
-
"nav",
|
|
258
|
-
{
|
|
259
|
-
"aria-label": "Primary",
|
|
260
|
-
className: "top-0 left-0 flex min-w-0 flex-1 items-center justify-center gap-4 overflow-x-auto lg:justify-start lg:pl-6 xl:pl-10",
|
|
261
|
-
children: /* @__PURE__ */ jsx3("ul", { className: "flex items-center gap-2 font-semibold", children: navbarItems.map((item) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsx3(
|
|
262
|
-
"a",
|
|
263
|
-
{
|
|
264
|
-
href: withSiteBaseUrl(item.href),
|
|
265
|
-
className: cmMerge2(
|
|
266
|
-
"btn px-2 whitespace-nowrap",
|
|
267
|
-
item.id === activeSectionId ? "btn-primary btn-soft" : "btn-ghost"
|
|
268
|
-
),
|
|
269
|
-
children: renderInlineMarkdown(item.title)
|
|
270
|
-
}
|
|
271
|
-
) }, item.id)) })
|
|
272
|
-
}
|
|
273
|
-
),
|
|
274
|
-
/* @__PURE__ */ jsx3("div", { className: "flex flex-1 items-center justify-end gap-2 lg:flex-none", children: /* @__PURE__ */ jsx3(ThemeSwitch, { theme }) })
|
|
275
|
-
] }) })
|
|
276
|
-
]
|
|
277
|
-
}
|
|
278
|
-
);
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
// src/runtime/components/UserSettingsSync.tsx
|
|
282
|
-
import { useEffect as useEffect2 } from "react";
|
|
283
|
-
var UserSettingsSync = ({ theme }) => {
|
|
284
|
-
const themePreference = useDocsUserSettingsStore((state) => state.themePreference);
|
|
285
|
-
const lightTheme = theme?.light ?? "consumer-light";
|
|
286
|
-
const darkTheme = theme?.dark ?? "consumer-dark";
|
|
287
|
-
const defaultThemePreference = theme?.defaultPreference ?? "light";
|
|
288
|
-
const resolvedTheme = { light: lightTheme, dark: darkTheme, defaultPreference: defaultThemePreference };
|
|
289
|
-
const effectiveThemePreference = resolveThemePreference(themePreference, resolvedTheme);
|
|
290
|
-
useEffect2(() => {
|
|
291
|
-
applyThemePreference(effectiveThemePreference, resolvedTheme);
|
|
292
|
-
}, [darkTheme, defaultThemePreference, effectiveThemePreference, lightTheme]);
|
|
293
|
-
return null;
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// src/runtime/AppLayout.tsx
|
|
297
|
-
import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
298
|
-
var AppLayout = ({ children, docsConfig }) => {
|
|
299
|
-
const pageContext = usePageContext2();
|
|
300
|
-
const resolvedConfig = resolveDocsConfig(docsConfig);
|
|
301
|
-
const activeSection = getActiveSectionByPathname(resolvedConfig, pageContext.urlPathname);
|
|
302
|
-
return /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
303
|
-
/* @__PURE__ */ jsx4(UserSettingsSync, { theme: resolvedConfig.theme }),
|
|
304
|
-
/* @__PURE__ */ jsxs4("div", { className: "min-h-screen bg-base-100 text-base-content", children: [
|
|
305
|
-
/* @__PURE__ */ jsx4(
|
|
306
|
-
Navbar,
|
|
307
|
-
{
|
|
308
|
-
brand: resolvedConfig.brand,
|
|
309
|
-
activeSectionId: activeSection?.id ?? null,
|
|
310
|
-
navbarItems: resolvedConfig.navbarItems,
|
|
311
|
-
theme: resolvedConfig.theme
|
|
312
|
-
}
|
|
313
|
-
),
|
|
314
|
-
/* @__PURE__ */ jsx4("div", { className: "pt-16", children })
|
|
315
|
-
] })
|
|
316
|
-
] });
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
// src/runtime/components/MetaHead/FaviconLinks.tsx
|
|
320
|
-
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
321
|
-
var FaviconLinks = ({ head }) => {
|
|
322
|
-
const { appleTouchIcon, faviconIco, faviconSvg } = head;
|
|
323
|
-
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
324
|
-
appleTouchIcon && /* @__PURE__ */ jsx5("link", { rel: "apple-touch-icon", href: appleTouchIcon }),
|
|
325
|
-
faviconSvg && /* @__PURE__ */ jsx5("link", { rel: "icon", type: "image/svg+xml", href: faviconSvg }),
|
|
326
|
-
faviconIco && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
327
|
-
/* @__PURE__ */ jsx5("link", { rel: "shortcut icon", type: "image/x-icon", href: faviconIco }),
|
|
328
|
-
/* @__PURE__ */ jsx5("link", { rel: "icon", type: "image/x-icon", href: faviconIco })
|
|
329
|
-
] })
|
|
330
|
-
] });
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
// src/runtime/components/MetaHead/FontLinks.tsx
|
|
334
|
-
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
335
|
-
var FontLinks = ({ head }) => {
|
|
336
|
-
const { fontStylesheetHref, fontPreloadHrefs } = head;
|
|
337
|
-
const effectivePreloadHrefs = fontPreloadHrefs ?? [];
|
|
338
|
-
return /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
339
|
-
effectivePreloadHrefs.map((href) => /* @__PURE__ */ jsx6("link", { rel: "preload", href, as: "font", type: "font/woff2", crossOrigin: "anonymous" }, href)),
|
|
340
|
-
fontStylesheetHref && /* @__PURE__ */ jsx6("link", { rel: "stylesheet", href: fontStylesheetHref })
|
|
341
|
-
] });
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
// src/runtime/components/MetaHead/ThemeBootstrap.tsx
|
|
345
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
346
|
-
var getThemeBootstrapScript = (theme) => {
|
|
347
|
-
return `(() => {
|
|
348
|
-
const storageKey = ${JSON.stringify(USER_SETTINGS_STORAGE_KEY)};
|
|
349
|
-
const darkThemeMediaQuery = ${JSON.stringify(DARK_THEME_MEDIA_QUERY)};
|
|
350
|
-
const defaultThemePreference = ${JSON.stringify(theme.defaultPreference)};
|
|
351
|
-
const themes = {
|
|
352
|
-
light: ${JSON.stringify(theme.light)},
|
|
353
|
-
dark: ${JSON.stringify(theme.dark)}
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
try {
|
|
357
|
-
const persistedValue = window.localStorage.getItem(storageKey);
|
|
358
|
-
const parsedValue = persistedValue ? JSON.parse(persistedValue) : null;
|
|
359
|
-
const storedThemePreference = parsedValue?.state?.themePreference;
|
|
360
|
-
const themePreference =
|
|
361
|
-
storedThemePreference === 'light' || storedThemePreference === 'dark'
|
|
362
|
-
? storedThemePreference
|
|
363
|
-
: typeof window.matchMedia === 'function'
|
|
364
|
-
? window.matchMedia(darkThemeMediaQuery).matches
|
|
365
|
-
? 'dark'
|
|
366
|
-
: 'light'
|
|
367
|
-
: defaultThemePreference;
|
|
368
|
-
|
|
369
|
-
document.documentElement.setAttribute('data-theme', themes[themePreference]);
|
|
370
|
-
} catch {
|
|
371
|
-
const themePreference =
|
|
372
|
-
typeof window.matchMedia === 'function'
|
|
373
|
-
? window.matchMedia(darkThemeMediaQuery).matches
|
|
374
|
-
? 'dark'
|
|
375
|
-
: 'light'
|
|
376
|
-
: defaultThemePreference;
|
|
377
|
-
|
|
378
|
-
document.documentElement.setAttribute('data-theme', themes[themePreference]);
|
|
379
|
-
}
|
|
380
|
-
})();`;
|
|
381
|
-
};
|
|
382
|
-
var ThemeBootstrap = ({ theme }) => {
|
|
383
|
-
return /* @__PURE__ */ jsx7(
|
|
384
|
-
"script",
|
|
385
|
-
{
|
|
386
|
-
dangerouslySetInnerHTML: {
|
|
387
|
-
__html: getThemeBootstrapScript(theme)
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
// src/runtime/components/MetaHead/index.tsx
|
|
394
|
-
import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
395
|
-
var MetaHead = ({ docsConfig }) => {
|
|
396
|
-
const resolvedConfig = resolveDocsConfig(docsConfig);
|
|
397
|
-
return /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
398
|
-
/* @__PURE__ */ jsx8(ThemeBootstrap, { theme: resolvedConfig.theme }),
|
|
399
|
-
/* @__PURE__ */ jsx8(FaviconLinks, { head: resolvedConfig.head }),
|
|
400
|
-
/* @__PURE__ */ jsx8(FontLinks, { head: resolvedConfig.head })
|
|
401
|
-
] });
|
|
402
|
-
};
|
|
403
|
-
|
|
404
|
-
// src/runtime/components/ProseContainer.tsx
|
|
405
|
-
import cm2 from "@classmatejs/react";
|
|
406
|
-
var ProseContainer = cm2.section`
|
|
407
|
-
prose
|
|
408
|
-
prose-neutral
|
|
409
|
-
max-w-none
|
|
410
|
-
dark:prose-invert
|
|
411
|
-
prose-a:text-primary
|
|
412
|
-
|
|
413
|
-
prose-pre:bg-base-200!
|
|
414
|
-
|
|
415
|
-
prose-code:py-0!
|
|
416
|
-
prose-code:px-1!
|
|
417
|
-
|
|
418
|
-
prose-code:rounded!
|
|
419
|
-
prose-code:dark:inset-shadow-2xs
|
|
420
|
-
|
|
421
|
-
prose-code:bg-primary/5!
|
|
422
|
-
prose-code:border-primary/15!
|
|
423
|
-
|
|
424
|
-
prose-code:dark:bg-primary/10!
|
|
425
|
-
prose-code:dark:border-primary/20!
|
|
426
|
-
|
|
427
|
-
prose-p:leading-[200%]
|
|
428
|
-
prose-li:leading-[200%]
|
|
429
|
-
prose-table:my-8
|
|
430
|
-
prose-table:w-full
|
|
431
|
-
prose-table:text-sm
|
|
432
|
-
prose-th:align-top
|
|
433
|
-
prose-th:font-semibold
|
|
434
|
-
prose-td:align-top
|
|
435
|
-
[&_table_code]:whitespace-nowrap
|
|
436
|
-
[&_thead]:bg-base-200/70
|
|
437
|
-
|
|
438
|
-
prose-p:after:content-none
|
|
439
|
-
prose-p:before:content-none
|
|
440
|
-
prose-blockquote:not-italic
|
|
441
|
-
prose-blockquote:bg-base-200
|
|
442
|
-
prose-blockquote:py-2
|
|
443
|
-
prose-li:my-1
|
|
444
|
-
prose-figure:mb-0
|
|
445
|
-
[&_figure_*]:mb-0
|
|
446
|
-
[&_blockquote_p]:mt-0
|
|
447
|
-
[&_blockquote_p]:mb-2
|
|
448
|
-
[&_blockquote_ul]:pl-4
|
|
449
|
-
[&_blockquote_ul]:mt-2
|
|
450
|
-
[&_blockquote_li]:mt-2
|
|
451
|
-
[&_blockquote_blockquote]:mt-2
|
|
452
|
-
[&_blockquote_blockquote]:mb-0
|
|
453
|
-
[&_blockquote_blockquote]:bg-base-300/40
|
|
454
|
-
[&_blockquote_blockquote]:pt-2
|
|
455
|
-
[&_blockquote_blockquote]:pb-1
|
|
456
|
-
`;
|
|
457
|
-
|
|
458
|
-
// src/runtime/DocsPage.tsx
|
|
459
|
-
import { useData as useData2 } from "vike-react/useData";
|
|
460
|
-
import { usePageContext as usePageContext3 } from "vike-react/usePageContext";
|
|
461
|
-
|
|
462
|
-
// src/runtime/components/DocsPagination.tsx
|
|
463
|
-
import { cmMerge as cmMerge3 } from "@classmatejs/react";
|
|
464
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
465
|
-
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
466
|
-
var PaginationCard = ({ item, direction, isOffset }) => {
|
|
467
|
-
const isPrevious = direction === "previous";
|
|
468
|
-
return /* @__PURE__ */ jsx9(
|
|
469
|
-
"a",
|
|
470
|
-
{
|
|
471
|
-
href: withSiteBaseUrl(item.href),
|
|
472
|
-
className: cmMerge3(
|
|
473
|
-
"group rounded-box border border-base-muted-light bg-base-100 p-5 no-underline hover:border-primary-muted-medium hover:bg-base-200",
|
|
474
|
-
isPrevious ? "text-left" : "text-right",
|
|
475
|
-
isOffset && "sm:col-start-2"
|
|
476
|
-
),
|
|
477
|
-
"aria-label": `${isPrevious ? "Previous" : "Next"}: ${item.title}`,
|
|
478
|
-
children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col justify-between gap-2", children: [
|
|
479
|
-
/* @__PURE__ */ jsx9("p", { className: "text-lg font-semibold text-base-content", children: renderInlineMarkdown(item.title) }),
|
|
480
|
-
/* @__PURE__ */ jsxs8(
|
|
481
|
-
"div",
|
|
482
|
-
{
|
|
483
|
-
className: cmMerge3(
|
|
484
|
-
"flex items-center gap-1 text-base-muted group-hover:text-base-content",
|
|
485
|
-
isPrevious ? "justify-start" : "justify-end"
|
|
486
|
-
),
|
|
487
|
-
children: [
|
|
488
|
-
isPrevious && /* @__PURE__ */ jsx9(ChevronLeft, { className: "h-4 w-4" }),
|
|
489
|
-
/* @__PURE__ */ jsx9("span", { children: isPrevious ? "Previous" : "Next" }),
|
|
490
|
-
!isPrevious && /* @__PURE__ */ jsx9(ChevronRight, { className: "h-4 w-4" })
|
|
491
|
-
]
|
|
492
|
-
}
|
|
493
|
-
)
|
|
494
|
-
] })
|
|
495
|
-
}
|
|
496
|
-
);
|
|
497
|
-
};
|
|
498
|
-
var DocsPagination = ({ previousPage, nextPage }) => {
|
|
499
|
-
if (!previousPage && !nextPage) {
|
|
500
|
-
return null;
|
|
501
|
-
}
|
|
502
|
-
return /* @__PURE__ */ jsx9("nav", { className: "mb-10 mt-16", "aria-label": "Previous Next", children: /* @__PURE__ */ jsxs8("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
503
|
-
previousPage && /* @__PURE__ */ jsx9(PaginationCard, { item: previousPage, direction: "previous" }),
|
|
504
|
-
nextPage && /* @__PURE__ */ jsx9(PaginationCard, { isOffset: !previousPage, item: nextPage, direction: "next" })
|
|
505
|
-
] }) });
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
// src/runtime/components/Footer.tsx
|
|
509
|
-
import { Bug, Pencil } from "lucide-react";
|
|
510
|
-
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
511
|
-
var DocsFooter = ({ brand }) => {
|
|
512
|
-
return /* @__PURE__ */ jsxs9("footer", { className: "mb-8 mt-12 text-sm border-t border-base-muted-light pt-10", children: [
|
|
513
|
-
/* @__PURE__ */ jsxs9("div", { className: "mb-16 flex items-center gap-2", children: [
|
|
514
|
-
/* @__PURE__ */ jsxs9("a", { href: "edit", className: "btn btn-sm btn-primary btn-soft", children: [
|
|
515
|
-
/* @__PURE__ */ jsx10(Pencil, { className: "w-3 h-3" }),
|
|
516
|
-
" Edit this page"
|
|
517
|
-
] }),
|
|
518
|
-
/* @__PURE__ */ jsxs9("a", { href: "edit", className: "btn btn-sm btn-primary btn-soft", children: [
|
|
519
|
-
/* @__PURE__ */ jsx10(Bug, { className: "w-3 h-3" }),
|
|
520
|
-
" Report Issue"
|
|
521
|
-
] })
|
|
522
|
-
] }),
|
|
523
|
-
/* @__PURE__ */ jsx10("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ jsx10("div", { className: "flex gap-2 items-center", children: brand && /* @__PURE__ */ jsx10(Brand, { brand, noText: true }) }) })
|
|
524
|
-
] });
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
// src/runtime/components/Sidebar.tsx
|
|
528
|
-
import { cmMerge as cmMerge4 } from "@classmatejs/react";
|
|
529
|
-
import { useEffect as useEffect3 } from "react";
|
|
530
|
-
import { create as create2 } from "zustand";
|
|
531
|
-
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
532
|
-
var useSidebarDisclosureStore = create2()((set) => ({
|
|
533
|
-
openNodes: {},
|
|
534
|
-
setNodeOpen: (nodeId, isOpen) => set((state) => {
|
|
535
|
-
if (state.openNodes[nodeId] === isOpen) {
|
|
536
|
-
return state;
|
|
537
|
-
}
|
|
538
|
-
return {
|
|
539
|
-
openNodes: {
|
|
540
|
-
...state.openNodes,
|
|
541
|
-
[nodeId]: isOpen
|
|
542
|
-
}
|
|
543
|
-
};
|
|
544
|
-
})
|
|
545
|
-
}));
|
|
546
|
-
var containsActiveHref = (items, currentHref) => {
|
|
547
|
-
return items.some((item) => {
|
|
548
|
-
if (item.kind === "page") {
|
|
549
|
-
return item.href === currentHref;
|
|
550
|
-
}
|
|
551
|
-
if (item.kind === "group") {
|
|
552
|
-
return containsActiveHref(item.items, currentHref);
|
|
553
|
-
}
|
|
554
|
-
return false;
|
|
555
|
-
});
|
|
556
|
-
};
|
|
557
|
-
var hasActiveItem = (items, activeHref) => {
|
|
558
|
-
return items.some((item) => {
|
|
559
|
-
if (item.kind === "group") {
|
|
560
|
-
return containsActiveHref(item.items, activeHref);
|
|
561
|
-
}
|
|
562
|
-
return item.kind === "page" && item.href === activeHref;
|
|
563
|
-
});
|
|
564
|
-
};
|
|
565
|
-
var getGroupLandingPage = (group) => {
|
|
566
|
-
return group.items.find((item) => {
|
|
567
|
-
if (item.kind !== "page") {
|
|
568
|
-
return false;
|
|
569
|
-
}
|
|
570
|
-
return item.navTitle === group.title || item.title === group.title;
|
|
571
|
-
}) ?? null;
|
|
572
|
-
};
|
|
573
|
-
var getVisibleGroupItems = (group, landingPage) => {
|
|
574
|
-
if (!landingPage) {
|
|
575
|
-
return group.items;
|
|
576
|
-
}
|
|
577
|
-
return group.items.filter((item) => item.id !== landingPage.id);
|
|
578
|
-
};
|
|
579
|
-
var useAutoOpenDetails = (nodeId, isOpenByDefault, hasActiveDescendant) => {
|
|
580
|
-
const storedOpen = useSidebarDisclosureStore((state) => state.openNodes[nodeId]);
|
|
581
|
-
const setNodeOpen = useSidebarDisclosureStore((state) => state.setNodeOpen);
|
|
582
|
-
const isOpen = storedOpen === void 0 ? isOpenByDefault || hasActiveDescendant : storedOpen || hasActiveDescendant;
|
|
583
|
-
useEffect3(() => {
|
|
584
|
-
if (hasActiveDescendant) {
|
|
585
|
-
setNodeOpen(nodeId, true);
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
if (storedOpen === void 0 && isOpenByDefault) {
|
|
589
|
-
setNodeOpen(nodeId, true);
|
|
590
|
-
}
|
|
591
|
-
}, [hasActiveDescendant, isOpenByDefault, nodeId, setNodeOpen, storedOpen]);
|
|
592
|
-
return {
|
|
593
|
-
isOpen,
|
|
594
|
-
setIsOpen: (nextOpen) => setNodeOpen(nodeId, nextOpen)
|
|
595
|
-
};
|
|
596
|
-
};
|
|
597
|
-
var SidebarPageLink = ({ title, href, currentHref }) => {
|
|
598
|
-
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
|
|
599
|
-
"a",
|
|
600
|
-
{
|
|
601
|
-
href: withSiteBaseUrl(href),
|
|
602
|
-
className: cmMerge4(
|
|
603
|
-
"text-base-muted hover:text-base-content justify-start hover:bg-base-200",
|
|
604
|
-
href === currentHref && "text-primary! font-semibold bg-base-200"
|
|
605
|
-
),
|
|
606
|
-
children: renderInlineMarkdown(title, { codeClassName: "text-sm!" })
|
|
607
|
-
}
|
|
608
|
-
) });
|
|
609
|
-
};
|
|
610
|
-
var SidebarDivider = ({ title }) => {
|
|
611
|
-
return /* @__PURE__ */ jsx11("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__ */ jsx11("span", { className: "-ml-3", children: renderInlineMarkdown(title, { codeClassName: "text-sm!" }) }) });
|
|
612
|
-
};
|
|
613
|
-
var SidebarGroupTitle = ({ title, href, isActive, allowNavigation = false }) => {
|
|
614
|
-
const content = /* @__PURE__ */ jsx11(
|
|
615
|
-
"span",
|
|
616
|
-
{
|
|
617
|
-
className: cmMerge4(
|
|
618
|
-
allowNavigation ? "font-medium" : "font-semibold",
|
|
619
|
-
isActive && allowNavigation && "text-primary!"
|
|
620
|
-
),
|
|
621
|
-
children: renderInlineMarkdown(title, { codeClassName: "text-sm!" })
|
|
622
|
-
}
|
|
623
|
-
);
|
|
624
|
-
if (allowNavigation && href) {
|
|
625
|
-
return /* @__PURE__ */ jsx11(
|
|
626
|
-
"a",
|
|
627
|
-
{
|
|
628
|
-
href: withSiteBaseUrl(href),
|
|
629
|
-
onClick: (event) => {
|
|
630
|
-
event.stopPropagation();
|
|
631
|
-
},
|
|
632
|
-
className: cmMerge4(
|
|
633
|
-
"flex items-center gap-2 text-base-muted hover:text-base-content no-underline",
|
|
634
|
-
isActive && "text-primary! font-semibold"
|
|
635
|
-
),
|
|
636
|
-
children: content
|
|
637
|
-
}
|
|
638
|
-
);
|
|
639
|
-
}
|
|
640
|
-
return /* @__PURE__ */ jsx11("span", { className: "flex items-center gap-2 text-base-content", children: content });
|
|
641
|
-
};
|
|
642
|
-
var SidebarItemList = ({ items, currentHref }) => {
|
|
643
|
-
return /* @__PURE__ */ jsx11("ul", { children: items.map((item) => {
|
|
644
|
-
if (item.kind === "divider") {
|
|
645
|
-
return /* @__PURE__ */ jsx11(SidebarDivider, { title: item.title }, item.id);
|
|
646
|
-
}
|
|
647
|
-
if (item.kind === "page") {
|
|
648
|
-
return /* @__PURE__ */ jsx11(SidebarPageLink, { title: item.navTitle, href: item.href, currentHref }, item.id);
|
|
649
|
-
}
|
|
650
|
-
return /* @__PURE__ */ jsx11(SidebarNestedGroup, { group: item, currentHref }, item.id);
|
|
651
|
-
}) });
|
|
652
|
-
};
|
|
653
|
-
var SidebarNestedGroup = ({ group, currentHref }) => {
|
|
654
|
-
const landingPage = getGroupLandingPage(group);
|
|
655
|
-
const visibleItems = getVisibleGroupItems(group, landingPage);
|
|
656
|
-
const isCollapsible = group.collapsible !== void 0;
|
|
657
|
-
const isOpenByDefault = group.collapsible?.isDefaultOpen ?? true;
|
|
658
|
-
const nestedHasActiveItem = landingPage?.href === currentHref || hasActiveItem(visibleItems, currentHref);
|
|
659
|
-
const { isOpen, setIsOpen } = useAutoOpenDetails(`group:${group.id}`, isOpenByDefault, nestedHasActiveItem);
|
|
660
|
-
if (!isCollapsible) {
|
|
661
|
-
return /* @__PURE__ */ jsxs10("li", { children: [
|
|
662
|
-
/* @__PURE__ */ jsx11("div", { className: "px-4 py-2", children: /* @__PURE__ */ jsx11(
|
|
663
|
-
SidebarGroupTitle,
|
|
664
|
-
{
|
|
665
|
-
title: group.title,
|
|
666
|
-
href: landingPage?.href,
|
|
667
|
-
isActive: nestedHasActiveItem,
|
|
668
|
-
allowNavigation: Boolean(landingPage)
|
|
669
|
-
}
|
|
670
|
-
) }),
|
|
671
|
-
visibleItems.length > 0 ? /* @__PURE__ */ jsx11(SidebarItemList, { items: visibleItems, currentHref }) : null
|
|
672
|
-
] });
|
|
673
|
-
}
|
|
674
|
-
return /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsxs10(
|
|
675
|
-
"details",
|
|
676
|
-
{
|
|
677
|
-
open: isOpen,
|
|
678
|
-
onToggle: (event) => {
|
|
679
|
-
setIsOpen(event.currentTarget.open);
|
|
680
|
-
},
|
|
681
|
-
children: [
|
|
682
|
-
/* @__PURE__ */ jsx11("summary", { children: /* @__PURE__ */ jsx11(
|
|
683
|
-
SidebarGroupTitle,
|
|
684
|
-
{
|
|
685
|
-
title: group.title,
|
|
686
|
-
href: landingPage?.href,
|
|
687
|
-
isActive: nestedHasActiveItem,
|
|
688
|
-
allowNavigation: Boolean(landingPage)
|
|
689
|
-
}
|
|
690
|
-
) }),
|
|
691
|
-
visibleItems.length > 0 ? /* @__PURE__ */ jsx11(SidebarItemList, { items: visibleItems, currentHref }) : null
|
|
692
|
-
]
|
|
693
|
-
}
|
|
694
|
-
) });
|
|
695
|
-
};
|
|
696
|
-
var SidebarSectionGroup = ({ section, currentHref, activeSectionId }) => {
|
|
697
|
-
const sectionHasActiveItem = section.id === activeSectionId || containsActiveHref(section.items, currentHref);
|
|
698
|
-
const { isOpen, setIsOpen } = useAutoOpenDetails(
|
|
699
|
-
`section:${section.id}`,
|
|
700
|
-
section.id === activeSectionId,
|
|
701
|
-
sectionHasActiveItem
|
|
702
|
-
);
|
|
703
|
-
return /* @__PURE__ */ jsx11("li", { className: "pb-4", children: /* @__PURE__ */ jsxs10(
|
|
704
|
-
"details",
|
|
705
|
-
{
|
|
706
|
-
open: isOpen,
|
|
707
|
-
onToggle: (event) => {
|
|
708
|
-
setIsOpen(event.currentTarget.open);
|
|
709
|
-
},
|
|
710
|
-
children: [
|
|
711
|
-
/* @__PURE__ */ jsx11("summary", { children: /* @__PURE__ */ jsx11(SidebarGroupTitle, { title: section.title, isActive: sectionHasActiveItem }) }),
|
|
712
|
-
/* @__PURE__ */ jsx11(SidebarItemList, { items: section.items, currentHref })
|
|
713
|
-
]
|
|
714
|
-
}
|
|
715
|
-
) });
|
|
716
|
-
};
|
|
717
|
-
var Sidebar = ({ sections, activeSectionId, currentHref }) => {
|
|
718
|
-
return /* @__PURE__ */ jsx11("aside", { className: "hidden basis-76 shrink-0 lg:block", children: /* @__PURE__ */ jsxs10("div", { className: "-ml-3 sticky top-16", children: [
|
|
719
|
-
/* @__PURE__ */ jsx11("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" }),
|
|
720
|
-
/* @__PURE__ */ jsx11("div", { className: "pr-4 h-[calc(100svh-16*var(--spacing))] overflow-y-scroll overflow-x-hidden relative z-10", children: /* @__PURE__ */ jsx11("ul", { className: "menu w-full px-0 py-5 li:last-child:border-0", children: sections.map((section) => /* @__PURE__ */ jsx11(
|
|
721
|
-
SidebarSectionGroup,
|
|
722
|
-
{
|
|
723
|
-
section,
|
|
724
|
-
currentHref,
|
|
725
|
-
activeSectionId
|
|
726
|
-
},
|
|
727
|
-
section.id
|
|
728
|
-
)) }) })
|
|
729
|
-
] }) });
|
|
730
|
-
};
|
|
731
|
-
|
|
732
|
-
// src/runtime/components/TableOfContents.tsx
|
|
733
|
-
import cm3, { cmMerge as cmMerge5 } from "@classmatejs/react";
|
|
734
|
-
import { TableOfContentsIcon } from "lucide-react";
|
|
735
|
-
import { useEffect as useEffect4, useState as useState2 } from "react";
|
|
736
|
-
import { useData } from "vike-react/useData";
|
|
737
|
-
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
738
|
-
var getCurrentHash = () => {
|
|
739
|
-
try {
|
|
740
|
-
return decodeURIComponent(window.location.hash);
|
|
741
|
-
} catch {
|
|
742
|
-
return window.location.hash;
|
|
743
|
-
}
|
|
744
|
-
};
|
|
745
|
-
var getHeadingElements = () => {
|
|
746
|
-
const root = document.querySelector("[data-doc-content]");
|
|
747
|
-
if (!(root instanceof HTMLElement)) {
|
|
748
|
-
return [];
|
|
749
|
-
}
|
|
750
|
-
return Array.from(root.querySelectorAll("h2, h3, h4")).filter(
|
|
751
|
-
(element) => element instanceof HTMLHeadingElement
|
|
752
|
-
);
|
|
753
|
-
};
|
|
754
|
-
var areHeadingsEqual = (left, right) => {
|
|
755
|
-
if (left.length !== right.length) {
|
|
756
|
-
return false;
|
|
757
|
-
}
|
|
758
|
-
return left.every((heading, index) => {
|
|
759
|
-
const other = right[index];
|
|
760
|
-
return other !== void 0 && heading.depth === other.depth && heading.id === other.id && heading.title === other.title;
|
|
761
|
-
});
|
|
762
|
-
};
|
|
763
|
-
var syncHeadingsFromDom = (setDomHeadings) => {
|
|
764
|
-
const root = document.querySelector("[data-doc-content]");
|
|
765
|
-
if (!(root instanceof HTMLElement)) {
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
const slugify = createHeadingSlugger();
|
|
769
|
-
const nextHeadings = Array.from(root.querySelectorAll("h2, h3, h4")).map((element) => {
|
|
770
|
-
const title = normalizeHeadingTitle(element.textContent ?? "");
|
|
771
|
-
if (!title) {
|
|
772
|
-
return null;
|
|
773
|
-
}
|
|
774
|
-
element.classList.add("scroll-mt-24");
|
|
775
|
-
const id = element.id || slugify(title);
|
|
776
|
-
if (!element.id) {
|
|
777
|
-
element.id = id;
|
|
778
|
-
}
|
|
779
|
-
return {
|
|
780
|
-
depth: Number(element.tagName.slice(1)),
|
|
781
|
-
id,
|
|
782
|
-
title
|
|
783
|
-
};
|
|
784
|
-
}).filter((heading) => heading !== null);
|
|
785
|
-
setDomHeadings((currentHeadings) => {
|
|
786
|
-
if (areHeadingsEqual(currentHeadings, nextHeadings)) {
|
|
787
|
-
return currentHeadings;
|
|
788
|
-
}
|
|
789
|
-
return nextHeadings;
|
|
790
|
-
});
|
|
791
|
-
};
|
|
792
|
-
var updateActiveHeadingFromScroll = (setActiveHeadingId) => {
|
|
793
|
-
const headingElements = getHeadingElements();
|
|
794
|
-
if (headingElements.length === 0) {
|
|
795
|
-
return;
|
|
796
|
-
}
|
|
797
|
-
const activationOffset = 144;
|
|
798
|
-
let nextActiveHeadingId = headingElements[0]?.id ?? "";
|
|
799
|
-
for (const heading of headingElements) {
|
|
800
|
-
if (!heading.id) {
|
|
801
|
-
continue;
|
|
802
|
-
}
|
|
803
|
-
if (heading.getBoundingClientRect().top <= activationOffset) {
|
|
804
|
-
nextActiveHeadingId = heading.id;
|
|
805
|
-
continue;
|
|
806
|
-
}
|
|
807
|
-
break;
|
|
808
|
-
}
|
|
809
|
-
const lastHeading = headingElements.at(-1);
|
|
810
|
-
if (lastHeading?.id && window.innerHeight + window.scrollY >= document.documentElement.scrollHeight - 8) {
|
|
811
|
-
nextActiveHeadingId = lastHeading.id;
|
|
812
|
-
}
|
|
813
|
-
setActiveHeadingId(nextActiveHeadingId);
|
|
814
|
-
};
|
|
815
|
-
var TableOfContents = ({ headings, partners }) => {
|
|
816
|
-
const [activeHeadingId, setActiveHeadingId] = useState2("");
|
|
817
|
-
const [domHeadings, setDomHeadings] = useState2(headings);
|
|
818
|
-
const effectiveHeadings = domHeadings.length > 0 ? domHeadings : headings;
|
|
819
|
-
const { page } = useData();
|
|
820
|
-
useEffect4(() => {
|
|
821
|
-
let scrollFrame = 0;
|
|
822
|
-
const syncActiveHeading = () => {
|
|
823
|
-
if (scrollFrame) {
|
|
824
|
-
return;
|
|
825
|
-
}
|
|
826
|
-
scrollFrame = window.requestAnimationFrame(() => {
|
|
827
|
-
scrollFrame = 0;
|
|
828
|
-
updateActiveHeadingFromScroll(setActiveHeadingId);
|
|
829
|
-
});
|
|
830
|
-
};
|
|
831
|
-
const updateHash = () => {
|
|
832
|
-
const currentHash = getCurrentHash().replace(/^#/, "");
|
|
833
|
-
if (currentHash !== "") {
|
|
834
|
-
setActiveHeadingId(currentHash);
|
|
835
|
-
return;
|
|
836
|
-
}
|
|
837
|
-
syncActiveHeading();
|
|
838
|
-
};
|
|
839
|
-
updateHash();
|
|
840
|
-
queueMicrotask(() => {
|
|
841
|
-
syncHeadingsFromDom(setDomHeadings);
|
|
842
|
-
syncActiveHeading();
|
|
843
|
-
});
|
|
844
|
-
window.addEventListener("hashchange", updateHash);
|
|
845
|
-
window.addEventListener("scroll", syncActiveHeading, { passive: true });
|
|
846
|
-
window.addEventListener("resize", syncActiveHeading);
|
|
847
|
-
return () => {
|
|
848
|
-
if (scrollFrame) {
|
|
849
|
-
window.cancelAnimationFrame(scrollFrame);
|
|
850
|
-
}
|
|
851
|
-
window.removeEventListener("hashchange", updateHash);
|
|
852
|
-
window.removeEventListener("scroll", syncActiveHeading);
|
|
853
|
-
window.removeEventListener("resize", syncActiveHeading);
|
|
854
|
-
};
|
|
855
|
-
}, []);
|
|
856
|
-
useEffect4(() => {
|
|
857
|
-
if (typeof window === "undefined") {
|
|
858
|
-
return;
|
|
859
|
-
}
|
|
860
|
-
setDomHeadings((currentHeadings) => {
|
|
861
|
-
if (areHeadingsEqual(currentHeadings, headings)) {
|
|
862
|
-
return currentHeadings;
|
|
863
|
-
}
|
|
864
|
-
return headings;
|
|
865
|
-
});
|
|
866
|
-
setActiveHeadingId("");
|
|
867
|
-
queueMicrotask(() => {
|
|
868
|
-
syncHeadingsFromDom(setDomHeadings);
|
|
869
|
-
updateActiveHeadingFromScroll(setActiveHeadingId);
|
|
870
|
-
});
|
|
871
|
-
}, [headings]);
|
|
872
|
-
return /* @__PURE__ */ jsx12("aside", { className: cmMerge5(page.tableOfContents ? "w-64" : "w-32", "hidden shrink-0 xl:block"), children: /* @__PURE__ */ jsx12("div", { className: "sticky top-16", children: /* @__PURE__ */ jsxs11("div", { className: "relative h-[calc(100svh-16*var(--spacing))] overflow-y-auto overflow-x-hidden pt-10 pb-8", children: [
|
|
873
|
-
page.tableOfContents ? effectiveHeadings.length > 0 && /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
874
|
-
/* @__PURE__ */ jsxs11("p", { className: "mb-4 flex items-center gap-2 text-xs font-semibold uppercase tracking-widest text-base-muted", children: [
|
|
875
|
-
/* @__PURE__ */ jsx12(TableOfContentsIcon, { className: "h-3 w-3" }),
|
|
876
|
-
"On this page"
|
|
877
|
-
] }),
|
|
878
|
-
/* @__PURE__ */ jsx12("nav", { "aria-label": "On this page", className: "mb-16", children: /* @__PURE__ */ jsx12("ul", { children: effectiveHeadings.map((heading, index) => /* @__PURE__ */ jsx12("li", { children: /* @__PURE__ */ jsx12(
|
|
879
|
-
"a",
|
|
880
|
-
{
|
|
881
|
-
href: `#${heading.id}`,
|
|
882
|
-
"aria-current": activeHeadingId === heading.id ? "location" : void 0,
|
|
883
|
-
onClick: () => setActiveHeadingId(heading.id),
|
|
884
|
-
className: cmMerge5(
|
|
885
|
-
"block border-l border-base-muted-light py-1.5 text-sm text-base-muted hover:border-primary-muted hover:text-base-content",
|
|
886
|
-
heading.depth > 2 ? "pl-6" : "pl-4",
|
|
887
|
-
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" : ""
|
|
888
|
-
),
|
|
889
|
-
children: heading.title
|
|
890
|
-
}
|
|
891
|
-
) }, heading.id)) }) })
|
|
892
|
-
] }) : null,
|
|
893
|
-
/* @__PURE__ */ jsx12(Adbar, { partners })
|
|
894
|
-
] }) }) });
|
|
895
|
-
};
|
|
896
|
-
var Adbar = ({ partners }) => {
|
|
897
|
-
if (partners.primary.length === 0 && partners.gold.length === 0) {
|
|
898
|
-
return null;
|
|
899
|
-
}
|
|
900
|
-
return /* @__PURE__ */ jsxs11("ul", { className: "grid grid-cols-[repeat(auto-fit,minmax(5.5rem,1fr))] gap-3 opacity-90", children: [
|
|
901
|
-
partners.primary.map((partner) => /* @__PURE__ */ jsx12(AdbarItem, { className: "col-span-full", children: /* @__PURE__ */ jsx12(AdbarLink, { href: partner.href, title: partner.name, children: /* @__PURE__ */ jsx12(PartnerLogo, { partner }) }) }, partner.name)),
|
|
902
|
-
partners.gold.map((partner) => /* @__PURE__ */ jsx12(AdbarItem, { children: /* @__PURE__ */ jsx12(AdbarLink, { href: partner.href, title: partner.name, children: /* @__PURE__ */ jsx12(PartnerLogo, { partner }) }) }, partner.name))
|
|
903
|
-
] });
|
|
904
|
-
};
|
|
905
|
-
var PartnerLogo = ({
|
|
906
|
-
partner
|
|
907
|
-
}) => {
|
|
908
|
-
return /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
909
|
-
/* @__PURE__ */ jsx12(
|
|
910
|
-
Image,
|
|
911
|
-
{
|
|
912
|
-
src: partner.logoLight,
|
|
913
|
-
width: 200,
|
|
914
|
-
height: 100,
|
|
915
|
-
alt: partner.logoAlt,
|
|
916
|
-
className: cmMerge5("block", partner.logoDark ? "dark:hidden" : "dark:invert")
|
|
917
|
-
}
|
|
918
|
-
),
|
|
919
|
-
partner.logoDark ? /* @__PURE__ */ jsx12(Image, { src: partner.logoDark, width: 200, height: 100, alt: partner.logoAlt, className: "hidden dark:block" }) : null
|
|
920
|
-
] });
|
|
921
|
-
};
|
|
922
|
-
var AdbarItem = cm3.div`
|
|
923
|
-
px-5
|
|
924
|
-
py-5
|
|
925
|
-
bg-base-200
|
|
926
|
-
text-center
|
|
927
|
-
flex
|
|
928
|
-
items-center
|
|
929
|
-
justify-center
|
|
930
|
-
rounded-box
|
|
931
|
-
`;
|
|
932
|
-
var AdbarLink = cm3.a`
|
|
933
|
-
block
|
|
934
|
-
w-full
|
|
935
|
-
transition-opacity
|
|
936
|
-
hover:opacity-100
|
|
937
|
-
focus-visible:opacity-100
|
|
938
|
-
`;
|
|
939
|
-
var Image = cm3.img`
|
|
940
|
-
mx-auto
|
|
941
|
-
w-24
|
|
942
|
-
`;
|
|
943
|
-
|
|
944
|
-
// src/runtime/getMdxRuntimeValue.tsx
|
|
945
|
-
var isExternalHref = (href) => {
|
|
946
|
-
return /^(?:[a-z]+:)?\/\//i.test(href) || href.startsWith("mailto:") || href.startsWith("tel:");
|
|
947
|
-
};
|
|
948
|
-
var splitHref = (href) => {
|
|
949
|
-
const [pathname, hash = ""] = href.split("#");
|
|
950
|
-
return {
|
|
951
|
-
pathname,
|
|
952
|
-
hash: hash ? `#${hash}` : ""
|
|
953
|
-
};
|
|
954
|
-
};
|
|
955
|
-
var toDocsPathname = (basePath, href) => {
|
|
956
|
-
if (!href.startsWith("/")) {
|
|
957
|
-
return null;
|
|
958
|
-
}
|
|
959
|
-
if (href === basePath || href.startsWith(`${basePath}/`)) {
|
|
960
|
-
return href;
|
|
961
|
-
}
|
|
962
|
-
const normalizedPath = href.replace(/^\/+/, "");
|
|
963
|
-
if (!normalizedPath) {
|
|
964
|
-
return null;
|
|
965
|
-
}
|
|
966
|
-
return `${basePath}/${normalizedPath}`;
|
|
967
|
-
};
|
|
968
|
-
var resolveDocLink = (options) => {
|
|
969
|
-
const { currentPathname, href } = options;
|
|
970
|
-
if (href.startsWith("#") || isExternalHref(href)) {
|
|
971
|
-
return null;
|
|
972
|
-
}
|
|
973
|
-
const { pathname, hash } = splitHref(href);
|
|
974
|
-
const docsPathname = toDocsPathname(options.resolvedConfig.basePath, pathname);
|
|
975
|
-
if (!docsPathname) {
|
|
976
|
-
return null;
|
|
977
|
-
}
|
|
978
|
-
const page = getResolvedPageByPathname(options.resolvedConfig, docsPathname);
|
|
979
|
-
if (!page) {
|
|
980
|
-
return null;
|
|
981
|
-
}
|
|
982
|
-
const section = getResolvedSectionById(options.resolvedConfig, page.sectionId);
|
|
983
|
-
return {
|
|
984
|
-
href: withSiteBaseUrl(`${page.href}${hash}`),
|
|
985
|
-
title: page.title,
|
|
986
|
-
breadcrumb: section ? [section.navTitle] : [],
|
|
987
|
-
isCurrentPage: isSamePagePathname(page, currentPathname)
|
|
988
|
-
};
|
|
989
|
-
};
|
|
990
|
-
var resolveOverviewItem = (options) => {
|
|
991
|
-
const page = options.resolvedConfig.pages.find((candidate) => candidate.id === options.id);
|
|
992
|
-
if (!page) {
|
|
993
|
-
return null;
|
|
994
|
-
}
|
|
995
|
-
return {
|
|
996
|
-
title: page.title,
|
|
997
|
-
href: withSiteBaseUrl(page.href),
|
|
998
|
-
excerpt: page.description ?? null
|
|
999
|
-
};
|
|
1000
|
-
};
|
|
1001
|
-
var getMdxRuntimeValue = (options) => {
|
|
1002
|
-
const { currentPathname, docsConfig } = options;
|
|
1003
|
-
const resolvedConfig = resolveDocsConfig(docsConfig);
|
|
1004
|
-
const activeSection = getActiveSectionByPathname(resolvedConfig, currentPathname);
|
|
1005
|
-
const currentPage = getResolvedPageByPathname(resolvedConfig, currentPathname);
|
|
1006
|
-
return {
|
|
1007
|
-
locale: "en",
|
|
1008
|
-
codeBlockChoices: docsCodeBlockChoiceStore,
|
|
1009
|
-
localizeHref: (href) => {
|
|
1010
|
-
if (href.startsWith("#") || isExternalHref(href)) {
|
|
1011
|
-
return href;
|
|
1012
|
-
}
|
|
1013
|
-
const { pathname, hash } = splitHref(href);
|
|
1014
|
-
const docsPathname = toDocsPathname(resolvedConfig.basePath, pathname);
|
|
1015
|
-
const page = docsPathname ? getResolvedPageByPathname(resolvedConfig, docsPathname) : null;
|
|
1016
|
-
if (!page) {
|
|
1017
|
-
return withSiteBaseUrl(href);
|
|
1018
|
-
}
|
|
1019
|
-
return withSiteBaseUrl(`${page.href}${hash}`);
|
|
1020
|
-
},
|
|
1021
|
-
resolveDocLink: ({ href }) => resolveDocLink({
|
|
1022
|
-
resolvedConfig,
|
|
1023
|
-
currentPathname,
|
|
1024
|
-
href
|
|
1025
|
-
}),
|
|
1026
|
-
resolveOverviewItem: (id) => resolveOverviewItem({
|
|
1027
|
-
resolvedConfig,
|
|
1028
|
-
id
|
|
1029
|
-
}),
|
|
1030
|
-
t: (group, key) => {
|
|
1031
|
-
if (group === "docs" && key === "onThisPage") {
|
|
1032
|
-
return "On this page";
|
|
1033
|
-
}
|
|
1034
|
-
if (group === "docs" && key === "previous") {
|
|
1035
|
-
return "Previous";
|
|
1036
|
-
}
|
|
1037
|
-
if (group === "docs" && key === "next") {
|
|
1038
|
-
return "Next";
|
|
1039
|
-
}
|
|
1040
|
-
if (group === "docs" && key === "currentSection") {
|
|
1041
|
-
return activeSection?.navTitle ?? currentPage?.title ?? "Docs";
|
|
1042
|
-
}
|
|
1043
|
-
return key;
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
|
-
};
|
|
1047
|
-
|
|
1048
|
-
// src/runtime/DocsPage.tsx
|
|
1049
|
-
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1050
|
-
var DocsPage = ({ Content, docsConfig }) => {
|
|
1051
|
-
const pageContext = usePageContext3();
|
|
1052
|
-
const { activeSectionId, page, sidebarSections, headings, footer, previousPage, nextPage } = useData2();
|
|
1053
|
-
const resolvedConfig = resolveDocsConfig(docsConfig);
|
|
1054
|
-
return /* @__PURE__ */ jsxs12(
|
|
1055
|
-
UniversalMdxProvider,
|
|
1056
|
-
{
|
|
1057
|
-
value: getMdxRuntimeValue({
|
|
1058
|
-
docsConfig,
|
|
1059
|
-
currentPathname: pageContext.urlPathname
|
|
1060
|
-
}),
|
|
1061
|
-
children: [
|
|
1062
|
-
/* @__PURE__ */ jsx13("div", { className: "absolute top-0 left-0 w-full h-[60svh] bg-radial-[at_65%_-85%] from-primary-muted-light to-65%" }),
|
|
1063
|
-
/* @__PURE__ */ jsx13(LayoutComponent, { children: /* @__PURE__ */ jsxs12("div", { className: "lg:flex lg:gap-10 xl:gap-14", children: [
|
|
1064
|
-
/* @__PURE__ */ jsx13(Sidebar, { sections: sidebarSections, activeSectionId, currentHref: page.href }),
|
|
1065
|
-
/* @__PURE__ */ jsxs12("main", { className: "mt-10 min-w-0 flex-1 basis-auto shrink", children: [
|
|
1066
|
-
/* @__PURE__ */ jsxs12(ProseContainer, { "data-doc-content": "", children: [
|
|
1067
|
-
/* @__PURE__ */ jsx13("h1", { className: "scroll-mt-24", children: renderInlineMarkdown(page.title) }),
|
|
1068
|
-
/* @__PURE__ */ jsx13(Content, {})
|
|
1069
|
-
] }),
|
|
1070
|
-
footer.pagination ? /* @__PURE__ */ jsx13(DocsPagination, { previousPage, nextPage }) : null,
|
|
1071
|
-
/* @__PURE__ */ jsx13(DocsFooter, { brand: resolvedConfig.brand })
|
|
1072
|
-
] }),
|
|
1073
|
-
/* @__PURE__ */ jsx13(TableOfContents, { headings, partners: resolvedConfig.partners })
|
|
1074
|
-
] }) })
|
|
1075
|
-
]
|
|
1076
|
-
}
|
|
1077
|
-
);
|
|
1078
|
-
};
|
|
1079
|
-
|
|
1080
|
-
export {
|
|
1081
|
-
LayoutComponent,
|
|
1082
|
-
useDocsUserSettingsStore,
|
|
1083
|
-
DEFAULT_THEME_PREFERENCE,
|
|
1084
|
-
applyThemePreference,
|
|
1085
|
-
UserSettingsSync,
|
|
1086
|
-
AppLayout,
|
|
1087
|
-
MetaHead,
|
|
1088
|
-
ProseContainer,
|
|
1089
|
-
DocsPage
|
|
1090
|
-
};
|
|
1091
|
-
//# sourceMappingURL=chunk-62MBEYU7.js.map
|