@webmcp-auto-ui/ui 2.5.23 → 2.5.24
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webmcp-auto-ui/ui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.24",
|
|
4
4
|
"description": "Svelte 5 UI components — primitives, widgets, window manager",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -50,7 +50,9 @@
|
|
|
50
50
|
"@types/d3": "^7.4.3",
|
|
51
51
|
"bits-ui": "^2.17.2",
|
|
52
52
|
"clsx": "^2.1.1",
|
|
53
|
+
"highlight.js": "^11.10.0",
|
|
53
54
|
"html-to-image": "^1.11.13",
|
|
55
|
+
"marked": "^14.1.3",
|
|
54
56
|
"tailwind-merge": "^3.5.0",
|
|
55
57
|
"tailwind-variants": "^3.2.2"
|
|
56
58
|
}
|
package/src/index.ts
CHANGED
|
@@ -12,6 +12,9 @@ export { default as GridLayout } from './primitives/GridLayout.svelte';
|
|
|
12
12
|
export { default as List } from './primitives/List.svelte';
|
|
13
13
|
export { default as Panel } from './primitives/Panel.svelte';
|
|
14
14
|
export { default as Window } from './primitives/Window.svelte';
|
|
15
|
+
export { default as MarkdownView } from './primitives/MarkdownView.svelte';
|
|
16
|
+
export { default as CodeView } from './primitives/CodeView.svelte';
|
|
17
|
+
export { renderMarkdown, highlightCode, createMarkdownRenderer } from './primitives/markdown-renderer.js';
|
|
15
18
|
|
|
16
19
|
// Simple widgets (PJ blocks)
|
|
17
20
|
export { default as StatBlock } from './widgets/simple/StatBlock.svelte';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { highlightCode } from './markdown-renderer.js';
|
|
3
|
+
import 'highlight.js/styles/github-dark.css';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
source: string;
|
|
7
|
+
lang?: string;
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { source, lang = 'plaintext', class: className = '' }: Props = $props();
|
|
12
|
+
const highlighted = $derived(highlightCode(source ?? '', lang));
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<pre class="code-view hljs-pre {className}"><code class="hljs language-{lang}">{@html highlighted}</code></pre>
|
|
16
|
+
|
|
17
|
+
<style>
|
|
18
|
+
pre.code-view {
|
|
19
|
+
background: #0d1117;
|
|
20
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
21
|
+
border-radius: 0.375rem;
|
|
22
|
+
padding: 0;
|
|
23
|
+
margin: 0;
|
|
24
|
+
overflow-x: auto;
|
|
25
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
26
|
+
font-size: 0.7rem;
|
|
27
|
+
line-height: 1.5;
|
|
28
|
+
}
|
|
29
|
+
pre.code-view :global(code.hljs) {
|
|
30
|
+
display: block;
|
|
31
|
+
padding: 0.7rem;
|
|
32
|
+
background: transparent;
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { renderMarkdown } from './markdown-renderer.js';
|
|
3
|
+
import 'highlight.js/styles/github-dark.css';
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
source: string;
|
|
7
|
+
class?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let { source, class: className = '' }: Props = $props();
|
|
11
|
+
const html = $derived(renderMarkdown(source ?? ''));
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<div class="markdown-body {className}">
|
|
15
|
+
{@html html}
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
.markdown-body :global(h1),
|
|
20
|
+
.markdown-body :global(h2),
|
|
21
|
+
.markdown-body :global(h3),
|
|
22
|
+
.markdown-body :global(h4) {
|
|
23
|
+
font-weight: 600;
|
|
24
|
+
margin-top: 0.75rem;
|
|
25
|
+
margin-bottom: 0.4rem;
|
|
26
|
+
color: inherit;
|
|
27
|
+
}
|
|
28
|
+
.markdown-body :global(h1) { font-size: 1.05rem; }
|
|
29
|
+
.markdown-body :global(h2) { font-size: 0.95rem; }
|
|
30
|
+
.markdown-body :global(h3) { font-size: 0.85rem; }
|
|
31
|
+
.markdown-body :global(h4) { font-size: 0.8rem; }
|
|
32
|
+
.markdown-body :global(p) {
|
|
33
|
+
margin: 0.4rem 0;
|
|
34
|
+
line-height: 1.55;
|
|
35
|
+
font-size: 0.78rem;
|
|
36
|
+
}
|
|
37
|
+
.markdown-body :global(ul),
|
|
38
|
+
.markdown-body :global(ol) {
|
|
39
|
+
margin: 0.4rem 0;
|
|
40
|
+
padding-left: 1.4rem;
|
|
41
|
+
font-size: 0.78rem;
|
|
42
|
+
line-height: 1.55;
|
|
43
|
+
}
|
|
44
|
+
.markdown-body :global(li) { margin: 0.2rem 0; }
|
|
45
|
+
.markdown-body :global(code) {
|
|
46
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
47
|
+
font-size: 0.72rem;
|
|
48
|
+
background: rgba(0, 0, 0, 0.25);
|
|
49
|
+
padding: 0.08rem 0.3rem;
|
|
50
|
+
border-radius: 0.2rem;
|
|
51
|
+
}
|
|
52
|
+
.markdown-body :global(pre.hljs-pre) {
|
|
53
|
+
background: #0d1117;
|
|
54
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
55
|
+
border-radius: 0.375rem;
|
|
56
|
+
padding: 0.7rem;
|
|
57
|
+
margin: 0.5rem 0;
|
|
58
|
+
overflow-x: auto;
|
|
59
|
+
}
|
|
60
|
+
.markdown-body :global(pre.hljs-pre code) {
|
|
61
|
+
background: transparent;
|
|
62
|
+
padding: 0;
|
|
63
|
+
font-size: 0.7rem;
|
|
64
|
+
line-height: 1.5;
|
|
65
|
+
}
|
|
66
|
+
.markdown-body :global(a) {
|
|
67
|
+
color: rgb(96, 165, 250);
|
|
68
|
+
text-decoration: underline;
|
|
69
|
+
}
|
|
70
|
+
.markdown-body :global(strong) { font-weight: 600; }
|
|
71
|
+
.markdown-body :global(em) { font-style: italic; }
|
|
72
|
+
.markdown-body :global(blockquote) {
|
|
73
|
+
border-left: 3px solid rgba(255, 255, 255, 0.15);
|
|
74
|
+
padding-left: 0.7rem;
|
|
75
|
+
margin: 0.5rem 0;
|
|
76
|
+
color: rgba(255, 255, 255, 0.7);
|
|
77
|
+
}
|
|
78
|
+
.markdown-body :global(table) {
|
|
79
|
+
border-collapse: collapse;
|
|
80
|
+
margin: 0.5rem 0;
|
|
81
|
+
font-size: 0.72rem;
|
|
82
|
+
}
|
|
83
|
+
.markdown-body :global(th),
|
|
84
|
+
.markdown-body :global(td) {
|
|
85
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
86
|
+
padding: 0.3rem 0.55rem;
|
|
87
|
+
}
|
|
88
|
+
.markdown-body :global(th) {
|
|
89
|
+
background: rgba(255, 255, 255, 0.04);
|
|
90
|
+
font-weight: 600;
|
|
91
|
+
}
|
|
92
|
+
.markdown-body :global(hr) {
|
|
93
|
+
border: none;
|
|
94
|
+
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
|
95
|
+
margin: 1rem 0;
|
|
96
|
+
}
|
|
97
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { marked, Renderer, type Tokens } from 'marked';
|
|
2
|
+
import hljs from 'highlight.js';
|
|
3
|
+
|
|
4
|
+
export function createMarkdownRenderer(): Renderer {
|
|
5
|
+
const renderer = new Renderer();
|
|
6
|
+
renderer.code = function (this: Renderer, { text, lang }: Tokens.Code): string {
|
|
7
|
+
const language = lang && hljs.getLanguage(lang) ? lang : 'plaintext';
|
|
8
|
+
const highlighted = hljs.highlight(text, { language, ignoreIllegals: true }).value;
|
|
9
|
+
return `<pre class="hljs-pre"><code class="hljs language-${language}">${highlighted}</code></pre>`;
|
|
10
|
+
};
|
|
11
|
+
return renderer;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const defaultRenderer = createMarkdownRenderer();
|
|
15
|
+
marked.use({ renderer: defaultRenderer, gfm: true, breaks: false });
|
|
16
|
+
|
|
17
|
+
export function renderMarkdown(source: string): string {
|
|
18
|
+
return marked.parse(source ?? '', { async: false }) as string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function highlightCode(source: string, lang: string = 'plaintext'): string {
|
|
22
|
+
const language = lang && hljs.getLanguage(lang) ? lang : 'plaintext';
|
|
23
|
+
return hljs.highlight(source ?? '', { language, ignoreIllegals: true }).value;
|
|
24
|
+
}
|