markstream-svelte 0.0.5 → 0.1.0-beta.2

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 CHANGED
@@ -1,6 +1,12 @@
1
1
  # markstream-svelte
2
2
 
3
- Svelte 5 streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown states, long documents, custom components, Mermaid, KaTeX, Monaco, D2, and Infographic.
3
+ Svelte 5 streaming Markdown renderer for AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown states, long documents, custom components, Mermaid, KaTeX, stream-diffs code blocks, D2, and Infographic.
4
+
5
+ The coordinated 2.0 family beta will use `markstream-svelte@next`. Before installing, verify that `npm view markstream-svelte@next version` reports `0.1.0-beta.1`. It removes the former Monaco code-block API in favor of `stream-diffs`; read the [coordinated 2.0 family migration guide](https://markstream.simonhe.me/guide/migration-2-0) before upgrading.
6
+
7
+ ```bash
8
+ pnpm add markstream-svelte@next svelte@^5 stream-diffs
9
+ ```
4
10
 
5
11
  ## When to use it
6
12
 
@@ -31,8 +37,6 @@ pnpm add katex mermaid stream-diffs @terrastruct/d2 @antv/infographic
31
37
  ```
32
38
 
33
39
  `stream-diffs` powers the enhanced code blocks (smaller runtime, no `monaco-editor`).
34
- If you prefer the legacy Monaco-based rendering, install `stream-monaco` instead;
35
- it is used automatically as a fallback when `stream-diffs` is absent.
36
40
 
37
41
  ## Enhanced Code Blocks
38
42
 
@@ -40,8 +44,8 @@ it is used automatically as a fallback when `stream-diffs` is absent.
40
44
 
41
45
  ```svelte
42
46
  <script lang="ts">
47
+ import type { CodeBlockOptions } from 'markstream-svelte'
43
48
  import { CodeBlockNode } from 'markstream-svelte'
44
- import type { CodeBlockMonacoOptions } from 'markstream-svelte'
45
49
 
46
50
  const node = {
47
51
  type: 'code_block',
@@ -50,24 +54,17 @@ it is used automatically as a fallback when `stream-diffs` is absent.
50
54
  raw: 'const answer = 42',
51
55
  }
52
56
 
53
- // fontSize / lineHeight / tabSize also drive the streaming <pre> fallback so
54
- // the enhanced surface swaps in without a visual jump.
55
- const monacoOptions: CodeBlockMonacoOptions = {
56
- fontSize: 14,
57
- lineHeight: 21,
58
- tabSize: 4,
59
- fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',
60
- wordWrap: 'off',
61
- theme: 'vitesse-dark',
62
- renderSideBySide: true,
63
- MAX_HEIGHT: 640,
57
+ const codeBlockOptions: CodeBlockOptions = {
58
+ overflow: 'wrap',
59
+ diffStyle: 'unified',
60
+ enableLineSelection: true,
64
61
  }
65
62
  </script>
66
63
 
67
- <CodeBlockNode {node} {monacoOptions} isDark showLineNumbers />
64
+ <CodeBlockNode {node} {codeBlockOptions} isDark showHeader />
68
65
  ```
69
66
 
70
- Component-level options: `isDark`, `showLineNumbers` (default `true`), and `monacoOptions` for both single blocks and diff blocks (`renderSideBySide`, `diffHunkActionsOnHover`, `onDiffHunkAction`). When neither `stream-diffs` nor `stream-monaco` is installed, the block renders as a plain `<pre>`.
67
+ Direct `CodeBlockNode` and top-level `MarkdownRender` both accept `codeBlockOptions`. It covers host-managed typography/layout and supported File/FileDiff, interaction, annotation, and callback fields; `maxHeight` and the single symmetric `padding` value use numeric CSS pixels. Use `codeBlockProps` for header/toolbar controls. Theme values are registered names and `themes` is the `[dark, light]` pair. An old Monaco JSON theme is not accepted directly: first convert it to a Shiki `ThemeRegistration`, then call `registerCustomTheme(name, loader)` from `stream-diffs/pierre`; see the [coordinated 2.0 family migration guide](https://markstream.simonhe.me/guide/migration-2-0). When `stream-diffs` is not installed, the block renders as a plain `<pre>`.
71
68
 
72
69
  ## Basic Usage
73
70