@mintlify/msft-sdk 1.1.21 → 1.1.23
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/api-playground-2/ApiExamples.js +24 -16
- package/dist/api-playground-2/ApiExamples.js.map +1 -1
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js +66 -58
- package/dist/api-playground-2/components/Example/GeneratedRequestExample.js.map +1 -1
- package/dist/api-playground-2/components/Example/RequestExample.js +55 -50
- package/dist/api-playground-2/components/Example/RequestExample.js.map +1 -1
- package/dist/api-playground-2/generators/createBodyData.js +1 -1
- package/dist/api-playground-2/generators/createBodyData.js.map +1 -1
- package/dist/api-playground-2/generators/createHeaders.js +18 -18
- package/dist/api-playground-2/generators/createHeaders.js.map +1 -1
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js +18 -16
- package/dist/api-playground-2/generators/generateInteractiveCodeSample.js.map +1 -1
- package/dist/api-playground-2/generators/generateRequest.js +26 -25
- package/dist/api-playground-2/generators/generateRequest.js.map +1 -1
- package/dist/api-playground-2/generators/generateSnippetMap.js +13 -11
- package/dist/api-playground-2/generators/generateSnippetMap.js.map +1 -1
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js +24 -13
- package/dist/api-playground-2/hooks/usePlaygroundInputsStore.js.map +1 -1
- package/dist/api-playground-2/schemaGraph/processExamples.js.map +1 -1
- package/dist/common/guards.js +11 -0
- package/dist/common/guards.js.map +1 -0
- package/dist/components/content-components/code-block.js +30 -30
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/toc/index.js +4 -4
- package/dist/components/toc/index.js.map +1 -1
- package/dist/contexts/ConfigContext.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +10 -11
|
@@ -14,38 +14,38 @@ import { cn as h } from "../../utils/cn.js";
|
|
|
14
14
|
import { ClipboardCheckmarkRegular as B, Copy20Regular as I } from "@fluentui/react-icons";
|
|
15
15
|
const A = ["image/png", "text/plain"];
|
|
16
16
|
function w() {
|
|
17
|
-
const [t, e] = y(!1),
|
|
17
|
+
const [t, e] = y(!1), n = async (m) => {
|
|
18
18
|
try {
|
|
19
19
|
await navigator.clipboard.writeText(m), e(!0), setTimeout(() => e(!1), 2e3);
|
|
20
20
|
} catch (c) {
|
|
21
21
|
console.error("Failed to copy to clipboard:", c);
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
return { isCopied: t, copy:
|
|
24
|
+
return { isCopied: t, copy: n, copyBlob: async (m, c) => {
|
|
25
25
|
try {
|
|
26
26
|
if (A.includes(c)) {
|
|
27
|
-
const
|
|
28
|
-
[c]:
|
|
27
|
+
const o = await m.arrayBuffer(), i = new Blob([o], { type: c }), a = new ClipboardItem({
|
|
28
|
+
[c]: i
|
|
29
29
|
});
|
|
30
|
-
await navigator.clipboard.write([
|
|
30
|
+
await navigator.clipboard.write([a]), e(!0), setTimeout(() => e(!1), 2e3);
|
|
31
31
|
} else {
|
|
32
|
-
const
|
|
33
|
-
await o
|
|
32
|
+
const o = await m.text();
|
|
33
|
+
await n(o);
|
|
34
34
|
}
|
|
35
|
-
} catch (
|
|
36
|
-
console.error("Failed to copy blob to clipboard:",
|
|
35
|
+
} catch (o) {
|
|
36
|
+
console.error("Failed to copy blob to clipboard:", o);
|
|
37
37
|
try {
|
|
38
|
-
const
|
|
39
|
-
await
|
|
40
|
-
} catch (
|
|
41
|
-
console.error("Failed to copy as text fallback:",
|
|
38
|
+
const i = await m.text();
|
|
39
|
+
await n(i);
|
|
40
|
+
} catch (i) {
|
|
41
|
+
console.error("Failed to copy as text fallback:", i);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
} };
|
|
45
45
|
}
|
|
46
|
-
function R({ onClick: t, isCopied: e, showTooltip:
|
|
46
|
+
function R({ onClick: t, isCopied: e, showTooltip: n = !0 }) {
|
|
47
47
|
return /* @__PURE__ */ k("div", { className: "mint:relative", children: [
|
|
48
|
-
|
|
48
|
+
n && e && /* @__PURE__ */ r("div", { className: "mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]", children: "Copied!" }),
|
|
49
49
|
/* @__PURE__ */ r(
|
|
50
50
|
"button",
|
|
51
51
|
{
|
|
@@ -58,22 +58,22 @@ function R({ onClick: t, isCopied: e, showTooltip: o = !0 }) {
|
|
|
58
58
|
] });
|
|
59
59
|
}
|
|
60
60
|
function q({ textToCopy: t, showTooltip: e = !0 }) {
|
|
61
|
-
const { isCopied:
|
|
61
|
+
const { isCopied: n, copy: p } = w();
|
|
62
62
|
return /* @__PURE__ */ r(R, { onClick: () => {
|
|
63
63
|
p(t);
|
|
64
|
-
}, isCopied:
|
|
64
|
+
}, isCopied: n, showTooltip: e });
|
|
65
65
|
}
|
|
66
66
|
function G({
|
|
67
67
|
children: t,
|
|
68
68
|
className: e,
|
|
69
|
-
fileName:
|
|
69
|
+
fileName: n,
|
|
70
70
|
language: p,
|
|
71
71
|
blob: m,
|
|
72
72
|
contentType: c
|
|
73
73
|
}) {
|
|
74
|
-
const [
|
|
74
|
+
const [o, i] = y("");
|
|
75
75
|
w();
|
|
76
|
-
const
|
|
76
|
+
const a = p || (e == null ? void 0 : e.replace(/^language-/, "")) || "text", d = T(t), _ = !!n, u = v.useMemo(() => {
|
|
77
77
|
var f, g;
|
|
78
78
|
if (typeof t != "object" || t == null)
|
|
79
79
|
return !1;
|
|
@@ -90,38 +90,38 @@ function G({
|
|
|
90
90
|
return N(() => {
|
|
91
91
|
if (!u)
|
|
92
92
|
try {
|
|
93
|
-
const s = b.languages[
|
|
94
|
-
|
|
93
|
+
const s = b.languages[a] || b.languages.plaintext, f = b.highlight(d, s, a);
|
|
94
|
+
i(f);
|
|
95
95
|
} catch (s) {
|
|
96
|
-
console.error("Failed to highlight code:", s),
|
|
96
|
+
console.error("Failed to highlight code:", s), i(d);
|
|
97
97
|
}
|
|
98
|
-
}, [d,
|
|
98
|
+
}, [d, a, u]), /* @__PURE__ */ r(
|
|
99
99
|
"div",
|
|
100
100
|
{
|
|
101
|
-
className: _ ? "flex flex-col gap-2
|
|
101
|
+
className: _ ? "mint:flex mint:flex-col mint:gap-2 mint:px-0.5 mint:pb-0.5 mint:rounded-xl mint:overflow-hidden" : void 0,
|
|
102
102
|
children: /* @__PURE__ */ r("div", { className: "not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]", children: /* @__PURE__ */ r("div", { className: "mint:code-scrollbar mint:overflow-x-auto", children: /* @__PURE__ */ r("pre", { className: "mint:px-4 mint:pb-3 mint:pt-2 mint:m-0 mint:whitespace-pre mint:text-sm", children: u ? /* @__PURE__ */ r(
|
|
103
103
|
"code",
|
|
104
104
|
{
|
|
105
105
|
className: h(
|
|
106
|
-
`language-${
|
|
106
|
+
`language-${a}`,
|
|
107
107
|
"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
|
|
108
108
|
),
|
|
109
109
|
children: t
|
|
110
110
|
}
|
|
111
|
-
) :
|
|
111
|
+
) : o ? /* @__PURE__ */ r(
|
|
112
112
|
"code",
|
|
113
113
|
{
|
|
114
114
|
className: h(
|
|
115
|
-
`language-${
|
|
115
|
+
`language-${a}`,
|
|
116
116
|
"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
|
|
117
117
|
),
|
|
118
|
-
dangerouslySetInnerHTML: { __html:
|
|
118
|
+
dangerouslySetInnerHTML: { __html: o }
|
|
119
119
|
}
|
|
120
120
|
) : /* @__PURE__ */ r(
|
|
121
121
|
"code",
|
|
122
122
|
{
|
|
123
123
|
className: h(
|
|
124
|
-
`language-${
|
|
124
|
+
`language-${a}`,
|
|
125
125
|
"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]"
|
|
126
126
|
),
|
|
127
127
|
children: d
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block.js","sources":["../../../src/components/content-components/code-block.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from \"react\";\nimport Prism from \"prismjs\";\nimport \"prismjs/components/prism-javascript.js\";\nimport \"prismjs/components/prism-typescript.js\";\nimport \"prismjs/components/prism-python.js\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-json.js\";\nimport \"prismjs/components/prism-markdown.js\";\nimport \"prismjs/components/prism-csharp.js\";\nimport \"prismjs/components/prism-powershell.js\";\nimport { getNodeText } from \"../../utils/get-node-text\";\nimport { capitalize } from \"../../utils/string\";\nimport { cn } from \"../../utils/cn\";\nimport {\n Copy20Regular,\n ClipboardCheckmarkRegular,\n} from \"@fluentui/react-icons\";\n\nconst SUPPORTED_CLIPBOARD_CONTENT_TYPES = [\"image/png\", \"text/plain\"];\n\n// Hook for clipboard operations\nexport function useCopyToClipboard() {\n const [isCopied, setIsCopied] = useState(false);\n\n const copy = async (text: string) => {\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } catch (error) {\n console.error(\"Failed to copy to clipboard:\", error);\n }\n };\n\n const copyBlob = async (blob: Blob, contentType: string) => {\n try {\n // image/png, text/plain, and text/html are the only filetypes supported in the chromium\n // clipboard - however, text/html crashes chrome for some reason\n if (SUPPORTED_CLIPBOARD_CONTENT_TYPES.includes(contentType)) {\n const buffer = await blob.arrayBuffer();\n const newBlob = new Blob([buffer], { type: contentType });\n const clipboardItem = new ClipboardItem({\n [contentType]: newBlob,\n });\n await navigator.clipboard.write([clipboardItem]);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } else {\n // Fallback to text copy for unsupported types\n const text = await blob.text();\n await copy(text);\n }\n } catch (error) {\n console.error(\"Failed to copy blob to clipboard:\", error);\n // Fallback to text copy if blob copy fails\n try {\n const text = await blob.text();\n await copy(text);\n } catch (fallbackError) {\n console.error(\"Failed to copy as text fallback:\", fallbackError);\n }\n }\n };\n\n return { isCopied, copy, copyBlob };\n}\n\n// Base copy icon button component\ninterface CopyIconButtonProps {\n onClick: () => void;\n isCopied: boolean;\n showTooltip?: boolean;\n}\n\nexport function CopyIconButton({ onClick, isCopied, showTooltip = true }: CopyIconButtonProps) {\n return (\n <div className=\"mint:relative\">\n {showTooltip && isCopied && (\n <div className=\"mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]\">\n Copied!\n </div>\n )}\n <button\n onClick={onClick}\n className=\"mint:flex mint:items-center mint:gap-1.5 mint:px-2 mint:py-1 mint:text-xs mint:text-[#737373] mint:dark:text-[#a3a3a3] mint:rounded mint:transition-colors mint:duration-150 mint:border-none mint:bg-transparent mint:cursor-pointer mint:hover:text-[#9263f1] mint:dark:hover:text-[#c9aaf9]\"\n aria-label={isCopied ? \"Copied\" : \"Copy code\"}\n >\n {isCopied ? (\n <ClipboardCheckmarkRegular className=\"mint:w-5 mint:h-5 mint:text-[#737373] mint:dark:text-[#a3a3a3]\" />\n ) : (\n <Copy20Regular className=\"mint:w-5 mint:h-5\" />\n )}\n </button>\n </div>\n );\n}\n\n// Convenience component that handles text copying\ninterface CopyToClipboardButtonProps {\n textToCopy: string;\n showTooltip?: boolean;\n}\n\nexport function CopyToClipboardButton({ textToCopy, showTooltip = true }: CopyToClipboardButtonProps) {\n const { isCopied, copy } = useCopyToClipboard();\n\n const handleCopy = () => {\n copy(textToCopy);\n };\n\n return <CopyIconButton onClick={handleCopy} isCopied={isCopied} showTooltip={showTooltip} />;\n}\n\n// Convenience component that handles blob/data copying\ninterface CopyDataToClipboardButtonProps {\n data: {\n type: 'image' | 'audio' | 'video' | 'other';\n blob: Blob;\n contentType?: string;\n content?: string;\n };\n showTooltip?: boolean;\n}\n\nexport function CopyDataToClipboardButton({ data, showTooltip = true }: CopyDataToClipboardButtonProps) {\n const { isCopied, copy, copyBlob } = useCopyToClipboard();\n\n const handleCopy = () => {\n // Check if we can copy as blob (for images, etc.)\n if (data.contentType && SUPPORTED_CLIPBOARD_CONTENT_TYPES.includes(data.contentType)) {\n copyBlob(data.blob, data.contentType);\n } else if (data.type === 'other' && data.content) {\n // For text content, copy as text\n copy(data.content);\n } else {\n console.error('Unsupported content type for clipboard');\n }\n };\n\n return <CopyIconButton onClick={handleCopy} isCopied={isCopied} showTooltip={showTooltip} />;\n}\n\ninterface CodeBlockProps {\n children: React.ReactNode;\n className?: string;\n language?: string;\n fileName?: string;\n // Support for copying blobs (images, etc.)\n blob?: Blob;\n contentType?: string;\n}\n\nexport function CodeBlock({\n children,\n className,\n fileName,\n language,\n blob,\n contentType,\n}: CodeBlockProps) {\n const [highlightedCode, setHighlightedCode] = useState<string>(\"\");\n const { isCopied, copy, copyBlob } = useCopyToClipboard();\n const lang = language || className?.replace(/^language-/, \"\") || \"text\";\n const codeText = getNodeText(children);\n const showContainer = !!fileName;\n\n const isSSRHighlighted = React.useMemo(() => {\n if (typeof children !== \"object\" || children == null) {\n return false;\n }\n\n const childrenArray = Array.isArray(children) ? children : [children];\n for (const child of childrenArray) {\n if (\n typeof child === \"object\" &&\n child != null &&\n \"props\" in child &&\n child.props?.children\n ) {\n const codeChildren = Array.isArray(child.props.children)\n ? child.props.children\n : [child.props.children];\n\n for (const codeChild of codeChildren) {\n if (\n typeof codeChild === \"object\" &&\n codeChild != null &&\n \"props\" in codeChild &&\n codeChild.props?.className\n ) {\n return true;\n }\n }\n }\n }\n return false;\n }, [children]);\n\n useEffect(() => {\n if (isSSRHighlighted) {\n return;\n }\n\n try {\n const grammar = Prism.languages[lang] || Prism.languages.plaintext;\n const html = Prism.highlight(codeText, grammar, lang);\n setHighlightedCode(html);\n } catch (error) {\n console.error(\"Failed to highlight code:\", error);\n setHighlightedCode(codeText);\n }\n }, [codeText, lang, isSSRHighlighted]);\n\n const handleCopy = () => {\n // If blob and contentType are provided, use blob copying\n if (blob && contentType) {\n copyBlob(blob, contentType);\n } else {\n // Otherwise, use text copying\n copy(codeText);\n }\n };\n\n return (\n <div\n // eslint-disable-next-line local/enforce-cn-classname\n className={\n showContainer\n ? \"flex flex-col gap-2 mt-4 mb-4 border border-[#e5e5e5] dark:border-[#262626] pt-2.5 px-2 pb-2 rounded-xl overflow-hidden\"\n : undefined\n }\n >\n <div className=\"not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]\">\n <div className=\"mint:code-scrollbar mint:overflow-x-auto\">\n <pre className=\"mint:px-4 mint:pb-3 mint:pt-2 mint:m-0 mint:whitespace-pre mint:text-sm\">\n {isSSRHighlighted ? (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n >\n {children}\n </code>\n ) : highlightedCode ? (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n dangerouslySetInnerHTML={{ __html: highlightedCode }}\n />\n ) : (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n >\n {codeText}\n </code>\n )}\n </pre>\n </div>\n </div>\n </div>\n );\n}\n"],"names":["SUPPORTED_CLIPBOARD_CONTENT_TYPES","useCopyToClipboard","isCopied","setIsCopied","useState","copy","text","error","blob","contentType","buffer","newBlob","clipboardItem","fallbackError","CopyIconButton","onClick","showTooltip","jsxs","jsx","ClipboardCheckmarkRegular","Copy20Regular","CopyToClipboardButton","textToCopy","CodeBlock","children","className","fileName","language","highlightedCode","setHighlightedCode","lang","codeText","getNodeText","showContainer","isSSRHighlighted","React","childrenArray","child","_a","codeChildren","codeChild","_b","useEffect","grammar","Prism","html","cn"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAMA,IAAoC,CAAC,aAAa,YAAY;AAG7D,SAASC,IAAqB;AACnC,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAK,GAExCC,IAAO,OAAOC,MAAiB;AACnC,QAAI;AACF,YAAM,UAAU,UAAU,UAAUA,CAAI,GACxCH,EAAY,EAAI,GAChB,WAAW,MAAMA,EAAY,EAAK,GAAG,GAAI;AAAA,IAC3C,SAASI,GAAO;AACd,cAAQ,MAAM,gCAAgCA,CAAK;AAAA,IACrD;AAAA,EACF;AAgCA,SAAO,EAAE,UAAAL,GAAU,MAAAG,GAAM,UA9BR,OAAOG,GAAYC,MAAwB;AAC1D,QAAI;AAGF,UAAIT,EAAkC,SAASS,CAAW,GAAG;AAC3D,cAAMC,IAAS,MAAMF,EAAK,YA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AA6BA,CAAK,GAChDsB,EAAmBE,CAAQ;AAAA,MAC7B;AAAA,EACF,GAAG,CAACA,GAAUD,GAAMI,CAAgB,CAAC,GAanC,gBAAAhB;AAAA,IAAC;AAAA,IAAA;AAAA,MAEC,WACEe,IACI,4HACA;AAAA,MAGN,UAAA,gBAAAf,EAAC,OAAA,EAAI,WAAU,oFACb,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,4CACb,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,2EACZ,UAAAgB,IACC,gBAAAhB;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW4B;AAAA,YACT,YAAYhB,CAAI;AAAA,YAChB;AAAA,UAAA;AAAA,UAGD,UAAAN;AAAA,QAAA;AAAA,MAAA,IAEDI,IACF,gBAAAV;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW4B;AAAA,YACT,YAAYhB,CAAI;AAAA,YAChB;AAAA,UAAA;AAAA,UAEF,yBAAyB,EAAE,QAAQF,EAAA;AAAA,QAAgB;AAAA,MAAA,IAGrD,gBAAAV;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAW4B;AAAA,YACT,YAAYhB,CAAI;AAAA,YAChB;AAAA,UAAA;AAAA,UAGD,UAAAC;AAAA,QAAA;AAAA,MAAA,EACH,CAEJ,GACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"code-block.js","sources":["../../../src/components/content-components/code-block.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from \"react\";\nimport Prism from \"prismjs\";\nimport \"prismjs/components/prism-javascript.js\";\nimport \"prismjs/components/prism-typescript.js\";\nimport \"prismjs/components/prism-python.js\";\nimport \"prismjs/components/prism-bash.js\";\nimport \"prismjs/components/prism-json.js\";\nimport \"prismjs/components/prism-markdown.js\";\nimport \"prismjs/components/prism-csharp.js\";\nimport \"prismjs/components/prism-powershell.js\";\nimport { getNodeText } from \"../../utils/get-node-text\";\nimport { capitalize } from \"../../utils/string\";\nimport { cn } from \"../../utils/cn\";\nimport {\n Copy20Regular,\n ClipboardCheckmarkRegular,\n} from \"@fluentui/react-icons\";\n\nconst SUPPORTED_CLIPBOARD_CONTENT_TYPES = [\"image/png\", \"text/plain\"];\n\n// Hook for clipboard operations\nexport function useCopyToClipboard() {\n const [isCopied, setIsCopied] = useState(false);\n\n const copy = async (text: string) => {\n try {\n await navigator.clipboard.writeText(text);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } catch (error) {\n console.error(\"Failed to copy to clipboard:\", error);\n }\n };\n\n const copyBlob = async (blob: Blob, contentType: string) => {\n try {\n // image/png, text/plain, and text/html are the only filetypes supported in the chromium\n // clipboard - however, text/html crashes chrome for some reason\n if (SUPPORTED_CLIPBOARD_CONTENT_TYPES.includes(contentType)) {\n const buffer = await blob.arrayBuffer();\n const newBlob = new Blob([buffer], { type: contentType });\n const clipboardItem = new ClipboardItem({\n [contentType]: newBlob,\n });\n await navigator.clipboard.write([clipboardItem]);\n setIsCopied(true);\n setTimeout(() => setIsCopied(false), 2000);\n } else {\n // Fallback to text copy for unsupported types\n const text = await blob.text();\n await copy(text);\n }\n } catch (error) {\n console.error(\"Failed to copy blob to clipboard:\", error);\n // Fallback to text copy if blob copy fails\n try {\n const text = await blob.text();\n await copy(text);\n } catch (fallbackError) {\n console.error(\"Failed to copy as text fallback:\", fallbackError);\n }\n }\n };\n\n return { isCopied, copy, copyBlob };\n}\n\n// Base copy icon button component\ninterface CopyIconButtonProps {\n onClick: () => void;\n isCopied: boolean;\n showTooltip?: boolean;\n}\n\nexport function CopyIconButton({ onClick, isCopied, showTooltip = true }: CopyIconButtonProps) {\n return (\n <div className=\"mint:relative\">\n {showTooltip && isCopied && (\n <div className=\"mint:absolute mint:bottom-[calc(100%+0.5rem)] mint:left-1/2 mint:-translate-x-1/2 mint:bg-white mint:dark:bg-[#1a1a1a] mint:text-[#171717] mint:dark:text-[#fafafa] mint:px-2.5 mint:py-1.5 mint:rounded-md mint:text-xs mint:font-medium mint:whitespace-nowrap mint:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.1),0_2px_4px_-1px_rgba(0,0,0,0.06)] mint:dark:shadow-[0_4px_6px_-1px_rgba(0,0,0,0.3),0_2px_4px_-1px_rgba(0,0,0,0.2)] mint:z-10 mint:animate-[fadeIn_0.15s_ease-out] mint:after:content-[''] mint:after:absolute mint:after:top-full mint:after:left-1/2 mint:after:-translate-x-1/2 mint:after:w-0 mint:after:h-0 mint:after:border-l-[6px] mint:after:border-l-transparent mint:after:border-r-[6px] mint:after:border-r-transparent mint:after:border-t-[6px] mint:after:border-t-white mint:dark:after:border-t-[#1a1a1a]\">\n Copied!\n </div>\n )}\n <button\n onClick={onClick}\n className=\"mint:flex mint:items-center mint:gap-1.5 mint:px-2 mint:py-1 mint:text-xs mint:text-[#737373] mint:dark:text-[#a3a3a3] mint:rounded mint:transition-colors mint:duration-150 mint:border-none mint:bg-transparent mint:cursor-pointer mint:hover:text-[#9263f1] mint:dark:hover:text-[#c9aaf9]\"\n aria-label={isCopied ? \"Copied\" : \"Copy code\"}\n >\n {isCopied ? (\n <ClipboardCheckmarkRegular className=\"mint:w-5 mint:h-5 mint:text-[#737373] mint:dark:text-[#a3a3a3]\" />\n ) : (\n <Copy20Regular className=\"mint:w-5 mint:h-5\" />\n )}\n </button>\n </div>\n );\n}\n\n// Convenience component that handles text copying\ninterface CopyToClipboardButtonProps {\n textToCopy: string;\n showTooltip?: boolean;\n}\n\nexport function CopyToClipboardButton({ textToCopy, showTooltip = true }: CopyToClipboardButtonProps) {\n const { isCopied, copy } = useCopyToClipboard();\n\n const handleCopy = () => {\n copy(textToCopy);\n };\n\n return <CopyIconButton onClick={handleCopy} isCopied={isCopied} showTooltip={showTooltip} />;\n}\n\n// Convenience component that handles blob/data copying\ninterface CopyDataToClipboardButtonProps {\n data: {\n type: 'image' | 'audio' | 'video' | 'other';\n blob: Blob;\n contentType?: string;\n content?: string;\n };\n showTooltip?: boolean;\n}\n\nexport function CopyDataToClipboardButton({ data, showTooltip = true }: CopyDataToClipboardButtonProps) {\n const { isCopied, copy, copyBlob } = useCopyToClipboard();\n\n const handleCopy = () => {\n // Check if we can copy as blob (for images, etc.)\n if (data.contentType && SUPPORTED_CLIPBOARD_CONTENT_TYPES.includes(data.contentType)) {\n copyBlob(data.blob, data.contentType);\n } else if (data.type === 'other' && data.content) {\n // For text content, copy as text\n copy(data.content);\n } else {\n console.error('Unsupported content type for clipboard');\n }\n };\n\n return <CopyIconButton onClick={handleCopy} isCopied={isCopied} showTooltip={showTooltip} />;\n}\n\ninterface CodeBlockProps {\n children: React.ReactNode;\n className?: string;\n language?: string;\n fileName?: string;\n // Support for copying blobs (images, etc.)\n blob?: Blob;\n contentType?: string;\n}\n\nexport function CodeBlock({\n children,\n className,\n fileName,\n language,\n blob,\n contentType,\n}: CodeBlockProps) {\n const [highlightedCode, setHighlightedCode] = useState<string>(\"\");\n const { isCopied, copy, copyBlob } = useCopyToClipboard();\n const lang = language || className?.replace(/^language-/, \"\") || \"text\";\n const codeText = getNodeText(children);\n const showContainer = !!fileName;\n\n const isSSRHighlighted = React.useMemo(() => {\n if (typeof children !== \"object\" || children == null) {\n return false;\n }\n\n const childrenArray = Array.isArray(children) ? children : [children];\n for (const child of childrenArray) {\n if (\n typeof child === \"object\" &&\n child != null &&\n \"props\" in child &&\n child.props?.children\n ) {\n const codeChildren = Array.isArray(child.props.children)\n ? child.props.children\n : [child.props.children];\n\n for (const codeChild of codeChildren) {\n if (\n typeof codeChild === \"object\" &&\n codeChild != null &&\n \"props\" in codeChild &&\n codeChild.props?.className\n ) {\n return true;\n }\n }\n }\n }\n return false;\n }, [children]);\n\n useEffect(() => {\n if (isSSRHighlighted) {\n return;\n }\n\n try {\n const grammar = Prism.languages[lang] || Prism.languages.plaintext;\n const html = Prism.highlight(codeText, grammar, lang);\n setHighlightedCode(html);\n } catch (error) {\n console.error(\"Failed to highlight code:\", error);\n setHighlightedCode(codeText);\n }\n }, [codeText, lang, isSSRHighlighted]);\n\n const handleCopy = () => {\n // If blob and contentType are provided, use blob copying\n if (blob && contentType) {\n copyBlob(blob, contentType);\n } else {\n // Otherwise, use text copying\n copy(codeText);\n }\n };\n\n return (\n <div\n className={\n showContainer\n ? \"mint:flex mint:flex-col mint:gap-2 mint:px-0.5 mint:pb-0.5 mint:rounded-xl mint:overflow-hidden\"\n : undefined\n }\n >\n <div className=\"not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]\">\n <div className=\"mint:code-scrollbar mint:overflow-x-auto\">\n <pre className=\"mint:px-4 mint:pb-3 mint:pt-2 mint:m-0 mint:whitespace-pre mint:text-sm\">\n {isSSRHighlighted ? (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n >\n {children}\n </code>\n ) : highlightedCode ? (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n dangerouslySetInnerHTML={{ __html: highlightedCode }}\n />\n ) : (\n <code\n className={cn(\n `language-${lang}`,\n \"mint:block mint:text-[#24292e] mint:dark:text-[#e6edf3]\"\n )}\n >\n {codeText}\n </code>\n )}\n </pre>\n </div>\n </div>\n </div>\n );\n}\n"],"names":["SUPPORTED_CLIPBOARD_CONTENT_TYPES","useCopyToClipboard","isCopied","setIsCopied","useState","copy","text","error","blob","contentType","buffer","newBlob","clipboardItem","fallbackError","CopyIconButton","onClick","showTooltip","jsxs","jsx","ClipboardCheckmarkRegular","Copy20Regular","CopyToClipboardButton","textToCopy","CodeBlock","children","className","fileName","language","highlightedCode","setHighlightedCode","lang","codeText","getNodeText","showContainer","isSSRHighlighted","React","childrenArray","child","_a","codeChildren","codeChild","_b","useEffect","grammar","Prism","html","cn"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAMA,IAAoC,CAAC,aAAa,YAAY;AAG7D,SAASC,IAAqB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MAAA,EACH,CAEJ,GACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -21,7 +21,7 @@ function j({ toc: i }) {
|
|
|
21
21
|
if (!e) return (p = i[0]) == null ? void 0 : p.slug;
|
|
22
22
|
const r = window.getComputedStyle(document.documentElement), E = parseFloat(
|
|
23
23
|
r.getPropertyValue("--scroll-mt") || "0"
|
|
24
|
-
),
|
|
24
|
+
), k = parseFloat(r.fontSize), R = E * k + 100, h = e.scrollTop, f = i.map((s) => {
|
|
25
25
|
const v = document.getElementById(s.slug);
|
|
26
26
|
if (!v) return null;
|
|
27
27
|
const C = v.getBoundingClientRect(), I = e.getBoundingClientRect(), L = C.top - I.top + h;
|
|
@@ -30,7 +30,7 @@ function j({ toc: i }) {
|
|
|
30
30
|
if (f.length === 0) return (b = i[0]) == null ? void 0 : b.slug;
|
|
31
31
|
let a = f[0];
|
|
32
32
|
for (const s of f)
|
|
33
|
-
h +
|
|
33
|
+
h + R >= s.top && (a = s);
|
|
34
34
|
return a == null ? void 0 : a.id;
|
|
35
35
|
}, l = () => {
|
|
36
36
|
if (o.current) return;
|
|
@@ -44,7 +44,7 @@ function j({ toc: i }) {
|
|
|
44
44
|
return n || (u = setTimeout(l, 100)), () => {
|
|
45
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
|
-
}, [i]), /* @__PURE__ */ d("ul", { className: "mint:list-none mint:flex mint:flex-col mint:gap-
|
|
47
|
+
}, [i]), /* @__PURE__ */ d("ul", { className: "mint:list-none mint:flex mint:flex-col mint:gap-2 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
48
|
const e = x === n.slug;
|
|
49
49
|
return /* @__PURE__ */ S("li", { className: "mint:relative", children: [
|
|
50
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" }),
|
|
@@ -54,7 +54,7 @@ function j({ toc: i }) {
|
|
|
54
54
|
href: `#${n.slug}`,
|
|
55
55
|
className: A(
|
|
56
56
|
"mint:block mint:pl-6 mint:leading-relaxed mint:no-underline",
|
|
57
|
-
e ? "mint:text-[#643fb2] mint:dark:text-[#c9aaf9] mint:font-semibold" : "mint:text-[#424242] mint:
|
|
57
|
+
e ? "mint:text-[#643fb2] mint:dark:text-[#c9aaf9] mint:font-semibold" : "mint:text-[#424242] mint:dark:text-[#d6d6d6] mint:dark:hover:text-[#d1d5db] mint:hover:text-[#111827]"
|
|
58
58
|
),
|
|
59
59
|
children: n.title
|
|
60
60
|
}
|
|
@@ -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 { 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:list-none mint:flex mint:flex-col mint:gap-
|
|
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:list-none mint:flex mint:flex-col mint:gap-2 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-relaxed mint:no-underline\",\n isActive\n ? \"mint:text-[#643fb2] mint:dark:text-[#c9aaf9] mint:font-semibold\"\n : \"mint:text-[#424242] mint:dark:text-[#d6d6d6] mint:dark:hover:text-[#d1d5db] mint:hover:text-[#111827]\"\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":";;;AAQO,SAASA,EAAgB,EAAE,KAAAC,KAA6B;AAC7D,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAE,GACrCC,IAAkBC,EAAO,EAAK,GAC9BC,IAAmBD,EAAA;AAEzB,SAAAE,EAAU,MAAM;;AACd,QAAIP,EAAI,WAAW,EAAG;AAEtB,IAAAI,EAAgB,UAAU,IACtBE,EAAiB,WACnB,aAAaA,EAAiB,OAAO;AAGvC,UAAME,IAAO,OAAO,SAAS,KAAK,MAAM,CAAC;AACzC,IAAIA,KACFN,EAAYM,CAAI,GAChBJ,EAAgB,UAAU,IAC1BE,EAAiB,UAAU,WAAW,MAAM;AAC1C,MAAAF,EAAgB,UAAU;AAAA,IAC5B,GAAG,GAAI,KAEPF,IAAYO,IAAAT,EAAI,CAAC,MAAL,gBAAAS,EAAQ,SAAQ,EAAE;AAGhC,UAAMC,IAAmB,MAAM;AAC7B,YAAMF,IAAO,OAAO,SAAS,KAAK,MAAM,CAAC;AACzC,MAAIA,MACFN,EAAYM,CAAI,GAChBJ,EAAgB,UAAU,IACtBE,EAAiB,WACnB,aAAaA,E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BAAiB,UAAUA,GAAc,EAAE,SAAS,IAAM;AAGnE,QAAIE;AACJ,WAAKrB,MACHqB,IAAY,WAAWF,GAAc,GAAG,IAGnC,MAAM;AACX,MAAIE,kBAAwBA,CAAS,GACjCvB,EAAiB,WAAS,aAAaA,EAAiB,OAAO,GACnE,OAAO,oBAAoB,cAAcI,CAAgB,GACrDC,IACFA,EAAgB,oBAAoB,UAAUgB,CAAY,IAE1D,OAAO,oBAAoB,UAAUA,CAAY;AAAA,IAErD;AAAA,EACF,GAAG,CAAC3B,CAAG,CAAC,GAGN,gBAAA8B,EAAC,QAAG,WAAU,oXACX,YAAI,IAAI,CAACX,GAAMY,MAAU;AACxB,UAAMC,IAAW/B,MAAakB,EAAK;AACnC,WACE,gBAAAc,EAAC,MAAA,EAAiC,WAAU,iBACzC,UAAA;AAAA,MAAAD,KACC,gBAAAF,EAAC,OAAA,EAAI,WAAU,sIAAA,CAAsI;AAAA,MAEvJ,gBAAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,MAAM,IAAIX,EAAK,IAAI;AAAA,UACnB,WAAWe;AAAA,YACT;AAAA,YACAF,IACI,oEACA;AAAA,UAAA;AAAA,UAGL,UAAAb,EAAK;AAAA,QAAA;AAAA,MAAA;AAAA,IACR,EAAA,GAdO,GAAGA,EAAK,IAAI,IAAIY,CAAK,EAe9B;AAAA,EAEJ,CAAC,EAAA,CACH;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigContext.js","sources":["../../src/contexts/ConfigContext.tsx"],"sourcesContent":["'use client';\n\nimport { MdxExtracts } from '@mintlify/common';\nimport { SerializeSuccess } from '@mintlify/mdx/types';\nimport { InkeepType, MintConfig, PageMetaTags } from '@mintlify/models';\nimport { PageType } from '@mintlify/models';\nimport {\n DeploymentEntitlements,\n GitSource,\n DeploymentFeedbackType,\n DocsConfig,\n DecoratedNavigationConfig,\n TrieveType,\n DeploymentPreviewType,\n} from '@mintlify/validation';\nimport { createContext, ReactNode } from 'react';\n\nimport { addApiReferenceDataFromMdxAndDocsConfig } from '@/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig';\nimport { processSecurityOptions } from '@/api-playground-2/schemaGraph/processSecurityOptions';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { ApiReferenceData } from '../utils/api-reference/getApiReferenceData';\n\nexport type PageContextType = {\n pageMetadata: PageMetaTags;\n pageType?: PageType;\n mdxExtracts?: MdxExtracts;\n description?: SerializeSuccess | string | null;\n panelMdxSource?: SerializeSuccess;\n panelMdxSourceWithNoJs?: SerializeSuccess;\n};\n\nexport type DeploymentMetadataContextType = {\n subdomain?: string;\n actualSubdomain?: string;\n gitSource?: GitSource;\n inkeep?: InkeepType;\n trieve?: TrieveType;\n feedback?: DeploymentFeedbackType;\n entitlements?: DeploymentEntitlements;\n buildId?: string;\n clientVersion?: string;\n preview?: DeploymentPreviewType;\n};\n\nexport type DocsConfigContextType = {\n mintConfig?: MintConfig;\n docsConfig?: DocsConfig;\n docsNavWithMetadata?: DecoratedNavigationConfig;\n};\n\nexport type ApiReferenceContextType = {\n apiReferenceData: ApiReferenceData;\n};\n\nexport type ApiReferenceContext2Type = {\n apiReferenceData2: ApiReferenceDataV2;\n};\n\nexport const PageContext = createContext<PageContextType>({ pageMetadata: {} });\n\nexport const DeploymentMetadataContext = createContext<DeploymentMetadataContextType>({});\n\nexport const DocsConfigContext = createContext<DocsConfigContextType>({});\n\nexport const ApiReferenceContext = createContext<ApiReferenceContextType>({ apiReferenceData: {} });\n\nexport const ApiReferenceContext2 = createContext<ApiReferenceContext2Type>({\n apiReferenceData2: {},\n});\n\nPageContext.displayName = 'PageContext';\nDeploymentMetadataContext.displayName = 'DeploymentMetadataContext';\nDocsConfigContext.displayName = 'DocsConfigContext';\nApiReferenceContext.displayName = 'ApiReferenceContext';\n\nexport function PageProvider({ value, children }: { value: PageContextType; children: ReactNode }) {\n return <PageContext.Provider value={value}>{children}</PageContext.Provider>;\n}\n\nexport function DeploymentMetadataProvider({\n value,\n children,\n}: {\n value: DeploymentMetadataContextType;\n children: ReactNode;\n}) {\n return (\n <DeploymentMetadataContext.Provider value={value}>\n {children}\n </DeploymentMetadataContext.Provider>\n );\n}\n\nexport function DocsConfigProvider({\n value,\n children,\n}: {\n value: DocsConfigContextType;\n children: ReactNode;\n}) {\n return <DocsConfigContext.Provider value={value}>{children}</DocsConfigContext.Provider>;\n}\n\nexport function ApiReferenceProvider({\n value,\n children,\n}: {\n value: ApiReferenceContextType;\n children: ReactNode;\n}) {\n return <ApiReferenceContext.Provider value={value}>{children}</ApiReferenceContext.Provider>;\n}\n\nexport function ApiReferenceProvider2({\n pageMetadata,\n docsConfig,\n mdxExtracts,\n apiReferenceData2,\n children,\n}: {\n pageMetadata: PageMetaTags;\n docsConfig: DocsConfig | undefined;\n mdxExtracts: MdxExtracts | undefined;\n apiReferenceData2: ApiReferenceDataV2 | undefined;\n children: ReactNode;\n}) {\n // combine apiReferenceData2 from page props with mdxExtracts and docsConfig so we don't\n // have to go hunting per component for things that can come from other sources\n const apiReferenceDataFromPageProps = apiReferenceData2;\n\n const apiReferenceDataWithMdxAndDocsConfig = addApiReferenceDataFromMdxAndDocsConfig({\n apiReferenceData2: apiReferenceDataFromPageProps,\n mdxExtracts,\n docsConfig,\n pageMetadata,\n });\n\n // after we have the apiReferenceDataWithMdxAndDocsConfig, we can process the security options - some may have come from docs config\n const processedSecurityOptions = processSecurityOptions(apiReferenceDataWithMdxAndDocsConfig);\n if (processedSecurityOptions.length > 0) {\n if (!apiReferenceDataWithMdxAndDocsConfig.dependencies) {\n apiReferenceDataWithMdxAndDocsConfig.dependencies = {\n servers: {},\n security: {},\n processedSecurityOptions: [],\n };\n }\n apiReferenceDataWithMdxAndDocsConfig.dependencies.processedSecurityOptions =\n processedSecurityOptions;\n }\n\n const filteredApiReferenceData = apiReferenceDataWithMdxAndDocsConfig;\n return (\n <ApiReferenceContext2.Provider value={{ apiReferenceData2: filteredApiReferenceData ?? {} }}>\n {children}\n </ApiReferenceContext2.Provider>\n );\n}\n"],"names":["PageContext","createContext","DeploymentMetadataContext","DocsConfigContext","ApiReferenceContext","ApiReferenceContext2"],"mappings":";;;AA0DO,MAAMA,IAAcC,EAA+B,EAAE,cAAc,IAAI,GAEjEC,IAA4BD,EAA6C,CAAA,CAAE,GAE3EE,IAAoBF,EAAqC,CAAA,CAAE,GAE3DG,IAAsBH,EAAuC,EAAE,kBAAkB,IAAI,GAErFI,IAAuBJ,EAAwC;AAAA,EAC1E,mBAAmB,CAAA;AACrB,CAAC;AAEDD,EAAY,cAAc;AAC1BE,EAA0B,cAAc;AACxCC,EAAkB,cAAc;AAChCC,EAAoB,cAAc;"}
|
|
1
|
+
{"version":3,"file":"ConfigContext.js","sources":["../../src/contexts/ConfigContext.tsx"],"sourcesContent":["'use client';\n\nimport type { MdxExtracts } from '@mintlify/common';\nimport { SerializeSuccess } from '@mintlify/mdx/types';\nimport { InkeepType, MintConfig, PageMetaTags } from '@mintlify/models';\nimport { PageType } from '@mintlify/models';\nimport {\n DeploymentEntitlements,\n GitSource,\n DeploymentFeedbackType,\n DocsConfig,\n DecoratedNavigationConfig,\n TrieveType,\n DeploymentPreviewType,\n} from '@mintlify/validation';\nimport { createContext, ReactNode } from 'react';\n\nimport { addApiReferenceDataFromMdxAndDocsConfig } from '@/api-playground-2/schemaGraph/addApiReferenceDataFromMdxAndDocsConfig';\nimport { processSecurityOptions } from '@/api-playground-2/schemaGraph/processSecurityOptions';\nimport type { ApiReferenceDataV2 } from '@/api-playground-2/types';\nimport { ApiReferenceData } from '../utils/api-reference/getApiReferenceData';\n\nexport type PageContextType = {\n pageMetadata: PageMetaTags;\n pageType?: PageType;\n mdxExtracts?: MdxExtracts;\n description?: SerializeSuccess | string | null;\n panelMdxSource?: SerializeSuccess;\n panelMdxSourceWithNoJs?: SerializeSuccess;\n};\n\nexport type DeploymentMetadataContextType = {\n subdomain?: string;\n actualSubdomain?: string;\n gitSource?: GitSource;\n inkeep?: InkeepType;\n trieve?: TrieveType;\n feedback?: DeploymentFeedbackType;\n entitlements?: DeploymentEntitlements;\n buildId?: string;\n clientVersion?: string;\n preview?: DeploymentPreviewType;\n};\n\nexport type DocsConfigContextType = {\n mintConfig?: MintConfig;\n docsConfig?: DocsConfig;\n docsNavWithMetadata?: DecoratedNavigationConfig;\n};\n\nexport type ApiReferenceContextType = {\n apiReferenceData: ApiReferenceData;\n};\n\nexport type ApiReferenceContext2Type = {\n apiReferenceData2: ApiReferenceDataV2;\n};\n\nexport const PageContext = createContext<PageContextType>({ pageMetadata: {} });\n\nexport const DeploymentMetadataContext = createContext<DeploymentMetadataContextType>({});\n\nexport const DocsConfigContext = createContext<DocsConfigContextType>({});\n\nexport const ApiReferenceContext = createContext<ApiReferenceContextType>({ apiReferenceData: {} });\n\nexport const ApiReferenceContext2 = createContext<ApiReferenceContext2Type>({\n apiReferenceData2: {},\n});\n\nPageContext.displayName = 'PageContext';\nDeploymentMetadataContext.displayName = 'DeploymentMetadataContext';\nDocsConfigContext.displayName = 'DocsConfigContext';\nApiReferenceContext.displayName = 'ApiReferenceContext';\n\nexport function PageProvider({ value, children }: { value: PageContextType; children: ReactNode }) {\n return <PageContext.Provider value={value}>{children}</PageContext.Provider>;\n}\n\nexport function DeploymentMetadataProvider({\n value,\n children,\n}: {\n value: DeploymentMetadataContextType;\n children: ReactNode;\n}) {\n return (\n <DeploymentMetadataContext.Provider value={value}>\n {children}\n </DeploymentMetadataContext.Provider>\n );\n}\n\nexport function DocsConfigProvider({\n value,\n children,\n}: {\n value: DocsConfigContextType;\n children: ReactNode;\n}) {\n return <DocsConfigContext.Provider value={value}>{children}</DocsConfigContext.Provider>;\n}\n\nexport function ApiReferenceProvider({\n value,\n children,\n}: {\n value: ApiReferenceContextType;\n children: ReactNode;\n}) {\n return <ApiReferenceContext.Provider value={value}>{children}</ApiReferenceContext.Provider>;\n}\n\nexport function ApiReferenceProvider2({\n pageMetadata,\n docsConfig,\n mdxExtracts,\n apiReferenceData2,\n children,\n}: {\n pageMetadata: PageMetaTags;\n docsConfig: DocsConfig | undefined;\n mdxExtracts: MdxExtracts | undefined;\n apiReferenceData2: ApiReferenceDataV2 | undefined;\n children: ReactNode;\n}) {\n // combine apiReferenceData2 from page props with mdxExtracts and docsConfig so we don't\n // have to go hunting per component for things that can come from other sources\n const apiReferenceDataFromPageProps = apiReferenceData2;\n\n const apiReferenceDataWithMdxAndDocsConfig = addApiReferenceDataFromMdxAndDocsConfig({\n apiReferenceData2: apiReferenceDataFromPageProps,\n mdxExtracts,\n docsConfig,\n pageMetadata,\n });\n\n // after we have the apiReferenceDataWithMdxAndDocsConfig, we can process the security options - some may have come from docs config\n const processedSecurityOptions = processSecurityOptions(apiReferenceDataWithMdxAndDocsConfig);\n if (processedSecurityOptions.length > 0) {\n if (!apiReferenceDataWithMdxAndDocsConfig.dependencies) {\n apiReferenceDataWithMdxAndDocsConfig.dependencies = {\n servers: {},\n security: {},\n processedSecurityOptions: [],\n };\n }\n apiReferenceDataWithMdxAndDocsConfig.dependencies.processedSecurityOptions =\n processedSecurityOptions;\n }\n\n const filteredApiReferenceData = apiReferenceDataWithMdxAndDocsConfig;\n return (\n <ApiReferenceContext2.Provider value={{ apiReferenceData2: filteredApiReferenceData ?? {} }}>\n {children}\n </ApiReferenceContext2.Provider>\n );\n}\n"],"names":["PageContext","createContext","DeploymentMetadataContext","DocsConfigContext","ApiReferenceContext","ApiReferenceContext2"],"mappings":";;;AA0DO,MAAMA,IAAcC,EAA+B,EAAE,cAAc,IAAI,GAEjEC,IAA4BD,EAA6C,CAAA,CAAE,GAE3EE,IAAoBF,EAAqC,CAAA,CAAE,GAE3DG,IAAsBH,EAAuC,EAAE,kBAAkB,IAAI,GAErFI,IAAuBJ,EAAwC;AAAA,EAC1E,mBAAmB,CAAA;AACrB,CAAC;AAEDD,EAAY,cAAc;AAC1BE,EAA0B,cAAc;AACxCC,EAAkB,cAAc;AAChCC,EAAoB,cAAc;"}
|