boltdocs 3.0.2 → 3.1.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 (113) hide show
  1. package/README.md +2 -18
  2. package/dist/{adapters-C5AWWGfb.cjs → adapters-uGz-UKQa.cjs} +1 -1
  3. package/dist/{banner-DNSkgUsO.d.cts → banner-DdSgCs4G.d.cts} +1 -1
  4. package/dist/{banner-CfdalYLL.d.ts → banner-DjujkctF.d.ts} +1 -1
  5. package/dist/cache-B0C2i0yP.mjs +6 -0
  6. package/dist/cache-CfRTUzWC.cjs +6 -0
  7. package/dist/chunk-hT5z_Zn9-DsJawvsz.mjs +6 -0
  8. package/dist/chunk-hT5z_Zn9-SKz6VFXu.cjs +6 -0
  9. package/dist/client/index.cjs +227 -113
  10. package/dist/client/index.d.cts +57 -12
  11. package/dist/client/index.d.ts +57 -12
  12. package/dist/client/index.js +227 -114
  13. package/dist/client/mdx.cjs +1 -1
  14. package/dist/client/mdx.js +1 -1
  15. package/dist/client/primitives.cjs +4 -4
  16. package/dist/client/primitives.d.cts +1 -1
  17. package/dist/client/primitives.d.ts +1 -1
  18. package/dist/client/primitives.js +4 -4
  19. package/dist/client/theme/neutral.css +1 -3
  20. package/dist/{config-JGkMJoJQ.cjs → config-BxsogK5A.cjs} +1 -1
  21. package/dist/config-DAgpZyh6.mjs +7 -0
  22. package/dist/config-DrRQYDCI.cjs +7 -0
  23. package/dist/{docs-layout-3TpAt6MB.cjs → docs-layout-D1buSdua.cjs} +1 -1
  24. package/dist/{docs-layout-6FQ8__ok.js → docs-layout-DyLDBwS6.js} +1 -1
  25. package/dist/{doctor-DQxLM202.cjs → doctor-BadGEhXv.cjs} +1 -1
  26. package/dist/{doctor-BR1B2Mkz.cjs → doctor-DPDcRKM1.cjs} +1 -1
  27. package/dist/{doctor-3MheVMwd.mjs → doctor-vDsUDgqp.mjs} +1 -1
  28. package/dist/escape-string-regexp-AG8q1e25-9Un9V90q.mjs +6 -0
  29. package/dist/escape-string-regexp-AG8q1e25-bJ9Ixe7c.cjs +6 -0
  30. package/dist/esm-shims-DSep1HcR.mjs +6 -0
  31. package/dist/{icons-dev-kJyGWNeg.js → icons-dev-CHZOwhQA.js} +8 -3
  32. package/dist/{icons-dev-BryEFkJu.cjs → icons-dev-YtDoLUsb.cjs} +8 -3
  33. package/dist/{image-C9md50h2.js → image-5WsgWYTh.js} +2 -2
  34. package/dist/{image-CR6UlaI5.cjs → image-Hb105Gu6.cjs} +2 -2
  35. package/dist/lib-BR0SoanK-CLswltLI.cjs +6 -0
  36. package/dist/lib-BR0SoanK-DcYeDrE6.mjs +6 -0
  37. package/dist/lib-DPoCz1YB-CLYXwKST.cjs +6 -0
  38. package/dist/lib-DPoCz1YB-CyGOqgSO.mjs +6 -0
  39. package/dist/{mdx-DhyMkc35.js → mdx-Bv-pS6-O.js} +6 -2
  40. package/dist/{mdx-DJBg5DuL.cjs → mdx-CDUcJmye.cjs} +6 -2
  41. package/dist/micromark-util-character-5KqJafVT-C6gnc770.cjs +6 -0
  42. package/dist/micromark-util-character-5KqJafVT-DkPKsbgn.mjs +6 -0
  43. package/dist/node/cache.cjs +6 -0
  44. package/dist/node/cache.d.cts +83 -0
  45. package/dist/node/cache.d.mts +83 -0
  46. package/dist/node/cache.mjs +6 -0
  47. package/dist/node/cli-entry.cjs +3 -3
  48. package/dist/node/cli-entry.mjs +3 -3
  49. package/dist/node/index.cjs +1 -1
  50. package/dist/node/index.d.cts +10 -467
  51. package/dist/node/index.d.mts +12 -468
  52. package/dist/node/index.mjs +1 -1
  53. package/dist/node/mdx/shiki-adapter.cjs +6 -0
  54. package/dist/node/mdx/shiki-adapter.d.cts +3 -0
  55. package/dist/node/mdx/shiki-adapter.d.mts +3 -0
  56. package/dist/node/mdx/shiki-adapter.mjs +6 -0
  57. package/dist/node-BDBv8CT6.mjs +104 -0
  58. package/dist/node-DFV_FV0y.mjs +6 -0
  59. package/dist/node-DqsP7kXz.cjs +6 -0
  60. package/dist/node-yFmAavND.cjs +104 -0
  61. package/dist/{package-_dCCKVvG.mjs → package-CoHWTf0N.mjs} +1 -1
  62. package/dist/{package-CEDhVAfO.cjs → package-_-Oa8-qN.cjs} +1 -1
  63. package/dist/{parser-D0QHIQsi.mjs → parser-BZJgAa9E.mjs} +1 -1
  64. package/dist/{parser-CNIPHx4s.cjs → parser-DlanzESE.cjs} +1 -1
  65. package/dist/plugin-BVuwx5D9.cjs +73 -0
  66. package/dist/plugin-BoxD91Yh.mjs +73 -0
  67. package/dist/rehype-slug--ZOxZ-_K-BNeYC4aT.cjs +6 -0
  68. package/dist/rehype-slug--ZOxZ-_K-CjIQEJCs.mjs +6 -0
  69. package/dist/remark-frontmatter-wFYRLcCt-CutW0gA3.mjs +8 -0
  70. package/dist/remark-frontmatter-wFYRLcCt-ENB5qG3y.cjs +8 -0
  71. package/dist/remark-gfm-B8TMkQbX-CjUJo8Rd.cjs +21 -0
  72. package/dist/remark-gfm-B8TMkQbX-Ctu0VV1_.mjs +21 -0
  73. package/dist/rollup-DMqoG11U-CKcJ37u_.mjs +59 -0
  74. package/dist/rollup-DMqoG11U-DKdxvZIj.cjs +59 -0
  75. package/dist/routes-BN2XbGcT.mjs +6 -0
  76. package/dist/routes-Cnq8xTCv.cjs +6 -0
  77. package/dist/{routes-BajCwrvX.cjs → routes-D_S9kjkS.cjs} +1 -1
  78. package/dist/{search-dialog-CW1f6dn6.cjs → search-dialog-BIuxGQsg.cjs} +1 -1
  79. package/dist/{search-dialog-Cx7aGW3U.cjs → search-dialog-BbtxA1uT.cjs} +2 -2
  80. package/dist/{search-dialog-D4rplZMv.cjs → search-dialog-BpNULmrl.cjs} +1 -1
  81. package/dist/{search-dialog-DDopgbKM.js → search-dialog-DC7oXU-5.js} +2 -2
  82. package/dist/{search-dialog-DaeSPvEo.js → search-dialog-PJrFRU5G.js} +1 -1
  83. package/dist/{search-dialog-BNdRV60O.js → search-dialog-gp9lrJXm.js} +1 -1
  84. package/dist/server/index.cjs +1 -1
  85. package/dist/server/index.d.mts +1 -1
  86. package/dist/shiki-adapter-CK3llqw2.mjs +6 -0
  87. package/dist/shiki-adapter-fS94vy-z.d.mts +534 -0
  88. package/dist/shiki-adapter-l2kEP5rn.d.cts +534 -0
  89. package/dist/{sidebar-BAKgJ-Er.d.ts → sidebar-DH2iPKXM.d.cts} +187 -10
  90. package/dist/{sidebar-7gIifpBX.d.cts → sidebar-DknLUI1R.d.ts} +187 -10
  91. package/package.json +16 -5
  92. package/src/shared/types.ts +177 -10
  93. package/dist/cache-DETwlACe.cjs +0 -6
  94. package/dist/cache-SF59enb3.mjs +0 -6
  95. package/dist/config-B5uVv5q4.cjs +0 -7
  96. package/dist/config-D3_zDkHh.mjs +0 -7
  97. package/dist/node-B9JSyEIU.mjs +0 -105
  98. package/dist/node-Cedquois.cjs +0 -105
  99. package/dist/plugin-WYNORxp1.cjs +0 -68
  100. package/dist/plugin-YWNVRpws.mjs +0 -68
  101. package/dist/routes-CyrnmVuG.mjs +0 -6
  102. package/dist/routes-D6Tuu7Fs.cjs +0 -6
  103. package/dist/shiki-adapter-CXEGRnjr.mjs +0 -6
  104. package/dist/shiki-adapter-Mr8_oT_9.cjs +0 -6
  105. /package/dist/{csp-CBysWlAf.cjs → csp-BX06rvdg.cjs} +0 -0
  106. /package/dist/{csp-gaZ51xzq.mjs → csp-z2D0FuRW.mjs} +0 -0
  107. /package/dist/{generator-DtUU3Cfk.cjs → generator-BN75lJOv.cjs} +0 -0
  108. /package/dist/{handler-Dzf4dSnV.cjs → handler-1LRMYeI4.cjs} +0 -0
  109. /package/dist/{headers-CXyf0auY.mjs → headers-CL0pMcwm.mjs} +0 -0
  110. /package/dist/{headers-BXKxiPUv.cjs → headers-YpD10rDb.cjs} +0 -0
  111. /package/dist/{index-CdJv4ocW.d.mts → index-DJYJzs-Z.d.mts} +0 -0
  112. /package/dist/{meta-loader-C4Hu9RN9.mjs → meta-loader-Bq-MjTXB.mjs} +0 -0
  113. /package/dist/{meta-loader-C9MKjAs0.cjs → meta-loader-CTB62-Mo.cjs} +0 -0
