vue-stream-markdown 0.1.3 → 0.1.5

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 (193) hide show
  1. package/README.md +3 -1
  2. package/dist/arrow-left-C5s0Sn8o.js +25 -0
  3. package/dist/{blockquote-DdEg2gww.js → blockquote-bkADuiGm.js} +1 -9
  4. package/dist/{button-CJyeXWq2.js → button-BQhuT7wh.js} +2 -3
  5. package/dist/button-JYC8d-B-.js +5 -0
  6. package/dist/{code-CJ4tMt6L.js → code-DF8PTNol.js} +10 -18
  7. package/dist/code-block-BhMDz2ZL.js +9 -0
  8. package/dist/{code-block-CQ4lgva1.js → code-block-Dm2wl0cb.js} +87 -77
  9. package/dist/{composables-Cj6_jbwr.js → composables-yny5gJo3.js} +570 -234
  10. package/dist/{delete-BdWzKJCy.js → delete-D17YBeI-.js} +1 -9
  11. package/dist/dropdown-Y5_Z4a_u.js +5 -0
  12. package/dist/{emphasis-CTuGt1Ok.js → emphasis-B-2R_0Q5.js} +1 -9
  13. package/dist/{en-US-Bfc50l3I.js → en-US-Kw2LYAMk.js} +7 -1
  14. package/dist/{error-component-ClGLfmwy.js → error-component-Bb0gIZsx.js} +4 -3
  15. package/dist/error-component-DEIWb6kB.js +4 -0
  16. package/dist/flip-horizontal-BFWjqDbQ.js +25 -0
  17. package/dist/{heading-2vpQQtTH.js → heading-DyJIwNrN.js} +1 -9
  18. package/dist/{html-DL0PcUXX.js → html-DXNqMvt_.js} +0 -8
  19. package/dist/{image-xeiC5YFM.js → image-BPhFn1xp.js} +40 -76
  20. package/dist/image-DXBD47sF.js +8 -0
  21. package/dist/image-DvOGBhi-.js +327 -0
  22. package/dist/index.css +44 -64
  23. package/dist/index.d.ts +155 -81
  24. package/dist/index.js +55 -63
  25. package/dist/{inline-code-CBoqhfz7.js → inline-code-C44UJ2TH.js} +0 -8
  26. package/dist/{inline-math-C2NUSasr.js → inline-math-wO1rMt9T.js} +2 -10
  27. package/dist/{link-BceXudNH.js → link-sGo7CEll.js} +3 -11
  28. package/dist/{list-BCiFKGaz.js → list-C0I1ysSI.js} +1 -9
  29. package/dist/{list-item-p-OLUR_9.js → list-item-BoC2wKBL.js} +1 -9
  30. package/dist/{math-DXOLG3Xg.js → math-BlqtUf2r.js} +2 -10
  31. package/dist/{mermaid-CU4hpB6S.js → mermaid-Ka1jnXrR.js} +6 -14
  32. package/dist/modal-Duhc-vVa.js +4 -0
  33. package/dist/modal-Rc_RoeYA.js +94 -0
  34. package/dist/node-list-C1je2nLd.js +3 -0
  35. package/dist/{node-list-CGr_EVtn.js → node-list-YhpHXdM_.js} +0 -16
  36. package/dist/{paragraph-DYjqr_Sa.js → paragraph-BN-4-Dn7.js} +1 -9
  37. package/dist/previewers-D0VVcdjL.js +10 -0
  38. package/dist/rotate-ccw-square-C2KVFUF3.js +24 -0
  39. package/dist/{segmented-CF6exjdD.js → segmented-CaC54iz_.js} +1 -1
  40. package/dist/segmented-XdoLnuuq.js +6 -0
  41. package/dist/{shiki-BlfngIRi.js → shiki-sJNZTn1K.js} +4 -12
  42. package/dist/spin-wM2KE8mO.js +3 -0
  43. package/dist/{strong-CvOjLZiq.js → strong-NdAS3VjP.js} +1 -9
  44. package/dist/{table-C5VHgkTQ.js → table-CWX5B2i1.js} +14 -18
  45. package/dist/table-R9gmCXm_.js +3 -0
  46. package/dist/{text-DuONUqRA.js → text-DpleLvNh.js} +0 -8
  47. package/dist/{thematic-break-CcNPEI9Y.js → thematic-break-D5GvzU5S.js} +0 -8
  48. package/dist/tooltip-BJDs-A8d.js +4 -0
  49. package/dist/tooltip-Bgbzbk4Q.js +68 -0
  50. package/dist/{vanilla-D5DzB31q.js → vanilla-BTOVqKl7.js} +1 -1
  51. package/dist/vanilla-DA5bwIkr.js +4 -0
  52. package/dist/{yaml-DJHrmzSe.js → yaml-y0snrPRx.js} +1 -9
  53. package/dist/{zh-CN-CL1XGe0H.js → zh-CN-Dfow4Yn2.js} +7 -1
  54. package/dist/zoom-container-B1qbA-7z.js +153 -0
  55. package/dist/zoom-container-KztuE4ri.js +6 -0
  56. package/package.json +9 -10
  57. package/dist/button-2wMU7qkH.js +0 -5
  58. package/dist/code-block-BucFZooo.js +0 -9
  59. package/dist/dropdown-dsCfq0Hl.js +0 -5
  60. package/dist/error-component-B0mmLhh6.js +0 -4
  61. package/dist/modal-CuQR21UD.js +0 -71
  62. package/dist/modal-DcpxxDDX.js +0 -3
  63. package/dist/node-list-lgY1wbfQ.js +0 -3
  64. package/dist/previewers-qHMi6xZ3.js +0 -10
  65. package/dist/segmented-BeHqXuFx.js +0 -6
  66. package/dist/spin-Bz4zGBEo.js +0 -3
  67. package/dist/table-CZLbUHiJ.js +0 -3
  68. package/dist/tooltip-BzVZqo7w.js +0 -4
  69. package/dist/tooltip-gxsqaBNg.js +0 -71
  70. package/dist/vanilla-CKj7EQLx.js +0 -4
  71. package/dist/zoom-container-CwEDlKRx.js +0 -6
  72. package/dist/zoom-container-D_fBClW2.js +0 -111
  73. /package/dist/{angular-Chs-UKBr.js → angular-Mip1mspI.js} +0 -0
  74. /package/dist/{angular-component-Cc_FANXU.js → angular-component-Cq5UbX7R.js} +0 -0
  75. /package/dist/{apache-COYnc6xR.js → apache-BSq7fX32.js} +0 -0
  76. /package/dist/{asciidoc-BabXBDAL.js → asciidoc-DS-PMOLv.js} +0 -0
  77. /package/dist/{assembly-CDqKhexW.js → assembly-BPatlOM7.js} +0 -0
  78. /package/dist/{astro-C9kftzFG.js → astro-CSD_ZjXp.js} +0 -0
  79. /package/dist/{bash-Ce4pNIkV.js → bash-RITislE1.js} +0 -0
  80. /package/dist/{batch-CHQBRjFL.js → batch-DWPShYhN.js} +0 -0
  81. /package/dist/{bicep-8jxWtuBF.js → bicep-C6BEHfP6.js} +0 -0
  82. /package/dist/{c-FBUef746.js → c-DNo3tsNy.js} +0 -0
  83. /package/dist/{check-C4xOk8um.js → check-BfpxIITS.js} +0 -0
  84. /package/dist/{chevron-down-cnOJ4h1g.js → chevron-down-LeNeemjn.js} +0 -0
  85. /package/dist/{circle-alert-CLX-h5rZ.js → circle-alert-BjDuIzgc.js} +0 -0
  86. /package/dist/{clojure-BulUroSy.js → clojure-C1DEYHW0.js} +0 -0
  87. /package/dist/{cmake-CW3vz1Mo.js → cmake-B69mdXcH.js} +0 -0
  88. /package/dist/{cobol-CIn3oFju.js → cobol-qmL-zIWi.js} +0 -0
  89. /package/dist/{code-D8LSp8rK.js → code-D9CiymEK.js} +0 -0
  90. /package/dist/{codeowners-CJggXF_b.js → codeowners-Crklt5nF.js} +0 -0
  91. /package/dist/{coffeescript-CBrVvzGY.js → coffeescript-k3huSp23.js} +0 -0
  92. /package/dist/{copy-Cabve0xf.js → copy-C4580J93.js} +0 -0
  93. /package/dist/{cpp-BTKeuyd-.js → cpp-Cn3MB35e.js} +0 -0
  94. /package/dist/{crystal-DyIYvZbm.js → crystal-D5aGETSx.js} +0 -0
  95. /package/dist/{csharp-NqZ1vyF9.js → csharp-CgkTkbPx.js} +0 -0
  96. /package/dist/{css-BpR5Lajb.js → css-DRH4n_IV.js} +0 -0
  97. /package/dist/{csv-eCMFnKKK.js → csv-D5nNTIzO.js} +0 -0
  98. /package/dist/{cue-TY97dGOQ.js → cue-B5mC88-N.js} +0 -0
  99. /package/dist/{d-NftUsdTd.js → d-BdQRMgma.js} +0 -0
  100. /package/dist/{dart-DJpwZZbk.js → dart-BGnfn0NN.js} +0 -0
  101. /package/dist/{database-aZwE71Px.js → database-Ca1VGX7u.js} +0 -0
  102. /package/dist/{diff-CYRzypaU.js → diff-DVaTsnqu.js} +0 -0
  103. /package/dist/{docker-CxHBuukH.js → docker-E47qYlmL.js} +0 -0
  104. /package/dist/{download-Bnn7rtYw.js → download-DytrK56a.js} +0 -0
  105. /package/dist/{elixir-BKSxVc1h.js → elixir-C-jqqu6q.js} +0 -0
  106. /package/dist/{elm-DScuAf3X.js → elm-CmeHvaWl.js} +0 -0
  107. /package/dist/{env-CDAKsodl.js → env-Ck1BHoxR.js} +0 -0
  108. /package/dist/{erlang-D2M1ZL3m.js → erlang-CIP8kpGJ.js} +0 -0
  109. /package/dist/{eye-CdeX8PhP.js → eye-TaEwQS2Z.js} +0 -0
  110. /package/dist/{fortran-CORyQ0wt.js → fortran-DJVP2s7V.js} +0 -0
  111. /package/dist/{fsharp-BJz_Jgpl.js → fsharp-Bp6mUcG0.js} +0 -0
  112. /package/dist/{git-DgrlTr1E.js → git-BDcqJ1Gp.js} +0 -0
  113. /package/dist/{gleam-t_xad9Kw.js → gleam-JLiZVlev.js} +0 -0
  114. /package/dist/{go-Cvlh1xtL.js → go-ClcCiS7e.js} +0 -0
  115. /package/dist/{graphql-ApIm0mDD.js → graphql-D2RDo-DF.js} +0 -0
  116. /package/dist/{groovy-CaLnK8PV.js → groovy-DLZBw8xE.js} +0 -0
  117. /package/dist/{haml-MwijEO_6.js → haml-Da74jRwZ.js} +0 -0
  118. /package/dist/{handlebars-CKdUPI9h.js → handlebars-CNgS57Sz.js} +0 -0
  119. /package/dist/{haskell-NPOXEnck.js → haskell-DCvfD6VB.js} +0 -0
  120. /package/dist/{haxe-DyKBMsDE.js → haxe-CHVK1TId.js} +0 -0
  121. /package/dist/{html-CMgES1dE.js → html-Du4235Z-.js} +0 -0
  122. /package/dist/{http-B9FFNmUr.js → http-B8VAFeQ5.js} +0 -0
  123. /package/dist/{image-CMZAakWu.js → image-D8MZj4W5.js} +0 -0
  124. /package/dist/{java-iU-L9wJz.js → java-CoSdnK1N.js} +0 -0
  125. /package/dist/{javascript-DtnWdTFC.js → javascript-BCDeVll0.js} +0 -0
  126. /package/dist/{jinja-CoWszo_D.js → jinja-DYbiqZy0.js} +0 -0
  127. /package/dist/{json-C80qKCnh.js → json-CdzCyWJA.js} +0 -0
  128. /package/dist/{julia-DG2BCBLx.js → julia-pswJGtpP.js} +0 -0
  129. /package/dist/{kdl-7twRfIlJ.js → kdl-M8rfQ85l.js} +0 -0
  130. /package/dist/{kotlin-BjrOgP7R.js → kotlin-CfCV33oB.js} +0 -0
  131. /package/dist/{latex-DIQfUvG8.js → latex-DK8DFhTm.js} +0 -0
  132. /package/dist/{less-BJ1yEAWt.js → less-BFnNZiIs.js} +0 -0
  133. /package/dist/{link-DeV4CQOB.js → link-C7eU_yi-.js} +0 -0
  134. /package/dist/{liquid-BqKFZ1wQ.js → liquid-C8h46DoX.js} +0 -0
  135. /package/dist/{lisp-oekhB2ti.js → lisp-C3FbGuD1.js} +0 -0
  136. /package/dist/{log-D1XEqR9q.js → log-D-O3FXf2.js} +0 -0
  137. /package/dist/{lua-C5Q97-1D.js → lua-BC_aR1_i.js} +0 -0
  138. /package/dist/{luau-BT8KwqZ2.js → luau-DFUOrNN7.js} +0 -0
  139. /package/dist/{makefile-B4a0ciG4.js → makefile-Ck67veVV.js} +0 -0
  140. /package/dist/{markdown-DvNyKsiJ.js → markdown-BX13X3kd.js} +0 -0
  141. /package/dist/{marko-BzsIf6bg.js → marko-CQE8YTCc.js} +0 -0
  142. /package/dist/{matlab-cMBkmDhQ.js → matlab-Bd9O2Ml3.js} +0 -0
  143. /package/dist/{maximize-4PIqBONS.js → maximize-CDZ9rnYF.js} +0 -0
  144. /package/dist/{mermaid-8JIH2gkQ.js → mermaid-Dv-Pr0W-.js} +0 -0
  145. /package/dist/{minimize-BJ8htyDF.js → minimize-B9ER7p2X.js} +0 -0
  146. /package/dist/{nextflow-DNmqU1xg.js → nextflow-D3lDq1Yi.js} +0 -0
  147. /package/dist/{nginx-DDfYF_rj.js → nginx-CgsqCL4l.js} +0 -0
  148. /package/dist/{nim-D9xEmy4k.js → nim-BJdSu3c6.js} +0 -0
  149. /package/dist/{nix-BV1Deshw.js → nix-B7K_D6CN.js} +0 -0
  150. /package/dist/{ocaml-BkFn4LL3.js → ocaml-gYS1Y45s.js} +0 -0
  151. /package/dist/{perl-BytUHDE7.js → perl-DXFhFWhI.js} +0 -0
  152. /package/dist/{php-BImJJtNM.js → php-We35bF4E.js} +0 -0
  153. /package/dist/{postcss-CrZ9_0sT.js → postcss-BWovY_YV.js} +0 -0
  154. /package/dist/{powershell-DYSGu7TM.js → powershell-C6teiBsq.js} +0 -0
  155. /package/dist/{prisma-BhRvcOFY.js → prisma-UyJEg0_X.js} +0 -0
  156. /package/dist/{prolog-DuaCKek_.js → prolog-YZsPgdnw.js} +0 -0
  157. /package/dist/{properties-BbIJwuP-.js → properties-DaPbL0e2.js} +0 -0
  158. /package/dist/{proto-CE0aVW11.js → proto-1LIwu2O1.js} +0 -0
  159. /package/dist/{pug-B1-IC-Tc.js → pug-CzkUK-Ec.js} +0 -0
  160. /package/dist/{puppet-8nYquiMG.js → puppet-CNhB1MHb.js} +0 -0
  161. /package/dist/{python-DhRyfBrD.js → python-B_hgEobv.js} +0 -0
  162. /package/dist/{r-Cjje17IA.js → r-CVeKYmPK.js} +0 -0
  163. /package/dist/{racket-Dx0gMnpg.js → racket-D5UfvXuw.js} +0 -0
  164. /package/dist/{razor-DPht_bdD.js → razor-RIKaANTN.js} +0 -0
  165. /package/dist/{ruby-B8RxtCzI.js → ruby-C8wV0pMO.js} +0 -0
  166. /package/dist/{rust-Cjtli6yf.js → rust-75Gei1mP.js} +0 -0
  167. /package/dist/{sass-Dv3DMzjs.js → sass-Cq68xmQ4.js} +0 -0
  168. /package/dist/{scala-B7bZGKXq.js → scala-C_E5rjSc.js} +0 -0
  169. /package/dist/{scheme-B2PsEdVN.js → scheme-Bm-q-nLL.js} +0 -0
  170. /package/dist/{shader-BZzu3zGr.js → shader-DPaRkMCs.js} +0 -0
  171. /package/dist/{shiki-token-renderer-D164wC7Y.js → shiki-token-renderer-CLmUjKa3.js} +0 -0
  172. /package/dist/{solidity-CLieFYpL.js → solidity-DvHG_0CD.js} +0 -0
  173. /package/dist/{spin-Ds5W7qC_.js → spin--f5jNjBn.js} +0 -0
  174. /package/dist/{stata-C0yUiO47.js → stata-DoVloJLm.js} +0 -0
  175. /package/dist/{svelte-rtF4yNGL.js → svelte-tlbA11de.js} +0 -0
  176. /package/dist/{swift-CzvYoIM0.js → swift-BZn5eRnK.js} +0 -0
  177. /package/dist/{table-4ec9FVB_.js → table-CaUMjs4M.js} +0 -0
  178. /package/dist/{terraform-CD_BZGb-.js → terraform-c5-k7yB1.js} +0 -0
  179. /package/dist/{text-D1-vbZ7l.js → text-DPCGWvDK.js} +0 -0
  180. /package/dist/{toml-C6jUF0Xd.js → toml-DdLGBe1A.js} +0 -0
  181. /package/dist/{twig-C4dfP84J.js → twig-D_jzZxh6.js} +0 -0
  182. /package/dist/{typescript-Bk-pp-cK.js → typescript-B95hq2ns.js} +0 -0
  183. /package/dist/{typst-DPCpaVSH.js → typst-CSAEQ4yK.js} +0 -0
  184. /package/dist/{v-nRGMJ2Ki.js → v-BAhebuOB.js} +0 -0
  185. /package/dist/{vala-B78bKcY0.js → vala-RAu83-lp.js} +0 -0
  186. /package/dist/{verilog-CRpkl76S.js → verilog-BgmTn52U.js} +0 -0
  187. /package/dist/{vim-DpKnut7b.js → vim-c8oTCLkH.js} +0 -0
  188. /package/dist/{vue-D5eadhjo.js → vue-TGT6HTBA.js} +0 -0
  189. /package/dist/{xml-Dvx5F-hl.js → xml-C1HDr874.js} +0 -0
  190. /package/dist/{yaml-n1S8nAOh.js → yaml-BO7FjFQZ.js} +0 -0
  191. /package/dist/{zig-R-iFzxfW.js → zig-qANBp1SU.js} +0 -0
  192. /package/dist/{zoomIn-CEukuh3x.js → zoomIn-iVMAUxIz.js} +0 -0
  193. /package/dist/{zoomOut-qlzQyQli.js → zoomOut-Cxq1_dIQ.js} +0 -0
