@lonik/prestige 0.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 (50) hide show
  1. package/README.md +29 -0
  2. package/dist/README.md +29 -0
  3. package/dist/client.d.ts +101 -0
  4. package/dist/content.types-BbDmygmP.d.ts +44 -0
  5. package/dist/index.d.ts +5 -0
  6. package/dist/index.js +6 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/ui.d.ts +124 -0
  9. package/dist/ui.js +675 -0
  10. package/dist/ui.js.map +1 -0
  11. package/dist/vite.d.ts +47 -0
  12. package/dist/vite.js +685 -0
  13. package/dist/vite.js.map +1 -0
  14. package/package.json +131 -0
  15. package/src/themes/core.css +54 -0
  16. package/src/themes/default-gray.css +44 -0
  17. package/src/themes/default-mauve.css +44 -0
  18. package/src/themes/default-mist.css +44 -0
  19. package/src/themes/default-neutral.css +44 -0
  20. package/src/themes/default-olive.css +44 -0
  21. package/src/themes/default-slate.css +44 -0
  22. package/src/themes/default-stone.css +44 -0
  23. package/src/themes/default-taupe.css +44 -0
  24. package/src/themes/default-zinc.css +44 -0
  25. package/src/themes/primary-amber.css +42 -0
  26. package/src/themes/primary-blue.css +42 -0
  27. package/src/themes/primary-cyan.css +42 -0
  28. package/src/themes/primary-emerald.css +42 -0
  29. package/src/themes/primary-fuchsia.css +42 -0
  30. package/src/themes/primary-gray.css +42 -0
  31. package/src/themes/primary-green.css +42 -0
  32. package/src/themes/primary-indigo.css +42 -0
  33. package/src/themes/primary-lime.css +42 -0
  34. package/src/themes/primary-mauve.css +42 -0
  35. package/src/themes/primary-mist.css +42 -0
  36. package/src/themes/primary-neutral.css +42 -0
  37. package/src/themes/primary-olive.css +42 -0
  38. package/src/themes/primary-orange.css +42 -0
  39. package/src/themes/primary-pink.css +42 -0
  40. package/src/themes/primary-purple.css +42 -0
  41. package/src/themes/primary-red.css +42 -0
  42. package/src/themes/primary-rose.css +42 -0
  43. package/src/themes/primary-sky.css +42 -0
  44. package/src/themes/primary-slate.css +42 -0
  45. package/src/themes/primary-stone.css +42 -0
  46. package/src/themes/primary-taupe.css +42 -0
  47. package/src/themes/primary-teal.css +42 -0
  48. package/src/themes/primary-violet.css +42 -0
  49. package/src/themes/primary-yellow.css +42 -0
  50. package/src/themes/primary-zinc.css +42 -0
