boltdocs 3.2.1 → 3.3.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 (155) hide show
  1. package/bin/boltdocs.js +20 -1
  2. package/bin/preloader.mjs +28 -0
  3. package/dist/{adapters-ByYY44Zy.mjs → adapters-BmB4TKCc.mjs} +1 -1
  4. package/dist/{adapters-DvmtpdSF.cjs → adapters-Cp1Maurn.cjs} +1 -1
  5. package/dist/audit-CLXjMzwQ.mjs +11 -0
  6. package/dist/audit-COgjnQ5n.cjs +11 -0
  7. package/dist/build-BS2hefiL.cjs +6 -0
  8. package/dist/build-C5mNh9D-.mjs +6 -0
  9. package/dist/cache-CJE9nWLE.cjs +6 -0
  10. package/dist/cache-OY4HzIXl.mjs +6 -0
  11. package/dist/callout-oI_LCbxS.d.ts +71 -0
  12. package/dist/callout-plqx9Dw-.d.cts +71 -0
  13. package/dist/client/index.cjs +1265 -569
  14. package/dist/client/index.d.cts +3 -542
  15. package/dist/client/index.d.ts +3 -542
  16. package/dist/client/index.js +1167 -521
  17. package/dist/client/mdx.cjs +1 -1
  18. package/dist/client/mdx.d.cts +24 -2
  19. package/dist/client/mdx.d.ts +24 -2
  20. package/dist/client/mdx.js +1 -1
  21. package/dist/client/primitives.cjs +14 -4
  22. package/dist/client/primitives.d.cts +281 -38
  23. package/dist/client/primitives.d.ts +281 -38
  24. package/dist/client/primitives.js +5 -5
  25. package/dist/client/router.cjs +49 -0
  26. package/dist/client/router.d.cts +3 -0
  27. package/dist/client/router.d.ts +3 -0
  28. package/dist/client/router.js +8 -0
  29. package/dist/client/theme/reset.css +40 -4
  30. package/dist/{config-BpzaPsJj.d.cts → config-BoRlz0Ca.d.mts} +157 -14
  31. package/dist/{config-xtS0ZkMm.d.mts → config-CTsX_tGM.d.cts} +157 -14
  32. package/dist/config-Ceib-AOH.cjs +7 -0
  33. package/dist/config-DGLQsy7y.mjs +7 -0
  34. package/dist/{package-BcISI5-P.cjs → config-files-BYHDOrKn.mjs} +1 -1
  35. package/dist/config-files-D9cdBMl2.cjs +6 -0
  36. package/dist/config-jJh8WYJI.cjs +6 -0
  37. package/dist/csp-C4LmN1ko.cjs +6 -0
  38. package/dist/csp-D6JEOqKh.mjs +6 -0
  39. package/dist/dev-Ch3hEe5Y.cjs +6 -0
  40. package/dist/dev-QPNxysrd.mjs +6 -0
  41. package/dist/{docs-layout-BdtZ9z6s.js → docs-layout-CbZ7LDRe.js} +504 -249
  42. package/dist/{docs-layout-CFWI15Id.cjs → docs-layout-vzfXed1Q.cjs} +516 -254
  43. package/dist/{doctor-BBtmNJE0.cjs → doctor-B1_YL0Wt.cjs} +1 -1
  44. package/dist/doctor-C7whl4ED.cjs +6 -0
  45. package/dist/doctor-DmQnml2k.mjs +6 -0
  46. package/dist/{generator-COepVWGi.cjs → generator-BlW45ST7.cjs} +5 -3
  47. package/dist/{generator-CcOBN5vI.mjs → generator-BwknNejd.mjs} +5 -3
  48. package/dist/{handler-XX7cLTqe.cjs → handler-CDEoKARD.cjs} +2 -2
  49. package/dist/{handler-DzQae4eA.mjs → handler-D7UyZlPm.mjs} +2 -2
  50. package/dist/{image-Bz87fCla.js → image-B-NDSDuY.js} +129 -11
  51. package/dist/{image-C4TlpMHn.cjs → image-Hnaa2bJd.cjs} +175 -9
  52. package/dist/index-C56bL-A-.d.cts +1344 -0
  53. package/dist/{sidebar-COTaMHR-.d.ts → index-CPUUKzxD.d.cts} +344 -327
  54. package/dist/{sidebar-CrEdJuHX.d.cts → index-Ci4kfOHF.d.ts} +344 -327
  55. package/dist/index-Cu9H6CRa.d.ts +1344 -0
  56. package/dist/link-CgdI6O2o.js +872 -0
  57. package/dist/{link-D1Gjkb-2.cjs → link-vZjmD-es.cjs} +406 -223
  58. package/dist/{mdx-BuO6a1f7.js → mdx-BRT71V5Q.js} +211 -168
  59. package/dist/{mdx-CD-tSjRG.cjs → mdx-D0Absdq5.cjs} +225 -169
  60. package/dist/native-BNCY7PRF.cjs +6 -0
  61. package/dist/native-Di9Fnfrv.mjs +6 -0
  62. package/dist/native-Kre2T5eS.cjs +6 -0
  63. package/dist/node/cache.cjs +1 -1
  64. package/dist/node/cache.d.cts +19 -3
  65. package/dist/node/cache.d.mts +19 -3
  66. package/dist/node/cache.mjs +1 -1
  67. package/dist/node/cli-entry.cjs +1 -9
  68. package/dist/node/cli-entry.mjs +1 -9
  69. package/dist/node/index.cjs +1 -1
  70. package/dist/node/index.d.cts +245 -17
  71. package/dist/node/index.d.mts +246 -18
  72. package/dist/node/index.mjs +1 -1
  73. package/dist/node/mdx/shiki-adapter.cjs +1 -1
  74. package/dist/node/mdx/shiki-adapter.d.cts +24 -3
  75. package/dist/node/mdx/shiki-adapter.d.mts +24 -2
  76. package/dist/node/mdx/shiki-adapter.mjs +1 -1
  77. package/dist/node-Du5UL5wo.mjs +23 -0
  78. package/dist/node-DunuGqyp.cjs +23 -0
  79. package/dist/{package-CCYEAYeA.mjs → package-DA848keM.mjs} +1 -1
  80. package/dist/package-wplzySjz.cjs +6 -0
  81. package/dist/pages-external-BBw8ObVK.mjs +6 -0
  82. package/dist/pages-external-DPiPFxxP.cjs +6 -0
  83. package/dist/parser-BqTOsEUa.cjs +6 -0
  84. package/dist/parser-CGMY2lJ7.mjs +6 -0
  85. package/dist/plugin-BcTzvHAJ.mjs +69 -0
  86. package/dist/plugin-TulVMt1z.cjs +69 -0
  87. package/dist/plugin-context-C-l90hFt.cjs +15 -0
  88. package/dist/plugin-context-wqHNSZum.mjs +15 -0
  89. package/dist/plugin-lifecycle-B1BzSHdn.cjs +6 -0
  90. package/dist/resolve-B7vWOd8R.cjs +6 -0
  91. package/dist/resolve-C2kKnk_5.mjs +6 -0
  92. package/dist/resolve-It1Iug83.cjs +6 -0
  93. package/dist/resolve-YdTrt_FG.mjs +6 -0
  94. package/dist/router-C3kygdRK.cjs +1285 -0
  95. package/dist/router-CZBxMRAH.js +987 -0
  96. package/dist/routes-BL4y79tb.mjs +6 -0
  97. package/dist/routes-C2nPecwu.cjs +6 -0
  98. package/dist/routes-U9L8psZ9.cjs +6 -0
  99. package/dist/{search-dialog-DHqwjJuG.cjs → search-dialog-BCOHQGSt.cjs} +1 -1
  100. package/dist/search-dialog-Bp_P1MPP.js +481 -0
  101. package/dist/{search-dialog-DFnlx8LO.js → search-dialog-BqkzDTq2.js} +107 -57
  102. package/dist/{search-dialog-BRFno7HD.cjs → search-dialog-CIeIUhAn.cjs} +218 -43
  103. package/dist/{search-dialog-D6TvjcuV.js → search-dialog-DtmxmfEu.js} +1 -1
  104. package/dist/{search-dialog-B1NERUNx.cjs → search-dialog-x_qHU8ty.cjs} +107 -58
  105. package/dist/server/index.cjs +1 -1
  106. package/dist/server/index.d.mts +1 -1
  107. package/dist/server/index.mjs +1 -1
  108. package/dist/update-check-BKqmYfwT.cjs +11 -0
  109. package/dist/update-check-QnrVR3q1.mjs +11 -0
  110. package/dist/utils-8lzafE49.mjs +7 -0
  111. package/dist/utils-ej6_SjIZ.cjs +7 -0
  112. package/dist/virtual-modules-Ca5tHk1X.cjs +30 -0
  113. package/dist/virtual-modules-Dlgt1fP0.mjs +30 -0
  114. package/package.json +18 -16
  115. package/src/shared/mdx-path.ts +12 -0
  116. package/src/shared/structured-data.ts +145 -0
  117. package/src/shared/types.ts +220 -16
  118. package/dist/banner-BMop1KLF.d.ts +0 -100
  119. package/dist/banner-CVD0GugR.d.cts +0 -100
  120. package/dist/cache-CO4Dy2uQ.cjs +0 -6
  121. package/dist/cache-Dk53iOo6.mjs +0 -6
  122. package/dist/config-CCXp3aXO.mjs +0 -7
  123. package/dist/config-CMd4XoFq.cjs +0 -6
  124. package/dist/config-DlGoEM9D.cjs +0 -7
  125. package/dist/csp-CRp_3U7a.cjs +0 -6
  126. package/dist/csp-oTC2ygvF.mjs +0 -6
  127. package/dist/doctor-Bv16QSrI.cjs +0 -7
  128. package/dist/doctor-DOAbSaiL.mjs +0 -7
  129. package/dist/headers-Ddwek8K7.mjs +0 -6
  130. package/dist/headers-dg4SDrjY.cjs +0 -6
  131. package/dist/link-2PzgTnaP.js +0 -673
  132. package/dist/meta-loader-C4Hu9RN9.mjs +0 -6
  133. package/dist/meta-loader-Dq1zcFnh.cjs +0 -6
  134. package/dist/node-BXtqM1uH.mjs +0 -6
  135. package/dist/node-BlVk4EVg.cjs +0 -104
  136. package/dist/node-DOf4zhWc.mjs +0 -104
  137. package/dist/node-aD1eisrR.cjs +0 -6
  138. package/dist/pages-external-BYa4JSda.mjs +0 -6
  139. package/dist/pages-external-XkYIs-d5.cjs +0 -6
  140. package/dist/parser-DCiEWkSk.cjs +0 -8
  141. package/dist/parser-qk9FIHJ7.mjs +0 -8
  142. package/dist/plugin-C95kvu6h.mjs +0 -73
  143. package/dist/plugin-DM3u2bVj.cjs +0 -73
  144. package/dist/routes-BW6zsk7Z.mjs +0 -6
  145. package/dist/routes-BgoIB5wb.cjs +0 -6
  146. package/dist/routes-CORVxc02.cjs +0 -6
  147. package/dist/search-dialog-BmxHiKwt.js +0 -312
  148. package/dist/shiki-adapter-CoQ6jyJ4.cjs +0 -6
  149. package/dist/shiki-adapter-D-aKw7PP.mjs +0 -6
  150. package/dist/utils-Crm9oPcV.mjs +0 -7
  151. package/dist/utils-D6Xtj0FZ.cjs +0 -7
  152. /package/dist/{errors-0zGHRLue.mjs → errors-N-b6Sn2G.mjs} +0 -0
  153. /package/dist/{index-1KsTDq4o.d.mts → index-lFoyzCXy.d.mts} +0 -0
  154. /package/dist/{types-generator-BXhv7Ill.cjs → types-generator-DDSA93P3.cjs} +0 -0
  155. /package/dist/{types-generator-bDPvUztF.mjs → types-generator-DG1GX1EZ.mjs} +0 -0
