ardo 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/{Features-BlVr5s_C.d.ts → Features-rHF_bj67.d.ts} +27 -12
  2. package/dist/Search-RJRSEY42.js +9 -0
  3. package/dist/Search-RJRSEY42.js.map +1 -0
  4. package/dist/{chunk-EOV2OUTW.js → chunk-3O2PF4HA.js} +2 -42
  5. package/dist/chunk-3O2PF4HA.js.map +1 -0
  6. package/dist/{chunk-PCMPLBJA.js → chunk-5K5L7ZYS.js} +15 -16
  7. package/dist/chunk-5K5L7ZYS.js.map +1 -0
  8. package/dist/{chunk-4IRLOOXV.js → chunk-7L64KVOU.js} +110 -1
  9. package/dist/chunk-7L64KVOU.js.map +1 -0
  10. package/dist/{chunk-FGRL2G4S.js → chunk-BH7JD5XJ.js} +2 -1
  11. package/dist/chunk-BH7JD5XJ.js.map +1 -0
  12. package/dist/chunk-FZP2AVJL.js +43 -0
  13. package/dist/chunk-FZP2AVJL.js.map +1 -0
  14. package/dist/chunk-GAYGMYIS.js +194 -0
  15. package/dist/chunk-GAYGMYIS.js.map +1 -0
  16. package/dist/{chunk-O64PX2AK.js → chunk-M5VLOQYV.js} +2 -2
  17. package/dist/chunk-MJQGGJQZ.js +88 -0
  18. package/dist/chunk-MJQGGJQZ.js.map +1 -0
  19. package/dist/{chunk-2L4ZS6W2.js → chunk-NJWWPDO2.js} +23 -14
  20. package/dist/chunk-NJWWPDO2.js.map +1 -0
  21. package/dist/chunk-X7MG5VTZ.js +682 -0
  22. package/dist/chunk-X7MG5VTZ.js.map +1 -0
  23. package/dist/config/index.d.ts +4 -3
  24. package/dist/config/index.js +3 -1
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +15 -10
  27. package/dist/mdx/provider.js +4 -2
  28. package/dist/mdx/provider.js.map +1 -1
  29. package/dist/runtime/index.d.ts +1 -1
  30. package/dist/runtime/index.js +5 -3
  31. package/dist/typedoc/index.d.ts +2 -0
  32. package/dist/typedoc/index.js +2 -2
  33. package/dist/{types-tjxB5eh7.d.ts → types-DSD5zwMd.d.ts} +6 -1
  34. package/dist/ui/icons/alert-triangle.svg +1 -0
  35. package/dist/ui/icons/check.svg +1 -0
  36. package/dist/ui/icons/chevron-down.svg +1 -0
  37. package/dist/ui/icons/copy.svg +1 -0
  38. package/dist/ui/icons/file-text.svg +1 -0
  39. package/dist/ui/icons/github.svg +1 -0
  40. package/dist/ui/icons/info.svg +1 -0
  41. package/dist/ui/icons/lightbulb.svg +1 -0
  42. package/dist/ui/icons/linkedin.svg +1 -0
  43. package/dist/ui/icons/message-circle.svg +1 -0
  44. package/dist/ui/icons/monitor.svg +1 -0
  45. package/dist/ui/icons/moon.svg +1 -0
  46. package/dist/ui/icons/package.svg +1 -0
  47. package/dist/ui/icons/search.svg +1 -0
  48. package/dist/ui/icons/sun.svg +1 -0
  49. package/dist/ui/icons/twitter.svg +1 -0
  50. package/dist/ui/icons/x-circle.svg +1 -0
  51. package/dist/ui/icons/youtube.svg +1 -0
  52. package/dist/ui/index.d.ts +11 -7
  53. package/dist/ui/index.js +8 -4
  54. package/dist/ui/styles.css +117 -0
  55. package/dist/vite/index.d.ts +1 -1
  56. package/dist/vite/index.js +3 -3
  57. package/package.json +10 -2
  58. package/dist/chunk-2L4ZS6W2.js.map +0 -1
  59. package/dist/chunk-4IRLOOXV.js.map +0 -1
  60. package/dist/chunk-C4W4YI7C.js +0 -812
  61. package/dist/chunk-C4W4YI7C.js.map +0 -1
  62. package/dist/chunk-EOV2OUTW.js.map +0 -1
  63. package/dist/chunk-FGRL2G4S.js.map +0 -1
  64. package/dist/chunk-PCMPLBJA.js.map +0 -1
  65. /package/dist/{chunk-O64PX2AK.js.map → chunk-M5VLOQYV.js.map} +0 -0
