vue-stream-markdown 0.2.3 → 0.3.0

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 (59) hide show
  1. package/README.md +1 -1
  2. package/dist/{blockquote-Crr-D7fY.js → blockquote-DTo6zg12.js} +2 -2
  3. package/dist/button-1EHxh8s2.js +6 -0
  4. package/dist/{button-DVWlhfQ9.js → button-B7H9jKmU.js} +2 -2
  5. package/dist/{code-Bz8LM16H.js → code-DC7KVCvB.js} +10 -10
  6. package/dist/{code-block-CmUZxKNr.js → code-block-DPC1FZT3.js} +18 -10
  7. package/dist/code-block-DYrPMONb.js +10 -0
  8. package/dist/{composables-CzUVrTt_.js → composables-BvaSMf02.js} +3 -0
  9. package/dist/{delete-DFoiOzHW.js → delete-xkkM7TML.js} +2 -2
  10. package/dist/dropdown-Cv_yW4GS.js +6 -0
  11. package/dist/{emphasis-DvaBuxeK.js → emphasis-BmM30dZi.js} +2 -2
  12. package/dist/error-component-1U-JNS6o.js +5 -0
  13. package/dist/{error-component-BTe-SuY7.js → error-component-DFBWdaYB.js} +2 -2
  14. package/dist/{footnote-definition-ByWh1N3S.js → footnote-definition-6cTbdg-J.js} +5 -5
  15. package/dist/{footnote-reference-BJ4J7BFo.js → footnote-reference-CxJUg8wT.js} +1 -1
  16. package/dist/{heading-1fssqGGO.js → heading-DQ4lofbm.js} +2 -2
  17. package/dist/{icon-DcLTFhFW.js → icon-BJa4ovUe.js} +1 -1
  18. package/dist/icon-CvIgAOPh.js +4 -0
  19. package/dist/{image-DXnmoID_.js → image-DXu2WF2r.js} +13 -10
  20. package/dist/image-Dm5xIWs7.js +9 -0
  21. package/dist/{image-xPrAKT9D.js → image-e0E51Nc3.js} +17 -12
  22. package/dist/index.d.ts +44 -7
  23. package/dist/index.js +177 -87
  24. package/dist/{inline-math-CPkpjl8t.js → inline-math-BuO_dWPX.js} +3 -3
  25. package/dist/{link-BACrkxRW.js → link-DyD59DzG.js} +4 -4
  26. package/dist/{list-Cu8G46hK.js → list-De0KPajx.js} +2 -2
  27. package/dist/{list-item-BMgDS1tS.js → list-item-CuUgvXRC.js} +2 -2
  28. package/dist/{math-XsZX0VMw.js → math-DnFOOLdz.js} +3 -3
  29. package/dist/{mermaid-CQdSlhqn.js → mermaid-ZCQPlRUa.js} +6 -6
  30. package/dist/modal-B5jFKJL4.js +4 -0
  31. package/dist/{modal-C1riNMrs.js → modal-Bhe0iSs6.js} +1 -1
  32. package/dist/{node-list-7H-lIfUX.js → node-list-CWy--Gin.js} +2 -81
  33. package/dist/node-list-Doh9Z-4p.js +4 -0
  34. package/dist/{paragraph-Cfd37HUK.js → paragraph-D3H1qprZ.js} +2 -2
  35. package/dist/{previewers-C7PKsIbc.js → previewers-DB2HHDGb.js} +1 -1
  36. package/dist/{segmented-C9j-IIDc.js → segmented-B-kjIOkd.js} +1 -1
  37. package/dist/segmented-fbmq_xK1.js +7 -0
  38. package/dist/{shiki-BoBbCakv.js → shiki-DAu2_FTG.js} +2 -2
  39. package/dist/{strong-BzOBAWrG.js → strong-BlCQoXCR.js} +2 -2
  40. package/dist/{table-YY5M01Jm.js → table-Co_MpK6m.js} +13 -8
  41. package/dist/tooltip-70WIAMmC.js +4 -0
  42. package/dist/{tooltip-DarhJuZR.js → tooltip-CWv9skVu.js} +1 -1
  43. package/dist/{vanilla-Z6d1vQmX.js → vanilla-D30b-_ch.js} +1 -1
  44. package/dist/vanilla-DV7fYrnj.js +4 -0
  45. package/dist/{zoom-container-DQMpHHGQ.js → zoom-container-DbeN8U39.js} +2 -2
  46. package/dist/zoom-container-Dc8N-wuo.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/dropdown-CSRjqK0u.js +0 -6
  51. package/dist/error-component-DDnC0bqw.js +0 -5
  52. package/dist/icon-DE3AzDqz.js +0 -4
  53. package/dist/image-Dl-r78_E.js +0 -9
  54. package/dist/modal-C7O4jt5-.js +0 -4
  55. package/dist/node-list-DMwAmH_n.js +0 -4
  56. package/dist/segmented-BRTZXoDN.js +0 -7
  57. package/dist/tooltip-vDDEbLwf.js +0 -4
  58. package/dist/vanilla-CzQw2_b4.js +0 -4
  59. package/dist/zoom-container-JLbwB4gy.js +0 -7