@@ -3,48 +3,8 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- //#region \0rolldown/runtime.js
7
- var __create = Object.create;
8
- var __defProp = Object.defineProperty;
9
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
10
- var __getOwnPropNames = Object.getOwnPropertyNames;
11
- var __getProtoOf = Object.getPrototypeOf;
12
- var __hasOwnProp = Object.prototype.hasOwnProperty;
13
- var __exportAll = (all, no_symbols) => {
14
- let target = {};
15
- for (var name in all) {
16
- __defProp(target, name, {
17
- get: all[name],
18
- enumerable: true
19
- });
20
- }
21
- if (!no_symbols) {
22
- __defProp(target, Symbol.toStringTag, { value: "Module" });
23
- }
24
- return target;
25
- };
26
- var __copyProps = (to, from, except, desc) => {
27
- if (from && typeof from === "object" || typeof from === "function") {
28
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
29
- key = keys[i];
30
- if (!__hasOwnProp.call(to, key) && key !== except) {
31
- __defProp(to, key, {
32
- get: ((k) => from[k]).bind(null, key),
33
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
34
- });
35
- }
36
- }
37
- }
38
- return to;
39
- };
40
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
41
- value: mod,
42
- enumerable: true
43
- }) : target, mod));
44
-
45
- //#endregion
6
+ const require_router = require('./router-C3kygdRK.cjs');
46
7
  let react = require("react");
