vue-stream-markdown 0.0.0-alpha.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.
- package/LICENSE.md +21 -0
- package/README.md +96 -0
- package/dist/angular-Chs-UKBr.js +29 -0
- package/dist/angular-component-Cc_FANXU.js +29 -0
- package/dist/apache-COYnc6xR.js +35 -0
- package/dist/asciidoc-BabXBDAL.js +24 -0
- package/dist/assembly-CDqKhexW.js +35 -0
- package/dist/astro-C9kftzFG.js +28 -0
- package/dist/bash-Ce4pNIkV.js +27 -0
- package/dist/batch-CHQBRjFL.js +23 -0
- package/dist/bicep-8jxWtuBF.js +46 -0
- package/dist/blockquote-DFANmQEB.css +13 -0
- package/dist/blockquote-DdEg2gww.js +83 -0
- package/dist/button-BClRCjnc.js +5 -0
- package/dist/button-C12sn_G5.css +24 -0
- package/dist/button-D8xx1WIP.js +202 -0
- package/dist/c-FBUef746.js +25 -0
- package/dist/check-C4xOk8um.js +25 -0
- package/dist/chevron-down-cnOJ4h1g.js +25 -0
- package/dist/circle-alert-CLX-h5rZ.js +28 -0
- package/dist/clojure-BulUroSy.js +18 -0
- package/dist/cmake-CW3vz1Mo.js +35 -0
- package/dist/cobol-CIn3oFju.js +24 -0
- package/dist/code-CP6mPwkq.js +106 -0
- package/dist/code-D8LSp8rK.js +25 -0
- package/dist/code-NAXHb0o2.css +4 -0
- package/dist/code-block-C4D_QNTq.js +408 -0
- package/dist/code-block-D2zjJAww.css +57 -0
- package/dist/code-block-Dzw63Lki.js +9 -0
- package/dist/codeowners-CJggXF_b.js +27 -0
- package/dist/coffeescript-CBrVvzGY.js +23 -0
- package/dist/composables-qhB1h_ed.js +1567 -0
- package/dist/copy-Cabve0xf.js +31 -0
- package/dist/cpp-BTKeuyd-.js +31 -0
- package/dist/crystal-DyIYvZbm.js +24 -0
- package/dist/csharp-NqZ1vyF9.js +22 -0
- package/dist/css-BpR5Lajb.js +26 -0
- package/dist/csv-eCMFnKKK.js +24 -0
- package/dist/cue-TY97dGOQ.js +32 -0
- package/dist/d-NftUsdTd.js +24 -0
- package/dist/dart-DJpwZZbk.js +23 -0
- package/dist/database-aZwE71Px.js +24 -0
- package/dist/delete-BdWzKJCy.js +83 -0
- package/dist/delete-Ci7IJDoT.css +4 -0
- package/dist/diff-CYRzypaU.js +35 -0
- package/dist/docker-CxHBuukH.js +24 -0
- package/dist/download-Bnn7rtYw.js +24 -0
- package/dist/dropdown-Ca_PKF_d.js +5 -0
- package/dist/elixir-BKSxVc1h.js +24 -0
- package/dist/elm-DScuAf3X.js +24 -0
- package/dist/emphasis-BseYvUae.css +4 -0
- package/dist/emphasis-CTuGt1Ok.js +83 -0
- package/dist/en-US-Bfc50l3I.js +27 -0
- package/dist/env-CDAKsodl.js +24 -0
- package/dist/erlang-D2M1ZL3m.js +23 -0
- package/dist/error-component-BIPPxd-M.css +21 -0
- package/dist/error-component-CLEJmPmM.js +4 -0
- package/dist/error-component-CzarUjhh.js +61 -0
- package/dist/eye-CdeX8PhP.js +28 -0
- package/dist/fortran-CORyQ0wt.js +24 -0
- package/dist/fsharp-BJz_Jgpl.js +24 -0
- package/dist/git-DgrlTr1E.js +28 -0
- package/dist/gleam-t_xad9Kw.js +29 -0
- package/dist/go-Cvlh1xtL.js +24 -0
- package/dist/graphql-ApIm0mDD.js +24 -0
- package/dist/groovy-CaLnK8PV.js +23 -0
- package/dist/haml-MwijEO_6.js +35 -0
- package/dist/handlebars-CKdUPI9h.js +24 -0
- package/dist/haskell-NPOXEnck.js +24 -0
- package/dist/haxe-DyKBMsDE.js +23 -0
- package/dist/heading-2vpQQtTH.js +88 -0
- package/dist/heading-KxpVX3-u.css +30 -0
- package/dist/html-C5_wsY4-.css +5 -0
- package/dist/html-CMgES1dE.js +28 -0
- package/dist/html-DL0PcUXX.js +102 -0
- package/dist/http-B9FFNmUr.js +23 -0
- package/dist/image-B77jbMUB.css +46 -0
- package/dist/image-CMZAakWu.js +39 -0
- package/dist/image-heJSlrNv.js +215 -0
- package/dist/index.css +43 -0
- package/dist/index.d.ts +762 -0
- package/dist/index.js +18674 -0
- package/dist/inline-code-CBoqhfz7.js +81 -0
- package/dist/inline-code-Eo65bj3F.css +12 -0
- package/dist/inline-math-B4XO1wMP.js +110 -0
- package/dist/inline-math-DgBjIrPT.css +7 -0
- package/dist/java-iU-L9wJz.js +35 -0
- package/dist/javascript-DtnWdTFC.js +23 -0
- package/dist/jinja-CoWszo_D.js +24 -0
- package/dist/json-C80qKCnh.js +24 -0
- package/dist/julia-DG2BCBLx.js +35 -0
- package/dist/kdl-7twRfIlJ.js +40 -0
- package/dist/kotlin-BjrOgP7R.js +18 -0
- package/dist/latex-DIQfUvG8.js +24 -0
- package/dist/less-BJ1yEAWt.js +24 -0
- package/dist/link-BA_j8di3.css +12 -0
- package/dist/link-DOtoFtxu.js +107 -0
- package/dist/link-DeV4CQOB.js +24 -0
- package/dist/liquid-BqKFZ1wQ.js +24 -0
- package/dist/lisp-oekhB2ti.js +23 -0
- package/dist/list-BCiFKGaz.js +88 -0
- package/dist/list-CcVBNIly.css +11 -0
- package/dist/list-item-Y6Cphjrp.css +15 -0
- package/dist/list-item-p-OLUR_9.js +95 -0
- package/dist/log-D1XEqR9q.js +23 -0
- package/dist/lua-C5Q97-1D.js +28 -0
- package/dist/luau-BT8KwqZ2.js +28 -0
- package/dist/makefile-B4a0ciG4.js +28 -0
- package/dist/markdown-DvNyKsiJ.js +24 -0
- package/dist/marko-BzsIf6bg.js +18 -0
- package/dist/math-Byka28HI.js +110 -0
- package/dist/math-Cq89zpB6.css +11 -0
- package/dist/matlab-cMBkmDhQ.js +28 -0
- package/dist/maximize-4PIqBONS.js +25 -0
- package/dist/mermaid-8JIH2gkQ.js +24 -0
- package/dist/mermaid-C9ZUejzK.css +8 -0
- package/dist/mermaid-X0AFRzfF.js +203 -0
- package/dist/minimize-BJ8htyDF.js +25 -0
- package/dist/modal-CWdgVkH_.css +48 -0
- package/dist/modal-CuQR21UD.js +71 -0
- package/dist/modal-DcpxxDDX.js +3 -0
- package/dist/nextflow-DNmqU1xg.js +24 -0
- package/dist/nginx-DDfYF_rj.js +23 -0
- package/dist/nim-D9xEmy4k.js +24 -0
- package/dist/nix-BV1Deshw.js +18 -0
- package/dist/node-list-C9O-A1aZ.css +11 -0
- package/dist/node-list-CGr_EVtn.js +199 -0
- package/dist/node-list-lgY1wbfQ.js +3 -0
- package/dist/ocaml-BkFn4LL3.js +27 -0
- package/dist/paragraph-DYjqr_Sa.js +83 -0
- package/dist/paragraph-wRNmMYAI.css +6 -0
- package/dist/perl-BytUHDE7.js +24 -0
- package/dist/php-BImJJtNM.js +24 -0
- package/dist/postcss-CrZ9_0sT.js +18 -0
- package/dist/powershell-DYSGu7TM.js +23 -0
- package/dist/previewers-Drlf7IQF.js +10 -0
- package/dist/prisma-BhRvcOFY.js +24 -0
- package/dist/prolog-DuaCKek_.js +24 -0
- package/dist/properties-BbIJwuP-.js +24 -0
- package/dist/proto-CE0aVW11.js +18 -0
- package/dist/pug-B1-IC-Tc.js +24 -0
- package/dist/puppet-8nYquiMG.js +24 -0
- package/dist/python-DhRyfBrD.js +35 -0
- package/dist/r-Cjje17IA.js +28 -0
- package/dist/racket-Dx0gMnpg.js +28 -0
- package/dist/razor-DPht_bdD.js +24 -0
- package/dist/renderer-CZ41eK_V.js +43 -0
- package/dist/ruby-B8RxtCzI.js +24 -0
- package/dist/rust-Cjtli6yf.js +23 -0
- package/dist/sass-Dv3DMzjs.js +24 -0
- package/dist/scala-B7bZGKXq.js +24 -0
- package/dist/scheme-B2PsEdVN.js +24 -0
- package/dist/segmented-BEtO1eyl.js +69 -0
- package/dist/segmented-CWoQcX-H.js +6 -0
- package/dist/segmented-DLmggl-e.css +8 -0
- package/dist/shader-BZzu3zGr.js +24 -0
- package/dist/shiki-CMgjqKKu.css +20 -0
- package/dist/shiki-vToM7Pz1.js +114 -0
- package/dist/solidity-CLieFYpL.js +24 -0
- package/dist/spin-B2FU3Sx6.css +19 -0
- package/dist/spin-Bz4zGBEo.js +3 -0
- package/dist/spin-Ds5W7qC_.js +23 -0
- package/dist/stata-C0yUiO47.js +33 -0
- package/dist/strong-CvOjLZiq.js +83 -0
- package/dist/strong-DpeQmP2J.css +4 -0
- package/dist/svelte-rtF4yNGL.js +23 -0
- package/dist/swift-CzvYoIM0.js +24 -0
- package/dist/table-4ec9FVB_.js +59 -0
- package/dist/table-BWn_kG8W.css +19 -0
- package/dist/table-CJzlDdmv.css +34 -0
- package/dist/table-CZLbUHiJ.js +3 -0
- package/dist/table-DjkiVd9L.js +188 -0
- package/dist/terraform-CD_BZGb-.js +24 -0
- package/dist/text-D098eCyi.css +5 -0
- package/dist/text-D1-vbZ7l.js +23 -0
- package/dist/text-DuONUqRA.js +81 -0
- package/dist/thematic-break-C5zxgoE9.css +6 -0
- package/dist/thematic-break-CcNPEI9Y.js +81 -0
- package/dist/theme.css +67 -0
- package/dist/toml-C6jUF0Xd.js +24 -0
- package/dist/tooltip-Ac_2x9ps.js +4 -0
- package/dist/tooltip-DAngu9Wp.css +5 -0
- package/dist/tooltip-RiXixMIt.js +71 -0
- package/dist/twig-C4dfP84J.js +30 -0
- package/dist/typescript-Bk-pp-cK.js +23 -0
- package/dist/typst-DPCpaVSH.js +24 -0
- package/dist/v-nRGMJ2Ki.js +23 -0
- package/dist/vala-B78bKcY0.js +24 -0
- package/dist/vanilla-BZ8bn5Yz.css +4 -0
- package/dist/vanilla-CA9QO96X.js +3 -0
- package/dist/vanilla-DkX6g0dm.js +87 -0
- package/dist/verilog-CRpkl76S.js +23 -0
- package/dist/vim-DpKnut7b.js +24 -0
- package/dist/vue-D5eadhjo.js +23 -0
- package/dist/xml-Dvx5F-hl.js +24 -0
- package/dist/yaml-DJHrmzSe.js +94 -0
- package/dist/yaml-McBkYbxI.css +5 -0
- package/dist/yaml-n1S8nAOh.js +24 -0
- package/dist/zh-CN-CL1XGe0H.js +27 -0
- package/dist/zig-R-iFzxfW.js +24 -0
- package/dist/zoom-container-BDEP09K9.js +6 -0
- package/dist/zoom-container-BENM7TpV.css +28 -0
- package/dist/zoom-container-BfUO3Ocp.js +113 -0
- package/dist/zoomIn-CEukuh3x.js +28 -0
- package/dist/zoomOut-qlzQyQli.js +28 -0
- package/package.json +115 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createElementBlock, createElementVNode, markRaw, openBlock } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region ~icons/catppuccin/http
|
|
4
|
+
const _hoisted_1 = {
|
|
5
|
+
viewBox: "0 0 16 16",
|
|
6
|
+
width: "1.2em",
|
|
7
|
+
height: "1.2em"
|
|
8
|
+
};
|
|
9
|
+
function render(_ctx, _cache) {
|
|
10
|
+
return openBlock(), createElementBlock("svg", _hoisted_1, [..._cache[0] || (_cache[0] = [createElementVNode("g", {
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "#8aadf4",
|
|
13
|
+
"stroke-linecap": "round",
|
|
14
|
+
"stroke-linejoin": "round"
|
|
15
|
+
}, [createElementVNode("path", { d: "M14.5 8A6.5 6.5 0 0 1 8 14.5A6.5 6.5 0 0 1 1.5 8A6.5 6.5 0 0 1 8 1.5A6.5 6.5 0 0 1 14.5 8" }), createElementVNode("path", { d: "M8 1.5c1.67 2 2.5 4.17 2.5 6.5s-.83 4.5-2.5 6.5m0-13A9.96 9.96 0 0 0 5.5 8c0 2.33.83 4.5 2.5 6.5m-5.5-4h11m-11-5h11" })], -1)])]);
|
|
16
|
+
}
|
|
17
|
+
var http_default = markRaw({
|
|
18
|
+
name: "catppuccin-http",
|
|
19
|
+
render
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { http_default as default };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
.stream-markdown [data-stream-markdown="image-figure"] {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
}
|
|
4
|
+
.stream-markdown [data-stream-markdown="image-wrapper"] {
|
|
5
|
+
text-align: center;
|
|
6
|
+
position: relative;
|
|
7
|
+
}
|
|
8
|
+
.stream-markdown [data-stream-markdown="image"] {
|
|
9
|
+
object-fit: contain;
|
|
10
|
+
border-radius: .5rem;
|
|
11
|
+
max-width: 100%;
|
|
12
|
+
height: auto;
|
|
13
|
+
display: block;
|
|
14
|
+
}
|
|
15
|
+
.stream-markdown [data-stream-markdown="image-caption"] {
|
|
16
|
+
text-align: center;
|
|
17
|
+
font-size: .875rem;
|
|
18
|
+
font-style: italic;
|
|
19
|
+
line-height: 1.25rem;
|
|
20
|
+
}
|
|
21
|
+
.stream-markdown [data-stream-markdown="image-mask"] {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
background-color: #0000001a;
|
|
24
|
+
border-radius: .5rem;
|
|
25
|
+
display: none;
|
|
26
|
+
position: absolute;
|
|
27
|
+
inset: 0;
|
|
28
|
+
}
|
|
29
|
+
.stream-markdown [data-stream-markdown="image-download-button"] {
|
|
30
|
+
pointer-events: all;
|
|
31
|
+
position: absolute;
|
|
32
|
+
bottom: .5rem;
|
|
33
|
+
right: .5rem;
|
|
34
|
+
}
|
|
35
|
+
.stream-markdown .img-switch-enter-active, .stream-markdown .img-switch-leave-active {
|
|
36
|
+
transition: opacity var(--default-transition-duration) ease, transform var(--default-transition-duration) ease;
|
|
37
|
+
}
|
|
38
|
+
.stream-markdown .img-switch-enter-from, .stream-markdown .img-switch-leave-to {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transform: translateY(6px);
|
|
41
|
+
}
|
|
42
|
+
.stream-markdown .img-switch-enter-to, .stream-markdown .img-switch-leave-from {
|
|
43
|
+
opacity: 1;
|
|
44
|
+
transform: translateY(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createElementBlock, createElementVNode, markRaw, openBlock } from "vue";
|
|
2
|
+
|
|
3
|
+
//#region ~icons/lucide/image
|
|
4
|
+
const _hoisted_1 = {
|
|
5
|
+
viewBox: "0 0 24 24",
|
|
6
|
+
width: "1.2em",
|
|
7
|
+
height: "1.2em"
|
|
8
|
+
};
|
|
9
|
+
function render(_ctx, _cache) {
|
|
10
|
+
return openBlock(), createElementBlock("svg", _hoisted_1, [..._cache[0] || (_cache[0] = [createElementVNode("g", {
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
"stroke-linecap": "round",
|
|
14
|
+
"stroke-linejoin": "round",
|
|
15
|
+
"stroke-width": "2"
|
|
16
|
+
}, [
|
|
17
|
+
createElementVNode("rect", {
|
|
18
|
+
width: "18",
|
|
19
|
+
height: "18",
|
|
20
|
+
x: "3",
|
|
21
|
+
y: "3",
|
|
22
|
+
rx: "2",
|
|
23
|
+
ry: "2"
|
|
24
|
+
}),
|
|
25
|
+
createElementVNode("circle", {
|
|
26
|
+
cx: "9",
|
|
27
|
+
cy: "9",
|
|
28
|
+
r: "2"
|
|
29
|
+
}),
|
|
30
|
+
createElementVNode("path", { d: "m21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
31
|
+
], -1)])]);
|
|
32
|
+
}
|
|
33
|
+
var image_default = markRaw({
|
|
34
|
+
name: "lucide-image",
|
|
35
|
+
render
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { image_default as default };
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { O as save, R as useControls, g as useHardenSanitizers, j as ICONS, l as useI18n } from "./composables-qhB1h_ed.js";
|
|
2
|
+
import "./tooltip-RiXixMIt.js";
|
|
3
|
+
import { t as button_default } from "./button-D8xx1WIP.js";
|
|
4
|
+
import { t as error_component_default } from "./error-component-CzarUjhh.js";
|
|
5
|
+
import { t as spin_default } from "./spin-Ds5W7qC_.js";
|
|
6
|
+
import { Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, normalizeStyle, openBlock, ref, resolveDynamicComponent, toDisplayString, toRefs, unref, withCtx } from "vue";
|
|
7
|
+
|
|
8
|
+
//#region src/components/renderers/image.vue?vue&type=script&setup=true&lang.ts
|
|
9
|
+
const _hoisted_1 = { "data-stream-markdown": "image-wrapper" };
|
|
10
|
+
const _hoisted_2 = [
|
|
11
|
+
"src",
|
|
12
|
+
"alt",
|
|
13
|
+
"title"
|
|
14
|
+
];
|
|
15
|
+
const _hoisted_3 = {
|
|
16
|
+
key: 0,
|
|
17
|
+
"data-stream-markdown": "image-caption"
|
|
18
|
+
};
|
|
19
|
+
var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
20
|
+
__name: "image",
|
|
21
|
+
props: {
|
|
22
|
+
node: {
|
|
23
|
+
type: Object,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
markdownParser: {
|
|
27
|
+
type: Object,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
nodeRenderers: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
mediumZoom: {
|
|
35
|
+
type: Object,
|
|
36
|
+
required: true
|
|
37
|
+
},
|
|
38
|
+
indexKey: {
|
|
39
|
+
type: [Number, String],
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
getContainer: {
|
|
43
|
+
type: Function,
|
|
44
|
+
required: true
|
|
45
|
+
},
|
|
46
|
+
controls: {
|
|
47
|
+
type: [Boolean, Object],
|
|
48
|
+
required: false
|
|
49
|
+
},
|
|
50
|
+
previewers: {
|
|
51
|
+
type: [Boolean, Object],
|
|
52
|
+
required: false
|
|
53
|
+
},
|
|
54
|
+
shikiOptions: {
|
|
55
|
+
type: Object,
|
|
56
|
+
required: false
|
|
57
|
+
},
|
|
58
|
+
mermaidOptions: {
|
|
59
|
+
type: Object,
|
|
60
|
+
required: false
|
|
61
|
+
},
|
|
62
|
+
katexOptions: {
|
|
63
|
+
type: Object,
|
|
64
|
+
required: false
|
|
65
|
+
},
|
|
66
|
+
hardenOptions: {
|
|
67
|
+
type: Object,
|
|
68
|
+
required: false
|
|
69
|
+
},
|
|
70
|
+
codeOptions: {
|
|
71
|
+
type: Object,
|
|
72
|
+
required: false
|
|
73
|
+
},
|
|
74
|
+
imageOptions: {
|
|
75
|
+
type: Object,
|
|
76
|
+
required: false
|
|
77
|
+
},
|
|
78
|
+
isDark: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
required: false
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
setup(__props) {
|
|
84
|
+
const props = __props;
|
|
85
|
+
const fileExtensionPattern = /\.[^/.]+$/;
|
|
86
|
+
const { t } = useI18n();
|
|
87
|
+
const { controls, hardenOptions } = toRefs(props);
|
|
88
|
+
const { isControlEnabled } = useControls({ controls });
|
|
89
|
+
const imgRef = ref();
|
|
90
|
+
const maskRef = ref();
|
|
91
|
+
const loadError = ref(false);
|
|
92
|
+
const imageLoaded = ref(false);
|
|
93
|
+
const fallbackAttempted = ref(false);
|
|
94
|
+
const isLoading = computed(() => props.node.loading || !props.node.url);
|
|
95
|
+
const showDownload = computed(() => isControlEnabled("image.download"));
|
|
96
|
+
const fallback = computed(() => {
|
|
97
|
+
var _props$imageOptions;
|
|
98
|
+
return ((_props$imageOptions = props.imageOptions) === null || _props$imageOptions === void 0 ? void 0 : _props$imageOptions.fallback) ?? "";
|
|
99
|
+
});
|
|
100
|
+
const imageSrc = computed(() => loadError.value && fallback.value ? fallback.value : props.node.url);
|
|
101
|
+
const { transformedUrl, isHardenUrl } = useHardenSanitizers({
|
|
102
|
+
url: imageSrc,
|
|
103
|
+
hardenOptions,
|
|
104
|
+
loading: isLoading,
|
|
105
|
+
isImage: true
|
|
106
|
+
});
|
|
107
|
+
const alt = computed(() => String(props.node.alt ?? props.node.title ?? ""));
|
|
108
|
+
const title = computed(() => String(props.node.title ?? props.node.alt ?? ""));
|
|
109
|
+
const showCaption = computed(() => {
|
|
110
|
+
var _props$imageOptions2;
|
|
111
|
+
return (typeof ((_props$imageOptions2 = props.imageOptions) === null || _props$imageOptions2 === void 0 ? void 0 : _props$imageOptions2.caption) === "boolean" ? props.imageOptions.caption : true) && !isLoading.value && !!title.value;
|
|
112
|
+
});
|
|
113
|
+
const Error = computed(() => {
|
|
114
|
+
var _hardenOptions$value, _props$imageOptions3;
|
|
115
|
+
return isHardenUrl.value ? ((_hardenOptions$value = hardenOptions.value) === null || _hardenOptions$value === void 0 ? void 0 : _hardenOptions$value.errorComponent) ?? error_component_default : ((_props$imageOptions3 = props.imageOptions) === null || _props$imageOptions3 === void 0 ? void 0 : _props$imageOptions3.errorComponent) ?? error_component_default;
|
|
116
|
+
});
|
|
117
|
+
function handleLoaded() {
|
|
118
|
+
imageLoaded.value = true;
|
|
119
|
+
if (fallbackAttempted.value) return;
|
|
120
|
+
if (imgRef.value) props.mediumZoom.attach(imgRef.value);
|
|
121
|
+
}
|
|
122
|
+
function handleError() {
|
|
123
|
+
if (fallback.value && !fallbackAttempted.value) {
|
|
124
|
+
fallbackAttempted.value = true;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
loadError.value = true;
|
|
128
|
+
}
|
|
129
|
+
async function handleDownload() {
|
|
130
|
+
if (!imageSrc.value) return;
|
|
131
|
+
const blob = await (await fetch(imageSrc.value)).blob();
|
|
132
|
+
const originalFilename = new URL(imageSrc.value, window.location.origin).pathname.split("/").pop() || "";
|
|
133
|
+
const extension = originalFilename.split(".").pop();
|
|
134
|
+
const hasExtension = originalFilename.includes(".") && extension !== void 0 && extension.length <= 4;
|
|
135
|
+
let filename = "";
|
|
136
|
+
if (hasExtension) filename = originalFilename;
|
|
137
|
+
else {
|
|
138
|
+
const mimeType = blob.type;
|
|
139
|
+
let fileExtension = "png";
|
|
140
|
+
if (mimeType.includes("jpeg") || mimeType.includes("jpg")) fileExtension = "jpg";
|
|
141
|
+
else if (mimeType.includes("png")) fileExtension = "png";
|
|
142
|
+
else if (mimeType.includes("svg")) fileExtension = "svg";
|
|
143
|
+
else if (mimeType.includes("gif")) fileExtension = "gif";
|
|
144
|
+
else if (mimeType.includes("webp")) fileExtension = "webp";
|
|
145
|
+
filename = `${(alt.value || originalFilename || "image").replace(fileExtensionPattern, "")}.${fileExtension}`;
|
|
146
|
+
}
|
|
147
|
+
save(filename, blob, blob.type);
|
|
148
|
+
}
|
|
149
|
+
function handleMouseEnter() {
|
|
150
|
+
if (maskRef.value) maskRef.value.style.display = "block";
|
|
151
|
+
}
|
|
152
|
+
function handleMouseLeave() {
|
|
153
|
+
if (maskRef.value) maskRef.value.style.display = "none";
|
|
154
|
+
}
|
|
155
|
+
return (_ctx, _cache) => {
|
|
156
|
+
return openBlock(), createElementBlock("figure", {
|
|
157
|
+
"data-stream-markdown": "image-figure",
|
|
158
|
+
style: normalizeStyle({ width: isLoading.value || !imageLoaded.value ? "100%" : "auto" }),
|
|
159
|
+
onMouseenter: handleMouseEnter,
|
|
160
|
+
onMouseleave: handleMouseLeave
|
|
161
|
+
}, [createElementVNode("div", _hoisted_1, [!unref(isHardenUrl) ? (openBlock(), createElementBlock("div", {
|
|
162
|
+
key: 0,
|
|
163
|
+
ref_key: "maskRef",
|
|
164
|
+
ref: maskRef,
|
|
165
|
+
"data-stream-markdown": "image-mask"
|
|
166
|
+
}, [!isLoading.value && showDownload.value ? (openBlock(), createBlock(button_default, {
|
|
167
|
+
key: 0,
|
|
168
|
+
"data-stream-markdown": "image-download-button",
|
|
169
|
+
icon: unref(ICONS).download,
|
|
170
|
+
name: unref(t)("button.download"),
|
|
171
|
+
"icon-class": "test",
|
|
172
|
+
"icon-width": 16,
|
|
173
|
+
"icon-height": 16,
|
|
174
|
+
"button-style": { backgroundColor: "color-mix(in oklab, var(--background) 90%, transparent)" },
|
|
175
|
+
onClick: handleDownload
|
|
176
|
+
}, null, 8, ["icon", "name"])) : createCommentVNode("v-if", true)], 512)) : createCommentVNode("v-if", true), createVNode(Transition, {
|
|
177
|
+
name: "img-switch",
|
|
178
|
+
mode: "out-in"
|
|
179
|
+
}, {
|
|
180
|
+
default: withCtx(() => [!isLoading.value && !unref(isHardenUrl) && typeof unref(transformedUrl) === "string" ? (openBlock(), createElementBlock("img", {
|
|
181
|
+
ref_key: "imgRef",
|
|
182
|
+
ref: imgRef,
|
|
183
|
+
key: unref(transformedUrl),
|
|
184
|
+
"data-stream-markdown": "image",
|
|
185
|
+
src: unref(transformedUrl),
|
|
186
|
+
alt: alt.value,
|
|
187
|
+
title: title.value,
|
|
188
|
+
style: normalizeStyle({
|
|
189
|
+
opacity: isLoading.value ? 0 : 1,
|
|
190
|
+
cursor: isLoading.value ? "default" : "pointer"
|
|
191
|
+
}),
|
|
192
|
+
loading: "lazy",
|
|
193
|
+
decoding: "async",
|
|
194
|
+
"data-zoomable": "",
|
|
195
|
+
onLoad: handleLoaded,
|
|
196
|
+
onError: handleError
|
|
197
|
+
}, null, 44, _hoisted_2)) : (isLoading.value || !imageLoaded.value) && !unref(isHardenUrl) ? (openBlock(), createBlock(spin_default, { key: 1 })) : (openBlock(), createBlock(resolveDynamicComponent(Error.value), mergeProps({
|
|
198
|
+
key: 2,
|
|
199
|
+
variant: unref(isHardenUrl) ? "harden-image" : "image"
|
|
200
|
+
}, props), {
|
|
201
|
+
default: withCtx(() => [createTextVNode(toDisplayString(title.value), 1)]),
|
|
202
|
+
_: 1
|
|
203
|
+
}, 16, ["variant"]))]),
|
|
204
|
+
_: 1
|
|
205
|
+
})]), showCaption.value && title.value ? (openBlock(), createElementBlock("figcaption", _hoisted_3, toDisplayString(title.value), 1)) : createCommentVNode("v-if", true)], 36);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region src/components/renderers/image.vue
|
|
212
|
+
var image_default = image_vue_vue_type_script_setup_true_lang_default;
|
|
213
|
+
|
|
214
|
+
//#endregion
|
|
215
|
+
export { image_default as default };
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.stream-markdown {
|
|
2
|
+
--default-transition-duration: .15s;
|
|
3
|
+
--typewriter-transition-duration: .9s;
|
|
4
|
+
--font-sans: "Geist", "Geist Fallback", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
5
|
+
--font-serif: "Geist", "Geist Fallback", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
|
|
6
|
+
--font-mono: "Geist Mono", "Geist Mono Fallback", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
7
|
+
--radius: .5rem;
|
|
8
|
+
font-family: var(--font-sans);
|
|
9
|
+
color: var(--foreground);
|
|
10
|
+
}
|
|
11
|
+
.stream-markdown * {
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
border: 0 solid;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
}
|
|
17
|
+
.stream-markdown .tippy-box {
|
|
18
|
+
background: var(--popover);
|
|
19
|
+
color: var(--popover-foreground);
|
|
20
|
+
border: 1px solid var(--border);
|
|
21
|
+
}
|
|
22
|
+
.stream-markdown .tippy-arrow {
|
|
23
|
+
color: var(--popover);
|
|
24
|
+
}
|
|
25
|
+
.stream-markdown .tippy-box > .tippy-svg-arrow {
|
|
26
|
+
border-top-color: var(--popover);
|
|
27
|
+
}
|
|
28
|
+
.stream-markdown ::-webkit-scrollbar {
|
|
29
|
+
width: 6px;
|
|
30
|
+
height: 6px;
|
|
31
|
+
}
|
|
32
|
+
.stream-markdown ::-webkit-scrollbar-track {
|
|
33
|
+
background: none;
|
|
34
|
+
}
|
|
35
|
+
.stream-markdown ::-webkit-scrollbar-thumb {
|
|
36
|
+
background: var(--border);
|
|
37
|
+
border-radius: 3px;
|
|
38
|
+
}
|
|
39
|
+
.stream-markdown ::-webkit-scrollbar-thumb:hover {
|
|
40
|
+
background: var(--border);
|
|
41
|
+
opacity: .5;
|
|
42
|
+
}
|
|
43
|
+
|