@vezham/docs-core 1.0.1
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/advanced-Ct13khZr.js +79 -0
- package/dist/algolia-C0E5qQhM.d.ts +66 -0
- package/dist/breadcrumb.d.ts +46 -0
- package/dist/breadcrumb.js +59 -0
- package/dist/build-doc-4OvfjVN2.js +85 -0
- package/dist/client-kQ39Ub0-.d.ts +247 -0
- package/dist/codeblock-utils-CyP8qsYv.d.ts +29 -0
- package/dist/content/github.d.ts +41 -0
- package/dist/content/github.js +28 -0
- package/dist/content/md/frontmatter.d.ts +15 -0
- package/dist/content/md/frontmatter.js +24 -0
- package/dist/content/md.d.ts +24 -0
- package/dist/content/md.js +43 -0
- package/dist/content/mdx/preset-bundler.d.ts +29 -0
- package/dist/content/mdx/preset-bundler.js +39 -0
- package/dist/content/mdx/preset-runtime.d.ts +26 -0
- package/dist/content/mdx/preset-runtime.js +36 -0
- package/dist/content/toc.d.ts +19 -0
- package/dist/content/toc.js +14 -0
- package/dist/definitions-CFOhwE1k.d.ts +72 -0
- package/dist/dynamic-CTsodhTH.js +905 -0
- package/dist/dynamic-link.d.ts +12 -0
- package/dist/dynamic-link.js +31 -0
- package/dist/endpoint-MyoBU5IC.js +28 -0
- package/dist/framework/astro.d.ts +21 -0
- package/dist/framework/astro.js +52 -0
- package/dist/framework/index.d.ts +40 -0
- package/dist/framework/index.js +66 -0
- package/dist/framework/next.d.ts +10 -0
- package/dist/framework/next.js +19 -0
- package/dist/framework/react-router.d.ts +10 -0
- package/dist/framework/react-router.js +43 -0
- package/dist/framework/tanstack.d.ts +13 -0
- package/dist/framework/tanstack.js +54 -0
- package/dist/framework/waku.d.ts +10 -0
- package/dist/framework/waku.js +46 -0
- package/dist/highlight/client.d.ts +11 -0
- package/dist/highlight/client.js +15 -0
- package/dist/highlight/index.d.ts +31 -0
- package/dist/highlight/index.js +30 -0
- package/dist/highlight/shiki/full.d.ts +7 -0
- package/dist/highlight/shiki/full.js +23 -0
- package/dist/highlight/shiki/index.d.ts +2 -0
- package/dist/highlight/shiki/index.js +27 -0
- package/dist/highlight/shiki/react.d.ts +23 -0
- package/dist/highlight/shiki/react.js +50 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.js +63 -0
- package/dist/i18n/middleware.d.ts +34 -0
- package/dist/i18n/middleware.js +3855 -0
- package/dist/icon-BILaoXeg.js +17 -0
- package/dist/index-B-0R0VbS.d.ts +18 -0
- package/dist/index-BM36H-xw.d.ts +36 -0
- package/dist/index-BMEUQz-F.d.ts +21 -0
- package/dist/index-DAYtLGbx.d.ts +16 -0
- package/dist/index-DIwKCYOz.d.ts +513 -0
- package/dist/index-DydiXvgS.d.ts +90 -0
- package/dist/index-E8Qh_yQs.d.ts +49 -0
- package/dist/is-equal-LdLqRs0o.js +8 -0
- package/dist/link.d.ts +17 -0
- package/dist/link.js +23 -0
- package/dist/mdx-plugins/codeblock-utils.d.ts +2 -0
- package/dist/mdx-plugins/codeblock-utils.js +68 -0
- package/dist/mdx-plugins/index.d.ts +20 -0
- package/dist/mdx-plugins/index.js +18 -0
- package/dist/mdx-plugins/rehype-code.core.d.ts +3 -0
- package/dist/mdx-plugins/rehype-code.core.js +3 -0
- package/dist/mdx-plugins/rehype-code.d.ts +4 -0
- package/dist/mdx-plugins/rehype-code.js +24 -0
- package/dist/mdx-plugins/rehype-toc.d.ts +2 -0
- package/dist/mdx-plugins/rehype-toc.js +139 -0
- package/dist/mdx-plugins/remark-admonition.d.ts +2 -0
- package/dist/mdx-plugins/remark-admonition.js +71 -0
- package/dist/mdx-plugins/remark-block-id.d.ts +37 -0
- package/dist/mdx-plugins/remark-block-id.js +41 -0
- package/dist/mdx-plugins/remark-code-tab.d.ts +2 -0
- package/dist/mdx-plugins/remark-code-tab.js +190 -0
- package/dist/mdx-plugins/remark-directive-admonition.d.ts +2 -0
- package/dist/mdx-plugins/remark-directive-admonition.js +57 -0
- package/dist/mdx-plugins/remark-feedback-block.d.ts +2 -0
- package/dist/mdx-plugins/remark-feedback-block.js +54 -0
- package/dist/mdx-plugins/remark-gfm.d.ts +2 -0
- package/dist/mdx-plugins/remark-gfm.js +2 -0
- package/dist/mdx-plugins/remark-heading.d.ts +2 -0
- package/dist/mdx-plugins/remark-heading.js +46 -0
- package/dist/mdx-plugins/remark-image.d.ts +2 -0
- package/dist/mdx-plugins/remark-image.js +167 -0
- package/dist/mdx-plugins/remark-llms.d.ts +2 -0
- package/dist/mdx-plugins/remark-llms.js +338 -0
- package/dist/mdx-plugins/remark-llms.runtime.d.ts +10 -0
- package/dist/mdx-plugins/remark-llms.runtime.js +24 -0
- package/dist/mdx-plugins/remark-mdx-files.d.ts +2 -0
- package/dist/mdx-plugins/remark-mdx-files.js +182 -0
- package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +2 -0
- package/dist/mdx-plugins/remark-mdx-mermaid.js +28 -0
- package/dist/mdx-plugins/remark-npm.d.ts +2 -0
- package/dist/mdx-plugins/remark-npm.js +76 -0
- package/dist/mdx-plugins/remark-steps.d.ts +2 -0
- package/dist/mdx-plugins/remark-steps.js +93 -0
- package/dist/mdx-plugins/remark-structure.d.ts +2 -0
- package/dist/mdx-plugins/remark-structure.js +118 -0
- package/dist/mdx-plugins/stringifier.d.ts +2 -0
- package/dist/mdx-plugins/stringifier.js +91 -0
- package/dist/mdx-plugins/transformer-icon.d.ts +2 -0
- package/dist/mdx-plugins/transformer-icon.js +145 -0
- package/dist/negotiation/index.d.ts +17 -0
- package/dist/negotiation/index.js +378 -0
- package/dist/page-tree/index.d.ts +3 -0
- package/dist/page-tree/index.js +2 -0
- package/dist/path-1H5VzYiT.js +75 -0
- package/dist/rehype-code-D-RFJb9W.d.ts +14 -0
- package/dist/rehype-code.core-BUwNuchP.js +548 -0
- package/dist/rehype-code.core-BjH1uHWj.d.ts +115 -0
- package/dist/rehype-toc-K51AGb5U.d.ts +43 -0
- package/dist/remark-admonition-BwTcmI_S.d.ts +20 -0
- package/dist/remark-code-tab-DE_4bdnu.d.ts +34 -0
- package/dist/remark-directive-admonition-BLiJ5l43.d.ts +27 -0
- package/dist/remark-feedback-block-BxtINXN-.d.ts +45 -0
- package/dist/remark-gfm-DpVfAX1x.d.ts +2 -0
- package/dist/remark-heading-DEIzTkU5.d.ts +33 -0
- package/dist/remark-image-BI2S9LOb.d.ts +57 -0
- package/dist/remark-llms-bD3WvU2V.d.ts +73 -0
- package/dist/remark-mdx-files-Buvxc-sa.d.ts +54 -0
- package/dist/remark-mdx-mermaid-C1bCHHc6.d.ts +15 -0
- package/dist/remark-npm-BbpvkJaT.d.ts +31 -0
- package/dist/remark-steps-DqVEo0iq.d.ts +23 -0
- package/dist/remark-structure-CnHwvNZr.d.ts +87 -0
- package/dist/remove-markdown-DfKNMl9w.js +40 -0
- package/dist/remove-undefined-CzMSKybq.js +24 -0
- package/dist/rolldown-runtime-DC62tzP2.js +33 -0
- package/dist/search/algolia.d.ts +2 -0
- package/dist/search/algolia.js +75 -0
- package/dist/search/client/algolia.d.ts +2 -0
- package/dist/search/client/algolia.js +53 -0
- package/dist/search/client/fetch.d.ts +2 -0
- package/dist/search/client/fetch.js +28 -0
- package/dist/search/client/flexsearch-static.d.ts +2 -0
- package/dist/search/client/flexsearch-static.js +42 -0
- package/dist/search/client/mixedbread.d.ts +2 -0
- package/dist/search/client/mixedbread.js +65 -0
- package/dist/search/client/orama-cloud-legacy.d.ts +2 -0
- package/dist/search/client/orama-cloud-legacy.js +84 -0
- package/dist/search/client/orama-cloud.d.ts +2 -0
- package/dist/search/client/orama-cloud.js +86 -0
- package/dist/search/client/orama-static.d.ts +2 -0
- package/dist/search/client/orama-static.js +75 -0
- package/dist/search/client.d.ts +2 -0
- package/dist/search/client.js +97 -0
- package/dist/search/flexsearch.d.ts +56 -0
- package/dist/search/flexsearch.js +128 -0
- package/dist/search/index.d.ts +2 -0
- package/dist/search/index.js +74 -0
- package/dist/search/mixedbread.d.ts +49 -0
- package/dist/search/mixedbread.js +77 -0
- package/dist/search/orama-cloud-legacy.d.ts +75 -0
- package/dist/search/orama-cloud-legacy.js +48 -0
- package/dist/search/orama-cloud.d.ts +75 -0
- package/dist/search/orama-cloud.js +50 -0
- package/dist/search/server.d.ts +2 -0
- package/dist/search/server.js +237 -0
- package/dist/server-CCqACwlF.d.ts +165 -0
- package/dist/server.browser.d.ts +13 -0
- package/dist/server.browser.js +22 -0
- package/dist/server.d.ts +42 -0
- package/dist/server.js +398 -0
- package/dist/source/client/index.d.ts +2 -0
- package/dist/source/client/index.js +37 -0
- package/dist/source/dynamic.d.ts +2 -0
- package/dist/source/dynamic.js +2 -0
- package/dist/source/index.d.ts +2 -0
- package/dist/source/index.js +5 -0
- package/dist/source/llms.d.ts +2 -0
- package/dist/source/llms.js +74 -0
- package/dist/source/plugins/lucide-icons.d.ts +11 -0
- package/dist/source/plugins/lucide-icons.js +21 -0
- package/dist/source/plugins/slugs.d.ts +2 -0
- package/dist/source/plugins/slugs.js +75 -0
- package/dist/source/plugins/status-badges.d.ts +50 -0
- package/dist/source/plugins/status-badges.js +52 -0
- package/dist/source/schema.d.ts +30 -0
- package/dist/source/schema.js +28 -0
- package/dist/stringifier-B_QUcUyo.d.ts +63 -0
- package/dist/toc-CtW5lwA1.d.ts +64 -0
- package/dist/toc.d.ts +2 -0
- package/dist/toc.js +245 -0
- package/dist/transformer-icon-DlrneIS3.d.ts +17 -0
- package/dist/types-D89QoQR-.d.ts +4 -0
- package/dist/url-BVHvi3_K.js +29 -0
- package/dist/util-BDsqOxh3.d.ts +6 -0
- package/dist/util-DjBr9b3w.js +8 -0
- package/dist/utils/use-media-query.d.ts +4 -0
- package/dist/utils/use-media-query.js +20 -0
- package/dist/utils/use-on-change.d.ts +9 -0
- package/dist/utils/use-on-change.js +17 -0
- package/dist/utils-Bvy3V-fv.js +59 -0
- package/dist/utils-Cgs-6U-z.js +39 -0
- package/dist/utils-DEVq3cEC.js +151 -0
- package/dist/utils-Yx0IL9eW.js +48 -0
- package/package.json +251 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { highlightHast } from "./index.js";
|
|
3
|
+
import { use, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import * as JsxRuntime from "react/jsx-runtime";
|
|
5
|
+
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
6
|
+
//#region src/highlight/shiki/react.ts
|
|
7
|
+
const promises = {};
|
|
8
|
+
/**
|
|
9
|
+
* get highlighted results (uncached), use `useEffect` instead of React 19 APIs.
|
|
10
|
+
*/
|
|
11
|
+
function useShikiDynamic(highlighter, code, options, deps) {
|
|
12
|
+
const [node, setNode] = useState(options.defaultValue);
|
|
13
|
+
const lastTask = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
async function task() {
|
|
16
|
+
const instance = typeof highlighter === "function" ? await highlighter() : highlighter;
|
|
17
|
+
return toJsxRuntime(await highlightHast(instance, code, options), {
|
|
18
|
+
...JsxRuntime,
|
|
19
|
+
components: options.components
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const promise = task();
|
|
23
|
+
lastTask.current = promise;
|
|
24
|
+
promise.then((res) => {
|
|
25
|
+
if (lastTask.current === promise) setNode(res);
|
|
26
|
+
});
|
|
27
|
+
return () => {
|
|
28
|
+
lastTask.current = null;
|
|
29
|
+
};
|
|
30
|
+
}, deps);
|
|
31
|
+
return node;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* get highlighted results, should be used with React Suspense API.
|
|
35
|
+
*
|
|
36
|
+
* note: results are cached with (lang, code) as keys, if this is not the desired behaviour, pass a `deps` instead.
|
|
37
|
+
*/
|
|
38
|
+
function useShiki(highlighter, code, options, deps = [options.lang, code]) {
|
|
39
|
+
const key = useMemo(() => JSON.stringify(deps), [deps]);
|
|
40
|
+
async function run() {
|
|
41
|
+
const instance = typeof highlighter === "function" ? await highlighter() : highlighter;
|
|
42
|
+
return toJsxRuntime(await highlightHast(instance, code, options), {
|
|
43
|
+
...JsxRuntime,
|
|
44
|
+
components: options.components
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return use(promises[key] ??= run());
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { useShiki, useShikiDynamic };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as TranslationPreset, c as defineTranslations, i as TranslationExtension, n as I18nConfig, o as TranslationsAPI, r as SingularTranslationsAPI, s as defineI18n, t as I18nAPI } from "../index-DydiXvgS.js";
|
|
2
|
+
export { I18nAPI, I18nConfig, SingularTranslationsAPI, TranslationExtension, TranslationPreset, TranslationsAPI, defineI18n, defineTranslations };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//#region src/i18n/index.ts
|
|
2
|
+
function pickTranslations(full, keys) {
|
|
3
|
+
const result = {};
|
|
4
|
+
for (const k in full) if (keys.has(k)) result[k] = full[k];
|
|
5
|
+
return result;
|
|
6
|
+
}
|
|
7
|
+
function defineI18n(config) {
|
|
8
|
+
return {
|
|
9
|
+
...config,
|
|
10
|
+
translations() {
|
|
11
|
+
const translations = {};
|
|
12
|
+
const registeredKeys = /* @__PURE__ */ new Set();
|
|
13
|
+
for (const lang of config.languages) translations[lang] = {};
|
|
14
|
+
return {
|
|
15
|
+
config,
|
|
16
|
+
$inferLanguages: void 0,
|
|
17
|
+
$inferKeys: void 0,
|
|
18
|
+
get(lang) {
|
|
19
|
+
if (!translations[lang]) return void 0;
|
|
20
|
+
return pickTranslations(translations[lang], registeredKeys);
|
|
21
|
+
},
|
|
22
|
+
extend(extension) {
|
|
23
|
+
for (const key of extension.keys) registeredKeys.add(key);
|
|
24
|
+
return this;
|
|
25
|
+
},
|
|
26
|
+
add(...args) {
|
|
27
|
+
const overrides = args.length === 2 ? args[1] : args[0];
|
|
28
|
+
for (const [lang, values] of Object.entries(overrides)) Object.assign(translations[lang] ??= {}, values);
|
|
29
|
+
return this;
|
|
30
|
+
},
|
|
31
|
+
preset(lang, preset) {
|
|
32
|
+
Object.assign(translations[lang], preset.value);
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/** create translations API without i18n */
|
|
40
|
+
function defineTranslations() {
|
|
41
|
+
const translations = {};
|
|
42
|
+
const registeredKeys = /* @__PURE__ */ new Set();
|
|
43
|
+
return {
|
|
44
|
+
$inferKeys: void 0,
|
|
45
|
+
get() {
|
|
46
|
+
return pickTranslations(translations, registeredKeys);
|
|
47
|
+
},
|
|
48
|
+
extend(extension) {
|
|
49
|
+
for (const key of extension.keys) registeredKeys.add(key);
|
|
50
|
+
return this;
|
|
51
|
+
},
|
|
52
|
+
add(...args) {
|
|
53
|
+
Object.assign(translations, args.length === 2 ? args[1] : args[0]);
|
|
54
|
+
return this;
|
|
55
|
+
},
|
|
56
|
+
preset(preset) {
|
|
57
|
+
Object.assign(translations, preset.value);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { defineI18n, defineTranslations };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { n as I18nConfig } from "../index-DydiXvgS.js";
|
|
2
|
+
import { NextProxy } from "next/server.js";
|
|
3
|
+
import { NextURL } from "next/dist/server/web/next-url.js";
|
|
4
|
+
//#region src/i18n/middleware.d.ts
|
|
5
|
+
interface MiddlewareOptions extends I18nConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Either:
|
|
8
|
+
* - A formatter object
|
|
9
|
+
* - A function that adds the locale prefix to pathname
|
|
10
|
+
*/
|
|
11
|
+
format?: URLFormatter | ((locale: string, pathname: string) => string);
|
|
12
|
+
/**
|
|
13
|
+
* the cookie to store locale code when `hideLocale` is set to `always`.
|
|
14
|
+
*/
|
|
15
|
+
cookieName?: string;
|
|
16
|
+
}
|
|
17
|
+
interface URLFormatter {
|
|
18
|
+
/**
|
|
19
|
+
* get locale code from request URL
|
|
20
|
+
*/
|
|
21
|
+
get: (url: NextURL) => string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* add locale code to request URL (which is missing the locale).
|
|
24
|
+
*/
|
|
25
|
+
add: (url: NextURL, locale: string) => URL;
|
|
26
|
+
/**
|
|
27
|
+
* remove locale code from request URL
|
|
28
|
+
*/
|
|
29
|
+
remove: (url: NextURL) => URL;
|
|
30
|
+
}
|
|
31
|
+
declare const DefaultFormatter: URLFormatter;
|
|
32
|
+
declare function createI18nMiddleware({ languages, defaultLanguage, format, cookieName, hideLocale }: MiddlewareOptions): NextProxy;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { DefaultFormatter, URLFormatter, createI18nMiddleware };
|