@@ -1,812 +0,0 @@
1
- import {
2
- Content
3
- } from "./chunk-2L4ZS6W2.js";
4
- import {
5
- useConfig,
6
- usePageData,
7
- useTOC,
8
- useThemeConfig
9
- } from "./chunk-EOV2OUTW.js";
10
-
11
- // src/ui/Layout.tsx
12
- import { jsx, jsxs } from "react/jsx-runtime";
13
- function Layout({ header, sidebar, footer, children, className }) {
14
- return /* @__PURE__ */ jsxs("div", { className: className ?? "ardo-layout", children: [
15
- /* @__PURE__ */ jsx("a", { href: "#main-content", className: "ardo-skip-link", children: "Skip to content" }),
16
- header,
17
- /* @__PURE__ */ jsxs("div", { className: "ardo-layout-container", children: [
18
- sidebar,
19
- /* @__PURE__ */ jsx("main", { id: "main-content", className: "ardo-main", children })
20
- ] }),
21
- footer
22
- ] });
23
- }
24
-
25
- // src/ui/Header.tsx
26
- import { useState as useState3 } from "react";
27
- import { Link as Link2 } from "react-router";
28
- import { Github, Twitter, MessageCircle, Linkedin, Youtube, Package } from "lucide-react";
29
-
30
- // src/ui/components/ThemeToggle.tsx
31
- import { useState, useEffect } from "react";
32
- import { Sun, Moon, Monitor } from "lucide-react";
33
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
34
- function ThemeToggle() {
35
- const [theme, setTheme] = useState("system");
36
- const [mounted, setMounted] = useState(false);
37
- useEffect(() => {
38
- setMounted(true);
39
- const stored = localStorage.getItem("ardo-theme");
40
- if (stored) {
41
- setTheme(stored);
42
- applyTheme(stored);
43
- } else {
44
- applyTheme("system");
45
- }
46
- }, []);
47
- const toggleTheme = () => {
48
- const nextTheme = theme === "light" ? "dark" : theme === "dark" ? "system" : "light";
49
- setTheme(nextTheme);
50
- localStorage.setItem("ardo-theme", nextTheme);
51
- applyTheme(nextTheme);
52
- };
53
- if (!mounted) {
54
- return /* @__PURE__ */ jsx2("button", { className: "ardo-theme-toggle", "aria-label": "Toggle theme", children: /* @__PURE__ */ jsx2("span", { className: "ardo-theme-icon", children: /* @__PURE__ */ jsx2(Sun, { size: 20 }) }) });
55
- }
56
- return /* @__PURE__ */ jsx2(
57
- "button",
58
- {
59
- className: "ardo-theme-toggle",
60
- onClick: toggleTheme,
61
- "aria-label": `Switch to ${theme === "light" ? "dark" : theme === "dark" ? "system" : "light"} theme`,
62
- children: /* @__PURE__ */ jsxs2("span", { className: "ardo-theme-icon", children: [
63
- theme === "light" && /* @__PURE__ */ jsx2(Sun, { size: 20 }),
64
- theme === "dark" && /* @__PURE__ */ jsx2(Moon, { size: 20 }),
65
- theme === "system" && /* @__PURE__ */ jsx2(Monitor, { size: 20 })
66
- ] })
67
- }
68
- );
69
- }
70
- function applyTheme(theme) {
71
- const root = document.documentElement;
72
- if (theme === "system") {
73
- const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
74
- root.classList.toggle("dark", isDark);
75
- root.classList.toggle("light", !isDark);
76
- } else {
77
- root.classList.toggle("dark", theme === "dark");
78
- root.classList.toggle("light", theme === "light");
79
- }
80
- }
81
-
82
- // src/ui/components/Search.tsx
83
- import { useState as useState2, useEffect as useEffect2, useRef, useMemo } from "react";
84
- import { Link, useNavigate } from "react-router";
85
- import MiniSearch from "minisearch";
86
- import searchDocs from "virtual:ardo/search-index";
87
- import { Search as SearchIcon } from "lucide-react";
88
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
89
- function Search() {
90
- const navigate = useNavigate();
91
- const [isOpen, setIsOpen] = useState2(false);
92
- const [query, setQuery] = useState2("");
93
- const [results, setResults] = useState2([]);
94
- const [selectedIndex, setSelectedIndex] = useState2(0);
95
- const containerRef = useRef(null);
96
- const inputRef = useRef(null);
97
- const themeConfig = useThemeConfig();
98
- const hasQuery = query.trim().length > 0;
99
- const placeholder = themeConfig.search?.placeholder ?? "Search...";
100
- useEffect2(() => {
101
- const handleKeyDown2 = (e) => {
102
- if ((e.metaKey || e.ctrlKey) && e.key === "k") {
103
- e.preventDefault();
104
- inputRef.current?.focus();
105
- setIsOpen(true);
106
- }
107
- if (e.key === "Escape") {
108
- setIsOpen(false);
109
- }
110
- };
111
- document.addEventListener("keydown", handleKeyDown2);
112
- return () => document.removeEventListener("keydown", handleKeyDown2);
113
- }, []);
114
- useEffect2(() => {
115
- if (isOpen && inputRef.current) {
116
- inputRef.current.focus();
117
- }
118
- }, [isOpen]);
119
- useEffect2(() => {
120
- if (!isOpen) {
121
- return;
122
- }
123
- const handleOutsideClick = (e) => {
124
- if (containerRef.current && !containerRef.current.contains(e.target)) {
125
- setIsOpen(false);
126
- }
127
- };
128
- document.addEventListener("mousedown", handleOutsideClick);
129
- document.addEventListener("touchstart", handleOutsideClick);
130
- return () => {
131
- document.removeEventListener("mousedown", handleOutsideClick);
132
- document.removeEventListener("touchstart", handleOutsideClick);
133
- };
134
- }, [isOpen]);
135
- const searchIndex = useMemo(() => {
136
- const index = new MiniSearch({
137
- fields: ["title", "content", "section"],
138
- storeFields: ["title", "path", "section"],
139
- searchOptions: {
140
- boost: { title: 2 },
141
- fuzzy: 0.2,
142
- prefix: true
143
- }
144
- });
145
- index.addAll(searchDocs);
146
- return index;
147
- }, []);
148
- const handleSearch = (searchQuery) => {
149
- setQuery(searchQuery);
150
- if (!searchQuery.trim()) {
151
- setResults([]);
152
- setIsOpen(false);
153
- setSelectedIndex(0);
154
- return;
155
- }
156
- const searchResults = searchIndex.search(searchQuery).slice(0, 10);
157
- setResults(searchResults);
158
- setSelectedIndex(0);
159
- setIsOpen(true);
160
- };
161
- const handleKeyDown = (e) => {
162
- if (e.key === "ArrowDown" && results.length > 0) {
163
- e.preventDefault();
164
- setSelectedIndex((prev) => Math.min(prev + 1, results.length - 1));
165
- } else if (e.key === "ArrowUp" && results.length > 0) {
166
- e.preventDefault();
167
- setSelectedIndex((prev) => Math.max(prev - 1, 0));
168
- } else if (e.key === "Enter" && results[selectedIndex]) {
169
- e.preventDefault();
170
- const result = results[selectedIndex];
171
- navigate(result.path);
172
- setIsOpen(false);
173
- } else if (e.key === "Escape") {
174
- setIsOpen(false);
175
- inputRef.current?.blur();
176
- }
177
- };
178
- return /* @__PURE__ */ jsxs3(
179
- "div",
180
- {
181
- className: "ardo-search",
182
- ref: containerRef,
183
- "data-expanded": isOpen || hasQuery ? "true" : "false",
184
- onClick: () => inputRef.current?.focus(),
185
- children: [
186
- /* @__PURE__ */ jsxs3("div", { className: "ardo-search-field", children: [
187
- /* @__PURE__ */ jsx3(SearchIcon, { size: 18 }),
188
- /* @__PURE__ */ jsx3(
189
- "input",
190
- {
191
- ref: inputRef,
192
- type: "text",
193
- className: "ardo-search-input",
194
- placeholder,
195
- value: query,
196
- onChange: (e) => handleSearch(e.target.value),
197
- onKeyDown: handleKeyDown,
198
- onFocus: () => {
199
- if (hasQuery) {
200
- setIsOpen(true);
201
- }
202
- },
203
- "aria-expanded": isOpen,
204
- "aria-label": "Search"
205
- }
206
- ),
207
- query && /* @__PURE__ */ jsx3(
208
- "button",
209
- {
210
- type: "button",
211
- className: "ardo-search-clear",
212
- onClick: (e) => {
213
- e.stopPropagation();
214
- handleSearch("");
215
- inputRef.current?.focus();
216
- },
217
- "aria-label": "Clear search",
218
- children: "\xD7"
219
- }
220
- ),
221
- /* @__PURE__ */ jsxs3("span", { className: "ardo-search-kbd", children: [
222
- /* @__PURE__ */ jsx3("kbd", { children: "\u2318" }),
223
- /* @__PURE__ */ jsx3("kbd", { children: "K" })
224
- ] })
225
- ] }),
226
- isOpen && hasQuery && /* @__PURE__ */ jsxs3("div", { className: "ardo-search-popover", children: [
227
- results.length > 0 && /* @__PURE__ */ jsx3("ul", { className: "ardo-search-results", children: results.map((result, index) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsxs3(
228
- Link,
229
- {
230
- to: result.path,
231
- className: ["ardo-search-result", index === selectedIndex && "selected"].filter(Boolean).join(" "),
232
- onClick: () => setIsOpen(false),
233
- children: [
234
- /* @__PURE__ */ jsx3("span", { className: "ardo-search-result-title", children: result.title }),
235
- result.section && /* @__PURE__ */ jsx3("span", { className: "ardo-search-result-section", children: result.section })
236
- ]
237
- }
238
- ) }, result.id)) }),
239
- query && results.length === 0 && /* @__PURE__ */ jsxs3("div", { className: "ardo-search-no-results", children: [
240
- 'No results found for "',
241
- query,
242
- '"'
243
- ] }),
244
- /* @__PURE__ */ jsxs3("div", { className: "ardo-search-footer", children: [
245
- /* @__PURE__ */ jsxs3("span", { children: [
246
- /* @__PURE__ */ jsx3("kbd", { children: "\u2191" }),
247
- " ",
248
- /* @__PURE__ */ jsx3("kbd", { children: "\u2193" }),
249
- " to navigate"
250
- ] }),
251
- /* @__PURE__ */ jsxs3("span", { children: [
252
- /* @__PURE__ */ jsx3("kbd", { children: "\u21B5" }),
253
- " to select"
254
- ] }),
255
- /* @__PURE__ */ jsxs3("span", { children: [
256
- /* @__PURE__ */ jsx3("kbd", { children: "esc" }),
257
- " to close"
258
- ] })
259
- ] })
260
- ] })
261
- ]
262
- }
263
- );
264
- }
265
-
266
- // src/ui/Header.tsx
267
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
268
- function Header({
269
- logo,
270
- title,
271
- nav,
272
- actions,
273
- search = true,
274
- themeToggle = true,
275
- className
276
- }) {
277
- const [mobileMenuOpen, setMobileMenuOpen] = useState3(false);
278
- return /* @__PURE__ */ jsxs4("header", { className: className ?? "ardo-header", children: [
279
- /* @__PURE__ */ jsxs4("div", { className: "ardo-header-container", children: [
280
- /* @__PURE__ */ jsxs4("div", { className: "ardo-header-left", children: [
281
- /* @__PURE__ */ jsx4(
282
- "button",
283
- {
284
- className: "ardo-mobile-menu-button",
285
- onClick: () => setMobileMenuOpen(!mobileMenuOpen),
286
- "aria-label": "Toggle menu",
287
- "aria-expanded": mobileMenuOpen,
288
- children: /* @__PURE__ */ jsxs4("span", { className: "ardo-hamburger", children: [
289
- /* @__PURE__ */ jsx4("span", {}),
290
- /* @__PURE__ */ jsx4("span", {}),
291
- /* @__PURE__ */ jsx4("span", {})
292
- ] })
293
- }
294
- ),
295
- /* @__PURE__ */ jsxs4(Link2, { to: "/", className: "ardo-logo-link", children: [
296
- logo && /* @__PURE__ */ jsx4(
297
- "img",
298
- {
299
- src: typeof logo === "string" ? logo : logo.light,
300
- alt: title ?? "Logo",
301
- className: "ardo-logo"
302
- }
303
- ),
304
- title && /* @__PURE__ */ jsx4("span", { className: "ardo-site-title", children: title })
305
- ] })
306
- ] }),
307
- nav && /* @__PURE__ */ jsx4("div", { className: "ardo-nav", children: nav }),
308
- /* @__PURE__ */ jsxs4("div", { className: "ardo-header-right", children: [
309
- search && /* @__PURE__ */ jsx4(Search, {}),
310
- themeToggle && /* @__PURE__ */ jsx4(ThemeToggle, {}),
311
- actions
312
- ] })
313
- ] }),
314
- mobileMenuOpen && /* @__PURE__ */ jsx4("div", { className: "ardo-mobile-menu", children: /* @__PURE__ */ jsx4("nav", { className: "ardo-mobile-nav", onClick: () => setMobileMenuOpen(false), children: nav }) })
315
- ] });
316
- }
317
- function SocialLink({ href, icon, ariaLabel, className }) {
318
- return /* @__PURE__ */ jsx4(
319
- "a",
320
- {
321
- href,
322
- target: "_blank",
323
- rel: "noopener noreferrer",
324
- className: className ?? "ardo-social-link",
325
- "aria-label": ariaLabel ?? icon,
326
- children: /* @__PURE__ */ jsx4(SocialIcon, { icon })
327
- }
328
- );
329
- }
330
- var socialIcons = {
331
- github: Github,
332
- twitter: Twitter,
333
- discord: MessageCircle,
334
- linkedin: Linkedin,
335
- youtube: Youtube,
336
- npm: Package
337
- };
338
- function SocialIcon({ icon }) {
339
- const IconComponent = socialIcons[icon] ?? Github;
340
- return /* @__PURE__ */ jsx4(IconComponent, { size: 20 });
341
- }
342
-
343
- // src/ui/Sidebar.tsx
344
- import {
345
- useState as useState4,
346
- Children,
347
- isValidElement,
348
- createContext,
349
- useContext
350
- } from "react";
351
- import { NavLink, useLocation } from "react-router";
352
- import { ChevronDown } from "lucide-react";
353
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
354
- var SidebarContext = createContext({ currentPath: "" });
355
- function useSidebarContext() {
356
- return useContext(SidebarContext);
357
- }
358
- function Sidebar({ items, children, className }) {
359
- const { pathname } = useLocation();
360
- return /* @__PURE__ */ jsx5(SidebarContext.Provider, { value: { currentPath: pathname }, children: /* @__PURE__ */ jsx5("aside", { className: className ?? "ardo-sidebar", children: /* @__PURE__ */ jsx5("nav", { className: "ardo-sidebar-nav", "aria-label": "Main navigation", children: items ? /* @__PURE__ */ jsx5(SidebarItems, { items, depth: 0 }) : /* @__PURE__ */ jsx5("ul", { className: "ardo-sidebar-list ardo-sidebar-list-0", children }) }) }) });
361
- }
362
- function SidebarGroup({
363
- title,
364
- to,
365
- collapsed: initialCollapsed = false,
366
- collapsible = true,
367
- children,
368
- className
369
- }) {
370
- const [collapsed, setCollapsed] = useState4(initialCollapsed);
371
- const { currentPath } = useSidebarContext();
372
- const isChildActive = checkChildrenActive(children, currentPath);
373
- const textClassName = ["ardo-sidebar-text", isChildActive && "child-active"].filter(Boolean).join(" ");
374
- const linkClassName = ["ardo-sidebar-link", isChildActive && "child-active"].filter(Boolean).join(" ");
375
- const hasChildren = Children.count(children) > 0;
376
- return /* @__PURE__ */ jsxs5("li", { className: className ?? "ardo-sidebar-item", children: [
377
- /* @__PURE__ */ jsxs5("div", { className: "ardo-sidebar-item-header", children: [
378
- to ? /* @__PURE__ */ jsx5(
379
- NavLink,
380
- {
381
- to,
382
- className: ({ isActive }) => [linkClassName, isActive && "active"].filter(Boolean).join(" "),
383
- children: title
384
- }
385
- ) : /* @__PURE__ */ jsx5(
386
- "span",
387
- {
388
- className: textClassName,
389
- onClick: () => collapsible && hasChildren && setCollapsed(!collapsed),
390
- style: collapsible && hasChildren ? { cursor: "pointer" } : void 0,
391
- children: title
392
- }
393
- ),
394
- collapsible && hasChildren && /* @__PURE__ */ jsx5(
395
- "button",
396
- {
397
- className: ["ardo-sidebar-collapse", collapsed && "collapsed"].filter(Boolean).join(" "),
398
- onClick: () => setCollapsed(!collapsed),
399
- "aria-label": collapsed ? "Expand" : "Collapse",
400
- children: /* @__PURE__ */ jsx5(ChevronDown, { size: 16 })
401
- }
402
- )
403
- ] }),
404
- hasChildren && !collapsed && /* @__PURE__ */ jsx5("ul", { className: "ardo-sidebar-list ardo-sidebar-list-1", children })
405
- ] });
406
- }
407
- function SidebarLink({ to, children, className }) {
408
- const baseClassName = className ?? "ardo-sidebar-link";
409
- return /* @__PURE__ */ jsx5("li", { className: "ardo-sidebar-item", children: /* @__PURE__ */ jsx5(
410
- NavLink,
411
- {
412
- to,
413
- className: ({ isActive }) => [baseClassName, isActive && "active"].filter(Boolean).join(" "),
414
- children
415
- }
416
- ) });
417
- }
418
- function SidebarItems({ items, depth }) {
419
- return /* @__PURE__ */ jsx5("ul", { className: `ardo-sidebar-list ardo-sidebar-list-${depth}`, children: items.map((item, index) => /* @__PURE__ */ jsx5(SidebarItemComponent, { item, depth }, index)) });
420
- }
421
- function SidebarItemComponent({ item, depth }) {
422
- const { currentPath } = useSidebarContext();
423
- const [collapsed, setCollapsed] = useState4(item.collapsed ?? false);
424
- const hasChildren = item.items && item.items.length > 0;
425
- const isChildActive = hasChildren && item.items.some(
426
- (child) => child.link === currentPath || child.items && child.items.some((grandchild) => grandchild.link === currentPath)
427
- );
428
- const linkClassName = ["ardo-sidebar-link", isChildActive && "child-active"].filter(Boolean).join(" ");
429
- const textClassName = ["ardo-sidebar-text", isChildActive && "child-active"].filter(Boolean).join(" ");
430
- return /* @__PURE__ */ jsxs5("li", { className: "ardo-sidebar-item", children: [
431
- /* @__PURE__ */ jsxs5("div", { className: "ardo-sidebar-item-header", children: [
432
- item.link ? /* @__PURE__ */ jsx5(
433
- NavLink,
434
- {
435
- to: item.link,
436
- className: ({ isActive }) => [linkClassName, isActive && "active"].filter(Boolean).join(" "),
437
- children: item.text
438
- }
439
- ) : /* @__PURE__ */ jsx5("span", { className: textClassName, onClick: () => hasChildren && setCollapsed(!collapsed), children: item.text }),
440
- hasChildren && /* @__PURE__ */ jsx5(
441
- "button",
442
- {
443
- className: ["ardo-sidebar-collapse", collapsed && "collapsed"].filter(Boolean).join(" "),
444
- onClick: () => setCollapsed(!collapsed),
445
- "aria-label": collapsed ? "Expand" : "Collapse",
446
- children: /* @__PURE__ */ jsx5(ChevronDown, { size: 16 })
447
- }
448
- )
449
- ] }),
450
- hasChildren && !collapsed && /* @__PURE__ */ jsx5(SidebarItems, { items: item.items, depth: depth + 1 })
451
- ] });
452
- }
453
- function checkChildrenActive(children, currentPath) {
454
- let isActive = false;
455
- Children.forEach(children, (child) => {
456
- if (isActive) return;
457
- if (isValidElement(child)) {
458
- if (child.type === SidebarLink && child.props.to === currentPath) {
459
- isActive = true;
460
- return;
461
- }
462
- if (child.type === SidebarGroup) {
463
- const groupProps = child.props;
464
- if (groupProps.to === currentPath) {
465
- isActive = true;
466
- return;
467
- }
468
- if (groupProps.children && checkChildrenActive(groupProps.children, currentPath)) {
469
- isActive = true;
470
- return;
471
- }
472
- }
473
- }
474
- });
475
- return isActive;
476
- }
477
-
478
- // src/ui/Footer.tsx
479
- import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
480
- function Footer({ message, copyright, children, className }) {
481
- const hasContent = message || copyright || children;
482
- if (!hasContent) {
483
- return null;
484
- }
485
- return /* @__PURE__ */ jsx6("footer", { className: className ?? "ardo-footer", children: /* @__PURE__ */ jsx6("div", { className: "ardo-footer-container", children: children ?? /* @__PURE__ */ jsxs6(Fragment, { children: [
486
- message && /* @__PURE__ */ jsx6("p", { className: "ardo-footer-message", dangerouslySetInnerHTML: { __html: message } }),
487
- copyright && /* @__PURE__ */ jsx6(
488
- "p",
489
- {
490
- className: "ardo-footer-copyright",
491
- dangerouslySetInnerHTML: { __html: copyright }
492
- }
493
- )
494
- ] }) }) });
495
- }
496
-
497
- // src/ui/Nav.tsx
498
- import { useState as useState5, createContext as createContext2, useContext as useContext2 } from "react";
499
- import { NavLink as RouterNavLink } from "react-router";
500
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
501
- var NavContext = createContext2(null);
502
- function useNavContext() {
503
- return useContext2(NavContext);
504
- }
505
- function Nav({ children, className }) {
506
- return /* @__PURE__ */ jsx7("nav", { className: className ?? "ardo-nav", children });
507
- }
508
- function NavLink2({
509
- to,
510
- href,
511
- children,
512
- className,
513
- activeMatch: _activeMatch
514
- }) {
515
- const navContext = useNavContext();
516
- const baseClassName = className ?? "ardo-nav-link";
517
- const handleClick = () => {
518
- navContext?.setMobileMenuOpen(false);
519
- };
520
- if (href) {
521
- return /* @__PURE__ */ jsx7(
522
- "a",
523
- {
524
- href,
525
- className: baseClassName,
526
- target: "_blank",
527
- rel: "noopener noreferrer",
528
- onClick: handleClick,
529
- children
530
- }
531
- );
532
- }
533
- if (to) {
534
- return /* @__PURE__ */ jsx7(
535
- RouterNavLink,
536
- {
537
- to,
538
- className: ({ isActive }) => [baseClassName, isActive && "active"].filter(Boolean).join(" "),
539
- onClick: handleClick,
540
- children
541
- }
542
- );
543
- }
544
- return /* @__PURE__ */ jsx7("span", { className: baseClassName, children });
545
- }
546
- function NavDropdown({ text, children, className }) {
547
- const [open, setOpen] = useState5(false);
548
- return /* @__PURE__ */ jsxs7(
549
- "div",
550
- {
551
- className: className ?? "ardo-nav-dropdown",
552
- onMouseEnter: () => setOpen(true),
553
- onMouseLeave: () => setOpen(false),
554
- children: [
555
- /* @__PURE__ */ jsxs7("button", { className: "ardo-nav-dropdown-button", children: [
556
- text,
557
- /* @__PURE__ */ jsx7("span", { className: "ardo-nav-dropdown-icon", children: "\u25BC" })
558
- ] }),
559
- open && /* @__PURE__ */ jsx7("div", { className: "ardo-nav-dropdown-menu", children })
560
- ]
561
- }
562
- );
563
- }
564
-
565
- // src/ui/TOC.tsx
566
- import { useState as useState6, useEffect as useEffect3 } from "react";
567
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
568
- function TOC() {
569
- const toc = useTOC();
570
- const themeConfig = useThemeConfig();
571
- const [activeId, setActiveId] = useState6("");
572
- const label = themeConfig.outline?.label ?? "On this page";
573
- useEffect3(() => {
574
- if (toc.length === 0) return;
575
- const headingElements = toc.map((item) => document.getElementById(item.id)).filter(Boolean);
576
- if (headingElements.length === 0) return;
577
- const observer = new IntersectionObserver(
578
- (entries) => {
579
- for (const entry of entries) {
580
- if (entry.isIntersecting) {
581
- setActiveId(entry.target.id);
582
- break;
583
- }
584
- }
585
- },
586
- {
587
- rootMargin: "-80px 0px -80% 0px",
588
- threshold: 0
589
- }
590
- );
591
- headingElements.forEach((el) => el && observer.observe(el));
592
- return () => {
593
- headingElements.forEach((el) => el && observer.unobserve(el));
594
- };
595
- }, [toc]);
596
- if (toc.length === 0) {
597
- return null;
598
- }
599
- return /* @__PURE__ */ jsx8("aside", { className: "ardo-toc", children: /* @__PURE__ */ jsxs8("div", { className: "ardo-toc-container", children: [
600
- /* @__PURE__ */ jsx8("h3", { className: "ardo-toc-title", children: label }),
601
- /* @__PURE__ */ jsx8("nav", { className: "ardo-toc-nav", "aria-label": "Table of contents", children: /* @__PURE__ */ jsx8(TOCItems, { items: toc, activeId }) })
602
- ] }) });
603
- }
604
- function TOCItems({ items, activeId }) {
605
- return /* @__PURE__ */ jsx8("ul", { className: "ardo-toc-list", children: items.map((item) => /* @__PURE__ */ jsx8(TOCItemComponent, { item, activeId }, item.id)) });
606
- }
607
- function TOCItemComponent({ item, activeId }) {
608
- const isActive = item.id === activeId;
609
- const hasActiveChild = hasActiveDescendant(item, activeId);
610
- return /* @__PURE__ */ jsxs8("li", { className: "ardo-toc-item", children: [
611
- /* @__PURE__ */ jsx8(
612
- "a",
613
- {
614
- href: `#${item.id}`,
615
- className: [
616
- `ardo-toc-link ardo-toc-link-${item.level}`,
617
- isActive && "active",
618
- hasActiveChild && "child-active"
619
- ].filter(Boolean).join(" "),
620
- onClick: (e) => {
621
- e.preventDefault();
622
- const element = document.getElementById(item.id);
623
- if (element) {
624
- element.scrollIntoView({ behavior: "smooth" });
625
- window.history.pushState(null, "", `#${item.id}`);
626
- }
627
- },
628
- children: item.text
629
- }
630
- ),
631
- item.children && item.children.length > 0 && /* @__PURE__ */ jsx8(TOCItems, { items: item.children, activeId })
632
- ] });
633
- }
634
- function hasActiveDescendant(item, activeId) {
635
- if (!item.children) return false;
636
- for (const child of item.children) {
637
- if (child.id === activeId) return true;
638
- if (hasActiveDescendant(child, activeId)) return true;
639
- }
640
- return false;
641
- }
642
-
643
- // src/ui/DocPage.tsx
644
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
645
- function DocPage({ children }) {
646
- const pageData = usePageData();
647
- const showToc = pageData?.frontmatter.outline !== false && pageData?.toc && pageData.toc.length > 0;
648
- return /* @__PURE__ */ jsx9(Layout, { children: /* @__PURE__ */ jsxs9("div", { className: "ardo-doc-page", children: [
649
- /* @__PURE__ */ jsx9(Content, { children }),
650
- showToc && /* @__PURE__ */ jsx9(TOC, {})
651
- ] }) });
652
- }
653
- function DocContent({ children }) {
654
- const pageData = usePageData();
655
- const showToc = pageData?.frontmatter.outline !== false && pageData?.toc && pageData.toc.length > 0;
656
- return /* @__PURE__ */ jsxs9("div", { className: "ardo-doc-page", children: [
657
- /* @__PURE__ */ jsx9(Content, { children }),
658
- showToc && /* @__PURE__ */ jsx9(TOC, {})
659
- ] });
660
- }
661
- function DocLayout({ content }) {
662
- return /* @__PURE__ */ jsx9(DocPage, { children: content });
663
- }
664
-
665
- // src/ui/HomePage.tsx
666
- import { Link as Link3 } from "react-router";
667
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
668
- function HomePage() {
669
- const pageData = usePageData();
670
- const config = useConfig();
671
- const themeConfig = useThemeConfig();
672
- const hero = pageData?.frontmatter.hero;
673
- const features = pageData?.frontmatter.features;
674
- return /* @__PURE__ */ jsxs10("div", { className: "ardo-home", children: [
675
- /* @__PURE__ */ jsx10(
676
- Header,
677
- {
678
- logo: themeConfig.logo,
679
- title: themeConfig.siteTitle !== false ? config.title : void 0,
680
- nav: themeConfig.nav && themeConfig.nav.length > 0 ? /* @__PURE__ */ jsx10(Nav, { children: themeConfig.nav.map((item, index) => /* @__PURE__ */ jsx10(NavLink2, { to: item.link, children: item.text }, index)) }) : void 0,
681
- actions: themeConfig.socialLinks?.map((link, index) => /* @__PURE__ */ jsx10(SocialLink, { href: link.link, icon: link.icon, ariaLabel: link.ariaLabel }, index))
682
- }
683
- ),
684
- /* @__PURE__ */ jsxs10("main", { className: "ardo-home-main", children: [
685
- hero && /* @__PURE__ */ jsx10("section", { className: "ardo-hero", children: /* @__PURE__ */ jsxs10("div", { className: "ardo-hero-container", children: [
686
- hero.image && /* @__PURE__ */ jsx10("div", { className: "ardo-hero-image", children: /* @__PURE__ */ jsx10(
687
- "img",
688
- {
689
- src: typeof hero.image === "string" ? hero.image : hero.image.light,
690
- alt: hero.name || config.title
691
- }
692
- ) }),
693
- /* @__PURE__ */ jsxs10("div", { className: "ardo-hero-content", children: [
694
- hero.name && /* @__PURE__ */ jsx10("h1", { className: "ardo-hero-name", children: hero.name }),
695
- hero.text && /* @__PURE__ */ jsx10("p", { className: "ardo-hero-text", children: hero.text }),
696
- hero.tagline && /* @__PURE__ */ jsx10("p", { className: "ardo-hero-tagline", children: hero.tagline }),
697
- hero.actions && hero.actions.length > 0 && /* @__PURE__ */ jsx10("div", { className: "ardo-hero-actions", children: hero.actions.map((action, index) => /* @__PURE__ */ jsx10(
698
- Link3,
699
- {
700
- to: action.link,
701
- className: `ardo-hero-action ardo-hero-action-${action.theme || "brand"}`,
702
- children: action.text
703
- },
704
- index
705
- )) })
706
- ] })
707
- ] }) }),
708
- features && features.length > 0 && /* @__PURE__ */ jsx10("section", { className: "ardo-features", children: /* @__PURE__ */ jsx10("div", { className: "ardo-features-container", children: features.map((feature, index) => /* @__PURE__ */ jsxs10("div", { className: "ardo-feature", children: [
709
- feature.icon && /* @__PURE__ */ jsx10("div", { className: "ardo-feature-icon", children: feature.icon }),
710
- /* @__PURE__ */ jsx10("h3", { className: "ardo-feature-title", children: feature.title }),
711
- /* @__PURE__ */ jsx10("p", { className: "ardo-feature-details", children: feature.details }),
712
- feature.link && /* @__PURE__ */ jsx10(Link3, { to: feature.link, className: "ardo-feature-link", children: feature.linkText || "Learn more" })
713
- ] }, index)) }) })
714
- ] }),
715
- /* @__PURE__ */ jsx10(Footer, {})
716
- ] });
717
- }
718
-
719
- // src/ui/components/Hero.tsx
720
- import { Link as Link4 } from "react-router";
721
- import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
722
- function Hero({ name, text, tagline, image, actions, className }) {
723
- const imageUrl = typeof image === "string" ? image : image?.light;
724
- const imageAlt = typeof image === "string" ? name : image?.alt ?? name;
725
- return /* @__PURE__ */ jsx11("section", { className: className ?? "ardo-hero", children: /* @__PURE__ */ jsxs11("div", { className: "ardo-hero-container ardo-hero-animate", children: [
726
- image && /* @__PURE__ */ jsx11("div", { className: "ardo-hero-image", children: /* @__PURE__ */ jsx11("img", { src: imageUrl, alt: imageAlt }) }),
727
- /* @__PURE__ */ jsxs11("div", { className: "ardo-hero-content", children: [
728
- name && /* @__PURE__ */ jsx11("h1", { className: "ardo-hero-name", children: name }),
729
- text && /* @__PURE__ */ jsx11("p", { className: "ardo-hero-text", children: text }),
730
- tagline && /* @__PURE__ */ jsx11("p", { className: "ardo-hero-tagline", children: tagline }),
731
- actions && actions.length > 0 && /* @__PURE__ */ jsx11("div", { className: "ardo-hero-actions", children: actions.map((action, index) => {
732
- const link = action.link;
733
- const isExternal = typeof link === "string" && (link.startsWith("http://") || link.startsWith("https://"));
734
- const className2 = `ardo-hero-action ardo-hero-action-${action.theme || "brand"}`;
735
- const content = /* @__PURE__ */ jsxs11(Fragment2, { children: [
736
- action.icon,
737
- action.text
738
- ] });
739
- if (isExternal) {
740
- return /* @__PURE__ */ jsx11(
741
- "a",
742
- {
743
- href: link,
744
- className: className2,
745
- target: "_blank",
746
- rel: "noopener noreferrer",
747
- children: content
748
- },
749
- index
750
- );
751
- }
752
- return /* @__PURE__ */ jsx11(Link4, { to: link, className: className2, children: content }, index);
753
- }) })
754
- ] })
755
- ] }) });
756
- }
757
-
758
- // src/ui/components/Features.tsx
759
- import { Link as Link5 } from "react-router";
760
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
761
- function FeatureCard({
762
- title,
763
- icon,
764
- details,
765
- link,
766
- linkText,
767
- className,
768
- style
769
- }) {
770
- return /* @__PURE__ */ jsxs12("div", { className: className ?? "ardo-feature", style, children: [
771
- icon && /* @__PURE__ */ jsx12("div", { className: "ardo-feature-icon", children: icon }),
772
- /* @__PURE__ */ jsx12("h3", { className: "ardo-feature-title", children: title }),
773
- /* @__PURE__ */ jsx12("p", { className: "ardo-feature-details", children: details }),
774
- link && /* @__PURE__ */ jsx12(Link5, { to: link, className: "ardo-feature-link", children: linkText || "Learn more" })
775
- ] });
776
- }
777
- function Features({ items, title, subtitle, className }) {
778
- if (!items || items.length === 0) {
779
- return null;
780
- }
781
- return /* @__PURE__ */ jsxs12("section", { className: className ?? "ardo-features", children: [
782
- (title || subtitle) && /* @__PURE__ */ jsxs12("div", { className: "ardo-features-header", children: [
783
- title && /* @__PURE__ */ jsx12("h2", { className: "ardo-features-title", children: title }),
784
- subtitle && /* @__PURE__ */ jsx12("p", { className: "ardo-features-subtitle", children: subtitle })
785
- ] }),
786
- /* @__PURE__ */ jsx12("div", { className: "ardo-features-container", children: items.map((feature, index) => /* @__PURE__ */ jsx12(FeatureCard, { ...feature, style: { animationDelay: `${index * 80}ms` } }, index)) })
787
- ] });
788
- }
789
-
790
- export {
791
- Layout,
792
- ThemeToggle,
793
- Search,
794
- Header,
795
- SocialLink,
796
- Sidebar,
797
- SidebarGroup,
798
- SidebarLink,
799
- Footer,
800
- Nav,
801
- NavLink2 as NavLink,
802
- NavDropdown,
803
- TOC,
804
- DocPage,
805
- DocContent,
806
- DocLayout,
807
- HomePage,
808
- Hero,
809
- FeatureCard,
810
- Features
811
- };
812
- //# sourceMappingURL=chunk-C4W4YI7C.js.map