@multiplatform.one/markdown 6.0.4 → 6.3.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/README.md +61 -0
- package/dist/cjs/Aside/index.cjs +37 -32
- package/dist/cjs/Aside/index.native.js +41 -34
- package/dist/cjs/Aside/index.native.js.map +1 -1
- package/dist/cjs/ExternalIcon/index.cjs +2 -0
- package/dist/cjs/ExternalIcon/index.native.js +2 -0
- package/dist/cjs/ExternalIcon/index.native.js.map +1 -1
- package/dist/cjs/Hr/index.cjs +3 -11
- package/dist/cjs/Hr/index.native.js +3 -11
- package/dist/cjs/Hr/index.native.js.map +1 -1
- package/dist/cjs/{SimpleTable → MarkdownSimpleTable}/index.cjs +27 -9
- package/dist/{jsx/SimpleTable → cjs/MarkdownSimpleTable}/index.native.js +32 -11
- package/dist/cjs/MarkdownSimpleTable/index.native.js.map +1 -0
- package/dist/cjs/Mdx/index.cjs +15 -7
- package/dist/cjs/Mdx/index.native.js +15 -7
- package/dist/cjs/Mdx/index.native.js.map +1 -1
- package/dist/cjs/MdxCodeBlock/index.cjs +28 -20
- package/dist/cjs/MdxCodeBlock/index.native.js +33 -22
- package/dist/cjs/MdxCodeBlock/index.native.js.map +1 -1
- package/dist/cjs/Notice/index.cjs +13 -56
- package/dist/cjs/Notice/index.native.js +13 -56
- package/dist/cjs/Notice/index.native.js.map +1 -1
- package/dist/cjs/Table/index.cjs +13 -0
- package/dist/cjs/Table/index.native.js +15 -0
- package/dist/cjs/Table/index.native.js.map +1 -1
- package/dist/cjs/Tabs/index.cjs +15 -47
- package/dist/cjs/Tabs/index.native.js +20 -52
- package/dist/cjs/Tabs/index.native.js.map +1 -1
- package/dist/cjs/Ul/index.cjs +2 -2
- package/dist/cjs/Ul/index.native.js +2 -2
- package/dist/cjs/Ul/index.native.js.map +1 -1
- package/dist/cjs/Video/index.cjs +4 -2
- package/dist/cjs/Video/index.native.js +4 -2
- package/dist/cjs/Video/index.native.js.map +1 -1
- package/dist/cjs/components/Blockquote.cjs +16 -3
- package/dist/cjs/components/Blockquote.native.js +25 -3
- package/dist/cjs/components/Blockquote.native.js.map +1 -1
- package/dist/cjs/components/Break.cjs +1 -0
- package/dist/cjs/components/Break.native.js +1 -0
- package/dist/cjs/components/Break.native.js.map +1 -1
- package/dist/cjs/components/CodeBlock.cjs +20 -60
- package/dist/cjs/components/CodeBlock.native.js +22 -64
- package/dist/cjs/components/CodeBlock.native.js.map +1 -1
- package/dist/cjs/components/Heading.cjs +23 -0
- package/dist/cjs/components/Heading.native.js +24 -0
- package/dist/cjs/components/Heading.native.js.map +1 -1
- package/dist/cjs/components/Image.cjs +3 -5
- package/dist/cjs/components/Image.native.js +6 -5
- package/dist/cjs/components/Image.native.js.map +1 -1
- package/dist/cjs/components/InlineCode.cjs +3 -6
- package/dist/cjs/components/InlineCode.native.js +3 -6
- package/dist/cjs/components/InlineCode.native.js.map +1 -1
- package/dist/cjs/components/InlineStyles.cjs +3 -0
- package/dist/cjs/components/InlineStyles.native.js +3 -0
- package/dist/cjs/components/InlineStyles.native.js.map +1 -1
- package/dist/cjs/components/Link.cjs +22 -5
- package/dist/cjs/components/Link.native.js +23 -5
- package/dist/cjs/components/Link.native.js.map +1 -1
- package/dist/cjs/components/List.cjs +87 -9
- package/dist/cjs/components/List.native.js +91 -9
- package/dist/cjs/components/List.native.js.map +1 -1
- package/dist/cjs/components/Paragraph.cjs +6 -1
- package/dist/cjs/components/Paragraph.native.js +6 -1
- package/dist/cjs/components/Paragraph.native.js.map +1 -1
- package/dist/cjs/components/Table.cjs +57 -24
- package/dist/cjs/components/Table.native.js +67 -25
- package/dist/cjs/components/Table.native.js.map +1 -1
- package/dist/cjs/hooks/useCompileMdx.cjs +61 -28
- package/dist/cjs/hooks/useCompileMdx.native.js +80 -28
- package/dist/cjs/hooks/useCompileMdx.native.js.map +1 -1
- package/dist/cjs/hooks/useEvaluateMdx.cjs +7 -1
- package/dist/cjs/hooks/useEvaluateMdx.native.js +9 -3
- package/dist/cjs/hooks/useEvaluateMdx.native.js.map +1 -1
- package/dist/cjs/icons/index.cjs +31 -101
- package/dist/cjs/icons/index.native.js +36 -116
- package/dist/cjs/icons/index.native.js.map +1 -1
- package/dist/cjs/index.cjs +6 -4
- package/dist/cjs/index.native.js +6 -4
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/mdxComponents.cjs +13 -6
- package/dist/cjs/mdxComponents.native.js +16 -6
- package/dist/cjs/mdxComponents.native.js.map +1 -1
- package/dist/cjs/mermaid/MermaidBlock.cjs +110 -0
- package/dist/cjs/mermaid/MermaidBlock.native.js +41 -0
- package/dist/cjs/mermaid/MermaidBlock.native.js.map +1 -0
- package/dist/cjs/mermaid/index.cjs +31 -0
- package/dist/cjs/mermaid/index.native.js +34 -0
- package/dist/cjs/mermaid/index.native.js.map +1 -0
- package/dist/cjs/mermaid/mountDiagramSvg.cjs +54 -0
- package/dist/cjs/mermaid/mountDiagramSvg.native.js +98 -0
- package/dist/cjs/mermaid/mountDiagramSvg.native.js.map +1 -0
- package/dist/cjs/mermaid/renderMermaidDiagram.cjs +92 -0
- package/dist/cjs/mermaid/renderMermaidDiagram.native.js +110 -0
- package/dist/cjs/mermaid/renderMermaidDiagram.native.js.map +1 -0
- package/dist/cjs/renderer.cjs +9 -1
- package/dist/cjs/renderer.native.js +10 -2
- package/dist/cjs/renderer.native.js.map +1 -1
- package/dist/cjs/shared/colorRamps.cjs +1 -11
- package/dist/cjs/shared/colorRamps.native.js +1 -11
- package/dist/cjs/shared/colorRamps.native.js.map +1 -1
- package/dist/cjs/shared/cutoffGradient.cjs +54 -0
- package/dist/cjs/shared/cutoffGradient.native.js +63 -0
- package/dist/cjs/shared/cutoffGradient.native.js.map +1 -0
- package/dist/cjs/shiki/index.cjs +1 -16
- package/dist/cjs/shiki/index.native.js +0 -15
- package/dist/cjs/shiki/index.native.js.map +1 -1
- package/dist/esm/Aside/index.mjs +39 -34
- package/dist/esm/Aside/index.mjs.map +1 -1
- package/dist/esm/Aside/index.native.js +43 -36
- package/dist/esm/Aside/index.native.js.map +1 -1
- package/dist/esm/ExternalIcon/index.mjs +2 -0
- package/dist/esm/ExternalIcon/index.mjs.map +1 -1
- package/dist/esm/ExternalIcon/index.native.js +2 -0
- package/dist/esm/ExternalIcon/index.native.js.map +1 -1
- package/dist/esm/Hr/index.mjs +4 -12
- package/dist/esm/Hr/index.mjs.map +1 -1
- package/dist/esm/Hr/index.native.js +4 -12
- package/dist/esm/Hr/index.native.js.map +1 -1
- package/dist/esm/{SimpleTable → MarkdownSimpleTable}/index.mjs +24 -6
- package/dist/esm/MarkdownSimpleTable/index.mjs.map +1 -0
- package/dist/esm/{SimpleTable → MarkdownSimpleTable}/index.native.js +29 -8
- package/dist/esm/MarkdownSimpleTable/index.native.js.map +1 -0
- package/dist/esm/Mdx/index.mjs +15 -7
- package/dist/esm/Mdx/index.mjs.map +1 -1
- package/dist/esm/Mdx/index.native.js +15 -7
- package/dist/esm/Mdx/index.native.js.map +1 -1
- package/dist/esm/MdxCodeBlock/index.mjs +30 -22
- package/dist/esm/MdxCodeBlock/index.mjs.map +1 -1
- package/dist/esm/MdxCodeBlock/index.native.js +35 -24
- package/dist/esm/MdxCodeBlock/index.native.js.map +1 -1
- package/dist/esm/Notice/index.mjs +15 -57
- package/dist/esm/Notice/index.mjs.map +1 -1
- package/dist/esm/Notice/index.native.js +15 -57
- package/dist/esm/Notice/index.native.js.map +1 -1
- package/dist/esm/Table/index.mjs +13 -0
- package/dist/esm/Table/index.mjs.map +1 -1
- package/dist/esm/Table/index.native.js +15 -0
- package/dist/esm/Table/index.native.js.map +1 -1
- package/dist/esm/Tabs/index.mjs +17 -49
- package/dist/esm/Tabs/index.mjs.map +1 -1
- package/dist/esm/Tabs/index.native.js +22 -54
- package/dist/esm/Tabs/index.native.js.map +1 -1
- package/dist/esm/Ul/index.mjs +2 -2
- package/dist/esm/Ul/index.mjs.map +1 -1
- package/dist/esm/Ul/index.native.js +2 -2
- package/dist/esm/Ul/index.native.js.map +1 -1
- package/dist/esm/Video/index.mjs +4 -2
- package/dist/esm/Video/index.mjs.map +1 -1
- package/dist/esm/Video/index.native.js +4 -2
- package/dist/esm/Video/index.native.js.map +1 -1
- package/dist/esm/components/Blockquote.mjs +17 -4
- package/dist/esm/components/Blockquote.mjs.map +1 -1
- package/dist/esm/components/Blockquote.native.js +26 -4
- package/dist/esm/components/Blockquote.native.js.map +1 -1
- package/dist/esm/components/Break.mjs +2 -1
- package/dist/esm/components/Break.mjs.map +1 -1
- package/dist/esm/components/Break.native.js +2 -1
- package/dist/esm/components/Break.native.js.map +1 -1
- package/dist/esm/components/CodeBlock.mjs +21 -61
- package/dist/esm/components/CodeBlock.mjs.map +1 -1
- package/dist/esm/components/CodeBlock.native.js +23 -65
- package/dist/esm/components/CodeBlock.native.js.map +1 -1
- package/dist/esm/components/Heading.mjs +24 -1
- package/dist/esm/components/Heading.mjs.map +1 -1
- package/dist/esm/components/Heading.native.js +25 -1
- package/dist/esm/components/Heading.native.js.map +1 -1
- package/dist/esm/components/Image.mjs +3 -5
- package/dist/esm/components/Image.mjs.map +1 -1
- package/dist/esm/components/Image.native.js +6 -5
- package/dist/esm/components/Image.native.js.map +1 -1
- package/dist/esm/components/InlineCode.mjs +3 -6
- package/dist/esm/components/InlineCode.mjs.map +1 -1
- package/dist/esm/components/InlineCode.native.js +3 -6
- package/dist/esm/components/InlineCode.native.js.map +1 -1
- package/dist/esm/components/InlineStyles.mjs +3 -0
- package/dist/esm/components/InlineStyles.mjs.map +1 -1
- package/dist/esm/components/InlineStyles.native.js +3 -0
- package/dist/esm/components/InlineStyles.native.js.map +1 -1
- package/dist/esm/components/Link.mjs +23 -6
- package/dist/esm/components/Link.mjs.map +1 -1
- package/dist/esm/components/Link.native.js +24 -6
- package/dist/esm/components/Link.native.js.map +1 -1
- package/dist/esm/components/List.mjs +88 -10
- package/dist/esm/components/List.mjs.map +1 -1
- package/dist/esm/components/List.native.js +92 -10
- package/dist/esm/components/List.native.js.map +1 -1
- package/dist/esm/components/Paragraph.mjs +6 -1
- package/dist/esm/components/Paragraph.mjs.map +1 -1
- package/dist/esm/components/Paragraph.native.js +6 -1
- package/dist/esm/components/Paragraph.native.js.map +1 -1
- package/dist/esm/components/Table.mjs +59 -26
- package/dist/esm/components/Table.mjs.map +1 -1
- package/dist/esm/components/Table.native.js +69 -27
- package/dist/esm/components/Table.native.js.map +1 -1
- package/dist/esm/hooks/useCompileMdx.mjs +61 -29
- package/dist/esm/hooks/useCompileMdx.mjs.map +1 -1
- package/dist/esm/hooks/useCompileMdx.native.js +80 -29
- package/dist/esm/hooks/useCompileMdx.native.js.map +1 -1
- package/dist/esm/hooks/useEvaluateMdx.mjs +7 -1
- package/dist/esm/hooks/useEvaluateMdx.mjs.map +1 -1
- package/dist/esm/hooks/useEvaluateMdx.native.js +9 -3
- package/dist/esm/hooks/useEvaluateMdx.native.js.map +1 -1
- package/dist/esm/icons/index.mjs +32 -100
- package/dist/esm/icons/index.mjs.map +1 -1
- package/dist/esm/icons/index.native.js +37 -115
- package/dist/esm/icons/index.native.js.map +1 -1
- package/dist/esm/index.mjs +5 -3
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +5 -3
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/mdxComponents.mjs +14 -7
- package/dist/esm/mdxComponents.mjs.map +1 -1
- package/dist/esm/mdxComponents.native.js +17 -7
- package/dist/esm/mdxComponents.native.js.map +1 -1
- package/dist/esm/mermaid/MermaidBlock.mjs +85 -0
- package/dist/esm/mermaid/MermaidBlock.mjs.map +1 -0
- package/dist/esm/mermaid/MermaidBlock.native.js +13 -0
- package/dist/esm/mermaid/MermaidBlock.native.js.map +1 -0
- package/dist/esm/mermaid/index.mjs +4 -0
- package/dist/esm/mermaid/index.mjs.map +1 -0
- package/dist/esm/mermaid/index.native.js +4 -0
- package/dist/esm/mermaid/index.native.js.map +1 -0
- package/dist/esm/mermaid/mountDiagramSvg.mjs +29 -0
- package/dist/esm/mermaid/mountDiagramSvg.mjs.map +1 -0
- package/dist/esm/mermaid/mountDiagramSvg.native.js +70 -0
- package/dist/esm/mermaid/mountDiagramSvg.native.js.map +1 -0
- package/dist/esm/mermaid/renderMermaidDiagram.mjs +55 -0
- package/dist/esm/mermaid/renderMermaidDiagram.mjs.map +1 -0
- package/dist/esm/mermaid/renderMermaidDiagram.native.js +70 -0
- package/dist/esm/mermaid/renderMermaidDiagram.native.js.map +1 -0
- package/dist/esm/renderer.mjs +9 -1
- package/dist/esm/renderer.mjs.map +1 -1
- package/dist/esm/renderer.native.js +10 -2
- package/dist/esm/renderer.native.js.map +1 -1
- package/dist/esm/shared/colorRamps.mjs +1 -10
- package/dist/esm/shared/colorRamps.mjs.map +1 -1
- package/dist/esm/shared/colorRamps.native.js +1 -10
- package/dist/esm/shared/colorRamps.native.js.map +1 -1
- package/dist/esm/shared/cutoffGradient.mjs +28 -0
- package/dist/esm/shared/cutoffGradient.mjs.map +1 -0
- package/dist/esm/shared/cutoffGradient.native.js +34 -0
- package/dist/esm/shared/cutoffGradient.native.js.map +1 -0
- package/dist/esm/shiki/index.mjs +1 -2
- package/dist/esm/shiki/index.mjs.map +1 -1
- package/dist/esm/shiki/index.native.js +1 -2
- package/dist/esm/shiki/index.native.js.map +1 -1
- package/dist/jsx/Aside/index.mjs +39 -34
- package/dist/jsx/Aside/index.mjs.map +1 -1
- package/dist/jsx/Aside/index.native.js +41 -34
- package/dist/jsx/Aside/index.native.js.map +1 -1
- package/dist/jsx/ExternalIcon/index.mjs +2 -0
- package/dist/jsx/ExternalIcon/index.mjs.map +1 -1
- package/dist/jsx/ExternalIcon/index.native.js +2 -0
- package/dist/jsx/ExternalIcon/index.native.js.map +1 -1
- package/dist/jsx/Hr/index.mjs +4 -12
- package/dist/jsx/Hr/index.mjs.map +1 -1
- package/dist/jsx/Hr/index.native.js +3 -11
- package/dist/jsx/Hr/index.native.js.map +1 -1
- package/dist/jsx/{SimpleTable → MarkdownSimpleTable}/index.mjs +24 -6
- package/dist/jsx/MarkdownSimpleTable/index.mjs.map +1 -0
- package/dist/{cjs/SimpleTable → jsx/MarkdownSimpleTable}/index.native.js +32 -11
- package/dist/jsx/MarkdownSimpleTable/index.native.js.map +1 -0
- package/dist/jsx/Mdx/index.mjs +15 -7
- package/dist/jsx/Mdx/index.mjs.map +1 -1
- package/dist/jsx/Mdx/index.native.js +15 -7
- package/dist/jsx/Mdx/index.native.js.map +1 -1
- package/dist/jsx/MdxCodeBlock/index.mjs +30 -22
- package/dist/jsx/MdxCodeBlock/index.mjs.map +1 -1
- package/dist/jsx/MdxCodeBlock/index.native.js +33 -22
- package/dist/jsx/MdxCodeBlock/index.native.js.map +1 -1
- package/dist/jsx/Notice/index.mjs +15 -57
- package/dist/jsx/Notice/index.mjs.map +1 -1
- package/dist/jsx/Notice/index.native.js +13 -56
- package/dist/jsx/Notice/index.native.js.map +1 -1
- package/dist/jsx/Table/index.mjs +13 -0
- package/dist/jsx/Table/index.mjs.map +1 -1
- package/dist/jsx/Table/index.native.js +15 -0
- package/dist/jsx/Table/index.native.js.map +1 -1
- package/dist/jsx/Tabs/index.mjs +17 -49
- package/dist/jsx/Tabs/index.mjs.map +1 -1
- package/dist/jsx/Tabs/index.native.js +20 -52
- package/dist/jsx/Tabs/index.native.js.map +1 -1
- package/dist/jsx/Ul/index.mjs +2 -2
- package/dist/jsx/Ul/index.mjs.map +1 -1
- package/dist/jsx/Ul/index.native.js +2 -2
- package/dist/jsx/Ul/index.native.js.map +1 -1
- package/dist/jsx/Video/index.mjs +4 -2
- package/dist/jsx/Video/index.mjs.map +1 -1
- package/dist/jsx/Video/index.native.js +4 -2
- package/dist/jsx/Video/index.native.js.map +1 -1
- package/dist/jsx/components/Blockquote.mjs +17 -4
- package/dist/jsx/components/Blockquote.mjs.map +1 -1
- package/dist/jsx/components/Blockquote.native.js +25 -3
- package/dist/jsx/components/Blockquote.native.js.map +1 -1
- package/dist/jsx/components/Break.mjs +2 -1
- package/dist/jsx/components/Break.mjs.map +1 -1
- package/dist/jsx/components/Break.native.js +1 -0
- package/dist/jsx/components/Break.native.js.map +1 -1
- package/dist/jsx/components/CodeBlock.mjs +21 -61
- package/dist/jsx/components/CodeBlock.mjs.map +1 -1
- package/dist/jsx/components/CodeBlock.native.js +22 -64
- package/dist/jsx/components/CodeBlock.native.js.map +1 -1
- package/dist/jsx/components/Heading.mjs +24 -1
- package/dist/jsx/components/Heading.mjs.map +1 -1
- package/dist/jsx/components/Heading.native.js +24 -0
- package/dist/jsx/components/Heading.native.js.map +1 -1
- package/dist/jsx/components/Image.mjs +3 -5
- package/dist/jsx/components/Image.mjs.map +1 -1
- package/dist/jsx/components/Image.native.js +6 -5
- package/dist/jsx/components/Image.native.js.map +1 -1
- package/dist/jsx/components/InlineCode.mjs +3 -6
- package/dist/jsx/components/InlineCode.mjs.map +1 -1
- package/dist/jsx/components/InlineCode.native.js +3 -6
- package/dist/jsx/components/InlineCode.native.js.map +1 -1
- package/dist/jsx/components/InlineStyles.mjs +3 -0
- package/dist/jsx/components/InlineStyles.mjs.map +1 -1
- package/dist/jsx/components/InlineStyles.native.js +3 -0
- package/dist/jsx/components/InlineStyles.native.js.map +1 -1
- package/dist/jsx/components/Link.mjs +23 -6
- package/dist/jsx/components/Link.mjs.map +1 -1
- package/dist/jsx/components/Link.native.js +23 -5
- package/dist/jsx/components/Link.native.js.map +1 -1
- package/dist/jsx/components/List.mjs +88 -10
- package/dist/jsx/components/List.mjs.map +1 -1
- package/dist/jsx/components/List.native.js +91 -9
- package/dist/jsx/components/List.native.js.map +1 -1
- package/dist/jsx/components/Paragraph.mjs +6 -1
- package/dist/jsx/components/Paragraph.mjs.map +1 -1
- package/dist/jsx/components/Paragraph.native.js +6 -1
- package/dist/jsx/components/Paragraph.native.js.map +1 -1
- package/dist/jsx/components/Table.mjs +59 -26
- package/dist/jsx/components/Table.mjs.map +1 -1
- package/dist/jsx/components/Table.native.js +67 -25
- package/dist/jsx/components/Table.native.js.map +1 -1
- package/dist/jsx/hooks/useCompileMdx.mjs +61 -29
- package/dist/jsx/hooks/useCompileMdx.mjs.map +1 -1
- package/dist/jsx/hooks/useCompileMdx.native.js +80 -28
- package/dist/jsx/hooks/useCompileMdx.native.js.map +1 -1
- package/dist/jsx/hooks/useEvaluateMdx.mjs +7 -1
- package/dist/jsx/hooks/useEvaluateMdx.mjs.map +1 -1
- package/dist/jsx/hooks/useEvaluateMdx.native.js +9 -3
- package/dist/jsx/hooks/useEvaluateMdx.native.js.map +1 -1
- package/dist/jsx/icons/index.mjs +32 -100
- package/dist/jsx/icons/index.mjs.map +1 -1
- package/dist/jsx/icons/index.native.js +36 -116
- package/dist/jsx/icons/index.native.js.map +1 -1
- package/dist/jsx/index.js +5 -3
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +5 -3
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +6 -4
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/mdxComponents.mjs +14 -7
- package/dist/jsx/mdxComponents.mjs.map +1 -1
- package/dist/jsx/mdxComponents.native.js +16 -6
- package/dist/jsx/mdxComponents.native.js.map +1 -1
- package/dist/jsx/mermaid/MermaidBlock.mjs +85 -0
- package/dist/jsx/mermaid/MermaidBlock.mjs.map +1 -0
- package/dist/jsx/mermaid/MermaidBlock.native.js +41 -0
- package/dist/jsx/mermaid/MermaidBlock.native.js.map +1 -0
- package/dist/jsx/mermaid/index.mjs +4 -0
- package/dist/jsx/mermaid/index.mjs.map +1 -0
- package/dist/jsx/mermaid/index.native.js +34 -0
- package/dist/jsx/mermaid/index.native.js.map +1 -0
- package/dist/jsx/mermaid/mountDiagramSvg.mjs +29 -0
- package/dist/jsx/mermaid/mountDiagramSvg.mjs.map +1 -0
- package/dist/jsx/mermaid/mountDiagramSvg.native.js +98 -0
- package/dist/jsx/mermaid/mountDiagramSvg.native.js.map +1 -0
- package/dist/jsx/mermaid/renderMermaidDiagram.mjs +55 -0
- package/dist/jsx/mermaid/renderMermaidDiagram.mjs.map +1 -0
- package/dist/jsx/mermaid/renderMermaidDiagram.native.js +110 -0
- package/dist/jsx/mermaid/renderMermaidDiagram.native.js.map +1 -0
- package/dist/jsx/renderer.mjs +9 -1
- package/dist/jsx/renderer.mjs.map +1 -1
- package/dist/jsx/renderer.native.js +10 -2
- package/dist/jsx/renderer.native.js.map +1 -1
- package/dist/jsx/shared/colorRamps.mjs +1 -10
- package/dist/jsx/shared/colorRamps.mjs.map +1 -1
- package/dist/jsx/shared/colorRamps.native.js +1 -11
- package/dist/jsx/shared/colorRamps.native.js.map +1 -1
- package/dist/jsx/shared/cutoffGradient.mjs +28 -0
- package/dist/jsx/shared/cutoffGradient.mjs.map +1 -0
- package/dist/jsx/shared/cutoffGradient.native.js +63 -0
- package/dist/jsx/shared/cutoffGradient.native.js.map +1 -0
- package/dist/jsx/shiki/index.mjs +1 -2
- package/dist/jsx/shiki/index.mjs.map +1 -1
- package/dist/jsx/shiki/index.native.js +0 -15
- package/dist/jsx/shiki/index.native.js.map +1 -1
- package/package.json +25 -14
- package/src/Aside/index.tsx +42 -35
- package/src/ExternalIcon/index.tsx +8 -1
- package/src/Hr/index.tsx +3 -6
- package/src/{SimpleTable → MarkdownSimpleTable}/index.tsx +30 -12
- package/src/MarkdownSimpleTable/markdownSimpleTable.spec.tsx +92 -0
- package/src/Mdx/index.tsx +12 -7
- package/src/MdxCodeBlock/index.tsx +33 -20
- package/src/Notice/index.tsx +12 -54
- package/src/Table/index.tsx +22 -6
- package/src/Tabs/index.tsx +26 -52
- package/src/Ul/index.ts +2 -2
- package/src/Video/index.tsx +15 -12
- package/src/components/Blockquote.tsx +29 -4
- package/src/components/Break.tsx +3 -1
- package/src/components/CodeBlock.tsx +49 -79
- package/src/components/Heading.tsx +15 -2
- package/src/components/Image.tsx +6 -3
- package/src/components/InlineCode.tsx +14 -7
- package/src/components/InlineStyles.tsx +15 -3
- package/src/components/Link.tsx +29 -6
- package/src/components/List.tsx +111 -11
- package/src/components/Paragraph.tsx +6 -1
- package/src/components/Table.tsx +56 -35
- package/src/components/markdownPrimitives.spec.tsx +121 -0
- package/src/docBlocks.spec.tsx +85 -0
- package/src/hooks/useCompileMdx.ts +75 -35
- package/src/hooks/useEvaluateMdx.ts +7 -1
- package/src/icons/index.tsx +36 -58
- package/src/index.ts +15 -3
- package/src/markdownComponent.spec.tsx +58 -0
- package/src/mdx.spec.tsx +4 -0
- package/src/mdxComponents.spec.tsx +185 -0
- package/src/mdxComponents.tsx +14 -5
- package/src/mermaid/MermaidBlock.native.tsx +15 -0
- package/src/mermaid/MermaidBlock.tsx +88 -0
- package/src/mermaid/index.ts +23 -0
- package/src/mermaid/mountDiagramSvg.ts +49 -0
- package/src/mermaid/renderMermaidDiagram.spec.ts +89 -0
- package/src/mermaid/renderMermaidDiagram.ts +78 -0
- package/src/renderer.spec.tsx +276 -0
- package/src/renderer.tsx +13 -1
- package/src/shared/colorRamps.ts +0 -10
- package/src/shared/cutoffGradient.ts +40 -0
- package/src/shiki/index.ts +7 -11
- package/src/stories/Blocks.stories.tsx +232 -0
- package/src/stories/Callouts.stories.tsx +147 -0
- package/src/stories/Code.stories.tsx +116 -0
- package/src/stories/Inline.stories.tsx +162 -0
- package/src/stories/Mdx.stories.tsx +107 -0
- package/src/stories/Media.stories.tsx +148 -0
- package/src/stories/Tables.stories.tsx +173 -0
- package/types/Aside/index.d.ts +11 -0
- package/types/Aside/index.d.ts.map +1 -0
- package/types/ExternalIcon/index.d.ts +2 -0
- package/types/ExternalIcon/index.d.ts.map +1 -0
- package/types/Hr/index.d.ts +2 -0
- package/types/Hr/index.d.ts.map +1 -0
- package/types/Li/index.d.ts +6 -0
- package/types/Li/index.d.ts.map +1 -0
- package/types/Markdown.d.ts +22 -0
- package/types/Markdown.d.ts.map +1 -0
- package/types/MarkdownSimpleTable/index.d.ts +16 -0
- package/types/MarkdownSimpleTable/index.d.ts.map +1 -0
- package/types/Mdx/index.d.ts +9 -0
- package/types/Mdx/index.d.ts.map +1 -0
- package/types/MdxCodeBlock/index.d.ts +7 -0
- package/types/MdxCodeBlock/index.d.ts.map +1 -0
- package/types/MdxCodeBlock/mdxCodeBlockContext.d.ts +13 -0
- package/types/MdxCodeBlock/mdxCodeBlockContext.d.ts.map +1 -0
- package/types/Notice/index.d.ts +12 -0
- package/types/Notice/index.d.ts.map +1 -0
- package/types/Table/index.d.ts +20 -0
- package/types/Table/index.d.ts.map +1 -0
- package/types/Tabs/index.d.ts +21 -0
- package/types/Tabs/index.d.ts.map +1 -0
- package/types/Ul/index.d.ts +6 -0
- package/types/Ul/index.d.ts.map +1 -0
- package/types/Video/index.d.ts +12 -0
- package/types/Video/index.d.ts.map +1 -0
- package/types/components/Blockquote.d.ts +3 -0
- package/types/components/Blockquote.d.ts.map +1 -0
- package/types/components/Break.d.ts +3 -0
- package/types/components/Break.d.ts.map +1 -0
- package/types/components/CodeBlock.d.ts +17 -0
- package/types/components/CodeBlock.d.ts.map +1 -0
- package/types/components/Heading.d.ts +3 -0
- package/types/components/Heading.d.ts.map +1 -0
- package/types/components/HorizontalRule.d.ts +3 -0
- package/types/components/HorizontalRule.d.ts.map +1 -0
- package/types/components/Image.d.ts +3 -0
- package/types/components/Image.d.ts.map +1 -0
- package/types/components/InlineCode.d.ts +12 -0
- package/types/components/InlineCode.d.ts.map +1 -0
- package/types/components/InlineStyles.d.ts +5 -0
- package/types/components/InlineStyles.d.ts.map +1 -0
- package/types/components/Link.d.ts +3 -0
- package/types/components/Link.d.ts.map +1 -0
- package/types/components/List.d.ts +10 -0
- package/types/components/List.d.ts.map +1 -0
- package/types/components/Paragraph.d.ts +3 -0
- package/types/components/Paragraph.d.ts.map +1 -0
- package/types/components/Table.d.ts +13 -0
- package/types/components/Table.d.ts.map +1 -0
- package/types/components/index.d.ts +13 -0
- package/types/components/index.d.ts.map +1 -0
- package/types/hooks/index.d.ts +4 -0
- package/types/hooks/index.d.ts.map +1 -0
- package/types/hooks/useCompileAndEvaluateMdx.d.ts +9 -0
- package/types/hooks/useCompileAndEvaluateMdx.d.ts.map +1 -0
- package/types/hooks/useCompileMdx.d.ts +13 -0
- package/types/hooks/useCompileMdx.d.ts.map +1 -0
- package/types/hooks/useEvaluateMdx.d.ts +5 -0
- package/types/hooks/useEvaluateMdx.d.ts.map +1 -0
- package/types/icons/index.d.ts +12 -0
- package/types/icons/index.d.ts.map +1 -0
- package/types/index.d.ts +29 -0
- package/types/index.d.ts.map +1 -0
- package/types/mdxComponents.d.ts +8 -0
- package/types/mdxComponents.d.ts.map +1 -0
- package/types/mermaid/MermaidBlock.d.ts +15 -0
- package/types/mermaid/MermaidBlock.d.ts.map +1 -0
- package/types/mermaid/MermaidBlock.native.d.ts +10 -0
- package/types/mermaid/MermaidBlock.native.d.ts.map +1 -0
- package/types/mermaid/index.d.ts +18 -0
- package/types/mermaid/index.d.ts.map +1 -0
- package/types/mermaid/mountDiagramSvg.d.ts +11 -0
- package/types/mermaid/mountDiagramSvg.d.ts.map +1 -0
- package/types/mermaid/renderMermaidDiagram.d.ts +33 -0
- package/types/mermaid/renderMermaidDiagram.d.ts.map +1 -0
- package/types/parser.d.ts +11 -0
- package/types/parser.d.ts.map +1 -0
- package/types/renderer.d.ts +32 -0
- package/types/renderer.d.ts.map +1 -0
- package/types/shared/colorRamps.d.ts +39 -0
- package/types/shared/colorRamps.d.ts.map +1 -0
- package/types/shared/cutoffGradient.d.ts +12 -0
- package/types/shared/cutoffGradient.d.ts.map +1 -0
- package/types/shared/index.d.ts +2 -0
- package/types/shared/index.d.ts.map +1 -0
- package/types/shiki/index.d.ts +8 -0
- package/types/shiki/index.d.ts.map +1 -0
- package/types/types.d.ts +160 -0
- package/types/types.d.ts.map +1 -0
- package/types/util/rehypeMetaAttributes.d.ts +2 -0
- package/types/util/rehypeMetaAttributes.d.ts.map +1 -0
- package/dist/cjs/ExternalIcon/ExternalIcon.spec.cjs +0 -37
- package/dist/cjs/ExternalIcon/ExternalIcon.spec.native.js +0 -40
- package/dist/cjs/ExternalIcon/ExternalIcon.spec.native.js.map +0 -1
- package/dist/cjs/Hr/hr.spec.cjs +0 -21
- package/dist/cjs/Hr/hr.spec.native.js +0 -24
- package/dist/cjs/Hr/hr.spec.native.js.map +0 -1
- package/dist/cjs/Li/li.spec.cjs +0 -45
- package/dist/cjs/Li/li.spec.native.js +0 -50
- package/dist/cjs/Li/li.spec.native.js.map +0 -1
- package/dist/cjs/Markdown.stories.cjs +0 -153
- package/dist/cjs/Markdown.stories.native.js +0 -162
- package/dist/cjs/Markdown.stories.native.js.map +0 -1
- package/dist/cjs/Mdx/mdx.spec.cjs +0 -139
- package/dist/cjs/Mdx/mdx.spec.native.js +0 -158
- package/dist/cjs/Mdx/mdx.spec.native.js.map +0 -1
- package/dist/cjs/MdxCodeBlock/mdxCodeBlock.spec.cjs +0 -90
- package/dist/cjs/MdxCodeBlock/mdxCodeBlock.spec.native.js +0 -122
- package/dist/cjs/MdxCodeBlock/mdxCodeBlock.spec.native.js.map +0 -1
- package/dist/cjs/SimpleTable/index.native.js.map +0 -1
- package/dist/cjs/Ul/ul.spec.cjs +0 -150
- package/dist/cjs/Ul/ul.spec.native.js +0 -153
- package/dist/cjs/Ul/ul.spec.native.js.map +0 -1
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.spec.cjs +0 -34
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.spec.native.js +0 -49
- package/dist/cjs/hooks/useCompileAndEvaluateMdx.spec.native.js.map +0 -1
- package/dist/cjs/mdx.spec.cjs +0 -400
- package/dist/cjs/mdx.spec.native.js +0 -465
- package/dist/cjs/mdx.spec.native.js.map +0 -1
- package/dist/cjs/parser.spec.cjs +0 -109
- package/dist/cjs/parser.spec.native.js +0 -114
- package/dist/cjs/parser.spec.native.js.map +0 -1
- package/dist/cjs/shiki/highlighter.cjs +0 -89
- package/dist/cjs/shiki/highlighter.native.js +0 -94
- package/dist/cjs/shiki/highlighter.native.js.map +0 -1
- package/dist/cjs/util/util.spec.cjs +0 -81
- package/dist/cjs/util/util.spec.native.js +0 -84
- package/dist/cjs/util/util.spec.native.js.map +0 -1
- package/dist/esm/ExternalIcon/ExternalIcon.spec.mjs +0 -38
- package/dist/esm/ExternalIcon/ExternalIcon.spec.mjs.map +0 -1
- package/dist/esm/ExternalIcon/ExternalIcon.spec.native.js +0 -38
- package/dist/esm/ExternalIcon/ExternalIcon.spec.native.js.map +0 -1
- package/dist/esm/Hr/hr.spec.mjs +0 -22
- package/dist/esm/Hr/hr.spec.mjs.map +0 -1
- package/dist/esm/Hr/hr.spec.native.js +0 -22
- package/dist/esm/Hr/hr.spec.native.js.map +0 -1
- package/dist/esm/Li/li.spec.mjs +0 -46
- package/dist/esm/Li/li.spec.mjs.map +0 -1
- package/dist/esm/Li/li.spec.native.js +0 -48
- package/dist/esm/Li/li.spec.native.js.map +0 -1
- package/dist/esm/Markdown.stories.mjs +0 -125
- package/dist/esm/Markdown.stories.mjs.map +0 -1
- package/dist/esm/Markdown.stories.native.js +0 -131
- package/dist/esm/Markdown.stories.native.js.map +0 -1
- package/dist/esm/Mdx/mdx.spec.mjs +0 -140
- package/dist/esm/Mdx/mdx.spec.mjs.map +0 -1
- package/dist/esm/Mdx/mdx.spec.native.js +0 -156
- package/dist/esm/Mdx/mdx.spec.native.js.map +0 -1
- package/dist/esm/MdxCodeBlock/mdxCodeBlock.spec.mjs +0 -91
- package/dist/esm/MdxCodeBlock/mdxCodeBlock.spec.mjs.map +0 -1
- package/dist/esm/MdxCodeBlock/mdxCodeBlock.spec.native.js +0 -96
- package/dist/esm/MdxCodeBlock/mdxCodeBlock.spec.native.js.map +0 -1
- package/dist/esm/SimpleTable/index.mjs.map +0 -1
- package/dist/esm/SimpleTable/index.native.js.map +0 -1
- package/dist/esm/Ul/ul.spec.mjs +0 -151
- package/dist/esm/Ul/ul.spec.mjs.map +0 -1
- package/dist/esm/Ul/ul.spec.native.js +0 -151
- package/dist/esm/Ul/ul.spec.native.js.map +0 -1
- package/dist/esm/hooks/useCompileAndEvaluateMdx.spec.mjs +0 -35
- package/dist/esm/hooks/useCompileAndEvaluateMdx.spec.mjs.map +0 -1
- package/dist/esm/hooks/useCompileAndEvaluateMdx.spec.native.js +0 -47
- package/dist/esm/hooks/useCompileAndEvaluateMdx.spec.native.js.map +0 -1
- package/dist/esm/mdx.spec.mjs +0 -377
- package/dist/esm/mdx.spec.mjs.map +0 -1
- package/dist/esm/mdx.spec.native.js +0 -439
- package/dist/esm/mdx.spec.native.js.map +0 -1
- package/dist/esm/parser.spec.mjs +0 -110
- package/dist/esm/parser.spec.mjs.map +0 -1
- package/dist/esm/parser.spec.native.js +0 -112
- package/dist/esm/parser.spec.native.js.map +0 -1
- package/dist/esm/shiki/highlighter.mjs +0 -59
- package/dist/esm/shiki/highlighter.mjs.map +0 -1
- package/dist/esm/shiki/highlighter.native.js +0 -61
- package/dist/esm/shiki/highlighter.native.js.map +0 -1
- package/dist/esm/util/util.spec.mjs +0 -82
- package/dist/esm/util/util.spec.mjs.map +0 -1
- package/dist/esm/util/util.spec.native.js +0 -82
- package/dist/esm/util/util.spec.native.js.map +0 -1
- package/dist/jsx/ExternalIcon/ExternalIcon.spec.mjs +0 -38
- package/dist/jsx/ExternalIcon/ExternalIcon.spec.mjs.map +0 -1
- package/dist/jsx/ExternalIcon/ExternalIcon.spec.native.js +0 -40
- package/dist/jsx/ExternalIcon/ExternalIcon.spec.native.js.map +0 -1
- package/dist/jsx/Hr/hr.spec.mjs +0 -22
- package/dist/jsx/Hr/hr.spec.mjs.map +0 -1
- package/dist/jsx/Hr/hr.spec.native.js +0 -24
- package/dist/jsx/Hr/hr.spec.native.js.map +0 -1
- package/dist/jsx/Li/li.spec.mjs +0 -46
- package/dist/jsx/Li/li.spec.mjs.map +0 -1
- package/dist/jsx/Li/li.spec.native.js +0 -50
- package/dist/jsx/Li/li.spec.native.js.map +0 -1
- package/dist/jsx/Markdown.stories.mjs +0 -125
- package/dist/jsx/Markdown.stories.mjs.map +0 -1
- package/dist/jsx/Markdown.stories.native.js +0 -162
- package/dist/jsx/Markdown.stories.native.js.map +0 -1
- package/dist/jsx/Mdx/mdx.spec.mjs +0 -140
- package/dist/jsx/Mdx/mdx.spec.mjs.map +0 -1
- package/dist/jsx/Mdx/mdx.spec.native.js +0 -158
- package/dist/jsx/Mdx/mdx.spec.native.js.map +0 -1
- package/dist/jsx/MdxCodeBlock/mdxCodeBlock.spec.mjs +0 -91
- package/dist/jsx/MdxCodeBlock/mdxCodeBlock.spec.mjs.map +0 -1
- package/dist/jsx/MdxCodeBlock/mdxCodeBlock.spec.native.js +0 -122
- package/dist/jsx/MdxCodeBlock/mdxCodeBlock.spec.native.js.map +0 -1
- package/dist/jsx/SimpleTable/index.mjs.map +0 -1
- package/dist/jsx/SimpleTable/index.native.js.map +0 -1
- package/dist/jsx/Ul/ul.spec.mjs +0 -151
- package/dist/jsx/Ul/ul.spec.mjs.map +0 -1
- package/dist/jsx/Ul/ul.spec.native.js +0 -153
- package/dist/jsx/Ul/ul.spec.native.js.map +0 -1
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.spec.mjs +0 -35
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.spec.mjs.map +0 -1
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.spec.native.js +0 -49
- package/dist/jsx/hooks/useCompileAndEvaluateMdx.spec.native.js.map +0 -1
- package/dist/jsx/mdx.spec.mjs +0 -377
- package/dist/jsx/mdx.spec.mjs.map +0 -1
- package/dist/jsx/mdx.spec.native.js +0 -465
- package/dist/jsx/mdx.spec.native.js.map +0 -1
- package/dist/jsx/parser.spec.mjs +0 -110
- package/dist/jsx/parser.spec.mjs.map +0 -1
- package/dist/jsx/parser.spec.native.js +0 -114
- package/dist/jsx/parser.spec.native.js.map +0 -1
- package/dist/jsx/shiki/highlighter.mjs +0 -59
- package/dist/jsx/shiki/highlighter.mjs.map +0 -1
- package/dist/jsx/shiki/highlighter.native.js +0 -94
- package/dist/jsx/shiki/highlighter.native.js.map +0 -1
- package/dist/jsx/util/util.spec.mjs +0 -82
- package/dist/jsx/util/util.spec.mjs.map +0 -1
- package/dist/jsx/util/util.spec.native.js +0 -84
- package/dist/jsx/util/util.spec.native.js.map +0 -1
- package/src/shiki/highlighter.ts +0 -148
package/src/components/Break.tsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { Text } from "tamagui";
|
|
1
|
+
import { Text, isWeb } from "tamagui";
|
|
2
2
|
import type { BreakProps } from "../types";
|
|
3
3
|
|
|
4
4
|
export function Break(_props: BreakProps) {
|
|
5
|
+
// a literal "\n" collapses under white-space: normal on web (SB-M-1210)
|
|
6
|
+
if (isWeb) return <br />;
|
|
5
7
|
return <Text>{"\n"}</Text>;
|
|
6
8
|
}
|
|
@@ -1,93 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain-markdown code block.
|
|
3
|
+
*
|
|
4
|
+
* LC-16 wrapper: tokenizing and token rendering come from the canonical
|
|
5
|
+
* `@multiplatform.one/components` code family (`useShikiTokens` +
|
|
6
|
+
* `HighlightedCode` — one shiki highlighter for the whole app). This file
|
|
7
|
+
* only owns the markdown-specific container chrome: the block inset (rides
|
|
8
|
+
* the space knob — SP-PAD, spec CodeBlock frame) and the shared markdown
|
|
9
|
+
* code color ramp.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { Code, HighlightedCode, useShikiTokens } from "@multiplatform.one/components";
|
|
1
13
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
2
|
-
import {
|
|
3
|
-
import { ScrollView, Text, View, XStack } from "tamagui";
|
|
14
|
+
import { ScrollView, View } from "tamagui";
|
|
4
15
|
import { markdownCodeColors } from "../shared/colorRamps";
|
|
5
|
-
import { highlightCode, type ThemedToken, type BundledTheme } from "../shiki";
|
|
6
16
|
import type { CodeBlockProps } from "../types";
|
|
7
17
|
|
|
8
18
|
interface CodeBlockInternalProps extends CodeBlockProps {
|
|
9
|
-
theme?:
|
|
19
|
+
theme?: string | "auto";
|
|
10
20
|
}
|
|
11
21
|
|
|
12
|
-
export function CodeBlock({ children, lang, theme = "
|
|
22
|
+
export function CodeBlock({ children, lang, theme: themeProp = "auto" }: CodeBlockInternalProps) {
|
|
13
23
|
const { knobProps } = useResolvedKnobs();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (!cancelled) {
|
|
23
|
-
setTokens(result);
|
|
24
|
-
setError(null);
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
.catch((err) => {
|
|
28
|
-
if (!cancelled) {
|
|
29
|
-
setError(String(err));
|
|
30
|
-
setTokens(null);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return () => {
|
|
35
|
-
cancelled = true;
|
|
36
|
-
};
|
|
37
|
-
}, [children, lang, theme]);
|
|
38
|
-
|
|
39
|
-
const containerProps = {
|
|
40
|
-
borderRadius: knobProps.borderRadiusOuter?.borderRadius ?? "$4",
|
|
41
|
-
backgroundColor: markdownCodeColors.background.base,
|
|
42
|
-
borderWidth: 1,
|
|
43
|
-
borderColor: markdownCodeColors.border.base,
|
|
44
|
-
padding: knobProps.panelPadding.padding,
|
|
45
|
-
marginVertical: "$2",
|
|
46
|
-
overflow: "hidden" as const,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
// Loading or error fallback
|
|
50
|
-
if (!tokens || error) {
|
|
51
|
-
return (
|
|
52
|
-
<View {...containerProps}>
|
|
53
|
-
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
|
54
|
-
<Text
|
|
55
|
-
fontFamily="$mono"
|
|
56
|
-
fontSize={knobProps.sizeToken}
|
|
57
|
-
color={markdownCodeColors.text.muted}
|
|
58
|
-
>
|
|
59
|
-
{children}
|
|
60
|
-
</Text>
|
|
61
|
-
</ScrollView>
|
|
62
|
-
</View>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
24
|
+
// "auto" defers to useShikiTokens' scheme default (github-light/dark from
|
|
25
|
+
// the active Tamagui theme), so direct CodeBlock use matches the color
|
|
26
|
+
// scheme instead of painting dark tokens on a light container (SB-M-1216).
|
|
27
|
+
const tokens = useShikiTokens(
|
|
28
|
+
children,
|
|
29
|
+
lang || "text",
|
|
30
|
+
themeProp === "auto" ? undefined : themeProp,
|
|
31
|
+
);
|
|
65
32
|
|
|
66
33
|
return (
|
|
67
|
-
<View
|
|
34
|
+
<View
|
|
35
|
+
// Full fragment spread (AGENTS.md knob rule) so the cornerSmoothing
|
|
36
|
+
// class rides along with the outer radius; the fallback keeps the old
|
|
37
|
+
// default when a Preset override drops the fragment.
|
|
38
|
+
{...(knobProps.borderRadiusOuter ?? { borderRadius: "$4" })}
|
|
39
|
+
backgroundColor={markdownCodeColors.background.base}
|
|
40
|
+
borderWidth={1}
|
|
41
|
+
borderColor={markdownCodeColors.border.base}
|
|
42
|
+
// SP-PAD (spec CodeBlock frame; LC-18 / UX-P07): the block inset rides
|
|
43
|
+
// the space knob through the complete panelPadding fragment —
|
|
44
|
+
// components-CodeBlock parity.
|
|
45
|
+
{...knobProps.panelPadding}
|
|
46
|
+
marginVertical="$2"
|
|
47
|
+
overflow="hidden"
|
|
48
|
+
>
|
|
68
49
|
<ScrollView horizontal showsHorizontalScrollIndicator={false}>
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
fontFamily="$mono"
|
|
81
|
-
fontSize={knobProps.sizeToken}
|
|
82
|
-
style={{ color: token.color }}
|
|
83
|
-
>
|
|
84
|
-
{token.content}
|
|
85
|
-
</Text>
|
|
86
|
-
))
|
|
87
|
-
)}
|
|
88
|
-
</XStack>
|
|
89
|
-
))}
|
|
90
|
-
</View>
|
|
50
|
+
<Code
|
|
51
|
+
backgroundColor="transparent"
|
|
52
|
+
borderWidth={0}
|
|
53
|
+
padding={0}
|
|
54
|
+
color={markdownCodeColors.text.base}
|
|
55
|
+
fontSize={knobProps.sizeToken}
|
|
56
|
+
>
|
|
57
|
+
<HighlightedCode tokens={tokens} fontSize={knobProps.sizeToken}>
|
|
58
|
+
{children}
|
|
59
|
+
</HighlightedCode>
|
|
60
|
+
</Code>
|
|
91
61
|
</ScrollView>
|
|
92
62
|
</View>
|
|
93
63
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
2
|
+
import { H1, H2, H3, H4, H5, H6, isWeb } from "tamagui";
|
|
2
3
|
import type { HeadingProps } from "../types";
|
|
3
4
|
|
|
4
5
|
const headingComponents = {
|
|
@@ -10,10 +11,22 @@ const headingComponents = {
|
|
|
10
11
|
6: H6,
|
|
11
12
|
} as const;
|
|
12
13
|
|
|
14
|
+
/** Tamagui default heading scale per level (medium size knob keeps these). */
|
|
15
|
+
const headingBaseSize = { 1: 9, 2: 8, 3: 7, 4: 6, 5: 5, 6: 4 } as const;
|
|
16
|
+
|
|
17
|
+
/** Size knob shifts the whole heading scale one step, preserving hierarchy. */
|
|
18
|
+
const sizeShift: Record<string, number> = { $3: -1, $4: 0, $5: 1 };
|
|
19
|
+
|
|
13
20
|
export function Heading({ level, children }: HeadingProps) {
|
|
14
21
|
const Component = headingComponents[level];
|
|
22
|
+
// T-HEADING: heading recipe + sizeToken-appropriate scale (spec: Heading).
|
|
23
|
+
// Web resolves the heading family through the tamagui font config, so the
|
|
24
|
+
// fontFamily override is native-only (same pattern as PageHeader).
|
|
25
|
+
const { knobProps } = useResolvedKnobs();
|
|
26
|
+
const headingFamily = isWeb ? null : { fontFamily: knobProps.heading.fontFamily };
|
|
27
|
+
const size = `$${headingBaseSize[level] + (sizeShift[knobProps.sizeToken] ?? 0)}`;
|
|
15
28
|
return (
|
|
16
|
-
<Component marginTop="$3" marginBottom="$2">
|
|
29
|
+
<Component marginTop="$3" marginBottom="$2" size={size as any} {...headingFamily}>
|
|
17
30
|
{children}
|
|
18
31
|
</Component>
|
|
19
32
|
);
|
package/src/components/Image.tsx
CHANGED
|
@@ -7,12 +7,15 @@ export function MarkdownImage({ src, alt, title }: ImageProps) {
|
|
|
7
7
|
return (
|
|
8
8
|
<View marginVertical="$2">
|
|
9
9
|
<TamaguiImage
|
|
10
|
-
source
|
|
10
|
+
// src (string), not source: the RN source object never reaches the
|
|
11
|
+
// DOM <img> src on web, so the image silently renders empty; tamagui
|
|
12
|
+
// maps src back to source={{uri}} on native.
|
|
13
|
+
src={src}
|
|
11
14
|
alt={alt || ""}
|
|
12
|
-
|
|
15
|
+
aria-label={alt || title || undefined}
|
|
13
16
|
width="100%"
|
|
14
17
|
height={200}
|
|
15
|
-
|
|
18
|
+
objectFit="contain"
|
|
16
19
|
borderRadius={knobProps.borderRadius.borderRadius}
|
|
17
20
|
/>
|
|
18
21
|
</View>
|
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Plain-markdown inline code.
|
|
3
|
+
*
|
|
4
|
+
* LC-16 wrapper over the canonical `CodeInline` from
|
|
5
|
+
* `@multiplatform.one/components` (real `<code>` semantics, shared code
|
|
6
|
+
* color ramp). Markdown-specific constraint kept here: sizing uses the size
|
|
7
|
+
* knob token instead of CodeInline's web-only percentage font metrics, so
|
|
8
|
+
* the same source renders on native (React Native has no % font sizes).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { CodeInline } from "@multiplatform.one/components";
|
|
2
12
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
3
|
-
import { markdownCodeColors } from "../shared/colorRamps";
|
|
4
13
|
import type { InlineCodeProps } from "../types";
|
|
5
14
|
|
|
6
15
|
export function InlineCode({ children }: InlineCodeProps) {
|
|
7
16
|
const { knobProps } = useResolvedKnobs();
|
|
8
17
|
return (
|
|
9
|
-
<
|
|
10
|
-
fontFamily="$mono"
|
|
18
|
+
<CodeInline
|
|
11
19
|
fontSize={knobProps.sizeToken}
|
|
12
|
-
|
|
13
|
-
color={markdownCodeColors.text.base}
|
|
20
|
+
lineHeight={knobProps.sizeToken}
|
|
14
21
|
paddingHorizontal="$1.5"
|
|
15
22
|
paddingVertical="$0.5"
|
|
16
23
|
borderRadius={knobProps.borderRadius.borderRadius}
|
|
17
24
|
>
|
|
18
25
|
{children}
|
|
19
|
-
</
|
|
26
|
+
</CodeInline>
|
|
20
27
|
);
|
|
21
28
|
}
|
|
@@ -2,13 +2,25 @@ import { Text } from "tamagui";
|
|
|
2
2
|
import type { InlineProps } from "../types";
|
|
3
3
|
|
|
4
4
|
export function Strong({ children }: InlineProps) {
|
|
5
|
-
return
|
|
5
|
+
return (
|
|
6
|
+
<Text render="strong" fontWeight="bold">
|
|
7
|
+
{children}
|
|
8
|
+
</Text>
|
|
9
|
+
);
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
export function Emphasis({ children }: InlineProps) {
|
|
9
|
-
return
|
|
13
|
+
return (
|
|
14
|
+
<Text render="em" fontStyle="italic">
|
|
15
|
+
{children}
|
|
16
|
+
</Text>
|
|
17
|
+
);
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
export function Strikethrough({ children }: InlineProps) {
|
|
13
|
-
return
|
|
21
|
+
return (
|
|
22
|
+
<Text render="del" textDecorationLine="line-through">
|
|
23
|
+
{children}
|
|
24
|
+
</Text>
|
|
25
|
+
);
|
|
14
26
|
}
|
package/src/components/Link.tsx
CHANGED
|
@@ -1,24 +1,47 @@
|
|
|
1
|
-
import { Text } from "tamagui";
|
|
1
|
+
import { Text, isWeb } from "tamagui";
|
|
2
2
|
import { openUrl } from "@multiplatform.one/platform";
|
|
3
3
|
import { markdownLinkColors } from "../shared/colorRamps";
|
|
4
4
|
import type { LinkProps } from "../types";
|
|
5
5
|
|
|
6
|
+
const safeProtocols = new Set(["http", "https", "mailto", "tel", "sms"]);
|
|
7
|
+
|
|
8
|
+
function getSafeHref(href?: string): string | undefined {
|
|
9
|
+
if (!href) return undefined;
|
|
10
|
+
const trimmed = href.trim();
|
|
11
|
+
const match = trimmed.match(/^([a-z][a-z0-9+.-]*):/i);
|
|
12
|
+
// relative, hash, and query hrefs have no scheme and are safe
|
|
13
|
+
if (!match) return trimmed;
|
|
14
|
+
return safeProtocols.has(match[1].toLowerCase()) ? trimmed : undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
6
17
|
export function Link({ href, title, children }: LinkProps) {
|
|
18
|
+
const safeHref = getSafeHref(href);
|
|
19
|
+
const isExternal = !!safeHref && /^https?:\/\//i.test(safeHref);
|
|
20
|
+
|
|
7
21
|
const handlePress = () => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
22
|
+
// web navigation is handled natively by the anchor element
|
|
23
|
+
if (!isWeb && safeHref) openUrl(safeHref);
|
|
11
24
|
};
|
|
12
25
|
|
|
13
26
|
return (
|
|
14
27
|
<Text
|
|
28
|
+
render="a"
|
|
29
|
+
// @ts-expect-error anchor attributes forwarded to the DOM element
|
|
30
|
+
href={safeHref}
|
|
31
|
+
target={isExternal ? "_blank" : undefined}
|
|
32
|
+
rel={isExternal ? "noopener noreferrer" : undefined}
|
|
33
|
+
title={title || undefined}
|
|
15
34
|
color={markdownLinkColors.text.base}
|
|
16
35
|
textDecorationLine="underline"
|
|
17
36
|
cursor="pointer"
|
|
18
37
|
onPress={handlePress}
|
|
19
|
-
accessibilityRole="link"
|
|
20
|
-
accessibilityLabel={title || undefined}
|
|
21
38
|
hoverStyle={{ color: markdownLinkColors.text.hover }}
|
|
39
|
+
focusVisibleStyle={{
|
|
40
|
+
outlineColor: "$outlineColor",
|
|
41
|
+
outlineWidth: 2,
|
|
42
|
+
outlineStyle: "solid",
|
|
43
|
+
outlineOffset: 2,
|
|
44
|
+
}}
|
|
22
45
|
>
|
|
23
46
|
{children}
|
|
24
47
|
</Text>
|
package/src/components/List.tsx
CHANGED
|
@@ -1,13 +1,108 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Children, cloneElement, isValidElement } from "react";
|
|
2
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
3
|
+
import { Text, View, XStack, getConfig, getVariableValue } from "tamagui";
|
|
4
|
+
import { CheckIcon } from "../icons";
|
|
5
|
+
import type { ListItemProps, ListProps } from "../types";
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
const listReset = {
|
|
8
|
+
listStyleType: "none",
|
|
9
|
+
paddingInlineStart: 0,
|
|
10
|
+
marginBlockStart: 0,
|
|
11
|
+
marginBlockEnd: 0,
|
|
12
|
+
} as any;
|
|
13
|
+
|
|
14
|
+
export function MarkdownList({ ordered, start, children }: ListProps) {
|
|
15
|
+
const items = Children.map(children, (child) => {
|
|
16
|
+
if (!isValidElement(child) || child.type !== MarkdownListItem) return child;
|
|
17
|
+
const childProps = child.props as ListItemInternalProps;
|
|
18
|
+
return cloneElement(child as React.ReactElement<ListItemInternalProps>, {
|
|
19
|
+
ordered: childProps.ordered ?? ordered,
|
|
20
|
+
start: childProps.start ?? start ?? undefined,
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return (
|
|
24
|
+
<View
|
|
25
|
+
render={ordered ? "ol" : "ul"}
|
|
26
|
+
start={ordered ? (start ?? undefined) : undefined}
|
|
27
|
+
style={listReset}
|
|
28
|
+
marginVertical="$2"
|
|
29
|
+
>
|
|
30
|
+
{items}
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
6
33
|
}
|
|
7
34
|
|
|
8
35
|
interface ListItemInternalProps extends ListItemProps {
|
|
9
36
|
index?: number;
|
|
10
37
|
ordered?: boolean;
|
|
38
|
+
start?: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Typography of the prose the task marker sits beside: markdown Paragraph
|
|
43
|
+
* renders the $body font at size $true with lineHeight $6 (./Paragraph.tsx).
|
|
44
|
+
* The box derives from those same tokens so it scales with the body type
|
|
45
|
+
* instead of a hardcoded glyph column (theme-propagation-spec: MarkdownListItem
|
|
46
|
+
* marker "scales with type/size").
|
|
47
|
+
*/
|
|
48
|
+
function getTaskBoxMetrics() {
|
|
49
|
+
const bodyFont = getConfig()?.fontsParsed?.$body;
|
|
50
|
+
const fontSize = Math.round(getVariableValue(bodyFont?.size?.$true) || 14);
|
|
51
|
+
const lineHeight = Math.round(getVariableValue(bodyFont?.lineHeight?.$6) || fontSize * 2);
|
|
52
|
+
return { boxSize: Math.round(fontSize * 1.15), lineHeight };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Box↔label gap by space knob — mirrors the forms Checkbox inline gap. */
|
|
56
|
+
const taskInlineGapMap: Record<string, string> = {
|
|
57
|
+
small: "$1.5",
|
|
58
|
+
medium: "$2",
|
|
59
|
+
large: "$2.5",
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/** Cap the radius knob for a small square control (R-CLAMP: never a circle). */
|
|
63
|
+
function clampTaskBoxRadius(radiusToken: string, pointy: boolean): string | number {
|
|
64
|
+
if (pointy || radiusToken === "$0") return 0;
|
|
65
|
+
const num = Number.parseInt(radiusToken.replace("$", ""), 10);
|
|
66
|
+
return Number.isFinite(num) && num > 2 ? "$2" : radiusToken;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Read-only GFM task-list marker. It is document content, not a form field:
|
|
71
|
+
* never focusable or clickable, state conveyed via role/aria only. Drawn with
|
|
72
|
+
* the house control treatment ($color5 surface, $color7 border, accent check)
|
|
73
|
+
* so radius/border/fill/space/accent/weight knobs all reach it (LC-18).
|
|
74
|
+
*/
|
|
75
|
+
function TaskCheckbox({ checked }: { checked: boolean }) {
|
|
76
|
+
const { knobProps } = useResolvedKnobs();
|
|
77
|
+
const { boxSize, lineHeight } = getTaskBoxMetrics();
|
|
78
|
+
return (
|
|
79
|
+
<View height={lineHeight} justifyContent="center">
|
|
80
|
+
<View
|
|
81
|
+
role="checkbox"
|
|
82
|
+
aria-checked={checked}
|
|
83
|
+
aria-disabled={true}
|
|
84
|
+
width={boxSize}
|
|
85
|
+
height={boxSize}
|
|
86
|
+
borderWidth={knobProps.borderRadius.borderWidth}
|
|
87
|
+
borderColor="$color7"
|
|
88
|
+
backgroundColor={knobProps.outlined ? "transparent" : "$color5"}
|
|
89
|
+
borderRadius={clampTaskBoxRadius(
|
|
90
|
+
knobProps.borderRadius.borderRadius as string,
|
|
91
|
+
knobProps.pointy,
|
|
92
|
+
)}
|
|
93
|
+
alignItems="center"
|
|
94
|
+
justifyContent="center"
|
|
95
|
+
>
|
|
96
|
+
{checked ? (
|
|
97
|
+
<CheckIcon
|
|
98
|
+
size={Math.round(boxSize * 0.72)}
|
|
99
|
+
color={knobProps.textAccentColor}
|
|
100
|
+
strokeWidth={knobProps.textWeight.fontWeight === "700" ? 3 : 2.5}
|
|
101
|
+
/>
|
|
102
|
+
) : null}
|
|
103
|
+
</View>
|
|
104
|
+
</View>
|
|
105
|
+
);
|
|
11
106
|
}
|
|
12
107
|
|
|
13
108
|
export function MarkdownListItem({
|
|
@@ -15,24 +110,29 @@ export function MarkdownListItem({
|
|
|
15
110
|
children,
|
|
16
111
|
index = 0,
|
|
17
112
|
ordered = false,
|
|
113
|
+
start,
|
|
18
114
|
}: ListItemInternalProps) {
|
|
19
|
-
const
|
|
115
|
+
const { knobProps } = useResolvedKnobs();
|
|
116
|
+
const bullet = ordered ? `${(start ?? 1) + index}.` : "•";
|
|
20
117
|
|
|
21
118
|
// Task list item
|
|
22
119
|
if (checked !== null && checked !== undefined) {
|
|
23
120
|
return (
|
|
24
|
-
<XStack
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
121
|
+
<XStack
|
|
122
|
+
render="li"
|
|
123
|
+
marginBottom="$1"
|
|
124
|
+
alignItems="flex-start"
|
|
125
|
+
gap={taskInlineGapMap[knobProps.space] ?? "$2"}
|
|
126
|
+
>
|
|
127
|
+
<TaskCheckbox checked={checked} />
|
|
28
128
|
<View flex={1}>{children}</View>
|
|
29
129
|
</XStack>
|
|
30
130
|
);
|
|
31
131
|
}
|
|
32
132
|
|
|
33
133
|
return (
|
|
34
|
-
<XStack marginBottom="$1" alignItems="flex-start">
|
|
35
|
-
<Text width={24} color="$color11">
|
|
134
|
+
<XStack render="li" marginBottom="$1" alignItems="flex-start">
|
|
135
|
+
<Text width={24} color="$color11" aria-hidden>
|
|
36
136
|
{bullet}
|
|
37
137
|
</Text>
|
|
38
138
|
<View flex={1}>{children}</View>
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
1
2
|
import { Paragraph as TamaguiParagraph } from "tamagui";
|
|
2
3
|
import type { ParagraphProps } from "../types";
|
|
3
4
|
|
|
4
5
|
export function Paragraph({ children }: ParagraphProps) {
|
|
6
|
+
// Prose is T-VALUE: body recipe (family/weight) + size-knob body scale
|
|
7
|
+
// (spec: markdown Paragraph binds `body`; LC-18). The size prop carries
|
|
8
|
+
// the paired lineHeight, replacing the old fixed $6.
|
|
9
|
+
const { knobProps } = useResolvedKnobs();
|
|
5
10
|
return (
|
|
6
|
-
<TamaguiParagraph marginBottom="$2"
|
|
11
|
+
<TamaguiParagraph marginBottom="$2" size={knobProps.sizeToken as any} {...knobProps.body}>
|
|
7
12
|
{children}
|
|
8
13
|
</TamaguiParagraph>
|
|
9
14
|
);
|
package/src/components/Table.tsx
CHANGED
|
@@ -1,56 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plain-markdown table renderer.
|
|
3
|
+
*
|
|
4
|
+
* Built on `@multiplatform.one/table-primitives` so plain-markdown tables
|
|
5
|
+
* render real `<table>/<thead>/<tbody>/<tr>/<th>/<td>` semantics and match
|
|
6
|
+
* the MDX table styling. The renderer emits a flat list of rows (first row
|
|
7
|
+
* flagged `isHeader`); MarkdownTable partitions them into head and body.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { Children, isValidElement } from "react";
|
|
1
11
|
import { useResolvedKnobs } from "@multiplatform.one/theme";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
12
|
+
import { Paragraph, ScrollView, YStack } from "tamagui";
|
|
13
|
+
import { Table } from "@multiplatform.one/table-primitives";
|
|
4
14
|
import type { TableProps, TableRowProps, TableCellProps } from "../types";
|
|
5
15
|
|
|
16
|
+
function isHeaderRow(row: unknown): boolean {
|
|
17
|
+
return isValidElement(row) && Boolean((row.props as TableRowProps).isHeader);
|
|
18
|
+
}
|
|
19
|
+
|
|
6
20
|
export function MarkdownTable({ children }: TableProps) {
|
|
7
21
|
const { knobProps } = useResolvedKnobs();
|
|
22
|
+
const rows = Children.toArray(children);
|
|
23
|
+
const headerRows = rows.filter((row) => isHeaderRow(row));
|
|
24
|
+
const bodyRows = rows.filter((row) => !isHeaderRow(row));
|
|
8
25
|
|
|
9
26
|
return (
|
|
10
|
-
<ScrollView horizontal marginVertical="$3">
|
|
11
|
-
<YStack
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
<ScrollView horizontal showsHorizontalScrollIndicator={false} marginVertical="$3">
|
|
28
|
+
<YStack minWidth="100%">
|
|
29
|
+
<Table
|
|
30
|
+
render="table"
|
|
31
|
+
// Size by content inside the horizontal scroller: a real <table> with
|
|
32
|
+
// width:100% against the scroller's indefinite width hits Chromium's
|
|
33
|
+
// 1e6px table clamp. Auto width + auto layout = GitHub-style
|
|
34
|
+
// shrink-to-fit columns; cellWidth="auto" lifts the token width cap.
|
|
35
|
+
width="auto"
|
|
36
|
+
cellWidth="auto"
|
|
37
|
+
style={{ tableLayout: "auto" }}
|
|
38
|
+
borderColor="$borderColor"
|
|
39
|
+
borderRadius={knobProps.borderRadius.borderRadius}
|
|
40
|
+
alignCells={{ x: "start", y: "center" }}
|
|
41
|
+
alignHeaderCells={{ x: "start", y: "center" }}
|
|
42
|
+
>
|
|
43
|
+
{headerRows.length > 0 && <Table.Head render="thead">{headerRows}</Table.Head>}
|
|
44
|
+
<Table.Body render="tbody">{bodyRows}</Table.Body>
|
|
45
|
+
</Table>
|
|
19
46
|
</YStack>
|
|
20
47
|
</ScrollView>
|
|
21
48
|
);
|
|
22
49
|
}
|
|
23
50
|
|
|
24
|
-
export function MarkdownTableRow({ children
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
backgroundColor={
|
|
28
|
-
isHeader ? markdownTableColors.background.header : markdownTableColors.background.base
|
|
29
|
-
}
|
|
30
|
-
borderBottomWidth={isHeader ? 1 : 0.5}
|
|
31
|
-
borderBottomColor={markdownTableColors.border.base}
|
|
32
|
-
>
|
|
33
|
-
{children}
|
|
34
|
-
</XStack>
|
|
35
|
-
);
|
|
51
|
+
export function MarkdownTableRow({ children }: TableRowProps) {
|
|
52
|
+
// `isHeader` is consumed by MarkdownTable to place the row in thead/tbody.
|
|
53
|
+
return <Table.Row render="tr">{children}</Table.Row>;
|
|
36
54
|
}
|
|
37
55
|
|
|
38
56
|
export function MarkdownTableCell({ children, isHeader, align }: TableCellProps) {
|
|
39
|
-
const { knobProps } = useResolvedKnobs();
|
|
40
57
|
const textAlign = align || "left";
|
|
41
58
|
|
|
59
|
+
if (isHeader) {
|
|
60
|
+
return (
|
|
61
|
+
<Table.HeaderCell render="th">
|
|
62
|
+
<Paragraph render="span" display="block" size="$4" fontWeight="600" textAlign={textAlign}>
|
|
63
|
+
{children}
|
|
64
|
+
</Paragraph>
|
|
65
|
+
</Table.HeaderCell>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
42
69
|
return (
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
paddingVertical="$2"
|
|
47
|
-
borderRightWidth={0.5}
|
|
48
|
-
borderRightColor={markdownTableColors.border.base}
|
|
49
|
-
justifyContent="center"
|
|
50
|
-
>
|
|
51
|
-
<Text fontWeight={isHeader ? "600" : "normal"} textAlign={textAlign}>
|
|
70
|
+
<Table.Cell render="td">
|
|
71
|
+
{/* maxWidth caps the column's max-content contribution so long cells wrap */}
|
|
72
|
+
<Paragraph render="span" display="block" size="$4" textAlign={textAlign} maxWidth={480}>
|
|
52
73
|
{children}
|
|
53
|
-
</
|
|
54
|
-
</
|
|
74
|
+
</Paragraph>
|
|
75
|
+
</Table.Cell>
|
|
55
76
|
);
|
|
56
77
|
}
|