vue-stream-markdown 0.2.3 → 0.3.1

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.
Files changed (60) hide show
  1. package/README.md +1 -1
  2. package/dist/{blockquote-Crr-D7fY.js → blockquote-ClgbyGJ2.js} +2 -2
  3. package/dist/button-BKN2jNlv.js +6 -0
  4. package/dist/{button-DVWlhfQ9.js → button-BVOWJPmC.js} +2 -2
  5. package/dist/{code-Bz8LM16H.js → code-DG1O8Nim.js} +10 -10
  6. package/dist/code-block-C3VwzdZn.js +10 -0
  7. package/dist/{code-block-CmUZxKNr.js → code-block-wjjUUcJZ.js} +22 -11
  8. package/dist/composables-CcP6Ysj8.js +10954 -0
  9. package/dist/{delete-DFoiOzHW.js → delete-C9W-KhtX.js} +2 -2
  10. package/dist/dropdown-ByLAwToD.js +6 -0
  11. package/dist/{emphasis-DvaBuxeK.js → emphasis-DiWz4428.js} +2 -2
  12. package/dist/error-component-Bhq210EM.js +5 -0
  13. package/dist/{error-component-BTe-SuY7.js → error-component-BrESW9p1.js} +2 -2
  14. package/dist/{footnote-definition-ByWh1N3S.js → footnote-definition-lObKczNc.js} +5 -5
  15. package/dist/{footnote-reference-BJ4J7BFo.js → footnote-reference-D4hG5a5R.js} +1 -1
  16. package/dist/{heading-1fssqGGO.js → heading-CV3_yOWw.js} +2 -2
  17. package/dist/{icon-DcLTFhFW.js → icon-CRNiOEiK.js} +1 -1
  18. package/dist/icon-CVg4xQw0.js +4 -0
  19. package/dist/image-C9bwOpvz.js +9 -0
  20. package/dist/{image-xPrAKT9D.js → image-CRAZ3iRD.js} +17 -12
  21. package/dist/{image-DXnmoID_.js → image-CS78DShm.js} +13 -10
  22. package/dist/index.d.ts +294 -182
  23. package/dist/index.js +10387 -18754
  24. package/dist/{inline-math-CPkpjl8t.js → inline-math-BE7gPPl0.js} +3 -3
  25. package/dist/{link-BACrkxRW.js → link-EaqqdLrN.js} +4 -4
  26. package/dist/{list-Cu8G46hK.js → list-EaQaXX4p.js} +2 -2
  27. package/dist/{list-item-BMgDS1tS.js → list-item-KAU_GIzi.js} +2 -2
  28. package/dist/{math-XsZX0VMw.js → math-CsyxsUp9.js} +3 -3
  29. package/dist/{mermaid-CQdSlhqn.js → mermaid-CA30wprV.js} +25 -11
  30. package/dist/modal-C0X_IXfp.js +4 -0
  31. package/dist/{modal-C1riNMrs.js → modal-D8sOifLe.js} +1 -1
  32. package/dist/node-list--ReOjYkK.js +4 -0
  33. package/dist/{node-list-7H-lIfUX.js → node-list-VskJkISk.js} +2 -81
  34. package/dist/{paragraph-Cfd37HUK.js → paragraph-D6OuJvHb.js} +2 -2
  35. package/dist/{previewers-C7PKsIbc.js → previewers-CwjTiQh8.js} +1 -1
  36. package/dist/segmented-D-zfh_BF.js +7 -0
  37. package/dist/{segmented-C9j-IIDc.js → segmented-DafF5jPA.js} +1 -1
  38. package/dist/{shiki-BoBbCakv.js → shiki-C1omjtbf.js} +2 -2
  39. package/dist/{strong-BzOBAWrG.js → strong-Clqsbyuc.js} +2 -2
  40. package/dist/{table-YY5M01Jm.js → table-DQZFzn1X.js} +13 -8
  41. package/dist/{tooltip-DarhJuZR.js → tooltip-BfznjscC.js} +1 -1
  42. package/dist/tooltip-Yf5TSh_Q.js +4 -0
  43. package/dist/vanilla-C7Ds8DWX.js +4 -0
  44. package/dist/{vanilla-Z6d1vQmX.js → vanilla-CfMvJwq0.js} +1 -1
  45. package/dist/{zoom-container-DQMpHHGQ.js → zoom-container-Ci1d-2Rg.js} +2 -2
  46. package/dist/zoom-container-Dd5Vtieh.js +7 -0
  47. package/package.json +3 -5
  48. package/dist/button-Dw4uJRaD.js +0 -6
  49. package/dist/code-block-Bitp8x1w.js +0 -10
  50. package/dist/composables-CzUVrTt_.js +0 -2151
  51. package/dist/dropdown-CSRjqK0u.js +0 -6
  52. package/dist/error-component-DDnC0bqw.js +0 -5
  53. package/dist/icon-DE3AzDqz.js +0 -4
  54. package/dist/image-Dl-r78_E.js +0 -9
  55. package/dist/modal-C7O4jt5-.js +0 -4
  56. package/dist/node-list-DMwAmH_n.js +0 -4
  57. package/dist/segmented-BRTZXoDN.js +0 -7
  58. package/dist/tooltip-vDDEbLwf.js +0 -4
  59. package/dist/vanilla-CzQw2_b4.js +0 -4
  60. package/dist/zoom-container-JLbwB4gy.js +0 -7
