veslx 0.1.14 → 0.1.16

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.
Files changed (82) hide show
  1. package/README.md +262 -55
  2. package/bin/lib/build.ts +65 -13
  3. package/bin/lib/import-config.ts +10 -9
  4. package/bin/lib/init.ts +21 -22
  5. package/bin/lib/serve.ts +66 -12
  6. package/bin/veslx.ts +2 -2
  7. package/dist/client/App.js +3 -9
  8. package/dist/client/App.js.map +1 -1
  9. package/dist/client/components/front-matter.js +11 -25
  10. package/dist/client/components/front-matter.js.map +1 -1
  11. package/dist/client/components/gallery/components/figure-caption.js +6 -4
  12. package/dist/client/components/gallery/components/figure-caption.js.map +1 -1
  13. package/dist/client/components/gallery/components/figure-header.js +3 -3
  14. package/dist/client/components/gallery/components/figure-header.js.map +1 -1
  15. package/dist/client/components/gallery/components/lightbox.js +13 -13
  16. package/dist/client/components/gallery/components/lightbox.js.map +1 -1
  17. package/dist/client/components/gallery/components/loading-image.js +11 -10
  18. package/dist/client/components/gallery/components/loading-image.js.map +1 -1
  19. package/dist/client/components/gallery/hooks/use-gallery-images.js +31 -7
  20. package/dist/client/components/gallery/hooks/use-gallery-images.js.map +1 -1
  21. package/dist/client/components/gallery/index.js +22 -15
  22. package/dist/client/components/gallery/index.js.map +1 -1
  23. package/dist/client/components/header.js +5 -3
  24. package/dist/client/components/header.js.map +1 -1
  25. package/dist/client/components/mdx-components.js +42 -8
  26. package/dist/client/components/mdx-components.js.map +1 -1
  27. package/dist/client/components/post-list.js +97 -90
  28. package/dist/client/components/post-list.js.map +1 -1
  29. package/dist/client/components/running-bar.js +1 -1
  30. package/dist/client/components/running-bar.js.map +1 -1
  31. package/dist/client/components/slide.js +18 -0
  32. package/dist/client/components/slide.js.map +1 -0
  33. package/dist/client/components/slides-renderer.js +7 -71
  34. package/dist/client/components/slides-renderer.js.map +1 -1
  35. package/dist/client/hooks/use-mdx-content.js +55 -9
  36. package/dist/client/hooks/use-mdx-content.js.map +1 -1
  37. package/dist/client/main.js +1 -0
  38. package/dist/client/main.js.map +1 -1
  39. package/dist/client/pages/content-router.js +19 -0
  40. package/dist/client/pages/content-router.js.map +1 -0
  41. package/dist/client/pages/home.js +11 -7
  42. package/dist/client/pages/home.js.map +1 -1
  43. package/dist/client/pages/post.js +8 -20
  44. package/dist/client/pages/post.js.map +1 -1
  45. package/dist/client/pages/slides.js +62 -86
  46. package/dist/client/pages/slides.js.map +1 -1
  47. package/dist/client/plugin/src/client.js +58 -96
  48. package/dist/client/plugin/src/client.js.map +1 -1
  49. package/dist/client/plugin/src/directory-tree.js +111 -0
  50. package/dist/client/plugin/src/directory-tree.js.map +1 -0
  51. package/index.html +1 -1
  52. package/package.json +27 -15
  53. package/plugin/src/client.tsx +64 -116
  54. package/plugin/src/directory-tree.ts +171 -0
  55. package/plugin/src/lib.ts +6 -249
  56. package/plugin/src/plugin.ts +93 -50
  57. package/plugin/src/remark-slides.ts +100 -0
  58. package/plugin/src/types.ts +22 -0
  59. package/src/App.tsx +3 -6
  60. package/src/components/front-matter.tsx +14 -29
  61. package/src/components/gallery/components/figure-caption.tsx +15 -7
  62. package/src/components/gallery/components/figure-header.tsx +3 -3
  63. package/src/components/gallery/components/lightbox.tsx +15 -13
  64. package/src/components/gallery/components/loading-image.tsx +15 -12
  65. package/src/components/gallery/hooks/use-gallery-images.ts +51 -10
  66. package/src/components/gallery/index.tsx +32 -26
  67. package/src/components/header.tsx +14 -9
  68. package/src/components/mdx-components.tsx +61 -8
  69. package/src/components/post-list.tsx +149 -115
  70. package/src/components/running-bar.tsx +1 -1
  71. package/src/components/slide.tsx +22 -5
  72. package/src/components/slides-renderer.tsx +7 -115
  73. package/src/components/welcome.tsx +11 -14
  74. package/src/hooks/use-mdx-content.ts +94 -9
  75. package/src/index.css +159 -0
  76. package/src/main.tsx +1 -0
  77. package/src/pages/content-router.tsx +27 -0
  78. package/src/pages/home.tsx +16 -2
  79. package/src/pages/post.tsx +10 -13
  80. package/src/pages/slides.tsx +75 -88
  81. package/src/vite-env.d.ts +7 -17
  82. package/vite.config.ts +31 -6
