boltdocs 3.2.2 → 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.
- package/bin/boltdocs.js +20 -1
- package/bin/preloader.mjs +28 -0
- package/dist/{adapters-ByYY44Zy.mjs → adapters-BmB4TKCc.mjs} +1 -1
- package/dist/{adapters-DvmtpdSF.cjs → adapters-Cp1Maurn.cjs} +1 -1
- package/dist/audit-CLXjMzwQ.mjs +11 -0
- package/dist/audit-COgjnQ5n.cjs +11 -0
- package/dist/build-BS2hefiL.cjs +6 -0
- package/dist/build-C5mNh9D-.mjs +6 -0
- package/dist/cache-CJE9nWLE.cjs +6 -0
- package/dist/cache-OY4HzIXl.mjs +6 -0
- package/dist/callout-oI_LCbxS.d.ts +71 -0
- package/dist/callout-plqx9Dw-.d.cts +71 -0
- package/dist/client/index.cjs +1265 -569
- package/dist/client/index.d.cts +3 -542
- package/dist/client/index.d.ts +3 -542
- package/dist/client/index.js +1167 -521
- package/dist/client/mdx.cjs +1 -1
- package/dist/client/mdx.d.cts +24 -2
- package/dist/client/mdx.d.ts +24 -2
- package/dist/client/mdx.js +1 -1
- package/dist/client/primitives.cjs +14 -4
- package/dist/client/primitives.d.cts +281 -38
- package/dist/client/primitives.d.ts +281 -38
- package/dist/client/primitives.js +5 -5
- package/dist/client/router.cjs +49 -0
- package/dist/client/router.d.cts +3 -0
- package/dist/client/router.d.ts +3 -0
- package/dist/client/router.js +8 -0
- package/dist/client/theme/reset.css +40 -4
- package/dist/{config-BpzaPsJj.d.cts → config-BoRlz0Ca.d.mts} +157 -14
- package/dist/{config-xtS0ZkMm.d.mts → config-CTsX_tGM.d.cts} +157 -14
- package/dist/config-Ceib-AOH.cjs +7 -0
- package/dist/config-DGLQsy7y.mjs +7 -0
- package/dist/{package-CH2ChQqw.cjs → config-files-BYHDOrKn.mjs} +1 -1
- package/dist/config-files-D9cdBMl2.cjs +6 -0
- package/dist/config-jJh8WYJI.cjs +6 -0
- package/dist/csp-C4LmN1ko.cjs +6 -0
- package/dist/csp-D6JEOqKh.mjs +6 -0
- package/dist/dev-Ch3hEe5Y.cjs +6 -0
- package/dist/dev-QPNxysrd.mjs +6 -0
- package/dist/{docs-layout-BdtZ9z6s.js → docs-layout-CbZ7LDRe.js} +504 -249
- package/dist/{docs-layout-CFWI15Id.cjs → docs-layout-vzfXed1Q.cjs} +516 -254
- package/dist/{doctor-BBtmNJE0.cjs → doctor-B1_YL0Wt.cjs} +1 -1
- package/dist/doctor-C7whl4ED.cjs +6 -0
- package/dist/doctor-DmQnml2k.mjs +6 -0
- package/dist/{generator-COepVWGi.cjs → generator-BlW45ST7.cjs} +5 -3
- package/dist/{generator-CcOBN5vI.mjs → generator-BwknNejd.mjs} +5 -3
- package/dist/{handler-XX7cLTqe.cjs → handler-CDEoKARD.cjs} +2 -2
- package/dist/{handler-DzQae4eA.mjs → handler-D7UyZlPm.mjs} +2 -2
- package/dist/{image-Bz87fCla.js → image-B-NDSDuY.js} +129 -11
- package/dist/{image-C4TlpMHn.cjs → image-Hnaa2bJd.cjs} +175 -9
- package/dist/index-C56bL-A-.d.cts +1344 -0
- package/dist/{sidebar-COTaMHR-.d.ts → index-CPUUKzxD.d.cts} +344 -327
- package/dist/{sidebar-CrEdJuHX.d.cts → index-Ci4kfOHF.d.ts} +344 -327
- package/dist/index-Cu9H6CRa.d.ts +1344 -0
- package/dist/link-CgdI6O2o.js +872 -0
- package/dist/{link-D1Gjkb-2.cjs → link-vZjmD-es.cjs} +406 -223
- package/dist/{mdx-BuO6a1f7.js → mdx-BRT71V5Q.js} +211 -168
- package/dist/{mdx-CD-tSjRG.cjs → mdx-D0Absdq5.cjs} +225 -169
- package/dist/native-BNCY7PRF.cjs +6 -0
- package/dist/native-Di9Fnfrv.mjs +6 -0
- package/dist/native-Kre2T5eS.cjs +6 -0
- package/dist/node/cache.cjs +1 -1
- package/dist/node/cache.d.cts +19 -3
- package/dist/node/cache.d.mts +19 -3
- package/dist/node/cache.mjs +1 -1
- package/dist/node/cli-entry.cjs +1 -9
- package/dist/node/cli-entry.mjs +1 -9
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +245 -17
- package/dist/node/index.d.mts +246 -18
- package/dist/node/index.mjs +1 -1
- package/dist/node/mdx/shiki-adapter.cjs +1 -1
- package/dist/node/mdx/shiki-adapter.d.cts +24 -3
- package/dist/node/mdx/shiki-adapter.d.mts +24 -2
- package/dist/node/mdx/shiki-adapter.mjs +1 -1
- package/dist/node-Du5UL5wo.mjs +23 -0
- package/dist/node-DunuGqyp.cjs +23 -0
- package/dist/{package-DSSB8B5L.mjs → package-DA848keM.mjs} +1 -1
- package/dist/package-wplzySjz.cjs +6 -0
- package/dist/pages-external-BBw8ObVK.mjs +6 -0
- package/dist/pages-external-DPiPFxxP.cjs +6 -0
- package/dist/parser-BqTOsEUa.cjs +6 -0
- package/dist/parser-CGMY2lJ7.mjs +6 -0
- package/dist/plugin-BcTzvHAJ.mjs +69 -0
- package/dist/plugin-TulVMt1z.cjs +69 -0
- package/dist/plugin-context-C-l90hFt.cjs +15 -0
- package/dist/plugin-context-wqHNSZum.mjs +15 -0
- package/dist/plugin-lifecycle-B1BzSHdn.cjs +6 -0
- package/dist/resolve-B7vWOd8R.cjs +6 -0
- package/dist/resolve-C2kKnk_5.mjs +6 -0
- package/dist/resolve-It1Iug83.cjs +6 -0
- package/dist/resolve-YdTrt_FG.mjs +6 -0
- package/dist/router-C3kygdRK.cjs +1285 -0
- package/dist/router-CZBxMRAH.js +987 -0
- package/dist/routes-BL4y79tb.mjs +6 -0
- package/dist/routes-C2nPecwu.cjs +6 -0
- package/dist/routes-U9L8psZ9.cjs +6 -0
- package/dist/{search-dialog-DHqwjJuG.cjs → search-dialog-BCOHQGSt.cjs} +1 -1
- package/dist/search-dialog-Bp_P1MPP.js +481 -0
- package/dist/{search-dialog-DFnlx8LO.js → search-dialog-BqkzDTq2.js} +107 -57
- package/dist/{search-dialog-BRFno7HD.cjs → search-dialog-CIeIUhAn.cjs} +218 -43
- package/dist/{search-dialog-D6TvjcuV.js → search-dialog-DtmxmfEu.js} +1 -1
- package/dist/{search-dialog-B1NERUNx.cjs → search-dialog-x_qHU8ty.cjs} +107 -58
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.d.mts +1 -1
- package/dist/server/index.mjs +1 -1
- package/dist/update-check-BKqmYfwT.cjs +11 -0
- package/dist/update-check-QnrVR3q1.mjs +11 -0
- package/dist/utils-8lzafE49.mjs +7 -0
- package/dist/utils-ej6_SjIZ.cjs +7 -0
- package/dist/virtual-modules-Ca5tHk1X.cjs +30 -0
- package/dist/virtual-modules-Dlgt1fP0.mjs +30 -0
- package/package.json +18 -16
- package/src/shared/mdx-path.ts +12 -0
- package/src/shared/structured-data.ts +145 -0
- package/src/shared/types.ts +220 -16
- package/dist/banner-BMop1KLF.d.ts +0 -100
- package/dist/banner-CVD0GugR.d.cts +0 -100
- package/dist/cache-CO4Dy2uQ.cjs +0 -6
- package/dist/cache-Dk53iOo6.mjs +0 -6
- package/dist/config-CCXp3aXO.mjs +0 -7
- package/dist/config-CMd4XoFq.cjs +0 -6
- package/dist/config-DlGoEM9D.cjs +0 -7
- package/dist/csp-CRp_3U7a.cjs +0 -6
- package/dist/csp-oTC2ygvF.mjs +0 -6
- package/dist/doctor-Bv16QSrI.cjs +0 -7
- package/dist/doctor-DOAbSaiL.mjs +0 -7
- package/dist/headers-Ddwek8K7.mjs +0 -6
- package/dist/headers-dg4SDrjY.cjs +0 -6
- package/dist/link-2PzgTnaP.js +0 -673
- package/dist/meta-loader-C4Hu9RN9.mjs +0 -6
- package/dist/meta-loader-Dq1zcFnh.cjs +0 -6
- package/dist/node-B5hu_6qj.cjs +0 -104
- package/dist/node-BXtqM1uH.mjs +0 -6
- package/dist/node-C8725aw7.mjs +0 -104
- package/dist/node-aD1eisrR.cjs +0 -6
- package/dist/pages-external-BYa4JSda.mjs +0 -6
- package/dist/pages-external-XkYIs-d5.cjs +0 -6
- package/dist/parser-DCiEWkSk.cjs +0 -8
- package/dist/parser-qk9FIHJ7.mjs +0 -8
- package/dist/plugin-CX1OZ6jB.cjs +0 -73
- package/dist/plugin-CgfiWaFZ.mjs +0 -73
- package/dist/routes-BW6zsk7Z.mjs +0 -6
- package/dist/routes-BgoIB5wb.cjs +0 -6
- package/dist/routes-CORVxc02.cjs +0 -6
- package/dist/search-dialog-BmxHiKwt.js +0 -312
- package/dist/shiki-adapter-CoQ6jyJ4.cjs +0 -6
- package/dist/shiki-adapter-D-aKw7PP.mjs +0 -6
- package/dist/utils-Crm9oPcV.mjs +0 -7
- package/dist/utils-D6Xtj0FZ.cjs +0 -7
- /package/dist/{errors-0zGHRLue.mjs → errors-N-b6Sn2G.mjs} +0 -0
- /package/dist/{index-1KsTDq4o.d.mts → index-lFoyzCXy.d.mts} +0 -0
- /package/dist/{types-generator-BXhv7Ill.cjs → types-generator-DDSA93P3.cjs} +0 -0
- /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
|
-
|
|
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
|
-
|
|
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
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
|
144
|
-
if (!
|
|
145
|
-
|
|
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/
|
|
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
|
|
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
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
const
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
const
|
|
546
|
-
const
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
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
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
}
|
|
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
|
|
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
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
const
|
|
609
|
-
const
|
|
610
|
-
const
|
|
611
|
-
|
|
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
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
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
|
-
|
|
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
|
|
654
|
-
const
|
|
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 =
|
|
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, '
|
|
1059
|
+
Object.defineProperty(exports, 'TransitionLink', {
|
|
901
1060
|
enumerable: true,
|
|
902
1061
|
get: function () {
|
|
903
|
-
return
|
|
1062
|
+
return TransitionLink;
|
|
904
1063
|
}
|
|
905
1064
|
});
|
|
906
|
-
Object.defineProperty(exports, '
|
|
1065
|
+
Object.defineProperty(exports, 'X', {
|
|
907
1066
|
enumerable: true,
|
|
908
1067
|
get: function () {
|
|
909
|
-
return
|
|
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, '
|
|
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
|
|
1134
|
+
return useViewTransition;
|
|
952
1135
|
}
|
|
953
1136
|
});
|