@@ -1,85 +1,6 @@
1
- import { K as useContext } from "./composables-CzUVrTt_.js";
1
+ import { K as useContext } from "./composables-BvaSMf02.js";
2
2
  import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, mergeProps, openBlock, renderList, resolveDynamicComponent, withCtx } from "vue";
3
3
 
4
- //#region src/components/markdown.vue?vue&type=script&setup=true&lang.ts
5
- const _hoisted_1 = ["innerHTML"];
6
- var markdown_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
7
- __name: "markdown",
8
- props: {
9
- markdownParser: {
10
- type: Object,
11
- required: true
12
- },
13
- nodeRenderers: {
14
- type: Object,
15
- required: true
16
- },
17
- node: {
18
- type: Object,
19
- required: true
20
- },
21
- nodeKey: {
22
- type: String,
23
- required: true
24
- },
25
- controls: {
26
- type: [Boolean, Object],
27
- required: false
28
- },
29
- previewers: {
30
- type: [Boolean, Object],
31
- required: false
32
- },
33
- shikiOptions: {
34
- type: Object,
35
- required: false
36
- },
37
- mermaidOptions: {
38
- type: Object,
39
- required: false
40
- },
41
- katexOptions: {
42
- type: Object,
43
- required: false
44
- },
45
- hardenOptions: {
46
- type: Object,
47
- required: false
48
- },
49
- codeOptions: {
50
- type: Object,
51
- required: false
52
- },
53
- imageOptions: {
54
- type: Object,
55
- required: false
56
- },
57
- uiOptions: {
58
- type: Object,
59
- required: false
60
- },
61
- isDark: {
62
- type: Boolean,
63
- required: false
64
- }
65
- },
66
- setup(__props) {
67
- const props = __props;
68
- const html = computed(() => {
69
- const content = props.markdownParser.astToMarkdown(props.node);
70
- return props.markdownParser.markdownToHtml(content);
71
- });
72
- return (_ctx, _cache) => {
73
- return openBlock(), createElementBlock("span", { innerHTML: html.value }, null, 8, _hoisted_1);
74
- };
75
- }
76
- });
77
-
78
- //#endregion
79
- //#region src/components/markdown.vue
80
- var markdown_default = markdown_vue_vue_type_script_setup_true_lang_default;
81
-
82
- //#endregion
83
4
  //#region src/components/node-list.vue?vue&type=script&setup=true&lang.ts
84
5
  var node_list_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
85
6
  inheritAttrs: false,
@@ -160,7 +81,7 @@ var node_list_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
160
81
  });
161
82
  const excludeTransition = ["code"];