47
- let react_router_dom = require("react-router-dom");
48
8
  let react_jsx_runtime = require("react/jsx-runtime");
49
9
  let clsx = require("clsx");
50
10
  let tailwind_merge = require("tailwind-merge");
@@ -53,17 +13,20 @@ let tailwind_merge = require("tailwind-merge");
53
13
  const PREFERENCES_KEY = "boltdocs-user-preferences";
54
14
  const BOLTDOCS_CONTEXT_SYMBOL = Symbol.for("__BDOCS_BOLTDOCS_CONTEXT__");
55
15
  const BOLTDOCS_INSTANCE_SYMBOL = Symbol.for("__BDOCS_BOLTDOCS_INSTANCE__");
56
- const BoltdocsContext = globalThis[BOLTDOCS_CONTEXT_SYMBOL] || (globalThis[BOLTDOCS_CONTEXT_SYMBOL] = (0, react.createContext)(void 0));
16
+ function getSavedPrefs() {
17
+ if (typeof window === "undefined") return {};
18
+ try {
19
+ const raw = window.localStorage.getItem(PREFERENCES_KEY);
20
+ return raw ? JSON.parse(raw) : {};
21
+ } catch {
22
+ return {};
23
+ }
24
+ }
25
+ const globalRegistry$1 = globalThis;
26
+ const existingContext = globalRegistry$1[BOLTDOCS_CONTEXT_SYMBOL];
27
+ const BoltdocsContext = existingContext || (0, react.createContext)(void 0);
28
+ if (!existingContext) Reflect.set(globalRegistry$1, BOLTDOCS_CONTEXT_SYMBOL, BoltdocsContext);
57
29
  function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" }) {
58
- const getSavedPrefs = () => {
59
- if (typeof window === "undefined") return {};
60
- try {
61
- const raw = window.localStorage.getItem(PREFERENCES_KEY);
62
- return raw ? JSON.parse(raw) : {};
63
- } catch {
64
- return {};
65
- }
66
- };
67
30
  const [locale, setLocaleState] = (0, react.useState)(() => {
68
31
  if (initialLocale) return initialLocale;
69
32
  return getSavedPrefs().locale || "";
@@ -78,43 +41,57 @@ function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" })
78
41
  (0, react.useEffect)(() => {
79
42
  setHasHydrated(true);
80
43
  }, []);
81
- const value = (0, react.useMemo)(() => {
82
- const updateLocale = (l) => {
83
- const newL = l || "";
84
- setLocaleState(newL);
85
- if (typeof window !== "undefined") try {
86
- const prefs = getSavedPrefs();
87
- window.localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
88
- ...prefs,
89
- locale: newL
90
- }));
91
- } catch (e) {}
92
- };
93
- const updateVersion = (v) => {
94
- const newV = v || "";
95
- setVersionState(newV);
96
- if (typeof window !== "undefined") try {
97
- const prefs = getSavedPrefs();
98
- window.localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
99
- ...prefs,
100
- version: newV
101
- }));
102
- } catch (e) {}
103
- };
104
- return {
105
- currentLocale: locale,
106
- currentVersion: version,
107
- setLocale: updateLocale,
108
- setVersion: updateVersion,
109
- hasHydrated,
110
- setHasHydrated
111
- };
112
- }, [
44
+ const updateLocale = (0, react.useCallback)((l) => {
45
+ const newL = l || "";
46
+ setLocaleState((current) => {
47
+ if (current === newL) return current;
48
+ return newL;
49
+ });
50
+ if (typeof globalThis !== "undefined") Reflect.set(globalThis, BOLTDOCS_INSTANCE_SYMBOL, {
51
+ ...globalThis[BOLTDOCS_INSTANCE_SYMBOL],
52
+ currentLocale: newL
53
+ });
54
+ if (typeof window !== "undefined") try {
55
+ const prefs = getSavedPrefs();
56
+ if (prefs.locale !== newL) window.localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
57
+ ...prefs,
58
+ locale: newL
59
+ }));
60
+ } catch {}
61
+ }, []);
62
+ const updateVersion = (0, react.useCallback)((v) => {
63
+ const newV = v || "";
64
+ setVersionState((current) => {
65
+ if (current === newV) return current;
66
+ return newV;
67
+ });
68
+ if (typeof globalThis !== "undefined") Reflect.set(globalThis, BOLTDOCS_INSTANCE_SYMBOL, {
69
+ ...globalThis[BOLTDOCS_INSTANCE_SYMBOL],
70
+ currentVersion: newV
71
+ });
72
+ if (typeof window !== "undefined") try {
73
+ const prefs = getSavedPrefs();
74
+ if (prefs.version !== newV) window.localStorage.setItem(PREFERENCES_KEY, JSON.stringify({
75
+ ...prefs,
76
+ version: newV
77
+ }));
78
+ } catch {}
79
+ }, []);
80
+ const value = (0, react.useMemo)(() => ({
81
+ currentLocale: locale,
82
+ currentVersion: version,
83
+ setLocale: updateLocale,
84
+ setVersion: updateVersion,
85
+ hasHydrated,
86
+ setHasHydrated
87
+ }), [
113
88
  locale,
114
89
  version,
115
- hasHydrated
90
+ hasHydrated,
91
+ updateLocale,
92
+ updateVersion
116
93
  ]);
