markstream-vue2 0.0.53 → 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 +27 -24
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +679 -2006
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/dist/types/components/CodeBlockNode/CodeBlockNode.vue.d.ts +38 -19
- package/dist/types/components/CodeBlockNode/streamDiffs.d.ts +9 -0
- package/dist/types/components/MarkdownRenderCompat.vue.d.ts +11 -14
- package/dist/types/components/NodeRenderer/CodeBlockNodeLoading.vue.d.ts +0 -9
- package/dist/types/components/NodeRenderer/LegacyNodesRenderer.vue.d.ts +9 -20
- package/dist/types/components/NodeRenderer/NodeRenderer.vue.d.ts +10 -20
- package/dist/types/composables/useSingletonTooltip.d.ts +1 -1
- package/dist/types/exports.d.ts +2 -3
- package/dist/types/types/component-props.d.ts +59 -69
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/languageIcon.d.ts +1 -1
- package/package.json +7 -15
- package/dist/chunks/andromeeda-0e066d27.js +0 -4
- package/dist/chunks/andromeeda-beebe2f9.cjs +0 -1
- package/dist/chunks/aurora-x-7d279c8e.cjs +0 -1
- package/dist/chunks/aurora-x-e4f2fe1b.js +0 -4
- package/dist/chunks/ayu-dark-349c357c.js +0 -4
- package/dist/chunks/ayu-dark-5e86208e.cjs +0 -1
- package/dist/chunks/ayu-light-18928686.cjs +0 -1
- package/dist/chunks/ayu-light-bfc150f8.js +0 -4
- package/dist/chunks/ayu-mirage-3383fcd0.js +0 -4
- package/dist/chunks/ayu-mirage-3af5c477.cjs +0 -1
- package/dist/chunks/catppuccin-frappe-32dd8ebe.js +0 -4
- package/dist/chunks/catppuccin-frappe-5990e1cc.cjs +0 -1
- package/dist/chunks/catppuccin-latte-7dd9ec26.cjs +0 -1
- package/dist/chunks/catppuccin-latte-842c8be1.js +0 -4
- package/dist/chunks/catppuccin-macchiato-0c355ced.js +0 -4
- package/dist/chunks/catppuccin-macchiato-12297a0c.cjs +0 -1
- package/dist/chunks/catppuccin-mocha-164bffb5.cjs +0 -1
- package/dist/chunks/catppuccin-mocha-840be6a5.js +0 -4
- package/dist/chunks/dark-plus-37515867.cjs +0 -1
- package/dist/chunks/dark-plus-51ee0d5e.js +0 -4
- package/dist/chunks/dracula-6e5c19a8.js +0 -4
- package/dist/chunks/dracula-ad0b94e0.cjs +0 -1
- package/dist/chunks/dracula-soft-223c44b5.cjs +0 -1
- package/dist/chunks/dracula-soft-744d21b1.js +0 -4
- package/dist/chunks/everforest-dark-3a566062.js +0 -4
- package/dist/chunks/everforest-dark-630f597e.cjs +0 -1
- package/dist/chunks/everforest-light-92583419.js +0 -4
- package/dist/chunks/everforest-light-ba8af69c.cjs +0 -1
- package/dist/chunks/github-dark-44cb1819.cjs +0 -1
- package/dist/chunks/github-dark-cb4e8bb4.js +0 -4
- package/dist/chunks/github-dark-default-d50179ae.js +0 -4
- package/dist/chunks/github-dark-default-f99477eb.cjs +0 -1
- package/dist/chunks/github-dark-dimmed-96ccf893.cjs +0 -1
- package/dist/chunks/github-dark-dimmed-ebbb9420.js +0 -4
- package/dist/chunks/github-dark-high-contrast-5cc08661.js +0 -4
- package/dist/chunks/github-dark-high-contrast-adcd4e61.cjs +0 -1
- package/dist/chunks/github-light-42f759a4.cjs +0 -1
- package/dist/chunks/github-light-555bd325.js +0 -4
- package/dist/chunks/github-light-default-50fa37cd.cjs +0 -1
- package/dist/chunks/github-light-default-9c006cf6.js +0 -4
- package/dist/chunks/github-light-high-contrast-15a9bb5a.cjs +0 -1
- package/dist/chunks/github-light-high-contrast-ffa0564e.js +0 -4
- package/dist/chunks/gruvbox-dark-hard-4412389e.js +0 -4
- package/dist/chunks/gruvbox-dark-hard-cc007dcd.cjs +0 -1
- package/dist/chunks/gruvbox-dark-medium-415e09f2.cjs +0 -1
- package/dist/chunks/gruvbox-dark-medium-fa0eeef7.js +0 -4
- package/dist/chunks/gruvbox-dark-soft-3125d894.cjs +0 -1
- package/dist/chunks/gruvbox-dark-soft-a4600b2a.js +0 -4
- package/dist/chunks/gruvbox-light-hard-4c8c0395.cjs +0 -1
- package/dist/chunks/gruvbox-light-hard-8e736562.js +0 -4
- package/dist/chunks/gruvbox-light-medium-0c0cbf5d.js +0 -4
- package/dist/chunks/gruvbox-light-medium-abf52b0c.cjs +0 -1
- package/dist/chunks/gruvbox-light-soft-0e7ed903.cjs +0 -1
- package/dist/chunks/gruvbox-light-soft-a35d50d0.js +0 -4
- package/dist/chunks/horizon-31da8ee5.js +0 -4
- package/dist/chunks/horizon-bright-bb8b03f8.js +0 -4
- package/dist/chunks/horizon-bright-d2ea0b12.cjs +0 -1
- package/dist/chunks/horizon-f8b833c3.cjs +0 -1
- package/dist/chunks/houston-20eb8cbf.cjs +0 -1
- package/dist/chunks/houston-d3d3c60d.js +0 -4
- package/dist/chunks/index-42602bc0.js +0 -18739
- package/dist/chunks/index-b485917b.cjs +0 -1
- package/dist/chunks/index-c958c796.cjs +0 -1
- package/dist/chunks/index-fce73667.js +0 -1702
- package/dist/chunks/kanagawa-dragon-0246ed94.cjs +0 -1
- package/dist/chunks/kanagawa-dragon-324edcdc.js +0 -4
- package/dist/chunks/kanagawa-lotus-61838bd3.cjs +0 -1
- package/dist/chunks/kanagawa-lotus-a847832a.js +0 -4
- package/dist/chunks/kanagawa-wave-2b426416.cjs +0 -1
- package/dist/chunks/kanagawa-wave-7b8409ec.js +0 -4
- package/dist/chunks/laserwave-538ee8e3.js +0 -4
- package/dist/chunks/laserwave-d5e6cfa6.cjs +0 -1
- package/dist/chunks/light-plus-471df294.cjs +0 -1
- package/dist/chunks/light-plus-a0703fa7.js +0 -4
- package/dist/chunks/material-theme-686d9ffc.js +0 -4
- package/dist/chunks/material-theme-9d859633.cjs +0 -1
- package/dist/chunks/material-theme-darker-cac9360e.js +0 -4
- package/dist/chunks/material-theme-darker-fe8dd38a.cjs +0 -1
- package/dist/chunks/material-theme-lighter-03523bbb.js +0 -4
- package/dist/chunks/material-theme-lighter-879be29a.cjs +0 -1
- package/dist/chunks/material-theme-ocean-37052f40.js +0 -4
- package/dist/chunks/material-theme-ocean-c1caeaa4.cjs +0 -1
- package/dist/chunks/material-theme-palenight-70bbf617.js +0 -4
- package/dist/chunks/material-theme-palenight-ef8b2399.cjs +0 -1
- package/dist/chunks/min-dark-0baaa2b0.cjs +0 -1
- package/dist/chunks/min-dark-16b503e6.js +0 -4
- package/dist/chunks/min-light-0c4ea4ec.js +0 -4
- package/dist/chunks/min-light-f65395e0.cjs +0 -1
- package/dist/chunks/monokai-32171550.js +0 -4
- package/dist/chunks/monokai-b9c22257.cjs +0 -1
- package/dist/chunks/night-owl-5eeb6e45.cjs +0 -1
- package/dist/chunks/night-owl-cb71e64c.js +0 -4
- package/dist/chunks/night-owl-light-3b4be46f.js +0 -4
- package/dist/chunks/night-owl-light-f04fad9f.cjs +0 -1
- package/dist/chunks/nord-0b42b6b4.cjs +0 -1
- package/dist/chunks/nord-b2f653cd.js +0 -4
- package/dist/chunks/one-dark-pro-611d46bc.js +0 -4
- package/dist/chunks/one-dark-pro-6ac63500.cjs +0 -1
- package/dist/chunks/one-light-2f27f0f0.cjs +0 -1
- package/dist/chunks/one-light-f2b411cc.js +0 -4
- package/dist/chunks/pierre-dark-9c2ca7e3.cjs +0 -1
- package/dist/chunks/pierre-dark-f4c18c96.js +0 -4
- package/dist/chunks/pierre-dark-protanopia-deuteranopia-31face57.js +0 -4
- package/dist/chunks/pierre-dark-protanopia-deuteranopia-67028f58.cjs +0 -1
- package/dist/chunks/pierre-dark-soft-3103370a.js +0 -4
- package/dist/chunks/pierre-dark-soft-59e1d5bc.cjs +0 -1
- package/dist/chunks/pierre-dark-tritanopia-b2966d75.js +0 -4
- package/dist/chunks/pierre-dark-tritanopia-d87f3323.cjs +0 -1
- package/dist/chunks/pierre-dark-vibrant-4de6032d.js +0 -4
- package/dist/chunks/pierre-dark-vibrant-f4553619.cjs +0 -1
- package/dist/chunks/pierre-light-45d08543.js +0 -4
- package/dist/chunks/pierre-light-ae152c30.cjs +0 -1
- package/dist/chunks/pierre-light-protanopia-deuteranopia-78f5453c.cjs +0 -1
- package/dist/chunks/pierre-light-protanopia-deuteranopia-816a3304.js +0 -4
- package/dist/chunks/pierre-light-soft-2a7b83ed.cjs +0 -1
- package/dist/chunks/pierre-light-soft-9c96aa07.js +0 -4
- package/dist/chunks/pierre-light-tritanopia-22534644.cjs +0 -1
- package/dist/chunks/pierre-light-tritanopia-b49f3566.js +0 -4
- package/dist/chunks/pierre-light-vibrant-178f2e13.cjs +0 -1
- package/dist/chunks/pierre-light-vibrant-1d779afc.js +0 -4
- package/dist/chunks/plastic-050a5288.js +0 -4
- package/dist/chunks/plastic-ab5115cb.cjs +0 -1
- package/dist/chunks/poimandres-9b9bffc0.cjs +0 -1
- package/dist/chunks/poimandres-e7807ea4.js +0 -4
- package/dist/chunks/red-58c74b50.cjs +0 -1
- package/dist/chunks/red-8b5bb9fd.js +0 -4
- package/dist/chunks/rose-pine-dawn-c54a297c.js +0 -4
- package/dist/chunks/rose-pine-dawn-dcd06a2d.cjs +0 -1
- package/dist/chunks/rose-pine-e3dfc7b6.js +0 -4
- package/dist/chunks/rose-pine-e443c3f3.cjs +0 -1
- package/dist/chunks/rose-pine-moon-c4ae0bee.cjs +0 -1
- package/dist/chunks/rose-pine-moon-ff747b44.js +0 -4
- package/dist/chunks/slack-dark-119fdcba.cjs +0 -1
- package/dist/chunks/slack-dark-cba39ccf.js +0 -4
- package/dist/chunks/slack-ochin-4a97383e.js +0 -4
- package/dist/chunks/slack-ochin-e53abb89.cjs +0 -1
- package/dist/chunks/snazzy-light-863adb77.js +0 -4
- package/dist/chunks/snazzy-light-aacd1ca8.cjs +0 -1
- package/dist/chunks/solarized-dark-18286b81.js +0 -4
- package/dist/chunks/solarized-dark-6c53ecf9.cjs +0 -1
- package/dist/chunks/solarized-light-abef5a54.cjs +0 -1
- package/dist/chunks/solarized-light-e7adfa5b.js +0 -4
- package/dist/chunks/synthwave-84-26ebbfca.js +0 -4
- package/dist/chunks/synthwave-84-ddb2c535.cjs +0 -1
- package/dist/chunks/tokyo-night-25368f86.js +0 -4
- package/dist/chunks/tokyo-night-6e0b49fd.cjs +0 -1
- package/dist/chunks/vesper-0ba44279.js +0 -4
- package/dist/chunks/vesper-a2e0b586.cjs +0 -1
- package/dist/chunks/vitesse-black-2be67ba4.cjs +0 -1
- package/dist/chunks/vitesse-black-33005deb.js +0 -4
- package/dist/chunks/vitesse-dark-82a14fc3.cjs +0 -1
- package/dist/chunks/vitesse-dark-9bb81e7a.js +0 -4
- package/dist/chunks/vitesse-light-2f9f7ba9.js +0 -4
- package/dist/chunks/vitesse-light-ee2c704b.cjs +0 -1
- package/dist/chunks/wasm-4cd10f60.cjs +0 -1
- package/dist/chunks/wasm-cb55701e.js +0 -30
- package/dist/types/components/CodeBlockNode/monaco.d.ts +0 -1
- package/dist/types/components/CodeBlockNode/monacoThemeScheduler.d.ts +0 -3
- package/dist/types/components/MarkdownCodeBlockNode/MarkdownCodeBlockNode.vue.d.ts +0 -233
- package/dist/types/components/MarkdownCodeBlockNode/index.d.ts +0 -2
- /package/dist/types/components/NodeRenderer/{preloadMonaco.d.ts → preloadStreamDiffs.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -7,6 +7,16 @@ Vue 2.6 / 2.7 compatibility renderer for legacy Vue 2 apps that need streaming M
|
|
|
7
7
|
|
|
8
8
|
For Vue 3 or new Vue/Nuxt projects, use `markstream-vue` instead.
|
|
9
9
|
|
|
10
|
+
The coordinated 2.0 family beta will use `markstream-vue2@next`. Before installing, verify that `npm view markstream-vue2@next version` reports `0.1.0-beta.1`. It removes the Monaco and Shiki code-block APIs in favor of `stream-diffs`; read the [coordinated 2.0 family migration guide](https://markstream.simonhe.me/guide/migration-2-0) before upgrading.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Vue 2.7
|
|
14
|
+
pnpm add markstream-vue2@next stream-diffs
|
|
15
|
+
|
|
16
|
+
# Vue 2.6 (also register the plugin with Vue.use)
|
|
17
|
+
pnpm add markstream-vue2@next stream-diffs @vue/composition-api
|
|
18
|
+
```
|
|
19
|
+
|
|
10
20
|
## Install
|
|
11
21
|
|
|
12
22
|
```bash
|
|
@@ -149,7 +159,7 @@ new Vue({
|
|
|
149
159
|
|
|
150
160
|
- For simple chat streaming, passing `content` is the fastest way to integrate.
|
|
151
161
|
- For high-frequency SSE / token streaming, long conversations, or very large code/table/math blocks, prefer parsing outside the renderer and pass `nodes` instead of reparsing the whole `content` string every chunk.
|
|
152
|
-
- Keep `viewport-priority` enabled unless you explicitly want eager rendering. Mermaid /
|
|
162
|
+
- Keep `viewport-priority` enabled unless you explicitly want eager rendering. Mermaid / stream-diffs / D2 blocks now stay idle while offscreen and resume when they approach the viewport.
|
|
153
163
|
|
|
154
164
|
```vue
|
|
155
165
|
<template>
|
|
@@ -187,24 +197,28 @@ Notes:
|
|
|
187
197
|
|
|
188
198
|
## Enhanced Code Blocks
|
|
189
199
|
|
|
190
|
-
|
|
200
|
+
`stream-diffs` powers enhanced code blocks across all Markstream packages (smaller runtime, no `monaco-editor`); a plain `<pre>` is rendered when it is not installed.
|
|
191
201
|
|
|
192
|
-
Install the
|
|
202
|
+
Install the runtime:
|
|
193
203
|
|
|
194
204
|
```bash
|
|
195
205
|
pnpm add stream-diffs
|
|
196
|
-
# or, to keep the legacy Monaco surface as the fallback:
|
|
197
|
-
pnpm add stream-monaco
|
|
198
206
|
```
|
|
199
207
|
|
|
200
208
|
`CodeBlockNode` renders a single code block with the header, toolbar, and a `stream-diffs` File / FileDiff surface:
|
|
201
209
|
|
|
202
210
|
```vue
|
|
203
211
|
<script lang="ts">
|
|
204
|
-
import type {
|
|
212
|
+
import type { CodeBlockOptions } from 'markstream-vue2'
|
|
205
213
|
import { CodeBlockNode } from 'markstream-vue2'
|
|
206
214
|
import Vue from 'vue'
|
|
207
215
|
|
|
216
|
+
const codeBlockOptions: CodeBlockOptions = {
|
|
217
|
+
overflow: 'wrap',
|
|
218
|
+
diffStyle: 'unified',
|
|
219
|
+
enableLineSelection: true,
|
|
220
|
+
}
|
|
221
|
+
|
|
208
222
|
export default Vue.extend({
|
|
209
223
|
components: { CodeBlockNode },
|
|
210
224
|
data() {
|
|
@@ -215,29 +229,18 @@ export default Vue.extend({
|
|
|
215
229
|
code: 'const answer = 42',
|
|
216
230
|
raw: 'const answer = 42',
|
|
217
231
|
},
|
|
218
|
-
|
|
219
|
-
// so the enhanced surface swaps in without a visual jump.
|
|
220
|
-
monacoOptions: {
|
|
221
|
-
fontSize: 14,
|
|
222
|
-
lineHeight: 21,
|
|
223
|
-
tabSize: 4,
|
|
224
|
-
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace',
|
|
225
|
-
wordWrap: 'off',
|
|
226
|
-
theme: 'vitesse-dark',
|
|
227
|
-
renderSideBySide: true,
|
|
228
|
-
MAX_HEIGHT: 640,
|
|
229
|
-
} as CodeBlockMonacoOptions,
|
|
232
|
+
codeBlockOptions,
|
|
230
233
|
}
|
|
231
234
|
},
|
|
232
235
|
})
|
|
233
236
|
</script>
|
|
234
237
|
|
|
235
238
|
<template>
|
|
236
|
-
<CodeBlockNode :node="node" :
|
|
239
|
+
<CodeBlockNode :node="node" :code-block-options="codeBlockOptions" is-dark show-header />
|
|
237
240
|
</template>
|
|
238
241
|
```
|
|
239
242
|
|
|
240
|
-
|
|
243
|
+
Direct `CodeBlockNode` and top-level `MarkdownRender` both accept `code-block-options`. The shared `CodeBlockOptions` type covers host-managed typography/layout plus supported File/FileDiff, interaction, annotation, and callback fields; `maxHeight` and the single symmetric `padding` value use numeric CSS pixels. Use `code-block-props` 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). Vue 2.6 apps need `@vue/composition-api`; see the Webpack 4 notes above if you use Vue CLI 4.
|
|
241
244
|
|
|
242
245
|
## Language-specific code block overrides
|
|
243
246
|
|
|
@@ -380,15 +383,15 @@ module.exports = {
|
|
|
380
383
|
|
|
381
384
|
## Notes
|
|
382
385
|
|
|
383
|
-
- The Vue 2 package is a compatibility port for legacy Vue 2 apps and mirrors the Vue 3 renderer feature set where practical (virtualization, streaming code blocks,
|
|
384
|
-
- Optional peers are still required for those features (`stream-diffs` for
|
|
386
|
+
- The Vue 2 package is a compatibility port for legacy Vue 2 apps and mirrors the Vue 3 renderer feature set where practical (virtualization, streaming code blocks, stream-diffs, Mermaid, KaTeX, tooltip singleton).
|
|
387
|
+
- Optional peers are still required for those features (`stream-diffs` for enhanced code blocks, `mermaid`, `katex`, etc.).
|
|
385
388
|
- Custom node components are supported via `setCustomComponents` from `markstream-vue2`.
|
|
386
389
|
- If you only render short static Markdown, a smaller Vue 2 Markdown component may be a simpler fit.
|
|
387
390
|
|
|
388
391
|
## TypeScript
|
|
389
392
|
|
|
390
|
-
Parser node types are re-exported from `stream-markdown-parser`, and Vue 2 specific mapping
|
|
393
|
+
Parser node types are re-exported from `stream-markdown-parser`, and Vue 2 specific mapping types are available from `markstream-vue2` itself:
|
|
391
394
|
|
|
392
395
|
```ts
|
|
393
|
-
import type {
|
|
396
|
+
import type { CustomComponents, ParsedNode } from 'markstream-vue2'
|
|
394
397
|
```
|