veslx 0.1.65 → 0.1.66
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 +0 -16
- package/dist/client/components/mdx-components.js +0 -14
- package/dist/client/components/mdx-components.js.map +1 -1
- package/dist/client/components/post-list-item.js +6 -5
- package/dist/client/components/post-list-item.js.map +1 -1
- package/dist/client/components/post-list.js +6 -1
- package/dist/client/components/post-list.js.map +1 -1
- package/dist/client/lib/content-classification.js +11 -2
- package/dist/client/lib/content-classification.js.map +1 -1
- package/dist/client/plugin/src/client.js +7 -40
- package/dist/client/plugin/src/client.js.map +1 -1
- package/dist/plugin/src/client.js +7 -0
- package/dist/plugin/src/plugin.js +5 -2
- package/package.json +1 -1
- package/plugin/src/client.tsx +10 -0
- package/plugin/src/plugin.ts +5 -2
- package/src/components/index.ts +0 -3
- package/src/components/mdx-components.tsx +0 -21
- package/src/components/post-list-item.tsx +10 -6
- package/src/components/post-list.tsx +8 -2
- package/src/lib/content-classification.ts +12 -2
- package/dist/client/components/parameter-badge.js +0 -48
- package/dist/client/components/parameter-badge.js.map +0 -1
- package/dist/client/components/parameter-table.js +0 -216
- package/dist/client/components/parameter-table.js.map +0 -1
- package/dist/client/components/slides/figure-slide.js +0 -14
- package/dist/client/components/slides/figure-slide.js.map +0 -1
- package/dist/client/components/slides/hero-slide.js +0 -21
- package/dist/client/components/slides/hero-slide.js.map +0 -1
- package/dist/client/components/slides/slide-outline.js +0 -28
- package/dist/client/components/slides/slide-outline.js.map +0 -1
- package/dist/client/components/slides/text-slide.js +0 -18
- package/dist/client/components/slides/text-slide.js.map +0 -1
- package/dist/client/components/veslx-cat.js +0 -40
- package/dist/client/components/veslx-cat.js.map +0 -1
- package/dist/client/lib/parameter-utils.js +0 -108
- package/dist/client/lib/parameter-utils.js.map +0 -1
- package/src/components/parameter-badge.tsx +0 -78
- package/src/components/parameter-table.tsx +0 -369
- package/src/components/slides/figure-slide.tsx +0 -16
- package/src/components/slides/hero-slide.tsx +0 -34
- package/src/components/slides/slide-outline.tsx +0 -38
- package/src/components/slides/text-slide.tsx +0 -35
- package/src/components/veslx-cat.tsx +0 -73
|
@@ -7,12 +7,16 @@ interface PostListItemProps {
|
|
|
7
7
|
title: string;
|
|
8
8
|
description?: string;
|
|
9
9
|
date?: Date;
|
|
10
|
-
href
|
|
10
|
+
href?: string;
|
|
11
|
+
/** Alias for href (used in MDX as linkPath) */
|
|
12
|
+
linkPath?: string;
|
|
11
13
|
external?: boolean;
|
|
14
|
+
openInNewTab?: boolean;
|
|
12
15
|
isSlides?: boolean;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
export function PostListItem({ title, description, date, href, external, isSlides }: PostListItemProps) {
|
|
18
|
+
export function PostListItem({ title, description, date, href, linkPath, external, openInNewTab = true, isSlides }: PostListItemProps) {
|
|
19
|
+
const resolvedHref = href || linkPath || '#';
|
|
16
20
|
const className = cn(
|
|
17
21
|
"group block py-3 px-3 -mx-3 rounded-md",
|
|
18
22
|
"transition-colors duration-150",
|
|
@@ -53,9 +57,9 @@ export function PostListItem({ title, description, date, href, external, isSlide
|
|
|
53
57
|
if (external) {
|
|
54
58
|
return (
|
|
55
59
|
<a
|
|
56
|
-
href={
|
|
57
|
-
target="_blank"
|
|
58
|
-
rel="noopener noreferrer"
|
|
60
|
+
href={resolvedHref}
|
|
61
|
+
target={openInNewTab ? "_blank" : undefined}
|
|
62
|
+
rel={openInNewTab ? "noopener noreferrer" : undefined}
|
|
59
63
|
className={className}
|
|
60
64
|
>
|
|
61
65
|
{content}
|
|
@@ -65,7 +69,7 @@ export function PostListItem({ title, description, date, href, external, isSlide
|
|
|
65
69
|
|
|
66
70
|
return (
|
|
67
71
|
<Link
|
|
68
|
-
to={
|
|
72
|
+
to={resolvedHref}
|
|
69
73
|
className={className}
|
|
70
74
|
>
|
|
71
75
|
{content}
|
|
@@ -36,7 +36,11 @@ function filePathToRoutePath(filePath: string): string {
|
|
|
36
36
|
// Helper to get link path from post
|
|
37
37
|
function getLinkPath(post: PostEntry): string {
|
|
38
38
|
if (post.file) {
|
|
39
|
-
// Standalone
|
|
39
|
+
// Standalone PDF file should open directly.
|
|
40
|
+
if (post.file.path.toLowerCase().endsWith('.pdf')) {
|
|
41
|
+
return `/raw/${post.file.path}`;
|
|
42
|
+
}
|
|
43
|
+
// Standalone MDX/TSX file
|
|
40
44
|
return filePathToRoutePath(post.file.path);
|
|
41
45
|
} else if (post.slides && !post.readme) {
|
|
42
46
|
// Folder with only slides
|
|
@@ -51,7 +55,7 @@ function getLinkPath(post: PostEntry): string {
|
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
function isRouterPath(href: string): boolean {
|
|
54
|
-
return href.startsWith("/") && !href.startsWith("//");
|
|
58
|
+
return href.startsWith("/") && !href.startsWith("//") && !href.startsWith("/raw/");
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
export function PostList({ globs = null }: PostListProps) {
|
|
@@ -143,6 +147,7 @@ export function PostList({ globs = null }: PostListProps) {
|
|
|
143
147
|
typeof frontmatter?.link === "string" ? frontmatter.link.trim() : "";
|
|
144
148
|
const href = frontmatterLink || internalLinkPath;
|
|
145
149
|
const external = !isRouterPath(href);
|
|
150
|
+
const openInNewTab = external && !href.startsWith("/raw/");
|
|
146
151
|
|
|
147
152
|
return (
|
|
148
153
|
<PostListItem
|
|
@@ -152,6 +157,7 @@ export function PostList({ globs = null }: PostListProps) {
|
|
|
152
157
|
date={date}
|
|
153
158
|
href={href}
|
|
154
159
|
external={external}
|
|
160
|
+
openInNewTab={openInNewTab}
|
|
155
161
|
isSlides={isSlides}
|
|
156
162
|
/>
|
|
157
163
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DirectoryEntry, FileEntry } from "../../plugin/src/lib";
|
|
2
|
-
import { findReadme, findSlides, findMdxFiles, findStandaloneSlides, findTsxFiles } from "../../plugin/src/client";
|
|
2
|
+
import { findReadme, findSlides, findMdxFiles, findStandaloneSlides, findTsxFiles, findPdfFiles } from "../../plugin/src/client";
|
|
3
3
|
|
|
4
4
|
export type PostEntry = {
|
|
5
5
|
type: 'folder' | 'file';
|
|
@@ -19,6 +19,7 @@ export function directoryToPostEntries(directory: DirectoryEntry): PostEntry[] {
|
|
|
19
19
|
const standaloneFiles = findMdxFiles(directory);
|
|
20
20
|
const standaloneTsxFiles = findTsxFiles(directory);
|
|
21
21
|
const standaloneSlidesFiles = findStandaloneSlides(directory);
|
|
22
|
+
const standalonePdfFiles = findPdfFiles(directory);
|
|
22
23
|
|
|
23
24
|
const folderPosts: PostEntry[] = folders
|
|
24
25
|
.map((folder) => ({
|
|
@@ -59,7 +60,16 @@ export function directoryToPostEntries(directory: DirectoryEntry): PostEntry[] {
|
|
|
59
60
|
file: null,
|
|
60
61
|
}));
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
const pdfPosts: PostEntry[] = standalonePdfFiles.map((file) => ({
|
|
64
|
+
type: 'file' as const,
|
|
65
|
+
name: file.name.replace(/\.pdf$/i, ''),
|
|
66
|
+
path: file.path,
|
|
67
|
+
readme: null,
|
|
68
|
+
slides: null,
|
|
69
|
+
file,
|
|
70
|
+
}));
|
|
71
|
+
|
|
72
|
+
return [...folderPosts, ...filePosts, ...tsxPosts, ...slidesPosts, ...pdfPosts];
|
|
63
73
|
}
|
|
64
74
|
|
|
65
75
|
export function filterVisiblePosts(posts: PostEntry[]): PostEntry[] {
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useFileContent } from "../plugin/src/client.js";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
import { cn } from "../lib/utils.js";
|
|
5
|
-
import { parseConfigFile, extractPath, deriveLabelFromPath, formatValue, getValueType } from "../lib/parameter-utils.js";
|
|
6
|
-
function ParameterBadge({ path, keyPath, label, unit }) {
|
|
7
|
-
const { content, loading, error } = useFileContent(path);
|
|
8
|
-
const { value, displayLabel } = useMemo(() => {
|
|
9
|
-
if (!content) return { value: void 0, displayLabel: "" };
|
|
10
|
-
const data = parseConfigFile(content, path);
|
|
11
|
-
if (!data) return { value: void 0, displayLabel: "" };
|
|
12
|
-
const extracted = extractPath(data, keyPath);
|
|
13
|
-
const derivedLabel = label || deriveLabelFromPath(keyPath);
|
|
14
|
-
return { value: extracted, displayLabel: derivedLabel };
|
|
15
|
-
}, [content, path, keyPath, label]);
|
|
16
|
-
if (loading) {
|
|
17
|
-
return /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/50 border border-border/50", children: /* @__PURE__ */ jsx("span", { className: "w-2 h-2 border border-muted-foreground/40 border-t-transparent rounded-full animate-spin" }) });
|
|
18
|
-
}
|
|
19
|
-
if (error || value === void 0) {
|
|
20
|
-
return /* @__PURE__ */ jsx("span", { className: "inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-destructive/10 border border-destructive/30", children: /* @__PURE__ */ jsx("span", { className: "text-[10px] font-mono text-destructive", children: "—" }) });
|
|
21
|
-
}
|
|
22
|
-
const type = getValueType(value);
|
|
23
|
-
const formattedValue = formatValue(value);
|
|
24
|
-
return /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md font-mono text-[11px]", children: [
|
|
25
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: displayLabel }),
|
|
26
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground/40", children: "=" }),
|
|
27
|
-
/* @__PURE__ */ jsx(
|
|
28
|
-
"span",
|
|
29
|
-
{
|
|
30
|
-
className: cn(
|
|
31
|
-
"font-medium tabular-nums",
|
|
32
|
-
type === "number" && "text-foreground",
|
|
33
|
-
type === "string" && "text-amber-600 dark:text-amber-500",
|
|
34
|
-
type === "boolean" && "text-cyan-600 dark:text-cyan-500",
|
|
35
|
-
type === "null" && "text-muted-foreground/50",
|
|
36
|
-
type === "array" && "text-purple-600 dark:text-purple-400",
|
|
37
|
-
type === "object" && "text-purple-600 dark:text-purple-400"
|
|
38
|
-
),
|
|
39
|
-
children: type === "string" ? `"${formattedValue}"` : formattedValue
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
unit && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: unit })
|
|
43
|
-
] });
|
|
44
|
-
}
|
|
45
|
-
export {
|
|
46
|
-
ParameterBadge
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=parameter-badge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parameter-badge.js","sources":["../../../src/components/parameter-badge.tsx"],"sourcesContent":["import { useFileContent } from \"../../plugin/src/client\";\nimport { useMemo } from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport {\n type ParameterValue,\n extractPath,\n getValueType,\n formatValue,\n parseConfigFile,\n deriveLabelFromPath,\n} from \"@/lib/parameter-utils\";\n\ninterface ParameterBadgeProps {\n /** Path to the YAML or JSON file */\n path: string;\n /** jq-like path to the value (e.g., \".base.N_E\") */\n keyPath: string;\n /** Optional label override (defaults to last segment of keyPath) */\n label?: string;\n /** Optional unit suffix (e.g., \"ms\", \"Hz\") */\n unit?: string;\n}\n\nexport function ParameterBadge({ path, keyPath, label, unit }: ParameterBadgeProps) {\n const { content, loading, error } = useFileContent(path);\n\n const { value, displayLabel } = useMemo(() => {\n if (!content) return { value: undefined, displayLabel: \"\" };\n\n const data = parseConfigFile(content, path);\n if (!data) return { value: undefined, displayLabel: \"\" };\n\n const extracted = extractPath(data, keyPath);\n const derivedLabel = label || deriveLabelFromPath(keyPath);\n\n return { value: extracted, displayLabel: derivedLabel };\n }, [content, path, keyPath, label]);\n\n if (loading) {\n return (\n <span className=\"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-muted/50 border border-border/50\">\n <span className=\"w-2 h-2 border border-muted-foreground/40 border-t-transparent rounded-full animate-spin\" />\n </span>\n );\n }\n\n if (error || value === undefined) {\n return (\n <span className=\"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md bg-destructive/10 border border-destructive/30\">\n <span className=\"text-[10px] font-mono text-destructive\">—</span>\n </span>\n );\n }\n\n const type = getValueType(value);\n const formattedValue = formatValue(value);\n\n return (\n <span className=\"inline-flex items-center gap-1.5 px-2 py-0.5 rounded-md font-mono text-[11px]\">\n <span className=\"text-muted-foreground\">{displayLabel}</span>\n <span className=\"text-muted-foreground/40\">=</span>\n <span\n className={cn(\n \"font-medium tabular-nums\",\n type === \"number\" && \"text-foreground\",\n type === \"string\" && \"text-amber-600 dark:text-amber-500\",\n type === \"boolean\" && \"text-cyan-600 dark:text-cyan-500\",\n type === \"null\" && \"text-muted-foreground/50\",\n type === \"array\" && \"text-purple-600 dark:text-purple-400\",\n type === \"object\" && \"text-purple-600 dark:text-purple-400\"\n )}\n >\n {type === \"string\" ? `\"${formattedValue}\"` : formattedValue}\n </span>\n {unit && <span className=\"text-muted-foreground/60\">{unit}</span>}\n </span>\n );\n}\n"],"names":[],"mappings":";;;;;AAuBO,SAAS,eAAe,EAAE,MAAM,SAAS,OAAO,QAA6B;AAClF,QAAM,EAAE,SAAS,SAAS,MAAA,IAAU,eAAe,IAAI;AAEvD,QAAM,EAAE,OAAO,aAAA,IAAiB,QAAQ,MAAM;AAC5C,QAAI,CAAC,QAAS,QAAO,EAAE,OAAO,QAAW,cAAc,GAAA;AAEvD,UAAM,OAAO,gBAAgB,SAAS,IAAI;AAC1C,QAAI,CAAC,KAAM,QAAO,EAAE,OAAO,QAAW,cAAc,GAAA;AAEpD,UAAM,YAAY,YAAY,MAAM,OAAO;AAC3C,UAAM,eAAe,SAAS,oBAAoB,OAAO;AAEzD,WAAO,EAAE,OAAO,WAAW,cAAc,aAAA;AAAA,EAC3C,GAAG,CAAC,SAAS,MAAM,SAAS,KAAK,CAAC;AAElC,MAAI,SAAS;AACX,WACE,oBAAC,UAAK,WAAU,+FACd,8BAAC,QAAA,EAAK,WAAU,4FAA2F,EAAA,CAC7G;AAAA,EAEJ;AAEA,MAAI,SAAS,UAAU,QAAW;AAChC,WACE,oBAAC,UAAK,WAAU,0GACd,8BAAC,QAAA,EAAK,WAAU,0CAAyC,UAAA,IAAA,CAAC,EAAA,CAC5D;AAAA,EAEJ;AAEA,QAAM,OAAO,aAAa,KAAK;AAC/B,QAAM,iBAAiB,YAAY,KAAK;AAExC,SACE,qBAAC,QAAA,EAAK,WAAU,iFACd,UAAA;AAAA,IAAA,oBAAC,QAAA,EAAK,WAAU,yBAAyB,UAAA,cAAa;AAAA,IACtD,oBAAC,QAAA,EAAK,WAAU,4BAA2B,UAAA,KAAC;AAAA,IAC5C;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,SAAS,YAAY;AAAA,UACrB,SAAS,YAAY;AAAA,UACrB,SAAS,aAAa;AAAA,UACtB,SAAS,UAAU;AAAA,UACnB,SAAS,WAAW;AAAA,UACpB,SAAS,YAAY;AAAA,QAAA;AAAA,QAGtB,UAAA,SAAS,WAAW,IAAI,cAAc,MAAM;AAAA,MAAA;AAAA,IAAA;AAAA,IAE9C,QAAQ,oBAAC,QAAA,EAAK,WAAU,4BAA4B,UAAA,KAAA,CAAK;AAAA,EAAA,GAC5D;AAEJ;"}
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useDirectory, useFileContent } from "../plugin/src/client.js";
|
|
3
|
-
import { useMemo, useRef, useEffect } from "react";
|
|
4
|
-
import { useParams } from "react-router-dom";
|
|
5
|
-
import { cn } from "../lib/utils.js";
|
|
6
|
-
import { minimatch } from "minimatch";
|
|
7
|
-
import { parseConfigFile, extractPath, formatValue, getValueType } from "../lib/parameter-utils.js";
|
|
8
|
-
function usePreventSwipeNavigation(ref) {
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
const el = ref.current;
|
|
11
|
-
if (!el) return;
|
|
12
|
-
const handleWheel = (e) => {
|
|
13
|
-
if (Math.abs(e.deltaX) <= Math.abs(e.deltaY)) return;
|
|
14
|
-
const { scrollLeft, scrollWidth, clientWidth } = el;
|
|
15
|
-
const atLeftEdge = scrollLeft <= 0;
|
|
16
|
-
const atRightEdge = scrollLeft + clientWidth >= scrollWidth - 1;
|
|
17
|
-
if (atLeftEdge && e.deltaX < 0 || atRightEdge && e.deltaX > 0) {
|
|
18
|
-
e.preventDefault();
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
el.addEventListener("wheel", handleWheel, { passive: false });
|
|
22
|
-
return () => el.removeEventListener("wheel", handleWheel);
|
|
23
|
-
}, [ref]);
|
|
24
|
-
}
|
|
25
|
-
function isGlobPattern(path) {
|
|
26
|
-
return path.includes("*") || path.includes("?") || path.includes("[");
|
|
27
|
-
}
|
|
28
|
-
function collectAllConfigFiles(entry) {
|
|
29
|
-
if (entry.type === "file") {
|
|
30
|
-
if (entry.name.match(/\.(yaml|yml|json)$/i)) {
|
|
31
|
-
return [entry];
|
|
32
|
-
}
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
const files = [];
|
|
36
|
-
for (const child of entry.children || []) {
|
|
37
|
-
files.push(...collectAllConfigFiles(child));
|
|
38
|
-
}
|
|
39
|
-
return files;
|
|
40
|
-
}
|
|
41
|
-
function sortPathsNumerically(paths) {
|
|
42
|
-
paths.sort((a, b) => {
|
|
43
|
-
const nums = (s) => (s.match(/\d+/g) || []).map(Number);
|
|
44
|
-
const na = nums(a);
|
|
45
|
-
const nb = nums(b);
|
|
46
|
-
const len = Math.max(na.length, nb.length);
|
|
47
|
-
for (let i = 0; i < len; i++) {
|
|
48
|
-
const diff = (na[i] ?? 0) - (nb[i] ?? 0);
|
|
49
|
-
if (diff !== 0) return diff;
|
|
50
|
-
}
|
|
51
|
-
return a.localeCompare(b);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
function SingleParameterTable({
|
|
55
|
-
path,
|
|
56
|
-
pairs,
|
|
57
|
-
label,
|
|
58
|
-
withMargin = true,
|
|
59
|
-
scrollable = true,
|
|
60
|
-
compact = false
|
|
61
|
-
}) {
|
|
62
|
-
const { content, loading, error } = useFileContent(path);
|
|
63
|
-
if (!pairs || pairs.length === 0) {
|
|
64
|
-
return /* @__PURE__ */ jsx("div", { className: cn("p-3 rounded border border-border/50 bg-card/30", withMargin && "my-6"), children: /* @__PURE__ */ jsx("p", { className: "text-[11px] font-mono text-muted-foreground", children: "pairs is required" }) });
|
|
65
|
-
}
|
|
66
|
-
const { parsed, parseError } = useMemo(() => {
|
|
67
|
-
if (!content) return { parsed: null, parseError: "no content" };
|
|
68
|
-
const data = parseConfigFile(content, path);
|
|
69
|
-
if (!data) {
|
|
70
|
-
if (!path.match(/\.(yaml|yml|json)$/i)) {
|
|
71
|
-
return { parsed: null, parseError: `unsupported file type` };
|
|
72
|
-
}
|
|
73
|
-
if (content.trim().startsWith("<!") || content.trim().startsWith("<html")) {
|
|
74
|
-
return { parsed: null, parseError: `file not found` };
|
|
75
|
-
}
|
|
76
|
-
return { parsed: null, parseError: `invalid ${path.split(".").pop()} syntax` };
|
|
77
|
-
}
|
|
78
|
-
return { parsed: data, parseError: null };
|
|
79
|
-
}, [content, path]);
|
|
80
|
-
if (loading) {
|
|
81
|
-
return /* @__PURE__ */ jsx("div", { className: "my-6 p-4 rounded border border-border/50 bg-card/30", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground/60", children: [
|
|
82
|
-
/* @__PURE__ */ jsx("div", { className: "w-3 h-3 border border-current border-t-transparent rounded-full animate-spin" }),
|
|
83
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-mono", children: "loading parameters..." })
|
|
84
|
-
] }) });
|
|
85
|
-
}
|
|
86
|
-
if (error) {
|
|
87
|
-
return /* @__PURE__ */ jsx("div", { className: "my-6 p-3 rounded border border-destructive/30 bg-destructive/5", children: /* @__PURE__ */ jsx("p", { className: "text-[11px] font-mono text-destructive", children: error }) });
|
|
88
|
-
}
|
|
89
|
-
if (!parsed) {
|
|
90
|
-
return /* @__PURE__ */ jsx("div", { className: cn("p-3 rounded border border-border/50 bg-card/30", withMargin && "my-6"), children: /* @__PURE__ */ jsxs("p", { className: "text-[11px] font-mono text-muted-foreground", children: [
|
|
91
|
-
label && /* @__PURE__ */ jsxs("span", { className: "text-foreground/60", children: [
|
|
92
|
-
label,
|
|
93
|
-
": "
|
|
94
|
-
] }),
|
|
95
|
-
parseError || "unable to parse"
|
|
96
|
-
] }) });
|
|
97
|
-
}
|
|
98
|
-
const renderPairsTable = () => {
|
|
99
|
-
return /* @__PURE__ */ jsx("div", { className: cn(
|
|
100
|
-
"border border-border rounded-md",
|
|
101
|
-
scrollable ? "overflow-x-auto" : "overflow-x-hidden"
|
|
102
|
-
), children: /* @__PURE__ */ jsxs("table", { className: cn(
|
|
103
|
-
"w-full border-collapse",
|
|
104
|
-
compact ? "text-[11px]" : "text-sm"
|
|
105
|
-
), children: [
|
|
106
|
-
/* @__PURE__ */ jsx("thead", { className: "bg-muted/50", children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-border last:border-b-0", children: [
|
|
107
|
-
/* @__PURE__ */ jsx("th", { className: cn(
|
|
108
|
-
"text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",
|
|
109
|
-
compact ? "px-3 py-2" : "px-4 py-3"
|
|
110
|
-
), children: "Parameter" }),
|
|
111
|
-
/* @__PURE__ */ jsx("th", { className: cn(
|
|
112
|
-
"text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",
|
|
113
|
-
compact ? "px-3 py-2" : "px-4 py-3"
|
|
114
|
-
), children: "Value" })
|
|
115
|
-
] }) }),
|
|
116
|
-
/* @__PURE__ */ jsx("tbody", { children: pairs.map(({ key, label: rowLabel }) => {
|
|
117
|
-
const value = extractPath(parsed, key);
|
|
118
|
-
const type = value === void 0 ? "missing" : getValueType(value);
|
|
119
|
-
const displayValue = value === void 0 ? "—" : type === "string" ? `"${formatValue(value)}"` : formatValue(value);
|
|
120
|
-
return /* @__PURE__ */ jsxs("tr", { className: "border-b border-border last:border-b-0", children: [
|
|
121
|
-
/* @__PURE__ */ jsx("td", { className: cn(
|
|
122
|
-
"align-top",
|
|
123
|
-
compact ? "px-3 py-2" : "px-4 py-3"
|
|
124
|
-
), children: rowLabel || key }),
|
|
125
|
-
/* @__PURE__ */ jsx(
|
|
126
|
-
"td",
|
|
127
|
-
{
|
|
128
|
-
className: cn(
|
|
129
|
-
"align-top",
|
|
130
|
-
compact ? "px-3 py-2" : "px-4 py-3",
|
|
131
|
-
type === "missing" && "text-muted-foreground"
|
|
132
|
-
),
|
|
133
|
-
children: displayValue
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
] }, key);
|
|
137
|
-
}) })
|
|
138
|
-
] }) });
|
|
139
|
-
};
|
|
140
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("not-prose", withMargin && "my-6"), children: [
|
|
141
|
-
label && /* @__PURE__ */ jsx("div", { className: "text-[11px] font-mono text-muted-foreground mb-1.5 truncate", title: label, children: label }),
|
|
142
|
-
renderPairsTable()
|
|
143
|
-
] });
|
|
144
|
-
}
|
|
145
|
-
function ParameterTable({ path, pairs, compact = false }) {
|
|
146
|
-
const { "*": routePath = "" } = useParams();
|
|
147
|
-
if (!pairs || pairs.length === 0) {
|
|
148
|
-
return /* @__PURE__ */ jsx("div", { className: "my-6 p-3 rounded border border-border/50 bg-card/30", children: /* @__PURE__ */ jsx("p", { className: "text-[11px] font-mono text-muted-foreground", children: "pairs is required" }) });
|
|
149
|
-
}
|
|
150
|
-
const currentDir = routePath.replace(/\/?[^/]+\.mdx$/i, "").replace(/\/$/, "") || ".";
|
|
151
|
-
let resolvedPath = path;
|
|
152
|
-
if (path == null ? void 0 : path.startsWith("./")) {
|
|
153
|
-
const relativePart = path.slice(2);
|
|
154
|
-
resolvedPath = currentDir === "." ? relativePart : `${currentDir}/${relativePart}`;
|
|
155
|
-
} else if (path && !path.startsWith("/") && !path.includes("/") && !isGlobPattern(path)) {
|
|
156
|
-
resolvedPath = currentDir === "." ? path : `${currentDir}/${path}`;
|
|
157
|
-
}
|
|
158
|
-
const hasGlob = isGlobPattern(resolvedPath);
|
|
159
|
-
const baseDir = useMemo(() => {
|
|
160
|
-
if (!hasGlob) return null;
|
|
161
|
-
const beforeGlob = resolvedPath.split(/[*?\[]/, 1)[0];
|
|
162
|
-
const lastSlash = beforeGlob.lastIndexOf("/");
|
|
163
|
-
if (lastSlash === -1) return ".";
|
|
164
|
-
return beforeGlob.slice(0, lastSlash) || ".";
|
|
165
|
-
}, [hasGlob, resolvedPath]);
|
|
166
|
-
const { directory } = useDirectory(baseDir || ".");
|
|
167
|
-
const matchingPaths = useMemo(() => {
|
|
168
|
-
if (!hasGlob || !directory) return [];
|
|
169
|
-
const allFiles = collectAllConfigFiles(directory);
|
|
170
|
-
const paths = allFiles.map((f) => f.path).filter((p) => minimatch(p, resolvedPath, { matchBase: true }));
|
|
171
|
-
sortPathsNumerically(paths);
|
|
172
|
-
return paths;
|
|
173
|
-
}, [hasGlob, directory, resolvedPath, path, baseDir]);
|
|
174
|
-
if (!hasGlob) {
|
|
175
|
-
return /* @__PURE__ */ jsx(SingleParameterTable, { path: resolvedPath, pairs, compact });
|
|
176
|
-
}
|
|
177
|
-
if (!directory) {
|
|
178
|
-
return /* @__PURE__ */ jsx("div", { className: "my-6 p-4 rounded border border-border/50 bg-card/30", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-muted-foreground/60", children: [
|
|
179
|
-
/* @__PURE__ */ jsx("div", { className: "w-3 h-3 border border-current border-t-transparent rounded-full animate-spin" }),
|
|
180
|
-
/* @__PURE__ */ jsx("span", { className: "text-[11px] font-mono", children: "loading parameters..." })
|
|
181
|
-
] }) });
|
|
182
|
-
}
|
|
183
|
-
if (matchingPaths.length === 0) {
|
|
184
|
-
return /* @__PURE__ */ jsx("div", { className: "my-6 p-3 rounded border border-border/50 bg-card/30", children: /* @__PURE__ */ jsxs("p", { className: "text-[11px] font-mono text-muted-foreground", children: [
|
|
185
|
-
"no files matching: ",
|
|
186
|
-
resolvedPath,
|
|
187
|
-
/* @__PURE__ */ jsx("br", {}),
|
|
188
|
-
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground/50", children: [
|
|
189
|
-
"(base dir: ",
|
|
190
|
-
baseDir,
|
|
191
|
-
", original: ",
|
|
192
|
-
path,
|
|
193
|
-
")"
|
|
194
|
-
] })
|
|
195
|
-
] }) });
|
|
196
|
-
}
|
|
197
|
-
const scrollRef = useRef(null);
|
|
198
|
-
usePreventSwipeNavigation(scrollRef);
|
|
199
|
-
const count = matchingPaths.length;
|
|
200
|
-
const breakoutClass = count >= 4 ? "relative left-1/2 w-[96vw] -translate-x-1/2" : count >= 2 ? "relative left-1/2 w-[75vw] -translate-x-1/2" : "";
|
|
201
|
-
return /* @__PURE__ */ jsx("div", { className: `my-6 ${breakoutClass} overflow-x-hidden`, children: /* @__PURE__ */ jsx("div", { ref: scrollRef, className: "flex gap-4 overflow-x-auto overscroll-x-contain pb-2", children: matchingPaths.map((filePath) => /* @__PURE__ */ jsx("div", { className: "flex-none w-[280px]", children: /* @__PURE__ */ jsx(
|
|
202
|
-
SingleParameterTable,
|
|
203
|
-
{
|
|
204
|
-
path: filePath,
|
|
205
|
-
pairs,
|
|
206
|
-
label: filePath.split("/").pop() || filePath,
|
|
207
|
-
withMargin: false,
|
|
208
|
-
scrollable: false,
|
|
209
|
-
compact
|
|
210
|
-
}
|
|
211
|
-
) }, filePath)) }) });
|
|
212
|
-
}
|
|
213
|
-
export {
|
|
214
|
-
ParameterTable
|
|
215
|
-
};
|
|
216
|
-
//# sourceMappingURL=parameter-table.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parameter-table.js","sources":["../../../src/components/parameter-table.tsx"],"sourcesContent":["import { useFileContent, useDirectory } from \"../../plugin/src/client\";\nimport { useMemo, useRef, useEffect } from \"react\";\nimport { useParams } from \"react-router-dom\";\nimport { cn } from \"@/lib/utils\";\nimport { minimatch } from \"minimatch\";\nimport {\n type ParameterValue,\n extractPath,\n getValueType,\n formatValue,\n parseConfigFile,\n} from \"@/lib/parameter-utils\";\nimport { FileEntry, DirectoryEntry } from \"../../plugin/src/lib\";\n\n/**\n * Hook to prevent horizontal scroll from triggering browser back/forward gestures.\n */\nfunction usePreventSwipeNavigation(ref: React.RefObject<HTMLElement | null>) {\n useEffect(() => {\n const el = ref.current;\n if (!el) return;\n\n const handleWheel = (e: WheelEvent) => {\n if (Math.abs(e.deltaX) <= Math.abs(e.deltaY)) return;\n\n const { scrollLeft, scrollWidth, clientWidth } = el;\n const atLeftEdge = scrollLeft <= 0;\n const atRightEdge = scrollLeft + clientWidth >= scrollWidth - 1;\n\n if ((atLeftEdge && e.deltaX < 0) || (atRightEdge && e.deltaX > 0)) {\n e.preventDefault();\n }\n };\n\n el.addEventListener('wheel', handleWheel, { passive: false });\n return () => el.removeEventListener('wheel', handleWheel);\n }, [ref]);\n}\n\n// Check if a path contains glob patterns\nfunction isGlobPattern(path: string): boolean {\n return path.includes('*') || path.includes('?') || path.includes('[');\n}\n\n// Recursively collect all config files from a directory tree\nfunction collectAllConfigFiles(entry: DirectoryEntry | FileEntry): FileEntry[] {\n if (entry.type === \"file\") {\n if (entry.name.match(/\\.(yaml|yml|json)$/i)) {\n return [entry];\n }\n return [];\n }\n const files: FileEntry[] = [];\n for (const child of entry.children || []) {\n files.push(...collectAllConfigFiles(child));\n }\n return files;\n}\n\n// Sort paths numerically\nfunction sortPathsNumerically(paths: string[]): void {\n paths.sort((a, b) => {\n const nums = (s: string) => (s.match(/\\d+/g) || []).map(Number);\n const na = nums(a);\n const nb = nums(b);\n const len = Math.max(na.length, nb.length);\n for (let i = 0; i < len; i++) {\n const diff = (na[i] ?? 0) - (nb[i] ?? 0);\n if (diff !== 0) return diff;\n }\n return a.localeCompare(b);\n });\n}\n\ninterface SingleParameterTableProps {\n /** Path to the YAML or JSON file */\n path: string;\n /**\n * Required array of key/label pairs to render as a markdown-style table.\n * Each key is a jq-like path (e.g., \".base.dt\").\n */\n pairs: Array<{ key: string; label?: string }>;\n /** Optional label to show above the table */\n label?: string;\n /** Whether to include vertical margin (default true) */\n withMargin?: boolean;\n /**\n * Whether this table should manage its own horizontal scrolling.\n * Set false when the parent already provides a single shared scrollbar.\n */\n scrollable?: boolean;\n /** Compact mode for dense rendering */\n compact?: boolean;\n}\n\ninterface ParameterTableProps {\n /** Path to the YAML or JSON file, supports glob patterns like \"*.yaml\" */\n path: string;\n /**\n * Required array of key/label pairs to render Complete table.\n */\n pairs: Array<{ key: string; label?: string }>;\n /** Compact mode for dense rendering */\n compact?: boolean;\n}\n\nfunction SingleParameterTable({\n path,\n pairs,\n label,\n withMargin = true,\n scrollable = true,\n compact = false,\n}: SingleParameterTableProps) {\n const { content, loading, error } = useFileContent(path);\n\n if (!pairs || pairs.length === 0) {\n return (\n <div className={cn(\"p-3 rounded border border-border/50 bg-card/30\", withMargin && \"my-6\")}>\n <p className=\"text-[11px] font-mono text-muted-foreground\">\n pairs is required\n </p>\n </div>\n );\n }\n\n const { parsed, parseError } = useMemo(() => {\n if (!content) return { parsed: null, parseError: 'no content' };\n\n const data = parseConfigFile(content, path);\n if (!data) {\n // Check why parsing failed\n if (!path.match(/\\.(yaml|yml|json)$/i)) {\n return { parsed: null, parseError: `unsupported file type` };\n }\n // Check if content looks like HTML (404 page)\n if (content.trim().startsWith('<!') || content.trim().startsWith('<html')) {\n return { parsed: null, parseError: `file not found` };\n }\n return { parsed: null, parseError: `invalid ${path.split('.').pop()} syntax` };\n }\n\n return { parsed: data, parseError: null };\n }, [content, path]);\n\n if (loading) {\n return (\n <div className=\"my-6 p-4 rounded border border-border/50 bg-card/30\">\n <div className=\"flex items-center gap-2 text-muted-foreground/60\">\n <div className=\"w-3 h-3 border border-current border-t-transparent rounded-full animate-spin\" />\n <span className=\"text-[11px] font-mono\">loading parameters...</span>\n </div>\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"my-6 p-3 rounded border border-destructive/30 bg-destructive/5\">\n <p className=\"text-[11px] font-mono text-destructive\">{error}</p>\n </div>\n );\n }\n\n if (!parsed) {\n return (\n <div className={cn(\"p-3 rounded border border-border/50 bg-card/30\", withMargin && \"my-6\")}>\n <p className=\"text-[11px] font-mono text-muted-foreground\">\n {label && <span className=\"text-foreground/60\">{label}: </span>}\n {parseError || 'unable to parse'}\n </p>\n </div>\n );\n }\n\n const renderPairsTable = () => {\n return (\n <div className={cn(\n \"border border-border rounded-md\",\n scrollable ? \"overflow-x-auto\" : \"overflow-x-hidden\"\n )}>\n <table className={cn(\n \"w-full border-collapse\",\n compact ? \"text-[11px]\" : \"text-sm\"\n )}>\n <thead className=\"bg-muted/50\">\n <tr className=\"border-b border-border last:border-b-0\">\n <th className={cn(\n \"text-left text-xs font-medium text-muted-foreground uppercase tracking-wider\",\n compact ? \"px-3 py-2\" : \"px-4 py-3\"\n )}>\n Parameter\n </th>\n <th className={cn(\n \"text-left text-xs font-medium text-muted-foreground uppercase tracking-wider\",\n compact ? \"px-3 py-2\" : \"px-4 py-3\"\n )}>\n Value\n </th>\n </tr>\n </thead>\n <tbody>\n {pairs.map(({ key, label: rowLabel }) => {\n const value = extractPath(parsed, key);\n const type = value === undefined ? \"missing\" : getValueType(value);\n const displayValue = value === undefined\n ? \"—\"\n : type === \"string\"\n ? `\"${formatValue(value)}\"`\n : formatValue(value);\n\n return (\n <tr key={key} className=\"border-b border-border last:border-b-0\">\n <td className={cn(\n \"align-top\",\n compact ? \"px-3 py-2\" : \"px-4 py-3\"\n )}>{rowLabel || key}</td>\n <td\n className={cn(\n \"align-top\",\n compact ? \"px-3 py-2\" : \"px-4 py-3\",\n type === \"missing\" && \"text-muted-foreground\"\n )}\n >\n {displayValue}\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n );\n };\n\n return (\n <div className={cn(\"not-prose\", withMargin && \"my-6\")}>\n {label && (\n <div className=\"text-[11px] font-mono text-muted-foreground mb-1.5 truncate\" title={label}>\n {label}\n </div>\n )}\n {renderPairsTable()}\n </div>\n );\n}\n\n/**\n * ParameterTable component that displays YAML/JSON config files.\n * Supports glob patterns in the path prop to show multiple files.\n */\nexport function ParameterTable({ path, pairs, compact = false }: ParameterTableProps) {\n const { \"*\": routePath = \"\" } = useParams();\n\n if (!pairs || pairs.length === 0) {\n return (\n <div className=\"my-6 p-3 rounded border border-border/50 bg-card/30\">\n <p className=\"text-[11px] font-mono text-muted-foreground\">pairs is required</p>\n </div>\n );\n }\n\n // Get current directory from route\n const currentDir = routePath\n .replace(/\\/?[^/]+\\.mdx$/i, \"\")\n .replace(/\\/$/, \"\")\n || \".\";\n\n // Resolve relative paths\n let resolvedPath = path;\n if (path?.startsWith(\"./\")) {\n const relativePart = path.slice(2);\n resolvedPath = currentDir === \".\" ? relativePart : `${currentDir}/${relativePart}`;\n } else if (path && !path.startsWith(\"/\") && !path.includes(\"/\") && !isGlobPattern(path)) {\n resolvedPath = currentDir === \".\" ? path : `${currentDir}/${path}`;\n }\n\n // Check if this is a glob pattern\n const hasGlob = isGlobPattern(resolvedPath);\n\n // For glob patterns, get the base directory (directory containing the glob pattern)\n const baseDir = useMemo(() => {\n if (!hasGlob) return null;\n // Get everything before the first glob character\n const beforeGlob = resolvedPath.split(/[*?\\[]/, 1)[0];\n // Extract directory portion (everything up to the last slash)\n const lastSlash = beforeGlob.lastIndexOf('/');\n if (lastSlash === -1) return \".\";\n return beforeGlob.slice(0, lastSlash) || \".\";\n }, [hasGlob, resolvedPath]);\n\n const { directory } = useDirectory(baseDir || \".\");\n\n // Find matching files for glob patterns\n const matchingPaths = useMemo(() => {\n if (!hasGlob || !directory) return [];\n\n const allFiles = collectAllConfigFiles(directory);\n const paths = allFiles\n .map(f => f.path)\n .filter(p => minimatch(p, resolvedPath, { matchBase: true }));\n\n sortPathsNumerically(paths);\n\n return paths;\n }, [hasGlob, directory, resolvedPath, path, baseDir]);\n\n // If not a glob pattern, just render the single table\n if (!hasGlob) {\n return <SingleParameterTable path={resolvedPath} pairs={pairs} compact={compact} />;\n }\n\n // Loading state for glob patterns\n if (!directory) {\n return (\n <div className=\"my-6 p-4 rounded border border-border/50 bg-card/30\">\n <div className=\"flex items-center gap-2 text-muted-foreground/60\">\n <div className=\"w-3 h-3 border border-current border-t-transparent rounded-full animate-spin\" />\n <span className=\"text-[11px] font-mono\">loading parameters...</span>\n </div>\n </div>\n );\n }\n\n // No matches\n if (matchingPaths.length === 0) {\n return (\n <div className=\"my-6 p-3 rounded border border-border/50 bg-card/30\">\n <p className=\"text-[11px] font-mono text-muted-foreground\">\n no files matching: {resolvedPath}\n <br />\n <span className=\"text-muted-foreground/50\">(base dir: {baseDir}, original: {path})</span>\n </p>\n </div>\n );\n }\n\n const scrollRef = useRef<HTMLDivElement>(null);\n usePreventSwipeNavigation(scrollRef);\n\n // Breakout width based on count\n const count = matchingPaths.length;\n // Use translate centering (instead of negative margins) to avoid creating a tiny\n // page-level horizontal scrollbar while still \"breaking out\" of prose width.\n const breakoutClass = count >= 4\n ? 'relative left-1/2 w-[96vw] -translate-x-1/2'\n : count >= 2\n ? 'relative left-1/2 w-[75vw] -translate-x-1/2'\n : '';\n\n return (\n <div className={`my-6 ${breakoutClass} overflow-x-hidden`}>\n <div ref={scrollRef} className=\"flex gap-4 overflow-x-auto overscroll-x-contain pb-2\">\n {matchingPaths.map((filePath) => (\n <div key={filePath} className=\"flex-none w-[280px]\">\n <SingleParameterTable\n path={filePath}\n pairs={pairs}\n label={filePath.split('/').pop() || filePath}\n withMargin={false}\n scrollable={false}\n compact={compact}\n />\n </div>\n ))}\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAiBA,SAAS,0BAA0B,KAA0C;AAC3E,YAAU,MAAM;AACd,UAAM,KAAK,IAAI;AACf,QAAI,CAAC,GAAI;AAET,UAAM,cAAc,CAAC,MAAkB;AACrC,UAAI,KAAK,IAAI,EAAE,MAAM,KAAK,KAAK,IAAI,EAAE,MAAM,EAAG;A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AAA;AAAA,QAAY;AAAA,QAAQ;AAAA,QAAa;AAAA,QAAK;AAAA,MAAA,EAAA,CAAC;AAAA,IAAA,EAAA,CACpF,EAAA,CACF;AAAA,EAEJ;AAEA,QAAM,YAAY,OAAuB,IAAI;AAC7C,4BAA0B,SAAS;AAGnC,QAAM,QAAQ,cAAc;AAG5B,QAAM,gBAAgB,SAAS,IAC3B,gDACA,SAAS,IACP,gDACA;AAEN,6BACG,OAAA,EAAI,WAAW,QAAQ,aAAa,sBACnC,8BAAC,OAAA,EAAI,KAAK,WAAW,WAAU,wDAC5B,wBAAc,IAAI,CAAC,aAClB,oBAAC,OAAA,EAAmB,WAAU,uBAC5B,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA,MACA,OAAO,SAAS,MAAM,GAAG,EAAE,SAAS;AAAA,MACpC,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ;AAAA,IAAA;AAAA,EAAA,EACF,GARQ,QASV,CACD,EAAA,CACH,GACF;AAEJ;"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
function FigureSlide({
|
|
3
|
-
title,
|
|
4
|
-
src
|
|
5
|
-
}) {
|
|
6
|
-
return /* @__PURE__ */ jsxs("div", { className: "figure-slide", children: [
|
|
7
|
-
/* @__PURE__ */ jsx("h2", { children: title }),
|
|
8
|
-
/* @__PURE__ */ jsx("img", { src, alt: title })
|
|
9
|
-
] });
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
FigureSlide
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=figure-slide.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"figure-slide.js","sources":["../../../../src/components/slides/figure-slide.tsx"],"sourcesContent":["\n\nexport function FigureSlide({\n title,\n src,\n}: {\n title: string;\n src: string;\n}) {\n return (\n <div className=\"figure-slide\">\n <h2>{title}</h2>\n <img src={src} alt={title} />\n </div>\n );\n}"],"names":[],"mappings":";AAEO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AACF,GAGG;AACD,SACE,qBAAC,OAAA,EAAI,WAAU,gBACb,UAAA;AAAA,IAAA,oBAAC,QAAI,UAAA,MAAA,CAAM;AAAA,IACX,oBAAC,OAAA,EAAI,KAAU,KAAK,MAAA,CAAO;AAAA,EAAA,GAC7B;AAEJ;"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
function HeroSlide({
|
|
3
|
-
title,
|
|
4
|
-
subtitle,
|
|
5
|
-
author,
|
|
6
|
-
date
|
|
7
|
-
}) {
|
|
8
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
9
|
-
/* @__PURE__ */ jsx("h1", { className: "text-[clamp(2.5rem,6vw,5rem)] font-semibold leading-[1.1] tracking-[-0.02em] text-foreground text-balance", children: title }),
|
|
10
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "text-[clamp(1rem,2vw,1.5rem)] text-muted-foreground max-w-[50ch] leading-relaxed", children: subtitle }),
|
|
11
|
-
(author || date) && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted-foreground mt-4", children: [
|
|
12
|
-
author && /* @__PURE__ */ jsx("span", { children: author }),
|
|
13
|
-
author && date && /* @__PURE__ */ jsx("span", { className: "text-border", children: "·" }),
|
|
14
|
-
date && /* @__PURE__ */ jsx("span", { children: date })
|
|
15
|
-
] })
|
|
16
|
-
] });
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
HeroSlide
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=hero-slide.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hero-slide.js","sources":["../../../../src/components/slides/hero-slide.tsx"],"sourcesContent":["\nexport function HeroSlide({\n title,\n subtitle,\n author,\n date,\n}: {\n title: string;\n subtitle?: string;\n author?: string;\n date?: string;\n}) {\n return (\n <div>\n <h1 className=\"text-[clamp(2.5rem,6vw,5rem)] font-semibold leading-[1.1] tracking-[-0.02em] text-foreground text-balance\">\n {title}\n </h1>\n\n {subtitle && (\n <p className=\"text-[clamp(1rem,2vw,1.5rem)] text-muted-foreground max-w-[50ch] leading-relaxed\">\n {subtitle}\n </p>\n )}\n\n {(author || date) && (\n <div className=\"flex flex-wrap gap-x-4 gap-y-1 text-sm text-muted-foreground mt-4\">\n {author && <span>{author}</span>}\n {author && date && <span className=\"text-border\">·</span>}\n {date && <span>{date}</span>}\n </div>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";AACO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAKG;AACD,8BACG,OAAA,EACC,UAAA;AAAA,IAAA,oBAAC,MAAA,EAAG,WAAU,6GACX,UAAA,OACH;AAAA,IAEC,YACC,oBAAC,KAAA,EAAE,WAAU,oFACV,UAAA,UACH;AAAA,KAGA,UAAU,SACV,qBAAC,OAAA,EAAI,WAAU,qEACZ,UAAA;AAAA,MAAA,UAAU,oBAAC,UAAM,UAAA,OAAA,CAAO;AAAA,MACxB,UAAU,QAAQ,oBAAC,QAAA,EAAK,WAAU,eAAc,UAAA,KAAC;AAAA,MACjD,QAAQ,oBAAC,QAAA,EAAM,UAAA,KAAA,CAAK;AAAA,IAAA,EAAA,CACvB;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
function SlideOutline({
|
|
3
|
-
children,
|
|
4
|
-
className,
|
|
5
|
-
size = "md"
|
|
6
|
-
}) {
|
|
7
|
-
const wClasses = {
|
|
8
|
-
sm: "max-w-lg",
|
|
9
|
-
md: "max-w-2xl",
|
|
10
|
-
lg: "max-w-5xl",
|
|
11
|
-
xl: "max-w-7xl",
|
|
12
|
-
full: "max-w-full"
|
|
13
|
-
};
|
|
14
|
-
const wClassName = `${wClasses[size]} ${className ?? ""}`;
|
|
15
|
-
const hClasses = {
|
|
16
|
-
sm: "min-h-[300px]",
|
|
17
|
-
md: "min-h-[400px]",
|
|
18
|
-
lg: "min-h-[500px]",
|
|
19
|
-
xl: "min-h-[600px]",
|
|
20
|
-
full: "min-h-[600px]"
|
|
21
|
-
};
|
|
22
|
-
const hClassName = `${hClasses[size]} ${className ?? ""}`;
|
|
23
|
-
return /* @__PURE__ */ jsx("div", { className: `border rounded relative left-1/2 -translate-x-1/2 w-screen ${wClassName} ${hClassName} ${className}`, children });
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
SlideOutline
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=slide-outline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slide-outline.js","sources":["../../../../src/components/slides/slide-outline.tsx"],"sourcesContent":["\n\nexport function SlideOutline({\n children,\n className,\n size=\"md\"\n}: {\n children?: React.ReactNode;\n className?: string;\n size?: \"sm\" | \"md\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\" | \"full\";\n}) {\n\n const wClasses: Record<string, string> = {\n sm: \"max-w-lg\",\n md: \"max-w-2xl\",\n lg: \"max-w-5xl\",\n xl: \"max-w-7xl\",\n full: \"max-w-full\",\n };\n\n const wClassName = `${wClasses[size]} ${className ?? \"\"}`;\n\n const hClasses: Record<string, string> = {\n sm: \"min-h-[300px]\",\n md: \"min-h-[400px]\",\n lg: \"min-h-[500px]\",\n xl: \"min-h-[600px]\",\n full: \"min-h-[600px]\",\n };\n\n const hClassName = `${hClasses[size]} ${className ?? \"\"}`;\n\n return (\n <div className={`border rounded relative left-1/2 -translate-x-1/2 w-screen ${wClassName} ${hClassName} ${className}`}>\n {children}\n </div>\n );\n}"],"names":[],"mappings":";AAEO,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,OAAK;AACP,GAIG;AAED,QAAM,WAAmC;AAAA,IACvC,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAGR,QAAM,aAAa,GAAG,SAAS,IAAI,CAAC,IAAI,aAAa,EAAE;AAEvD,QAAM,WAAmC;AAAA,IACvC,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,MAAM;AAAA,EAAA;AAGR,QAAM,aAAa,GAAG,SAAS,IAAI,CAAC,IAAI,aAAa,EAAE;AAEvD,SACE,oBAAC,OAAA,EAAI,WAAW,8DAA8D,UAAU,IAAI,UAAU,IAAI,SAAS,IAChH,SAAA,CACH;AAEJ;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
function TextSlide({
|
|
3
|
-
title,
|
|
4
|
-
subtitle,
|
|
5
|
-
children
|
|
6
|
-
}) {
|
|
7
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
8
|
-
(title || subtitle) && /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-2", children: [
|
|
9
|
-
title && /* @__PURE__ */ jsx("h2", { className: "text-[clamp(1.75rem,4vw,3rem)] font-semibold leading-tight tracking-[-0.02em] text-foreground", children: title }),
|
|
10
|
-
subtitle && /* @__PURE__ */ jsx("p", { className: "text-[clamp(0.95rem,1.5vw,1.25rem)] text-muted-foreground", children: subtitle })
|
|
11
|
-
] }),
|
|
12
|
-
children && /* @__PURE__ */ jsx("div", { className: "text-[clamp(1rem,1.8vw,1.35rem)] leading-[1.6] text-foreground/90 space-y-4 [&>ul]:space-y-2 [&>ul]:list-disc [&>ul]:pl-6 [&>ol]:space-y-2 [&>ol]:list-decimal [&>ol]:pl-6", children })
|
|
13
|
-
] });
|
|
14
|
-
}
|
|
15
|
-
export {
|
|
16
|
-
TextSlide
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=text-slide.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-slide.js","sources":["../../../../src/components/slides/text-slide.tsx"],"sourcesContent":["\nexport function TextSlide({\n title,\n subtitle,\n children,\n}: {\n title?: string;\n subtitle?: string;\n children?: React.ReactNode;\n}) {\n return (\n <div>\n {(title || subtitle) && (\n <header className=\"flex flex-col gap-2\">\n {title && (\n <h2 className=\"text-[clamp(1.75rem,4vw,3rem)] font-semibold leading-tight tracking-[-0.02em] text-foreground\">\n {title}\n </h2>\n )}\n {subtitle && (\n <p className=\"text-[clamp(0.95rem,1.5vw,1.25rem)] text-muted-foreground\">\n {subtitle}\n </p>\n )}\n </header>\n )}\n\n {children && (\n <div className=\"text-[clamp(1rem,1.8vw,1.35rem)] leading-[1.6] text-foreground/90 space-y-4 [&>ul]:space-y-2 [&>ul]:list-disc [&>ul]:pl-6 [&>ol]:space-y-2 [&>ol]:list-decimal [&>ol]:pl-6\">\n {children}\n </div>\n )}\n </div>\n );\n}\n"],"names":[],"mappings":";AACO,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AACF,GAIG;AACD,8BACG,OAAA,EACG,UAAA;AAAA,KAAA,SAAS,aACT,qBAAC,UAAA,EAAO,WAAU,uBACf,UAAA;AAAA,MAAA,SACC,oBAAC,MAAA,EAAG,WAAU,iGACX,UAAA,OACH;AAAA,MAED,YACC,oBAAC,KAAA,EAAE,WAAU,6DACV,UAAA,SAAA,CACH;AAAA,IAAA,GAEJ;AAAA,IAGD,YACC,oBAAC,OAAA,EAAI,WAAU,8KACZ,SAAA,CACH;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useFileContent } from "../plugin/src/client.js";
|
|
3
|
-
import { cn } from "../lib/utils.js";
|
|
4
|
-
import { FigureHeader } from "./gallery/components/figure-header.js";
|
|
5
|
-
import { FigureCaption } from "./gallery/components/figure-caption.js";
|
|
6
|
-
function VeslxCat({
|
|
7
|
-
path,
|
|
8
|
-
title,
|
|
9
|
-
subtitle,
|
|
10
|
-
caption,
|
|
11
|
-
captionLabel,
|
|
12
|
-
className
|
|
13
|
-
}) {
|
|
14
|
-
const { content, loading, error } = useFileContent(path);
|
|
15
|
-
const header = title || subtitle ? /* @__PURE__ */ jsx("div", { className: "mb-3", children: /* @__PURE__ */ jsx(FigureHeader, { title, subtitle }) }) : null;
|
|
16
|
-
const footer = caption || captionLabel ? /* @__PURE__ */ jsx(FigureCaption, { caption, label: captionLabel }) : null;
|
|
17
|
-
if (loading) {
|
|
18
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("not-prose my-6", className), children: [
|
|
19
|
-
header,
|
|
20
|
-
/* @__PURE__ */ jsx("pre", { className: "w-full overflow-x-auto p-4 text-xs bg-muted border border-border rounded-md font-mono", children: "loading…" }),
|
|
21
|
-
footer
|
|
22
|
-
] });
|
|
23
|
-
}
|
|
24
|
-
if (error) {
|
|
25
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("not-prose my-6", className), children: [
|
|
26
|
-
header,
|
|
27
|
-
/* @__PURE__ */ jsx("pre", { className: "w-full overflow-x-auto p-4 text-xs bg-destructive/5 border border-destructive/30 rounded-md font-mono text-destructive", children: error }),
|
|
28
|
-
footer
|
|
29
|
-
] });
|
|
30
|
-
}
|
|
31
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("not-prose my-6", className), children: [
|
|
32
|
-
header,
|
|
33
|
-
/* @__PURE__ */ jsx("pre", { className: "w-full overflow-x-auto p-4 text-xs bg-muted border border-border rounded-md font-mono", children: content ?? "" }),
|
|
34
|
-
footer
|
|
35
|
-
] });
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
VeslxCat
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=veslx-cat.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"veslx-cat.js","sources":["../../../src/components/veslx-cat.tsx"],"sourcesContent":["import { useFileContent } from \"../../plugin/src/client\";\nimport { cn } from \"@/lib/utils\";\nimport { FigureHeader } from \"@/components/gallery/components/figure-header\";\nimport { FigureCaption } from \"@/components/gallery/components/figure-caption\";\n\ninterface VeslxCatProps {\n /** Path to the file */\n path: string;\n /** Optional title */\n title?: string;\n /** Optional subtitle */\n subtitle?: string;\n /** Optional caption */\n caption?: string;\n /** Optional caption label */\n captionLabel?: string;\n /** Optional class override */\n className?: string;\n}\n\nexport function VeslxCat({\n path,\n title,\n subtitle,\n caption,\n captionLabel,\n className,\n}: VeslxCatProps) {\n const { content, loading, error } = useFileContent(path);\n\n const header = (title || subtitle) ? (\n <div className=\"mb-3\">\n <FigureHeader title={title} subtitle={subtitle} />\n </div>\n ) : null;\n const footer = (caption || captionLabel) ? (\n <FigureCaption caption={caption} label={captionLabel} />\n ) : null;\n\n if (loading) {\n return (\n <div className={cn(\"not-prose my-6\", className)}>\n {header}\n <pre className=\"w-full overflow-x-auto p-4 text-xs bg-muted border border-border rounded-md font-mono\">\n loading…\n </pre>\n {footer}\n </div>\n );\n }\n\n if (error) {\n return (\n <div className={cn(\"not-prose my-6\", className)}>\n {header}\n <pre className=\"w-full overflow-x-auto p-4 text-xs bg-destructive/5 border border-destructive/30 rounded-md font-mono text-destructive\">\n {error}\n </pre>\n {footer}\n </div>\n );\n }\n\n return (\n <div className={cn(\"not-prose my-6\", className)}>\n {header}\n <pre className=\"w-full overflow-x-auto p-4 text-xs bg-muted border border-border rounded-md font-mono\">\n {content ?? \"\"}\n </pre>\n {footer}\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;AAoBO,SAAS,SAAS;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAkB;AAChB,QAAM,EAAE,SAAS,SAAS,MAAA,IAAU,eAAe,IAAI;AAEvD,QAAM,SAAU,SAAS,WACvB,oBAAC,OAAA,EAAI,WAAU,QACb,UAAA,oBAAC,cAAA,EAAa,OAAc,SAAA,CAAoB,EAAA,CAClD,IACE;AACJ,QAAM,SAAU,WAAW,eACzB,oBAAC,iBAAc,SAAkB,OAAO,cAAc,IACpD;AAEJ,MAAI,SAAS;AACX,gCACG,OAAA,EAAI,WAAW,GAAG,kBAAkB,SAAS,GAC3C,UAAA;AAAA,MAAA;AAAA,MACD,oBAAC,OAAA,EAAI,WAAU,yFAAwF,UAAA,YAEvG;AAAA,MACC;AAAA,IAAA,GACH;AAAA,EAEJ;AAEA,MAAI,OAAO;AACT,gCACG,OAAA,EAAI,WAAW,GAAG,kBAAkB,SAAS,GAC3C,UAAA;AAAA,MAAA;AAAA,MACD,oBAAC,OAAA,EAAI,WAAU,0HACZ,UAAA,OACH;AAAA,MACC;AAAA,IAAA,GACH;AAAA,EAEJ;AAEA,8BACG,OAAA,EAAI,WAAW,GAAG,kBAAkB,SAAS,GAC3C,UAAA;AAAA,IAAA;AAAA,IACD,oBAAC,OAAA,EAAI,WAAU,yFACZ,qBAAW,IACd;AAAA,IACC;AAAA,EAAA,GACH;AAEJ;"}
|