ardo 1.2.2 → 2.0.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 (43) hide show
  1. package/README.md +29 -47
  2. package/dist/{CopyButton-BkACwxQM.d.ts → Features-C_06EvGb.d.ts} +212 -10
  3. package/dist/{chunk-SZVJKB3V.js → chunk-G5L4ZUTS.js} +40 -40
  4. package/dist/chunk-G5L4ZUTS.js.map +1 -0
  5. package/dist/{chunk-VMA2OXSY.js → chunk-LUOUBO3L.js} +587 -669
  6. package/dist/chunk-LUOUBO3L.js.map +1 -0
  7. package/dist/{chunk-3U63LMDZ.js → chunk-N5CEHG2F.js} +3 -3
  8. package/dist/{chunk-3U63LMDZ.js.map → chunk-N5CEHG2F.js.map} +1 -1
  9. package/dist/chunk-OTUACKCQ.js +896 -0
  10. package/dist/chunk-OTUACKCQ.js.map +1 -0
  11. package/dist/chunk-UWAVET45.js +311 -0
  12. package/dist/chunk-UWAVET45.js.map +1 -0
  13. package/dist/chunk-ZXPAEM3M.js +854 -0
  14. package/dist/chunk-ZXPAEM3M.js.map +1 -0
  15. package/dist/config/index.d.ts +2 -2
  16. package/dist/config/index.js +1 -1
  17. package/dist/icons/index.d.ts +1 -0
  18. package/dist/icons/index.js +3 -0
  19. package/dist/icons/index.js.map +1 -0
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.js +34 -26
  22. package/dist/mdx/provider.d.ts +9 -0
  23. package/dist/mdx/provider.js +114 -0
  24. package/dist/mdx/provider.js.map +1 -0
  25. package/dist/runtime/index.d.ts +1 -1
  26. package/dist/typedoc/index.d.ts +25 -0
  27. package/dist/typedoc/index.js +2 -2
  28. package/dist/{types-C22M-Kor.d.ts → types-DchPWkJl.d.ts} +1 -1
  29. package/dist/ui/index.d.ts +116 -0
  30. package/dist/{theme → ui}/index.js +26 -12
  31. package/dist/ui/styles.css +2198 -0
  32. package/dist/vite/index.d.ts +13 -23
  33. package/dist/vite/index.js +5 -5
  34. package/package.json +23 -11
  35. package/dist/chunk-2JBVPO6S.js +0 -1144
  36. package/dist/chunk-2JBVPO6S.js.map +0 -1
  37. package/dist/chunk-SZVJKB3V.js.map +0 -1
  38. package/dist/chunk-VMA2OXSY.js.map +0 -1
  39. package/dist/chunk-YN6PP526.js +0 -441
  40. package/dist/chunk-YN6PP526.js.map +0 -1
  41. package/dist/theme/index.d.ts +0 -70
  42. package/dist/theme/styles.css +0 -1454
  43. /package/dist/{theme → ui}/index.js.map +0 -0