117
- if (typeof globalThis !== "undefined") globalThis[BOLTDOCS_INSTANCE_SYMBOL] = value;
94
+ if (typeof globalThis !== "undefined") Reflect.set(globalThis, BOLTDOCS_INSTANCE_SYMBOL, value);
118
95
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoltdocsContext.Provider, {
119
96
  value,
120
97
  children
@@ -122,7 +99,8 @@ function BoltdocsProvider({ children, initialLocale = "", initialVersion = "" })
122
99
  }
123
100
  function useBoltdocsContext() {
124
101
  const context = (0, react.use)(BoltdocsContext);
125
- if (!context && typeof globalThis !== "undefined" && globalThis[BOLTDOCS_INSTANCE_SYMBOL]) return globalThis[BOLTDOCS_INSTANCE_SYMBOL];
102
+ const globalInstance = typeof globalThis !== "undefined" ? globalThis[BOLTDOCS_INSTANCE_SYMBOL] : void 0;
103
+ if (!context && globalInstance) return globalInstance;
126
104
  if (!context) throw new Error("useBoltdocsContext must be used within a BoltdocsProvider");
127
105
  return context;
128
106
  }
@@ -135,28 +113,46 @@ function useBoltdocsContext() {
135
113
  */
136
114
  const CONFIG_CONTEXT_SYMBOL = Symbol.for("__BDOCS_CONFIG_CONTEXT__");
137
115
  const CONFIG_INSTANCE_SYMBOL = Symbol.for("__BDOCS_CONFIG_INSTANCE__");
138
- const ConfigContext = globalThis[CONFIG_CONTEXT_SYMBOL] || (globalThis[CONFIG_CONTEXT_SYMBOL] = (0, react.createContext)(null));
116
+ const globalRegistry = globalThis;
117
+ const existingConfigContext = globalRegistry[CONFIG_CONTEXT_SYMBOL];
118
+ const ConfigContext = existingConfigContext || (0, react.createContext)(null);
119
+ if (!existingConfigContext) globalRegistry[CONFIG_CONTEXT_SYMBOL] = ConfigContext;
120
+ /**
121
+ * Hook to access the Boltdocs configuration when one is available.
122
+ *
123
+ * Low-level primitives such as icons can also be rendered standalone (for
124
+ * example in a component preview or a unit test), so they must not be forced
125
+ * to mount the full application provider just to render an inline SVG.
126
+ */
127
+ function useOptionalConfig() {
128
+ const context = (0, react.use)(ConfigContext);
129
+ if (context) return context;
130
+ const globalConfig = globalRegistry[CONFIG_INSTANCE_SYMBOL];
131
+ if (globalConfig) return globalConfig;
132
+ return null;
133
+ }
139
134
  /**
140
135
  * Hook to access the Boltdocs configuration.
141
136
  */
142
137
  function useConfig() {
143
- const context = (0, react.use)(ConfigContext);
144
- if (!context && typeof globalThis !== "undefined" && globalThis[CONFIG_INSTANCE_SYMBOL]) return globalThis[CONFIG_INSTANCE_SYMBOL];
145
- if (!context) throw new Error("useConfig must be used within a ConfigProvider");
146
- return context;
138
+ const config = useOptionalConfig();
139
+ if (!config) throw new Error("useConfig must be used within a ConfigProvider");
140
+ return config;
147
141
  }
148
142
 
149
143
  //#endregion
150
144
  //#region src/client/components/ui-base/icons.tsx
151
- var icons_exports = /* @__PURE__ */ __exportAll({
145
+ var icons_exports = /* @__PURE__ */ require_router.__exportAll({
152
146
  AlertCircle: () => AlertCircle,
153
147
  AlertTriangle: () => AlertTriangle,
154
148
  ArrowLeft: () => ArrowLeft,
149
+ BookOpen: () => BookOpen,
155
150
  Check: () => Check,
156
151
  ChevronDown: () => ChevronDown,
157
152
  ChevronLeft: () => ChevronLeft,
158
153
  ChevronRight: () => ChevronRight,
159
154
  CircleHelp: () => CircleHelp,
155
+ Code2: () => Code2,
160
156
  Copy: () => Copy,
161
157
  CornerDownLeft: () => CornerDownLeft,
162
158
  ExternalLink: () => ExternalLink,
@@ -164,18 +160,24 @@ var icons_exports = /* @__PURE__ */ __exportAll({
164
160
  FaceGood: () => FaceGood,
165
161
  FaceRegular: () => FaceRegular,
166
162
  File: () => File,
163
+ FileCode2: () => FileCode2,
167
164
  FileText: () => FileText,
165
+ FlaskConical: () => FlaskConical,
166
+ Gauge: () => Gauge,
168
167
  Hash: () => Hash,
169
168
  Home: () => Home,
170
169
  Info: () => Info,
171
170
  Languages: () => Languages,
171
+ LifeBuoy: () => LifeBuoy,
172
172
  Lightbulb: () => Lightbulb,
173
173
  Link: () => Link$1,
174
174
  Menu: () => Menu,
175
175
  Monitor: () => Monitor,
176
176
  Moon: () => Moon,
177
177
  MoreVertical: () => MoreVertical,
178
+ Paintbrush: () => Paintbrush,
178
179
  Pencil: () => Pencil,
180
+ Rocket: () => Rocket,
179
181
  Search: () => Search,
180
182
  Sun: () => Sun,
181
183
  TextAlignStart: () => TextAlignStart,
@@ -215,6 +217,58 @@ const Lightbulb = createIcon("Lightbulb", /* @__PURE__ */ (0, react_jsx_runtime.
215
217
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 18h6" }),
216
218
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10 22h4" })
217
219
  ] }));
220
+ const BookOpen = createIcon("BookOpen", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
221
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2 4v16a2 2 0 0 0 2 2h16" }),
222
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M22 18V4a2 2 0 0 0-2-2H6a4 4 0 0 0-4 4" }),
223
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 2v16" }),
224
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M6 18h16" })
225
+ ] }));
226
+ const Rocket = createIcon("Rocket", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
227
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M4.5 16.5c-1.5 1.5-2 4-2 4s2.5-.5 4-2c.7-.7.7-1.8 0-2.5s-1.3-.2-2 0Z" }),
228
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m12 15-3-3a22 22 0 0 1 3-5c2-2.5 5-4 9-4 0 4-1.5 7-4 9a22 22 0 0 1-5 3Z" }),
229
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 12H4l-2 2 5 1" }),
230
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M12 15v5l2-2 1-5" }),
231
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
232
+ cx: "16",
233
+ cy: "8",
234
+ r: "1"
235
+ })
236
+ ] }));
237
+ const Code2 = createIcon("Code2", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
238
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m18 16 4-4-4-4" }),
239
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m6 8-4 4 4 4" }),
240
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m14.5 4-5 16" })
241
+ ] }));
242
+ const FlaskConical = createIcon("FlaskConical", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
243
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9 3h6" }),
244
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10 3v7.5L4.5 19a2 2 0 0 0 1.7 3h11.6a2 2 0 0 0 1.7-3L14 10.5V3" }),
245
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M7 16h10" })
246
+ ] }));
247
+ const FileCode2 = createIcon("FileCode2", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
248
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z" }),
249
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 2v6h6" }),
250
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m10 13-2 2 2 2" }),
251
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m14 13 2 2-2 2" })
252
+ ] }));
253
+ const Paintbrush = createIcon("Paintbrush", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m14 6 4 4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3 21c3 0 5-1 6-4l8-8a2.8 2.8 0 1 0-4-4l-8 8c-3 1-4 4-2 8Z" })] }));
254
+ const Gauge = createIcon("Gauge", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
255
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m12 14 4-4" }),
256
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M3.3 17a9 9 0 1 1 17.4 0" }),
257
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M5 19h14" })
258
+ ] }));
259
+ const LifeBuoy = createIcon("LifeBuoy", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
260
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
261
+ cx: "12",
262
+ cy: "12",
263
+ r: "10"
264
+ }),
265
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("circle", {
266
+ cx: "12",
267
+ cy: "12",
268
+ r: "4"
269
+ }),
270
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "m4.9 4.9 4.3 4.3M14.8 14.8l4.3 4.3M19.1 4.9l-4.3 4.3M9.2 14.8l-4.3 4.3" })
271
+ ] }));
218
272
  const AlertTriangle = createIcon("AlertTriangle", /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
219
273
  /* @__PURE__ */ (0, react_jsx_runtime.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" }),
220
274
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
@@ -493,25 +547,6 @@ const FaceBad = createIcon("FaceBad", /* @__PURE__ */ (0, react_jsx_runtime.jsxs
493
547
  })
494
548
  ] }));
