veslx 0.0.28 → 0.1.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/bin/lib/build.ts +3 -0
- package/bin/lib/serve.ts +4 -4
- package/bin/veslx.ts +1 -1
- package/dist/assets/README-DVMP1xaW.js +7 -0
- package/dist/assets/SLIDES-DjNLQtEU.js +10 -0
- package/dist/assets/index-CBkKcH4y.js +469 -0
- package/dist/assets/index-PspMxLnH.css +1 -0
- package/dist/assets/index-UZKwazVi.js +1 -0
- package/dist/index.html +2 -2
- package/dist/raw/.veslx.json +61 -0
- package/dist/raw/README.md +33 -0
- package/dist/raw/test-post/Chart.tsx +16 -0
- package/dist/raw/test-post/README.mdx +21 -0
- package/dist/raw/test-slides/Counter.tsx +25 -0
- package/dist/raw/test-slides/SLIDES.mdx +27 -0
- package/package.json +3 -7
- package/plugin/src/plugin.ts +38 -0
- package/src/components/slides-renderer.tsx +130 -0
- package/src/hooks/use-mdx-content.ts +108 -0
- package/src/pages/post.tsx +15 -13
- package/src/pages/slides.tsx +21 -34
- package/src/vite-env.d.ts +21 -0
- package/vite.config.ts +1 -19
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/index-C75KddSa.css +0 -1
- package/dist/assets/index-DsHb4M_F.js +0 -542
- package/src/components/runtime-mdx.tsx +0 -82
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react'
|
|
2
|
-
import { compile, run } from '@mdx-js/mdx'
|
|
3
|
-
import * as runtime from 'react/jsx-runtime'
|
|
4
|
-
import remarkGfm from 'remark-gfm'
|
|
5
|
-
import remarkMath from 'remark-math'
|
|
6
|
-
import remarkFrontmatter from 'remark-frontmatter'
|
|
7
|
-
import rehypeKatex from 'rehype-katex'
|
|
8
|
-
import 'katex/dist/katex.min.css'
|
|
9
|
-
import { mdxComponents } from '@/components/mdx-components'
|
|
10
|
-
import { cn } from '@/lib/utils'
|
|
11
|
-
|
|
12
|
-
export function RuntimeMDX({
|
|
13
|
-
content,
|
|
14
|
-
size
|
|
15
|
-
}: {
|
|
16
|
-
content: string; size?: "sm" | "md" | "lg" | "xl" | "2xl";
|
|
17
|
-
}) {
|
|
18
|
-
const [MDXContent, setMDXContent] = useState<React.ComponentType<{ components: typeof mdxComponents }> | null>(null)
|
|
19
|
-
const [error, setError] = useState<Error | null>(null)
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
let cancelled = false
|
|
23
|
-
|
|
24
|
-
async function compileMDX() {
|
|
25
|
-
try {
|
|
26
|
-
const compiled = await compile(content, {
|
|
27
|
-
outputFormat: 'function-body',
|
|
28
|
-
remarkPlugins: [remarkFrontmatter, remarkGfm, remarkMath],
|
|
29
|
-
rehypePlugins: [rehypeKatex as never],
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const mod = await run(compiled, {
|
|
33
|
-
...runtime,
|
|
34
|
-
baseUrl: import.meta.url,
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
if (!cancelled) {
|
|
38
|
-
setMDXContent(() => mod.default)
|
|
39
|
-
setError(null)
|
|
40
|
-
}
|
|
41
|
-
} catch (err) {
|
|
42
|
-
console.error('MDX compilation error:', err)
|
|
43
|
-
if (!cancelled) {
|
|
44
|
-
setError(err as Error)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
compileMDX()
|
|
50
|
-
|
|
51
|
-
return () => {
|
|
52
|
-
cancelled = true
|
|
53
|
-
}
|
|
54
|
-
}, [content])
|
|
55
|
-
|
|
56
|
-
if (error) {
|
|
57
|
-
return (
|
|
58
|
-
<div className="text-destructive p-4 border border-destructive/30 rounded-lg bg-destructive/5">
|
|
59
|
-
<h3 className="font-semibold">MDX Compilation Error</h3>
|
|
60
|
-
<pre className="text-sm mt-2 overflow-x-auto font-mono">{error.message}</pre>
|
|
61
|
-
</div>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (!MDXContent) {
|
|
66
|
-
return <div className="text-muted-foreground">Loading content...</div>
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<div className={cn(
|
|
71
|
-
"prose prose-slate dark:prose-invert",
|
|
72
|
-
size === "sm" ? "prose-sm" :
|
|
73
|
-
size === "md" ? "prose-md" :
|
|
74
|
-
size === "lg" ? "prose-lg" :
|
|
75
|
-
size === "xl" ? "prose-xl" :
|
|
76
|
-
size === "2xl" ? "prose-2xl" : "prose-md"
|
|
77
|
-
|
|
78
|
-
)}>
|
|
79
|
-
<MDXContent components={mdxComponents} />
|
|
80
|
-
</div>
|
|
81
|
-
)
|
|
82
|
-
}
|