@@ -1,1144 +0,0 @@
1
- import {
2
- getPrevNextLinks,
3
- useConfig,
4
- usePageData,
5
- useSidebar,
6
- useTOC,
7
- useThemeConfig
8
- } from "./chunk-EOV2OUTW.js";
9
-
10
- // src/theme/Layout.tsx
11
- import { jsx, jsxs } from "react/jsx-runtime";
12
- function Layout({ header, sidebar, footer, children, className }) {
13
- return /* @__PURE__ */ jsxs("div", { className: className ?? "press-layout", children: [
14
- header,
15
- /* @__PURE__ */ jsxs("div", { className: "press-layout-container", children: [
16
- sidebar,
17
- /* @__PURE__ */ jsx("main", { className: "press-main", children })
18
- ] }),
19
- footer
20
- ] });
21
- }
22
-
23
- // src/theme/Header.tsx
24
- import { useState as useState3 } from "react";
25
- import { Link as Link2 } from "@tanstack/react-router";
26
-
27
- // src/theme/components/ThemeToggle.tsx
28
- import { useState, useEffect } from "react";
29
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
30
- function ThemeToggle() {
31
- const [theme, setTheme] = useState("system");
32
- const [mounted, setMounted] = useState(false);
33
- useEffect(() => {
34
- setMounted(true);
35
- const stored = localStorage.getItem("press-theme");
36
- if (stored) {
37
- setTheme(stored);
38
- applyTheme(stored);
39
- } else {
40
- applyTheme("system");
41
- }
42
- }, []);
43
- const toggleTheme = () => {
44
- const nextTheme = theme === "light" ? "dark" : theme === "dark" ? "system" : "light";
45
- setTheme(nextTheme);
46
- localStorage.setItem("press-theme", nextTheme);
47
- applyTheme(nextTheme);
48
- };
49
- if (!mounted) {
50
- return /* @__PURE__ */ jsx2("button", { className: "press-theme-toggle", "aria-label": "Toggle theme", children: /* @__PURE__ */ jsx2("span", { className: "press-theme-icon", children: /* @__PURE__ */ jsx2(SunIcon, {}) }) });
51
- }
52
- return /* @__PURE__ */ jsx2(
53
- "button",
54
- {
55
- className: "press-theme-toggle",
56
- onClick: toggleTheme,
57
- "aria-label": `Switch to ${theme === "light" ? "dark" : theme === "dark" ? "system" : "light"} theme`,
58
- children: /* @__PURE__ */ jsxs2("span", { className: "press-theme-icon", children: [
59
- theme === "light" && /* @__PURE__ */ jsx2(SunIcon, {}),
60
- theme === "dark" && /* @__PURE__ */ jsx2(MoonIcon, {}),
61
- theme === "system" && /* @__PURE__ */ jsx2(SystemIcon, {})
62
- ] })
63
- }
64
- );
65
- }
66
- function applyTheme(theme) {
67
- const root = document.documentElement;
68
- if (theme === "system") {
69
- const isDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
70
- root.classList.toggle("dark", isDark);
71
- root.classList.toggle("light", !isDark);
72
- } else {
73
- root.classList.toggle("dark", theme === "dark");
74
- root.classList.toggle("light", theme === "light");
75
- }
76
- }
77
- function SunIcon() {
78
- return /* @__PURE__ */ jsxs2(
79
- "svg",
80
- {
81
- viewBox: "0 0 24 24",
82
- width: "20",
83
- height: "20",
84
- fill: "none",
85
- stroke: "currentColor",
86
- strokeWidth: "2",
87
- children: [
88
- /* @__PURE__ */ jsx2("circle", { cx: "12", cy: "12", r: "5" }),
89
- /* @__PURE__ */ jsx2("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
90
- /* @__PURE__ */ jsx2("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
91
- /* @__PURE__ */ jsx2("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
92
- /* @__PURE__ */ jsx2("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
93
- /* @__PURE__ */ jsx2("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
94
- /* @__PURE__ */ jsx2("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
95
- /* @__PURE__ */ jsx2("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
96
- /* @__PURE__ */ jsx2("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
97
- ]
98
- }
99
- );
100
- }
101
- function MoonIcon() {
102
- return /* @__PURE__ */ jsx2(
103
- "svg",
104
- {
105
- viewBox: "0 0 24 24",
106
- width: "20",
107
- height: "20",
108
- fill: "none",
109
- stroke: "currentColor",
110
- strokeWidth: "2",
111
- children: /* @__PURE__ */ jsx2("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" })
112
- }
113
- );
114
- }
115
- function SystemIcon() {
116
- return /* @__PURE__ */ jsxs2(
117
- "svg",
118
- {
119
- viewBox: "0 0 24 24",
120
- width: "20",
121
- height: "20",
122
- fill: "none",
123
- stroke: "currentColor",
124
- strokeWidth: "2",
125
- children: [
126
- /* @__PURE__ */ jsx2("rect", { x: "2", y: "3", width: "20", height: "14", rx: "2", ry: "2" }),
127
- /* @__PURE__ */ jsx2("line", { x1: "8", y1: "21", x2: "16", y2: "21" }),
128
- /* @__PURE__ */ jsx2("line", { x1: "12", y1: "17", x2: "12", y2: "21" })
129
- ]
130
- }
131
- );
132
- }
133
-
134
- // src/theme/components/Search.tsx
135
- import { useState as useState2, useEffect as useEffect2, useRef, useCallback } from "react";
136
- import { Link } from "@tanstack/react-router";
137
- import MiniSearch from "minisearch";
138
- import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
139
- var searchIndex = null;
140
- function Search() {
141
- const [isOpen, setIsOpen] = useState2(false);
142
- const [query, setQuery] = useState2("");
143
- const [results, setResults] = useState2([]);
144
- const [selectedIndex, setSelectedIndex] = useState2(0);
145
- const inputRef = useRef(null);
146
- const themeConfig = useThemeConfig();
147
- const placeholder = themeConfig.search?.placeholder ?? "Search...";
148
- useEffect2(() => {
149
- const handleKeyDown2 = (e) => {
150
- if ((e.metaKey || e.ctrlKey) && e.key === "k") {
151
- e.preventDefault();
152
- setIsOpen(true);
153
- }
154
- if (e.key === "Escape") {
155
- setIsOpen(false);
156
- }
157
- };
158
- document.addEventListener("keydown", handleKeyDown2);
159
- return () => document.removeEventListener("keydown", handleKeyDown2);
160
- }, []);
161
- useEffect2(() => {
162
- if (isOpen && inputRef.current) {
163
- inputRef.current.focus();
164
- }
165
- }, [isOpen]);
166
- useEffect2(() => {
167
- if (!isOpen) {
168
- setQuery("");
169
- setResults([]);
170
- setSelectedIndex(0);
171
- }
172
- }, [isOpen]);
173
- const loadSearchIndex = useCallback(async () => {
174
- if (searchIndex) return searchIndex;
175
- try {
176
- const response = await fetch("/_press/search-index.json");
177
- if (!response.ok) return null;
178
- const docs = await response.json();
179
- searchIndex = new MiniSearch({
180
- fields: ["title", "content", "section"],
181
- storeFields: ["title", "path", "section"],
182
- searchOptions: {
183
- boost: { title: 2 },
184
- fuzzy: 0.2,
185
- prefix: true
186
- }
187
- });
188
- searchIndex.addAll(docs);
189
- return searchIndex;
190
- } catch {
191
- return null;
192
- }
193
- }, []);
194
- const handleSearch = useCallback(
195
- async (searchQuery) => {
196
- setQuery(searchQuery);
197
- if (!searchQuery.trim()) {
198
- setResults([]);
199
- return;
200
- }
201
- const index = await loadSearchIndex();
202
- if (!index) {
203
- setResults([]);
204
- return;
205
- }
206
- const searchResults = index.search(searchQuery).slice(0, 10);
207
- setResults(searchResults);
208
- setSelectedIndex(0);
209
- },
210
- [loadSearchIndex]
211
- );
212
- const handleKeyDown = (e) => {
213
- if (e.key === "ArrowDown") {
214
- e.preventDefault();
215
- setSelectedIndex((prev) => Math.min(prev + 1, results.length - 1));
216
- } else if (e.key === "ArrowUp") {
217
- e.preventDefault();
218
- setSelectedIndex((prev) => Math.max(prev - 1, 0));
219
- } else if (e.key === "Enter" && results[selectedIndex]) {
220
- e.preventDefault();
221
- const result = results[selectedIndex];
222
- window.location.href = result.path;
223
- setIsOpen(false);
224
- }
225
- };
226
- return /* @__PURE__ */ jsxs3(Fragment, { children: [
227
- /* @__PURE__ */ jsxs3("button", { className: "press-search-button", onClick: () => setIsOpen(true), "aria-label": "Search", children: [
228
- /* @__PURE__ */ jsx3(SearchIcon, {}),
229
- /* @__PURE__ */ jsx3("span", { className: "press-search-button-text", children: placeholder }),
230
- /* @__PURE__ */ jsxs3("span", { className: "press-search-kbd", children: [
231
- /* @__PURE__ */ jsx3("kbd", { children: "\u2318" }),
232
- /* @__PURE__ */ jsx3("kbd", { children: "K" })
233
- ] })
234
- ] }),
235
- isOpen && /* @__PURE__ */ jsx3("div", { className: "press-search-modal", onClick: () => setIsOpen(false), children: /* @__PURE__ */ jsxs3("div", { className: "press-search-dialog", onClick: (e) => e.stopPropagation(), children: [
236
- /* @__PURE__ */ jsxs3("div", { className: "press-search-input-wrapper", children: [
237
- /* @__PURE__ */ jsx3(SearchIcon, {}),
238
- /* @__PURE__ */ jsx3(
239
- "input",
240
- {
241
- ref: inputRef,
242
- type: "text",
243
- className: "press-search-input",
244
- placeholder,
245
- value: query,
246
- onChange: (e) => handleSearch(e.target.value),
247
- onKeyDown: handleKeyDown
248
- }
249
- ),
250
- query && /* @__PURE__ */ jsx3(
251
- "button",
252
- {
253
- className: "press-search-clear",
254
- onClick: () => handleSearch(""),
255
- "aria-label": "Clear search",
256
- children: "\xD7"
257
- }
258
- )
259
- ] }),
260
- results.length > 0 && /* @__PURE__ */ jsx3("ul", { className: "press-search-results", children: results.map((result, index) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsxs3(
261
- Link,
262
- {
263
- to: result.path,
264
- className: ["press-search-result", index === selectedIndex && "selected"].filter(Boolean).join(" "),
265
- onClick: () => setIsOpen(false),
266
- children: [
267
- /* @__PURE__ */ jsx3("span", { className: "press-search-result-title", children: result.title }),
268
- result.section && /* @__PURE__ */ jsx3("span", { className: "press-search-result-section", children: result.section })
269
- ]
270
- }
271
- ) }, result.id)) }),
272
- query && results.length === 0 && /* @__PURE__ */ jsxs3("div", { className: "press-search-no-results", children: [
273
- 'No results found for "',
274
- query,
275
- '"'
276
- ] }),
277
- /* @__PURE__ */ jsxs3("div", { className: "press-search-footer", children: [
278
- /* @__PURE__ */ jsxs3("span", { children: [
279
- /* @__PURE__ */ jsx3("kbd", { children: "\u2191" }),
280
- " ",
281
- /* @__PURE__ */ jsx3("kbd", { children: "\u2193" }),
282
- " to navigate"
283
- ] }),
284
- /* @__PURE__ */ jsxs3("span", { children: [
285
- /* @__PURE__ */ jsx3("kbd", { children: "\u21B5" }),
286
- " to select"
287
- ] }),
288
- /* @__PURE__ */ jsxs3("span", { children: [
289
- /* @__PURE__ */ jsx3("kbd", { children: "esc" }),
290
- " to close"
291
- ] })
292
- ] })
293
- ] }) })
294
- ] });
295
- }
296
- function SearchIcon() {
297
- return /* @__PURE__ */ jsxs3(
298
- "svg",
299
- {
300
- viewBox: "0 0 24 24",
301
- width: "18",
302
- height: "18",
303
- fill: "none",
304
- stroke: "currentColor",
305
- strokeWidth: "2",
306
- children: [
307
- /* @__PURE__ */ jsx3("circle", { cx: "11", cy: "11", r: "8" }),
308
- /* @__PURE__ */ jsx3("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
309
- ]
310
- }
311
- );
312
- }
313
-
314
- // src/theme/Header.tsx
315
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
316
- function Header({
317
- logo,
318
- title,
319
- nav,
320
- actions,
321
- search = true,
322
- themeToggle = true,
323
- className
324
- }) {
325
- const [mobileMenuOpen, setMobileMenuOpen] = useState3(false);
326
- return /* @__PURE__ */ jsxs4("header", { className: className ?? "press-header", children: [
327
- /* @__PURE__ */ jsxs4("div", { className: "press-header-container", children: [
328
- /* @__PURE__ */ jsxs4("div", { className: "press-header-left", children: [
329
- /* @__PURE__ */ jsx4(
330
- "button",
331
- {
332
- className: "press-mobile-menu-button",
333
- onClick: () => setMobileMenuOpen(!mobileMenuOpen),
334
- "aria-label": "Toggle menu",
335
- "aria-expanded": mobileMenuOpen,
336
- children: /* @__PURE__ */ jsxs4("span", { className: "press-hamburger", children: [
337
- /* @__PURE__ */ jsx4("span", {}),
338
- /* @__PURE__ */ jsx4("span", {}),
339
- /* @__PURE__ */ jsx4("span", {})
340
- ] })
341
- }
342
- ),
343
- /* @__PURE__ */ jsxs4(Link2, { to: "/", className: "press-logo-link", children: [
344
- logo && /* @__PURE__ */ jsx4(
345
- "img",
346
- {
347
- src: typeof logo === "string" ? logo : logo.light,
348
- alt: title ?? "Logo",
349
- className: "press-logo"
350
- }
351
- ),
352
- title && /* @__PURE__ */ jsx4("span", { className: "press-site-title", children: title })
353
- ] })
354
- ] }),
355
- nav && /* @__PURE__ */ jsx4("div", { className: "press-nav", children: nav }),
356
- /* @__PURE__ */ jsxs4("div", { className: "press-header-right", children: [
357
- search && /* @__PURE__ */ jsx4(Search, {}),
358
- themeToggle && /* @__PURE__ */ jsx4(ThemeToggle, {}),
359
- actions
360
- ] })
361
- ] }),
362
- mobileMenuOpen && /* @__PURE__ */ jsx4("div", { className: "press-mobile-menu", children: /* @__PURE__ */ jsx4("nav", { className: "press-mobile-nav", onClick: () => setMobileMenuOpen(false), children: nav }) })
363
- ] });
364
- }
365
- function SocialLink({ href, icon, ariaLabel, className }) {
366
- return /* @__PURE__ */ jsx4(
367
- "a",
368
- {
369
- href,
370
- target: "_blank",
371
- rel: "noopener noreferrer",
372
- className: className ?? "press-social-link",
373
- "aria-label": ariaLabel ?? icon,
374
- children: /* @__PURE__ */ jsx4(SocialIcon, { icon })
375
- }
376
- );
377
- }
378
- function SocialIcon({ icon }) {
379
- const icons2 = {
380
- github: "M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.166 6.839 9.489.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.831.092-.646.35-1.086.636-1.336-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.203 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.743 0 .267.18.578.688.48C19.138 20.163 22 16.418 22 12c0-5.523-4.477-10-10-10z",
381
- twitter: "M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z",
382
- discord: "M20.317 4.37a19.791 19.791 0 00-4.885-1.515.074.074 0 00-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 00-5.487 0 12.64 12.64 0 00-.617-1.25.077.077 0 00-.079-.037A19.736 19.736 0 003.677 4.37a.07.07 0 00-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 00.031.057 19.9 19.9 0 005.993 3.03.078.078 0 00.084-.028 14.09 14.09 0 001.226-1.994.076.076 0 00-.041-.106 13.107 13.107 0 01-1.872-.892.077.077 0 01-.008-.128 10.2 10.2 0 00.372-.292.074.074 0 01.077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 01.078.01c.12.098.246.198.373.292a.077.077 0 01-.006.127 12.299 12.299 0 01-1.873.892.077.077 0 00-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 00.084.028 19.839 19.839 0 006.002-3.03.077.077 0 00.032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 00-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z",
383
- linkedin: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 01-2.063-2.065 2.064 2.064 0 112.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",
384
- youtube: "M23.498 6.186a3.016 3.016 0 00-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 00.502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 002.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 002.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z",
385
- npm: "M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"
386
- };
387
- const path = icons2[icon] || icons2.github;
388
- return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 24 24", width: "20", height: "20", fill: "currentColor", children: /* @__PURE__ */ jsx4("path", { d: path }) });
389
- }
390
-
391
- // src/theme/Sidebar.tsx
392
- import {
393
- useState as useState4,
394
- Children,
395
- isValidElement,
396
- createContext,
397
- useContext
398
- } from "react";
399
- import { Link as Link3, useRouterState } from "@tanstack/react-router";
400
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
401
- var SidebarContext = createContext({ currentPath: "" });
402
- function useSidebarContext() {
403
- return useContext(SidebarContext);
404
- }
405
- function Sidebar({ items, children, className }) {
406
- const pathname = useRouterState({ select: (s) => s.location.pathname });
407
- return /* @__PURE__ */ jsx5(SidebarContext.Provider, { value: { currentPath: pathname }, children: /* @__PURE__ */ jsx5("aside", { className: className ?? "press-sidebar", children: /* @__PURE__ */ jsx5("nav", { className: "press-sidebar-nav", children: items ? /* @__PURE__ */ jsx5(SidebarItems, { items, depth: 0 }) : /* @__PURE__ */ jsx5("ul", { className: "press-sidebar-list press-sidebar-list-0", children }) }) }) });
408
- }
409
- function SidebarGroup({
410
- title,
411
- to,
412
- collapsed: initialCollapsed = false,
413
- collapsible = true,
414
- children,
415
- className
416
- }) {
417
- const [collapsed, setCollapsed] = useState4(initialCollapsed);
418
- const { currentPath } = useSidebarContext();
419
- const isChildActive = checkChildrenActive(children, currentPath);
420
- const textClassName = ["press-sidebar-text", isChildActive && "child-active"].filter(Boolean).join(" ");
421
- const linkClassName = ["press-sidebar-link", isChildActive && "child-active"].filter(Boolean).join(" ");
422
- const hasChildren = Children.count(children) > 0;
423
- return /* @__PURE__ */ jsxs5("li", { className: className ?? "press-sidebar-item", children: [
424
- /* @__PURE__ */ jsxs5("div", { className: "press-sidebar-item-header", children: [
425
- to ? /* @__PURE__ */ jsx5(Link3, { to, className: linkClassName, activeProps: { className: "active" }, children: title }) : /* @__PURE__ */ jsx5(
426
- "span",
427
- {
428
- className: textClassName,
429
- onClick: () => collapsible && hasChildren && setCollapsed(!collapsed),
430
- style: collapsible && hasChildren ? { cursor: "pointer" } : void 0,
431
- children: title
432
- }
433
- ),
434
- collapsible && hasChildren && /* @__PURE__ */ jsx5(
435
- "button",
436
- {
437
- className: ["press-sidebar-collapse", collapsed && "collapsed"].filter(Boolean).join(" "),
438
- onClick: () => setCollapsed(!collapsed),
439
- "aria-label": collapsed ? "Expand" : "Collapse",
440
- children: /* @__PURE__ */ jsx5(
441
- "svg",
442
- {
443
- viewBox: "0 0 24 24",
444
- width: "16",
445
- height: "16",
446
- fill: "none",
447
- stroke: "currentColor",
448
- strokeWidth: "2",
449
- children: /* @__PURE__ */ jsx5("path", { d: "M6 9l6 6 6-6" })
450
- }
451
- )
452
- }
453
- )
454
- ] }),
455
- hasChildren && !collapsed && /* @__PURE__ */ jsx5("ul", { className: "press-sidebar-list press-sidebar-list-1", children })
456
- ] });
457
- }
458
- function SidebarLink({ to, children, className }) {
459
- return /* @__PURE__ */ jsx5("li", { className: "press-sidebar-item", children: /* @__PURE__ */ jsx5(
460
- Link3,
461
- {
462
- to,
463
- className: className ?? "press-sidebar-link",
464
- activeProps: { className: "active" },
465
- children
466
- }
467
- ) });
468
- }
469
- function SidebarItems({ items, depth }) {
470
- return /* @__PURE__ */ jsx5("ul", { className: `press-sidebar-list press-sidebar-list-${depth}`, children: items.map((item, index) => /* @__PURE__ */ jsx5(SidebarItemComponent, { item, depth }, index)) });
471
- }
472
- function SidebarItemComponent({ item, depth }) {
473
- const { currentPath } = useSidebarContext();
474
- const [collapsed, setCollapsed] = useState4(item.collapsed ?? false);
475
- const hasChildren = item.items && item.items.length > 0;
476
- const isChildActive = hasChildren && item.items.some(
477
- (child) => child.link === currentPath || child.items && child.items.some((grandchild) => grandchild.link === currentPath)
478
- );
479
- const linkClassName = ["press-sidebar-link", isChildActive && "child-active"].filter(Boolean).join(" ");
480
- const textClassName = ["press-sidebar-text", isChildActive && "child-active"].filter(Boolean).join(" ");
481
- return /* @__PURE__ */ jsxs5("li", { className: "press-sidebar-item", children: [
482
- /* @__PURE__ */ jsxs5("div", { className: "press-sidebar-item-header", children: [
483
- item.link ? /* @__PURE__ */ jsx5(Link3, { to: item.link, className: linkClassName, activeProps: { className: "active" }, children: item.text }) : /* @__PURE__ */ jsx5("span", { className: textClassName, onClick: () => hasChildren && setCollapsed(!collapsed), children: item.text }),
484
- hasChildren && /* @__PURE__ */ jsx5(
485
- "button",
486
- {
487
- className: ["press-sidebar-collapse", collapsed && "collapsed"].filter(Boolean).join(" "),
488
- onClick: () => setCollapsed(!collapsed),
489
- "aria-label": collapsed ? "Expand" : "Collapse",
490
- children: /* @__PURE__ */ jsx5(
491
- "svg",
492
- {
493
- viewBox: "0 0 24 24",
494
- width: "16",
495
- height: "16",
496
- fill: "none",
497
- stroke: "currentColor",
498
- strokeWidth: "2",
499
- children: /* @__PURE__ */ jsx5("path", { d: "M6 9l6 6 6-6" })
500
- }
501
- )
502
- }
503
- )
504
- ] }),
505
- hasChildren && !collapsed && /* @__PURE__ */ jsx5(SidebarItems, { items: item.items, depth: depth + 1 })
506
- ] });
507
- }
508
- function checkChildrenActive(children, currentPath) {
509
- let isActive = false;
510
- Children.forEach(children, (child) => {
511
- if (isActive) return;
512
- if (isValidElement(child)) {
513
- if (child.type === SidebarLink && child.props.to === currentPath) {
514
- isActive = true;
515
- return;
516
- }
517
- if (child.type === SidebarGroup) {
518
- const groupProps = child.props;
519
- if (groupProps.to === currentPath) {
520
- isActive = true;
521
- return;
522
- }
523
- if (groupProps.children && checkChildrenActive(groupProps.children, currentPath)) {
524
- isActive = true;
525
- return;
526
- }
527
- }
528
- }
529
- });
530
- return isActive;
531
- }
532
-
533
- // src/theme/Footer.tsx
534
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
535
- function Footer({ message, copyright, children, className }) {
536
- const hasContent = message || copyright || children;
537
- if (!hasContent) {
538
- return null;
539
- }
540
- return /* @__PURE__ */ jsx6("footer", { className: className ?? "press-footer", children: /* @__PURE__ */ jsx6("div", { className: "press-footer-container", children: children ?? /* @__PURE__ */ jsxs6(Fragment2, { children: [
541
- message && /* @__PURE__ */ jsx6("p", { className: "press-footer-message", dangerouslySetInnerHTML: { __html: message } }),
542
- copyright && /* @__PURE__ */ jsx6(
543
- "p",
544
- {
545
- className: "press-footer-copyright",
546
- dangerouslySetInnerHTML: { __html: copyright }
547
- }
548
- )
549
- ] }) }) });
550
- }
551
-
552
- // src/theme/Nav.tsx
553
- import { useState as useState5, createContext as createContext2, useContext as useContext2 } from "react";
554
- import { Link as Link4 } from "@tanstack/react-router";
555
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
556
- var NavContext = createContext2(null);
557
- function useNavContext() {
558
- return useContext2(NavContext);
559
- }
560
- function Nav({ children, className }) {
561
- return /* @__PURE__ */ jsx7("nav", { className: className ?? "press-nav", children });
562
- }
563
- function NavLink({ to, href, children, className, activeMatch }) {
564
- const navContext = useNavContext();
565
- const baseClassName = className ?? "press-nav-link";
566
- const handleClick = () => {
567
- navContext?.setMobileMenuOpen(false);
568
- };
569
- if (href) {
570
- return /* @__PURE__ */ jsx7(
571
- "a",
572
- {
573
- href,
574
- className: baseClassName,
575
- target: "_blank",
576
- rel: "noopener noreferrer",
577
- onClick: handleClick,
578
- children
579
- }
580
- );
581
- }
582
- if (to) {
583
- return /* @__PURE__ */ jsx7(
584
- Link4,
585
- {
586
- to,
587
- className: baseClassName,
588
- activeProps: { className: "active" },
589
- activeOptions: activeMatch ? { exact: false } : { exact: false },
590
- onClick: handleClick,
591
- children
592
- }
593
- );
594
- }
595
- return /* @__PURE__ */ jsx7("span", { className: baseClassName, children });
596
- }
597
- function NavDropdown({ text, children, className }) {
598
- const [open, setOpen] = useState5(false);
599
- return /* @__PURE__ */ jsxs7(
600
- "div",
601
- {
602
- className: className ?? "press-nav-dropdown",
603
- onMouseEnter: () => setOpen(true),
604
- onMouseLeave: () => setOpen(false),
605
- children: [
606
- /* @__PURE__ */ jsxs7("button", { className: "press-nav-dropdown-button", children: [
607
- text,
608
- /* @__PURE__ */ jsx7("span", { className: "press-nav-dropdown-icon", children: "\u25BC" })
609
- ] }),
610
- open && /* @__PURE__ */ jsx7("div", { className: "press-nav-dropdown-menu", children })
611
- ]
612
- }
613
- );
614
- }
615
-
616
- // src/theme/TOC.tsx
617
- import { useState as useState6, useEffect as useEffect3 } from "react";
618
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
619
- function TOC() {
620
- const toc = useTOC();
621
- const themeConfig = useThemeConfig();
622
- const [activeId, setActiveId] = useState6("");
623
- const label = themeConfig.outline?.label ?? "On this page";
624
- useEffect3(() => {
625
- if (toc.length === 0) return;
626
- const headingElements = toc.map((item) => document.getElementById(item.id)).filter(Boolean);
627
- if (headingElements.length === 0) return;
628
- const observer = new IntersectionObserver(
629
- (entries) => {
630
- for (const entry of entries) {
631
- if (entry.isIntersecting) {
632
- setActiveId(entry.target.id);
633
- break;
634
- }
635
- }
636
- },
637
- {
638
- rootMargin: "-80px 0px -80% 0px",
639
- threshold: 0
640
- }
641
- );
642
- headingElements.forEach((el) => el && observer.observe(el));
643
- return () => {
644
- headingElements.forEach((el) => el && observer.unobserve(el));
645
- };
646
- }, [toc]);
647
- if (toc.length === 0) {
648
- return null;
649
- }
650
- return /* @__PURE__ */ jsx8("aside", { className: "press-toc", children: /* @__PURE__ */ jsxs8("div", { className: "press-toc-container", children: [
651
- /* @__PURE__ */ jsx8("h3", { className: "press-toc-title", children: label }),
652
- /* @__PURE__ */ jsx8("nav", { className: "press-toc-nav", children: /* @__PURE__ */ jsx8(TOCItems, { items: toc, activeId }) })
653
- ] }) });
654
- }
655
- function TOCItems({ items, activeId }) {
656
- return /* @__PURE__ */ jsx8("ul", { className: "press-toc-list", children: items.map((item) => /* @__PURE__ */ jsx8(TOCItemComponent, { item, activeId }, item.id)) });
657
- }
658
- function TOCItemComponent({ item, activeId }) {
659
- const isActive = item.id === activeId;
660
- const hasActiveChild = hasActiveDescendant(item, activeId);
661
- return /* @__PURE__ */ jsxs8("li", { className: "press-toc-item", children: [
662
- /* @__PURE__ */ jsx8(
663
- "a",
664
- {
665
- href: `#${item.id}`,
666
- className: [
667
- `press-toc-link press-toc-link-${item.level}`,
668
- isActive && "active",
669
- hasActiveChild && "child-active"
670
- ].filter(Boolean).join(" "),
671
- onClick: (e) => {
672
- e.preventDefault();
673
- const element = document.getElementById(item.id);
674
- if (element) {
675
- element.scrollIntoView({ behavior: "smooth" });
676
- window.history.pushState(null, "", `#${item.id}`);
677
- }
678
- },
679
- children: item.text
680
- }
681
- ),
682
- item.children && item.children.length > 0 && /* @__PURE__ */ jsx8(TOCItems, { items: item.children, activeId })
683
- ] });
684
- }
685
- function hasActiveDescendant(item, activeId) {
686
- if (!item.children) return false;
687
- for (const child of item.children) {
688
- if (child.id === activeId) return true;
689
- if (hasActiveDescendant(child, activeId)) return true;
690
- }
691
- return false;
692
- }
693
-
694
- // src/theme/Content.tsx
695
- import { Link as Link5, useLocation } from "@tanstack/react-router";
696
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
697
- function Content({ children }) {
698
- const pageData = usePageData();
699
- const themeConfig = useThemeConfig();
700
- const sidebar = useSidebar();
701
- const location = useLocation();
702
- const { prev, next } = getPrevNextLinks(sidebar, location.pathname);
703
- const showEditLink = pageData?.frontmatter.editLink !== false && themeConfig.editLink?.pattern;
704
- const showLastUpdated = pageData?.frontmatter.lastUpdated !== false && themeConfig.lastUpdated?.enabled && pageData?.lastUpdated;
705
- const editLink = showEditLink ? themeConfig.editLink.pattern.replace(":path", pageData?.relativePath || "") : null;
706
- const lastUpdatedText = showLastUpdated ? new Date(pageData.lastUpdated).toLocaleDateString(
707
- void 0,
708
- themeConfig.lastUpdated?.formatOptions ?? {
709
- year: "numeric",
710
- month: "long",
711
- day: "numeric"
712
- }
713
- ) : null;
714
- return /* @__PURE__ */ jsxs9("article", { className: "press-content-container", children: [
715
- pageData?.frontmatter.title && /* @__PURE__ */ jsxs9("header", { className: "press-content-header", children: [
716
- /* @__PURE__ */ jsx9("h1", { className: "press-content-title", children: pageData.frontmatter.title }),
717
- pageData.frontmatter.description && /* @__PURE__ */ jsx9("p", { className: "press-content-description", children: pageData.frontmatter.description })
718
- ] }),
719
- /* @__PURE__ */ jsx9("div", { className: "press-content-body", children }),
720
- /* @__PURE__ */ jsxs9("footer", { className: "press-content-footer", children: [
721
- (showEditLink || showLastUpdated) && /* @__PURE__ */ jsxs9("div", { className: "press-content-meta", children: [
722
- showEditLink && /* @__PURE__ */ jsx9(
723
- "a",
724
- {
725
- href: editLink,
726
- target: "_blank",
727
- rel: "noopener noreferrer",
728
- className: "press-edit-link",
729
- children: themeConfig.editLink?.text ?? "Edit this page"
730
- }
731
- ),
732
- showLastUpdated && /* @__PURE__ */ jsxs9("span", { className: "press-last-updated", children: [
733
- themeConfig.lastUpdated?.text ?? "Last updated",
734
- ": ",
735
- lastUpdatedText
736
- ] })
737
- ] }),
738
- (prev || next) && /* @__PURE__ */ jsxs9("nav", { className: "press-prev-next", children: [
739
- prev ? /* @__PURE__ */ jsxs9(Link5, { to: prev.link, className: "press-prev-link", children: [
740
- /* @__PURE__ */ jsx9("span", { className: "press-prev-next-label", children: "Previous" }),
741
- /* @__PURE__ */ jsx9("span", { className: "press-prev-next-title", children: prev.text })
742
- ] }) : /* @__PURE__ */ jsx9("div", {}),
743
- next ? /* @__PURE__ */ jsxs9(Link5, { to: next.link, className: "press-next-link", children: [
744
- /* @__PURE__ */ jsx9("span", { className: "press-prev-next-label", children: "Next" }),
745
- /* @__PURE__ */ jsx9("span", { className: "press-prev-next-title", children: next.text })
746
- ] }) : /* @__PURE__ */ jsx9("div", {})
747
- ] })
748
- ] })
749
- ] });
750
- }
751
-
752
- // src/theme/DocPage.tsx
753
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
754
- function DocPage({ children }) {
755
- const pageData = usePageData();
756
- const showToc = pageData?.frontmatter.outline !== false && pageData?.toc && pageData.toc.length > 0;
757
- return /* @__PURE__ */ jsx10(Layout, { children: /* @__PURE__ */ jsxs10("div", { className: "press-doc-page", children: [
758
- /* @__PURE__ */ jsx10(Content, { children }),
759
- showToc && /* @__PURE__ */ jsx10(TOC, {})
760
- ] }) });
761
- }
762
- function DocContent({ children }) {
763
- const pageData = usePageData();
764
- const showToc = pageData?.frontmatter.outline !== false && pageData?.toc && pageData.toc.length > 0;
765
- return /* @__PURE__ */ jsxs10("div", { className: "press-doc-page", children: [
766
- /* @__PURE__ */ jsx10(Content, { children }),
767
- showToc && /* @__PURE__ */ jsx10(TOC, {})
768
- ] });
769
- }
770
- function DocLayout({ content }) {
771
- return /* @__PURE__ */ jsx10(DocPage, { children: content });
772
- }
773
-
774
- // src/theme/HomePage.tsx
775
- import { Link as Link6 } from "@tanstack/react-router";
776
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
777
- function HomePage() {
778
- const pageData = usePageData();
779
- const config = useConfig();
780
- const themeConfig = useThemeConfig();
781
- const hero = pageData?.frontmatter.hero;
782
- const features = pageData?.frontmatter.features;
783
- return /* @__PURE__ */ jsxs11("div", { className: "press-home", children: [
784
- /* @__PURE__ */ jsx11(
785
- Header,
786
- {
787
- logo: themeConfig.logo,
788
- title: themeConfig.siteTitle !== false ? config.title : void 0,
789
- nav: themeConfig.nav && themeConfig.nav.length > 0 ? /* @__PURE__ */ jsx11(Nav, { children: themeConfig.nav.map((item, index) => /* @__PURE__ */ jsx11(NavLink, { to: item.link, children: item.text }, index)) }) : void 0,
790
- actions: themeConfig.socialLinks?.map((link, index) => /* @__PURE__ */ jsx11(SocialLink, { href: link.link, icon: link.icon, ariaLabel: link.ariaLabel }, index))
791
- }
792
- ),
793
- /* @__PURE__ */ jsxs11("main", { className: "press-home-main", children: [
794
- hero && /* @__PURE__ */ jsx11("section", { className: "press-hero", children: /* @__PURE__ */ jsxs11("div", { className: "press-hero-container", children: [
795
- hero.image && /* @__PURE__ */ jsx11("div", { className: "press-hero-image", children: /* @__PURE__ */ jsx11(
796
- "img",
797
- {
798
- src: typeof hero.image === "string" ? hero.image : hero.image.light,
799
- alt: hero.name || config.title
800
- }
801
- ) }),
802
- /* @__PURE__ */ jsxs11("div", { className: "press-hero-content", children: [
803
- hero.name && /* @__PURE__ */ jsx11("h1", { className: "press-hero-name", children: hero.name }),
804
- hero.text && /* @__PURE__ */ jsx11("p", { className: "press-hero-text", children: hero.text }),
805
- hero.tagline && /* @__PURE__ */ jsx11("p", { className: "press-hero-tagline", children: hero.tagline }),
806
- hero.actions && hero.actions.length > 0 && /* @__PURE__ */ jsx11("div", { className: "press-hero-actions", children: hero.actions.map((action, index) => /* @__PURE__ */ jsx11(
807
- Link6,
808
- {
809
- to: action.link,
810
- className: `press-hero-action press-hero-action-${action.theme || "brand"}`,
811
- children: action.text
812
- },
813
- index
814
- )) })
815
- ] })
816
- ] }) }),
817
- features && features.length > 0 && /* @__PURE__ */ jsx11("section", { className: "press-features", children: /* @__PURE__ */ jsx11("div", { className: "press-features-container", children: features.map((feature, index) => /* @__PURE__ */ jsxs11("div", { className: "press-feature", children: [
818
- feature.icon && /* @__PURE__ */ jsx11("div", { className: "press-feature-icon", children: feature.icon }),
819
- /* @__PURE__ */ jsx11("h3", { className: "press-feature-title", children: feature.title }),
820
- /* @__PURE__ */ jsx11("p", { className: "press-feature-details", children: feature.details }),
821
- feature.link && /* @__PURE__ */ jsx11(Link6, { to: feature.link, className: "press-feature-link", children: feature.linkText || "Learn more" })
822
- ] }, index)) }) })
823
- ] }),
824
- /* @__PURE__ */ jsx11(Footer, {})
825
- ] });
826
- }
827
-
828
- // src/theme/components/CodeBlock.tsx
829
- import { useState as useState8 } from "react";
830
-
831
- // src/theme/components/CopyButton.tsx
832
- import { useState as useState7 } from "react";
833
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
834
- function CopyButton({ code }) {
835
- const [copied, setCopied] = useState7(false);
836
- const handleCopy = async () => {
837
- try {
838
- await navigator.clipboard.writeText(code);
839
- setCopied(true);
840
- setTimeout(() => setCopied(false), 2e3);
841
- } catch (err) {
842
- console.error("Failed to copy:", err);
843
- }
844
- };
845
- return /* @__PURE__ */ jsxs12(
846
- "button",
847
- {
848
- className: "press-copy-button",
849
- onClick: handleCopy,
850
- "aria-label": copied ? "Copied!" : "Copy code",
851
- children: [
852
- copied ? /* @__PURE__ */ jsx12(CheckIcon, {}) : /* @__PURE__ */ jsx12(CopyIcon, {}),
853
- /* @__PURE__ */ jsx12("span", { className: "press-copy-text", children: copied ? "Copied!" : "Copy" })
854
- ]
855
- }
856
- );
857
- }
858
- function CopyIcon() {
859
- return /* @__PURE__ */ jsxs12(
860
- "svg",
861
- {
862
- viewBox: "0 0 24 24",
863
- width: "16",
864
- height: "16",
865
- fill: "none",
866
- stroke: "currentColor",
867
- strokeWidth: "2",
868
- children: [
869
- /* @__PURE__ */ jsx12("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
870
- /* @__PURE__ */ jsx12("path", { d: "M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1" })
871
- ]
872
- }
873
- );
874
- }
875
- function CheckIcon() {
876
- return /* @__PURE__ */ jsx12(
877
- "svg",
878
- {
879
- viewBox: "0 0 24 24",
880
- width: "16",
881
- height: "16",
882
- fill: "none",
883
- stroke: "currentColor",
884
- strokeWidth: "2",
885
- children: /* @__PURE__ */ jsx12("polyline", { points: "20,6 9,17 4,12" })
886
- }
887
- );
888
- }
889
-
890
- // src/theme/components/CodeBlock.tsx
891
- import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
892
- function CodeBlock({
893
- code,
894
- language = "text",
895
- title,
896
- lineNumbers = false,
897
- highlightLines = [],
898
- children
899
- }) {
900
- const lines = code.split("\n");
901
- return /* @__PURE__ */ jsxs13("div", { className: "press-code-block", "data-lang": language, children: [
902
- title && /* @__PURE__ */ jsx13("div", { className: "press-code-title", children: title }),
903
- /* @__PURE__ */ jsxs13("div", { className: "press-code-wrapper", children: [
904
- children || /* @__PURE__ */ jsx13("pre", { className: `language-${language}`, children: /* @__PURE__ */ jsx13("code", { children: lines.map((line, index) => {
905
- const lineNum = index + 1;
906
- const isHighlighted = highlightLines.includes(lineNum);
907
- const classes = ["press-code-line"];
908
- if (isHighlighted) classes.push("highlighted");
909
- return /* @__PURE__ */ jsxs13("span", { className: classes.join(" "), children: [
910
- lineNumbers && /* @__PURE__ */ jsx13("span", { className: "press-line-number", children: lineNum }),
911
- /* @__PURE__ */ jsx13("span", { className: "press-line-content", children: line }),
912
- index < lines.length - 1 && "\n"
913
- ] }, index);
914
- }) }) }),
915
- /* @__PURE__ */ jsx13(CopyButton, { code })
916
- ] })
917
- ] });
918
- }
919
- function CodeGroup({ children }) {
920
- const [activeTab, setActiveTab] = useState8(0);
921
- const childArray = Array.isArray(children) ? children : [children];
922
- const tabs = childArray.map((child, index) => {
923
- const props = child?.props;
924
- return props?.title || props?.language || `Tab ${index + 1}`;
925
- });
926
- return /* @__PURE__ */ jsxs13("div", { className: "press-code-group", children: [
927
- /* @__PURE__ */ jsx13("div", { className: "press-code-group-tabs", children: tabs.map((tab, index) => /* @__PURE__ */ jsx13(
928
- "button",
929
- {
930
- className: ["press-code-group-tab", index === activeTab && "active"].filter(Boolean).join(" "),
931
- onClick: () => setActiveTab(index),
932
- children: tab
933
- },
934
- index
935
- )) }),
936
- /* @__PURE__ */ jsx13("div", { className: "press-code-group-panels", children: childArray.map((child, index) => /* @__PURE__ */ jsx13(
937
- "div",
938
- {
939
- className: ["press-code-group-panel", index === activeTab && "active"].filter(Boolean).join(" "),
940
- style: { display: index === activeTab ? "block" : "none" },
941
- children: child
942
- },
943
- index
944
- )) })
945
- ] });
946
- }
947
-
948
- // src/theme/components/Container.tsx
949
- import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
950
- var defaultTitles = {
951
- tip: "TIP",
952
- warning: "WARNING",
953
- danger: "DANGER",
954
- info: "INFO",
955
- note: "NOTE"
956
- };
957
- var icons = {
958
- tip: /* @__PURE__ */ jsxs14(
959
- "svg",
960
- {
961
- viewBox: "0 0 24 24",
962
- width: "20",
963
- height: "20",
964
- fill: "none",
965
- stroke: "currentColor",
966
- strokeWidth: "2",
967
- children: [
968
- /* @__PURE__ */ jsx14("path", { d: "M9 18h6M12 2v1M12 21v-6M4.22 4.22l.71.71M19.07 4.93l-.71.71M1 12h2M21 12h2M4.22 19.78l.71-.71M19.07 19.07l-.71-.71" }),
969
- /* @__PURE__ */ jsx14("circle", { cx: "12", cy: "12", r: "4" })
970
- ]
971
- }
972
- ),
973
- warning: /* @__PURE__ */ jsxs14(
974
- "svg",
975
- {
976
- viewBox: "0 0 24 24",
977
- width: "20",
978
- height: "20",
979
- fill: "none",
980
- stroke: "currentColor",
981
- strokeWidth: "2",
982
- children: [
983
- /* @__PURE__ */ jsx14("path", { d: "M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" }),
984
- /* @__PURE__ */ jsx14("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
985
- /* @__PURE__ */ jsx14("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
986
- ]
987
- }
988
- ),
989
- danger: /* @__PURE__ */ jsxs14(
990
- "svg",
991
- {
992
- viewBox: "0 0 24 24",
993
- width: "20",
994
- height: "20",
995
- fill: "none",
996
- stroke: "currentColor",
997
- strokeWidth: "2",
998
- children: [
999
- /* @__PURE__ */ jsx14("circle", { cx: "12", cy: "12", r: "10" }),
1000
- /* @__PURE__ */ jsx14("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
1001
- /* @__PURE__ */ jsx14("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
1002
- ]
1003
- }
1004
- ),
1005
- info: /* @__PURE__ */ jsxs14(
1006
- "svg",
1007
- {
1008
- viewBox: "0 0 24 24",
1009
- width: "20",
1010
- height: "20",
1011
- fill: "none",
1012
- stroke: "currentColor",
1013
- strokeWidth: "2",
1014
- children: [
1015
- /* @__PURE__ */ jsx14("circle", { cx: "12", cy: "12", r: "10" }),
1016
- /* @__PURE__ */ jsx14("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
1017
- /* @__PURE__ */ jsx14("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
1018
- ]
1019
- }
1020
- ),
1021
- note: /* @__PURE__ */ jsxs14(
1022
- "svg",
1023
- {
1024
- viewBox: "0 0 24 24",
1025
- width: "20",
1026
- height: "20",
1027
- fill: "none",
1028
- stroke: "currentColor",
1029
- strokeWidth: "2",
1030
- children: [
1031
- /* @__PURE__ */ jsx14("path", { d: "M14.5 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V7.5L14.5 2z" }),
1032
- /* @__PURE__ */ jsx14("polyline", { points: "14,2 14,8 20,8" }),
1033
- /* @__PURE__ */ jsx14("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
1034
- /* @__PURE__ */ jsx14("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
1035
- /* @__PURE__ */ jsx14("line", { x1: "10", y1: "9", x2: "8", y2: "9" })
1036
- ]
1037
- }
1038
- )
1039
- };
1040
- function Container({ type, title, children }) {
1041
- const displayTitle = title || defaultTitles[type];
1042
- return /* @__PURE__ */ jsxs14("div", { className: `press-container press-container-${type}`, children: [
1043
- /* @__PURE__ */ jsxs14("p", { className: "press-container-title", children: [
1044
- /* @__PURE__ */ jsx14("span", { className: "press-container-icon", children: icons[type] }),
1045
- displayTitle
1046
- ] }),
1047
- /* @__PURE__ */ jsx14("div", { className: "press-container-content", children })
1048
- ] });
1049
- }
1050
- function Tip({ title, children }) {
1051
- return /* @__PURE__ */ jsx14(Container, { type: "tip", title, children });
1052
- }
1053
- function Warning({ title, children }) {
1054
- return /* @__PURE__ */ jsx14(Container, { type: "warning", title, children });
1055
- }
1056
- function Danger({ title, children }) {
1057
- return /* @__PURE__ */ jsx14(Container, { type: "danger", title, children });
1058
- }
1059
- function Info({ title, children }) {
1060
- return /* @__PURE__ */ jsx14(Container, { type: "info", title, children });
1061
- }
1062
- function Note({ title, children }) {
1063
- return /* @__PURE__ */ jsx14(Container, { type: "note", title, children });
1064
- }
1065
-
1066
- // src/theme/components/Tabs.tsx
1067
- import { useState as useState9, createContext as createContext3, useContext as useContext3 } from "react";
1068
- import { jsx as jsx15 } from "react/jsx-runtime";
1069
- var TabsContext = createContext3(null);
1070
- function useTabsContext() {
1071
- const context = useContext3(TabsContext);
1072
- if (!context) {
1073
- throw new Error("Tab components must be used within a Tabs component");
1074
- }
1075
- return context;
1076
- }
1077
- function Tabs({ defaultValue, children }) {
1078
- const [activeTab, setActiveTab] = useState9(defaultValue || "");
1079
- return /* @__PURE__ */ jsx15(TabsContext.Provider, { value: { activeTab, setActiveTab }, children: /* @__PURE__ */ jsx15("div", { className: "press-tabs", children }) });
1080
- }
1081
- function TabList({ children }) {
1082
- return /* @__PURE__ */ jsx15("div", { className: "press-tab-list", role: "tablist", children });
1083
- }
1084
- function Tab({ value, children }) {
1085
- const { activeTab, setActiveTab } = useTabsContext();
1086
- const isActive = activeTab === value;
1087
- return /* @__PURE__ */ jsx15(
1088
- "button",
1089
- {
1090
- role: "tab",
1091
- "aria-selected": isActive,
1092
- className: ["press-tab", isActive && "active"].filter(Boolean).join(" "),
1093
- onClick: () => setActiveTab(value),
1094
- children
1095
- }
1096
- );
1097
- }
1098
- function TabPanel({ value, children }) {
1099
- const { activeTab } = useTabsContext();
1100
- const isActive = activeTab === value;
1101
- if (!isActive) {
1102
- return null;
1103
- }
1104
- return /* @__PURE__ */ jsx15("div", { role: "tabpanel", className: "press-tab-panel", children });
1105
- }
1106
- function TabPanels({ children }) {
1107
- return /* @__PURE__ */ jsx15("div", { className: "press-tab-panels", children });
1108
- }
1109
-
1110
- export {
1111
- Layout,
1112
- ThemeToggle,
1113
- Search,
1114
- Header,
1115
- SocialLink,
1116
- Sidebar,
1117
- SidebarGroup,
1118
- SidebarLink,
1119
- Footer,
1120
- Nav,
1121
- NavLink,
1122
- NavDropdown,
1123
- TOC,
1124
- Content,
1125
- DocPage,
1126
- DocContent,
1127
- DocLayout,
1128
- HomePage,
1129
- CopyButton,
1130
- CodeBlock,
1131
- CodeGroup,
1132
- Container,
1133
- Tip,
1134
- Warning,
1135
- Danger,
1136
- Info,
1137
- Note,
1138
- Tabs,
1139
- TabList,
1140
- Tab,
1141
- TabPanel,
1142
- TabPanels
1143
- };
1144
- //# sourceMappingURL=chunk-2JBVPO6S.js.map