@@ -0,0 +1,327 @@
1
+ import { H as useContext, V as useControls, a as useMediumZoom, k as saveImage, u as useI18n } from "./composables-yny5gJo3.js";
2
+ import { t as button_default } from "./button-BQhuT7wh.js";
3
+ import { t as modal_default } from "./modal-Rc_RoeYA.js";
4
+ import { t as zoom_container_default } from "./zoom-container-B1qbA-7z.js";
5
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeStyle, openBlock, ref, toRefs, unref, watch, withCtx } from "vue";
6
+ import { useCycleList } from "@vueuse/core";
7
+
8
+ //#region node_modules/.pnpm/treechop@0.1.2/node_modules/treechop/dist/index.js
9
+ const DEFAULT_CHILDREN_KEY = "children";
10
+ function createTreeUtils(options = {}) {
11
+ const { childrenKey = DEFAULT_CHILDREN_KEY } = options;
12
+ return {
13
+ childrenKey,
14
+ getChildrenKey(node, meta) {
15
+ return typeof this.childrenKey === "function" ? this.childrenKey(node, meta) : this.childrenKey;
16
+ },
17
+ getChildren(node, meta) {
18
+ return node[this.getChildrenKey(node, meta)] || [];
19
+ },
20
+ hasChildren(node, meta) {
21
+ const children = this.getChildren(node, meta);
22
+ return Array.isArray(children) && children.length > 0;
23
+ }
24
+ };
25
+ }
26
+ function preOrderTraverse(tree, callback, utils) {
27
+ const result = [];
28
+ const traverse = (nodes, parents = [], depth = 0) => {
29
+ nodes.forEach((node, index) => {
30
+ const meta = {
31
+ depth,
32
+ index,
33
+ parents
34
+ };
35
+ result.push(callback(node, meta));
36
+ if (utils.hasChildren(node, meta)) traverse(utils.getChildren(node, meta), [...parents, node], depth + 1);
37
+ });
38
+ };
39
+ traverse(tree);
40
+ return result;
41
+ }
42
+ function postOrderTraverse(tree, callback, utils) {
43
+ const result = [];
44
+ const traverse = (nodes, parents = [], depth = 0) => {
45
+ nodes.forEach((node, index) => {
46
+ const meta = {
47
+ depth,
48
+ index,
49
+ parents
50
+ };
51
+ if (utils.hasChildren(node, meta)) traverse(utils.getChildren(node, meta), [...parents, node], depth + 1);
52
+ result.push(callback(node, meta));
53
+ });
54
+ };
55
+ traverse(tree);
56
+ return result;
57
+ }
58
+ function breadthTraverse(tree, callback, utils) {
59
+ const result = [];
60
+ const queue = tree.map((node, index) => [
61
+ node,
62
+ index,
63
+ [],
64
+ 0
65
+ ]);
66
+ while (queue.length) {
67
+ const [node, index, parents, depth] = queue.shift();
68
+ const meta = {
69
+ depth,
70
+ index,
71
+ parents
72
+ };
73
+ result.push(callback(node, meta));
74
+ if (utils.hasChildren(node, meta)) utils.getChildren(node, meta).forEach((child, childIndex) => {
75
+ queue.push([
76
+ child,
77
+ childIndex,
78
+ [...parents, node],
79
+ depth + 1
80
+ ]);
81
+ });
82
+ }
83
+ return result;
84
+ }
85
+ function treeFlatFilter(tree, predicate, options = {}) {
86
+ const { strategy = "pre" } = options;
87
+ const utils = createTreeUtils(options);
88
+ const callback = (node, meta) => {
89
+ return predicate(node, meta) ? node : null;
90
+ };
91
+ switch (strategy) {
92
+ case "post": return postOrderTraverse(tree, callback, utils).filter(Boolean);
93
+ case "breadth": return breadthTraverse(tree, callback, utils).filter(Boolean);
94
+ case "pre":
95
+ default: return preOrderTraverse(tree, callback, utils).filter(Boolean);
96
+ }
97
+ }
98
+
99
+ //#endregion
100
+ //#region src/components/image.vue?vue&type=script&setup=true&lang.ts
101
+ const _hoisted_1 = [
102
+ "src",
103
+ "alt",
104
+ "title"
105
+ ];
106
+ const _hoisted_2 = [
107
+ "src",
108
+ "alt",
109
+ "title"
110
+ ];
111
+ var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
112
+ __name: "image",
113
+ props: {
114
+ src: {
115
+ type: String,
116
+ required: false
117
+ },
118
+ alt: {
119
+ type: String,
120
+ required: false
121
+ },
122
+ title: {
123
+ type: String,
124
+ required: false
125
+ },
126
+ preview: {
127
+ type: Boolean,
128
+ required: false,
129
+ default: true
130
+ },
131
+ margin: {
132
+ type: Number,
133
+ required: false,
134
+ default: 16
135
+ },
136
+ controls: {
137
+ type: [Boolean, Object],
138
+ required: false,
139
+ default: true
140
+ }
141
+ },
142
+ emits: ["load", "error"],
143
+ setup(__props, { emit: __emit }) {
144
+ const props = __props;
145
+ const emits = __emit;
146
+ const { margin, controls } = toRefs(props);
147
+ const { t } = useI18n();
148
+ const { icons, parsedNodes } = useContext();
149
+ const { isControlEnabled, getControlValue } = useControls({ controls });
150
+ const imageNodes = computed(() => treeFlatFilter(parsedNodes.value, (node) => node.type === "image" && !node.loading));
151
+ const imageList = computed(() => [...new Set(imageNodes.value.map((node) => node.url))]);
152
+ const { state: imageSrc, prev, next } = useCycleList(imageList, {
153
+ initialValue: props.src,
154
+ fallbackIndex: 0
155
+ });
156
+ const enableDownload = computed(() => isControlEnabled("image.download"));
157
+ const enableCarousel = computed(() => isControlEnabled("image.carousel"));
158
+ const enableFlip = computed(() => isControlEnabled("image.flip"));
159
+ const enableRotate = computed(() => isControlEnabled("image.rotate"));
160
+ const controlPosition = computed(() => {
161
+ const position = getControlValue("image.controlPosition");
162
+ if (typeof position === "boolean") return "bottom-center";
163
+ return position || "bottom-center";
164
+ });
165
+ const loaded = ref(false);
166
+ const open = ref(false);
167
+ const scaleX = ref(1);
168
+ const scaleY = ref(1);
169
+ const rotate = ref(0);
170
+ const { isAnimating, elementRef, zoomElementRef: _zoomElementRef, elementStyle, zoomIn, zoomOut } = useMediumZoom({
171
+ margin,
172
+ open: () => open.value = true,
173
+ close: () => open.value = false
174
+ });
175
+ const imageStyle = computed(() => ({
176
+ transform: `
177
+ scaleX(${scaleX.value})
178
+ scaleY(${scaleY.value})
179
+ rotate(${rotate.value}deg)
180
+ `,
181
+ transition: "transform 0.3s ease",
182
+ ...elementStyle.value
183
+ }));
184
+ function handleLoad(event) {
185
+ loaded.value = true;
186
+ emits("load", event);
187
+ }
188
+ function handleError(event) {
189
+ emits("error", event);
190
+ }
191
+ function handleOpen() {
192
+ if (!props.preview || !elementRef.value || !loaded.value) return;
193
+ zoomIn();
194
+ }
195
+ function handleClose() {
196
+ if (isAnimating.value) return;
197
+ zoomOut();
198
+ }
199
+ function download() {
200
+ if (!imageSrc.value) return;
201
+ saveImage(imageSrc.value, props.alt);
202
+ }
203
+ function flipHorizontal() {
204
+ scaleX.value *= -1;
205
+ }
206
+ function flipVertical() {
207
+ scaleY.value *= -1;
208
+ }
209
+ function rotateLeft() {
210
+ rotate.value -= 90;
211
+ }
212
+ function rotateRight() {
213
+ rotate.value += 90;
214
+ }
215
+ watch(open, (data) => {
216
+ if (!data) {
217
+ scaleX.value = 1;
218
+ scaleY.value = 1;
219
+ rotate.value = 0;
220
+ if (props.src) imageSrc.value = props.src;
221
+ }
222
+ });
223
+ return (_ctx, _cache) => {
224
+ return openBlock(), createElementBlock(Fragment, null, [createElementVNode("img", {
225
+ ref_key: "elementRef",
226
+ ref: elementRef,
227
+ "data-stream-markdown": "image",
228
+ src: __props.src,
229
+ alt: __props.alt,
230
+ title: __props.title,
231
+ style: { transition: "transform 300ms cubic-bezier(0.2, 0, 0.2, 1)" },
232
+ loading: "lazy",
233
+ decoding: "async",
234
+ onLoad: handleLoad,
235
+ onError: handleError,
236
+ onClick: handleOpen
237
+ }, null, 40, _hoisted_1), createVNode(modal_default, {
238
+ open: open.value,
239
+ "onUpdate:open": _cache[2] || (_cache[2] = ($event) => open.value = $event),
240
+ transition: "",
241
+ "modal-style": { backgroundColor: "rgba(0, 0, 0, 0.45)" },
242
+ close: handleClose
243
+ }, {
244
+ default: withCtx(() => [createVNode(zoom_container_default, {
245
+ "control-size": "large",
246
+ position: controlPosition.value,
247
+ "container-style": {
248
+ width: "auto",
249
+ maxWidth: `calc(100% - ${props.margin * 2}px)`,
250
+ cursor: "grab"
251
+ },
252
+ onClick: handleClose
253
+ }, {
254
+ controls: withCtx((buttonProps) => [
255
+ unref(imageSrc) && enableDownload.value ? (openBlock(), createBlock(button_default, mergeProps({ key: 0 }, buttonProps, {
256
+ icon: unref(icons).download,
257
+ name: unref(t)("button.download"),
258
+ onClick: download
259
+ }), null, 16, ["icon", "name"])) : createCommentVNode("v-if", true),
260
+ imageList.value.length > 1 && enableCarousel.value ? (openBlock(), createBlock(button_default, mergeProps({ key: 1 }, buttonProps, {
261
+ icon: unref(icons).arrowLeft,
262
+ name: unref(t)("button.previous"),
263
+ onClick: _cache[0] || (_cache[0] = () => unref(prev)())
264
+ }), null, 16, ["icon", "name"])) : createCommentVNode("v-if", true),
265
+ imageList.value.length > 1 && enableCarousel.value ? (openBlock(), createBlock(button_default, mergeProps({ key: 2 }, buttonProps, {
266
+ icon: unref(icons).arrowRight || unref(icons).arrowLeft,
267
+ name: unref(t)("button.next"),
268
+ "button-style": { transform: unref(icons).arrowRight ? void 0 : "scaleX(-1)" },
269
+ onClick: _cache[1] || (_cache[1] = () => unref(next)())
270
+ }), null, 16, [
271
+ "icon",
272
+ "name",
273
+ "button-style"
274
+ ])) : createCommentVNode("v-if", true),
275
+ enableFlip.value ? (openBlock(), createBlock(button_default, mergeProps({ key: 3 }, buttonProps, {
276
+ icon: unref(icons).flipHorizontal,
277
+ name: unref(t)("button.flipX"),
278
+ onClick: flipHorizontal
279
+ }), null, 16, ["icon", "name"])) : createCommentVNode("v-if", true),
280
+ enableFlip.value ? (openBlock(), createBlock(button_default, mergeProps({ key: 4 }, buttonProps, {
281
+ icon: unref(icons).flipVertical || unref(icons).flipHorizontal,
282
+ name: unref(t)("button.flipY"),
283
+ "button-style": { rotate: unref(icons).flipVertical ? void 0 : "90deg" },
284
+ onClick: flipVertical
285
+ }), null, 16, [
286
+ "icon",
287
+ "name",
288
+ "button-style"
289
+ ])) : createCommentVNode("v-if", true),
290
+ enableRotate.value ? (openBlock(), createBlock(button_default, mergeProps({ key: 5 }, buttonProps, {
291
+ icon: unref(icons).rotateLeft,
292
+ name: unref(t)("button.rotateLeft"),
293
+ onClick: rotateLeft
294
+ }), null, 16, ["icon", "name"])) : createCommentVNode("v-if", true),
295
+ enableRotate.value ? (openBlock(), createBlock(button_default, mergeProps({ key: 6 }, buttonProps, {
296
+ icon: unref(icons).rotateRight || unref(icons).rotateLeft,
297
+ name: unref(t)("button.rotateRight"),
298
+ "button-style": { transform: unref(icons).rotateRight ? void 0 : "scaleX(-1)" },
299
+ onClick: rotateRight
300
+ }), null, 16, [
301
+ "icon",
302
+ "name",
303
+ "button-style"
304
+ ])) : createCommentVNode("v-if", true)
305
+ ]),
306
+ default: withCtx(() => [createElementVNode("img", {
307
+ ref_key: "_zoomElementRef",
308
+ ref: _zoomElementRef,
309
+ src: unref(imageSrc),
310
+ alt: __props.alt,
311
+ title: __props.title,
312
+ style: normalizeStyle(imageStyle.value)
313
+ }, null, 12, _hoisted_2)]),
314
+ _: 1
315
+ }, 8, ["position", "container-style"])]),
316
+ _: 1
317
+ }, 8, ["open"])], 64);
318
+ };
319
+ }
320
+ });
321
+
322
+ //#endregion
323
+ //#region src/components/image.vue
324
+ var image_default = image_vue_vue_type_script_setup_true_lang_default;
325
+
326
+ //#endregion
327
+ export { image_default as t };
package/dist/index.css CHANGED
@@ -43,18 +43,23 @@
43
43
  opacity: 0.5;
