@mintlify/msft-sdk 1.1.10 → 1.1.11
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/code-block.js +1 -1
- package/dist/components/content-components/code-block.js.map +1 -1
- package/dist/components/content-components/default-components.js +21 -26
- package/dist/components/content-components/default-components.js.map +1 -1
- package/dist/components/content-components/details/details.js +1 -1
- package/dist/components/content-components/details/details.js.map +1 -1
- package/dist/components/content-components/image.js +80 -0
- package/dist/components/content-components/image.js.map +1 -0
- package/dist/components/content-components/param-name.js +1 -1
- package/dist/components/content-components/param-name.js.map +1 -1
- package/dist/components/nav-tree/index.js +77 -132
- package/dist/components/nav-tree/index.js.map +1 -1
- package/dist/components/nav-tree/mobile-nav.js +21 -23
- package/dist/components/nav-tree/mobile-nav.js.map +1 -1
- package/dist/components/page.js +33 -35
- package/dist/components/page.js.map +1 -1
- package/dist/components/toc/index.js +1 -1
- package/dist/components/toc/index.js.map +1 -1
- package/dist/index.d.ts +3 -41
- package/dist/index.js +100 -104
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/Api/Api.js +0 -42
- package/dist/components/Api/Api.js.map +0 -1
- package/dist/components/Api/Api.module.css.js +0 -22
- package/dist/components/Api/Api.module.css.js.map +0 -1
- package/dist/components/nav-tree/dropdown-menu.js +0 -75
- package/dist/components/nav-tree/dropdown-menu.js.map +0 -1
|
@@ -98,7 +98,7 @@ function W({
|
|
|
98
98
|
className: v ? "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" : void 0,
|
|
99
99
|
children: [
|
|
100
100
|
i && /* @__PURE__ */ r("span", { className: "mint:text-sm mint:font-medium mint:px-2", children: i }),
|
|
101
|
-
/* @__PURE__ */ x("div", { className: "
|
|
101
|
+
/* @__PURE__ */ x("div", { className: "not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]", children: [
|
|
102
102
|
/* @__PURE__ */ x("div", { className: "mint:flex mint:items-center mint:justify-between mint:px-3 mint:pt-2", children: [
|
|
103
103
|
/* @__PURE__ */ r("span", { className: "mint:text-xs mint:font-medium mint:text-[#737373] mint:dark:text-[#a3a3a3]", children: A(s) }),
|
|
104
104
|
/* @__PURE__ */ r(F, { onClick: N, isCopied: u })
|
|
@@ -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 {fileName && (\n <span className=\"mint:text-sm mint:font-medium mint:px-2\">\n {fileName}\n </span>\n )}\n <div className=\"mint:not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]\">\n <div className=\"mint:flex mint:items-center mint:justify-between mint:px-3 mint:pt-2\">\n <span className=\"mint:text-xs mint:font-medium mint:text-[#737373] mint:dark:text-[#a3a3a3]\">\n {capitalize(lang)}\n </span>\n <CopyIconButton onClick={handleCopy} isCopied={isCopied} />\n </div>\n <div className=\"mint:code-scrollbar mint:overflow-x-auto\">\n <pre className=\"mint:px-3 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","CodeBlock","children","className","fileName","language","highlightedCode","setHighlightedCode","copyBlob","lang","codeText","getNodeText","showContainer","isSSRHighlighted","React","childrenArray","child","_a","codeChildren","codeChild","_b","useEffect","grammar","Prism","html","handleCopy","capitalize","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,UAAA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;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 // 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 {fileName && (\n <span className=\"mint:text-sm mint:font-medium mint:px-2\">\n {fileName}\n </span>\n )}\n <div className=\"not-prose mint:relative mint:rounded-xl mint:bg-[#f5f5f5] mint:dark:bg-[#141414]\">\n <div className=\"mint:flex mint:items-center mint:justify-between mint:px-3 mint:pt-2\">\n <span className=\"mint:text-xs mint:font-medium mint:text-[#737373] mint:dark:text-[#a3a3a3]\">\n {capitalize(lang)}\n </span>\n <CopyIconButton onClick={handleCopy} isCopied={isCopied} />\n </div>\n <div className=\"mint:code-scrollbar mint:overflow-x-auto\">\n <pre className=\"mint:px-3 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","CodeBlock","children","className","fileName","language","highlightedCode","setHighlightedCode","copyBlob","lang","codeText","getNodeText","showContainer","isSSRHighlighted","React","childrenArray","child","_a","codeChildren","codeChild","_b","useEffect","grammar","Prism","html","handleCopy","capitalize","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,YAAA,GACpBG,IAAU,IAAI,KAAK,CAACD,CAAM,GAAG,EAAE,MAAMD,GAAa,GAClDG,IAAgB,IAAI,cAAc;AAAA,UACtC,CAACH,CAAW,GAAGE;AAAA,QAA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AAK,WAAU,2CACb,UAAAM,GACH;AAAA,QAEF,gBAAAP,EAAC,OAAA,EAAI,WAAU,oFACb,UAAA;AAAA,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,wEACb,UAAA;AAAA,YAAA,gBAAAC,EAAC,QAAA,EAAK,WAAU,8EACb,UAAA4B,EAAWjB,CAAI,GAClB;AAAA,YACA,gBAAAX,EAACJ,GAAA,EAAe,SAAS+B,GAAY,UAAA3C,EAAA,CAAoB;AAAA,UAAA,GAC3D;AAAA,UACA,gBAAAgB,EAAC,SAAI,WAAU,4CACb,4BAAC,OAAA,EAAI,WAAU,2EACZ,UAAAe,IACC,gBAAAf;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW6B;AAAA,gBACT,YAAYlB,CAAI;AAAA,gBAChB;AAAA,cAAA;AAAA,cAGD,UAAAP;AAAA,YAAA;AAAA,UAAA,IAEDI,IACF,gBAAAR;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW6B;AAAA,gBACT,YAAYlB,CAAI;AAAA,gBAChB;AAAA,cAAA;AAAA,cAEF,yBAAyB,EAAE,QAAQH,EAAA;AAAA,YAAgB;AAAA,UAAA,IAGrD,gBAAAR;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAW6B;AAAA,gBACT,YAAYlB,CAAI;AAAA,gBAChB;AAAA,cAAA;AAAA,cAGD,UAAAC;AAAA,YAAA;AAAA,UAAA,GAGP,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, Fragment as l } from "react/jsx-runtime";
|
|
2
2
|
import { TableBody as s, TableHeader as d, TableRow as p, TableCell as b, TableHead as f, Table as u } from "./table/index.js";
|
|
3
3
|
import { cn as r } from "../../utils/cn.js";
|
|
4
4
|
import { allComponents as c } from "./all-components.js";
|
|
5
|
+
import { Image as g } from "./image.js";
|
|
5
6
|
import { Link as h } from "./link.js";
|
|
6
7
|
import { Heading as o } from "./heading.js";
|
|
7
|
-
import { Summary as
|
|
8
|
-
function
|
|
8
|
+
import { Summary as k, Details as _ } from "./details/details.js";
|
|
9
|
+
function y(i = {}) {
|
|
9
10
|
const { LinkComponent: m } = i;
|
|
10
11
|
return {
|
|
11
|
-
h1: (
|
|
12
|
-
h2: (
|
|
13
|
-
h3: (
|
|
14
|
-
h4: (
|
|
15
|
-
h5: (
|
|
16
|
-
h6: (
|
|
17
|
-
code: ({ className:
|
|
12
|
+
h1: (e) => /* @__PURE__ */ t(o, { level: 1, ...e }),
|
|
13
|
+
h2: (e) => /* @__PURE__ */ t(o, { level: 2, ...e }),
|
|
14
|
+
h3: (e) => /* @__PURE__ */ t(o, { level: 3, ...e }),
|
|
15
|
+
h4: (e) => /* @__PURE__ */ t(o, { level: 4, ...e }),
|
|
16
|
+
h5: (e) => /* @__PURE__ */ t(o, { level: 5, ...e }),
|
|
17
|
+
h6: (e) => /* @__PURE__ */ t(o, { level: 6, ...e }),
|
|
18
|
+
code: ({ className: e, children: n, ...a }) => e ? n : /* @__PURE__ */ t(
|
|
18
19
|
"code",
|
|
19
20
|
{
|
|
20
21
|
className: r(
|
|
@@ -24,39 +25,33 @@ function _(i = {}) {
|
|
|
24
25
|
children: n
|
|
25
26
|
}
|
|
26
27
|
),
|
|
27
|
-
pre: ({ children:
|
|
28
|
+
pre: ({ children: e }) => /* @__PURE__ */ t(l, { children: e }),
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
a: m ? (
|
|
30
|
-
blockquote: (
|
|
30
|
+
a: m ? (e) => /* @__PURE__ */ t(m, { ...e }) : h,
|
|
31
|
+
blockquote: (e) => /* @__PURE__ */ t(
|
|
31
32
|
"blockquote",
|
|
32
33
|
{
|
|
33
34
|
className: r(
|
|
34
35
|
"not-prose mint:border-l-4 mint:border-gray-200 mint:pl-6 mint:mb-4 mint:dark:border-l-white/20"
|
|
35
36
|
),
|
|
36
|
-
...
|
|
37
|
-
}
|
|
38
|
-
),
|
|
39
|
-
img: (t) => /* @__PURE__ */ e(
|
|
40
|
-
"img",
|
|
41
|
-
{
|
|
42
|
-
className: "mint:max-w-full mint:h-auto mint:object-contain",
|
|
43
|
-
...t
|
|
37
|
+
...e
|
|
44
38
|
}
|
|
45
39
|
),
|
|
40
|
+
img: g,
|
|
46
41
|
table: u,
|
|
47
42
|
th: f,
|
|
48
43
|
td: b,
|
|
49
44
|
tr: p,
|
|
50
45
|
thead: d,
|
|
51
46
|
tbody: s,
|
|
52
|
-
details:
|
|
53
|
-
summary:
|
|
47
|
+
details: _,
|
|
48
|
+
summary: k,
|
|
54
49
|
...c
|
|
55
50
|
};
|
|
56
51
|
}
|
|
57
|
-
const
|
|
52
|
+
const D = y();
|
|
58
53
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
y as createDefaultComponents,
|
|
55
|
+
D as defaultComponents
|
|
61
56
|
};
|
|
62
57
|
//# sourceMappingURL=default-components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-components.js","sources":["../../../src/components/content-components/default-components.tsx"],"sourcesContent":["import { Details, Heading, Link, Summary, allComponents } from \".\";\nimport type { MDXComponents, LinkComponent } from \"../../types\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"./table\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface CreateDefaultComponentsOptions {\n LinkComponent?: LinkComponent;\n}\n\nexport function createDefaultComponents(\n options: CreateDefaultComponentsOptions = {}\n): MDXComponents {\n const { LinkComponent: CustomLink } = options;\n\n return {\n h1: (props) => <Heading level={1} {...props} />,\n h2: (props) => <Heading level={2} {...props} />,\n h3: (props) => <Heading level={3} {...props} />,\n h4: (props) => <Heading level={4} {...props} />,\n h5: (props) => <Heading level={5} {...props} />,\n h6: (props) => <Heading level={6} {...props} />,\n code: ({ className, children, ...props }) => {\n const isInline = !className;\n if (isInline) {\n return (\n <code\n className={cn(\n \"not-prose mint:font-medium mint:font-mono mint:text-sm mint:bg-gray-100 mint:shadow-[0_0_0_1px_rgba(156,163,175,0.3)] mint:px-1.5 mint:py-0.5 mint:rounded mint:dark:bg-[#1f1f1f] mint:dark:shadow-[0_0_0_1px_rgba(55,65,81,0.5)]\"\n )}\n {...props}\n >\n {children}\n </code>\n );\n }\n return children;\n },\n pre: ({ children }) => <>{children}</>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n a: CustomLink ? (props: any) => <CustomLink {...props} /> : Link,\n blockquote: (props) => (\n <blockquote\n className={cn(\n \"not-prose mint:border-l-4 mint:border-gray-200 mint:pl-6 mint:mb-4 mint:dark:border-l-white/20\"\n )}\n {...props}\n />\n ),\n img:
|
|
1
|
+
{"version":3,"file":"default-components.js","sources":["../../../src/components/content-components/default-components.tsx"],"sourcesContent":["import { Details, Heading, Link, Summary, allComponents, Image } from \".\";\nimport type { MDXComponents, LinkComponent } from \"../../types\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from \"./table\";\nimport { cn } from \"../../utils/cn\";\n\nexport interface CreateDefaultComponentsOptions {\n LinkComponent?: LinkComponent;\n}\n\nexport function createDefaultComponents(\n options: CreateDefaultComponentsOptions = {}\n): MDXComponents {\n const { LinkComponent: CustomLink } = options;\n\n return {\n h1: (props) => <Heading level={1} {...props} />,\n h2: (props) => <Heading level={2} {...props} />,\n h3: (props) => <Heading level={3} {...props} />,\n h4: (props) => <Heading level={4} {...props} />,\n h5: (props) => <Heading level={5} {...props} />,\n h6: (props) => <Heading level={6} {...props} />,\n code: ({ className, children, ...props }) => {\n const isInline = !className;\n if (isInline) {\n return (\n <code\n className={cn(\n \"not-prose mint:font-medium mint:font-mono mint:text-sm mint:bg-gray-100 mint:shadow-[0_0_0_1px_rgba(156,163,175,0.3)] mint:px-1.5 mint:py-0.5 mint:rounded mint:dark:bg-[#1f1f1f] mint:dark:shadow-[0_0_0_1px_rgba(55,65,81,0.5)]\"\n )}\n {...props}\n >\n {children}\n </code>\n );\n }\n return children;\n },\n pre: ({ children }) => <>{children}</>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n a: CustomLink ? (props: any) => <CustomLink {...props} /> : Link,\n blockquote: (props) => (\n <blockquote\n className={cn(\n \"not-prose mint:border-l-4 mint:border-gray-200 mint:pl-6 mint:mb-4 mint:dark:border-l-white/20\"\n )}\n {...props}\n />\n ),\n img: Image,\n table: Table,\n th: TableHead,\n td: TableCell,\n tr: TableRow,\n thead: TableHeader,\n tbody: TableBody,\n details: Details,\n summary: Summary,\n ...allComponents,\n };\n}\n\n// Export as default for backward compatibility\nexport const defaultComponents: MDXComponents = createDefaultComponents();\n"],"names":["createDefaultComponents","options","CustomLink","props","jsx","Heading","className","children","cn","Link","Image","Table","TableHead","TableCell","TableRow","TableHeader","TableBody","Details","Summary","allComponents","defaultComponents"],"mappings":";;;;;;;;AAgBO,SAASA,EACdC,IAA0C,IAC3B;AACf,QAAM,EAAE,eAAeC,EAAA,IAAeD;AAEtC,SAAO;AAAA,IACL,IAAI,CAACE,MAAU,gBAAAC,EAACC,KAAQ,OAAO,GAAI,GAAGF,GAAO;AAAA,IAC7C,IAAI,CAACA,MAAU,gBAAAC,EAACC,KAAQ,OAAO,GAAI,GAAGF,GAAO;AAAA,IAC7C,IAAI,CAACA,MAAU,gBAAAC,EAACC,KAAQ,OAAO,GAAI,GAAGF,GAAO;AAAA,IAC7C,IAAI,CAACA,MAAU,gBAAAC,EAACC,KAAQ,OAAO,GAAI,GAAGF,GAAO;AAAA,IAC7C,IAAI,CAACA,MAAU,gBAAAC,EAACC,KAAQ,OAAO,GAAI,GAAGF,GAAO;AAAA,IAC7C,IAAI,CAACA,MAAU,gBAAAC,EAACC,KAAQ,OAAO,GAAI,GAAGF,GAAO;AAAA,IAC7C,MAAM,CAAC,EAAE,WAAAG,GAAW,UAAAC,GAAU,GAAGJ,QACbG,IAaXC,IAVH,gBAAAH;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWI;AAAA,UACT;AAAA,QAAA;AAAA,QAED,GAAGL;AAAA,QAEH,UAAAI;AAAA,MAAA;AAAA,IAAA;AAAA,IAMT,KAAK,CAAC,EAAE,UAAAA,EAAA,6BAAkB,UAAAA,GAAS;AAAA;AAAA,IAEnC,GAAGL,IAAa,CAACC,wBAAgBD,GAAA,EAAY,GAAGC,GAAO,IAAKM;AAAA,IAC5D,YAAY,CAACN,MACX,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWI;AAAA,UACT;AAAA,QAAA;AAAA,QAED,GAAGL;AAAA,MAAA;AAAA,IAAA;AAAA,IAGR,KAAKO;AAAA,IACL,OAAOC;AAAA,IACP,IAAIC;AAAA,IACJ,IAAIC;AAAA,IACJ,IAAIC;AAAA,IACJ,OAAOC;AAAA,IACP,OAAOC;AAAA,IACP,SAASC;AAAA,IACT,SAASC;AAAA,IACT,GAAGC;AAAA,EAAA;AAEP;AAGO,MAAMC,IAAmCpB,EAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"details.js","sources":["../../../../src/components/content-components/details/details.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { ChevronDown16Regular } from \"@fluentui/react-icons\";\nimport { cn } from \"../../../utils/cn\";\n\ninterface DetailsProps {\n children: React.ReactNode;\n open?: boolean;\n}\n\nexport function Details({ children, open = false }: DetailsProps) {\n const [isOpen, setIsOpen] = useState(open);\n\n const summaryChild = React.Children.toArray(children).find(\n (child) => React.isValidElement(child) && child.type === Summary\n );\n\n const otherChildren = React.Children.toArray(children).filter(\n (child) => !(React.isValidElement(child) && child.type === Summary)\n );\n\n return (\n <details\n open={isOpen}\n onToggle={(e) => setIsOpen(e.currentTarget.open)}\n className=\"mint:my-4 mint:border mint:border-gray-200 mint:rounded-lg mint:overflow-hidden mint:dark:border-white/10\"\n >\n {summaryChild &&\n React.isValidElement(summaryChild) &&\n React.cloneElement(\n summaryChild as React.ReactElement<\n SummaryProps & { isOpen?: boolean }\n >,\n { isOpen }\n )}\n {isOpen && otherChildren.length > 0 && (\n <div className=\"mint:px-3 mint:py-2 mint:pb-4 mint:border-t mint:border-gray-200 mint:dark:border-t-white/10\">\n {otherChildren}\n </div>\n )}\n </details>\n );\n}\n\ninterface SummaryProps {\n children: React.ReactNode;\n isOpen?: boolean;\n}\n\nexport function Summary({ children, isOpen }: SummaryProps) {\n return (\n <summary className=\"mint:flex mint:items-center mint:gap-2 mint:px-3 mint:py-2 mint:cursor-pointer mint:list-none mint:text-sm mint:font-semibold mint:text-gray-900 mint:hover:bg-gray-50 mint:dark:text-white mint:dark:hover:bg-white/5\">\n <ChevronDown16Regular\n className={cn(\n \"mint:transition-transform mint:duration-150 mint:shrink-0\",\n isOpen ? \"mint:rotate-0\" : \"mint:-rotate-90\"\n )}\n />\n <span className=\"mint:flex-1
|
|
1
|
+
{"version":3,"file":"details.js","sources":["../../../../src/components/content-components/details/details.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { ChevronDown16Regular } from \"@fluentui/react-icons\";\nimport { cn } from \"../../../utils/cn\";\n\ninterface DetailsProps {\n children: React.ReactNode;\n open?: boolean;\n}\n\nexport function Details({ children, open = false }: DetailsProps) {\n const [isOpen, setIsOpen] = useState(open);\n\n const summaryChild = React.Children.toArray(children).find(\n (child) => React.isValidElement(child) && child.type === Summary\n );\n\n const otherChildren = React.Children.toArray(children).filter(\n (child) => !(React.isValidElement(child) && child.type === Summary)\n );\n\n return (\n <details\n open={isOpen}\n onToggle={(e) => setIsOpen(e.currentTarget.open)}\n className=\"mint:my-4 mint:border mint:border-gray-200 mint:rounded-lg mint:overflow-hidden mint:dark:border-white/10\"\n >\n {summaryChild &&\n React.isValidElement(summaryChild) &&\n React.cloneElement(\n summaryChild as React.ReactElement<\n SummaryProps & { isOpen?: boolean }\n >,\n { isOpen }\n )}\n {isOpen && otherChildren.length > 0 && (\n <div className=\"mint:px-3 mint:py-2 mint:pb-4 mint:border-t mint:border-gray-200 mint:dark:border-t-white/10\">\n {otherChildren}\n </div>\n )}\n </details>\n );\n}\n\ninterface SummaryProps {\n children: React.ReactNode;\n isOpen?: boolean;\n}\n\nexport function Summary({ children, isOpen }: SummaryProps) {\n return (\n <summary className=\"mint:flex mint:items-center mint:gap-2 mint:px-3 mint:py-2 mint:cursor-pointer mint:list-none mint:text-sm mint:font-semibold mint:text-gray-900 mint:hover:bg-gray-50 mint:dark:text-white mint:dark:hover:bg-white/5\">\n <ChevronDown16Regular\n className={cn(\n \"mint:transition-transform mint:duration-150 mint:shrink-0\",\n isOpen ? \"mint:rotate-0\" : \"mint:-rotate-90\"\n )}\n />\n <span className=\"mint:flex-1 not-prose\">{children}</span>\n </summary>\n );\n}\n"],"names":["Details","children","open","isOpen","setIsOpen","useState","summaryChild","React","child","Summary","otherChildren","jsxs","e","jsx","ChevronDown16Regular","cn"],"mappings":";;;;AASO,SAASA,EAAQ,EAAE,UAAAC,GAAU,MAAAC,IAAO,MAAuB;AAChE,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAASH,CAAI,GAEnCI,IAAeC,EAAM,SAAS,QAAQN,CAAQ,EAAE;AAAA,IACpD,CAACO,MAAUD,EAAM,eAAeC,CAAK,KAAKA,EAAM,SAASC;AAAA,EAAA,GAGrDC,IAAgBH,EAAM,SAAS,QAAQN,CAAQ,EAAE;AAAA,IACrD,CAACO,MAAU,EAAED,EAAM,eAAeC,CAAK,KAAKA,EAAM,SAASC;AAAA,EAAA;AAG7D,SACE,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAMR;AAAA,MACN,UAAU,CAACS,MAAMR,EAAUQ,EAAE,cAAc,IAAI;AAAA,MAC/C,WAAU;AAAA,MAET,UAAA;AAAA,QAAAN,KACCC,EAAM,eAAeD,CAAY,KACjCC,EAAM;AAAA,UACJD;AAAA,UAGA,EAAE,QAAAH,EAAA;AAAA,QAAO;AAAA,QAEZA,KAAUO,EAAc,SAAS,uBAC/B,OAAA,EAAI,WAAU,gGACZ,UAAAA,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;AAOO,SAASD,EAAQ,EAAE,UAAAR,GAAU,QAAAE,KAAwB;AAC1D,SACE,gBAAAQ,EAAC,WAAA,EAAQ,WAAU,0NACjB,UAAA;AAAA,IAAA,gBAAAE;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,WAAWC;AAAA,UACT;AAAA,UACAZ,IAAS,kBAAkB;AAAA,QAAA;AAAA,MAC7B;AAAA,IAAA;AAAA,IAEF,gBAAAU,EAAC,QAAA,EAAK,WAAU,yBAAyB,UAAAZ,EAAA,CAAS;AAAA,EAAA,GACpD;AAEJ;"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsxs as d, Fragment as u, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useRef as o, useEffect as r } from "react";
|
|
3
|
+
import { cn as v } from "../../utils/cn.js";
|
|
4
|
+
function w({ isOpen: e, onClose: n, src: i, alt: m }) {
|
|
5
|
+
const c = o(null), a = o(null);
|
|
6
|
+
return r(() => {
|
|
7
|
+
var t;
|
|
8
|
+
return e ? (a.current = document.activeElement, document.body.style.overflow = "hidden") : (document.body.style.overflow = "unset", (t = a.current) == null || t.focus()), () => {
|
|
9
|
+
document.body.style.overflow = "unset";
|
|
10
|
+
};
|
|
11
|
+
}, [e]), r(() => {
|
|
12
|
+
const t = (s) => {
|
|
13
|
+
s.key === "Escape" && n();
|
|
14
|
+
};
|
|
15
|
+
return e && window.addEventListener("keydown", t), () => {
|
|
16
|
+
window.removeEventListener("keydown", t);
|
|
17
|
+
};
|
|
18
|
+
}, [e, n]), e ? /* @__PURE__ */ l(
|
|
19
|
+
"div",
|
|
20
|
+
{
|
|
21
|
+
className: "mint:fixed mint:inset-0 mint:flex mint:items-center mint:justify-center mint:p-4 mint:bg-black/80 mint:backdrop-blur-sm",
|
|
22
|
+
onClick: n,
|
|
23
|
+
role: "dialog",
|
|
24
|
+
"aria-modal": "true",
|
|
25
|
+
"aria-label": "Expanded image view",
|
|
26
|
+
style: { zIndex: 9999 },
|
|
27
|
+
children: /* @__PURE__ */ l(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
ref: c,
|
|
31
|
+
className: "mint:relative mint:max-w-[95vw] mint:max-h-[95vh] mint:flex mint:items-center mint:justify-center",
|
|
32
|
+
onClick: (t) => t.stopPropagation(),
|
|
33
|
+
children: /* @__PURE__ */ l(
|
|
34
|
+
"img",
|
|
35
|
+
{
|
|
36
|
+
src: i,
|
|
37
|
+
alt: m,
|
|
38
|
+
className: "mint:max-w-full mint:max-h-[95vh] mint:object-contain mint:rounded-lg"
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
) : null;
|
|
45
|
+
}
|
|
46
|
+
function g(e) {
|
|
47
|
+
const [n, i] = f(!1);
|
|
48
|
+
return /* @__PURE__ */ d(u, { children: [
|
|
49
|
+
/* @__PURE__ */ l(
|
|
50
|
+
"img",
|
|
51
|
+
{
|
|
52
|
+
...e,
|
|
53
|
+
className: v(
|
|
54
|
+
"mint:max-w-full mint:h-auto mint:object-contain mint:cursor-zoom-in mint:rounded-lg",
|
|
55
|
+
e.className
|
|
56
|
+
),
|
|
57
|
+
onClick: () => i(!0),
|
|
58
|
+
onKeyDown: (m) => {
|
|
59
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), i(!0));
|
|
60
|
+
},
|
|
61
|
+
tabIndex: 0,
|
|
62
|
+
role: "button",
|
|
63
|
+
"aria-label": `${e.alt || "Image"} - Click to enlarge`
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
e.src && /* @__PURE__ */ l(
|
|
67
|
+
w,
|
|
68
|
+
{
|
|
69
|
+
isOpen: n,
|
|
70
|
+
onClose: () => i(!1),
|
|
71
|
+
src: e.src,
|
|
72
|
+
alt: e.alt || ""
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] });
|
|
76
|
+
}
|
|
77
|
+
export {
|
|
78
|
+
g as Image
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.js","sources":["../../../src/components/content-components/image.tsx"],"sourcesContent":["import React, { useState, useEffect, useRef } from \"react\";\nimport { cn } from \"../../utils/cn\";\n\ninterface ImageModalProps {\n isOpen: boolean;\n onClose: () => void;\n src: string;\n alt: string;\n}\n\nfunction ImageModal({ isOpen, onClose, src, alt }: ImageModalProps) {\n const modalRef = useRef<HTMLDivElement>(null);\n const previousActiveElement = useRef<HTMLElement | null>(null);\n\n useEffect(() => {\n if (isOpen) {\n previousActiveElement.current = document.activeElement as HTMLElement;\n document.body.style.overflow = \"hidden\";\n } else {\n document.body.style.overflow = \"unset\";\n previousActiveElement.current?.focus();\n }\n\n return () => {\n document.body.style.overflow = \"unset\";\n };\n }, [isOpen]);\n\n useEffect(() => {\n const handleEscape = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n onClose();\n }\n };\n\n if (isOpen) {\n window.addEventListener(\"keydown\", handleEscape);\n }\n\n return () => {\n window.removeEventListener(\"keydown\", handleEscape);\n };\n }, [isOpen, onClose]);\n\n if (!isOpen) return null;\n\n return (\n <div\n className=\"mint:fixed mint:inset-0 mint:flex mint:items-center mint:justify-center mint:p-4 mint:bg-black/80 mint:backdrop-blur-sm\"\n onClick={onClose}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Expanded image view\"\n style={{ zIndex: 9999 }}\n >\n <div\n ref={modalRef}\n className=\"mint:relative mint:max-w-[95vw] mint:max-h-[95vh] mint:flex mint:items-center mint:justify-center\"\n onClick={(e) => e.stopPropagation()}\n >\n <img\n src={src}\n alt={alt}\n className=\"mint:max-w-full mint:max-h-[95vh] mint:object-contain mint:rounded-lg\"\n />\n </div>\n </div>\n );\n}\n\nexport function Image(props: React.ImgHTMLAttributes<HTMLImageElement>) {\n const [isModalOpen, setIsModalOpen] = useState(false);\n\n return (\n <>\n <img\n {...props}\n className={cn(\n \"mint:max-w-full mint:h-auto mint:object-contain mint:cursor-zoom-in mint:rounded-lg\",\n props.className\n )}\n onClick={() => setIsModalOpen(true)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n setIsModalOpen(true);\n }\n }}\n tabIndex={0}\n role=\"button\"\n aria-label={`${props.alt || \"Image\"} - Click to enlarge`}\n />\n {props.src && (\n <ImageModal\n isOpen={isModalOpen}\n onClose={() => setIsModalOpen(false)}\n src={props.src}\n alt={props.alt || \"\"}\n />\n )}\n </>\n );\n}\n"],"names":["ImageModal","isOpen","onClose","src","alt","modalRef","useRef","previousActiveElement","useEffect","_a","handleEscape","e","jsx","Image","props","isModalOpen","setIsModalOpen","useState","jsxs","Fragment","cn"],"mappings":";;;AAUA,SAASA,EAAW,EAAE,QAAAC,GAAQ,SAAAC,GAAS,KAAAC,GAAK,KAAAC,KAAwB;AAClE,QAAMC,IAAWC,EAAuB,IAAI,GACtCC,IAAwBD,EAA2B,IAAI;AAgC7D,SA9BAE,EAAU,MAAM;;AACd,WAAIP,KACFM,EAAsB,UAAU,SAAS,eACzC,SAAS,KAAK,MAAM,WAAW,aAE/B,SAAS,KAAK,MAAM,WAAW,UAC/BE,IAAAF,EAAsB,YAAtB,QAAAE,EAA+B,UAG1B,MAAM;AACX,eAAS,KAAK,MAAM,WAAW;AAAA,IACjC;AAAA,EACF,GAAG,CAACR,CAAM,CAAC,GAEXO,EAAU,MAAM;AACd,UAAME,IAAe,CAACC,MAAqB;AACzC,MAAIA,EAAE,QAAQ,YACZT,EAAA;AAAA,IAEJ;AAEA,WAAID,KACF,OAAO,iBAAiB,WAAWS,CAAY,GAG1C,MAAM;AACX,aAAO,oBAAoB,WAAWA,CAAY;AAAA,IACpD;AAAA,EACF,GAAG,CAACT,GAAQC,CA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 -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
function i({ children: n }) {
|
|
3
|
-
return /* @__PURE__ */ m("span", { className: "
|
|
3
|
+
return /* @__PURE__ */ m("span", { className: "not-prose mint:inline-block mint:mt-2 mint:mr-1 mint:px-1.5 mint:py-0.5 mint:text-sm mint:font-semibold mint:font-mono mint:rounded mint:bg-gray-100 mint:dark:bg-[#2d2d2d]", children: n });
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
i as ParamName
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"param-name.js","sources":["../../../src/components/content-components/param-name.tsx"],"sourcesContent":["import { cn } from \"../../utils/cn\";\ninterface ParamNameProps {\n children: React.ReactNode;\n}\n\nexport function ParamName({ children }: ParamNameProps) {\n return (\n <span className=\"
|
|
1
|
+
{"version":3,"file":"param-name.js","sources":["../../../src/components/content-components/param-name.tsx"],"sourcesContent":["import { cn } from \"../../utils/cn\";\ninterface ParamNameProps {\n children: React.ReactNode;\n}\n\nexport function ParamName({ children }: ParamNameProps) {\n return (\n <span className=\"not-prose mint:inline-block mint:mt-2 mint:mr-1 mint:px-1.5 mint:py-0.5 mint:text-sm mint:font-semibold mint:font-mono mint:rounded mint:bg-gray-100 mint:dark:bg-[#2d2d2d]\">\n {children}\n </span>\n );\n}\n"],"names":["ParamName","children","jsx"],"mappings":";AAKO,SAASA,EAAU,EAAE,UAAAC,KAA4B;AACtD,SACE,gBAAAC,EAAC,QAAA,EAAK,WAAU,+KACb,UAAAD,EAAA,CACH;AAEJ;"}
|