162
83
  function getNodeComponent(node) {
163
- return props.nodeRenderers[node.type] || markdown_default;
84
+ return props.nodeRenderers[node.type] || null;
164
85
  }
165
86
  function getNodeBindings(node) {
166
87
  return {
@@ -0,0 +1,4 @@
1
+ import "./composables-BvaSMf02.js";
2
+ import { t as node_list_default } from "./node-list-CWy--Gin.js";
3
+
4
+ export { node_list_default as default };
@@ -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-BvaSMf02.js";
2
+ import { t as node_list_default } from "./node-list-CWy--Gin.js";
3
3
  import { createElementBlock, createVNode, defineComponent, mergeProps, openBlock } from "vue";
4
4
 
5
5
  //#region src/components/renderers/paragraph.vue?vue&type=script&setup=true&lang.ts
@@ -3,7 +3,7 @@ import { defineAsyncComponent } from "vue";
3
3
  //#region src/components/previewers/index.ts
4
4
  const CODE_PREVIEWERS = {
5
5
  html: defineAsyncComponent(() => import("./html-DfTs9nEm.js")),
6
- mermaid: defineAsyncComponent(() => import("./mermaid-CQdSlhqn.js"))
6
+ mermaid: defineAsyncComponent(() => import("./mermaid-ZCQPlRUa.js"))
7
7
  };
8
8
 
9
9
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as button_default } from "./button-DVWlhfQ9.js";
1
+ import { t as button_default } from "./button-B7H9jKmU.js";
2
2
  import { Fragment, createBlock, createElementBlock, defineComponent, mergeModels, openBlock, renderList, useModel } from "vue";
3
3
 
4
4
  //#region src/components/segmented.vue?vue&type=script&setup=true&lang.ts
@@ -0,0 +1,7 @@
1
+ import "./composables-BvaSMf02.js";
2
+ import "./tooltip-CWv9skVu.js";
3
+ import "./button-B7H9jKmU.js";
4
+ import "./icon-BJa4ovUe.js";
5
+ import { t as segmented_default } from "./segmented-B-kjIOkd.js";
6
+
7
+ export { segmented_default as default };
@@ -1,5 +1,5 @@
1
- import { q as useCodeOptions, r as useShiki } from "./composables-CzUVrTt_.js";
2
- import { t as vanilla_default } from "./vanilla-Z6d1vQmX.js";
1
+ import { q as useCodeOptions, r as useShiki } from "./composables-BvaSMf02.js";
2
+ import { t as vanilla_default } from "./vanilla-D30b-_ch.js";
3
3
  import { Transition, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineAsyncComponent, defineComponent, mergeProps, normalizeStyle, openBlock, ref, toRefs, unref, watch, withCtx } from "vue";
4
4
  import { useResizeObserver } from "@vueuse/core";
5
5
 
@@ -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-BvaSMf02.js";
2
+ import { t as node_list_default } from "./node-list-CWy--Gin.js";
3
3
  import { createElementBlock, createVNode, defineComponent, mergeProps, openBlock } from "vue";
4
4
 
5
5
  //#region src/components/renderers/strong.vue?vue&type=script&setup=true&lang.ts
@@ -1,8 +1,8 @@
1
- import { A as tableDataToMarkdown, G as useControls, K as useContext, O as extractTableDataFromElement, V as save, b as useI18n, j as tableDataToTSV, k as tableDataToCSV } from "./composables-CzUVrTt_.js";
2
- import { t as node_list_default } from "./node-list-7H-lIfUX.js";
3
- import "./tooltip-DarhJuZR.js";
4
- import { t as button_default } from "./button-DVWlhfQ9.js";
5
- import "./icon-DcLTFhFW.js";
1
+ import { A as tableDataToMarkdown, G as useControls, K as useContext, O as extractTableDataFromElement, V as save, b as useI18n, j as tableDataToTSV, k as tableDataToCSV } from "./composables-BvaSMf02.js";
2
+ import { t as node_list_default } from "./node-list-CWy--Gin.js";
3
+ import "./tooltip-CWv9skVu.js";
4
+ import { t as button_default } from "./button-B7H9jKmU.js";
5
+ import "./icon-BJa4ovUe.js";
6
6
  import { t as spin_default } from "./spin-DzERwGWy.js";
7
7
  import { t as table_default$1 } from "./table-tZ8TA3cu.js";
8
8
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, openBlock, ref, renderList, withCtx } from "vue";
@@ -75,7 +75,7 @@ var table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
75
75
  setup(__props) {
76
76
  const props = __props;
77
77
  const { t } = useI18n();
78
- const { onCopied } = useContext();
78
+ const { beforeDownload, onCopied } = useContext();
79
79
  const { copy, copied } = useClipboard({ legacy: true });
80
80
  const { isControlEnabled, resolveControls } = useControls({ controls: props.controls });
81
81
  const showCopy = computed(() => isControlEnabled("table.copy"));
@@ -146,14 +146,19 @@ var table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCo
146
146
  icon: "download",
147
147
  options,
148
148
  visible: () => showDownload.value,
149
- onClick: (_event, item) => {
149
+ onClick: async (_event, item) => {
150
150
  const data = getTableContent((item === null || item === void 0 ? void 0 : item.value) || "csv");
151
151
  if (!data) return;
152
- save(`table.${data.extension}`, data.content, data.mimeType);
152
+ if (await beforeDownload({
153
+ type: "table",
154
+ content: data.content
155
+ })) save(`table.${data.extension}`, data.content, data.mimeType);
153
156
  }
154
157
  }]);