495
549
 
496
- //#endregion
497
- //#region src/client/app/routes-context.tsx
498
- const RoutesContext = (0, react.createContext)({ routes: [] });
499
- /**
500
- * Hook to access the processed routes list from the closest provider.
501
- */
502
- function useRoutesContext() {
503
- return (0, react.use)(RoutesContext);
504
- }
505
- /**
506
- * Provider component for the documentation routes.
507
- */
508
- function RoutesProvider({ routes, children }) {
509
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RoutesContext.Provider, {
510
- value: { routes },
511
- children
512
- });
513
- }
514
-
515
550
  //#endregion
516
551
  //#region src/client/utils/path.ts
517
552
  /**
@@ -523,117 +558,146 @@ function RoutesProvider({ routes, children }) {
523
558
  function normalizePath(p) {
524
559
  return p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
525
560
  }
561
+ /**
562
+ * Resolves a public asset URL under the configured Vite/base path.
563
+ * Root-relative URLs are otherwise interpreted against the origin root, which
564
+ * breaks sites deployed under a documentation base such as `/docs`.
565
+ */
566
+ function resolvePublicAssetUrl(value, base) {
567
+ if (!value || !value.startsWith("/") || value.startsWith("//") || /^\/(?:https?:|data:)/i.test(value)) return value;
568
+ const normalizedBase = (base || "/").replace(/\/+$/, "");
569
+ if (!normalizedBase || normalizedBase === "/") return value;
570
+ if (value === normalizedBase || value.startsWith(`${normalizedBase}/`)) return value;
571
+ return `${normalizedBase}${value}`;
572
+ }
526
573
 
527
574
  //#endregion
528
- //#region src/client/hooks/use-routes.ts
575
+ //#region src/client/app/routes-context.tsx
576
+ const RoutesContext = (0, react.createContext)({
577
+ routes: [],
578
+ index: {
579
+ byPath: /* @__PURE__ */ new Map(),
580
+ hintsByPath: /* @__PURE__ */ new Map(),
581
+ collectionNames: []
582
+ }
583
+ });
529
584
  /**
530
- * Hook to access the framework's routing state.
531
- * Returns both the complete set of routes and a filtered list based on the current
532
- * version and locale.
585
+ * Hook to access the processed routes list from the closest provider.
533
586
  */