@@ -1,7 +1,62 @@
1
-
1
+ import { Link, useLocation } from 'react-router-dom'
2
2
  import Gallery from '@/components/gallery'
3
3
  import { ParameterTable } from '@/components/parameter-table'
4
4
  import { ParameterBadge } from '@/components/parameter-badge'
5
+ import { FrontMatter } from './front-matter'
6
+
7
+ /**
8
+ * Smart link component that uses React Router for internal links
9
+ * and regular anchor tags for external links.
10
+ */
11
+ function SmartLink({ href, children, ...props }: React.AnchorHTMLAttributes<HTMLAnchorElement>) {
12
+ const location = useLocation()
13
+
14
+ // External links: absolute URLs, mailto, tel, etc.
15
+ const isExternal = href?.startsWith('http') || href?.startsWith('mailto:') || href?.startsWith('tel:')
16
+
17
+ // Hash-only links stay as anchors for in-page navigation
18
+ const isHashOnly = href?.startsWith('#')
19
+
20
+ if (isExternal || isHashOnly || !href) {
21
+ return (
22
+ <a
23
+ href={href}
24
+ className="text-primary hover:underline underline-offset-2"
25
+ {...(isExternal ? { target: '_blank', rel: 'noopener noreferrer' } : {})}
26
+ {...props}
27
+ >
28
+ {children}
29
+ </a>
30
+ )
31
+ }
32
+
33
+ // Resolve relative paths (./foo.mdx, ../bar.mdx) against current location
34
+ let resolvedHref = href
35
+ if (href.startsWith('./') || href.startsWith('../')) {
36
+ // Get current directory from pathname
37
+ const currentPath = location.pathname
38
+ const currentDir = currentPath.replace(/\/[^/]+\.mdx$/, '') || currentPath.replace(/\/[^/]*$/, '') || '/'
39
+
40
+ // Simple relative path resolution
41
+ if (href.startsWith('./')) {
42
+ resolvedHref = `${currentDir}/${href.slice(2)}`.replace(/\/+/g, '/')
43
+ } else if (href.startsWith('../')) {
44
+ const parentDir = currentDir.replace(/\/[^/]+$/, '') || '/'
45
+ resolvedHref = `${parentDir}/${href.slice(3)}`.replace(/\/+/g, '/')
46
+ }
47
+ }
48
+
49
+ // Internal link - use React Router Link
50
+ return (
51
+ <Link
52
+ to={resolvedHref}
53
+ className="text-primary hover:underline underline-offset-2"
54
+ {...props}
55
+ >
56
+ {children}
57
+ </Link>
58
+ )
59
+ }
5
60
 