package/README.md CHANGED
@@ -72,7 +72,7 @@ This project also uses and benefits from:
72
72
  - [Shiki](https://shiki.style/) - Beautiful syntax highlighting
73
73
  - [Mermaid](https://mermaid.js.org/) - Diagramming and charting tool
74
74
  - [KaTeX](https://katex.org/) - Fast math typesetting library for the web
75
- - [Remend](https://github.com/vercel/streamdown/tree/main/packages/remend) - Intelligently parses and styles incomplete Markdown blocks
75
+ - [Remend](https://github.com/vercel/streamdown/tree/main/packages/remend) - This project implements similar functionality inspired by remend for intelligently parsing and completing incomplete Markdown blocks.
76
76
 
77
77
  ### Code Sources
78
78
  - [markstream-vue](https://github.com/Simon-He95/markstream-vue) - The original inspiration for learning AST-based custom markdown rendering, and the source of the animation implementation used in this project
@@ -1,5 +1,5 @@
1
- import "./composables-CzUVrTt_.js";
2
- import { t as node_list_default } from "./node-list-7H-lIfUX.js";
1
+ import "./composables-CcP6Ysj8.js";
2
+ import { t as node_list_default } from "./node-list-VskJkISk.js";
3
3
  import { createElementBlock, createVNode, defineComponent, mergeProps, openBlock } from "vue";
4
4
 
5
5
  //#region src/components/renderers/blockquote.vue?vue&type=script&setup=true&lang.ts
@@ -0,0 +1,6 @@
1
+ import "./composables-CcP6Ysj8.js";
2
+ import "./tooltip-BfznjscC.js";
3
+ import { t as button_default } from "./button-BVOWJPmC.js";
4
+ import "./icon-CRNiOEiK.js";
5
+
6
+ export { button_default as default };
@@ -1,5 +1,5 @@
1
- import { t as tooltip_default } from "./tooltip-DarhJuZR.js";
2
- import { t as icon_default } from "./icon-DcLTFhFW.js";
1
+ import { t as tooltip_default } from "./tooltip-BfznjscC.js";
2
+ import { t as icon_default } from "./icon-CRNiOEiK.js";
3
3
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
4
4
  import { createReusableTemplate } from "@vueuse/core";
5
5
 
@@ -1,11 +1,11 @@
1
- import "./previewers-C7PKsIbc.js";
2
- import { r as useShiki } from "./composables-CzUVrTt_.js";
3
- import "./tooltip-DarhJuZR.js";
4
- import "./button-DVWlhfQ9.js";
5
- import "./icon-DcLTFhFW.js";
6
- import "./modal-C1riNMrs.js";
7
- import { t as code_block_default } from "./code-block-CmUZxKNr.js";
8
- import "./segmented-C9j-IIDc.js";
1
+ import { r as useShiki } from "./composables-CcP6Ysj8.js";
2
+ import "./previewers-CwjTiQh8.js";
3
+ import "./tooltip-BfznjscC.js";
4
+ import "./button-BVOWJPmC.js";
5
+ import "./icon-CRNiOEiK.js";
6
+ import "./modal-D8sOifLe.js";
7
+ import { t as code_block_default } from "./code-block-wjjUUcJZ.js";
8
+ import "./segmented-DafF5jPA.js";
9
9
  import { computed, createBlock, createCommentVNode, defineAsyncComponent, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, resolveDynamicComponent, withCtx } from "vue";
10
10
 
11
11
  //#region src/components/renderers/code/index.vue?vue&type=script&setup=true&lang.ts
@@ -79,8 +79,8 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
79
79
  const languageClass = computed(() => `language-${props.node.lang}`);
80
80
  const { installed: hasShiki } = useShiki();
81
81
  const components = {
82
- vanilla: defineAsyncComponent(() => import("./vanilla-CzQw2_b4.js")),
83
- shiki: defineAsyncComponent(() => import("./shiki-BoBbCakv.js"))
82
+ vanilla: defineAsyncComponent(() => import("./vanilla-C7Ds8DWX.js")),
83
+ shiki: defineAsyncComponent(() => import("./shiki-C1omjtbf.js"))
84
84
  };
85
85
  const component = computed(() => {
86
86
  if (hasShiki.value) return components.shiki;
@@ -0,0 +1,10 @@
1
+ import "./composables-CcP6Ysj8.js";
2
+ import "./previewers-CwjTiQh8.js";
3
+ import "./tooltip-BfznjscC.js";
4
+ import "./button-BVOWJPmC.js";
5
+ import "./icon-CRNiOEiK.js";
6
+ import "./modal-D8sOifLe.js";
7
+ import { t as code_block_default } from "./code-block-wjjUUcJZ.js";
8
+ import "./segmented-DafF5jPA.js";
9
+
10
+ export { code_block_default as default };
@@ -1,8 +1,8 @@
1
- import { t as CODE_PREVIEWERS } from "./previewers-C7PKsIbc.js";
2
- import { G as useControls, K as useContext, V as save, b as useI18n, d as LANGUAGE_ALIAS, f as LANGUAGE_EXTENSIONS, m as useMermaid, p as LANGUAGE_ICONS, q as useCodeOptions } from "./composables-CzUVrTt_.js";
3
- import { t as button_default } from "./button-DVWlhfQ9.js";
4
- import { t as modal_default } from "./modal-C1riNMrs.js";
5
- import { t as segmented_default } from "./segmented-C9j-IIDc.js";
1
+ import { B as LANGUAGE_ICONS, Ct as useContext, R as LANGUAGE_ALIAS, St as useControls, V as useMermaid, q as useI18n, vt as save, wt as useCodeOptions, z as LANGUAGE_EXTENSIONS } from "./composables-CcP6Ysj8.js";
2
+ import { t as CODE_PREVIEWERS } from "./previewers-CwjTiQh8.js";
3
+ import { t as button_default } from "./button-BVOWJPmC.js";
4
+ import { t as modal_default } from "./modal-D8sOifLe.js";
5
+ import { t as segmented_default } from "./segmented-DafF5jPA.js";
6
6
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineAsyncComponent, defineComponent, mergeProps, normalizeClass, normalizeStyle, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, toRefs, unref, useModel, vShow, watch, withCtx, withDirectives } from "vue";
7
7
  import { createReusableTemplate, useClipboard } from "@vueuse/core";
8
8
 
@@ -190,13 +190,13 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
190
190
  },
191
191
  setup(__props) {
192
192
  const props = __props;
193
- const CodeNode = defineAsyncComponent(() => import("./code-Bz8LM16H.js"));
193
+ const CodeNode = defineAsyncComponent(() => import("./code-DG1O8Nim.js"));
194
194
  const { controls, previewers, codeOptions } = toRefs(props);
195
195
  const [DefineTemplate, ReuseTemplate] = createReusableTemplate();
196
196
  const { t } = useI18n();
197
197
  const { isControlEnabled, getControlValue, resolveControls } = useControls({ controls });
198
198
  const { installed: hasMermaid } = useMermaid();
199
- const { onCopied } = useContext();
199
+ const { beforeDownload, onCopied } = useContext();
200
200
  const { copy, copied } = useClipboard({ legacy: true });
201
201
  const { saveMermaid } = useMermaid();
202
202
  const collapsed = ref(false);
@@ -327,14 +327,22 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
327
327
  icon: "download",
328
328
  options: downloadOptions.value.length > 0 ? downloadOptions.value : void 0,
329
329
  visible: () => showDownload.value && !!LANGUAGE_EXTENSIONS[language.value],
330
- onClick: (_event, item) => {
330
+ onClick: async (_event, item) => {
331
331
  if (props.node.loading) return;
332
332
  if (!item || item.value === "code") {
333
333
  const extension = LANGUAGE_EXTENSIONS[language.value];
334
- save(`file.${extension}`, props.node.value, "text/plain");
334
+ if (await beforeDownload({
335
+ type: "code",
336
+ content: props.node.value
337
+ })) save(`file.${extension}`, props.node.value, "text/plain");
335
338
  return;
336
339
  }
337
- if ((item === null || item === void 0 ? void 0 : item.value) === "svg" || (item === null || item === void 0 ? void 0 : item.value) === "png") saveMermaid(item === null || item === void 0 ? void 0 : item.value, props.node.value);
340
+ if ((item === null || item === void 0 ? void 0 : item.value) === "svg" || (item === null || item === void 0 ? void 0 : item.value) === "png") {
341
+ if (await beforeDownload({
342
+ type: "mermaid",
343
+ content: props.node.value
344
+ })) saveMermaid(item === null || item === void 0 ? void 0 : item.value, props.node.value);
345
+ }
338
346
  }
339
347
  },
340
348
  {
@@ -424,7 +432,10 @@ var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
424
432
  collapsed: collapsed.value,
425
433
  "onUpdate:collapsed": _cache[9] || (_cache[9] = ($event) => collapsed.value = $event)
426
434
  }, null, 8, ["mode", "collapsed"])) : createCommentVNode("v-if", true), createVNode(actions_default, { actions: modalControls.value }, null, 8, ["actions"])])]),
427
- default: withCtx(() => [previewable.value ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(PreviewComponent.value), mergeProps({ key: 0 }, props, { "container-height": "100%" }), null, 16)), [[vShow, mode.value === "preview"]]) : createCommentVNode("v-if", true), withDirectives(createVNode(unref(CodeNode), mergeProps(props, { "show-header": false }), null, 16), [[vShow, mode.value === "source"]])]),
435
+ default: withCtx(() => [previewable.value ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(PreviewComponent.value), mergeProps({ key: 0 }, props, {
436
+ "immediate-render": true,
437
+ "container-height": "100%"
438
+ }), null, 16)), [[vShow, mode.value === "preview"]]) : createCommentVNode("v-if", true), withDirectives(createVNode(unref(CodeNode), mergeProps(props, { "show-header": false }), null, 16), [[vShow, mode.value === "source"]])]),
428
439
  _: 1
429
440
  }, 8, ["open"])
430
441
  ], 10, _hoisted_2)], 64);