@@ -3,18 +3,18 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import { $ as TextAlignStart, C as RoutesProvider, D as Check, E as ArrowLeft, F as FaceBad, I as FaceGood, J as Moon, K as Menu, L as FaceRegular, M as Copy, O as ChevronDown, P as ExternalLink, Q as Sun, S as normalizePath, U as Languages, V as Home, X as Pencil, _ as Link$1, at as useBoltdocsContext, b as useLocalizedTo, et as X, it as BoltdocsProvider, j as CircleHelp, nt as ConfigContext, q as Monitor, rt as useConfig, s as Github, tt as icons_exports, x as useRoutes, y as cn } from "../icons-dev-kJyGWNeg.js";
7
- import { c as ThemeProvider, l as useTheme } from "../image-C9md50h2.js";
8
- import { n as useCodeBlock, r as copyToClipboard, t as mdx_components_default } from "../mdx-DhyMkc35.js";
9
- import { A as useUI, C as useSidebar, D as ButtonGroup, O as Breadcrumbs$2, S as useLocation, T as Menu$1, f as PageNav$1, k as UIProvider, m as OnThisPage$1, n as Sidebar$1, t as DocsLayout$1, w as Tabs$1, x as useSearchHighlight } from "../docs-layout-6FQ8__ok.js";
10
- import { a as Button$1, n as Navbar$1, r as ErrorBoundary$1 } from "../search-dialog-DaeSPvEo.js";
11
- import { n as useSearch, r as InternalErrorBoundary, t as SearchDialog } from "../search-dialog-DDopgbKM.js";
6
+ import { $ as TextAlignStart, C as RoutesProvider, D as Check, E as ArrowLeft, F as FaceBad, I as FaceGood, J as Moon, K as Menu, L as FaceRegular, M as Copy, O as ChevronDown, P as ExternalLink, Q as Sun, S as normalizePath, U as Languages, V as Home, X as Pencil, _ as Link$1, at as useBoltdocsContext, b as useLocalizedTo, et as X, it as BoltdocsProvider, j as CircleHelp, nt as ConfigContext, q as Monitor, rt as useConfig, s as Github, tt as icons_exports, x as useRoutes, y as cn } from "../icons-dev-CHZOwhQA.js";
7
+ import { c as ThemeProvider, l as useTheme } from "../image-5WsgWYTh.js";
8
+ import { n as useCodeBlock, r as copyToClipboard, t as mdx_components_default } from "../mdx-Bv-pS6-O.js";
9
+ import { A as useUI, C as useSidebar, D as ButtonGroup, O as Breadcrumbs$2, S as useLocation, T as Menu$1, f as PageNav$1, k as UIProvider, m as OnThisPage$1, n as Sidebar$1, t as DocsLayout$1, w as Tabs$1, x as useSearchHighlight } from "../docs-layout-DyLDBwS6.js";
10
+ import { a as Button$1, n as Navbar$1, r as ErrorBoundary$1 } from "../search-dialog-PJrFRU5G.js";
11
+ import { n as useSearch, r as InternalErrorBoundary, t as SearchDialog } from "../search-dialog-DC7oXU-5.js";
12
12
  import { ViteReactSSG } from "@bdocs/ssg";
13
13
  import { Suspense, createContext, isValidElement, lazy, use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
14
14
  import { Link, Outlet, useLoaderData, useLocation as useLocation$1, useMatches, useNavigate } from "react-router-dom";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
- import * as ReactHelmetAsync from "react-helmet-async";
17
16
  import { Button } from "react-aria-components";
17
+ import * as ReactHelmetAsync from "react-helmet-async";
18
18
  import virtualCustomComponents from "virtual:boltdocs-mdx-components";
19
19
  import virtualIcons from "virtual:boltdocs-icons";
20
20
  import DOMPurify from "isomorphic-dompurify";
@@ -49,20 +49,6 @@ function MdxComponentsProvider({ components, children }) {
49
49
  });
50
50
  }
51
51
 