6
61
  function generateId(children: unknown): string {
7
62
  return children
@@ -13,6 +68,9 @@ function generateId(children: unknown): string {
13
68
 
14
69
  // Shared MDX components - lab notebook / coder aesthetic
15
70
  export const mdxComponents = {
71
+
72
+ FrontMatter,
73
+
16
74
  Gallery,
17
75
 
18
76
  ParameterTable,
@@ -110,13 +168,8 @@ export const mdxComponents = {
110
168
  <li className="mt-1.5" {...props} />
111
169
  ),
112
170
 
113
- // Links
114
- a: (props: React.AnchorHTMLAttributes<HTMLAnchorElement>) => (
115
- <a
116
- className="text-primary hover:underline underline-offset-2"
117
- {...props}
118
- />
119
- ),
171
+ // Links - uses React Router for internal navigation
172
+ a: SmartLink,
120
173
 
121
174
  // Tables
122
175
  table: (props: React.TableHTMLAttributes<HTMLTableElement>) => (
@@ -1,14 +1,64 @@
1
1
  import { Link } from "react-router-dom";
2
2
  import { cn } from "@/lib/utils";
3
- import { DirectoryEntry } from "../../plugin/src/lib";
4
- import { findReadme, findSlides } from "../../plugin/src/client";
3
+ import { DirectoryEntry, FileEntry } from "../../plugin/src/lib";
4
+ import { findReadme, findSlides, findMdxFiles } from "../../plugin/src/client";
5
5
  import { formatDate } from "@/lib/format-date";
6
6
  import { ArrowRight } from "lucide-react";
7
7
 
8
+ type PostEntry = {
9
+ type: 'folder' | 'file';
10
+ name: string;
11
+ path: string;
12
+ readme: FileEntry | null;
13
+ slides: FileEntry | null;
14
+ file: FileEntry | null; // For standalone MDX files
15
+ };
16
+
17
+ // Helper to extract numeric prefix from filename (e.g., "01-intro" → 1)
18
+ function extractOrder(name: string): number | null {
19
+ const match = name.match(/^(\d+)-/);
20
+ return match ? parseInt(match[1], 10) : null;
21
+ }
22
+
23
+ // Helper to strip numeric prefix for display (e.g., "01-getting-started" → "Getting Started")
24
+ function stripNumericPrefix(name: string): string {
25
+ return name
26
+ .replace(/^\d+-/, '')
27
+ .replace(/-/g, ' ')
28
+ .replace(/\b\w/g, c => c.toUpperCase());
29
+ }
30
+
8
31
  export default function PostList({ directory }: { directory: DirectoryEntry }) {
9
32
  const folders = directory.children.filter((c): c is DirectoryEntry => c.type === "directory");
33
+ const standaloneFiles = findMdxFiles(directory);
34
+
35
+ // Convert folders to post entries
36
+ const folderPosts: PostEntry[] = folders.map((folder) => {
37
+ const readme = findReadme(folder);
38
+ const slides = findSlides(folder);
39
+ return {
40
+ type: 'folder' as const,
41
+ name: folder.name,
42
+ path: folder.path,
43
+ readme,
44
+ slides,
45
+ file: null,
46
+ };
47
+ });
10
48
 
11
- if (folders.length === 0) {
49
+ // Convert standalone MDX files to post entries
50
+ const filePosts: PostEntry[] = standaloneFiles.map((file) => ({
51
+ type: 'file' as const,
52
+ name: file.name.replace(/\.mdx?$/, ''),
53
+ path: file.path,
54
+ readme: null,
55
+ slides: null,
56
+ file,
57
+ }));
58
+
59
+ let posts: PostEntry[] = [...folderPosts, ...filePosts];
60
+
61
+ if (posts.length === 0) {
12
62
  return (
13
63
  <div className="py-24 text-center">
14
64
  <p className="text-muted-foreground font-mono text-sm tracking-wide">no entries</p>
@@ -16,133 +66,117 @@ export default function PostList({ directory }: { directory: DirectoryEntry }) {
16
66
  );
17
67
  }
18
68
 
19
- let posts = folders.map((folder) => {
20
- const readme = findReadme(folder);
21
- const slides = findSlides(folder);
22
- return {
23
- ...folder,
24
- readme,
25
- slides,
26
- }
27
- })
28
-
69
+ // Filter out hidden and draft posts
29
70
  posts = posts.filter((post) => {
30
- return post.readme?.frontmatter?.visibility !== "hidden";
71
+ const frontmatter = post.readme?.frontmatter || post.file?.frontmatter;
72
+ return frontmatter?.visibility !== "hidden" && frontmatter?.draft !== true;
31
73
  });
32
74
 
75
+ // Helper to get frontmatter from post
76
+ const getFrontmatter = (post: PostEntry) => {
77
+ return post.readme?.frontmatter || post.file?.frontmatter || post.slides?.frontmatter;
78
+ };
79
+
80
+ // Helper to get date from post
81
+ const getPostDate = (post: PostEntry): Date | null => {
82
+ const frontmatter = getFrontmatter(post);
83
+ return frontmatter?.date ? new Date(frontmatter.date as string) : null;
84
+ };
85
+
86
+ // Smart sorting: numeric prefix → date → alphabetical
33
87
  posts = posts.sort((a, b) => {
34
- let aDate = a.readme?.frontmatter?.date ? new Date(a.readme.frontmatter.date as string) : null;
35
- let bDate = b.readme?.frontmatter?.date ? new Date(b.readme.frontmatter.date as string) : null;
88
+ const aOrder = extractOrder(a.name);
89
+ const bOrder = extractOrder(b.name);
90
+ const aDate = getPostDate(a);
91
+ const bDate = getPostDate(b);
36
92
 
37
- if (!aDate && a.slides) {
38
- aDate = a.slides.frontmatter?.date ? new Date(a.slides.frontmatter.date as string) : null;
39
- }
40
- if (!bDate && b.slides) {
41
- bDate = b.slides.frontmatter?.date ? new Date(b.slides.frontmatter.date as string) : null;
93
+ // Both have numeric prefix → sort by number
94
+ if (aOrder !== null && bOrder !== null) {
95
+ return aOrder - bOrder;
42
96
  }
97
+ // One has prefix, one doesn't → prefixed comes first
98
+ if (aOrder !== null) return -1;
99
+ if (bOrder !== null) return 1;
43
100
 
101
+ // Both have dates → sort by date (newest first)
44
102
  if (aDate && bDate) {
45
103
  return bDate.getTime() - aDate.getTime();
46
- } else if (aDate) {
47
- return -1;
48
- } else if (bDate) {
49
- return 1;
50
- } else {
51
- return a.name.localeCompare(b.name);
52
104
  }
53
- });
105
+ // One has date → dated comes first
106
+ if (aDate) return -1;
107
+ if (bDate) return 1;
54
108
 
55
- const postsGroupedByMonthAndYear: { [key: string]: typeof posts } = {};
56
- posts.forEach((post) => {
57
- let date = post.readme?.frontmatter?.date ? new Date(post.readme.frontmatter.date as string) : null;
58
- if (!date && post.slides) {
59
- date = post.slides.frontmatter?.date ? new Date(post.slides.frontmatter.date as string) : null;
60
- }
61
- const monthYear = date ? `${date.getFullYear()}-${date.getMonth() + 1}` : "unknown";
62
- if (!postsGroupedByMonthAndYear[monthYear]) {
63
- postsGroupedByMonthAndYear[monthYear] = [];
64
- }
65
- postsGroupedByMonthAndYear[monthYear].push(post);
109
+ // Neither alphabetical by title
110
+ const aTitle = (getFrontmatter(a)?.title as string) || a.name;
111
+ const bTitle = (getFrontmatter(b)?.title as string) || b.name;
112
+ return aTitle.localeCompare(bTitle);
66
113
  });
67
114
 
68
115
  return (
69
- <div className="space-y-8">
70
- {Object.entries(postsGroupedByMonthAndYear)
71
- .sort(([a], [b]) => {
72
- if (a === "unknown") return 1;
73
- if (b === "unknown") return -1;
74
- return b.localeCompare(a);
75
- })
76
- .map(([monthYear, monthPosts]) => {
77
- const [year, month] = monthYear.split("-");
78
- const displayDate = monthYear === "unknown"
79
- ? "Unknown Date"
80
- : new Date(parseInt(year), parseInt(month) - 1).toLocaleDateString("en-US", {
81
- year: "numeric",
82
- month: "long"
83
- });
84
-
85
- return (
86
- <div key={monthYear}>
87
- <h2 className="text-xs font-mono uppercase tracking-wider text-muted-foreground mb-3">
88
- {displayDate}
89
- </h2>
90
- <div className="space-y-1">
91
- {monthPosts.map((post) => {
92
- let frontmatter = post.readme?.frontmatter;
93
-
94
- if (!post.readme && post.slides) {
95
- frontmatter = post.slides.frontmatter;
96
- }
97
-
98
- const title = (frontmatter?.title as string) || post.name;
99
- const description = frontmatter?.description as string | undefined;
100
- const date = frontmatter?.date ? new Date(frontmatter.date as string) : null;
101
-
102
- return (
103
- <Link
104
- key={post.path}
105
- to={(post.slides && !post.readme) ? `/${post.slides.path}` : `/${post.readme.path}`}
106
- className={cn(
107
- "group block py-3 px-3 -mx-3 rounded-md",
108
- "transition-colors duration-150",
109
- // "hover:bg-accent"
110
- )}
111
- >
112
- <article className="flex items-start gap-4">
113
- {/* Date - left side, fixed width */}
114
- <time
115
- dateTime={date?.toISOString()}
116
- className="font-mono text-xs text-muted-foreground tabular-nums w-20 flex-shrink-0 pt-0.5"
117
- >
118
- {date ? formatDate(date) : <span className="text-muted-foreground/30">—</span>}
119
- </time>
120
-
121
- {/* Main content */}
122
- <div className="flex-1 min-w-0">
123
- <h3 className={cn(
124
- "text-sm font-medium text-foreground",
125
- "group-hover:underline",
126
- "flex items-center gap-2"
127
- )}>
128
- <span>{title}</span>
129
- <ArrowRight className="h-3 w-3 opacity-0 -translate-x-1 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-200 text-primary" />
130
- </h3>
131
-
132
- {description && (
133
- <p className="text-sm text-muted-foreground line-clamp-1 mt-0.5">
134
- {description}
135
- </p>
136
- )}
137
- </div>
138
- </article>
139
- </Link>
140
- );
141
- })}
116
+ <div className="space-y-1">
117
+ {posts.map((post) => {
118
+ const frontmatter = getFrontmatter(post);
119
+
120
+ // Title: explicit frontmatter > stripped numeric prefix > raw name
121
+ const title = (frontmatter?.title as string) || stripNumericPrefix(post.name);
122
+ const description = frontmatter?.description as string | undefined;
123
+ const date = frontmatter?.date ? new Date(frontmatter.date as string) : null;
124
+
125
+ // Determine the link path
126
+ let linkPath: string;
127
+ if (post.file) {
128
+ // Standalone MDX file
129
+ linkPath = `/${post.file.path}`;
130
+ } else if (post.slides && !post.readme) {
131
+ // Folder with only slides
132
+ linkPath = `/${post.slides.path}`;
133
+ } else if (post.readme) {
134
+ // Folder with readme
135
+ linkPath = `/${post.readme.path}`;
136
+ } else {
137
+ // Fallback to folder path
138
+ linkPath = `/${post.path}`;
139
+ }
140
+
141
+ return (
142
+ <Link
143
+ key={post.path}
144
+ to={linkPath}
145
+ className={cn(
146
+ "group block py-3 px-3 -mx-3 rounded-md",
147
+ "transition-colors duration-150",
148
+ )}
149
+ >
150
+ <article className="flex items-start gap-4">
151
+ {/* Date - left side, fixed width */}
152
+ <time
153
+ dateTime={date?.toISOString()}
154
+ className="font-mono text-xs text-muted-foreground tabular-nums w-20 flex-shrink-0 pt-0.5"
155
+ >
156
+ {date ? formatDate(date) : <span className="text-muted-foreground/30">—</span>}
157
+ </time>
158
+
159
+ {/* Main content */}
160
+ <div className="flex-1 min-w-0">
161
+ <h3 className={cn(
162
+ "text-sm font-medium text-foreground",
163
+ "group-hover:underline",
164
+ "flex items-center gap-2"
165
+ )}>
166
+ <span>{title}</span>
167
+ <ArrowRight className="h-3 w-3 opacity-0 -translate-x-1 group-hover:opacity-100 group-hover:translate-x-0 transition-all duration-200 text-primary" />
168
+ </h3>
169
+
170
+ {description && (
171
+ <p className="text-sm text-muted-foreground line-clamp-1 mt-0.5">
172
+ {description}
173
+ </p>
174
+ )}
142
175
  </div>
143
- </div>
144
- );
145
- })}
176
+ </article>
177
+ </Link>
178
+ );
179
+ })}
146
180
  </div>
147
181
  );
148
182
  }
@@ -8,7 +8,7 @@ export function RunningBar() {
8
8
  <>
9
9
  {isRunning && (
10
10
  // this should stay red not another color
11
- <div className="sticky top-0 z-50 px-[var(--page-padding)] py-2 bg-red-500 text-primary-foreground font-mono text-xs text-center tracking-wide">
11
+ <div className="running-bar sticky top-0 z-50 px-[var(--page-padding)] py-2 bg-red-500 text-primary-foreground font-mono text-xs text-center tracking-wide">
12
12
  <span className="inline-flex items-center gap-3">
13
13
  <span className="h-1.5 w-1.5 rounded-full bg-current animate-pulse" />
14
14
  <span className="uppercase tracking-widest">simulation running</span>
@@ -1,11 +1,28 @@
1
+ import { ReactNode } from 'react'
1
2
 
3
+ interface SlideProps {
4
+ index: number
5
+ children: ReactNode
6
+ }
2
7
 
3
- export function Slide({ children }: { children: React.ReactNode }) {
8
+ /**
9
+ * Slide component - wraps slide content for stacked scrollable display.
10
+ * Each slide takes full viewport height.
11
+ */
12
+ export function Slide({ index, children }: SlideProps) {
4
13
  return (
5
- <div className="w-screen h-screen bg-red-500 flex items-center justify-center p-8">
6
- <div className="max-w-5xl w-full h-full">
7
- {children}
14
+ <>
15
+ {index > 0 && (
16
+ <hr className="border-t border-border w-full" />
17
+ )}
18
+ <div
19
+ className="slide-section min-h-screen flex items-center justify-center py-8 sm:py-12 md:py-16 px-4"
20
+ data-slide-index={index}
21
+ >
22
+ <div className="slide-content prose dark:prose-invert prose-headings:tracking-tight prose-p:leading-relaxed max-w-[var(--content-width)] w-full">
23
+ {children}
24
+ </div>
8
25
  </div>
9
- </div>
26
+ </>
10
27
  )
11
28
  }
@@ -1,127 +1,19 @@
1
- import React, { Children, isValidElement, ReactNode, useMemo } from 'react'
1
+ import { ReactNode } from 'react'
2
2
  import { mdxComponents } from '@/components/mdx-components'
3
-
4
- interface SlidesRendererProps {
5
- Content: React.ComponentType<{ components?: Record<string, React.ComponentType> }> | null
6
- frontmatter?: {
7
- title?: string
8
- description?: string
9
- date?: string
10
- }
11
- }
12
-
13
- /**
14
- * Splits MDX content into slides by <hr> elements.
15
- * The MDX is compiled at build time, so imports work.
16
- * Slide boundaries are marked with --- in MDX (which becomes <hr>).
17
- */
18
- export function useSlidesFromMDX({ Content, frontmatter }: SlidesRendererProps) {
19
- const slides = useMemo(() => {
20
- // Handle null Content (loading state)
21
- if (!Content) {
22
- return []
23
- }
24
-
25
- // Create a custom hr component that we can detect
26
- const SlideBreak = () => <hr data-slide-break="true" />
27
-
28
- // Render the MDX with our custom hr
29
- const componentsWithBreak = {
30
- ...mdxComponents,
31
- hr: SlideBreak,
32
- }
33
-
34
- // Render to get the element tree
35
- const rendered = <Content components={componentsWithBreak} />
36
-
37
- // Split children by hr elements
38
- return splitByHr(rendered)
39
- }, [Content])
40
-
41
- return { slides, frontmatter }
42
- }
3
+ import { Slide } from '@/components/slide'
43
4
 
44
5
  /**
45
- * Recursively traverses React element tree and splits by <hr> elements
6
+ * MDX components for slides - includes the Slide component
46
7
  */
47
- function splitByHr(element: ReactNode): ReactNode[][] {
48
- const slides: ReactNode[][] = [[]]
49
-
50
- function traverse(node: ReactNode) {
51
- if (!node) return
52
-
53
- if (Array.isArray(node)) {
54
- node.forEach(traverse)
55
- return
56
- }
57
-
58
- if (isValidElement(node)) {
59
- // Check if this is our slide break marker
60
- if (node.type === 'hr' || (node.props && node.props['data-slide-break'] === 'true')) {
61
- // Start a new slide
62
- slides.push([])
63
- return
64
- }
65
-
66
- // Check if it's an hr component from mdxComponents
67
- const nodeType = node.type as any
68
- if (typeof nodeType === 'function' && nodeType.name === 'SlideBreak') {
69
- slides.push([])
70
- return
71
- }
72
-
73
- // For fragments or elements with children, we need to check children
74
- if (node.props?.children) {
75
- const children = Children.toArray(node.props.children)
76
-
77
- // Check if any child is an hr - if so, we need to split this element
78
- const hasHrChild = children.some(child =>
79
- isValidElement(child) && (
80
- child.type === 'hr' ||
81
- (child.props && child.props['data-slide-break'] === 'true')
82
- )
83
- )
84
-
85
- if (hasHrChild) {
86
- // Split the children
87
- children.forEach(child => {
88
- if (isValidElement(child) && (
89
- child.type === 'hr' ||
90
- (child.props && child.props['data-slide-break'] === 'true')
91
- )) {
92
- slides.push([])
93
- } else {
94
- slides[slides.length - 1].push(child)
95
- }
96
- })
97
- } else {
98
- // No hr children, add the whole element
99
- slides[slides.length - 1].push(node)
100
- }
101
- return
102
- }
103
- }
104
-
105
- // Add to current slide
106
- slides[slides.length - 1].push(node)
107
- }
108
-
109
- // Get the children of the rendered element
110
- if (isValidElement(element) && element.props?.children) {
111
- const children = Children.toArray(element.props.children)
112
- children.forEach(traverse)
113
- } else {
114
- traverse(element)
115
- }
116
-
117
- // Filter out empty slides
118
- return slides.filter(slide => slide.length > 0)
8
+ export const slidesMdxComponents = {
9
+ ...mdxComponents,
10
+ Slide,
119
11
  }
120
12
 
121
13
  /**
122
14
  * Renders a single slide's content
123
15
  */
124
- export function SlideContent({ children }: { children: ReactNode[] }) {
16
+ export function SlideContent({ children }: { children: ReactNode }) {
125
17
  return (
126
18
  <div className="slide-content prose dark:prose-invert prose-headings:tracking-tight prose-p:leading-relaxed max-w-xl">
127
19
  {children}
@@ -1,21 +1,18 @@
1
+ import siteConfig from "virtual:veslx-config";
1
2
 
2
3
  export function Welcome() {
4
+ const config = siteConfig;
5
+
3
6
  return (
4
7
  <div className="text-muted-foreground">
5
- <pre
6
- className="not-prose text-xs md:text-sm rounded"
7
- >
8
- {/* Rubifont on figlet */}
9
- {`
10
- ▗▄▄▖▗▄▄▄▖▗▖ ▗▖ ▗▄▄▖▗▖ ▗▄▖ ▗▄▄▖
11
- ▐▌ ▐▌ █ ▐▛▚▖▐▌▐▌ ▐▌ ▐▌ ▐▌▐▌ ▐▌
12
- ▐▛▀▘ █ ▐▌ ▝▜▌▐▌▝▜▌▐▌ ▐▛▀▜▌▐▛▀▚▖
13
- ▐▌ ▗▄█▄▖▐▌ ▐▌▝▚▄▞▘▐▙▄▄▖▐▌ ▐▌▐▙▄▞▘
14
- `}
15
- </pre>
16
- <div className="text-xs mt-2 font-mono">
17
- PingLab is a repository for running experiments on PING Spiking Neural Networks.
18
- </div>
8
+ <h1 className="text-xl md:text-2xl font-semibold tracking-tight text-foreground mb-2">
9
+ {config.name}
10
+ </h1>
11
+ {config.description && (
12
+ <p className="text-sm text-muted-foreground/80 font-mono">
13
+ {config.description}
14
+ </p>
15
+ )}
19
16
  </div>
20
17
  )
21
18
  }