@multiplatform.one/markdown 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/cjs/Aside/index.cjs +112 -0
- package/dist/cjs/Aside/index.native.js +119 -0
- package/dist/cjs/Aside/index.native.js.map +1 -0
- package/dist/cjs/ExternalIcon/ExternalIcon.spec.cjs +37 -0
- package/dist/cjs/ExternalIcon/ExternalIcon.spec.native.js +40 -0
- package/dist/cjs/ExternalIcon/ExternalIcon.spec.native.js.map +1 -0
- package/dist/cjs/ExternalIcon/index.cjs +46 -0
- package/dist/cjs/ExternalIcon/index.native.js +51 -0
- package/dist/cjs/ExternalIcon/index.native.js.map +1 -0
- package/dist/cjs/Hr/hr.spec.cjs +21 -0
- package/dist/cjs/Hr/hr.spec.native.js +24 -0
- package/dist/cjs/Hr/hr.spec.native.js.map +1 -0
- package/dist/cjs/Hr/index.cjs +41 -0
- package/dist/cjs/Hr/index.native.js +46 -0
- package/dist/cjs/Hr/index.native.js.map +1 -0
- package/dist/cjs/Li/index.cjs +38 -0
- package/dist/cjs/Li/index.native.js +41 -0
- package/dist/cjs/Li/index.native.js.map +1 -0
- package/dist/cjs/Li/li.spec.cjs +45 -0
- package/dist/cjs/Li/li.spec.native.js +50 -0
- package/dist/cjs/Li/li.spec.native.js.map +1 -0
- package/dist/cjs/Markdown.cjs +66 -0
- package/dist/cjs/Markdown.native.js +71 -0
- package/dist/cjs/Markdown.native.js.map +1 -0
- package/dist/cjs/Markdown.stories.cjs +153 -0
- package/dist/cjs/Markdown.stories.native.js +162 -0
- package/dist/cjs/Markdown.stories.native.js.map +1 -0
- package/dist/cjs/Mdx/index.cjs +58 -0
- package/dist/cjs/Mdx/index.native.js +62 -0
- package/dist/cjs/Mdx/index.native.js.map +1 -0
- package/dist/cjs/Mdx/mdx.spec.cjs +139 -0
- package/dist/cjs/Mdx/mdx.spec.native.js +158 -0
- package/dist/cjs/Mdx/mdx.spec.native.js.map +1 -0
- package/dist/cjs/MdxCodeBlock/index.cjs +185 -0
- package/dist/cjs/MdxCodeBlock/index.native.js +205 -0
- package/dist/cjs/MdxCodeBlock/index.native.js.map +1 -0
- package/dist/cjs/MdxCodeBlock/mdxCodeBlock.spec.cjs +90 -0
- package/dist/cjs/MdxCodeBlock/mdxCodeBlock.spec.native.js +122 -0
- package/dist/cjs/MdxCodeBlock/mdxCodeBlock.spec.native.js.map +1 -0
- package/dist/cjs/MdxCodeBlock/mdxCodeBlockContext.cjs +29 -0
- package/dist/cjs/MdxCodeBlock/mdxCodeBlockContext.native.js +32 -0
- package/dist/cjs/MdxCodeBlock/mdxCodeBlockContext.native.js.map +1 -0
- package/dist/cjs/Notice/index.cjs +94 -0
- package/dist/cjs/Notice/index.native.js +98 -0
- package/dist/cjs/Notice/index.native.js.map +1 -0
- package/dist/cjs/SimpleTable/index.cjs +132 -0
- package/dist/cjs/SimpleTable/index.native.js +162 -0
- package/dist/cjs/SimpleTable/index.native.js.map +1 -0
- package/dist/cjs/Table/index.cjs +121 -0
- package/dist/cjs/Table/index.native.js +130 -0
- package/dist/cjs/Table/index.native.js.map +1 -0
- package/dist/cjs/Tabs/index.cjs +93 -0
- package/dist/cjs/Tabs/index.native.js +103 -0
- package/dist/cjs/Tabs/index.native.js.map +1 -0
- package/dist/cjs/Ul/index.cjs +35 -0
- package/dist/cjs/Ul/index.native.js +38 -0
- package/dist/cjs/Ul/index.native.js.map +1 -0
- package/dist/cjs/Ul/ul.spec.cjs +150 -0
- package/dist/cjs/Ul/ul.spec.native.js +153 -0
- package/dist/cjs/Ul/ul.spec.native.js.map +1 -0
- package/dist/cjs/Video/index.cjs +84 -0
- package/dist/cjs/Video/index.native.js +89 -0
- package/dist/cjs/Video/index.native.js.map +1 -0
- package/dist/cjs/components/Blockquote.cjs +47 -0
- package/dist/cjs/components/Blockquote.native.js +51 -0
- package/dist/cjs/components/Blockquote.native.js.map +1 -0
- package/dist/cjs/components/Break.cjs +34 -0
- package/dist/cjs/components/Break.native.js +37 -0
- package/dist/cjs/components/Break.native.js.map +1 -0
- package/dist/cjs/components/CodeBlock.cjs +109 -0
- package/dist/cjs/components/CodeBlock.native.js +119 -0
- package/dist/cjs/components/CodeBlock.native.js.map +1 -0
- package/dist/cjs/components/Heading.cjs +48 -0
- package/dist/cjs/components/Heading.native.js +52 -0
- package/dist/cjs/components/Heading.native.js.map +1 -0
- package/dist/cjs/components/HorizontalRule.cjs +34 -0
- package/dist/cjs/components/HorizontalRule.native.js +37 -0
- package/dist/cjs/components/HorizontalRule.native.js.map +1 -0
- package/dist/cjs/components/Image.cjs +53 -0
- package/dist/cjs/components/Image.native.js +57 -0
- package/dist/cjs/components/Image.native.js.map +1 -0
- package/dist/cjs/components/InlineCode.cjs +48 -0
- package/dist/cjs/components/InlineCode.native.js +52 -0
- package/dist/cjs/components/InlineCode.native.js.map +1 -0
- package/dist/cjs/components/InlineStyles.cjs +55 -0
- package/dist/cjs/components/InlineStyles.native.js +61 -0
- package/dist/cjs/components/InlineStyles.native.js.map +1 -0
- package/dist/cjs/components/Link.cjs +54 -0
- package/dist/cjs/components/Link.native.js +58 -0
- package/dist/cjs/components/Link.native.js.map +1 -0
- package/dist/cjs/components/List.cjs +74 -0
- package/dist/cjs/components/List.native.js +79 -0
- package/dist/cjs/components/List.native.js.map +1 -0
- package/dist/cjs/components/Paragraph.cjs +38 -0
- package/dist/cjs/components/Paragraph.native.js +42 -0
- package/dist/cjs/components/Paragraph.native.js.map +1 -0
- package/dist/cjs/components/Table.cjs +86 -0
- package/dist/cjs/components/Table.native.js +92 -0
- package/dist/cjs/components/Table.native.js.map +1 -0
- package/dist/cjs/components/index.cjs +55 -0
- package/dist/cjs/components/index.native.js +58 -0
- package/dist/cjs/components/index.native.js.map +1 -0
- package/dist/cjs/hooks/index.cjs +22 -0
- package/dist/cjs/hooks/index.native.js +25 -0
- package/dist/cjs/hooks/index.native.js.map +1 -0
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.cjs +42 -0
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.native.js +45 -0
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.native.js.map +1 -0
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.spec.cjs +34 -0
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.spec.native.js +49 -0
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.spec.native.js.map +1 -0
- package/dist/cjs/hooks/useCompileMdx.cjs +80 -0
- package/dist/cjs/hooks/useCompileMdx.native.js +83 -0
- package/dist/cjs/hooks/useCompileMdx.native.js.map +1 -0
- package/dist/cjs/hooks/useEvaluateMdx.cjs +58 -0
- package/dist/cjs/hooks/useEvaluateMdx.native.js +63 -0
- package/dist/cjs/hooks/useEvaluateMdx.native.js.map +1 -0
- package/dist/cjs/icons/index.cjs +205 -0
- package/dist/cjs/icons/index.native.js +226 -0
- package/dist/cjs/icons/index.native.js.map +1 -0
- package/dist/cjs/index.cjs +51 -0
- package/dist/cjs/index.native.js +54 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/mdx.spec.cjs +400 -0
- package/dist/cjs/mdx.spec.native.js +465 -0
- package/dist/cjs/mdx.spec.native.js.map +1 -0
- package/dist/cjs/mdxComponents.cjs +317 -0
- package/dist/cjs/mdxComponents.native.js +376 -0
- package/dist/cjs/mdxComponents.native.js.map +1 -0
- package/dist/cjs/parser.cjs +49 -0
- package/dist/cjs/parser.native.js +52 -0
- package/dist/cjs/parser.native.js.map +1 -0
- package/dist/cjs/parser.spec.cjs +109 -0
- package/dist/cjs/parser.spec.native.js +114 -0
- package/dist/cjs/parser.spec.native.js.map +1 -0
- package/dist/cjs/renderer.cjs +326 -0
- package/dist/cjs/renderer.native.js +348 -0
- package/dist/cjs/renderer.native.js.map +1 -0
- package/dist/cjs/shared/colorRamps.cjs +74 -0
- package/dist/cjs/shared/colorRamps.native.js +77 -0
- package/dist/cjs/shared/colorRamps.native.js.map +1 -0
- package/dist/cjs/shared/index.cjs +20 -0
- package/dist/cjs/shared/index.native.js +23 -0
- package/dist/cjs/shared/index.native.js.map +1 -0
- package/dist/cjs/shiki/highlighter.cjs +89 -0
- package/dist/cjs/shiki/highlighter.native.js +94 -0
- package/dist/cjs/shiki/highlighter.native.js.map +1 -0
- package/dist/cjs/shiki/index.cjs +33 -0
- package/dist/cjs/shiki/index.native.js +36 -0
- package/dist/cjs/shiki/index.native.js.map +1 -0
- package/dist/cjs/types.cjs +18 -0
- package/dist/cjs/types.native.js +21 -0
- package/dist/cjs/types.native.js.map +1 -0
- package/dist/cjs/util/rehypeMetaAttributes.cjs +45 -0
- package/dist/cjs/util/rehypeMetaAttributes.native.js +49 -0
- package/dist/cjs/util/rehypeMetaAttributes.native.js.map +1 -0
- package/dist/cjs/util/util.spec.cjs +81 -0
- package/dist/cjs/util/util.spec.native.js +84 -0
- package/dist/cjs/util/util.spec.native.js.map +1 -0
- package/dist/esm/Aside/index.mjs +86 -0
- package/dist/esm/Aside/index.mjs.map +1 -0
- package/dist/esm/Aside/index.native.js +90 -0
- package/dist/esm/Aside/index.native.js.map +1 -0
- package/dist/esm/ExternalIcon/ExternalIcon.spec.mjs +38 -0
- package/dist/esm/ExternalIcon/ExternalIcon.spec.mjs.map +1 -0
- package/dist/esm/ExternalIcon/ExternalIcon.spec.native.js +38 -0
- package/dist/esm/ExternalIcon/ExternalIcon.spec.native.js.map +1 -0
- package/dist/esm/ExternalIcon/index.mjs +21 -0
- package/dist/esm/ExternalIcon/index.mjs.map +1 -0
- package/dist/esm/ExternalIcon/index.native.js +23 -0
- package/dist/esm/ExternalIcon/index.native.js.map +1 -0
- package/dist/esm/Hr/hr.spec.mjs +22 -0
- package/dist/esm/Hr/hr.spec.mjs.map +1 -0
- package/dist/esm/Hr/hr.spec.native.js +22 -0
- package/dist/esm/Hr/hr.spec.native.js.map +1 -0
- package/dist/esm/Hr/index.mjs +16 -0
- package/dist/esm/Hr/index.mjs.map +1 -0
- package/dist/esm/Hr/index.native.js +18 -0
- package/dist/esm/Hr/index.native.js.map +1 -0
- package/dist/esm/Li/index.mjs +13 -0
- package/dist/esm/Li/index.mjs.map +1 -0
- package/dist/esm/Li/index.native.js +13 -0
- package/dist/esm/Li/index.native.js.map +1 -0
- package/dist/esm/Li/li.spec.mjs +46 -0
- package/dist/esm/Li/li.spec.mjs.map +1 -0
- package/dist/esm/Li/li.spec.native.js +48 -0
- package/dist/esm/Li/li.spec.native.js.map +1 -0
- package/dist/esm/Markdown.mjs +41 -0
- package/dist/esm/Markdown.mjs.map +1 -0
- package/dist/esm/Markdown.native.js +43 -0
- package/dist/esm/Markdown.native.js.map +1 -0
- package/dist/esm/Markdown.stories.mjs +125 -0
- package/dist/esm/Markdown.stories.mjs.map +1 -0
- package/dist/esm/Markdown.stories.native.js +131 -0
- package/dist/esm/Markdown.stories.native.js.map +1 -0
- package/dist/esm/Mdx/index.mjs +33 -0
- package/dist/esm/Mdx/index.mjs.map +1 -0
- package/dist/esm/Mdx/index.native.js +34 -0
- package/dist/esm/Mdx/index.native.js.map +1 -0
- package/dist/esm/Mdx/mdx.spec.mjs +140 -0
- package/dist/esm/Mdx/mdx.spec.mjs.map +1 -0
- package/dist/esm/Mdx/mdx.spec.native.js +156 -0
- package/dist/esm/Mdx/mdx.spec.native.js.map +1 -0
- package/dist/esm/MdxCodeBlock/index.mjs +149 -0
- package/dist/esm/MdxCodeBlock/index.mjs.map +1 -0
- package/dist/esm/MdxCodeBlock/index.native.js +166 -0
- package/dist/esm/MdxCodeBlock/index.native.js.map +1 -0
- package/dist/esm/MdxCodeBlock/mdxCodeBlock.spec.mjs +91 -0
- package/dist/esm/MdxCodeBlock/mdxCodeBlock.spec.mjs.map +1 -0
- package/dist/esm/MdxCodeBlock/mdxCodeBlock.spec.native.js +96 -0
- package/dist/esm/MdxCodeBlock/mdxCodeBlock.spec.native.js.map +1 -0
- package/dist/esm/MdxCodeBlock/mdxCodeBlockContext.mjs +4 -0
- package/dist/esm/MdxCodeBlock/mdxCodeBlockContext.mjs.map +1 -0
- package/dist/esm/MdxCodeBlock/mdxCodeBlockContext.native.js +4 -0
- package/dist/esm/MdxCodeBlock/mdxCodeBlockContext.native.js.map +1 -0
- package/dist/esm/Notice/index.mjs +68 -0
- package/dist/esm/Notice/index.mjs.map +1 -0
- package/dist/esm/Notice/index.native.js +69 -0
- package/dist/esm/Notice/index.native.js.map +1 -0
- package/dist/esm/SimpleTable/index.mjs +107 -0
- package/dist/esm/SimpleTable/index.mjs.map +1 -0
- package/dist/esm/SimpleTable/index.native.js +134 -0
- package/dist/esm/SimpleTable/index.native.js.map +1 -0
- package/dist/esm/Table/index.mjs +91 -0
- package/dist/esm/Table/index.mjs.map +1 -0
- package/dist/esm/Table/index.native.js +97 -0
- package/dist/esm/Table/index.native.js.map +1 -0
- package/dist/esm/Tabs/index.mjs +67 -0
- package/dist/esm/Tabs/index.mjs.map +1 -0
- package/dist/esm/Tabs/index.native.js +74 -0
- package/dist/esm/Tabs/index.native.js.map +1 -0
- package/dist/esm/Ul/index.mjs +10 -0
- package/dist/esm/Ul/index.mjs.map +1 -0
- package/dist/esm/Ul/index.native.js +10 -0
- package/dist/esm/Ul/index.native.js.map +1 -0
- package/dist/esm/Ul/ul.spec.mjs +151 -0
- package/dist/esm/Ul/ul.spec.mjs.map +1 -0
- package/dist/esm/Ul/ul.spec.native.js +151 -0
- package/dist/esm/Ul/ul.spec.native.js.map +1 -0
- package/dist/esm/Video/index.mjs +59 -0
- package/dist/esm/Video/index.mjs.map +1 -0
- package/dist/esm/Video/index.native.js +61 -0
- package/dist/esm/Video/index.native.js.map +1 -0
- package/dist/esm/components/Blockquote.mjs +22 -0
- package/dist/esm/components/Blockquote.mjs.map +1 -0
- package/dist/esm/components/Blockquote.native.js +23 -0
- package/dist/esm/components/Blockquote.native.js.map +1 -0
- package/dist/esm/components/Break.mjs +9 -0
- package/dist/esm/components/Break.mjs.map +1 -0
- package/dist/esm/components/Break.native.js +9 -0
- package/dist/esm/components/Break.native.js.map +1 -0
- package/dist/esm/components/CodeBlock.mjs +84 -0
- package/dist/esm/components/CodeBlock.mjs.map +1 -0
- package/dist/esm/components/CodeBlock.native.js +91 -0
- package/dist/esm/components/CodeBlock.native.js.map +1 -0
- package/dist/esm/components/Heading.mjs +23 -0
- package/dist/esm/components/Heading.mjs.map +1 -0
- package/dist/esm/components/Heading.native.js +24 -0
- package/dist/esm/components/Heading.native.js.map +1 -0
- package/dist/esm/components/HorizontalRule.mjs +9 -0
- package/dist/esm/components/HorizontalRule.mjs.map +1 -0
- package/dist/esm/components/HorizontalRule.native.js +9 -0
- package/dist/esm/components/HorizontalRule.native.js.map +1 -0
- package/dist/esm/components/Image.mjs +28 -0
- package/dist/esm/components/Image.mjs.map +1 -0
- package/dist/esm/components/Image.native.js +29 -0
- package/dist/esm/components/Image.native.js.map +1 -0
- package/dist/esm/components/InlineCode.mjs +23 -0
- package/dist/esm/components/InlineCode.mjs.map +1 -0
- package/dist/esm/components/InlineCode.native.js +24 -0
- package/dist/esm/components/InlineCode.native.js.map +1 -0
- package/dist/esm/components/InlineStyles.mjs +28 -0
- package/dist/esm/components/InlineStyles.mjs.map +1 -0
- package/dist/esm/components/InlineStyles.native.js +31 -0
- package/dist/esm/components/InlineStyles.native.js.map +1 -0
- package/dist/esm/components/Link.mjs +29 -0
- package/dist/esm/components/Link.mjs.map +1 -0
- package/dist/esm/components/Link.native.js +30 -0
- package/dist/esm/components/Link.native.js.map +1 -0
- package/dist/esm/components/List.mjs +48 -0
- package/dist/esm/components/List.mjs.map +1 -0
- package/dist/esm/components/List.native.js +50 -0
- package/dist/esm/components/List.native.js.map +1 -0
- package/dist/esm/components/Paragraph.mjs +13 -0
- package/dist/esm/components/Paragraph.mjs.map +1 -0
- package/dist/esm/components/Paragraph.native.js +14 -0
- package/dist/esm/components/Paragraph.native.js.map +1 -0
- package/dist/esm/components/Table.mjs +59 -0
- package/dist/esm/components/Table.mjs.map +1 -0
- package/dist/esm/components/Table.native.js +62 -0
- package/dist/esm/components/Table.native.js.map +1 -0
- package/dist/esm/components/index.mjs +14 -0
- package/dist/esm/components/index.mjs.map +1 -0
- package/dist/esm/components/index.native.js +14 -0
- package/dist/esm/components/index.native.js.map +1 -0
- package/dist/esm/hooks/index.mjs +4 -0
- package/dist/esm/hooks/index.mjs.map +1 -0
- package/dist/esm/hooks/index.native.js +4 -0
- package/dist/esm/hooks/index.native.js.map +1 -0
- package/dist/esm/hooks/useCompileAndEvaluateMdx.mjs +17 -0
- package/dist/esm/hooks/useCompileAndEvaluateMdx.mjs.map +1 -0
- package/dist/esm/hooks/useCompileAndEvaluateMdx.native.js +17 -0
- package/dist/esm/hooks/useCompileAndEvaluateMdx.native.js.map +1 -0
- package/dist/esm/hooks/useCompileAndEvaluateMdx.spec.mjs +35 -0
- package/dist/esm/hooks/useCompileAndEvaluateMdx.spec.mjs.map +1 -0
- package/dist/esm/hooks/useCompileAndEvaluateMdx.spec.native.js +47 -0
- package/dist/esm/hooks/useCompileAndEvaluateMdx.spec.native.js.map +1 -0
- package/dist/esm/hooks/useCompileMdx.mjs +44 -0
- package/dist/esm/hooks/useCompileMdx.mjs.map +1 -0
- package/dist/esm/hooks/useCompileMdx.native.js +44 -0
- package/dist/esm/hooks/useCompileMdx.native.js.map +1 -0
- package/dist/esm/hooks/useEvaluateMdx.mjs +22 -0
- package/dist/esm/hooks/useEvaluateMdx.mjs.map +1 -0
- package/dist/esm/hooks/useEvaluateMdx.native.js +24 -0
- package/dist/esm/hooks/useEvaluateMdx.native.js.map +1 -0
- package/dist/esm/icons/index.mjs +175 -0
- package/dist/esm/icons/index.mjs.map +1 -0
- package/dist/esm/icons/index.native.js +193 -0
- package/dist/esm/icons/index.native.js.map +1 -0
- package/dist/esm/index.mjs +21 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +21 -0
- package/dist/esm/index.native.js.map +1 -0
- package/dist/esm/mdx.spec.mjs +377 -0
- package/dist/esm/mdx.spec.mjs.map +1 -0
- package/dist/esm/mdx.spec.native.js +439 -0
- package/dist/esm/mdx.spec.native.js.map +1 -0
- package/dist/esm/mdxComponents.mjs +291 -0
- package/dist/esm/mdxComponents.mjs.map +1 -0
- package/dist/esm/mdxComponents.native.js +347 -0
- package/dist/esm/mdxComponents.native.js.map +1 -0
- package/dist/esm/parser.mjs +12 -0
- package/dist/esm/parser.mjs.map +1 -0
- package/dist/esm/parser.native.js +12 -0
- package/dist/esm/parser.native.js.map +1 -0
- package/dist/esm/parser.spec.mjs +110 -0
- package/dist/esm/parser.spec.mjs.map +1 -0
- package/dist/esm/parser.spec.native.js +112 -0
- package/dist/esm/parser.spec.native.js.map +1 -0
- package/dist/esm/renderer.mjs +300 -0
- package/dist/esm/renderer.mjs.map +1 -0
- package/dist/esm/renderer.native.js +319 -0
- package/dist/esm/renderer.native.js.map +1 -0
- package/dist/esm/shared/colorRamps.mjs +45 -0
- package/dist/esm/shared/colorRamps.mjs.map +1 -0
- package/dist/esm/shared/colorRamps.native.js +45 -0
- package/dist/esm/shared/colorRamps.native.js.map +1 -0
- package/dist/esm/shared/index.mjs +2 -0
- package/dist/esm/shared/index.mjs.map +1 -0
- package/dist/esm/shared/index.native.js +2 -0
- package/dist/esm/shared/index.native.js.map +1 -0
- package/dist/esm/shiki/highlighter.mjs +59 -0
- package/dist/esm/shiki/highlighter.mjs.map +1 -0
- package/dist/esm/shiki/highlighter.native.js +61 -0
- package/dist/esm/shiki/highlighter.native.js.map +1 -0
- package/dist/esm/shiki/index.mjs +3 -0
- package/dist/esm/shiki/index.mjs.map +1 -0
- package/dist/esm/shiki/index.native.js +3 -0
- package/dist/esm/shiki/index.native.js.map +1 -0
- package/dist/esm/types.mjs +2 -0
- package/dist/esm/types.mjs.map +1 -0
- package/dist/esm/types.native.js +2 -0
- package/dist/esm/types.native.js.map +1 -0
- package/dist/esm/util/rehypeMetaAttributes.mjs +20 -0
- package/dist/esm/util/rehypeMetaAttributes.mjs.map +1 -0
- package/dist/esm/util/rehypeMetaAttributes.native.js +21 -0
- package/dist/esm/util/rehypeMetaAttributes.native.js.map +1 -0
- package/dist/esm/util/util.spec.mjs +82 -0
- package/dist/esm/util/util.spec.mjs.map +1 -0
- package/dist/esm/util/util.spec.native.js +82 -0
- package/dist/esm/util/util.spec.native.js.map +1 -0
- package/dist/jsx/Aside/index.mjs +86 -0
- package/dist/jsx/Aside/index.mjs.map +1 -0
- package/dist/jsx/Aside/index.native.js +119 -0
- package/dist/jsx/Aside/index.native.js.map +1 -0
- package/dist/jsx/ExternalIcon/ExternalIcon.spec.mjs +38 -0
- package/dist/jsx/ExternalIcon/ExternalIcon.spec.mjs.map +1 -0
- package/dist/jsx/ExternalIcon/ExternalIcon.spec.native.js +40 -0
- package/dist/jsx/ExternalIcon/ExternalIcon.spec.native.js.map +1 -0
- package/dist/jsx/ExternalIcon/index.mjs +21 -0
- package/dist/jsx/ExternalIcon/index.mjs.map +1 -0
- package/dist/jsx/ExternalIcon/index.native.js +51 -0
- package/dist/jsx/ExternalIcon/index.native.js.map +1 -0
- package/dist/jsx/Hr/hr.spec.mjs +22 -0
- package/dist/jsx/Hr/hr.spec.mjs.map +1 -0
- package/dist/jsx/Hr/hr.spec.native.js +24 -0
- package/dist/jsx/Hr/hr.spec.native.js.map +1 -0
- package/dist/jsx/Hr/index.mjs +16 -0
- package/dist/jsx/Hr/index.mjs.map +1 -0
- package/dist/jsx/Hr/index.native.js +46 -0
- package/dist/jsx/Hr/index.native.js.map +1 -0
- package/dist/jsx/Li/index.mjs +13 -0
- package/dist/jsx/Li/index.mjs.map +1 -0
- package/dist/jsx/Li/index.native.js +41 -0
- package/dist/jsx/Li/index.native.js.map +1 -0
- package/dist/jsx/Li/li.spec.mjs +46 -0
- package/dist/jsx/Li/li.spec.mjs.map +1 -0
- package/dist/jsx/Li/li.spec.native.js +50 -0
- package/dist/jsx/Li/li.spec.native.js.map +1 -0
- package/dist/jsx/Markdown.mjs +41 -0
- package/dist/jsx/Markdown.mjs.map +1 -0
- package/dist/jsx/Markdown.native.js +71 -0
- package/dist/jsx/Markdown.native.js.map +1 -0
- package/dist/jsx/Markdown.stories.mjs +125 -0
- package/dist/jsx/Markdown.stories.mjs.map +1 -0
- package/dist/jsx/Markdown.stories.native.js +162 -0
- package/dist/jsx/Markdown.stories.native.js.map +1 -0
- package/dist/jsx/Mdx/index.mjs +33 -0
- package/dist/jsx/Mdx/index.mjs.map +1 -0
- package/dist/jsx/Mdx/index.native.js +62 -0
- package/dist/jsx/Mdx/index.native.js.map +1 -0
- package/dist/jsx/Mdx/mdx.spec.mjs +140 -0
- package/dist/jsx/Mdx/mdx.spec.mjs.map +1 -0
- package/dist/jsx/Mdx/mdx.spec.native.js +158 -0
- package/dist/jsx/Mdx/mdx.spec.native.js.map +1 -0
- package/dist/jsx/MdxCodeBlock/index.mjs +149 -0
- package/dist/jsx/MdxCodeBlock/index.mjs.map +1 -0
- package/dist/jsx/MdxCodeBlock/index.native.js +205 -0
- package/dist/jsx/MdxCodeBlock/index.native.js.map +1 -0
- package/dist/jsx/MdxCodeBlock/mdxCodeBlock.spec.mjs +91 -0
- package/dist/jsx/MdxCodeBlock/mdxCodeBlock.spec.mjs.map +1 -0
- package/dist/jsx/MdxCodeBlock/mdxCodeBlock.spec.native.js +122 -0
- package/dist/jsx/MdxCodeBlock/mdxCodeBlock.spec.native.js.map +1 -0
- package/dist/jsx/MdxCodeBlock/mdxCodeBlockContext.mjs +4 -0
- package/dist/jsx/MdxCodeBlock/mdxCodeBlockContext.mjs.map +1 -0
- package/dist/jsx/MdxCodeBlock/mdxCodeBlockContext.native.js +32 -0
- package/dist/jsx/MdxCodeBlock/mdxCodeBlockContext.native.js.map +1 -0
- package/dist/jsx/Notice/index.mjs +68 -0
- package/dist/jsx/Notice/index.mjs.map +1 -0
- package/dist/jsx/Notice/index.native.js +98 -0
- package/dist/jsx/Notice/index.native.js.map +1 -0
- package/dist/jsx/SimpleTable/index.mjs +107 -0
- package/dist/jsx/SimpleTable/index.mjs.map +1 -0
- package/dist/jsx/SimpleTable/index.native.js +162 -0
- package/dist/jsx/SimpleTable/index.native.js.map +1 -0
- package/dist/jsx/Table/index.mjs +91 -0
- package/dist/jsx/Table/index.mjs.map +1 -0
- package/dist/jsx/Table/index.native.js +130 -0
- package/dist/jsx/Table/index.native.js.map +1 -0
- package/dist/jsx/Tabs/index.mjs +67 -0
- package/dist/jsx/Tabs/index.mjs.map +1 -0
- package/dist/jsx/Tabs/index.native.js +103 -0
- package/dist/jsx/Tabs/index.native.js.map +1 -0
- package/dist/jsx/Ul/index.mjs +10 -0
- package/dist/jsx/Ul/index.mjs.map +1 -0
- package/dist/jsx/Ul/index.native.js +38 -0
- package/dist/jsx/Ul/index.native.js.map +1 -0
- package/dist/jsx/Ul/ul.spec.mjs +151 -0
- package/dist/jsx/Ul/ul.spec.mjs.map +1 -0
- package/dist/jsx/Ul/ul.spec.native.js +153 -0
- package/dist/jsx/Ul/ul.spec.native.js.map +1 -0
- package/dist/jsx/Video/index.mjs +59 -0
- package/dist/jsx/Video/index.mjs.map +1 -0
- package/dist/jsx/Video/index.native.js +89 -0
- package/dist/jsx/Video/index.native.js.map +1 -0
- package/dist/jsx/components/Blockquote.mjs +22 -0
- package/dist/jsx/components/Blockquote.mjs.map +1 -0
- package/dist/jsx/components/Blockquote.native.js +51 -0
- package/dist/jsx/components/Blockquote.native.js.map +1 -0
- package/dist/jsx/components/Break.mjs +9 -0
- package/dist/jsx/components/Break.mjs.map +1 -0
- package/dist/jsx/components/Break.native.js +37 -0
- package/dist/jsx/components/Break.native.js.map +1 -0
- package/dist/jsx/components/CodeBlock.mjs +84 -0
- package/dist/jsx/components/CodeBlock.mjs.map +1 -0
- package/dist/jsx/components/CodeBlock.native.js +119 -0
- package/dist/jsx/components/CodeBlock.native.js.map +1 -0
- package/dist/jsx/components/Heading.mjs +23 -0
- package/dist/jsx/components/Heading.mjs.map +1 -0
- package/dist/jsx/components/Heading.native.js +52 -0
- package/dist/jsx/components/Heading.native.js.map +1 -0
- package/dist/jsx/components/HorizontalRule.mjs +9 -0
- package/dist/jsx/components/HorizontalRule.mjs.map +1 -0
- package/dist/jsx/components/HorizontalRule.native.js +37 -0
- package/dist/jsx/components/HorizontalRule.native.js.map +1 -0
- package/dist/jsx/components/Image.mjs +28 -0
- package/dist/jsx/components/Image.mjs.map +1 -0
- package/dist/jsx/components/Image.native.js +57 -0
- package/dist/jsx/components/Image.native.js.map +1 -0
- package/dist/jsx/components/InlineCode.mjs +23 -0
- package/dist/jsx/components/InlineCode.mjs.map +1 -0
- package/dist/jsx/components/InlineCode.native.js +52 -0
- package/dist/jsx/components/InlineCode.native.js.map +1 -0
- package/dist/jsx/components/InlineStyles.mjs +28 -0
- package/dist/jsx/components/InlineStyles.mjs.map +1 -0
- package/dist/jsx/components/InlineStyles.native.js +61 -0
- package/dist/jsx/components/InlineStyles.native.js.map +1 -0
- package/dist/jsx/components/Link.mjs +29 -0
- package/dist/jsx/components/Link.mjs.map +1 -0
- package/dist/jsx/components/Link.native.js +58 -0
- package/dist/jsx/components/Link.native.js.map +1 -0
- package/dist/jsx/components/List.mjs +48 -0
- package/dist/jsx/components/List.mjs.map +1 -0
- package/dist/jsx/components/List.native.js +79 -0
- package/dist/jsx/components/List.native.js.map +1 -0
- package/dist/jsx/components/Paragraph.mjs +13 -0
- package/dist/jsx/components/Paragraph.mjs.map +1 -0
- package/dist/jsx/components/Paragraph.native.js +42 -0
- package/dist/jsx/components/Paragraph.native.js.map +1 -0
- package/dist/jsx/components/Table.mjs +59 -0
- package/dist/jsx/components/Table.mjs.map +1 -0
- package/dist/jsx/components/Table.native.js +92 -0
- package/dist/jsx/components/Table.native.js.map +1 -0
- package/dist/jsx/components/index.mjs +14 -0
- package/dist/jsx/components/index.mjs.map +1 -0
- package/dist/jsx/components/index.native.js +58 -0
- package/dist/jsx/components/index.native.js.map +1 -0
- package/dist/jsx/hooks/index.mjs +4 -0
- package/dist/jsx/hooks/index.mjs.map +1 -0
- package/dist/jsx/hooks/index.native.js +25 -0
- package/dist/jsx/hooks/index.native.js.map +1 -0
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.mjs +17 -0
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.mjs.map +1 -0
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.native.js +45 -0
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.native.js.map +1 -0
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.spec.mjs +35 -0
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.spec.mjs.map +1 -0
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.spec.native.js +49 -0
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.spec.native.js.map +1 -0
- package/dist/jsx/hooks/useCompileMdx.mjs +44 -0
- package/dist/jsx/hooks/useCompileMdx.mjs.map +1 -0
- package/dist/jsx/hooks/useCompileMdx.native.js +83 -0
- package/dist/jsx/hooks/useCompileMdx.native.js.map +1 -0
- package/dist/jsx/hooks/useEvaluateMdx.mjs +22 -0
- package/dist/jsx/hooks/useEvaluateMdx.mjs.map +1 -0
- package/dist/jsx/hooks/useEvaluateMdx.native.js +63 -0
- package/dist/jsx/hooks/useEvaluateMdx.native.js.map +1 -0
- package/dist/jsx/icons/index.mjs +175 -0
- package/dist/jsx/icons/index.mjs.map +1 -0
- package/dist/jsx/icons/index.native.js +226 -0
- package/dist/jsx/icons/index.native.js.map +1 -0
- package/dist/jsx/index.js +21 -0
- package/dist/jsx/index.js.map +1 -0
- package/dist/jsx/index.mjs +21 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +54 -0
- package/dist/jsx/index.native.js.map +1 -0
- package/dist/jsx/mdx.spec.mjs +377 -0
- package/dist/jsx/mdx.spec.mjs.map +1 -0
- package/dist/jsx/mdx.spec.native.js +465 -0
- package/dist/jsx/mdx.spec.native.js.map +1 -0
- package/dist/jsx/mdxComponents.mjs +291 -0
- package/dist/jsx/mdxComponents.mjs.map +1 -0
- package/dist/jsx/mdxComponents.native.js +376 -0
- package/dist/jsx/mdxComponents.native.js.map +1 -0
- package/dist/jsx/parser.mjs +12 -0
- package/dist/jsx/parser.mjs.map +1 -0
- package/dist/jsx/parser.native.js +52 -0
- package/dist/jsx/parser.native.js.map +1 -0
- package/dist/jsx/parser.spec.mjs +110 -0
- package/dist/jsx/parser.spec.mjs.map +1 -0
- package/dist/jsx/parser.spec.native.js +114 -0
- package/dist/jsx/parser.spec.native.js.map +1 -0
- package/dist/jsx/renderer.mjs +300 -0
- package/dist/jsx/renderer.mjs.map +1 -0
- package/dist/jsx/renderer.native.js +348 -0
- package/dist/jsx/renderer.native.js.map +1 -0
- package/dist/jsx/shared/colorRamps.mjs +45 -0
- package/dist/jsx/shared/colorRamps.mjs.map +1 -0
- package/dist/jsx/shared/colorRamps.native.js +77 -0
- package/dist/jsx/shared/colorRamps.native.js.map +1 -0
- package/dist/jsx/shared/index.mjs +2 -0
- package/dist/jsx/shared/index.mjs.map +1 -0
- package/dist/jsx/shared/index.native.js +23 -0
- package/dist/jsx/shared/index.native.js.map +1 -0
- package/dist/jsx/shiki/highlighter.mjs +59 -0
- package/dist/jsx/shiki/highlighter.mjs.map +1 -0
- package/dist/jsx/shiki/highlighter.native.js +94 -0
- package/dist/jsx/shiki/highlighter.native.js.map +1 -0
- package/dist/jsx/shiki/index.mjs +3 -0
- package/dist/jsx/shiki/index.mjs.map +1 -0
- package/dist/jsx/shiki/index.native.js +36 -0
- package/dist/jsx/shiki/index.native.js.map +1 -0
- package/dist/jsx/types.mjs +2 -0
- package/dist/jsx/types.mjs.map +1 -0
- package/dist/jsx/types.native.js +21 -0
- package/dist/jsx/types.native.js.map +1 -0
- package/dist/jsx/util/rehypeMetaAttributes.mjs +20 -0
- package/dist/jsx/util/rehypeMetaAttributes.mjs.map +1 -0
- package/dist/jsx/util/rehypeMetaAttributes.native.js +49 -0
- package/dist/jsx/util/rehypeMetaAttributes.native.js.map +1 -0
- package/dist/jsx/util/util.spec.mjs +82 -0
- package/dist/jsx/util/util.spec.mjs.map +1 -0
- package/dist/jsx/util/util.spec.native.js +84 -0
- package/dist/jsx/util/util.spec.native.js.map +1 -0
- package/package.json +94 -0
- package/src/Aside/index.tsx +89 -0
- package/src/ExternalIcon/ExternalIcon.spec.tsx +33 -0
- package/src/ExternalIcon/index.tsx +15 -0
- package/src/Hr/hr.spec.tsx +18 -0
- package/src/Hr/index.tsx +7 -0
- package/src/Li/index.tsx +14 -0
- package/src/Li/li.spec.tsx +33 -0
- package/src/Markdown.stories.tsx +127 -0
- package/src/Markdown.tsx +62 -0
- package/src/Mdx/index.tsx +32 -0
- package/src/Mdx/mdx.spec.tsx +118 -0
- package/src/MdxCodeBlock/index.tsx +168 -0
- package/src/MdxCodeBlock/mdxCodeBlock.spec.tsx +66 -0
- package/src/MdxCodeBlock/mdxCodeBlockContext.ts +15 -0
- package/src/Notice/index.tsx +76 -0
- package/src/SimpleTable/index.tsx +125 -0
- package/src/Table/index.tsx +80 -0
- package/src/Tabs/index.tsx +76 -0
- package/src/Ul/index.ts +11 -0
- package/src/Ul/ul.spec.tsx +131 -0
- package/src/Video/index.tsx +62 -0
- package/src/components/Blockquote.tsx +20 -0
- package/src/components/Break.tsx +6 -0
- package/src/components/CodeBlock.tsx +94 -0
- package/src/components/Heading.tsx +20 -0
- package/src/components/HorizontalRule.tsx +6 -0
- package/src/components/Image.tsx +20 -0
- package/src/components/InlineCode.tsx +21 -0
- package/src/components/InlineStyles.tsx +14 -0
- package/src/components/Link.tsx +26 -0
- package/src/components/List.tsx +41 -0
- package/src/components/Paragraph.tsx +10 -0
- package/src/components/Table.tsx +56 -0
- package/src/components/index.ts +12 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useCompileAndEvaluateMdx.spec.tsx +31 -0
- package/src/hooks/useCompileAndEvaluateMdx.ts +22 -0
- package/src/hooks/useCompileMdx.ts +55 -0
- package/src/hooks/useEvaluateMdx.ts +27 -0
- package/src/icons/index.tsx +116 -0
- package/src/index.ts +33 -0
- package/src/mdx.spec.tsx +347 -0
- package/src/mdxComponents.tsx +225 -0
- package/src/parser.spec.ts +126 -0
- package/src/parser.ts +27 -0
- package/src/renderer.tsx +391 -0
- package/src/shared/colorRamps.ts +52 -0
- package/src/shared/index.ts +1 -0
- package/src/shiki/highlighter.ts +148 -0
- package/src/shiki/index.ts +11 -0
- package/src/types.ts +225 -0
- package/src/util/rehypeMetaAttributes.ts +21 -0
- package/src/util/util.spec.tsx +90 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { ExternalIcon } from "./index";
|
|
4
|
+
|
|
5
|
+
describe("ExternalIcon Component", () => {
|
|
6
|
+
it("renders without crashing", () => {
|
|
7
|
+
const { container } = renderWithProviders(<ExternalIcon />);
|
|
8
|
+
const svgElement = container.querySelector("svg");
|
|
9
|
+
expect(svgElement).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("renders Svg with correct attributes", () => {
|
|
13
|
+
const { container } = renderWithProviders(<ExternalIcon />);
|
|
14
|
+
const svgElement = container.querySelector("svg");
|
|
15
|
+
expect(svgElement).toHaveAttribute("height", "10");
|
|
16
|
+
expect(svgElement).toHaveAttribute("width", "10");
|
|
17
|
+
expect(svgElement).toHaveAttribute("viewBox", "0 0 15 15");
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("applies correct opacity style to Svg", () => {
|
|
21
|
+
const { container } = renderWithProviders(<ExternalIcon />);
|
|
22
|
+
const svgElement = container.querySelector("svg");
|
|
23
|
+
expect(svgElement).toHaveStyle("opacity: 0.4");
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("contains Path inside Svg", () => {
|
|
27
|
+
const { container } = renderWithProviders(<ExternalIcon />);
|
|
28
|
+
const pathElement = container.querySelector("svg path");
|
|
29
|
+
expect(pathElement).toBeTruthy();
|
|
30
|
+
expect(pathElement).toHaveAttribute("fill");
|
|
31
|
+
// fill is now resolved via useTheme() instead of CSS var(--color)
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Path, Svg } from "@tamagui/react-native-svg";
|
|
2
|
+
import { useTheme } from "tamagui";
|
|
3
|
+
|
|
4
|
+
export function ExternalIcon() {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
const color = theme.color?.val ?? "currentColor";
|
|
7
|
+
return (
|
|
8
|
+
<Svg style={{ opacity: 0.4 }} width="10" height="10" viewBox="0 0 15 15">
|
|
9
|
+
<Path
|
|
10
|
+
d="M3.64645 11.3536C3.45118 11.1583 3.45118 10.8417 3.64645 10.6465L10.2929 4L6 4C5.72386 4 5.5 3.77614 5.5 3.5C5.5 3.22386 5.72386 3 6 3L11.5 3C11.6326 3 11.7598 3.05268 11.8536 3.14645C11.9473 3.24022 12 3.36739 12 3.5L12 9.00001C12 9.27615 11.7761 9.50001 11.5 9.50001C11.2239 9.50001 11 9.27615 11 9.00001V4.70711L4.35355 11.3536C4.15829 11.5488 3.84171 11.5488 3.64645 11.3536Z"
|
|
11
|
+
fill={color}
|
|
12
|
+
/>
|
|
13
|
+
</Svg>
|
|
14
|
+
);
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
2
|
+
import { expect, it } from "vitest";
|
|
3
|
+
import { HR } from "./index";
|
|
4
|
+
|
|
5
|
+
it("renders without crashing", () => {
|
|
6
|
+
const { container } = renderWithProviders(<HR />);
|
|
7
|
+
expect(container).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it("renders outer YStack with correct basic alignment and structure", () => {
|
|
11
|
+
const { container } = renderWithProviders(<HR />);
|
|
12
|
+
const outerYStack = container.firstElementChild as HTMLElement;
|
|
13
|
+
expect(outerYStack).toBeTruthy();
|
|
14
|
+
const styleAttr = outerYStack.getAttribute("style") || "";
|
|
15
|
+
expect(styleAttr.includes("margin-left: auto"));
|
|
16
|
+
expect(styleAttr.includes("margin-right: auto"));
|
|
17
|
+
expect(styleAttr.includes("max-width: 50%"));
|
|
18
|
+
});
|
package/src/Hr/index.tsx
ADDED
package/src/Li/index.tsx
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Paragraph, styled } from "tamagui";
|
|
2
|
+
|
|
3
|
+
export const LI = styled(Paragraph, {
|
|
4
|
+
name: "LI",
|
|
5
|
+
display: "list-item" as any,
|
|
6
|
+
render: "li",
|
|
7
|
+
size: "$5",
|
|
8
|
+
paddingBottom: "$1",
|
|
9
|
+
style: {
|
|
10
|
+
listStyleType: "disc",
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export type LIProps = React.ComponentProps<typeof LI>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
3
|
+
import { LI } from "./index";
|
|
4
|
+
|
|
5
|
+
describe("LI Component", () => {
|
|
6
|
+
it("should render without errors", () => {
|
|
7
|
+
const { getByText } = renderWithProviders(<LI>This is a list item</LI>);
|
|
8
|
+
expect(getByText("This is a list item")).toBeDefined();
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it("should have the correct tag", () => {
|
|
12
|
+
const { container } = renderWithProviders(<LI>This is a list item</LI>);
|
|
13
|
+
// Tamagui may render as li or as a styled element; ensure list content is present
|
|
14
|
+
expect(container.textContent).toContain("This is a list item");
|
|
15
|
+
const listItem = container.querySelector("li") ?? container.querySelector("[role='listitem']");
|
|
16
|
+
if (listItem) expect(listItem).toBeTruthy();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should render dynamic content correctly", () => {
|
|
20
|
+
const { getByText } = renderWithProviders(<LI>Another list item</LI>);
|
|
21
|
+
expect(getByText("Another list item")).toBeDefined();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("should have display: list-item", () => {
|
|
25
|
+
const { container } = renderWithProviders(<LI>This is a list item</LI>);
|
|
26
|
+
expect(container.textContent).toContain("This is a list item");
|
|
27
|
+
const listItem = container.querySelector("li") ?? container.querySelector("[role='listitem']");
|
|
28
|
+
if (listItem) {
|
|
29
|
+
const display = window.getComputedStyle(listItem).display;
|
|
30
|
+
expect(display).toBe("list-item");
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-native-web-vite";
|
|
2
|
+
import { YStack } from "tamagui";
|
|
3
|
+
import { Markdown } from "./Markdown";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Markdown> = {
|
|
6
|
+
title: "Markdown/Markdown",
|
|
7
|
+
component: Markdown,
|
|
8
|
+
parameters: {
|
|
9
|
+
status: { type: "beta" },
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
"Cross-platform markdown renderer with Shiki syntax highlighting. Supports GFM (tables, strikethrough, task lists).",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<typeof Markdown>;
|
|
21
|
+
|
|
22
|
+
const sampleMarkdown = `# Hello World
|
|
23
|
+
|
|
24
|
+
This is **bold**, _italic_, and ~~strikethrough~~ text.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- Markdown parsing with remark
|
|
29
|
+
- GFM support (tables, task lists)
|
|
30
|
+
- Shiki syntax highlighting
|
|
31
|
+
- Cross-platform (web + native)
|
|
32
|
+
|
|
33
|
+
### Task Lists
|
|
34
|
+
|
|
35
|
+
- [x] Completed task
|
|
36
|
+
- [ ] Incomplete task
|
|
37
|
+
- [ ] Another task
|
|
38
|
+
|
|
39
|
+
## Code Blocks
|
|
40
|
+
|
|
41
|
+
Inline \`code\` looks like this.
|
|
42
|
+
|
|
43
|
+
\`\`\`typescript
|
|
44
|
+
interface User {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
email: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function greet(user: User): string {
|
|
51
|
+
return \`Hello, \${user.name}!\`;
|
|
52
|
+
}
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
\`\`\`python
|
|
56
|
+
def fibonacci(n: int) -> int:
|
|
57
|
+
if n <= 1:
|
|
58
|
+
return n
|
|
59
|
+
return fibonacci(n - 1) + fibonacci(n - 2)
|
|
60
|
+
|
|
61
|
+
print(fibonacci(10))
|
|
62
|
+
\`\`\`
|
|
63
|
+
|
|
64
|
+
## Blockquotes
|
|
65
|
+
|
|
66
|
+
> This is a blockquote.
|
|
67
|
+
> It can span multiple lines.
|
|
68
|
+
|
|
69
|
+
## Tables
|
|
70
|
+
|
|
71
|
+
| Feature | Web | Native |
|
|
72
|
+
|---------|-----|--------|
|
|
73
|
+
| Markdown | Yes | Yes |
|
|
74
|
+
| Syntax Highlighting | Yes | Yes |
|
|
75
|
+
| Tables | Yes | Yes |
|
|
76
|
+
| HTML | Yes | No |
|
|
77
|
+
|
|
78
|
+
## Links and Images
|
|
79
|
+
|
|
80
|
+
[Visit GitHub](https://github.com)
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
That's a horizontal rule above.
|
|
85
|
+
`;
|
|
86
|
+
|
|
87
|
+
export const Main: Story = {
|
|
88
|
+
name: "Main",
|
|
89
|
+
render: () => (
|
|
90
|
+
<YStack maxWidth={700} padding="$4">
|
|
91
|
+
<Markdown>{sampleMarkdown}</Markdown>
|
|
92
|
+
</YStack>
|
|
93
|
+
),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const CodeBlock: Story = {
|
|
97
|
+
render: () => (
|
|
98
|
+
<YStack maxWidth={700} padding="$4">
|
|
99
|
+
<Markdown>
|
|
100
|
+
{`\`\`\`javascript
|
|
101
|
+
const express = require('express');
|
|
102
|
+
const app = express();
|
|
103
|
+
|
|
104
|
+
app.get('/', (req, res) => {
|
|
105
|
+
res.json({ message: 'Hello World!' });
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
app.listen(3000, () => {
|
|
109
|
+
console.log('Server running on port 3000');
|
|
110
|
+
});
|
|
111
|
+
\`\`\``}
|
|
112
|
+
</Markdown>
|
|
113
|
+
</YStack>
|
|
114
|
+
),
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export const Simple: Story = {
|
|
118
|
+
render: () => (
|
|
119
|
+
<YStack maxWidth={700} padding="$4">
|
|
120
|
+
<Markdown>
|
|
121
|
+
{`# Simple Example
|
|
122
|
+
|
|
123
|
+
Just some **bold** and _italic_ text with a [link](https://example.com).`}
|
|
124
|
+
</Markdown>
|
|
125
|
+
</YStack>
|
|
126
|
+
),
|
|
127
|
+
};
|
package/src/Markdown.tsx
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Markdown component
|
|
3
|
+
* Cross-platform markdown renderer with Shiki syntax highlighting
|
|
4
|
+
*/
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { View, type ViewProps, useThemeName } from "tamagui";
|
|
7
|
+
import { parseMarkdown } from "./parser";
|
|
8
|
+
import { renderMarkdown } from "./renderer";
|
|
9
|
+
import type { CodeTheme, MarkdownProps } from "./types";
|
|
10
|
+
|
|
11
|
+
export interface MarkdownComponentProps extends MarkdownProps, Omit<ViewProps, "children"> {}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Render markdown string as cross-platform React components
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <Markdown>
|
|
19
|
+
* # Hello World
|
|
20
|
+
*
|
|
21
|
+
* This is **bold** and _italic_ text.
|
|
22
|
+
*
|
|
23
|
+
* ```javascript
|
|
24
|
+
* const x = 1;
|
|
25
|
+
* ```
|
|
26
|
+
* </Markdown>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function Markdown({
|
|
30
|
+
children,
|
|
31
|
+
components,
|
|
32
|
+
codeTheme = "auto",
|
|
33
|
+
...viewProps
|
|
34
|
+
}: MarkdownComponentProps) {
|
|
35
|
+
const themeName = useThemeName();
|
|
36
|
+
|
|
37
|
+
// Resolve "auto" theme to light/dark based on current Tamagui theme
|
|
38
|
+
const resolvedCodeTheme = useMemo((): Exclude<CodeTheme, "auto"> => {
|
|
39
|
+
if (codeTheme !== "auto") {
|
|
40
|
+
return codeTheme;
|
|
41
|
+
}
|
|
42
|
+
// Check if theme name contains "dark" (e.g., "dark", "dark_blue", etc.)
|
|
43
|
+
const isDark = themeName?.includes("dark") ?? false;
|
|
44
|
+
return isDark ? "github-dark" : "github-light";
|
|
45
|
+
}, [codeTheme, themeName]);
|
|
46
|
+
|
|
47
|
+
const rendered = useMemo(() => {
|
|
48
|
+
if (!children || typeof children !== "string") {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
const ast = parseMarkdown(children);
|
|
54
|
+
return renderMarkdown(ast, { components, codeTheme: resolvedCodeTheme });
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.error("Markdown parsing error:", error);
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}, [children, components, resolvedCodeTheme]);
|
|
60
|
+
|
|
61
|
+
return <View {...viewProps}>{rendered}</View>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useMDXComponents } from "@mdx-js/react";
|
|
2
|
+
import type { DebugProp } from "@tamagui/web";
|
|
3
|
+
import type { MDXComponents } from "mdx/types";
|
|
4
|
+
import { useCompileAndEvaluateMdx } from "../hooks";
|
|
5
|
+
import { mdxComponents } from "../mdxComponents";
|
|
6
|
+
|
|
7
|
+
export interface MDXProps {
|
|
8
|
+
children: string;
|
|
9
|
+
components?: MDXComponents;
|
|
10
|
+
debug?: DebugProp;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const logger = console;
|
|
14
|
+
|
|
15
|
+
export function MDX({ children, debug, ...props }: MDXProps) {
|
|
16
|
+
const components = useMDXComponents();
|
|
17
|
+
const { Component, code, frontmatter } = useCompileAndEvaluateMdx(children);
|
|
18
|
+
if (!Component) return <>{}</>;
|
|
19
|
+
if (debug) {
|
|
20
|
+
logger.debug("MDX", { frontmatter });
|
|
21
|
+
logger.debug(code);
|
|
22
|
+
}
|
|
23
|
+
return (
|
|
24
|
+
<Component
|
|
25
|
+
components={{
|
|
26
|
+
...mdxComponents,
|
|
27
|
+
...components,
|
|
28
|
+
...props.components,
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { screen } from "@testing-library/react";
|
|
2
|
+
import { renderWithProviders } from "@multiplatform.one/test-utils";
|
|
3
|
+
import type { MDXComponents } from "mdx/types";
|
|
4
|
+
import { YStack } from "tamagui";
|
|
5
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { useCompileAndEvaluateMdx } from "../hooks";
|
|
7
|
+
import { MDX } from "./index";
|
|
8
|
+
|
|
9
|
+
const DummyComponent = ({ components }: { components: MDXComponents }) => {
|
|
10
|
+
return <YStack data-testid="dummy">{JSON.stringify(components)}</YStack>;
|
|
11
|
+
};
|
|
12
|
+
vi.mock("../hooks", () => ({
|
|
13
|
+
useCompileAndEvaluateMdx: vi.fn(),
|
|
14
|
+
}));
|
|
15
|
+
vi.mock("@mdx-js/react", () => ({
|
|
16
|
+
useMDXComponents: () => ({ hookKey: "hookValue" }),
|
|
17
|
+
}));
|
|
18
|
+
vi.mock("../mdxComponents", () => ({
|
|
19
|
+
mdxComponents: { mdxKey: "mdxValue" },
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
describe("MDX component", () => {
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
vi.clearAllMocks();
|
|
25
|
+
});
|
|
26
|
+
it("renders an empty fragment if no component is returned from the hook", () => {
|
|
27
|
+
(useCompileAndEvaluateMdx as any).mockReturnValue({
|
|
28
|
+
Component: null,
|
|
29
|
+
code: "some code",
|
|
30
|
+
frontmatter: { test: "frontmatter" },
|
|
31
|
+
});
|
|
32
|
+
renderWithProviders(
|
|
33
|
+
<>
|
|
34
|
+
<MDX children="hello" />
|
|
35
|
+
</>,
|
|
36
|
+
);
|
|
37
|
+
// When Component is null, no MDX content should be rendered
|
|
38
|
+
const mdxContent = screen.queryByText("hello");
|
|
39
|
+
expect(mdxContent).toBeNull();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("renders the evaluated MDX component and passes the merged components prop", () => {
|
|
43
|
+
const TestDummyComponent = ({ components }: { components: MDXComponents }) => {
|
|
44
|
+
// Check if components are properly merged by checking keys
|
|
45
|
+
const componentKeys = Object.keys(components || {});
|
|
46
|
+
return <YStack data-testid="dummy">{componentKeys.join(",")}</YStack>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
(useCompileAndEvaluateMdx as any).mockReturnValue({
|
|
50
|
+
Component: TestDummyComponent,
|
|
51
|
+
code: "compiledCode",
|
|
52
|
+
frontmatter: { test: true },
|
|
53
|
+
});
|
|
54
|
+
const additionalComponents = {
|
|
55
|
+
p: ({ children }: any) => <div data-testid="custom-p">{children}</div>,
|
|
56
|
+
};
|
|
57
|
+
renderWithProviders(
|
|
58
|
+
<>
|
|
59
|
+
<MDX children="hello" components={additionalComponents} />
|
|
60
|
+
</>,
|
|
61
|
+
);
|
|
62
|
+
const dummyDiv = screen.getByTestId("dummy");
|
|
63
|
+
const componentKeys = dummyDiv.textContent?.split(",") || [];
|
|
64
|
+
expect(componentKeys).toContain("mdxKey");
|
|
65
|
+
expect(componentKeys).toContain("hookKey");
|
|
66
|
+
expect(componentKeys).toContain("p");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("calls debug logging when the debug prop is provided", () => {
|
|
70
|
+
const debugSpy = vi.spyOn(console, "debug").mockImplementation(() => {});
|
|
71
|
+
(useCompileAndEvaluateMdx as any).mockReturnValue({
|
|
72
|
+
Component: DummyComponent,
|
|
73
|
+
code: "compiledCode",
|
|
74
|
+
frontmatter: { test: "frontmatter" },
|
|
75
|
+
});
|
|
76
|
+
renderWithProviders(
|
|
77
|
+
<>
|
|
78
|
+
<MDX children="hello" debug={true} />
|
|
79
|
+
</>,
|
|
80
|
+
);
|
|
81
|
+
expect(debugSpy).toHaveBeenCalledWith("MDX", {
|
|
82
|
+
frontmatter: { test: "frontmatter" },
|
|
83
|
+
});
|
|
84
|
+
expect(debugSpy).toHaveBeenCalledWith("compiledCode");
|
|
85
|
+
debugSpy.mockRestore();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("does not call debug logging when the debug prop is false", () => {
|
|
89
|
+
const debugSpy = vi.spyOn(console, "debug").mockImplementation(() => {});
|
|
90
|
+
(useCompileAndEvaluateMdx as any).mockReturnValue({
|
|
91
|
+
Component: DummyComponent,
|
|
92
|
+
code: "compiledCode",
|
|
93
|
+
frontmatter: { test: "frontmatter" },
|
|
94
|
+
});
|
|
95
|
+
renderWithProviders(
|
|
96
|
+
<>
|
|
97
|
+
<MDX children="hello" debug={false} />
|
|
98
|
+
</>,
|
|
99
|
+
);
|
|
100
|
+
expect(debugSpy).not.toHaveBeenCalled();
|
|
101
|
+
debugSpy.mockRestore();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("does not throw an error when an empty children string is provided", () => {
|
|
105
|
+
(useCompileAndEvaluateMdx as any).mockReturnValue({
|
|
106
|
+
Component: DummyComponent,
|
|
107
|
+
code: "",
|
|
108
|
+
frontmatter: {},
|
|
109
|
+
});
|
|
110
|
+
expect(() =>
|
|
111
|
+
renderWithProviders(
|
|
112
|
+
<>
|
|
113
|
+
<MDX children="hello" />
|
|
114
|
+
</>,
|
|
115
|
+
),
|
|
116
|
+
).not.toThrow();
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Code,
|
|
3
|
+
ErrorBoundary,
|
|
4
|
+
HighlightedCode,
|
|
5
|
+
Pre,
|
|
6
|
+
useClipboard,
|
|
7
|
+
useShikiTokens,
|
|
8
|
+
} from "@multiplatform.one/components";
|
|
9
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
10
|
+
import { LinearGradient } from "@tamagui/linear-gradient";
|
|
11
|
+
import rangeParser from "parse-numeric-range";
|
|
12
|
+
import type { ReactNode } from "react";
|
|
13
|
+
import { useContext, useMemo, useState } from "react";
|
|
14
|
+
import { Button, ScrollView, Spacer, TooltipSimple, XStack, YStack } from "tamagui";
|
|
15
|
+
import { CheckCircleIcon, ClipboardIcon } from "../icons";
|
|
16
|
+
|
|
17
|
+
const zIndex = { localTop: 100 };
|
|
18
|
+
import type { MDXCodeBlockContextValue } from "./mdxCodeBlockContext";
|
|
19
|
+
import { MDXCodeBlockContext } from "./mdxCodeBlockContext";
|
|
20
|
+
|
|
21
|
+
export interface MDXCodeBlockProps extends MDXCodeBlockContextValue {
|
|
22
|
+
className?: string;
|
|
23
|
+
id?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Extract raw code text from MDX children.
|
|
28
|
+
* Children are typically a plain string, but this handles nested elements for safety.
|
|
29
|
+
*/
|
|
30
|
+
function extractCodeText(children: ReactNode): string {
|
|
31
|
+
if (typeof children === "string") return children;
|
|
32
|
+
if (Array.isArray(children)) return children.map(extractCodeText).join("");
|
|
33
|
+
if (children && typeof children === "object" && "props" in children) {
|
|
34
|
+
return extractCodeText((children as any).props?.children);
|
|
35
|
+
}
|
|
36
|
+
return String(children ?? "");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Extract language from className like "language-tsx" -> "tsx"
|
|
41
|
+
*/
|
|
42
|
+
function extractLanguage(className?: string): string {
|
|
43
|
+
if (!className) return "text";
|
|
44
|
+
const match = className.match(/language-(\w+)/);
|
|
45
|
+
return match?.[1] || "text";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function MDXCodeBlock(props: MDXCodeBlockProps) {
|
|
49
|
+
const {
|
|
50
|
+
children,
|
|
51
|
+
className,
|
|
52
|
+
disableCopy,
|
|
53
|
+
id,
|
|
54
|
+
isCollapsible,
|
|
55
|
+
isHighlightingLines,
|
|
56
|
+
showLineNumbers: propShowLineNumbers,
|
|
57
|
+
size,
|
|
58
|
+
line,
|
|
59
|
+
...codeProps
|
|
60
|
+
} = { ...useContext(MDXCodeBlockContext), ...props } as MDXCodeBlockProps & {
|
|
61
|
+
line?: string;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const { knobProps } = useResolvedKnobs();
|
|
65
|
+
const codeText = useMemo(() => extractCodeText(children).replace(/\n$/, ""), [children]);
|
|
66
|
+
const language = useMemo(() => extractLanguage(className), [className]);
|
|
67
|
+
const tokens = useShikiTokens(codeText, language);
|
|
68
|
+
|
|
69
|
+
const lines = tokens?.length ?? codeText.split("\n").length;
|
|
70
|
+
const showLineNumbers = propShowLineNumbers ?? lines > 10;
|
|
71
|
+
const [isCollapsed, setIsCollapsed] = useState(isCollapsible);
|
|
72
|
+
const isLong = lines > 22;
|
|
73
|
+
const [isCutoff, setIsCutoff] = useState(isLong && !isCollapsible);
|
|
74
|
+
const { hasCopied, onCopy } = useClipboard(codeText);
|
|
75
|
+
|
|
76
|
+
const highlightLines = useMemo(() => {
|
|
77
|
+
if (!isHighlightingLines || !line) return [];
|
|
78
|
+
return rangeParser(line);
|
|
79
|
+
}, [isHighlightingLines, line]);
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<YStack position="relative" marginBottom="$4">
|
|
83
|
+
<ErrorBoundary>
|
|
84
|
+
<YStack
|
|
85
|
+
position="relative"
|
|
86
|
+
{...(isCutoff && {
|
|
87
|
+
maxHeight: 400,
|
|
88
|
+
overflow: "hidden",
|
|
89
|
+
borderRadius: knobProps.borderRadius.borderRadius,
|
|
90
|
+
})}
|
|
91
|
+
>
|
|
92
|
+
{(!isCollapsed || !isCollapsible) && isCutoff && (
|
|
93
|
+
<LinearGradient
|
|
94
|
+
position="absolute"
|
|
95
|
+
bottom={0}
|
|
96
|
+
left={0}
|
|
97
|
+
right={0}
|
|
98
|
+
height={200}
|
|
99
|
+
colors={["$backgroundTransparent", "$background"]}
|
|
100
|
+
zIndex={zIndex.localTop}
|
|
101
|
+
>
|
|
102
|
+
<Spacer flex={1} />
|
|
103
|
+
<Button onPress={() => setIsCutoff(!isCutoff)} alignSelf="center">
|
|
104
|
+
Show more
|
|
105
|
+
</Button>
|
|
106
|
+
<Spacer size="$4" />
|
|
107
|
+
</LinearGradient>
|
|
108
|
+
)}
|
|
109
|
+
{(!isCollapsed || !isCollapsible) && (
|
|
110
|
+
<Pre
|
|
111
|
+
padding={0}
|
|
112
|
+
marginBottom={0}
|
|
113
|
+
id={id}
|
|
114
|
+
data-line-numbers={showLineNumbers ? "true" : "false"}
|
|
115
|
+
>
|
|
116
|
+
<ScrollView
|
|
117
|
+
style={{ width: "100%" }}
|
|
118
|
+
contentContainerStyle={{ minWidth: "100%" }}
|
|
119
|
+
horizontal
|
|
120
|
+
showsHorizontalScrollIndicator={false}
|
|
121
|
+
>
|
|
122
|
+
<Code
|
|
123
|
+
backgroundColor="transparent"
|
|
124
|
+
flex={1}
|
|
125
|
+
{...knobProps.panelPadding}
|
|
126
|
+
size={(size ?? "$5") as any}
|
|
127
|
+
{...codeProps}
|
|
128
|
+
>
|
|
129
|
+
<HighlightedCode
|
|
130
|
+
tokens={tokens}
|
|
131
|
+
highlightLines={highlightLines}
|
|
132
|
+
showLineNumbers={showLineNumbers}
|
|
133
|
+
>
|
|
134
|
+
{codeText}
|
|
135
|
+
</HighlightedCode>
|
|
136
|
+
</Code>
|
|
137
|
+
</ScrollView>
|
|
138
|
+
</Pre>
|
|
139
|
+
)}
|
|
140
|
+
<XStack position="absolute" top="$3" right="$3" {...knobProps.gap}>
|
|
141
|
+
{(!isCollapsed || !isCollapsible) && !disableCopy && (
|
|
142
|
+
<TooltipSimple label={hasCopied ? "Copied" : "Copy to clipboard"}>
|
|
143
|
+
<Button
|
|
144
|
+
aria-label="Copy code to clipboard"
|
|
145
|
+
size="$2"
|
|
146
|
+
icon={hasCopied ? <CheckCircleIcon size={14} /> : <ClipboardIcon size={14} />}
|
|
147
|
+
onPress={onCopy}
|
|
148
|
+
$xs={{
|
|
149
|
+
display: "none",
|
|
150
|
+
}}
|
|
151
|
+
/>
|
|
152
|
+
</TooltipSimple>
|
|
153
|
+
)}
|
|
154
|
+
{isCollapsible && (
|
|
155
|
+
<Button
|
|
156
|
+
accessibilityLabel="Show or hide code"
|
|
157
|
+
size="$2"
|
|
158
|
+
onPress={() => setIsCollapsed((x) => !x)}
|
|
159
|
+
>
|
|
160
|
+
{isCollapsed ? "Show code" : "Hide code"}
|
|
161
|
+
</Button>
|
|
162
|
+
)}
|
|
163
|
+
</XStack>
|
|
164
|
+
</YStack>
|
|
165
|
+
</ErrorBoundary>
|
|
166
|
+
</YStack>
|
|
167
|
+
);
|
|
168
|
+
}
|