52
- //#endregion
53
- //#region src/client/app/helmet-compat.tsx
54
- const mod = ReactHelmetAsync;
55
- /**
56
- * The `<Helmet>` component, resolved across CJS/ESM module shapes.
57
- * Falls back to a transparent fragment wrapper if the module cannot be resolved.
58
- */
59
- const Helmet = mod.Helmet || mod.default?.Helmet || (({ children }) => /* @__PURE__ */ jsx(Fragment, { children }));
60
- /**
61
- * The `<HelmetProvider>` component, resolved across CJS/ESM module shapes.
62
- * Falls back to a transparent fragment wrapper if the module cannot be resolved.
63
- */
64
- const HelmetProvider = mod.HelmetProvider || mod.default?.HelmetProvider || (({ children }) => /* @__PURE__ */ jsx(Fragment, { children }));
65
-
66
52
  //#endregion
67
53
  //#region src/client/app/scroll-handler.tsx
68
54
  /**
@@ -155,6 +141,28 @@ const mdxComponentsDefault = {
155
141
  "404": NotFound
156
142
  };
157
143
 
144
+ //#endregion
145
+ //#region src/client/app/helmet-compat.tsx
146
+ const mod = ReactHelmetAsync;
147
+ /**
148
+ * The `<Helmet>` component, resolved across CJS/ESM module shapes.
149
+ * Falls back to a transparent fragment wrapper if the module cannot be resolved.
150
+ */
151
+ const Helmet = mod.Helmet || mod.default?.Helmet || (({ children }) => /* @__PURE__ */ jsx(Fragment, { children }));
152
+ /**
153
+ * The `<HelmetProvider>` component, resolved across CJS/ESM module shapes.
154
+ * Falls back to a transparent fragment wrapper if the module cannot be resolved.
155
+ */
156
+ const HelmetProvider = mod.HelmetProvider || mod.default?.HelmetProvider || (({ children }) => /* @__PURE__ */ jsx(Fragment, { children }));
157
+ if (typeof globalThis !== "undefined" && globalThis.__BOLTDOCS_SSG_RENDERING__) {
158
+ const hp = HelmetProvider;
159
+ if (hp && typeof hp === "function" && hp.canUseDOM) hp.canUseDOM = false;
160
+ }
161
+ if (typeof globalThis !== "undefined") {
162
+ globalThis.__BOLTDOCS_HELMET_PROVIDER__ = HelmetProvider;
163
+ globalThis.__BOLTDOCS_HELMET__ = Helmet;
164
+ }
165
+
158
166
  //#endregion
159
167
  //#region src/client/utils/i18n.ts
160
168
  /**
@@ -307,6 +315,16 @@ const CollectionsContext = createContext({});
307
315
  function useCollectionsData() {
308
316
  return use(CollectionsContext);
309
317
  }
318
+ const CurrentPostContext = createContext(null);
319
+ function CurrentPostProvider({ value, children }) {
320
+ return /* @__PURE__ */ jsx(CurrentPostContext.Provider, {
321
+ value,
322
+ children
323
+ });
324
+ }
325
+ function useCurrentPostData() {
326
+ return use(CurrentPostContext);
327
+ }
310
328
 
311
329
  //#endregion
312
330
  //#region src/client/ssg/boltdocs-shell.tsx
@@ -376,7 +394,7 @@ function BoltdocsShell({ config, routes, components = {}, collectionsData }) {
376
394
  config,
377
395
  routeMap
378
396
  ]);
379
- return /* @__PURE__ */ jsx(HelmetProvider, { children: /* @__PURE__ */ jsx(RoutesProvider, {
397
+ return /* @__PURE__ */ jsx(RoutesProvider, {
380
398
  routes,
381
399
  children: /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(UIProvider, { children: /* @__PURE__ */ jsx(MdxComponentsProvider, {
382
400
  components: allComponents,
@@ -404,7 +422,7 @@ function BoltdocsShell({ config, routes, components = {}, collectionsData }) {
404
422
  })
405
423
  })
406
424
  }) }) })
407
- }) });
425
+ });
408
426
  }
409
427
 
410
428
  //#endregion