155
158
  const controls = computed(() => resolveControls("table", builtinControls.value, props));
156
159
  function getNodes(cell) {
160
+ const children = cell.children;
161
+ if (children) return children;
157
162
  return [cell];
158
163
  }
159
164
  return (_ctx, _cache) => {
@@ -0,0 +1,4 @@
1
+ import "./composables-BvaSMf02.js";
2
+ import { t as tooltip_default } from "./tooltip-CWv9skVu.js";
3
+
4
+ export { tooltip_default as default };
@@ -1,4 +1,4 @@
1
- import { E as useFloating, K as useContext } from "./composables-CzUVrTt_.js";
1
+ import { E as useFloating, K as useContext } from "./composables-BvaSMf02.js";
2
2
  import { Fragment, Teleport, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeStyle, openBlock, renderSlot, toDisplayString, toRefs, unref } from "vue";
3
3
 
4
4
  //#region src/components/tooltip.vue?vue&type=script&setup=true&lang.ts
@@ -1,4 +1,4 @@
1
- import { q as useCodeOptions } from "./composables-CzUVrTt_.js";
1
+ import { q as useCodeOptions } from "./composables-BvaSMf02.js";
2
2
  import { computed, defineComponent, h, renderList, toRefs } from "vue";
3
3
 
4
4
  //#region src/components/renderers/code/vanilla.ts
@@ -0,0 +1,4 @@
1
+ import "./composables-BvaSMf02.js";
2
+ import { t as vanilla_default } from "./vanilla-D30b-_ch.js";
3
+
4
+ export { vanilla_default as default };
@@ -1,5 +1,5 @@
1
- import { b as useI18n, t as useZoom } from "./composables-CzUVrTt_.js";
2
- import { t as button_default } from "./button-DVWlhfQ9.js";
1
+ import { b as useI18n, t as useZoom } from "./composables-BvaSMf02.js";
2
+ import { t as button_default } from "./button-B7H9jKmU.js";
3
3
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, normalizeStyle, openBlock, ref, renderList, renderSlot, unref, withModifiers } from "vue";
4
4
 
5
5
  //#region src/components/zoom-container.vue?vue&type=script&setup=true&lang.ts