package/dist/ui.js ADDED
@@ -0,0 +1,675 @@
1
+ import React, { useEffect, useRef, useState } from "react";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Tabs as Tabs$1 } from "@base-ui/react/tabs";
4
+ import { Link, Outlet, useHydrated, useLocation } from "@tanstack/react-router";
5
+ import collections from "virtual:prestige/collection-all";
6
+ import config from "virtual:prestige/config";
7
+ import { ArrowLeft, ArrowRight, BookOpen, ChevronRight, ExternalLink, Github, Menu, Moon, Sun, SunMoon, X } from "lucide-react";
8
+ import "@docsearch/css";
9
+ import { DocSearch } from "@docsearch/react";
10
+ import { ThemeProvider, useTheme } from "@lonik/themer";
11
+ import clsx from "clsx";
12
+
13
+ //#region src/ui/components/aside/aside.tsx
14
+ const typeMap = {
15
+ note: "bg-blue-50/50 dark:bg-blue-900/20 border-blue-500 text-blue-900 dark:text-blue-200",
16
+ tip: "bg-purple-50/50 dark:bg-purple-900/20 border-purple-500 text-purple-900 dark:text-purple-200",
17
+ caution: "bg-yellow-50/50 dark:bg-yellow-900/20 border-yellow-500 text-yellow-900 dark:text-yellow-200",
18
+ danger: "bg-red-50/50 dark:bg-red-900/20 border-red-500 text-red-900 dark:text-red-200"
19
+ };
20
+ const defaultTitles = {
21
+ note: "Note",
22
+ tip: "Tip",
23
+ caution: "Caution",
24
+ danger: "Danger"
25
+ };
26
+ function Aside({ type = "note", title, children, className, ...props }) {
27
+ const iconProps = {
28
+ className: "w-5 h-5 flex-shrink-0",
29
+ xmlns: "http://www.w3.org/2000/svg",
30
+ width: "24",
31
+ height: "24",
32
+ viewBox: "0 0 24 24",
33
+ fill: "none",
34
+ stroke: "currentColor",
35
+ strokeWidth: "2",
36
+ strokeLinecap: "round",
37
+ strokeLinejoin: "round"
38
+ };
39
+ const Icon = () => {
40
+ switch (type) {
41
+ case "note": return /* @__PURE__ */ jsxs("svg", {
42
+ ...iconProps,
43
+ children: [
44
+ /* @__PURE__ */ jsx("circle", {
45
+ cx: "12",
46
+ cy: "12",
47
+ r: "10"
48
+ }),
49
+ /* @__PURE__ */ jsx("path", { d: "M12 16v-4" }),
50
+ /* @__PURE__ */ jsx("path", { d: "M12 8h.01" })
51
+ ]
52
+ });
53
+ case "tip": return /* @__PURE__ */ jsxs("svg", {
54
+ ...iconProps,
55
+ children: [
56
+ /* @__PURE__ */ jsx("path", { d: "M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z" }),
57
+ /* @__PURE__ */ jsx("path", { d: "m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z" }),
58
+ /* @__PURE__ */ jsx("path", { d: "M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0" }),
59
+ /* @__PURE__ */ jsx("path", { d: "M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5" })
60
+ ]
61
+ });
62
+ case "caution": return /* @__PURE__ */ jsxs("svg", {
63
+ ...iconProps,
64
+ children: [
65
+ /* @__PURE__ */ jsx("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" }),
66
+ /* @__PURE__ */ jsx("path", { d: "M12 9v4" }),
67
+ /* @__PURE__ */ jsx("path", { d: "M12 17h.01" })
68
+ ]
69
+ });
70
+ case "danger": return /* @__PURE__ */ jsxs("svg", {
71
+ ...iconProps,
72
+ children: [
73
+ /* @__PURE__ */ jsx("polygon", { points: "7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2" }),
74
+ /* @__PURE__ */ jsx("path", { d: "M12 8v4" }),
75
+ /* @__PURE__ */ jsx("path", { d: "M12 16h.01" })
76
+ ]
77
+ });
78
+ default: return null;
79
+ }
80
+ };
81
+ return /* @__PURE__ */ jsxs("aside", {
82
+ "aria-label": defaultTitles[type],
83
+ className: `relative my-6 px-4 py-3 border-l-4 rounded-lg ${typeMap[type]} ${className || ""}`,
84
+ ...props,
85
+ children: [/* @__PURE__ */ jsxs("p", {
86
+ className: "flex items-center gap-2 mb-2 mt-0 font-bold text-lg",
87
+ children: [/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Icon, {}) }), title || defaultTitles[type]]
88
+ }), /* @__PURE__ */ jsx("section", {
89
+ className: "[&>p]:mt-0 [&>p]:mb-2 [&>p:last-child]:mb-0 text-sm",
90
+ children
91
+ })]
92
+ });
93
+ }
94
+
95
+ //#endregion
96
+ //#region src/ui/components/code/code.tsx
97
+ function Code({ code, children }) {
98
+ return /* @__PURE__ */ jsx("pre", { children: /* @__PURE__ */ jsx("code", { children: code ?? children }) });
99
+ }
100
+
101
+ //#endregion
102
+ //#region src/ui/components/tabs/tabs.tsx
103
+ function Tabs({ orientation = "horizontal", className, ...props }) {
104
+ return /* @__PURE__ */ jsx(Tabs$1.Root, {
105
+ "data-slot": "tabs",
106
+ "data-orientation": orientation,
107
+ className: `w-full ${className || ""}`,
108
+ ...props
109
+ });
110
+ }
111
+ function TabsList({ className, ...props }) {
112
+ return /* @__PURE__ */ jsx(Tabs$1.List, {
113
+ "data-slot": "tabs-list",
114
+ className: `flex w-full overflow-x-auto border-b border-default-200 no-scrollbar ${className || ""}`,
115
+ ...props
116
+ });
117
+ }
118
+ function TabsTrigger({ className, ...props }) {
119
+ return /* @__PURE__ */ jsx(Tabs$1.Tab, {
120
+ "data-slot": "tabs-trigger",
121
+ className: `
122
+ -mb-px flex items-center justify-center whitespace-nowrap border-b-2 border-transparent
123
+ px-4 py-2.5 text-sm font-medium transition-colors cursor-pointer
124
+ text-default-600 hover:text-default-900 hover:border-default-300
125
+ aria-selected:border-primary-500 aria-selected:text-primary-500
126
+ focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2
127
+ disabled:pointer-events-none disabled:opacity-50
128
+ ${className || ""}
129
+ `,
130
+ ...props
131
+ });
132
+ }
133
+ function TabsContent({ className, ...props }) {
134
+ return /* @__PURE__ */ jsx(Tabs$1.Panel, {
135
+ "data-slot": "tabs-content",
136
+ className: `mt-4 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 ${className || ""}`,
137
+ ...props
138
+ });
139
+ }
140
+
141
+ //#endregion
142
+ //#region src/ui/components/package-managers/package-managers.tsx
143
+ const MANAGERS = [
144
+ "npm",
145
+ "pnpm",
146
+ "yarn",
147
+ "bun"
148
+ ];
149
+ function generateCommand(pm, type, pkg, dev, args) {
150
+ const parts = [];
151
+ switch (type) {
152
+ case "add":
153
+ parts.push(pm === "npm" ? "npm install" : `${pm} add`);
154
+ if (dev) parts.push("-D");
155
+ if (pkg) parts.push(pkg);
156
+ break;
157
+ case "create":
158
+ parts.push(`${pm} create`);
159
+ if (pkg) parts.push(pkg);
160
+ break;
161
+ case "exec":
162
+ if (pm === "npm") parts.push("npx");
163
+ else if (pm === "bun") parts.push("bun x");
164
+ else parts.push(`${pm} dlx`);
165
+ if (pkg) parts.push(pkg);
166
+ break;
167
+ case "run":
168
+ parts.push(pm === "yarn" ? "yarn" : `${pm} run`);
169
+ if (pkg) parts.push(pkg);
170
+ break;
171
+ }
172
+ if (args) {
173
+ if (pm === "npm" && (type === "exec" || type === "run")) parts.push("--");
174
+ parts.push(args);
175
+ }
176
+ return parts.join(" ");
177
+ }
178
+ function PackageManagers({ pkg, type = "add", dev = false, args, className }) {
179
+ return /* @__PURE__ */ jsxs(Tabs, {
180
+ defaultValue: "npm",
181
+ className: `my-6 ${className || ""}`,
182
+ children: [/* @__PURE__ */ jsx(TabsList, { children: MANAGERS.map((pm) => /* @__PURE__ */ jsx(TabsTrigger, {
183
+ value: pm,
184
+ children: pm.toLowerCase()
185
+ }, pm)) }), MANAGERS.map((pm) => {
186
+ return /* @__PURE__ */ jsx(TabsContent, {
187
+ keepMounted: true,
188
+ value: pm,
189
+ children: /* @__PURE__ */ jsx(Code, {
190
+ language: "bash",
191
+ children: generateCommand(pm, type, pkg, dev, args)
192
+ })
193
+ }, pm);
194
+ })]
195
+ });
196
+ }
197
+
198
+ //#endregion
199
+ //#region src/ui/core/github/github.tsx
200
+ function GitHub({ github }) {
201
+ if (!github) return null;
202
+ return /* @__PURE__ */ jsx("a", {
203
+ href: github,
204
+ target: "_blank",
205
+ rel: "noreferrer",
206
+ "aria-label": "GitHub repository",
207
+ title: "GitHub repository",
208
+ className: "inline-flex h-8 w-8 items-center justify-center rounded border border-default-200 bg-default-50 text-default-500 hover:bg-default-100",
209
+ children: /* @__PURE__ */ jsx(Github, { size: 16 })
210
+ });
211
+ }
212
+
213
+ //#endregion
214
+ //#region src/ui/core/search/search.tsx
215
+ function Search({ algolia }) {
216
+ if (!algolia) return null;
217
+ return /* @__PURE__ */ jsx("div", {
218
+ className: "prestige-search",
219
+ children: /* @__PURE__ */ jsx(DocSearch, {
220
+ appId: algolia.appId,
221
+ apiKey: algolia.apiKey,
222
+ indices: algolia.indices
223
+ })
224
+ });
225
+ }
226
+
227
+ //#endregion
228
+ //#region src/ui/core/theme/theme.tsx
229
+ const themeOrder = [
230
+ "system",
231
+ "light",
232
+ "dark"
233
+ ];
234
+ function Theme() {
235
+ const { theme, setTheme } = useTheme();
236
+ const currentTheme = theme ?? "system";
237
+ const hydrated = useHydrated();
238
+ const nextTheme = (value) => {
239
+ return themeOrder[(themeOrder.indexOf(value) + 1) % themeOrder.length];
240
+ };
241
+ const icon = currentTheme === "light" ? /* @__PURE__ */ jsx(Sun, { size: 16 }) : currentTheme === "dark" ? /* @__PURE__ */ jsx(Moon, { size: 16 }) : /* @__PURE__ */ jsx(SunMoon, { size: 16 });
242
+ return /* @__PURE__ */ jsx("button", {
243
+ suppressHydrationWarning: true,
244
+ type: "button",
245
+ "aria-label": `Theme: ${currentTheme}. Click to switch theme`,
246
+ title: `Theme: ${currentTheme}`,
247
+ className: "inline-flex h-8 w-8 items-center justify-center rounded-md border border-default-200 bg-default-50 text-default-500 hover:bg-default-100 cursor-pointer",
248
+ onClick: () => setTheme(nextTheme(currentTheme)),
249
+ children: hydrated && icon
250
+ });
251
+ }
252
+
253
+ //#endregion
254
+ //#region src/ui/core/header/header.tsx
255
+ function Header({ customHeaderTitle }) {
256
+ const location = useLocation();
257
+ return /* @__PURE__ */ jsx("header", {
258
+ className: "sticky top-0 z-40 flex h-header border-b border-default-200 bg-default-50/80 px-4 backdrop-blur-md",
259
+ children: /* @__PURE__ */ jsxs("div", {
260
+ className: "container mx-auto flex max-w-360 items-center justify-between",
261
+ children: [/* @__PURE__ */ jsxs("div", {
262
+ className: "flex gap-4 items-baseline",
263
+ children: [/* @__PURE__ */ jsx(Link, {
264
+ className: "text-sm rounded hover:bg-default-100 text-default-500",
265
+ to: "/",
266
+ children: customHeaderTitle ? customHeaderTitle() : /* @__PURE__ */ jsx("span", { children: config.title })
267
+ }), collections.map((collection) => {
268
+ const isActive = location.pathname === `/${collection.id}` || location.pathname.startsWith(`/${collection.id}/`);
269
+ return /* @__PURE__ */ jsx(Link, {
270
+ to: `/${collection.defaultLink}`,
271
+ className: `border-b-2 text-sm rounded hover:bg-default-100 active:bg-default-200 capitalize ${isActive ? "border-default-800 text-default-800 font-medium" : "border-b-transparent text-default-500"}`,
272
+ children: collection.label
273
+ }, collection.id);
274
+ })]
275
+ }), /* @__PURE__ */ jsxs("div", {
276
+ className: "flex items-center gap-2",
277
+ children: [
278
+ /* @__PURE__ */ jsx(Search, { algolia: config.algolia }),
279
+ /* @__PURE__ */ jsx(GitHub, { github: config.github }),
280
+ /* @__PURE__ */ jsx(Theme, {})
281
+ ]
282
+ })]
283
+ })
284
+ });
285
+ }
286
+
287
+ //#endregion
288
+ //#region src/ui/routes/content/content-navigations.tsx
289
+ function ContentNavigation({ isNext, navigation }) {
290
+ const label = isNext ? "Next" : "Previous";
291
+ return /* @__PURE__ */ jsx(Link, {
292
+ to: "/" + navigation.slug,
293
+ className: clsx(" flex-1 h-20 mb-4 border border-default-200 hover:bg-default-50 rounded-md cursor-pointer flex items-center px-4", isNext ? "justify-end" : "justify-start"),
294
+ children: /* @__PURE__ */ jsxs("div", {
295
+ className: clsx("flex items-center gap-4", isNext && "flex-row-reverse"),
296
+ children: [isNext ? /* @__PURE__ */ jsx(ArrowRight, { className: "text-default-400" }) : /* @__PURE__ */ jsx(ArrowLeft, { className: "text-default-400" }), /* @__PURE__ */ jsxs("div", {
297
+ className: clsx("flex flex-col", isNext && "items-end"),
298
+ children: [/* @__PURE__ */ jsx("span", {
299
+ className: "text-xs tracking-widest font-mono",
300
+ children: label.toLocaleUpperCase()
301
+ }), /* @__PURE__ */ jsx("span", {
302
+ className: "text-2xl font-li text-default-700",
303
+ children: navigation.label
304
+ })]
305
+ })]
306
+ })
307
+ });
308
+ }
309
+ function ContentNavigations({ prev, next }) {
310
+ return /* @__PURE__ */ jsxs("div", {
311
+ className: "lg:flex flex-row items-center gap-2 mt-2 lg:mt-20 px-6",
312
+ children: [prev && /* @__PURE__ */ jsx(ContentNavigation, { navigation: prev }), next && /* @__PURE__ */ jsx(ContentNavigation, {
313
+ navigation: next,
314
+ isNext: true
315
+ })]
316
+ });
317
+ }
318
+
319
+ //#endregion
320
+ //#region src/ui/routes/content/table-of-contents/use-table-of-contents.ts
321
+ function useTableOfContents(toc) {
322
+ const [activeId, setActiveId] = useState("");
323
+ useEffect(() => {
324
+ if (toc.length === 0) return;
325
+ const handleScroll = () => {
326
+ const headingElements = toc.map((item) => {
327
+ const id = item.href.startsWith("#") ? item.href.slice(1) : item.href;
328
+ return document.getElementById(id);
329
+ }).filter((el) => el !== null);
330
+ const scrollPosition = window.scrollY + 100;
331
+ let currentActiveId = "";
332
+ for (let i = headingElements.length - 1; i >= 0; i--) {
333
+ const element = headingElements[i];
334
+ if (element && element.offsetTop <= scrollPosition) {
335
+ currentActiveId = element.id;
336
+ break;
337
+ }
338
+ }
339
+ if (!currentActiveId && headingElements.length > 0 && headingElements[0]) currentActiveId = headingElements[0].id;
340
+ setActiveId(currentActiveId ? `#${currentActiveId}` : "");
341
+ };
342
+ window.addEventListener("scroll", handleScroll, { passive: true });
343
+ setTimeout(handleScroll, 100);
344
+ return () => window.removeEventListener("scroll", handleScroll);
345
+ }, [toc]);
346
+ const handleLinkClick = (e, href) => {
347
+ e.preventDefault();
348
+ const id = href.startsWith("#") ? href.slice(1) : href;
349
+ const element = document.getElementById(id);
350
+ if (element) {
351
+ element.scrollIntoView({ behavior: "smooth" });
352
+ window.history.pushState(null, "", href.startsWith("#") ? href : `#${href}`);
353
+ }
354
+ };
355
+ return {
356
+ activeId,
357
+ handleLinkClick
358
+ };
359
+ }
360
+
361
+ //#endregion
362
+ //#region src/ui/routes/content/table-of-contents/mobile-table-of-contents.tsx
363
+ function MobileTableOfContent({ toc }) {
364
+ const [isOpen, setIsOpen] = useState(false);
365
+ const { activeId, handleLinkClick } = useTableOfContents(toc);
366
+ const containerRef = useRef(null);
367
+ useEffect(() => {
368
+ function handleClickOutside(event) {
369
+ if (containerRef.current && !containerRef.current.contains(event.target)) setIsOpen(false);
370
+ }
371
+ document.addEventListener("mousedown", handleClickOutside);
372
+ return () => {
373
+ document.removeEventListener("mousedown", handleClickOutside);
374
+ };
375
+ }, []);
376
+ if (toc.length === 0) return null;
377
+ const activeItem = toc.find((item) => {
378
+ return (item.href.startsWith("#") ? item.href : `#${item.href}`) === activeId;
379
+ });
380
+ return /* @__PURE__ */ jsx("div", {
381
+ ref: containerRef,
382
+ className: "sticky top-header z-30 -mx-6 -mt-10 mb-8 bg-default-50/95 backdrop-blur border-b border-default-200 dark:border-default-800 lg:hidden px-6 pl-12",
383
+ children: /* @__PURE__ */ jsxs("div", {
384
+ className: "relative",
385
+ children: [/* @__PURE__ */ jsxs("button", {
386
+ onClick: () => setIsOpen((prev) => !prev),
387
+ className: "flex w-full items-center justify-between gap-4 px-6 py-3 text-sm text-default-500 font-medium cursor-pointer",
388
+ children: [/* @__PURE__ */ jsxs("div", {
389
+ className: "flex items-center gap-2",
390
+ children: [/* @__PURE__ */ jsx("span", { children: "On this page" }), /* @__PURE__ */ jsx(ChevronRight, { className: clsx("w-4 h-4 transition-transform duration-200", isOpen && "rotate-90") })]
391
+ }), activeItem && /* @__PURE__ */ jsx("span", {
392
+ className: "truncate font-normal max-w-[50%] text-right",
393
+ children: activeItem.value
394
+ })]
395
+ }), isOpen && /* @__PURE__ */ jsx("div", {
396
+ className: "absolute left-6 right-6 top-full mt-2 max-h-[60vh] overflow-y-auto rounded-lg border border-default-200 bg-background shadow-xl",
397
+ children: /* @__PURE__ */ jsx("ul", {
398
+ className: "p-4 space-y-2.5 text-sm",
399
+ children: toc.map((item) => {
400
+ const itemHref = item.href.startsWith("#") ? item.href : `#${item.href}`;
401
+ const isActive = activeId === itemHref;
402
+ return /* @__PURE__ */ jsx("li", {
403
+ style: { paddingLeft: `${(item.depth - 1) * .75}rem` },
404
+ children: /* @__PURE__ */ jsx("a", {
405
+ href: itemHref,
406
+ className: clsx("block transition-colors duration-200 line-clamp-2", isActive ? "text-primary-600 font-medium" : "text-default-600"),
407
+ onClick: (e) => {
408
+ handleLinkClick(e, item.href);
409
+ setIsOpen(false);
410
+ },
411
+ children: item.value
412
+ })
413
+ }, itemHref);
414
+ })
415
+ })
416
+ })]
417
+ })
418
+ });
419
+ }
420
+
421
+ //#endregion
422
+ //#region src/ui/routes/content/table-of-contents/web-table-of-contents.tsx
423
+ function WebTableOfContent({ toc }) {
424
+ const { activeId, handleLinkClick } = useTableOfContents(toc);
425
+ if (toc.length === 0) return null;
426
+ return /* @__PURE__ */ jsxs("nav", {
427
+ className: "sticky top-header h-main pt-4 overflow-y-auto w-64 shrink-0 hidden lg:block",
428
+ children: [/* @__PURE__ */ jsx("span", {
429
+ className: "text-xs font-mono tracking-widest",
430
+ children: "ON THIS PAGE"
431
+ }), /* @__PURE__ */ jsx("ul", {
432
+ className: "text-sm my-4",
433
+ children: toc.map((item) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("a", {
434
+ href: `${item.href}`,
435
+ className: clsx("border-l py-1 px-4 block hover:text-default-700 dark:hover:text-slate-100 transition-colors duration-200 line-clamp-2", activeId === item.href ? "text-default-700 border-default-600 font-medium" : "text-default-500 border-default-200 "),
436
+ onClick: (e) => handleLinkClick(e, item.href),
437
+ children: item.value
438
+ }) }, item.href))
439
+ })]
440
+ });
441
+ }
442
+
443
+ //#endregion
444
+ //#region src/ui/core/prestige-page.tsx
445
+ function PrestigePage({ children, toc = [], prev = null, next = null }) {
446
+ return /* @__PURE__ */ jsxs("div", {
447
+ className: "flex lg:gap-6 items-start max-w-[100vw]",
448
+ children: [/* @__PURE__ */ jsxs("div", {
449
+ className: "flex-1 min-w-0",
450
+ children: [
451
+ /* @__PURE__ */ jsx(MobileTableOfContent, { toc }),
452
+ /* @__PURE__ */ jsx("article", {
453
+ className: "prose max-w-none wrap-break-word py-15 px-6",
454
+ children
455
+ }),
456
+ /* @__PURE__ */ jsx(ContentNavigations, {
457
+ prev,
458
+ next
459
+ })
460
+ ]
461
+ }), /* @__PURE__ */ jsx(WebTableOfContent, { toc })]
462
+ });
463
+ }
464
+
465
+ //#endregion
466
+ //#region src/ui/utils.ts
467
+ function isExternalURL(str) {
468
+ try {
469
+ const url = new URL(str);
470
+ return url.protocol === "http:" || url.protocol === "https:";
471
+ } catch {
472
+ return false;
473
+ }
474
+ }
475
+
476
+ //#endregion
477
+ //#region src/ui/routes/collection/sidebar.tsx
478
+ function SidebarGroup({ group, onLinkClick }) {
479
+ const [open, setIsOpen] = useState(true);
480
+ return /* @__PURE__ */ jsxs("div", {
481
+ className: "mt-4 flex flex-col gap-1",
482
+ children: [/* @__PURE__ */ jsxs("button", {
483
+ className: "flex items-center w-full gap-2",
484
+ onClick: () => setIsOpen((prev) => !prev),
485
+ children: [/* @__PURE__ */ jsx(ChevronRight, {
486
+ size: 18,
487
+ className: clsx("transform transition cursor-pointer ml-1", open && "rotate-90")
488
+ }), /* @__PURE__ */ jsx("span", {
489
+ className: "font-mono text-xs tracking-widest",
490
+ children: group.label.toUpperCase()
491
+ })]
492
+ }), open && /* @__PURE__ */ jsx("div", {
493
+ className: "mb-2",
494
+ children: group.items.map((item) => {
495
+ if ("slug" in item || "link" in item) {
496
+ const key = "slug" in item ? item.slug : item.link;
497
+ return /* @__PURE__ */ jsx(SidebarLink, {
498
+ showIcon: false,
499
+ link: item,
500
+ onLinkClick
501
+ }, key);
502
+ }
503
+ return /* @__PURE__ */ jsx(SidebarGroup, { group: item }, item.label);
504
+ })
505
+ })]
506
+ });
507
+ }
508
+ function SidebarLink({ link, onLinkClick, showIcon }) {
509
+ if ("slug" in link || !isExternalURL(link.link)) return /* @__PURE__ */ jsx("div", {
510
+ className: "flex items-center ",
511
+ children: /* @__PURE__ */ jsxs(Link, {
512
+ onClick: onLinkClick,
513
+ activeProps: { className: "text-default-700 font-medium" },
514
+ className: "w-full inline-flex gap-2 py-1 px-2 rounded hover:bg-default-100 text-sm mr-2 items-center text-default-500",
515
+ to: "slug" in link ? `/${link.slug}` : link.link,
516
+ children: [showIcon && /* @__PURE__ */ jsx(BookOpen, { className: "w-4" }), link.label]
517
+ })
518
+ });
519
+ else return /* @__PURE__ */ jsx("div", {
520
+ className: "flex items-center ",
521
+ children: /* @__PURE__ */ jsxs("a", {
522
+ onClick: onLinkClick,
523
+ className: "w-full inline-flex gap-2 py-1 px-2 rounded hover:bg-default-100 text-sm mr-2 items-center text-default-500",
524
+ href: link.link,
525
+ target: "_blank",
526
+ rel: "noreferrer",
527
+ children: [showIcon && /* @__PURE__ */ jsx(ExternalLink, { className: "w-4" }), link.label]
528
+ })
529
+ });
530
+ }
531
+ function Sidebar({ sidebar, onLinkClick }) {
532
+ return /* @__PURE__ */ jsx("div", {
533
+ className: "w-full lg:w-sidebar border-r border-default-200 h-full overflow-auto lg:h-main lg:sticky top-header pt-4",
534
+ children: sidebar.items.map((item) => {
535
+ if ("slug" in item || "link" in item) {
536
+ const key = "slug" in item ? item.slug : item.link;
537
+ return /* @__PURE__ */ jsx(SidebarLink, {
538
+ showIcon: true,
539
+ onLinkClick,
540
+ link: item
541
+ }, key);
542
+ }
543
+ return /* @__PURE__ */ jsx(SidebarGroup, { group: item }, item.label);
544
+ })
545
+ });
546
+ }
547
+
548
+ //#endregion
549
+ //#region src/ui/routes/collection/mobile-sidebar.tsx
550
+ function SidebarOverlay({ sidebar }) {
551
+ const [isOpen, setIsOpen] = useState(false);
552
+ return /* @__PURE__ */ jsxs("div", {
553
+ className: "lg:hidden",
554
+ children: [/* @__PURE__ */ jsx("button", {
555
+ className: "bg-transparent p-3 -mt-[2px] text-default-700 top-header left-0 fixed z-50",
556
+ onClick: () => setIsOpen((prev) => !prev),
557
+ children: isOpen ? /* @__PURE__ */ jsx(X, {}) : /* @__PURE__ */ jsx(Menu, {})
558
+ }), isOpen && /* @__PURE__ */ jsx("div", {
559
+ className: "fixed top-[calc(var(--spacing-header)+44 )] shadow-xl left-0 overflow-auto z-10 bg-default-50 w-full h-screen",
560
+ children: /* @__PURE__ */ jsx(Sidebar, {
561
+ onLinkClick: () => setIsOpen(false),
562
+ sidebar
563
+ })
564
+ })]
565
+ });
566
+ }
567
+ function MobileSidebar({ sidebar }) {
568
+ return /* @__PURE__ */ jsx(SidebarOverlay, { sidebar });
569
+ }
570
+
571
+ //#endregion
572
+ //#region src/ui/routes/collection/collection.route.tsx
573
+ function CollectionRoute(sidebar, id) {
574
+ return { component: () => {
575
+ return /* @__PURE__ */ jsxs("div", {
576
+ className: "container mx-auto flex max-w-360 lg:gap-6",
577
+ children: [
578
+ /* @__PURE__ */ jsx(MobileSidebar, { sidebar }),
579
+ /* @__PURE__ */ jsx("div", {
580
+ className: "hidden lg:block",
581
+ children: sidebar && /* @__PURE__ */ jsx(Sidebar, { sidebar })
582
+ }),
583
+ /* @__PURE__ */ jsx("div", {
584
+ className: "flex-1 pb-20",
585
+ children: /* @__PURE__ */ jsx(Outlet, {})
586
+ })
587
+ ]
588
+ });
589
+ } };
590
+ }
591
+
592
+ //#endregion
593
+ //#region src/ui/routes/content/content.route.tsx
594
+ function ContentRoute(inlineData) {
595
+ const { frontmatter, prev, next, toc, default: Component } = inlineData;
596
+ return {
597
+ head: () => {
598
+ const metas = [];
599
+ const description = frontmatter.description;
600
+ const title = frontmatter.title;
601
+ if (title) metas.push({ title: title + " | " + config.title });
602
+ if (description) metas.push({
603
+ name: "description",
604
+ content: description
605
+ });
606
+ return { meta: metas };
607
+ },
608
+ component: () => {
609
+ return /* @__PURE__ */ jsxs("div", {
610
+ className: "flex lg:gap-6 items-start max-w-[100vw]",
611
+ children: [/* @__PURE__ */ jsxs("div", {
612
+ className: "flex-1 min-w-0",
613
+ children: [
614
+ /* @__PURE__ */ jsx(MobileTableOfContent, { toc }),
615
+ /* @__PURE__ */ jsx("article", {
616
+ className: "prose max-w-none wrap-break-word py-15 px-6",
617
+ children: /* @__PURE__ */ jsx(Component, {})
618
+ }),
619
+ /* @__PURE__ */ jsx(ContentNavigations, {
620
+ prev,
621
+ next
622
+ })
623
+ ]
624
+ }), /* @__PURE__ */ jsx(WebTableOfContent, { toc })]
625
+ });
626
+ }
627
+ };
628
+ }
629
+
630
+ //#endregion
631
+ //#region src/ui/routes/not-found.tsx
632
+ function NotFound() {
633
+ return /* @__PURE__ */ jsx("h1", { children: "This page could not be found." });
634
+ }
635
+
636
+ //#endregion
637
+ //#region src/ui/core/footer/footer.tsx
638
+ function License() {
639
+ if (!config.license) return null;
640
+ return /* @__PURE__ */ jsxs("a", {
641
+ target: "_blank",
642
+ href: config.license.url,
643
+ children: ["Released under: ", config.license.label]
644
+ });
645
+ }
646
+ function Footer() {
647
+ return /* @__PURE__ */ jsx("footer", {
648
+ className: "mt-10 flex items-center justify-center border-t border-t-default-100 pt-10 bg-default-50 text-sm py-10 text-default-700",
649
+ children: /* @__PURE__ */ jsx(License, {})
650
+ });
651
+ }
652
+
653
+ //#endregion
654
+ //#region src/ui/routes/prestige-shell.tsx
655
+ function PrestigeShell({ children, options }) {
656
+ return /* @__PURE__ */ jsxs(ThemeProvider, {
657
+ attribute: "data-theme",
658
+ defaultTheme: "system",
659
+ children: [
660
+ /* @__PURE__ */ jsx(Header, {
661
+ customHeaderTitle: options?.customHeaderTitle,
662
+ ...options
663
+ }),
664
+ /* @__PURE__ */ jsx("main", {
665
+ className: "min-h-[calc(100vh-var(--spacing-header))]",
666
+ children
667
+ }),
668
+ /* @__PURE__ */ jsx(Footer, {})
669
+ ]
670
+ });
671
+ }
672
+
673
+ //#endregion
674
+ export { Aside, Code, CollectionRoute, ContentRoute, Header, NotFound, PackageManagers, PrestigePage, PrestigeShell, Tabs, TabsContent, TabsList, TabsTrigger };
675
+ //# sourceMappingURL=ui.js.map