44
44
  }
45
45
 
46
- .stream-markdown .tippy-box {
46
+ .stream-markdown [data-stream-markdown='tooltip'] {
47
47
  background: var(--popover);
48
48
  color: var(--popover-foreground);
49
49
  border: 1px solid var(--border);
50
+ border-radius: 0.5rem;
51
+ z-index: 100;
50
52
  }
51
53
 
52
- .stream-markdown .tippy-arrow {
53
- color: var(--popover);
54
+ .stream-markdown [data-stream-markdown='tooltip-overlay'] {
55
+ padding-block: 0.25rem;
56
+ padding-inline: 0.5rem;
57
+ font-size: 0.875rem;
58
+ line-height: 1.25rem;
54
59
  }
55
60
 
56
- .stream-markdown .tippy-box > .tippy-svg-arrow {
57
- border-top-color: var(--popover);
61
+ .stream-markdown [data-stream-markdown='dropdown-overlay'] {
62
+ padding: 0.25rem;
58
63
  }
59
64
 
60
65
  .stream-markdown [data-stream-markdown='button'] {
@@ -78,10 +83,6 @@
78
83
  background-color: var(--accent);
79
84
  }
80
85
 
81
- .stream-markdown [data-stream-markdown='dropdown-overlay'] {
82
- padding: 0.25rem;
83
- }
84
-
85
86
  .stream-markdown [data-stream-markdown='error-component'] {
86
87
  display: inline-block;
87
88
  color: var(--muted-foreground);
@@ -144,15 +145,6 @@
144
145
  flex-shrink: 0;
145
146
  padding-inline: 1rem;
146
147
  padding-block: 0.5rem;
147
- background-color: color-mix(in oklab, var(--muted) 80%, transparent);
148
- color: var(--muted-foreground);
149
- border-bottom: 1px solid var(--border);
150
- }
151
-
152
- .stream-markdown [data-stream-markdown='modal-actions'] {
153
- display: flex;
154
- align-items: center;
155
- gap: 0.5rem;
156
148
  }
157
149
 
158
150
  .stream-markdown [data-stream-markdown='modal-body'] {
@@ -176,17 +168,6 @@
176
168
  transform: translateX(-50%);
177
169
  }
178
170
 
179
- .stream-markdown .typewriter-enter-from {
180
- opacity: 0;
181
- }
182
- .stream-markdown .typewriter-enter-active {
183
- transition: opacity var(--typewriter-transition-duration) ease-out;
184
- will-change: opacity;
185
- }
186
- .stream-markdown .typewriter-enter-to {
187
- opacity: 1;
188
- }
189
-
190
171
  .stream-markdown [data-stream-markdown='segmented'] {
191
172
  display: flex;
192
173
  align-items: center;
@@ -247,11 +228,6 @@
247
228
  line-height: 1.25rem;
248
229
  }
249
230
 
250
- .stream-markdown [data-stream-markdown='tooltip-overlay'] {
251
- padding-block: 0.25rem;
252
- padding-inline: 0.5rem;
253
- }
254
-
255
231
  .stream-markdown [data-stream-markdown='zoom-container'] {
256
232
  height: 100%;
257
233
  position: relative;
@@ -315,12 +291,6 @@
315
291
  color: var(--muted-foreground);
316
292
  }
317
293
 
318
- @media (max-width: 1024px) {
319
- .stream-markdown [data-stream-markdown='code-block-header'] {
320
- padding-inline: 0.75rem;
321
- }
322
- }
323
-
324
294
  .stream-markdown [data-stream-markdown='code-block-content'] {
325
295
  overflow: auto;
326
296
  }
@@ -328,11 +298,13 @@
328
298
  .stream-markdown [data-stream-markdown='code-block-header'] > :first-child {
329
299
  flex: 1;
330
300
  }
301
+
331
302
  .stream-markdown [data-stream-markdown='code-block-header'] > :last-child {
332
303
  flex: 1;
333
304
  display: flex;
334
305
  justify-content: flex-end;
335
306
  }
307
+
336
308
  .stream-markdown [data-stream-markdown='code-block-header'] > :nth-child(2) {
337
309
  position: absolute;
338
310
  left: 50%;
@@ -430,6 +402,15 @@
430
402
  line-height: 1.25rem;
431
403
  }
432
404
 
405
+ .stream-markdown [data-stream-markdown='image'] {
406
+ display: block;
407
+ height: auto;
408
+ max-width: 100%;
409
+ border-radius: 0.5rem;
410
+ object-fit: contain;
411
+ cursor: pointer;
412
+ }
413
+
433
414
  .stream-markdown [data-stream-markdown='image-figure'] {
434
415
  display: inline-block;
435
416
  }
@@ -439,14 +420,6 @@
439
420
  text-align: center;
440
421
  }
441
422
 
442
- .stream-markdown [data-stream-markdown='image'] {
443
- display: block;
444
- max-width: 100%;
445
- height: auto;
446
- object-fit: contain;
447
- border-radius: 0.5rem;
448
- }
449
-
450
423
  .stream-markdown [data-stream-markdown='image-caption'] {
451
424
  text-align: center;
452
425
  font-size: 0.875rem;
@@ -455,12 +428,13 @@
455
428
  }
456
429
 
457
430
  .stream-markdown [data-stream-markdown='image-mask'] {
458
- display: none;
431
+ opacity: 0;
459
432
  position: absolute;
460
433
  inset: 0;
461
434
  border-radius: 0.5rem;
462
435
  background-color: rgb(0 0 0 / 0.1);
463
436
  pointer-events: none;
437
+ transition: opacity var(--default-transition-duration) ease;
464
438
  }
465
439
 
466
440
  .stream-markdown [data-stream-markdown='image-download-button'] {
@@ -617,31 +591,37 @@
617
591
  padding: 1rem;
618
592
  }
619
593
 
594
+ @media (max-width: 1024px) {
595
+ .stream-markdown [data-stream-markdown='code-block-header'] {
596
+ padding-inline: 0.75rem;
597
+ }
598
+ .stream-markdown [data-stream-markdown='zoom-controls'] {
599
+ gap: 0;
600
+ }
601
+ }
602
+
603
+ .stream-markdown .typewriter-enter-from {
604
+ opacity: 0;
605
+ }
606
+ .stream-markdown .typewriter-enter-active {
607
+ transition: opacity var(--typewriter-transition-duration) ease-out;
608
+ will-change: opacity;
609
+ }
610
+ .stream-markdown .typewriter-enter-to {
611
+ opacity: 1;
612
+ }
613
+
620
614
  .stream-markdown .modal-enter-from,
621
615
  .stream-markdown .modal-leave-to {
622
616
  opacity: 0;
617
+ transform: scale(0.95);
623
618
  }
624
619
  .stream-markdown .modal-enter-active,
625
620
  .stream-markdown .modal-leave-active {
626
- transition: opacity var(--default-transition-duration) ease;
627
- }
628
-
629
- .stream-markdown .img-switch-enter-active,
630
- .stream-markdown .img-switch-leave-active {
631
621
  transition:
632
622
  opacity var(--default-transition-duration) ease,
633
623
  transform var(--default-transition-duration) ease;
634
624
  }
635
- .stream-markdown .img-switch-enter-from,
636
- .stream-markdown .img-switch-leave-to {
637
- opacity: 0;
638
- transform: translateY(6px);
639
- }
640
- .stream-markdown .img-switch-enter-to,
641
- .stream-markdown .img-switch-leave-from {
642
- opacity: 1;
643
- transform: translateY(0);
644
- }
645
625
 
646
626
  @keyframes spin {
647
627
  from {