markstream-angular 0.0.10 → 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 +23 -22
- package/dist/README.md +23 -22
- package/dist/fesm2022/markstream-angular.mjs +435 -241
- package/dist/fesm2022/markstream-angular.mjs.map +1 -1
- package/dist/index.css +7 -12
- package/dist/index.d.ts +100 -119
- package/package.json +7 -11
package/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# markstream-angular — Angular streaming Markdown renderer for AI chat
|
|
2
2
|
|
|
3
|
-
Angular 20+ standalone component for streaming Markdown: AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown states, long documents, Mermaid, KaTeX,
|
|
3
|
+
Angular 20+ standalone component for streaming Markdown: AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown states, long documents, Mermaid, KaTeX, streaming code blocks, D2, infographic blocks, custom HTML tags, and cross-framework playground parity.
|
|
4
|
+
|
|
5
|
+
The coordinated 2.0 family beta will use `markstream-angular@next`. Before installing, verify that `npm view markstream-angular@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-angular@next stream-diffs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Run this in an existing Angular 20+ application. Keep `@angular/core`, `@angular/common`, the compiler, and platform packages on the same Angular version line.
|
|
4
12
|
|
|
5
13
|
## When to use it
|
|
6
14
|
|
|
@@ -14,19 +22,18 @@ This package is currently alpha. Treat it as a streaming Markdown integration su
|
|
|
14
22
|
## Install
|
|
15
23
|
|
|
16
24
|
```bash
|
|
17
|
-
pnpm add markstream-angular
|
|
25
|
+
pnpm add markstream-angular
|
|
18
26
|
```
|
|
19
27
|
|
|
20
28
|
Optional peer dependencies:
|
|
21
29
|
|
|
22
|
-
- `stream-diffs`
|
|
23
|
-
- `stream-monaco` for Monaco-powered code blocks (automatic fallback when `stream-diffs` is absent)
|
|
30
|
+
- `stream-diffs` for enhanced / streaming code blocks
|
|
24
31
|
- `mermaid` for Mermaid diagrams
|
|
25
32
|
- `katex` for math rendering
|
|
26
33
|
- `@terrastruct/d2` for D2 diagrams
|
|
27
34
|
- `@antv/infographic` for infographic blocks
|
|
28
35
|
|
|
29
|
-
Install only the peers your output actually needs. Plain Markdown does not require Mermaid, KaTeX,
|
|
36
|
+
Install only the peers your output actually needs. Plain Markdown does not require Mermaid, KaTeX, stream-diffs enhanced code blocks, D2, or Infographic.
|
|
30
37
|
|
|
31
38
|
Example:
|
|
32
39
|
|
|
@@ -36,10 +43,9 @@ pnpm add stream-diffs mermaid katex @terrastruct/d2 @antv/infographic
|
|
|
36
43
|
|
|
37
44
|
## Enhanced Code Blocks
|
|
38
45
|
|
|
39
|
-
Code blocks use
|
|
46
|
+
Code blocks use `stream-diffs` for enhanced / streaming rendering, with a plain `<pre>` fallback when it is not installed. Inside `MarkstreamAngularComponent`, code blocks resolve to this runtime automatically; you can also mount the standalone `markstream-angular-code-block-node` component directly:
|
|
40
47
|
|
|
41
48
|
```ts
|
|
42
|
-
import type { CodeBlockMonacoOptions } from 'markstream-angular'
|
|
43
49
|
import { Component, signal } from '@angular/core'
|
|
44
50
|
import { CodeBlockNode } from 'markstream-angular'
|
|
45
51
|
|
|
@@ -59,26 +65,22 @@ class CodeBlockComponent {
|
|
|
59
65
|
raw: 'const answer = 42',
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
// fontSize / lineHeight / tabSize also drive the streaming <pre> fallback so
|
|
63
|
-
// the enhanced surface swaps in without a visual jump.
|
|
64
68
|
props = {
|
|
65
69
|
isDark: true,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
MAX_HEIGHT: 640,
|
|
76
|
-
} as CodeBlockMonacoOptions,
|
|
70
|
+
darkTheme: 'vitesse-dark',
|
|
71
|
+
lightTheme: 'vitesse-light',
|
|
72
|
+
themes: ['vitesse-dark', 'vitesse-light'],
|
|
73
|
+
codeBlockOptions: {
|
|
74
|
+
overflow: 'wrap',
|
|
75
|
+
diffStyle: 'unified',
|
|
76
|
+
enableLineSelection: true,
|
|
77
|
+
},
|
|
78
|
+
stream: true,
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
```
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
Direct component state goes through the `props` input. Both direct `CodeBlockNode` props and top-level `MarkstreamAngularComponent` props 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).
|
|
82
84
|
|
|
83
85
|
## Quick Start
|
|
84
86
|
|
|
@@ -126,7 +128,6 @@ bootstrapApplication(AppComponent)
|
|
|
126
128
|
```ts
|
|
127
129
|
import type {
|
|
128
130
|
AngularRenderContext,
|
|
129
|
-
CodeBlockMonacoOptions,
|
|
130
131
|
CustomComponentMap,
|
|
131
132
|
MarkstreamAngularComponentProps,
|
|
132
133
|
NodeRendererProps,
|
package/dist/README.md
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
# markstream-angular — Angular streaming Markdown renderer for AI chat
|
|
2
2
|
|
|
3
|
-
Angular 20+ standalone component for streaming Markdown: AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown states, long documents, Mermaid, KaTeX,
|
|
3
|
+
Angular 20+ standalone component for streaming Markdown: AI chat, LLM token streams, SSE/WebSocket output, incomplete Markdown states, long documents, Mermaid, KaTeX, streaming code blocks, D2, infographic blocks, custom HTML tags, and cross-framework playground parity.
|
|
4
|
+
|
|
5
|
+
The coordinated 2.0 family beta will use `markstream-angular@next`. Before installing, verify that `npm view markstream-angular@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-angular@next stream-diffs
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Run this in an existing Angular 20+ application. Keep `@angular/core`, `@angular/common`, the compiler, and platform packages on the same Angular version line.
|
|
4
12
|
|
|
5
13
|
## When to use it
|
|
6
14
|
|
|
@@ -14,19 +22,18 @@ This package is currently alpha. Treat it as a streaming Markdown integration su
|
|
|
14
22
|
## Install
|
|
15
23
|
|
|
16
24
|
```bash
|
|
17
|
-
pnpm add markstream-angular
|
|
25
|
+
pnpm add markstream-angular
|
|
18
26
|
```
|
|
19
27
|
|
|
20
28
|
Optional peer dependencies:
|
|
21
29
|
|
|
22
|
-
- `stream-diffs`
|
|
23
|
-
- `stream-monaco` for Monaco-powered code blocks (automatic fallback when `stream-diffs` is absent)
|
|
30
|
+
- `stream-diffs` for enhanced / streaming code blocks
|
|
24
31
|
- `mermaid` for Mermaid diagrams
|
|
25
32
|
- `katex` for math rendering
|
|
26
33
|
- `@terrastruct/d2` for D2 diagrams
|
|
27
34
|
- `@antv/infographic` for infographic blocks
|
|
28
35
|
|
|
29
|
-
Install only the peers your output actually needs. Plain Markdown does not require Mermaid, KaTeX,
|
|
36
|
+
Install only the peers your output actually needs. Plain Markdown does not require Mermaid, KaTeX, stream-diffs enhanced code blocks, D2, or Infographic.
|
|
30
37
|
|
|
31
38
|
Example:
|
|
32
39
|
|
|
@@ -36,10 +43,9 @@ pnpm add stream-diffs mermaid katex @terrastruct/d2 @antv/infographic
|
|
|
36
43
|
|
|
37
44
|
## Enhanced Code Blocks
|
|
38
45
|
|
|
39
|
-
Code blocks use
|
|
46
|
+
Code blocks use `stream-diffs` for enhanced / streaming rendering, with a plain `<pre>` fallback when it is not installed. Inside `MarkstreamAngularComponent`, code blocks resolve to this runtime automatically; you can also mount the standalone `markstream-angular-code-block-node` component directly:
|
|
40
47
|
|
|
41
48
|
```ts
|
|
42
|
-
import type { CodeBlockMonacoOptions } from 'markstream-angular'
|
|
43
49
|
import { Component, signal } from '@angular/core'
|
|
44
50
|
import { CodeBlockNode } from 'markstream-angular'
|
|
45
51
|
|
|
@@ -59,26 +65,22 @@ class CodeBlockComponent {
|
|
|
59
65
|
raw: 'const answer = 42',
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
// fontSize / lineHeight / tabSize also drive the streaming <pre> fallback so
|
|
63
|
-
// the enhanced surface swaps in without a visual jump.
|
|
64
68
|
props = {
|
|
65
69
|
isDark: true,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
MAX_HEIGHT: 640,
|
|
76
|
-
} as CodeBlockMonacoOptions,
|
|
70
|
+
darkTheme: 'vitesse-dark',
|
|
71
|
+
lightTheme: 'vitesse-light',
|
|
72
|
+
themes: ['vitesse-dark', 'vitesse-light'],
|
|
73
|
+
codeBlockOptions: {
|
|
74
|
+
overflow: 'wrap',
|
|
75
|
+
diffStyle: 'unified',
|
|
76
|
+
enableLineSelection: true,
|
|
77
|
+
},
|
|
78
|
+
stream: true,
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
```
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
Direct component state goes through the `props` input. Both direct `CodeBlockNode` props and top-level `MarkstreamAngularComponent` props 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).
|
|
82
84
|
|
|
83
85
|
## Quick Start
|
|
84
86
|
|
|
@@ -126,7 +128,6 @@ bootstrapApplication(AppComponent)
|
|
|
126
128
|
```ts
|
|
127
129
|
import type {
|
|
128
130
|
AngularRenderContext,
|
|
129
|
-
CodeBlockMonacoOptions,
|
|
130
131
|
CustomComponentMap,
|
|
131
132
|
MarkstreamAngularComponentProps,
|
|
132
133
|
NodeRendererProps,
|