@mintlify/msft-sdk 1.1.1 → 1.1.4
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/dist/components/content-components/callouts.js +35 -20
- package/dist/components/content-components/callouts.js.map +1 -1
- package/dist/components/content-components/code-block.js +87 -60
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/default-components.js +52 -33
- package/dist/components/content-components/default-components.js.map +1 -1
- package/dist/components/content-components/details/details.js +28 -25
- package/dist/components/content-components/details/details.js.map +1 -1
- package/dist/components/content-components/heading.js +6 -1
- package/dist/components/content-components/heading.js.map +1 -1
- package/dist/components/content-components/home.js +256 -163
- package/dist/components/content-components/home.js.map +1 -1
- package/dist/components/content-components/link.js +7 -7
- package/dist/components/content-components/link.js.map +1 -1
- package/dist/components/content-components/param-name.js +4 -5
- package/dist/components/content-components/param-name.js.map +1 -1
- package/dist/components/content-components/table/index.js +101 -67
- package/dist/components/content-components/table/index.js.map +1 -1
- package/dist/components/content-components/table/table-modal.js +31 -32
- package/dist/components/content-components/table/table-modal.js.map +1 -1
- package/dist/components/content-components/tabs/tabs.js +51 -46
- package/dist/components/content-components/tabs/tabs.js.map +1 -1
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.js +39 -36
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.js.map +1 -1
- package/dist/components/mdx-renderer.js +16 -8
- package/dist/components/mdx-renderer.js.map +1 -1
- package/dist/components/nav-tree/dropdown-menu.js +40 -33
- package/dist/components/nav-tree/dropdown-menu.js.map +1 -1
- package/dist/components/nav-tree/index.js +121 -92
- package/dist/components/nav-tree/index.js.map +1 -1
- package/dist/components/nav-tree/mobile-nav.js +60 -41
- package/dist/components/nav-tree/mobile-nav.js.map +1 -1
- package/dist/components/page-context-menu.js +107 -90
- package/dist/components/page-context-menu.js.map +1 -1
- package/dist/components/page.js +108 -86
- package/dist/components/page.js.map +1 -1
- package/dist/components/plain-text-page.js +3 -4
- package/dist/components/plain-text-page.js.map +1 -1
- package/dist/components/toc/index.js +45 -42
- package/dist/components/toc/index.js.map +1 -1
- package/dist/context/components-context.js +17 -0
- package/dist/context/components-context.js.map +1 -0
- package/dist/index.d.ts +34 -5
- package/dist/index.js +109 -103
- package/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/tailwind-merge@3.3.1/node_modules/tailwind-merge/dist/bundle-mjs.js +2732 -0
- package/dist/node_modules/.pnpm/tailwind-merge@3.3.1/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/utils/cn.js +9 -0
- package/dist/utils/cn.js.map +1 -0
- package/package.json +5 -1
- package/dist/components/content-components/callouts.module.css.js +0 -26
- package/dist/components/content-components/callouts.module.css.js.map +0 -1
- package/dist/components/content-components/code-block.module.css.js +0 -32
- package/dist/components/content-components/code-block.module.css.js.map +0 -1
- package/dist/components/content-components/default-components.module.css.js +0 -12
- package/dist/components/content-components/default-components.module.css.js.map +0 -1
- package/dist/components/content-components/details/details.module.css.js +0 -20
- package/dist/components/content-components/details/details.module.css.js.map +0 -1
- package/dist/components/content-components/home.module.css.js +0 -74
- package/dist/components/content-components/home.module.css.js.map +0 -1
- package/dist/components/content-components/link.module.css.js +0 -10
- package/dist/components/content-components/link.module.css.js.map +0 -1
- package/dist/components/content-components/param-name.module.css.js +0 -8
- package/dist/components/content-components/param-name.module.css.js.map +0 -1
- package/dist/components/content-components/table/table-modal.module.css.js +0 -18
- package/dist/components/content-components/table/table-modal.module.css.js.map +0 -1
- package/dist/components/content-components/table/table.module.css.js +0 -30
- package/dist/components/content-components/table/table.module.css.js.map +0 -1
- package/dist/components/content-components/tabs/tabs.module.css.js +0 -24
- package/dist/components/content-components/tabs/tabs.module.css.js.map +0 -1
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.module.css.js +0 -14
- package/dist/components/content-components/zone-pivots/zone-pivot-selector.module.css.js.map +0 -1
- package/dist/components/mdx-renderer.module.css.js +0 -8
- package/dist/components/mdx-renderer.module.css.js.map +0 -1
- package/dist/components/nav-tree/dropdown-menu.module.css.js +0 -52
- package/dist/components/nav-tree/dropdown-menu.module.css.js.map +0 -1
- package/dist/components/nav-tree/mobile-nav.module.css.js +0 -22
- package/dist/components/nav-tree/mobile-nav.module.css.js.map +0 -1
- package/dist/components/nav-tree/nav-tree.module.css.js +0 -50
- package/dist/components/nav-tree/nav-tree.module.css.js.map +0 -1
- package/dist/components/page-context-menu.module.css.js +0 -42
- package/dist/components/page-context-menu.module.css.js.map +0 -1
- package/dist/components/page.module.css.js +0 -52
- package/dist/components/page.module.css.js.map +0 -1
- package/dist/components/plain-text-page.module.css.js +0 -10
- package/dist/components/plain-text-page.module.css.js.map +0 -1
- package/dist/components/prose.module.css.js +0 -8
- package/dist/components/prose.module.css.js.map +0 -1
- package/dist/components/toc/toc.module.css.js +0 -18
- package/dist/components/toc/toc.module.css.js.map +0 -1
|
@@ -1,65 +1,68 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
function
|
|
5
|
-
const [
|
|
6
|
-
return
|
|
7
|
-
var
|
|
8
|
-
if (
|
|
1
|
+
import { jsx as d, jsxs as S } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useRef as w, useEffect as B } from "react";
|
|
3
|
+
import { cn as A } from "../../utils/cn.js";
|
|
4
|
+
function j({ toc: i }) {
|
|
5
|
+
const [x, c] = y(""), o = w(!1), t = w();
|
|
6
|
+
return B(() => {
|
|
7
|
+
var g;
|
|
8
|
+
if (i.length === 0) return;
|
|
9
9
|
o.current = !1, t.current && clearTimeout(t.current);
|
|
10
10
|
const n = window.location.hash.slice(1);
|
|
11
|
-
n ? (
|
|
11
|
+
n ? (c(n), o.current = !0, t.current = setTimeout(() => {
|
|
12
12
|
o.current = !1;
|
|
13
|
-
}, 1e3)) :
|
|
14
|
-
const
|
|
13
|
+
}, 1e3)) : c(((g = i[0]) == null ? void 0 : g.slug) || "");
|
|
14
|
+
const m = () => {
|
|
15
15
|
const r = window.location.hash.slice(1);
|
|
16
|
-
r && (
|
|
16
|
+
r && (c(r), o.current = !0, t.current && clearTimeout(t.current), t.current = setTimeout(() => {
|
|
17
17
|
o.current = !1;
|
|
18
18
|
}, 1e3));
|
|
19
|
-
}, e = document.getElementById("main-content"),
|
|
20
|
-
var p,
|
|
21
|
-
if (!e) return (p =
|
|
22
|
-
const r = window.getComputedStyle(document.documentElement),
|
|
19
|
+
}, e = document.getElementById("main-content"), T = () => {
|
|
20
|
+
var p, b;
|
|
21
|
+
if (!e) return (p = i[0]) == null ? void 0 : p.slug;
|
|
22
|
+
const r = window.getComputedStyle(document.documentElement), E = parseFloat(
|
|
23
23
|
r.getPropertyValue("--scroll-mt") || "0"
|
|
24
|
-
),
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
27
|
-
const
|
|
28
|
-
return { id:
|
|
24
|
+
), R = parseFloat(r.fontSize), k = E * R + 100, h = e.scrollTop, f = i.map((s) => {
|
|
25
|
+
const v = document.getElementById(s.slug);
|
|
26
|
+
if (!v) return null;
|
|
27
|
+
const C = v.getBoundingClientRect(), I = e.getBoundingClientRect(), L = C.top - I.top + h;
|
|
28
|
+
return { id: s.slug, top: L };
|
|
29
29
|
}).filter(Boolean);
|
|
30
|
-
if (
|
|
31
|
-
let
|
|
32
|
-
for (const
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
},
|
|
30
|
+
if (f.length === 0) return (b = i[0]) == null ? void 0 : b.slug;
|
|
31
|
+
let a = f[0];
|
|
32
|
+
for (const s of f)
|
|
33
|
+
h + k >= s.top && (a = s);
|
|
34
|
+
return a == null ? void 0 : a.id;
|
|
35
|
+
}, l = () => {
|
|
36
36
|
if (o.current) return;
|
|
37
|
-
const r =
|
|
38
|
-
r &&
|
|
37
|
+
const r = T();
|
|
38
|
+
r && c(r);
|
|
39
39
|
};
|
|
40
|
-
window.addEventListener("hashchange",
|
|
40
|
+
window.addEventListener("hashchange", m), e ? e.addEventListener("scroll", l, {
|
|
41
41
|
passive: !0
|
|
42
|
-
}) : window.addEventListener("scroll",
|
|
43
|
-
let
|
|
44
|
-
return n || (
|
|
45
|
-
|
|
42
|
+
}) : window.addEventListener("scroll", l, { passive: !0 });
|
|
43
|
+
let u;
|
|
44
|
+
return n || (u = setTimeout(l, 100)), () => {
|
|
45
|
+
u && clearTimeout(u), t.current && clearTimeout(t.current), window.removeEventListener("hashchange", m), e ? e.removeEventListener("scroll", l) : window.removeEventListener("scroll", l);
|
|
46
46
|
};
|
|
47
|
-
}, [
|
|
48
|
-
const e =
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
e && /* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
47
|
+
}, [i]), /* @__PURE__ */ d("ul", { className: "mint:flex mint:flex-col mint:gap-1 mint:text-sm mint:text-[#6b7280] mint:dark:text-[#9ca3af] mint:font-medium mint:relative mint:pl-[0.15rem] mint:before:content-[''] mint:before:absolute mint:before:left-[0.15rem] mint:before:top-0 mint:before:bottom-0 mint:before:w-[3px] mint:before:bg-[#f2f3f3] mint:dark:before:bg-[#222223] mint:before:rounded-full", children: i.map((n, m) => {
|
|
48
|
+
const e = x === n.slug;
|
|
49
|
+
return /* @__PURE__ */ S("li", { className: "mint:relative", children: [
|
|
50
|
+
e && /* @__PURE__ */ d("div", { className: "mint:absolute mint:left-0 mint:top-0 mint:bottom-0 mint:w-[3px] mint:rounded-full mint:bg-[#643fb2] mint:dark:bg-[#c9aaf9] mint:z-[1]" }),
|
|
51
|
+
/* @__PURE__ */ d(
|
|
52
52
|
"a",
|
|
53
53
|
{
|
|
54
54
|
href: `#${n.slug}`,
|
|
55
|
-
className:
|
|
55
|
+
className: A(
|
|
56
|
+
"mint:block mint:pl-6 mint:leading-[1.625] mint:transition-colors mint:duration-150 mint:no-underline",
|
|
57
|
+
e ? "mint:text-[#643fb2] mint:dark:text-[#c9aaf9]" : "mint:hover:text-[#111827] mint:dark:hover:text-[#d1d5db]"
|
|
58
|
+
),
|
|
56
59
|
children: n.title
|
|
57
60
|
}
|
|
58
61
|
)
|
|
59
|
-
] }, `${n.slug}-${
|
|
62
|
+
] }, `${n.slug}-${m}`);
|
|
60
63
|
}) });
|
|
61
64
|
}
|
|
62
65
|
export {
|
|
63
|
-
|
|
66
|
+
j as TableOfContents
|
|
64
67
|
};
|
|
65
68
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/toc/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { TocItem } from \"../../types\";\nimport
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/toc/index.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { TocItem } from \"../../types\";\nimport { cn } from \"../../utils/cn\";\n\ninterface TableOfContentsProps {\n toc: TocItem[];\n}\n\nexport function TableOfContents({ toc }: TableOfContentsProps) {\n const [activeId, setActiveId] = useState(\"\");\n const ignoreScrollRef = useRef(false);\n const ignoreTimeoutRef = useRef<NodeJS.Timeout>();\n\n useEffect(() => {\n if (toc.length === 0) return;\n\n ignoreScrollRef.current = false;\n if (ignoreTimeoutRef.current) {\n clearTimeout(ignoreTimeoutRef.current);\n }\n\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n ignoreScrollRef.current = true;\n ignoreTimeoutRef.current = setTimeout(() => {\n ignoreScrollRef.current = false;\n }, 1000);\n } else {\n setActiveId(toc[0]?.slug || \"\");\n }\n\n const handleHashChange = () => {\n const hash = window.location.hash.slice(1);\n if (hash) {\n setActiveId(hash);\n ignoreScrollRef.current = true;\n if (ignoreTimeoutRef.current) {\n clearTimeout(ignoreTimeoutRef.current);\n }\n ignoreTimeoutRef.current = setTimeout(() => {\n ignoreScrollRef.current = false;\n }, 1000);\n }\n };\n\n const scrollContainer = document.getElementById(\"main-content\");\n\n const getActiveHeading = () => {\n if (!scrollContainer) return toc[0]?.slug;\n\n const style = window.getComputedStyle(document.documentElement);\n const scrollMtRem = parseFloat(\n style.getPropertyValue(\"--scroll-mt\") || \"0\"\n );\n const fontSize = parseFloat(style.fontSize);\n const scrollOffset = scrollMtRem * fontSize + 100;\n\n const scrollY = scrollContainer.scrollTop;\n\n const headingPositions = toc\n .map((item) => {\n const element = document.getElementById(item.slug);\n if (!element) return null;\n\n const rect = element.getBoundingClientRect();\n const containerRect = scrollContainer.getBoundingClientRect();\n const relativeTop = rect.top - containerRect.top + scrollY;\n\n return { id: item.slug, top: relativeTop };\n })\n .filter(Boolean) as Array<{ id: string; top: number }>;\n\n if (headingPositions.length === 0) return toc[0]?.slug;\n\n let currentHeading = headingPositions[0];\n for (const heading of headingPositions) {\n if (scrollY + scrollOffset >= heading.top) {\n currentHeading = heading;\n }\n }\n\n return currentHeading?.id;\n };\n\n const handleScroll = () => {\n if (ignoreScrollRef.current) return;\n\n const newActiveId = getActiveHeading();\n if (newActiveId) {\n setActiveId(newActiveId);\n }\n };\n\n window.addEventListener(\"hashchange\", handleHashChange);\n\n if (scrollContainer) {\n scrollContainer.addEventListener(\"scroll\", handleScroll, {\n passive: true,\n });\n } else {\n window.addEventListener(\"scroll\", handleScroll, { passive: true });\n }\n\n let timeoutId: NodeJS.Timeout | undefined;\n if (!hash) {\n timeoutId = setTimeout(handleScroll, 100);\n }\n\n return () => {\n if (timeoutId) clearTimeout(timeoutId);\n if (ignoreTimeoutRef.current) clearTimeout(ignoreTimeoutRef.current);\n window.removeEventListener(\"hashchange\", handleHashChange);\n if (scrollContainer) {\n scrollContainer.removeEventListener(\"scroll\", handleScroll);\n } else {\n window.removeEventListener(\"scroll\", handleScroll);\n }\n };\n }, [toc]);\n\n return (\n <ul className=\"mint:flex mint:flex-col mint:gap-1 mint:text-sm mint:text-[#6b7280] mint:dark:text-[#9ca3af] mint:font-medium mint:relative mint:pl-[0.15rem] mint:before:content-[''] mint:before:absolute mint:before:left-[0.15rem] mint:before:top-0 mint:before:bottom-0 mint:before:w-[3px] mint:before:bg-[#f2f3f3] mint:dark:before:bg-[#222223] mint:before:rounded-full\">\n {toc.map((item, index) => {\n const isActive = activeId === item.slug;\n return (\n <li key={`${item.slug}-${index}`} className=\"mint:relative\">\n {isActive && (\n <div className=\"mint:absolute mint:left-0 mint:top-0 mint:bottom-0 mint:w-[3px] mint:rounded-full mint:bg-[#643fb2] mint:dark:bg-[#c9aaf9] mint:z-[1]\" />\n )}\n <a\n href={`#${item.slug}`}\n className={cn(\n \"mint:block mint:pl-6 mint:leading-[1.625] mint:transition-colors mint:duration-150 mint:no-underline\",\n isActive\n ? \"mint:text-[#643fb2] mint:dark:text-[#c9aaf9]\"\n : \"mint:hover:text-[#111827] mint:dark:hover:text-[#d1d5db]\"\n )}\n >\n {item.title}\n </a>\n </li>\n );\n })}\n </ul>\n );\n}\n"],"names":["TableOfContents","toc","activeId","setActiveId","useState","ignoreScrollRef","useRef","ignoreTimeoutRef","useEffect","hash","_a","handleHashChange","scrollContainer","getActiveHeading","style","scrollMtRem","fontSize","scrollOffset","scrollY","headingPositions","item","element","rect","containerRect","relativeTop","_b","currentHeading","heading","handleScroll","newActiveId","timeoutId","jsx","index","isActive","jsxs","cn"],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as r, useContext as m } from "react";
|
|
3
|
+
const o = r({});
|
|
4
|
+
function i({
|
|
5
|
+
children: t,
|
|
6
|
+
LinkComponent: e
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ n(o.Provider, { value: { LinkComponent: e }, children: t });
|
|
9
|
+
}
|
|
10
|
+
function p() {
|
|
11
|
+
return m(o);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
i as ComponentsProvider,
|
|
15
|
+
p as useComponents
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=components-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components-context.js","sources":["../../src/context/components-context.tsx"],"sourcesContent":["import { createContext, useContext } from \"react\";\nimport type { LinkComponent } from \"../types\";\n\nexport interface ComponentsContextValue {\n LinkComponent?: LinkComponent;\n}\n\nconst ComponentsContext = createContext<ComponentsContextValue>({});\n\nexport function ComponentsProvider({\n children,\n LinkComponent,\n}: {\n children: React.ReactNode;\n LinkComponent?: LinkComponent;\n}) {\n return (\n <ComponentsContext.Provider value={{ LinkComponent }}>\n {children}\n </ComponentsContext.Provider>\n );\n}\n\nexport function useComponents() {\n return useContext(ComponentsContext);\n}\n"],"names":["ComponentsContext","createContext","ComponentsProvider","children","LinkComponent","jsx","useComponents","useContext"],"mappings":";;AAOA,MAAMA,IAAoBC,EAAsC,EAAE;AAE3D,SAASC,EAAmB;AAAA,EACjC,UAAAC;AAAA,EACA,eAAAC;AACF,GAGG;AACD,SACE,gBAAAC,EAACL,EAAkB,UAAlB,EAA2B,OAAO,EAAE,eAAAI,EAAA,GAClC,UAAAD,GACH;AAEJ;AAEO,SAASG,IAAgB;AAC9B,SAAOC,EAAWP,CAAiB;AACrC;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
1
2
|
import { default as default_2 } from 'react';
|
|
2
3
|
import { Element as Element_2 } from 'hast';
|
|
3
4
|
import { Handle } from 'hast-util-to-mdast';
|
|
@@ -14,7 +15,7 @@ import { Text as Text_2 } from 'hast';
|
|
|
14
15
|
|
|
15
16
|
export declare const allComponents: {
|
|
16
17
|
CodeBlock: typeof CodeBlock;
|
|
17
|
-
Heading: ({ id, level, children, className }: HeadingProps) => JSX_2.Element;
|
|
18
|
+
Heading: ({ id, level, children, className, }: HeadingProps) => JSX_2.Element;
|
|
18
19
|
Link: typeof Link;
|
|
19
20
|
Callout: typeof Callout;
|
|
20
21
|
ZonePivot: typeof ZonePivot;
|
|
@@ -45,6 +46,8 @@ declare type CalloutType = "note" | "tip" | "important" | "caution" | "warning"
|
|
|
45
46
|
|
|
46
47
|
export declare const capitalize: (str: string) => string;
|
|
47
48
|
|
|
49
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
50
|
+
|
|
48
51
|
export declare function CodeBlock({ children, className, fileName, language, }: CodeBlockProps): JSX_2.Element;
|
|
49
52
|
|
|
50
53
|
declare interface CodeBlockProps {
|
|
@@ -54,6 +57,15 @@ declare interface CodeBlockProps {
|
|
|
54
57
|
fileName?: string;
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
declare interface ComponentsContextValue {
|
|
61
|
+
LinkComponent?: LinkComponent;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare function ComponentsProvider({ children, LinkComponent, }: {
|
|
65
|
+
children: React.ReactNode;
|
|
66
|
+
LinkComponent?: LinkComponent;
|
|
67
|
+
}): JSX_2.Element;
|
|
68
|
+
|
|
57
69
|
export declare function convertHtmlToMdx(html: string, options?: ConvertOptions): Promise<{
|
|
58
70
|
mdx: string;
|
|
59
71
|
mdxExtracts: MdxExtracts;
|
|
@@ -72,6 +84,12 @@ export declare interface CopyMarkdownOptions {
|
|
|
72
84
|
|
|
73
85
|
export declare const copyMarkdownToClipboard: ({ pathname, onSuccess, onFail, }: CopyMarkdownOptions) => void;
|
|
74
86
|
|
|
87
|
+
export declare function createDefaultComponents(options?: CreateDefaultComponentsOptions): MDXComponents;
|
|
88
|
+
|
|
89
|
+
export declare interface CreateDefaultComponentsOptions {
|
|
90
|
+
LinkComponent?: LinkComponent;
|
|
91
|
+
}
|
|
92
|
+
|
|
75
93
|
export declare const defaultComponents: MDXComponents;
|
|
76
94
|
|
|
77
95
|
export declare function Details({ children, open }: DetailsProps): JSX_2.Element;
|
|
@@ -81,7 +99,7 @@ declare interface DetailsProps {
|
|
|
81
99
|
open?: boolean;
|
|
82
100
|
}
|
|
83
101
|
|
|
84
|
-
export declare function DocsPage({ payload, toc, navTree, dropdown, activeHref, theme, className, pathname, markdownContent, allPages, baseUrl, bottomLinks, }: DocsPageProps): JSX_2.Element;
|
|
102
|
+
export declare function DocsPage({ payload, toc, navTree, dropdown, activeHref, theme, className, pathname, markdownContent, allPages, baseUrl, bottomLinks, LinkComponent, }: DocsPageProps): JSX_2.Element;
|
|
85
103
|
|
|
86
104
|
export declare interface DocsPageProps {
|
|
87
105
|
payload: PayloadData;
|
|
@@ -96,6 +114,7 @@ export declare interface DocsPageProps {
|
|
|
96
114
|
allPages?: LlmsPageConfig[];
|
|
97
115
|
baseUrl?: string;
|
|
98
116
|
bottomLinks?: BottomLinkConfig[];
|
|
117
|
+
LinkComponent?: LinkComponent;
|
|
99
118
|
}
|
|
100
119
|
|
|
101
120
|
export declare interface DropdownConfig {
|
|
@@ -148,7 +167,7 @@ export declare function getPageMarkdown(pathname: string): Promise<string>;
|
|
|
148
167
|
|
|
149
168
|
export declare function getTextContent(node: Element_2 | Text_2): string;
|
|
150
169
|
|
|
151
|
-
export declare const Heading: ({ id, level, children, className }: HeadingProps) => JSX_2.Element;
|
|
170
|
+
export declare const Heading: ({ id, level, children, className, }: HeadingProps) => JSX_2.Element;
|
|
152
171
|
|
|
153
172
|
declare interface HeadingProps {
|
|
154
173
|
id: string;
|
|
@@ -167,6 +186,13 @@ export declare function isElement<T extends ElementType = Element_2>(node: Eleme
|
|
|
167
186
|
|
|
168
187
|
export declare function Link({ href, children, className }: LinkProps): JSX_2.Element;
|
|
169
188
|
|
|
189
|
+
export declare type LinkComponent = default_2.ComponentType<LinkComponentProps>;
|
|
190
|
+
|
|
191
|
+
export declare interface LinkComponentProps extends default_2.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
192
|
+
children?: default_2.ReactNode;
|
|
193
|
+
className?: string;
|
|
194
|
+
}
|
|
195
|
+
|
|
170
196
|
declare interface LinkProps {
|
|
171
197
|
href?: string;
|
|
172
198
|
children: default_2.ReactNode;
|
|
@@ -196,7 +222,7 @@ export declare interface MDXComponents {
|
|
|
196
222
|
h6?: default_2.ComponentType<any>;
|
|
197
223
|
code?: default_2.ComponentType<any>;
|
|
198
224
|
pre?: default_2.ComponentType<any>;
|
|
199
|
-
a?: default_2.ComponentType<any
|
|
225
|
+
a?: default_2.ComponentType<any> | LinkComponent;
|
|
200
226
|
p?: default_2.ComponentType<any>;
|
|
201
227
|
ul?: default_2.ComponentType<any>;
|
|
202
228
|
ol?: default_2.ComponentType<any>;
|
|
@@ -233,7 +259,7 @@ declare interface MDXRendererProps {
|
|
|
233
259
|
components?: MDXComponents;
|
|
234
260
|
}
|
|
235
261
|
|
|
236
|
-
export declare function MobileNavTree({ isOpen, setIsOpen, navTree, activeId, className, theme, dropdown, activeHref, bottomLinks, }: MobileNavTreeProps): JSX_2.Element;
|
|
262
|
+
export declare function MobileNavTree({ isOpen, setIsOpen, navTree, activeId, className, theme, dropdown, activeHref, bottomLinks, LinkComponent, }: MobileNavTreeProps): JSX_2.Element;
|
|
237
263
|
|
|
238
264
|
declare interface MobileNavTreeProps {
|
|
239
265
|
isOpen: boolean;
|
|
@@ -245,6 +271,7 @@ declare interface MobileNavTreeProps {
|
|
|
245
271
|
dropdown?: DropdownConfig;
|
|
246
272
|
activeHref?: string;
|
|
247
273
|
bottomLinks?: BottomLinkConfig[];
|
|
274
|
+
LinkComponent?: LinkComponent;
|
|
248
275
|
}
|
|
249
276
|
|
|
250
277
|
export declare interface NavItem {
|
|
@@ -396,6 +423,8 @@ export declare interface TocItem {
|
|
|
396
423
|
children?: TocItem[];
|
|
397
424
|
}
|
|
398
425
|
|
|
426
|
+
export declare function useComponents(): ComponentsContextValue;
|
|
427
|
+
|
|
399
428
|
export declare function useMarkdownCopy(pathname: string): void;
|
|
400
429
|
|
|
401
430
|
export declare function ZonePivot({ pivot, target, children }: ZonePivotProps): JSX_2.Element | null;
|
package/dist/index.js
CHANGED
|
@@ -1,110 +1,116 @@
|
|
|
1
1
|
import { DocsPage as r } from "./components/page.js";
|
|
2
2
|
import { MDXRenderer as m } from "./components/mdx-renderer.js";
|
|
3
|
-
import { PlainTextPage as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
3
|
+
import { PlainTextPage as a } from "./components/plain-text-page.js";
|
|
4
|
+
import { createDefaultComponents as f, defaultComponents as l } from "./components/content-components/default-components.js";
|
|
5
|
+
import { ComponentsProvider as s, useComponents as d } from "./context/components-context.js";
|
|
6
|
+
import { NavTree as T } from "./components/nav-tree/index.js";
|
|
7
|
+
import { TableOfContents as b } from "./components/toc/index.js";
|
|
8
|
+
import { PivotAwareTOC as P } from "./components/toc/pivot-aware-toc.js";
|
|
9
|
+
import { PageContextMenu as y } from "./components/page-context-menu.js";
|
|
10
|
+
import { copyMarkdownToClipboard as c, getPageMarkdown as u, useMarkdownCopy as h } from "./hooks/useMarkdownCopy.js";
|
|
11
|
+
import { generateLlmsFullTxt as k, generateLlmsTxt as w } from "./utils/generate-llms-txt.js";
|
|
12
|
+
import { getNodeText as N } from "./utils/get-node-text.js";
|
|
13
|
+
import { capitalize as Z } from "./utils/string.js";
|
|
14
|
+
import { cn as F } from "./utils/cn.js";
|
|
15
|
+
import { getClassNames as B, getTextContent as E, isElement as I } from "./utils/rehype.js";
|
|
16
|
+
import { convertHtmlToMdx as S } from "./parser/convert-html-to-mdx.js";
|
|
17
|
+
import { serializeMdx as J } from "./parser/serialize-mdx.js";
|
|
18
|
+
import { extractHeadings as j } from "./plugins/extract-headings.js";
|
|
19
|
+
import { rehypeRemoveHtmlComments as G, removeHtmlComments as K } from "./plugins/sanitize/remove-html-comments.js";
|
|
20
|
+
import { CodeBlock as U } from "./components/content-components/code-block.js";
|
|
21
|
+
import { Heading as W } from "./components/content-components/heading.js";
|
|
22
|
+
import { Link as _ } from "./components/content-components/link.js";
|
|
23
|
+
import { Callout as ee } from "./components/content-components/callouts.js";
|
|
24
|
+
import { ZonePivot as re } from "./components/content-components/zone-pivots/zone-pivot.js";
|
|
25
|
+
import { ZoneTarget as me } from "./components/content-components/zone-pivots/zone-target.js";
|
|
26
|
+
import { ZonePivotProvider as ae } from "./components/content-components/zone-pivots/zone-pivot-context.js";
|
|
27
|
+
import { ZonePivotSelector as fe } from "./components/content-components/zone-pivots/zone-pivot-selector.js";
|
|
28
|
+
import { ParamName as ne } from "./components/content-components/param-name.js";
|
|
29
|
+
import { Tabs as de } from "./components/content-components/tabs/tabs.js";
|
|
30
|
+
import { Tab as Te } from "./components/content-components/tabs/tab.js";
|
|
31
|
+
import { Details as be, Summary as ge } from "./components/content-components/details/details.js";
|
|
32
|
+
import { Table as He, TableBody as ye, TableCaption as ve, TableCell as ce, TableFooter as ue, TableHead as he, TableHeader as Me, TableRow as ke } from "./components/content-components/table/index.js";
|
|
33
|
+
import { allComponents as De } from "./components/content-components/all-components.js";
|
|
34
|
+
import { Home as Re } from "./components/content-components/home.js";
|
|
35
|
+
import { DropdownMenu as ze } from "./components/nav-tree/dropdown-menu.js";
|
|
36
|
+
import { MobileNavTree as Le } from "./components/nav-tree/mobile-nav.js";
|
|
37
|
+
import { rehypeCodeblocks as Ee } from "./plugins/rehype/rehype-code-blocks.js";
|
|
38
|
+
import { remarkHeadingIds as Oe } from "./plugins/remark/remark-heading-ids.js";
|
|
39
|
+
import { sanitizePreTags as Ae } from "./plugins/sanitize/rehype-pre-to-mdx-fence.js";
|
|
40
|
+
import { rehypeCallouts as Xe } from "./plugins/sanitize/rehype-callouts.js";
|
|
41
|
+
import { rehypeParamName as qe } from "./plugins/sanitize/rehype-param-name.js";
|
|
42
|
+
import { rehypeTabs as Ke } from "./plugins/sanitize/rehype-tabs.js";
|
|
43
|
+
import { rehypeDetails as Ue } from "./plugins/sanitize/rehype-details.js";
|
|
44
|
+
import { rehypeHeadingIds as We } from "./plugins/sanitize/rehype-heading-ids.js";
|
|
45
|
+
import { rehypeZonePivots as _e } from "./plugins/sanitize/rehype-zone-pivots.js";
|
|
46
|
+
import { mdxJsxFlowElementHandler as eo, rehypeRemark as oo } from "./plugins/sanitize/rehype-remark.js";
|
|
47
|
+
import { tableCellHandler as to, tableHandler as mo, tableRowHandler as po } from "./plugins/sanitize/rehype-table-align.js";
|
|
46
48
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
ee as Callout,
|
|
50
|
+
U as CodeBlock,
|
|
51
|
+
s as ComponentsProvider,
|
|
52
|
+
be as Details,
|
|
50
53
|
r as DocsPage,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
ze as DropdownMenu,
|
|
55
|
+
W as Heading,
|
|
56
|
+
Re as Home,
|
|
57
|
+
_ as Link,
|
|
55
58
|
m as MDXRenderer,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
N as
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Xe as
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
59
|
+
Le as MobileNavTree,
|
|
60
|
+
T as NavTree,
|
|
61
|
+
y as PageContextMenu,
|
|
62
|
+
ne as ParamName,
|
|
63
|
+
P as PivotAwareTOC,
|
|
64
|
+
a as PlainTextPage,
|
|
65
|
+
ge as Summary,
|
|
66
|
+
Te as Tab,
|
|
67
|
+
He as Table,
|
|
68
|
+
ye as TableBody,
|
|
69
|
+
ve as TableCaption,
|
|
70
|
+
ce as TableCell,
|
|
71
|
+
ue as TableFooter,
|
|
72
|
+
he as TableHead,
|
|
73
|
+
Me as TableHeader,
|
|
74
|
+
b as TableOfContents,
|
|
75
|
+
ke as TableRow,
|
|
76
|
+
de as Tabs,
|
|
77
|
+
re as ZonePivot,
|
|
78
|
+
ae as ZonePivotProvider,
|
|
79
|
+
fe as ZonePivotSelector,
|
|
80
|
+
me as ZoneTarget,
|
|
81
|
+
De as allComponents,
|
|
82
|
+
Z as capitalize,
|
|
83
|
+
F as cn,
|
|
84
|
+
S as convertHtmlToMdx,
|
|
85
|
+
c as copyMarkdownToClipboard,
|
|
86
|
+
f as createDefaultComponents,
|
|
87
|
+
l as defaultComponents,
|
|
88
|
+
j as extractHeadings,
|
|
89
|
+
k as generateLlmsFullTxt,
|
|
90
|
+
w as generateLlmsTxt,
|
|
91
|
+
B as getClassNames,
|
|
92
|
+
N as getNodeText,
|
|
93
|
+
u as getPageMarkdown,
|
|
94
|
+
E as getTextContent,
|
|
95
|
+
I as isElement,
|
|
96
|
+
eo as mdxJsxFlowElementHandler,
|
|
97
|
+
Xe as rehypeCallouts,
|
|
98
|
+
Ee as rehypeCodeblocks,
|
|
99
|
+
Ue as rehypeDetails,
|
|
100
|
+
We as rehypeHeadingIds,
|
|
101
|
+
qe as rehypeParamName,
|
|
102
|
+
oo as rehypeRemark,
|
|
103
|
+
G as rehypeRemoveHtmlComments,
|
|
104
|
+
Ke as rehypeTabs,
|
|
105
|
+
_e as rehypeZonePivots,
|
|
106
|
+
Oe as remarkHeadingIds,
|
|
107
|
+
K as removeHtmlComments,
|
|
108
|
+
Ae as sanitizePreTags,
|
|
109
|
+
J as serializeMdx,
|
|
110
|
+
to as tableCellHandler,
|
|
111
|
+
mo as tableHandler,
|
|
112
|
+
po as tableRowHandler,
|
|
113
|
+
d as useComponents,
|
|
114
|
+
h as useMarkdownCopy
|
|
109
115
|
};
|
|
110
116
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|