@@ -0,0 +1,7 @@
1
+ import "./composables-BvaSMf02.js";
2
+ import "./tooltip-CWv9skVu.js";
3
+ import "./button-B7H9jKmU.js";
4
+ import "./icon-BJa4ovUe.js";
5
+ import { t as zoom_container_default } from "./zoom-container-DbeN8U39.js";
6
+
7
+ export { zoom_container_default as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vue-stream-markdown",
3
3
  "type": "module",
4
- "version": "0.2.3",
4
+ "version": "0.3.0",
5
5
  "description": "Streaming markdown output, Useful for text streams like LLM outputs.",
6
6
  "author": "jinghaihan",
7
7
  "license": "MIT",
@@ -18,8 +18,8 @@
18
18
  "markdown",
19
19
  "stream",
20
20
  "mermaid",
21
- "latex",
22
21
  "katex",
22
+ "latex",
23
23
  "customizable"
24
24
  ],
25
25
  "exports": {
@@ -53,9 +53,7 @@
53
53
  },
54
54
  "dependencies": {
55
55
  "@floating-ui/dom": "^1.7.4",
56
- "@vueuse/core": "^14.1.0",
57
- "markdown-it-async": "^2.2.0",
58
- "remend": "^1.0.1"
56
+ "@vueuse/core": "^14.1.0"
59
57
  },
60
58
  "devDependencies": {
61
59
  "@antfu/eslint-config": "^6.7.1",
@@ -1,6 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import "./tooltip-DarhJuZR.js";
3
- import { t as button_default } from "./button-DVWlhfQ9.js";
4
- import "./icon-DcLTFhFW.js";
5
-
6
- export { button_default as default };
@@ -1,10 +0,0 @@
1
- import "./previewers-C7PKsIbc.js";
2
- import "./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";
9
-
10
- export { code_block_default as default };
@@ -1,6 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import "./tooltip-DarhJuZR.js";
3
- import { n as dropdown_default } from "./button-DVWlhfQ9.js";
4
- import "./icon-DcLTFhFW.js";
5
-
6
- export { dropdown_default as default };
@@ -1,5 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import "./icon-DcLTFhFW.js";
3
- import { t as error_component_default } from "./error-component-BTe-SuY7.js";
4
-
5
- export { error_component_default as default };
@@ -1,4 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import { t as icon_default } from "./icon-DcLTFhFW.js";
3
-
4
- export { icon_default as default };
@@ -1,9 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import "./tooltip-DarhJuZR.js";
3
- import "./button-DVWlhfQ9.js";
4
- import "./icon-DcLTFhFW.js";
5
- import "./modal-C1riNMrs.js";
6
- import "./zoom-container-DQMpHHGQ.js";
7
- import { t as image_default } from "./image-DXnmoID_.js";
8
-
9
- export { image_default as default };
@@ -1,4 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import { t as modal_default } from "./modal-C1riNMrs.js";
3
-
4
- export { modal_default as default };
@@ -1,4 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import { t as node_list_default } from "./node-list-7H-lIfUX.js";
3
-
4
- export { node_list_default as default };
@@ -1,7 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import "./tooltip-DarhJuZR.js";
3
- import "./button-DVWlhfQ9.js";
4
- import "./icon-DcLTFhFW.js";
5
- import { t as segmented_default } from "./segmented-C9j-IIDc.js";
6
-
7
- export { segmented_default as default };
@@ -1,4 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import { t as tooltip_default } from "./tooltip-DarhJuZR.js";
3
-
4
- export { tooltip_default as default };
@@ -1,4 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import { t as vanilla_default } from "./vanilla-Z6d1vQmX.js";
3
-
4
- export { vanilla_default as default };
@@ -1,7 +0,0 @@
1
- import "./composables-CzUVrTt_.js";
2
- import "./tooltip-DarhJuZR.js";
3
- import "./button-DVWlhfQ9.js";
4
- import "./icon-DcLTFhFW.js";
5
- import { t as zoom_container_default } from "./zoom-container-DQMpHHGQ.js";
6
-
7
- export { zoom_container_default as default };