534
- function useRoutes() {
535
- const { routes: allRoutes } = useRoutesContext();
536
- const config = useConfig();
537
- const location = (0, react_router_dom.useLocation)();
538
- const { currentLocale: currentLocaleStore, currentVersion: currentVersionStore } = useBoltdocsContext();
539
- const currentPath = normalizePath(location.pathname);
540
- const currentRoute = allRoutes?.find?.((r) => normalizePath(r.path) === currentPath);
541
- const currentLocale = config.i18n ? currentLocaleStore || config.i18n.defaultLocale : void 0;
542
- const currentVersion = config.versions ? currentVersionStore || config.versions.defaultVersion : void 0;
543
- const routes = (0, react.useMemo)(() => {
544
- if (!allRoutes) return [];
545
- const alternateCounts = /* @__PURE__ */ new Map();
546
- const defaultLocale = config.i18n?.defaultLocale || "";
547
- const defaultVersion = config.versions?.defaultVersion || "";
548
- for (const r of allRoutes) {
549
- const locale = r.locale || defaultLocale;
550
- const version = r.version || defaultVersion;
551
- const key = `${r.filePath}::${locale}::${version}`;
552
- alternateCounts.set(key, (alternateCounts.get(key) || 0) + 1);
587
+ function useRoutesContext() {
588
+ return (0, react.use)(RoutesContext);
589
+ }
590
+ /**
591
+ * Provider component for the documentation routes.
592
+ */
593
+ function RoutesProvider({ routes: initialRoutes, children }) {
594
+ const [routes, setRoutes] = (0, react.useState)(initialRoutes);
595
+ const index = (0, react.useMemo)(() => {
596
+ const byPath = /* @__PURE__ */ new Map();
597
+ const hintsByPath = /* @__PURE__ */ new Map();
598
+ const collectionNames = /* @__PURE__ */ new Set();
599
+ for (const route of routes) {
600
+ if (!route.path) continue;
601
+ const path = normalizePath(route.path);
602
+ byPath.set(path, route);
603
+ hintsByPath.set(path, {
604
+ path: route.path,
605
+ kind: route.collection ? "collection" : void 0,
606
+ collection: route.collection
607
+ });
608
+ if (route.collection) collectionNames.add(route.collection);
553
609
  }
554
- return allRoutes.filter((r) => {
555
- const localeMatch = config.i18n ? (r.locale || config.i18n.defaultLocale) === currentLocale : true;
556
- const versionMatch = config.versions ? (r.version || config.versions.defaultVersion) === currentVersion : true;
557
- if (!(localeMatch && versionMatch)) return false;
558
- const pathParts = location.pathname.split("/").filter(Boolean);
559
- const isCurrentLocalePrefixed = !!(config.i18n && pathParts.includes(currentLocaleStore || config.i18n.defaultLocale));
560
- const isCurrentVersionPrefixed = !!(config.versions && pathParts.includes(currentVersionStore || config.versions.defaultVersion));
561
- const isRouteLocalePrefixed = !!r.locale;
562
- const isRouteVersionPrefixed = !!r.version;
563
- const locale = r.locale || defaultLocale;
564
- const version = r.version || defaultVersion;
565
- const key = `${r.filePath}::${locale}::${version}`;
566
- if ((alternateCounts.get(key) || 0) > 1) {
567
- const localeMismatch = config.i18n && isCurrentLocalePrefixed !== isRouteLocalePrefixed;
568
- const versionMismatch = config.versions && isCurrentVersionPrefixed !== isRouteVersionPrefixed;
569
- if (localeMismatch || versionMismatch) return false;
570
- }
571
- return true;
572
- });
573
- }, [
574
- allRoutes,
575
- config,
576
- currentLocale,
577
- currentVersion,
578
- location.pathname,
579
- currentLocaleStore,
580
- currentVersionStore
581
- ]);
582
- const collections = (0, react.useMemo)(() => {
583
- return new Set((allRoutes || []).map((r) => r.collection).filter(Boolean));
584
- }, [allRoutes]);
585
- const currentSegment = location.pathname.split("/").filter(Boolean)[0]?.toLowerCase();
586
- return {
587
- routes,
588
- allRoutes,
589
- currentRoute,
590
- isCollectionPage: !!currentRoute?.collection || (currentSegment ? collections.has(currentSegment) : false),
591
- currentLocale,
592
- currentVersion
593
- };
610
+ return {
611
+ byPath,
612
+ hintsByPath,
613
+ collectionNames: [...collectionNames]
614
+ };
615
+ }, [routes]);
616
+ (0, react.useEffect)(() => {
617
+ if (!{}.hot) return;
618
+ const handler = (payload) => {
619
+ setRoutes((prev) => {
620
+ const deleted = new Set(payload.routes.deleted);
621
+ const next = prev.filter((r) => !deleted.has(r.path));
622
+ for (const updated of payload.routes.updated) {
623
+ const idx = next.findIndex((r) => r.path === updated.path);
624
+ if (idx >= 0) next[idx] = updated;
625
+ else next.push(updated);
626
+ }
627
+ return [...next];
628
+ });
629
+ };
630
+ const hot = {}.hot;
631
+ hot.on("boltdocs:frontmatter-update", handler);
632
+ return () => hot.off?.("boltdocs:frontmatter-update", handler);
633
+ }, []);
634
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RoutesContext.Provider, {
635
+ value: {
636
+ routes,
637
+ index
638
+ },
639
+ children
640
+ });
594
641
  }
595
642
 
596
643
  //#endregion
597
644
  //#region src/client/hooks/use-localized-to.ts
598
645
  function useLocalizedTo(to) {
599
646
  const config = useConfig();
600
- const { currentLocale: activeLocale, currentVersion: activeVersion, allRoutes } = useRoutes();
647
+ const routeContext = useRoutesContext();
648
+ const routeIndex = routeContext.index || {
649
+ byPath: new Map(routeContext.routes.map((route) => [route.path, route])),
650
+ hintsByPath: /* @__PURE__ */ new Map(),
651
+ collectionNames: []
652
+ };
653
+ const { currentLocale: activeLocale, currentVersion: activeVersion } = useBoltdocsContext();
654
+ const configuredVersion = (config.versions?.versions || []).some((version) => version.path === activeVersion) ? activeVersion : void 0;
655
+ const configuredLocale = (config.i18n ? Array.isArray(config.i18n.locales) ? config.i18n.locales : Object.keys(config.i18n.locales) : []).includes(activeLocale) ? activeLocale : void 0;
601
656
  if (!config || typeof to !== "string") return to;
602
- if (to.startsWith("http") || to.startsWith("//") || to.startsWith("#")) return to;
603
- if (to.startsWith("site:")) {
604
- to = to.replace("site:", "");
605
- if (to === "" || to === "/") return config.i18n && activeLocale && activeLocale !== config.i18n.defaultLocale ? `/${activeLocale}` : "/";
606
- return to;
607
- }
608
- const [pathOnly, hashAndQuery] = to.split(/([?#].*)/s);
609
- const normalizedTo = pathOnly.endsWith("/") && pathOnly.length > 1 ? pathOnly.slice(0, -1) : pathOnly;
610
- const isKnownRoute = allRoutes?.some((r) => {
611
- return (r.path.endsWith("/") && r.path.length > 1 ? r.path.slice(0, -1) : r.path) === (normalizedTo || "/");
657
+ if (to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//") || to.startsWith("#") || to.startsWith("?") || require_router.hasUriScheme(to.replace(/^site:/, ""))) return to.startsWith("site:") ? to.slice(5) || "/" : to;
658
+ const siteProtocol = to.startsWith("site:");
659
+ const siteValue = siteProtocol ? to.slice(5) || "/" : to;
660
+ const configCollections = config.collections;
661
+ const configuredCollectionNames = Array.isArray(configCollections) ? configCollections : Object.keys(configCollections?.labels || {});
662
+ const collectionNames = [...new Set([...routeIndex.collectionNames, ...configuredCollectionNames])];
663
+ const targetPath = siteValue.split(/[?#]/, 1)[0];
664
+ const normalizedTarget = targetPath.endsWith("/") && targetPath.length > 1 ? targetPath.slice(0, -1) : targetPath;
665
+ const knownRoute = routeIndex.hintsByPath.get(normalizedTarget);
666
+ const knownRouteMeta = routeIndex.byPath.get(normalizedTarget);
667
+ const knownRouteKind = knownRoute ? knownRoute.kind || (require_router.hasUrlBase(normalizedTarget, config.base) ? "doc" : "external") : void 0;
668
+ const routeHints = knownRoute ? [{
669
+ ...knownRoute,
670
+ kind: knownRouteKind
671
+ }] : [];
672
+ const kind = knownRouteKind || (siteProtocol ? "external" : "doc");
673
+ const contractConfig = {
674
+ base: config.base,
675
+ i18n: config.i18n ? {
676
+ defaultLocale: config.i18n.defaultLocale,
677
+ locales: config.i18n.locales
678
+ } : void 0,
679
+ versions: config.versions ? {
680
+ defaultVersion: config.versions.defaultVersion,
681
+ prefix: config.versions.prefix,
682
+ versions: config.versions.versions
683
+ } : void 0,
684
+ collections: collectionNames
685
+ };
686
+ const parsedTarget = require_router.parseUrlReference(siteValue, contractConfig, {
687
+ kind,
688
+ routes: routeHints
612
689
  });
613
- const i18n = config.i18n;
614
- const versions = config.versions;
615
- const base = (config.base || "/docs").replace(/\/$/, "");
616
- const baseSegment = base.startsWith("/") ? base.substring(1) : base;
617
- const rawParts = pathOnly.split("/").filter(Boolean);
618
- const isDocsPath = baseSegment && rawParts.length > 0 && rawParts[0] === baseSegment || !isKnownRoute && rawParts.length > 0;
619
- const parts = [...rawParts];
620
- let pIdx = 0;
621
- if (baseSegment && parts[pIdx] === baseSegment) pIdx++;
622
- if (versions && parts.length > pIdx) {
623
- if (versions.versions.find((v) => v.path === parts[pIdx])) pIdx++;
690
+ const resolved = require_router.resolveUrlReference(siteValue, contractConfig, {
691
+ kind,
692
+ routes: routeHints,
693
+ locale: configuredLocale,
694
+ version: kind === "collection" || kind === "external" ? knownRouteMeta?.version : parsedTarget.version || configuredVersion
695
+ });
696
+ if (siteValue.endsWith("/") && siteValue.length > 1 && !resolved.split(/[?#]/, 1)[0].endsWith("/")) {
697
+ const suffixIndex = resolved.search(/[?#]/);
698
+ return `${suffixIndex < 0 ? resolved : resolved.slice(0, suffixIndex)}/${suffixIndex < 0 ? "" : resolved.slice(suffixIndex)}`;
624
699
  }
625
- if (i18n && parts.length > pIdx && (Array.isArray(i18n.locales) ? i18n.locales.includes(parts[pIdx]) : parts[pIdx] in i18n.locales)) pIdx++;
626
- const routeContent = parts.slice(pIdx);
627
- const resultParts = [];
628
- if (isDocsPath) {
629
- if (baseSegment) resultParts.push(baseSegment);
630
- if (versions && activeVersion) resultParts.push(activeVersion);
631
- if (i18n && activeLocale && activeLocale !== i18n.defaultLocale) resultParts.push(activeLocale);
632
- } else if (i18n && activeLocale && activeLocale !== i18n.defaultLocale) resultParts.push(activeLocale);
633
- resultParts.push(...routeContent);
634
- let finalPath = `/${resultParts.join("/")}`;
635
- if (pathOnly.endsWith("/") && pathOnly.length > 1 && !finalPath.endsWith("/")) finalPath += "/";
636
- return (finalPath || "/") + (hashAndQuery || "");
700
+ return resolved;
637
701
  }
638
702
 
639
703
  //#endregion
@@ -642,6 +706,74 @@ function cn(...inputs) {
642
706
  return (0, tailwind_merge.twMerge)((0, clsx.clsx)(inputs));
643
707
  }
644
708
 
709
+ //#endregion
710
+ //#region src/client/view-transitions.ts
711
+ function resolveOptions(options) {
712
+ if (options?.enabled === false) return void 0;
713
+ return {
714
+ enabled: true,
715
+ ...options?.types?.length ? { types: options.types } : {}
716
+ };
717
+ }
718
+ function isNativeViewTransitionSupported() {
719
+ return typeof document !== "undefined" && typeof document.startViewTransition === "function";
720
+ }
721
+ /**
722
+ * Starts a native document transition when the browser supports it. On older
723
+ * browsers, the update still runs normally and the function returns null.
724
+ */
725
+ function startViewTransition(update, options) {
726
+ const resolved = resolveOptions(options);
727
+ if (typeof document === "undefined" || resolved?.enabled !== true) {
728
+ update();
729
+ return null;
730
+ }
731
+ const start = document.startViewTransition;
732
+ if (!start) {
733
+ update();
734
+ return null;
735
+ }
736
+ const types = options?.types;
737
+ return start.call(document, {
738
+ update,
739
+ ...types?.length ? { types } : {}
740
+ });
741
+ }
742
+ /**
743
+ * Returns a transition-aware runner that follows the project's experimental
744
+ * configuration. It is safe to use in custom layouts and external pages.
745
+ *
746
+ * The returned value is callable for backwards compatibility:
747
+ * `transition(() => setState(...))`. It also exposes `run` and `start` aliases
748
+ * for discoverability in editor autocomplete.
749
+ */
750
+ function useViewTransition() {
751
+ const configured = useOptionalConfig()?.experimental?.viewTransitions;
752
+ const enabled = configured === true || typeof configured === "object" && configured.enabled === true;
753
+ const supported = isNativeViewTransitionSupported();
754
+ const run = (0, react.useCallback)((update, options) => {
755
+ if (!enabled && options?.enabled !== true) {
756
+ update();
757
+ return null;
758
+ }
759
+ const configuredTypes = typeof configured === "object" ? configured.types : void 0;
760
+ return startViewTransition(update, {
761
+ ...options,
762
+ types: options?.types || configuredTypes
763
+ });
764
+ }, [configured, enabled]);
765
+ return (0, react.useMemo)(() => Object.assign(run, {
766
+ run,
767
+ start: run,
768
+ enabled,
769
+ supported
770
+ }), [
771
+ enabled,
772
+ run,
773
+ supported
774
+ ]);
775
+ }
776
+
645
777
  //#endregion
646
778
  //#region src/client/components/primitives/link.tsx
647
779
  /**
@@ -649,44 +781,71 @@ function cn(...inputs) {
649
781
  * and adds framework-specific logic for path localization and preloading.
650
782
  */
651
783
  function Link(props) {
652
- const { href, onMouseEnter, onFocus, onClick, ...rest } = props;
653
- const navigate = (0, react_router_dom.useNavigate)();
654
- const localizedHref = useLocalizedTo(href ?? "");
784
+ const { href, to, ref, prefetch = "hover", onMouseEnter, onFocus, onClick, target: linkTarget, download, transition = false, transitionTypes, ...rest } = props;
785
+ const target = href ?? to ?? "";
786
+ const navigate = require_router.useNavigate();
787
+ const prefetchRoute = require_router.usePrefetch();
788
+ const runTransition = useViewTransition();
789
+ const localizedHref = useLocalizedTo(target);
655
790
  const handleClick = (e) => {
656
791
  onClick?.(e);
657
- if (e.defaultPrevented) return;
658
- if (!(localizedHref && (localizedHref.startsWith("http://") || localizedHref.startsWith("https://") || localizedHref.startsWith("//")))) {
792
+ if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || download !== void 0 || linkTarget && linkTarget !== "_self") return;
793
+ if (!(localizedHref && (localizedHref.startsWith("http://") || localizedHref.startsWith("https://") || localizedHref.startsWith("//") || require_router.hasUriScheme(localizedHref)))) {
659
794
  e.preventDefault();
660
- navigate(localizedHref);
795
+ const navigateTo = () => navigate(localizedHref, transition ? { viewTransition: false } : void 0);
796
+ if (transition) runTransition(navigateTo, {
797
+ enabled: true,
798
+ types: transitionTypes
799
+ });
800
+ else navigateTo();
661
801
  }
662
802
  };
803
+ const handlePrefetch = () => {
804
+ if (prefetch === "hover" && localizedHref) prefetchRoute(localizedHref);
805
+ };
663
806
  const handleMouseEnter = (e) => {
664
807
  onMouseEnter?.(e);
808
+ handlePrefetch();
665
809
  };
666
810
  const handleFocus = (e) => {
667
811
  onFocus?.(e);
812
+ handlePrefetch();
668
813
  };
669
814
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
670
815
  ...rest,
816
+ ref,
671
817
  href: localizedHref,
818
+ target: linkTarget,
819
+ download,
672
820
  onClick: handleClick,
673
821
  onMouseEnter: handleMouseEnter,
674
822
  onFocus: handleFocus
675
823
  });
676
824
  }
677
825
  /**
826
+ * A convenience link that opts into the experimental View Transition API.
827
+ * It keeps normal anchor behavior when the feature is disabled or unsupported.
828
+ */
829
+ function TransitionLink(props) {
830
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Link, {
831
+ ...props,
832
+ transition: true
833
+ });
834
+ }
835
+ /**
678
836
  * A primitive NavLink component that provides active state detection.
679
837
  */
680
838
  function NavLink(props) {
681
- const { href, end = false, className, children, ...rest } = props;
682
- const location = (0, react_router_dom.useLocation)();
683
- const localizedHref = useLocalizedTo(href ?? "");
839
+ const { href, to, end = false, className, children, ...rest } = props;
840
+ const location = require_router.useLocation();
841
+ const localizedHref = useLocalizedTo(href ?? to ?? "");
684
842
  const isActive = end ? location.pathname === localizedHref : location.pathname.startsWith(localizedHref);
685
843
  const resolvedClassName = typeof className === "function" ? className({ isActive }) : cn(className, isActive && "active");
686
844
  const resolvedChildren = typeof children === "function" ? children({ isActive }) : children;
687
845
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Link, {
688
846
  ...rest,
689
847
  href,
848
+ to,
690
849
  className: resolvedClassName,
691
850
  children: resolvedChildren
692
851
  });
@@ -897,16 +1056,16 @@ Object.defineProperty(exports, 'TextAlignStart', {
897
1056
  return TextAlignStart;
898
1057
  }
899
1058
  });
900
- Object.defineProperty(exports, 'X', {
1059
+ Object.defineProperty(exports, 'TransitionLink', {
901
1060
  enumerable: true,
902
1061
  get: function () {
903
- return X;
1062
+ return TransitionLink;
904
1063
  }
905
1064
  });
906
- Object.defineProperty(exports, '__toESM', {
1065
+ Object.defineProperty(exports, 'X', {
907
1066
  enumerable: true,
908
1067
  get: function () {
909
- return __toESM;
1068
+ return X;
910
1069
  }
911
1070
  });
912
1071
  Object.defineProperty(exports, 'cn', {
@@ -927,6 +1086,18 @@ Object.defineProperty(exports, 'normalizePath', {
927
1086
  return normalizePath;
928
1087
  }
929
1088
  });
1089
+ Object.defineProperty(exports, 'resolvePublicAssetUrl', {
1090
+ enumerable: true,
1091
+ get: function () {
1092
+ return resolvePublicAssetUrl;
1093
+ }
1094
+ });
1095
+ Object.defineProperty(exports, 'startViewTransition', {
1096
+ enumerable: true,
1097
+ get: function () {
1098
+ return startViewTransition;
1099
+ }
1100
+ });
930
1101
  Object.defineProperty(exports, 'useBoltdocsContext', {
931
1102
  enumerable: true,
932
1103
  get: function () {
@@ -945,9 +1116,21 @@ Object.defineProperty(exports, 'useLocalizedTo', {
945
1116
  return useLocalizedTo;
946
1117
  }
947
1118
  });
948
- Object.defineProperty(exports, 'useRoutes', {
1119
+ Object.defineProperty(exports, 'useOptionalConfig', {
1120
+ enumerable: true,
1121
+ get: function () {
1122
+ return useOptionalConfig;
1123
+ }
1124
+ });
1125
+ Object.defineProperty(exports, 'useRoutesContext', {
1126
+ enumerable: true,
1127
+ get: function () {
1128
+ return useRoutesContext;
1129
+ }
1130
+ });
1131
+ Object.defineProperty(exports, 'useViewTransition', {
949
1132
  enumerable: true,
950
1133
  get: function () {
951
- return useRoutes;
1134
+ return useViewTransition;
952
1135
  }
953
1136
  });