@@ -449,17 +467,43 @@ function DocPage({ route, content: Content, mdxComponents: propComponents }) {
449
467
  /**
450
468
  * Renders an MDX page by consuming pre-loaded route data.
451
469
  *
452
- * - If the route belongs to a collection (`data.collection` is set), renders
453
- * the custom post component if provided, else falls back to the standard DocPage.
470
+ * - If the route belongs to a collection (`data.collection` is set), wraps
471
+ * the content with `CurrentPostProvider` so that `usePost()` (called without
472
+ * a slug) can read the current post's data from context.
454
473
  * - Otherwise, renders the standard `DocPage` layout.
455
474
  */
456
475
  function MdxPage({ MDXComponent, mdxComponents: propComponents, collectionPostComponent: CollectionPost }) {
457
476
  const data = useLoaderData();
458
477
  if (!MDXComponent) return null;
459
- if (!!data?.collection && CollectionPost) return /* @__PURE__ */ jsx(CollectionPost, {
460
- MDXComponent,
461
- mdxComponents: propComponents
462
- });
478
+ const collectionData = data;
479
+ if (!!collectionData?.collection) {
480
+ const postElement = CollectionPost ? /* @__PURE__ */ jsx(CollectionPost, {
481
+ MDXComponent,
482
+ mdxComponents: propComponents
483
+ }) : /* @__PURE__ */ jsx(DocPage, {
484
+ route: {
485
+ path: collectionData.route.path,
486
+ filePath: collectionData.route.filePath,
487
+ title: collectionData.route.title,
488
+ description: collectionData.route.description,
489
+ headings: collectionData.headings,
490
+ locale: collectionData.route.locale,
491
+ version: collectionData.route.version,
492
+ lastUpdated: collectionData.route.lastUpdated,
493
+ frontmatter: collectionData.route.frontmatter
494
+ },
495
+ content: MDXComponent,
496
+ mdxComponents: propComponents
497
+ });
498
+ return /* @__PURE__ */ jsx(CurrentPostProvider, {
499
+ value: {
500
+ route: collectionData.route,
501
+ headings: collectionData.headings,
502
+ collection: collectionData.collection
503
+ },
504
+ children: postElement
505
+ });
506
+ }
463
507
  const docData = data;
464
508
  return /* @__PURE__ */ jsx(DocPage, {
465
509
  route: {
@@ -1022,7 +1066,7 @@ function VersionSelector({ className }) {
1022
1066
  function useI18n() {
1023
1067
  const navigate = useNavigate();
1024
1068
  const config = useConfig();
1025
- const { allRoutes, currentRoute, currentLocale, currentVersion } = useRoutes();
1069
+ const { allRoutes, currentRoute, currentLocale, isCollectionPage } = useRoutes();
1026
1070
  const i18n = config.i18n;
1027
1071
  const { setLocale } = useBoltdocsContext();
1028
1072
  const handleLocaleChange = (locale) => {
@@ -1032,7 +1076,7 @@ function useI18n() {
1032
1076
  const safeBase = base === "/" ? "" : base.replace(/\/$/, "");
1033
1077
  const isDocRoute = !!currentRoute?.filePath;
1034
1078
  let targetPath = "";
1035
- if (currentRoute) if (isDocRoute) {
1079
+ if (currentRoute) if (isDocRoute && !currentRoute.collection && !isCollectionPage) {
1036
1080
  const baseFile = getBaseFilePath(currentRoute.filePath, currentRoute.version, currentRoute.locale);
1037
1081
  const targetRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === baseFile && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version);
1038
1082
  if (targetRoute) targetPath = targetRoute.path;
@@ -1044,25 +1088,29 @@ function useI18n() {
1044
1088
  } else {
1045
1089
  let rawExternal = currentRoute.path;
1046
1090
  const parts = rawExternal.split("/").filter(Boolean);
1047
- if (parts.length > 0 && (Array.isArray(i18n.locales) ? i18n.locales.includes(parts[0]) : !!i18n.locales[parts[0]])) {
1048
- parts.shift();
1091
+ const localePosition = currentRoute.collection ? 1 : 0;
1092
+ if (parts.length > localePosition && (Array.isArray(i18n.locales) ? i18n.locales.includes(parts[localePosition]) : !!i18n.locales[parts[localePosition]])) {
1093
+ parts.splice(localePosition, 1);
1049
1094
  rawExternal = "/" + parts.join("/");
1050
1095
  }
1096
+ const cleanParts = rawExternal.split("/").filter(Boolean);
1051
1097
  if (locale === i18n.defaultLocale) targetPath = rawExternal === "" ? "/" : rawExternal;
1052
1098
  else {
1053
- const cleanExt = rawExternal.startsWith("/") ? rawExternal : `/${rawExternal}`;
1054
- targetPath = `/${locale}${cleanExt === "/" ? "" : cleanExt}`;
1099
+ cleanParts.splice(localePosition, 0, locale);
1100
+ targetPath = "/" + cleanParts.join("/") || "/";
1055
1101
  }
1056
1102
  }
1057
1103
  else {
1058
- const targetRoute = allRoutes.find((r) => (r.locale || i18n.defaultLocale) === locale && (r.version || config.versions?.defaultVersion) === (currentVersion || config.versions?.defaultVersion));
1059
- if (targetRoute) targetPath = targetRoute.path;
1104
+ const currentPath = location.pathname;
1105
+ if (isCollectionPage) targetPath = currentPath;
1060
1106
  else {
1061
- const vPath = currentVersion && currentVersion !== config.versions?.defaultVersion ? `/${currentVersion}` : "";
1062
- targetPath = locale === i18n.defaultLocale ? `${safeBase}${vPath}` : `${safeBase}${vPath}/${locale}`;
1107
+ const parts = currentPath.split("/").filter(Boolean);
1108
+ if (parts.length > 0 && (Array.isArray(i18n.locales) ? i18n.locales.includes(parts[0]) : !!i18n.locales[parts[0]])) parts.shift();
1109
+ if (locale !== i18n.defaultLocale) parts.unshift(locale);
1110
+ targetPath = "/" + parts.join("/");
1063
1111
  }
1064
1112
  }
1065
- if (!targetPath || targetPath === "") targetPath = "/";
1113
+ if (!targetPath || targetPath === "") targetPath = "/s";
1066
1114
  targetPath = targetPath.replace(/\/+/g, "/");
1067
1115
  navigate(targetPath);
1068
1116
  };
@@ -1146,10 +1194,42 @@ function usePageNav() {
1146
1194
  //#region src/client/hooks/use-analytics.ts
1147
1195
  function createAnalyticsInstance(config) {
1148
1196
  if (typeof window === "undefined") return createDisabledAnalytics();
1197
+ if (window.posthog) return createPostHogAnalytics(config);
1149
1198
  if (typeof window.gtag === "function") return createGtagAnalytics(config);
1150
1199
  if (window.dataLayer) return createDataLayerAnalytics(config);
1151
1200
  return createDisabledAnalytics();
1152
1201
  }
1202
+ function createPostHogAnalytics(_config) {
1203
+ return {
1204
+ trackPageView: (path) => {
1205
+ window.posthog?.capture("$pageview", { $current_url: path });
1206
+ },
1207
+ trackEvent: ({ action, category, label, value, params }) => {
1208
+ window.posthog?.capture(action, {
1209
+ event_category: category,
1210
+ event_label: label,
1211
+ value,
1212
+ ...params
1213
+ });
1214
+ },
1215
+ trackSearch: (query, resultsCount) => {
1216
+ window.posthog?.capture("search", {
1217
+ query,
1218
+ results_count: resultsCount
1219
+ });
1220
+ },
1221
+ trackDownload: (file, type) => {
1222
+ window.posthog?.capture("file_download", {
1223
+ file_name: file,
1224
+ file_type: type || file.split(".").pop()
1225
+ });
1226
+ },
1227
+ trackExternalLink: (url) => {
1228
+ window.posthog?.capture("external_link", { link_url: url });
1229
+ },
1230
+ isEnabled: true
1231
+ };
1232
+ }
1153
1233
  function createGtagAnalytics(config) {
1154
1234
  return {
1155
1235
  trackPageView: (path, title) => {
@@ -1433,7 +1513,7 @@ function I18nSelector({ className }) {
1433
1513
 
1434
1514
  //#endregion
1435
1515
  //#region src/client/components/ui-base/navbar.tsx
1436
- const SearchDialog$1 = lazy(() => import("../search-dialog-BNdRV60O.js").then((m) => ({ default: m.SearchDialog })));
1516
+ const SearchDialog$1 = lazy(() => import("../search-dialog-gp9lrJXm.js").then((m) => ({ default: m.SearchDialog })));
1437
1517
  function Navbar() {
1438
1518
  const { links, title, logo, logoProps, github, social, config } = useNavbar();
1439
1519
  const { routes, currentRoute, isCollectionPage, currentVersion, currentLocale } = useRoutes();
@@ -1464,6 +1544,10 @@ function Navbar() {
1464
1544
  href: "site:/",
1465
1545
  children: title
1466
1546
  }),
1547
+ currentRoute?.draft && /* @__PURE__ */ jsx("span", {
1548
+ className: "hidden sm:inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400 border border-yellow-200 dark:border-yellow-800",
1549
+ children: "Draft"
1550
+ }),
1467
1551
  /* @__PURE__ */ jsx("div", {
1468
1552
  className: "hidden sm:block",
1469
1553
  children: config.versions && currentVersion && /* @__PURE__ */ jsx(VersionSelector, {})
@@ -2194,21 +2278,107 @@ function buildExternalRoutes(options) {
2194
2278
  };
2195
2279
  }
2196
2280
 
2281
+ //#endregion
2282
+ //#region src/client/collections/hooks.ts
2283
+ const DEFAULT_COLLECTION = "blog";
2284
+ /**
2285
+ * Returns the posts of a collection, filtered by the current locale and version.
2286
+ * Defaults to "blog" if no collection is specified.
2287
+ * @param collection - The name of the collection. Defaults to "blog".
2288
+ * @param options - Options to customize the query.
2289
+ * @param options.includeDrafts - If true, includes draft posts in the results.
2290
+ * @returns The filtered posts of the collection.
2291
+ */
2292
+ function usePosts(collection = DEFAULT_COLLECTION, options) {
2293
+ const data = useCollectionsData();
2294
+ const { currentLocale, currentVersion } = useRoutes();
2295
+ const config = useConfig();
2296
+ const posts = data[collection] || [];
2297
+ const defaultLocale = config.i18n?.defaultLocale;
2298
+ const defaultVersion = config.versions?.defaultVersion;
2299
+ return useMemo(() => {
2300
+ return posts.filter((post) => {
2301
+ const postLocale = post.locale || defaultLocale;
2302
+ const postVersion = post.version || defaultVersion;
2303
+ const localeMatch = !currentLocale || postLocale === currentLocale;
2304
+ const versionMatch = !currentVersion || postVersion === currentVersion;
2305
+ const draftMatch = options?.includeDrafts || !post.draft;
2306
+ return localeMatch && versionMatch && draftMatch;
2307
+ });
2308
+ }, [
2309
+ posts,
2310
+ currentLocale,
2311
+ currentVersion,
2312
+ defaultLocale,
2313
+ defaultVersion,
2314
+ options?.includeDrafts
2315
+ ]);
2316
+ }
2317
+ function usePost(collection, slug) {
2318
+ const ctx = useCurrentPostData();
2319
+ const posts = usePosts(collection);
2320
+ if (ctx && !slug) {
2321
+ const { route } = ctx;
2322
+ return useMemo(() => ({
2323
+ path: route.path,
2324
+ title: route.title,
2325
+ date: route.date,
2326
+ excerpt: route.excerpt,
2327
+ tags: route.tags,
2328
+ author: route.author,
2329
+ coverImage: route.coverImage,
2330
+ filePath: route.filePath,
2331
+ locale: route.locale,
2332
+ version: route.version,
2333
+ frontmatter: route.frontmatter,
2334
+ lastUpdated: route.lastUpdated,
2335
+ headings: route.headings
2336
+ }), [route]);
2337
+ }
2338
+ if (!collection || !slug) return void 0;
2339
+ return useMemo(() => posts.find((p) => p.path === `/${collection}/${slug}` || p.path.endsWith(`/${slug}`) || p.path === slug), [
2340
+ posts,
2341
+ collection,
2342
+ slug
2343
+ ]);
2344
+ }
2345
+ /**
2346
+ * Returns the recent posts of a collection. Defaults to "blog".
2347
+ * @param collection - The name of the collection. Defaults to "blog".
2348
+ * @param count - The number of recent posts to return.
2349
+ * @returns The recent posts of the collection.
2350
+ */
2351
+ function useRecentPosts(collection = DEFAULT_COLLECTION, count = 5) {
2352
+ const posts = usePosts(collection);
2353
+ return useMemo(() => posts.slice(0, count), [posts, count]);
2354
+ }
2355
+
2197
2356
  //#endregion
2198
2357
  //#region src/client/ssg/create-routes.collection.tsx
2199
2358
  function DefaultCollectionList() {
2200
- const data = useLoaderData();
2201
- if (!data || !data.posts) return null;
2359
+ const location = useLocation$1();
2360
+ const config = useConfig();
2361
+ const postsPerPage = config.collections?.postsPerPage ?? 10;
2362
+ const segments = location.pathname.split("/").filter(Boolean);
2363
+ const isLocalePrefixed = config.i18n && segments[0] in (config.i18n.locales || {});
2364
+ const collection = isLocalePrefixed ? segments[1] : segments[0];
2365
+ const currentPage = (isLocalePrefixed ? segments[3] : segments[2]) === "page" ? Number(isLocalePrefixed ? segments[4] : segments[3]) || 1 : 1;
2366
+ const allPosts = usePosts(collection);
2367
+ const totalPages = Math.ceil(allPosts.length / postsPerPage);
2368
+ const start = (currentPage - 1) * postsPerPage;
2369
+ const posts = allPosts.slice(start, start + postsPerPage);
2370
+ if (!posts.length) return null;
2371
+ const basePath = isLocalePrefixed ? `/${segments[0]}/${segments[1]}` : `/${segments[0]}`;
2202
2372
  return /* @__PURE__ */ jsxs("div", {
2203
2373
  className: "py-8 max-w-2xl mx-auto px-4",
2204
2374
  children: [
2205
2375
  /* @__PURE__ */ jsx("h1", {
2206
2376
  className: "text-3xl font-bold mb-6 capitalize",
2207
- children: data.collection
2377
+ children: collection
2208
2378
  }),
2209
2379
  /* @__PURE__ */ jsx("div", {
2210
2380
  className: "space-y-6",
2211
- children: data.posts.map((post) => /* @__PURE__ */ jsxs("article", {
2381
+ children: posts.map((post) => /* @__PURE__ */ jsxs("article", {
2212
2382
  className: "border-b border-subtle pb-4",
2213
2383
  children: [
2214
2384
  /* @__PURE__ */ jsx("h2", {
@@ -2230,22 +2400,22 @@ function DefaultCollectionList() {
2230
2400
  ]
2231
2401
  }, post.path))
2232
2402
  }),
2233
- data.totalPages > 1 && /* @__PURE__ */ jsxs("div", {
2403
+ totalPages > 1 && /* @__PURE__ */ jsxs("div", {
2234
2404
  className: "mt-8 flex gap-4 text-sm",
2235
2405
  children: [
2236
- data.currentPage > 1 && /* @__PURE__ */ jsx(Link, {
2237
- to: data.currentPage === 2 ? `/${data.collection}` : `/${data.collection}/page/${data.currentPage - 1}`,
2406
+ currentPage > 1 && /* @__PURE__ */ jsx(Link, {
2407
+ to: currentPage === 2 ? basePath : `${basePath}/page/${currentPage - 1}`,
2238
2408
  className: "text-primary-600 hover:underline",
2239
2409
  children: "Previous"
2240
2410
  }),
2241
2411
  /* @__PURE__ */ jsxs("span", { children: [
2242
2412
  "Page ",
2243
- data.currentPage,
2413
+ currentPage,
2244
2414
  " of ",
2245
- data.totalPages
2415
+ totalPages
2246
2416
  ] }),
2247
- data.currentPage < data.totalPages && /* @__PURE__ */ jsx(Link, {
2248
- to: `/${data.collection}/page/${data.currentPage + 1}`,
2417
+ currentPage < totalPages && /* @__PURE__ */ jsx(Link, {
2418
+ to: `${basePath}/page/${currentPage + 1}`,
2249
2419
  className: "text-primary-600 hover:underline",
2250
2420
  children: "Next"
2251
2421
  })
@@ -2336,6 +2506,9 @@ function buildCollectionRoutes(options) {
2336
2506
  author: r.author,
2337
2507
  coverImage: r.coverImage,
2338
2508
  filePath: r.filePath,
2509
+ locale: r.locale,
2510
+ version: r.version,
2511
+ lastUpdated: r.lastUpdated,
2339
2512
  frontmatter: r.frontmatter
2340
2513
  }));
2341
2514
  const ListElement = collectionLists?.[colName] || DefaultCollectionList;
@@ -2416,18 +2589,6 @@ function createRoutes(options) {
2416
2589
  function DocsLayoutComponent({ children }) {
2417
2590
  const { routes: filteredRoutes, currentRoute, isCollectionPage } = useRoutes();
2418
2591
  const config = useConfig();
2419
- const AskAiDialog = useMergedComponents().AskAiDialog;
2420
- const [isAskAiOpen, setIsAskAiOpen] = useState(false);
2421
- useEffect(() => {
2422
- const handleOpen = () => setIsAskAiOpen(true);
2423
- const handleClose = () => setIsAskAiOpen(false);
2424
- window.addEventListener("boltdocs:ask-ai:open", handleOpen);
2425
- window.addEventListener("boltdocs:ask-ai:close", handleClose);
2426
- return () => {
2427
- window.removeEventListener("boltdocs:ask-ai:open", handleOpen);
2428
- window.removeEventListener("boltdocs:ask-ai:close", handleClose);
2429
- };
2430
- }, []);
2431
2592
  return /* @__PURE__ */ jsxs(DocsLayout$1, {
2432
2593
  className: "selection:bg-primary-500/10 selection:text-primary-500",
2433
2594
  children: [/* @__PURE__ */ jsx(Navbar, {}), /* @__PURE__ */ jsxs(DocsLayout$1.Body, {
@@ -2469,8 +2630,7 @@ function DocsLayoutComponent({ children }) {
2469
2630
  ]
2470
2631
  })
2471
2632
  }),
2472
- AskAiDialog && /* @__PURE__ */ jsx(AskAiDialog, {}),
2473
- !isCollectionPage && !isAskAiOpen && /* @__PURE__ */ jsx(OnThisPage, {
2633
+ /* @__PURE__ */ jsx(OnThisPage, {
2474
2634
  headings: currentRoute?.headings,
2475
2635
  filePath: currentRoute?.filePath,
2476
2636
  communityHelp: config.theme?.communityHelp,
@@ -2481,53 +2641,6 @@ function DocsLayoutComponent({ children }) {
2481
2641
  });
2482
2642
  }
2483
2643
 
2484
- //#endregion
2485
- //#region src/client/collections/hooks.ts
2486
- /**
2487
- * Returns the posts of a collection.
2488
- * @param collection - The name of the collection.
2489
- * @returns The posts of the collection.
2490
- */
2491
- function usePosts(collection) {
2492
- const data = useCollectionsData();
2493
- const { currentLocale, currentVersion } = useRoutes();
2494
- const config = useConfig();
2495
- const posts = data[collection] || [];
2496
- const defaultLocale = config.i18n?.defaultLocale;
2497
- const defaultVersion = config.versions?.defaultVersion;
2498
- return useMemo(() => {
2499
- return posts.filter((post) => {
2500
- const postLocale = post.locale || defaultLocale;
2501
- const postVersion = post.version || defaultVersion;
2502
- return (!currentLocale || postLocale === currentLocale) && (!currentVersion || postVersion === currentVersion);
2503
- });
2504
- }, [
2505
- posts,
2506
- currentLocale,
2507
- currentVersion,
2508
- defaultLocale,
2509
- defaultVersion
2510
- ]);
2511
- }
2512
- function usePost(collection, slug) {
2513
- const posts = usePosts(collection);
2514
- return useMemo(() => posts.find((p) => p.path === `/${collection}/${slug}` || p.path.endsWith(`/${slug}`) || p.path === slug), [
2515
- posts,
2516
- collection,
2517
- slug
2518
- ]);
2519
- }
2520
- /**
2521
- * Returns the recent posts of a collection.
2522
- * @param collection - The name of the collection.
2523
- * @param count - The number of recent posts to return.
2524
- * @returns The recent posts of the collection.
2525
- */
2526
- function useRecentPosts(collection, count = 5) {
2527
- const posts = usePosts(collection);
2528
- return useMemo(() => posts.slice(0, count), [posts, count]);
2529
- }
2530
-
2531
2644
  //#endregion
2532
2645
  //#region src/client/utils/react-to-text.ts
2533
2646
  const reactToText = (node, resolvers) => {
@@ -2543,4 +2656,4 @@ const reactToText = (node, resolvers) => {
2543
2656
  };
2544
2657
 
2545
2658
  //#endregion
2546
- export { Banner, BoltdocsShell, Breadcrumbs, CollectionsContext, CopyMarkdown, DocsLayoutComponent as DocsLayout, ErrorBoundary, MdxPage, Navbar, NotFound, OnThisPage, PageNav, SearchDialog, Sidebar, ViteReactSSG, cn, copyToClipboard, createRoutes, getStarsRepo, getTranslated, reactToText, useAnalytics, useBreadcrumbs, useCodeBlock, useConfig, useFeedback, useHeadings, useI18n, useLocalizedTo, useLocation, useMdxComponents, useMergedComponents, useNavbar, usePageNav, usePost, usePosts, useRecentPosts, useRoutes, useSearch, useSearchHighlight, useSidebar, useTabs, useTheme, useTrackEvent, useTrackPageView, useUI, useVersion };
2659
+ export { Banner, BoltdocsShell, Breadcrumbs, CollectionsContext, CopyMarkdown, CurrentPostProvider, DocsLayoutComponent as DocsLayout, ErrorBoundary, MdxPage, Navbar, NotFound, OnThisPage, PageNav, SearchDialog, Sidebar, ViteReactSSG, cn, copyToClipboard, createRoutes, getStarsRepo, getTranslated, reactToText, useAnalytics, useBreadcrumbs, useCodeBlock, useConfig, useFeedback, useHeadings, useI18n, useLocalizedTo, useLocation, useMdxComponents, useMergedComponents, useNavbar, usePageNav, usePost, usePosts, useRecentPosts, useRoutes, useSearch, useSearchHighlight, useSidebar, useTabs, useTheme, useTrackEvent, useTrackPageView, useUI, useVersion };
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7
- const require_mdx = require('../mdx-DJBg5DuL.cjs');
7
+ const require_mdx = require('../mdx-CDUcJmye.cjs');
8
8
 
9
9
  //#region src/client/mdx.ts
10
10
  const { Card, Cards, Callout, Field, Image } = require_mdx.mdx_components_default;
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import { t as mdx_components_default } from "../mdx-DhyMkc35.js";
6
+ import { t as mdx_components_default } from "../mdx-Bv-pS6-O.js";
7
7
 
8
8
  //#region src/client/mdx.ts
9
9
  const { Card, Cards, Callout, Field, Image } = mdx_components_default;
@@ -4,10 +4,10 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
7
- const require_icons_dev = require('../icons-dev-BryEFkJu.cjs');
8
- const require_image = require('../image-CR6UlaI5.cjs');
9
- const require_docs_layout = require('../docs-layout-3TpAt6MB.cjs');
10
- const require_search_dialog = require('../search-dialog-D4rplZMv.cjs');
7
+ const require_icons_dev = require('../icons-dev-YtDoLUsb.cjs');
8
+ const require_image = require('../image-Hb105Gu6.cjs');
9
+ const require_docs_layout = require('../docs-layout-D1buSdua.cjs');
10
+ const require_search_dialog = require('../search-dialog-BpNULmrl.cjs');
11
11
  let react_jsx_runtime = require("react/jsx-runtime");
12
12
 
13
13
  //#region src/client/components/primitives/skeleton.tsx
@@ -1,5 +1,5 @@
1
1
 
2
- import { A as BoltdocsRoutePathWithFallback, a as SidebarItem, c as SidebarItemsProps, d as SidebarMobile, f as SidebarRoot, i as SidebarHeader, l as SidebarLink, m as ComponentBase, n as SidebarContent, o as SidebarItemProps, p as SidebarSubGroup, r as SidebarGroup, s as SidebarItems, t as Sidebar, u as SidebarLinkProps } from "../sidebar-7gIifpBX.cjs";
2
+ import { A as BoltdocsRoutePathWithFallback, a as SidebarItem, c as SidebarItemsProps, d as SidebarMobile, f as SidebarRoot, i as SidebarHeader, l as SidebarLink, m as ComponentBase, n as SidebarContent, o as SidebarItemProps, p as SidebarSubGroup, r as SidebarGroup, s as SidebarItems, t as Sidebar, u as SidebarLinkProps } from "../sidebar-DH2iPKXM.cjs";
3
3
  import * as React$2 from "react";
4
4
  import { Component, ComponentProps, ComponentType, ErrorInfo, ImgHTMLAttributes, ReactNode, RefObject } from "react";
5
5
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
 
2
- import { A as BoltdocsRoutePathWithFallback, a as SidebarItem, c as SidebarItemsProps, d as SidebarMobile, f as SidebarRoot, i as SidebarHeader, l as SidebarLink, m as ComponentBase, n as SidebarContent, o as SidebarItemProps, p as SidebarSubGroup, r as SidebarGroup, s as SidebarItems, t as Sidebar, u as SidebarLinkProps } from "../sidebar-BAKgJ-Er.js";
2
+ import { A as BoltdocsRoutePathWithFallback, a as SidebarItem, c as SidebarItemsProps, d as SidebarMobile, f as SidebarRoot, i as SidebarHeader, l as SidebarLink, m as ComponentBase, n as SidebarContent, o as SidebarItemProps, p as SidebarSubGroup, r as SidebarGroup, s as SidebarItems, t as Sidebar, u as SidebarLinkProps } from "../sidebar-DknLUI1R.js";
3
3
  import * as React$2 from "react";
4
4
  import { Component, ComponentProps, ComponentType, ErrorInfo, ImgHTMLAttributes, ReactNode, RefObject } from "react";
5
5
  import * as _$react_jsx_runtime0 from "react/jsx-runtime";
@@ -3,10 +3,10 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import { _ as Link, v as NavLink, y as cn } from "../icons-dev-kJyGWNeg.js";
7
- import { a as CodeBlockGroup, i as CodeBlockContent, n as Tooltip, o as CodeBlockHeader, r as CodeBlock, s as Heading, t as Image } from "../image-C9md50h2.js";
8
- import { D as ButtonGroup, E as Popover, O as Breadcrumbs, T as Menu, _ as ScrollProvider, a as SidebarHeader, b as useItems, c as SidebarLink, d as SidebarSubGroup, f as PageNav, g as OnThisPageTree, h as OnThisPageItems, i as SidebarGroup, l as SidebarMobile, m as OnThisPage, n as Sidebar, o as SidebarItem, p as AnchorProvider, r as SidebarContent, s as SidebarItems, t as DocsLayout, u as SidebarRoot, v as useActiveAnchor, w as Tabs, y as useActiveAnchors } from "../docs-layout-6FQ8__ok.js";
9
- import { a as Button, i as ErrorBoundaryFallback, n as Navbar, r as ErrorBoundary, t as SearchDialog } from "../search-dialog-DaeSPvEo.js";
6
+ import { _ as Link, v as NavLink, y as cn } from "../icons-dev-CHZOwhQA.js";
7
+ import { a as CodeBlockGroup, i as CodeBlockContent, n as Tooltip, o as CodeBlockHeader, r as CodeBlock, s as Heading, t as Image } from "../image-5WsgWYTh.js";
8
+ import { D as ButtonGroup, E as Popover, O as Breadcrumbs, T as Menu, _ as ScrollProvider, a as SidebarHeader, b as useItems, c as SidebarLink, d as SidebarSubGroup, f as PageNav, g as OnThisPageTree, h as OnThisPageItems, i as SidebarGroup, l as SidebarMobile, m as OnThisPage, n as Sidebar, o as SidebarItem, p as AnchorProvider, r as SidebarContent, s as SidebarItems, t as DocsLayout, u as SidebarRoot, v as useActiveAnchor, w as Tabs, y as useActiveAnchors } from "../docs-layout-DyLDBwS6.js";
9
+ import { a as Button, i as ErrorBoundaryFallback, n as Navbar, r as ErrorBoundary, t as SearchDialog } from "../search-dialog-PJrFRU5G.js";
10
10
  import { jsx } from "react/jsx-runtime";
11
11
 
12
12
  //#region src/client/components/primitives/skeleton.tsx
@@ -72,7 +72,7 @@
72
72
  --color-subtle: var(--color-neutral-200);
73
73
  --color-strong: var(--color-neutral-300);
74
74
  --color-code-bg: var(--color-neutral-100);
75
- --color-code-text: #eb5828;
75
+ --color-code-text: color-mix(in srgb, var(--color-body) 80%, transparent);
76
76
 
77
77
  /* Semantic Colors - Dark Override (handled via standard CSS overrides below the @theme block) */
78
78
 
@@ -138,6 +138,4 @@
138
138
  --color-strong: #3c3c39;
139
139
  /* Strong dark border */
140
140
  --color-code-bg: var(--color-neutral-900);
141
- --color-code-text: #eb5828;
142
- /* Outstanding terracotta orange inline code */
143
141
  }
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- const e=require(`./config-B5uVv5q4.cjs`);exports.CONFIG_FILES=e.t,exports.defineConfig=e.a,exports.resolveConfig=e.n,exports.resolveConfigAndGenerateTypes=e.r;
6
+ const e=require(`./config-DrRQYDCI.cjs`);exports.CONFIG_FILES=e.t,exports.defineConfig=e.a,exports.resolveConfig=e.n,exports.resolveConfigAndGenerateTypes=e.r;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ import{t as e}from"./rolldown-runtime-fkIsjY3S.mjs";import{r as t}from"./errors-C0Hx15Ag.mjs";import{t as n}from"./types-generator-DVOnRVKU.mjs";import r from"node:path";import i from"node:fs";import{z as a}from"zod";import{warn as o}from"@bdocs/dui";function s(e){return e}const c=a.object({icon:a.string().max(50),link:a.string().url()});a.object({text:a.string().max(2e3).optional()});const l=a.object({processor:a.enum([`unified`,`satteri`]).optional()}),u=a.object({name:a.string(),enforce:a.enum([`pre`,`post`]).optional(),version:a.string().optional(),boltdocsVersion:a.string().optional(),remarkPlugins:a.array(a.unknown()).optional(),rehypePlugins:a.array(a.unknown()).optional(),vitePlugins:a.array(a.unknown()).optional(),components:a.record(a.string(),a.string()).optional(),hooks:a.record(a.string(),a.unknown()).optional()}),d=a.object({title:a.union([a.string(),a.record(a.string(),a.string())]).optional(),description:a.union([a.string(),a.record(a.string(),a.string())]).optional(),logo:a.union([a.string(),a.object({dark:a.string(),light:a.string(),alt:a.string().optional(),width:a.number().optional(),height:a.number().optional()})]).optional(),navbar:a.array(a.object({label:a.union([a.string(),a.record(a.string(),a.string())]),href:a.string(),items:a.array(a.object({label:a.union([a.string(),a.record(a.string(),a.string())]),href:a.string()})).optional()})).optional(),sidebar:a.record(a.string(),a.array(a.object({text:a.string(),link:a.string()}))).optional(),sidebarGroups:a.record(a.string(),a.object({title:a.union([a.string(),a.record(a.string(),a.string())]).optional(),icon:a.string().optional()})).optional(),socialLinks:a.array(c).optional(),editLink:a.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:a.string().url().optional(),version:a.string().max(50).optional(),githubRepo:a.string().max(100).optional(),favicon:a.string().optional(),tabs:a.array(a.object({id:a.string(),text:a.union([a.string(),a.record(a.string(),a.string())]),icon:a.string().optional()})).optional(),codeTheme:a.union([a.string(),a.object({light:a.string(),dark:a.string()})]).optional()}),f=a.union([a.string(),a.object({rules:a.array(a.object({userAgent:a.string(),allow:a.union([a.string(),a.array(a.string())]).optional(),disallow:a.union([a.string(),a.array(a.string())]).optional()})).optional(),sitemaps:a.array(a.string().url()).optional()})]),p=a.object({defaultLocale:a.string(),locales:a.union([a.record(a.string(),a.string()),a.array(a.string())]).transform(e=>Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e),localeConfigs:a.record(a.string(),a.object({label:a.string().optional(),direction:a.enum([`ltr`,`rtl`]).optional(),htmlLang:a.string().optional(),calendar:a.string().optional()})).optional()}),m=a.object({defaultVersion:a.string(),prefix:a.string().optional(),versions:a.array(a.object({label:a.string(),path:a.string()}))}),h=a.object({headers:a.record(a.string(),a.string()).optional(),enableCSP:a.boolean().optional(),customHeaders:a.record(a.string(),a.string()).optional()}),g=a.object({google:a.string().optional(),bing:a.string().optional(),yandex:a.string().optional(),pinterest:a.string().optional(),facebook:a.string().optional()}),_=a.object({metatags:a.record(a.string(),a.string()).optional(),indexing:a.enum([`all`,`public`]).optional(),thumbnails:a.object({background:a.string().optional()}).optional(),verification:g.optional()}),v=a.object({measurementId:a.string().min(1,`Measurement ID is required for GA4`),debug:a.boolean().optional(),anonymizeIp:a.boolean().optional(),sendPageView:a.boolean().optional(),cookieFlags:a.string().optional(),autoTrack:a.object({pageViews:a.boolean().optional(),downloads:a.boolean().optional(),externalLinks:a.boolean().optional(),search:a.boolean().optional()}).optional()}),y=a.object({tagId:a.string().min(1,`Tag ID is required for GTM`),dataLayerName:a.string().optional(),preview:a.string().optional()}),b=a.object({appId:a.string().min(1,`Algolia App ID is required`),apiKey:a.string().min(1,`Algolia API Key is required`),indexName:a.string().min(1,`Algolia Index Name is required`)}),x=a.object({repo:a.string().min(1,`Giscus repository is required`),repoId:a.string().min(1,`Giscus repository ID is required`),category:a.string().optional(),categoryId:a.string().optional(),mapping:a.enum([`pathname`,`url`,`title`,`og:title`,`specific`,`number`]).optional(),strict:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),reactionsEnabled:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),emitMetadata:a.union([a.enum([`0`,`1`]),a.boolean()]).optional(),inputPosition:a.enum([`top`,`bottom`]).optional(),theme:a.string().optional(),darkTheme:a.string().optional(),lang:a.string().optional(),loading:a.enum([`lazy`,`eager`]).optional()}),S=a.object({enabled:a.boolean(),owner:a.string().min(1,`GitHub owner is required`),repo:a.string().min(1,`GitHub repository name is required`),categorySlug:a.string().optional(),endpoint:a.string().optional()}),C=a.object({analytics:a.boolean().optional(),speedInsights:a.boolean().optional()}),w=a.object({apiKey:a.string().min(1,`API key is required for PostHog`),host:a.string().url().optional(),capturePageview:a.boolean().optional(),capturePageleave:a.boolean().optional(),sessionRecording:a.boolean().optional(),autocapture:a.boolean().optional()}),T=a.object({ga4:v.optional(),gtm:y.optional(),vercel:C.optional(),posthog:w.optional()}),E=a.object({algolia:b.optional()}),D=a.object({giscus:x.optional(),custom:S.optional()}),O=a.object({analytics:T.optional(),search:E.optional(),feedback:D.optional()}),k=a.object({visible:a.boolean().optional(),environments:a.array(a.string()).optional()}),A=a.object({siteUrl:a.string().url().optional(),docsDir:a.string().optional(),base:a.string().optional(),theme:d.optional(),i18n:p.optional(),versions:m.optional(),mdx:l.optional(),plugins:a.array(u).optional(),robots:f.optional(),security:h.optional(),seo:_.optional(),integrations:O.optional(),drafts:k.optional(),featureFlags:a.record(a.string(),a.union([a.boolean(),a.string()])).optional(),vite:a.record(a.string(),a.unknown()).optional()});var j=e({CONFIG_FILES:()=>M,defineConfig:()=>s,resolveConfig:()=>N,resolveConfigAndGenerateTypes:()=>P});const M=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function N(e,n=process.cwd()){let a=n,s={docsDir:r.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`}}},c={};for(let e of M){let t=r.resolve(a,e);if(i.existsSync(t))try{let{loadConfigFromFile:e}=await import(`vite`),n=await e({command:`serve`,mode:`development`},t,a);if(n){c=n.config;break}}catch(t){t instanceof Error&&o(`Failed to load config from ${e}: ${t}`)}}let l={title:c.title,description:c.description,logo:c.logo,favicon:c.favicon,navbar:c.navbar,sidebar:c.sidebar,sidebarGroups:c.theme?.sidebarGroups,socialLinks:c.socialLinks,githubRepo:c.githubRepo,tabs:c.tabs,codeTheme:c.codeTheme,communityHelp:c.communityHelp,version:c.version,editLink:c.editLink,...c.theme||{}},u=Object.fromEntries(Object.entries(l).filter(([e,t])=>t!==void 0));u.navbar&&=u.navbar.map(e=>({label:e.label||``,href:e.href||``,items:e.items}));let d={docsDir:r.resolve(e),theme:{...s.theme,...u},i18n:c.i18n?{...c.i18n,locales:Array.isArray(c.i18n.locales)?Object.fromEntries(c.i18n.locales.map(e=>[e,e])):c.i18n.locales}:void 0,versions:c.versions,siteUrl:c.siteUrl,base:c.base,seo:c.seo,plugins:c.plugins||[],robots:c.robots,security:c.security,integrations:c.integrations,vite:c.vite},f=A.safeParse(d);if(!f.success)throw new t(`Invalid Boltdocs configuration:\n${f.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
7
+ `)}`);return f.data}async function P(e,t=process.cwd()){let r=await N(e,t);return n(r,e,t),r}export{s as a,u as i,j as n,N as r,M as t};