markstream-vue 0.0.8-beta.2 → 0.0.8
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/dist/exports.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +13 -7
- package/dist/index.js +1 -1
- package/dist/index.px.css +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/index2.js +1 -1
- package/dist/index3.js +1 -1
- package/dist/index4.js +1 -1
- package/dist/index5.js +1 -1
- package/dist/index6.js +1 -1
- package/dist/index7.js +1 -1
- package/dist/safeRaf.js +1 -1
- package/dist/tailwind.ts +0 -0
- package/package.json +17 -11
package/dist/index6.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=(e,o,t)=>new Promise((n,r)=>{var l=e=>{try{i(t.next(e))}catch(o){r(o)}},a=e=>{try{i(t.throw(e))}catch(o){r(o)}},i=e=>e.done?n(e.value):Promise.resolve(e.value).then(l,a);i((t=t.apply(e,o)).next())});import{defineComponent as o,ref as t,computed as n,watch as r,nextTick as l,onMounted as a,onBeforeUnmount as i,createElementBlock as s,openBlock as u,normalizeClass as c,createCommentVNode as d,withDirectives as h,createBlock as v,renderSlot as g,createElementVNode as w,unref as m,toDisplayString as p,normalizeStyle as x,vShow as y,Teleport as C,createVNode as f,Transition as k,withCtx as b,withModifiers as M}from"vue";import{u as B,s as F,h as D,_ as j}from"./exports.js";const T=()=>import("@antv/infographic");let $=null,E=T;const z={key:0},L={key:1,class:"flex items-center gap-x-2 overflow-hidden"},Z=["src"],H={key:2},I={class:"flex items-center gap-x-1"},P={class:"flex items-center gap-x-1"},_={key:4},X={key:5,class:"flex items-center gap-x-1"},O=["aria-pressed"],S={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},V={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Y=["disabled"],R=["disabled"],U={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},G={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},N={key:1,class:"relative"},q={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},A={class:"flex items-center gap-2 backdrop-blur rounded-lg"},J={class:"markstream-vue"},K={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},Q=/* @__PURE__ */j(/* @__PURE__ */o({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(o,{emit:j}){const Q=o,{t:W}=B(),ee=t(!1),oe=t(!1),te=t(),ne=t(!1),re=t("360px"),le=t(!1),ae=t(),ie=t(null),se=t(1),ue=t(0),ce=t(0),de=t(!1),he=t({x:0,y:0}),ve=n(()=>Q.node.code);function ge(e){return!e||e.disabled}function we(e,o,t="top"){if(ge(e.currentTarget))return;const n=e,r=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;F(e.currentTarget,o,t,!1,r,Q.isDark)}function me(){D()}function pe(e){if(ge(e.currentTarget))return;const o=ee.value?W("common.copied")||"Copied":W("common.copy")||"Copy",t=e,n=null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0;F(e.currentTarget,o,"top",!1,n,Q.isDark)}function xe(){return e(this,null,function*(){try{const e=ve.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),ee.value=!0,setTimeout(()=>{ee.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function ye(e){ne.value="source"===e}function Ce(){var o;const t=null==(o=te.value)?void 0:o.querySelector("svg");t?function(o){e(this,null,function*(){try{const t=(new XMLSerializer).serializeToString(o),n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(n);if("undefined"!=typeof document){const o=document.createElement("a");o.href=r,o.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch(e){}URL.revokeObjectURL(r)}}catch(t){console.error("Failed to export SVG:",t)}})}(t):console.error("SVG element not found")}function fe(e){"Escape"===e.key&&le.value&&ke()}function ke(){if(le.value=!1,ae.value&&(ae.value.innerHTML=""),ie.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",fe)}catch(e){}}function be(){!function(){if(le.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",fe)}catch(e){}l(()=>{if(te.value&&ae.value){ae.value.innerHTML="";const e=document.createElement("div");e.style.transition="transform 0.1s ease",e.style.transformOrigin="center center",e.style.width="100%",e.style.height="100%",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center";const o=te.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),ae.value.appendChild(e),ie.value=e,e.style.transform=`translate(${ue.value}px, ${ce.value}px) scale(${se.value})`}})}()}function Me(){se.value<3&&(se.value+=.1)}function Be(){se.value>.5&&(se.value-=.1)}function Fe(){se.value=1,ue.value=0,ce.value=0}function De(e){de.value=!0,e instanceof MouseEvent?he.value={x:e.clientX-ue.value,y:e.clientY-ce.value}:he.value={x:e.touches[0].clientX-ue.value,y:e.touches[0].clientY-ce.value}}function je(e){if(!de.value)return;let o,t;e instanceof MouseEvent?(o=e.clientX,t=e.clientY):(o=e.touches[0].clientX,t=e.touches[0].clientY),ue.value=o-he.value.x,ce.value=t-he.value.y}function Te(){de.value=!1}let $e=null;function Ee(){return e(this,null,function*(){var o;if(te.value)try{const t=yield function(){return e(this,null,function*(){if($)return $;const e=E;if(!e)return null;let o;try{o=yield e()}catch(n){if(e===T)throw new Error('Optional dependency "@antv/infographic" is not installed. Please install it to enable infographic diagrams.');throw n}if(!o)return null;const t=o&&o.default?o.default:o;return $="function"==typeof t&&t.prototype&&t.prototype.render?t:o.Infographic?o.Infographic:t&&t.Infographic?t.Infographic:t,$})}();if(!t)return void console.warn("Infographic library failed to load.");$e&&(null==(o=$e.destroy)||o.call($e),$e=null),te.value.innerHTML="",$e=new t({container:te.value,width:"100%",height:"100%"}),$e.render(ve.value),l(()=>{if(te.value){const e=te.value.scrollHeight;e>0&&(re.value=`${Math.min(e,800)}px`)}})}catch(t){console.error("Failed to render infographic:",t),te.value&&(te.value.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${t instanceof Error?t.message:"Unknown error"}</div>`)}})}r(()=>ve.value,()=>{ne.value||oe.value||l(()=>{Ee()})}),r(()=>ne.value,e=>{e||oe.value||l(()=>{Ee()})}),r(()=>oe.value,e=>{e||ne.value||l(()=>{Ee()})}),a(()=>{ne.value||oe.value||l(()=>{Ee()})}),i(()=>{var e;if($e&&(null==(e=$e.destroy)||e.call($e),$e=null),"undefined"!=typeof window)try{window.removeEventListener("keydown",fe)}catch(o){}});const ze=n(()=>Q.isDark?"infographic-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"infographic-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700"),Le=n(()=>ne.value||oe.value),Ze=n(()=>({transform:`translate(${ue.value}px, ${ce.value}px) scale(${se.value})`}));return r(Ze,e=>{le.value&&ie.value&&(ie.value.style.transform=e.transform)}),(e,o)=>(u(),s("div",{class:c(["my-4 rounded-lg border overflow-hidden shadow-sm",[Q.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":Q.loading}]])},[Q.showHeader?(u(),s("div",{key:0,class:c(["infographic-block-header flex justify-between items-center px-4 py-2.5 border-b",Q.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"])},[e.$slots["header-left"]?(u(),s("div",z,[g(e.$slots,"header-left",{},void 0,!0)])):(u(),s("div",L,[w("img",{src:m("data:image/svg+xml,%3csvg%20width='15.52'%20height='16'%20viewBox='0%200%20291%20300'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%3e%3cpath%20d='M140.904%20239.376C128.83%20239.683%20119.675%20239.299%20115.448%20243.843C110.902%20248.07%20111.288%20257.227%20110.979%20269.302C111.118%20274.675%20111.118%20279.478%20111.472%20283.52C111.662%20285.638%20111.95%20287.547%20112.406%20289.224C112.411%20289.243%20112.416%20289.259%20112.422%20289.28C112.462%20289.419%20112.496%20289.558%20112.539%20289.691C113.168%20291.787%20114.088%20293.491%20115.446%20294.758C116.662%20296.064%20118.283%20296.963%20120.264%20297.59C120.36%20297.614%20120.464%20297.646%20120.555%20297.675C120.56%20297.68%20120.56%20297.68%20120.566%20297.68C120.848%20297.768%20121.142%20297.846%20121.443%20297.923C121.454%20297.923%20121.464%20297.928%20121.478%20297.934C122.875%20298.272%20124.424%20298.507%20126.11%20298.678C126.326%20298.696%20126.542%20298.718%20126.763%20298.739C130.79%20299.086%20135.558%20299.088%20140.904%20299.222C152.974%20298.912%20162.128%20299.302%20166.36%20294.758C170.904%20290.526%20170.515%20281.371%20170.824%20269.302C170.515%20257.227%20170.907%20248.07%20166.36%20243.843C162.131%20239.299%20152.974%20239.683%20140.904%20239.376Z'%20fill='%23FF6376'%3e%3c/path%3e%3cpath%20d='M21.2155%20128.398C12.6555%20128.616%206.16484%20128.339%203.16751%20131.56C-0.0538222%20134.56%200.218178%20141.054%20-0.000488281%20149.608C0.218178%20158.168%20-0.0538222%20164.659%203.16751%20167.656C6.16484%20170.878%2012.6555%20170.606%2021.2155%20170.824C25.0262%20170.726%2028.4288%20170.726%2031.2955%20170.475C32.7968%20170.342%2034.1488%20170.136%2035.3382%20169.814C35.3542%20169.811%2035.3648%20169.806%2035.3782%20169.803C35.4768%20169.774%2035.5755%20169.747%2035.6688%20169.718C37.1568%20169.272%2038.3648%20168.622%2039.2635%20167.656C40.1915%20166.795%2040.8262%20165.646%2041.2715%20164.243C41.2875%20164.174%2041.3115%20164.102%2041.3328%20164.035C41.3328%20164.035%2041.3355%20164.032%2041.3355%20164.027C41.3968%20163.827%2041.4529%20163.622%2041.5062%20163.406C41.5062%20163.398%2041.5115%20163.392%2041.5142%20163.382C41.7542%20162.392%2041.9222%20161.294%2042.0422%20160.096C42.0555%20159.944%2042.0715%20159.792%2042.0848%20159.635C42.3328%20156.779%2042.3328%20153.398%2042.4262%20149.608C42.2075%20141.054%2042.4848%20134.56%2039.2635%20131.56C36.2635%20128.339%2029.7728%20128.616%2021.2155%20128.398Z'%20fill='%23FFCCCC'%3e%3c/path%3e%3cpath%20d='M81.0595%20184.171C70.8568%20184.433%2063.1208%20184.102%2059.5475%20187.942C55.7075%20191.518%2056.0328%20199.254%2055.7742%20209.454C56.0328%20219.657%2055.7075%20227.393%2059.5475%20230.963C63.1208%20234.803%2070.8568%20234.478%2081.0595%20234.739C85.6008%20234.622%2089.6595%20234.622%2093.0728%20234.323C94.8648%20234.163%2096.4755%20233.921%2097.8942%20233.534C97.9102%20233.529%2097.9235%20233.526%2097.9422%20233.521C98.0568%20233.486%2098.1742%20233.457%2098.2888%20233.422C100.06%20232.889%20101.5%20232.113%20102.569%20230.963C103.676%20229.937%20104.433%20228.566%20104.964%20226.894C104.985%20226.811%20105.012%20226.726%20105.036%20226.646C105.041%20226.643%20105.041%20226.643%20105.041%20226.638C105.116%20226.401%20105.18%20226.153%20105.244%20225.897C105.244%20225.889%20105.249%20225.881%20105.254%20225.867C105.54%20224.689%20105.74%20223.379%20105.881%20221.953C105.9%20221.771%20105.916%20221.59%20105.934%20221.403C106.228%20218.001%20106.228%20213.969%20106.342%20209.454C106.081%20199.254%20106.412%20191.518%20102.572%20187.942C98.9955%20184.102%2091.2568%20184.433%2081.0595%20184.171Z'%20fill='%23FF939F'%3e%3c/path%3e%3cpath%20d='M260.591%20151.87C215.652%20151.87%20203.02%20164.523%20203.02%20209.462H198.476C198.476%20164.523%20185.836%20151.881%20140.895%20151.881V147.337C185.836%20147.337%20198.487%20134.705%20198.487%2089.7659H203.02C203.02%20134.705%20215.652%20147.337%20260.591%20147.337V151.87ZM286.052%20124.158C281.82%20119.614%20272.66%20120.001%20260.591%20119.689C248.521%20119.385%20239.361%20119.771%20235.129%20115.227C230.585%20110.995%20230.983%20101.846%20230.671%2089.7659C230.513%2083.7312%20230.535%2078.4272%20230.023%2074.1019C229.513%2069.7659%20228.481%2066.4219%20226.209%2064.3046C221.967%2059.7606%20212.817%2060.1472%20200.748%2059.8459C188.681%2060.1472%20179.519%2059.7606%20175.287%2064.3046C170.753%2068.5366%20171.129%2077.6966%20170.828%2089.7659C170.516%20101.835%20170.9%20110.995%20166.356%20115.227C162.124%20119.771%20152.985%20119.374%20140.905%20119.689C138.873%20119.739%20136.924%20119.771%20135.071%20119.811C119.313%20118.697%20106.337%20112.318%20106.337%2089.7659C106.212%2084.6699%20106.233%2080.1792%20105.807%2076.5206C105.367%2072.8726%20104.492%2070.0379%20102.575%2068.2566C99.0013%2064.4112%2091.2573%2064.7446%2081.0653%2064.4832C70.86%2064.7446%2063.1186%2064.4112%2059.5533%2068.2566C55.708%2071.8299%2056.0306%2079.5632%2055.7693%2089.7659C56.0306%2099.9686%2055.708%20107.702%2059.5533%20111.278C63.1186%20115.113%2070.86%20114.79%2081.0653%20115.049C103.617%20115.049%20109.996%20128.035%20111.1%20143.803C111.068%20145.659%20111.028%20147.587%20110.975%20149.619C111.121%20154.987%20111.121%20159.79%20111.476%20163.835C111.663%20165.95%20111.945%20167.857%20112.404%20169.534C112.412%20169.555%20112.412%20169.566%20112.423%20169.598C112.465%20169.734%20112.497%20169.867%20112.537%20170.003C113.164%20172.099%20114.092%20173.809%20115.447%20175.07C116.665%20176.371%20118.281%20177.278%20120.271%20177.905C120.364%20177.934%20120.46%20177.955%20120.564%20177.987C120.855%20178.081%20121.145%20178.153%20121.439%20178.238C121.46%20178.238%20121.471%20178.238%20121.479%20178.249C122.876%20178.582%20124.42%20178.822%20126.108%20178.987C126.327%20179.009%20126.545%20179.03%20126.764%20179.051C130.788%20179.395%20135.559%20179.395%20140.905%20179.529C152.975%20179.843%20162.124%20179.457%20166.356%20184.001C170.9%20188.233%20170.516%20197.371%20170.828%20209.451C171.129%20221.529%20170.743%20230.681%20175.287%20234.91C179.519%20239.454%20188.681%20239.07%20200.748%20239.371C206.127%20239.235%20210.921%20239.235%20214.975%20238.881C217.079%20238.694%20218.985%20238.403%20220.676%20237.955C220.695%20237.945%20220.705%20237.934%20220.727%20237.934C220.873%20237.891%20220.999%20237.859%20221.135%20237.819C223.228%20237.193%20224.937%20236.265%20226.209%20234.91C227.511%20233.691%20228.409%20232.065%20229.044%20230.097C229.065%20230.003%20229.095%20229.899%20229.127%20229.803V229.793C229.22%20229.513%20229.295%20229.222%20229.367%20228.918C229.367%20228.897%20229.377%20228.897%20229.377%20228.878C229.721%20227.481%20229.951%20225.937%20230.127%20224.249C230.137%20224.03%20230.169%20223.811%20230.191%20223.593C230.535%20219.571%20230.535%20214.798%20230.671%20209.451C230.972%20197.371%20230.585%20188.233%20235.129%20184.001C239.361%20179.457%20248.511%20179.843%20260.591%20179.529C272.66%20179.227%20281.82%20179.614%20286.052%20175.07C290.596%20170.838%20290.209%20161.689%20290.511%20149.619C290.209%20137.539%20290.596%20128.379%20286.052%20124.158Z'%20fill='%23FF356A'%3e%3c/path%3e%3cpath%20d='M112.405%2049.848C112.411%2049.8694%20112.416%2049.8827%20112.421%2049.904C112.461%2050.0427%20112.499%2050.1814%20112.539%2050.3147C113.171%2052.4134%20114.088%2054.1147%20115.448%2055.384C116.661%2056.6907%20118.283%2057.5894%20120.264%2058.2134C120.36%2058.24%20120.464%2058.2694%20120.555%2058.3014C120.56%2058.3067%20120.56%2058.3067%20120.565%2058.3067C120.848%2058.3947%20121.141%2058.4694%20121.443%2058.5467C121.453%2058.5467%20121.464%2058.552%20121.48%2058.5574C122.875%2058.896%20124.424%2059.1334%20126.112%2059.3014C126.325%2059.3227%20126.541%2059.3414%20126.763%2059.3627C130.789%2059.712%20135.56%2059.712%20140.904%2059.8454C152.973%2059.5387%20162.128%2059.928%20166.36%2055.384C170.907%2051.152%20170.515%2041.9947%20170.824%2029.9254C170.517%2017.8507%20170.907%208.69602%20166.363%204.46935C162.131%20-0.0746511%20152.973%200.309349%20140.904%201.52588e-05C128.829%200.309349%20119.675%20-0.0746511%20115.448%204.46935C110.904%208.69602%20111.288%2017.8507%20110.979%2029.9254C111.117%2035.3014%20111.117%2040.1014%20111.472%2044.144C111.661%2046.2614%20111.949%2048.1707%20112.405%2049.848Z'%20fill='%23FF6376'%3e%3c/path%3e%3c/g%3e%3c/svg%3e"),class:"w-4 h-4 my-0",alt:"Infographic"},null,8,Z),w("span",{class:c(["text-sm font-medium font-mono truncate",Q.isDark?"text-gray-400":"text-gray-600"])},"Infographic",2)])),e.$slots["header-center"]?(u(),s("div",H,[g(e.$slots,"header-center",{},void 0,!0)])):Q.showModeToggle?(u(),s("div",{key:3,class:c(["flex items-center gap-x-1 rounded-md p-0.5",Q.isDark?"bg-gray-700":"bg-gray-100"])},[w("button",{class:c(["px-2.5 py-1 text-xs rounded transition-colors",[ne.value?Q.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":Q.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"]]),onClick:o[0]||(o[0]=()=>ye("preview")),onMouseenter:o[1]||(o[1]=e=>we(e,m(W)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>we(e,m(W)("common.preview")||"Preview")),onMouseleave:me,onBlur:me},[w("div",I,[o[21]||(o[21]=w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),w("circle",{cx:"12",cy:"12",r:"3"})])],-1)),w("span",null,p(m(W)("common.preview")||"Preview"),1)])],34),w("button",{class:c(["px-2.5 py-1 text-xs rounded transition-colors",[ne.value?Q.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":Q.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"]]),onClick:o[3]||(o[3]=()=>ye("source")),onMouseenter:o[4]||(o[4]=e=>we(e,m(W)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>we(e,m(W)("common.source")||"Source")),onMouseleave:me,onBlur:me},[w("div",P,[o[22]||(o[22]=w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),w("span",null,p(m(W)("common.source")||"Source"),1)])],34)],2)):d("",!0),e.$slots["header-right"]?(u(),s("div",_,[g(e.$slots,"header-right",{},void 0,!0)])):(u(),s("div",X,[Q.showCollapseButton?(u(),s("button",{key:0,class:c(ze.value),"aria-pressed":oe.value,onClick:o[6]||(o[6]=e=>oe.value=!oe.value),onMouseenter:o[7]||(o[7]=e=>we(e,oe.value?m(W)("common.expand")||"Expand":m(W)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>we(e,oe.value?m(W)("common.expand")||"Expand":m(W)("common.collapse")||"Collapse")),onMouseleave:me,onBlur:me},[(u(),s("svg",{style:x({rotate:oe.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...o[23]||(o[23]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],42,O)):d("",!0),Q.showCopyButton?(u(),s("button",{key:1,class:c(ze.value),onClick:xe,onMouseenter:o[9]||(o[9]=e=>pe(e)),onFocus:o[10]||(o[10]=e=>pe(e)),onMouseleave:me,onBlur:me},[ee.value?(u(),s("svg",V,[...o[25]||(o[25]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(u(),s("svg",S,[...o[24]||(o[24]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],34)):d("",!0),Q.showExportButton?(u(),s("button",{key:2,class:c(`${ze.value} ${Le.value?"opacity-50 cursor-not-allowed":""}`),disabled:Le.value,onClick:Ce,onMouseenter:o[11]||(o[11]=e=>we(e,m(W)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>we(e,m(W)("common.export")||"Export")),onMouseleave:me,onBlur:me},[...o[26]||(o[26]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),w("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,Y)):d("",!0),Q.showFullscreenButton?(u(),s("button",{key:3,class:c(`${ze.value} ${Le.value?"opacity-50 cursor-not-allowed":""}`),disabled:Le.value,onClick:be,onMouseenter:o[13]||(o[13]=e=>we(e,le.value?m(W)("common.minimize")||"Minimize":m(W)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>we(e,le.value?m(W)("common.minimize")||"Minimize":m(W)("common.open")||"Open")),onMouseleave:me,onBlur:me},[le.value?(u(),s("svg",G,[...o[28]||(o[28]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(u(),s("svg",U,[...o[27]||(o[27]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],42,R)):d("",!0)]))],2)):d("",!0),h(w("div",null,[ne.value?(u(),s("div",{key:0,class:c(["p-4",Q.isDark?"bg-gray-900":"bg-gray-50"])},[w("pre",{class:c(["text-sm font-mono whitespace-pre-wrap",Q.isDark?"text-gray-300":"text-gray-700"])},p(ve.value),3)],2)):(u(),s("div",N,[Q.showZoomControls?(u(),s("div",q,[w("div",A,[w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Me,onMouseenter:o[15]||(o[15]=e=>we(e,m(W)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>we(e,m(W)("common.zoomIn")||"Zoom in")),onMouseleave:me,onBlur:me},[...o[29]||(o[29]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("circle",{cx:"11",cy:"11",r:"8"}),w("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],34),w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Be,onMouseenter:o[17]||(o[17]=e=>we(e,m(W)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>we(e,m(W)("common.zoomOut")||"Zoom out")),onMouseleave:me,onBlur:me},[...o[30]||(o[30]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("circle",{cx:"11",cy:"11",r:"8"}),w("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],34),w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Fe,onMouseenter:o[19]||(o[19]=e=>we(e,m(W)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>we(e,m(W)("common.resetZoom")||"Reset zoom")),onMouseleave:me,onBlur:me},p(Math.round(100*se.value))+"% ",35)])])):d("",!0),w("div",{class:c(["min-h-[360px] relative transition-all duration-100 overflow-hidden block",Q.isDark?"bg-gray-900":"bg-gray-50"]),style:x({height:re.value}),onMousedown:De,onMousemove:je,onMouseup:Te,onMouseleave:Te,onTouchstartPassive:De,onTouchmovePassive:je,onTouchendPassive:Te},[w("div",{class:c(["absolute inset-0 cursor-grab",{"cursor-grabbing":de.value}]),style:x(Ze.value)},[w("div",{ref_key:"infographicContainer",ref:te,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],38)]))],512),[[y,!oe.value]]),(u(),v(C,{to:"body"},[w("div",J,[f(k,{name:"infographic-dialog",appear:""},{default:b(()=>[le.value?(u(),s("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:M(ke,["self"])},[w("div",{class:c(["dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",Q.isDark?"bg-gray-900":"bg-white"])},[w("div",K,[w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Me},[...o[31]||(o[31]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("circle",{cx:"11",cy:"11",r:"8"}),w("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],2),w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Be},[...o[32]||(o[32]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("circle",{cx:"11",cy:"11",r:"8"}),w("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],2),w("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Fe},p(Math.round(100*se.value))+"% ",3),w("button",{class:c(["inline-flex items-center justify-center p-2 rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:ke},[...o[33]||(o[33]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])],2)]),w("div",{ref_key:"modalContent",ref:ae,class:c(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!de.value,"cursor-grabbing":de.value}]),onMousedown:De,onMousemove:je,onMouseup:Te,onMouseleave:Te,onTouchstartPassive:De,onTouchmovePassive:je,onTouchendPassive:Te},null,34)],2)])):d("",!0)]),_:1})])]))],2))}}),[["__scopeId","data-v-811a9bef"]]);Q.install=e=>{e.component(Q.__name,Q)};export{Q as default};
|
|
1
|
+
var e=(e,o,t)=>new Promise((n,r)=>{var l=e=>{try{i(t.next(e))}catch(o){r(o)}},a=e=>{try{i(t.throw(e))}catch(o){r(o)}},i=e=>e.done?n(e.value):Promise.resolve(e.value).then(l,a);i((t=t.apply(e,o)).next())});import{defineComponent as o,ref as t,computed as n,watch as r,nextTick as l,onMounted as a,onBeforeUnmount as i,openBlock as s,createElementBlock as u,normalizeClass as c,renderSlot as d,createElementVNode as h,unref as v,toDisplayString as g,createCommentVNode as w,normalizeStyle as m,withDirectives as p,vShow as x,createBlock as y,Teleport as C,createVNode as f,Transition as k,withCtx as b,withModifiers as M}from"vue";import{u as B,s as F,h as D,_ as j}from"./exports.js";const T=()=>import("@antv/infographic");let $=null,E=T;const z={key:0},L={key:1,class:"flex items-center gap-x-2 overflow-hidden"},Z=["src"],H={key:2},I={class:"flex items-center gap-x-1"},P={class:"flex items-center gap-x-1"},_={key:4},X={key:5,class:"flex items-center gap-x-1"},O=["aria-pressed"],S={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},V={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},Y=["disabled"],R=["disabled"],U={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},G={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"0.75rem",height:"0.75rem",viewBox:"0 0 24 24"},N={key:1,class:"relative"},q={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},A={class:"flex items-center gap-2 backdrop-blur rounded-lg"},J={class:"markstream-vue"},K={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},Q=/* @__PURE__ */j(/* @__PURE__ */o({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(o,{emit:j}){const Q=o,{t:W}=B(),ee=t(!1),oe=t(!1),te=t(),ne=t(!1),re=t("360px"),le=t(!1),ae=t(),ie=t(null),se=t(1),ue=t(0),ce=t(0),de=t(!1),he=t({x:0,y:0}),ve=n(()=>Q.node.code);function ge(e){return!e||e.disabled}function we(e,o,t="top"){if(ge(e.currentTarget))return;const n=e,r=null!=(null==n?void 0:n.clientX)&&null!=(null==n?void 0:n.clientY)?{x:n.clientX,y:n.clientY}:void 0;F(e.currentTarget,o,t,!1,r,Q.isDark)}function me(){D()}function pe(e){if(ge(e.currentTarget))return;const o=ee.value?W("common.copied")||"Copied":W("common.copy")||"Copy",t=e,n=null!=(null==t?void 0:t.clientX)&&null!=(null==t?void 0:t.clientY)?{x:t.clientX,y:t.clientY}:void 0;F(e.currentTarget,o,"top",!1,n,Q.isDark)}function xe(){return e(this,null,function*(){try{const e=ve.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),ee.value=!0,setTimeout(()=>{ee.value=!1},1e3)}catch(e){console.error("Failed to copy:",e)}})}function ye(e){ne.value="source"===e}function Ce(){var o;const t=null==(o=te.value)?void 0:o.querySelector("svg");t?function(o){e(this,null,function*(){try{const t=(new XMLSerializer).serializeToString(o),n=new Blob([t],{type:"image/svg+xml;charset=utf-8"}),r=URL.createObjectURL(n);if("undefined"!=typeof document){const o=document.createElement("a");o.href=r,o.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(o),o.click(),document.body.removeChild(o)}catch(e){}URL.revokeObjectURL(r)}}catch(t){console.error("Failed to export SVG:",t)}})}(t):console.error("SVG element not found")}function fe(e){"Escape"===e.key&&le.value&&ke()}function ke(){if(le.value=!1,ae.value&&(ae.value.innerHTML=""),ie.value=null,"undefined"!=typeof document)try{document.body.style.overflow=""}catch(e){}if("undefined"!=typeof window)try{window.removeEventListener("keydown",fe)}catch(e){}}function be(){!function(){if(le.value=!0,"undefined"!=typeof document)try{document.body.style.overflow="hidden"}catch(e){}if("undefined"!=typeof window)try{window.addEventListener("keydown",fe)}catch(e){}l(()=>{if(te.value&&ae.value){ae.value.innerHTML="";const e=document.createElement("div");e.style.transition="transform 0.1s ease",e.style.transformOrigin="center center",e.style.width="100%",e.style.height="100%",e.style.display="flex",e.style.alignItems="center",e.style.justifyContent="center";const o=te.value.cloneNode(!0);o.classList.add("fullscreen"),o.style.height="auto",e.appendChild(o),ae.value.appendChild(e),ie.value=e,e.style.transform=`translate(${ue.value}px, ${ce.value}px) scale(${se.value})`}})}()}function Me(){se.value<3&&(se.value+=.1)}function Be(){se.value>.5&&(se.value-=.1)}function Fe(){se.value=1,ue.value=0,ce.value=0}function De(e){de.value=!0,e instanceof MouseEvent?he.value={x:e.clientX-ue.value,y:e.clientY-ce.value}:he.value={x:e.touches[0].clientX-ue.value,y:e.touches[0].clientY-ce.value}}function je(e){if(!de.value)return;let o,t;e instanceof MouseEvent?(o=e.clientX,t=e.clientY):(o=e.touches[0].clientX,t=e.touches[0].clientY),ue.value=o-he.value.x,ce.value=t-he.value.y}function Te(){de.value=!1}let $e=null;function Ee(){return e(this,null,function*(){var o;if(te.value)try{const t=yield function(){return e(this,null,function*(){if($)return $;const e=E;if(!e)return null;let o;try{o=yield e()}catch(n){if(e===T)throw new Error('Optional dependency "@antv/infographic" is not installed. Please install it to enable infographic diagrams.');throw n}if(!o)return null;const t=o&&o.default?o.default:o;return $="function"==typeof t&&t.prototype&&t.prototype.render?t:o.Infographic?o.Infographic:t&&t.Infographic?t.Infographic:t,$})}();if(!t)return void console.warn("Infographic library failed to load.");$e&&(null==(o=$e.destroy)||o.call($e),$e=null),te.value.innerHTML="",$e=new t({container:te.value,width:"100%",height:"100%"}),$e.render(ve.value),l(()=>{if(te.value){const e=te.value.scrollHeight;e>0&&(re.value=`${Math.min(e,800)}px`)}})}catch(t){console.error("Failed to render infographic:",t),te.value&&(te.value.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${t instanceof Error?t.message:"Unknown error"}</div>`)}})}r(()=>ve.value,()=>{ne.value||oe.value||l(()=>{Ee()})}),r(()=>ne.value,e=>{e||oe.value||l(()=>{Ee()})}),r(()=>oe.value,e=>{e||ne.value||l(()=>{Ee()})}),a(()=>{ne.value||oe.value||l(()=>{Ee()})}),i(()=>{var e;if($e&&(null==(e=$e.destroy)||e.call($e),$e=null),"undefined"!=typeof window)try{window.removeEventListener("keydown",fe)}catch(o){}});const ze=n(()=>Q.isDark?"infographic-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"infographic-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700"),Le=n(()=>ne.value||oe.value),Ze=n(()=>({transform:`translate(${ue.value}px, ${ce.value}px) scale(${se.value})`}));return r(Ze,e=>{le.value&&ie.value&&(ie.value.style.transform=e.transform)}),(e,o)=>(s(),u("div",{class:c(["my-4 rounded-lg border overflow-hidden shadow-sm",[Q.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":Q.loading}]])},[Q.showHeader?(s(),u("div",{key:0,class:c(["infographic-block-header flex justify-between items-center px-4 py-2.5 border-b",Q.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"])},[e.$slots["header-left"]?(s(),u("div",z,[d(e.$slots,"header-left",{},void 0,!0)])):(s(),u("div",L,[h("img",{src:v("data:image/svg+xml,%3csvg%20width='15.52'%20height='16'%20viewBox='0%200%20291%20300'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%3e%3cpath%20d='M140.904%20239.376C128.83%20239.683%20119.675%20239.299%20115.448%20243.843C110.902%20248.07%20111.288%20257.227%20110.979%20269.302C111.118%20274.675%20111.118%20279.478%20111.472%20283.52C111.662%20285.638%20111.95%20287.547%20112.406%20289.224C112.411%20289.243%20112.416%20289.259%20112.422%20289.28C112.462%20289.419%20112.496%20289.558%20112.539%20289.691C113.168%20291.787%20114.088%20293.491%20115.446%20294.758C116.662%20296.064%20118.283%20296.963%20120.264%20297.59C120.36%20297.614%20120.464%20297.646%20120.555%20297.675C120.56%20297.68%20120.56%20297.68%20120.566%20297.68C120.848%20297.768%20121.142%20297.846%20121.443%20297.923C121.454%20297.923%20121.464%20297.928%20121.478%20297.934C122.875%20298.272%20124.424%20298.507%20126.11%20298.678C126.326%20298.696%20126.542%20298.718%20126.763%20298.739C130.79%20299.086%20135.558%20299.088%20140.904%20299.222C152.974%20298.912%20162.128%20299.302%20166.36%20294.758C170.904%20290.526%20170.515%20281.371%20170.824%20269.302C170.515%20257.227%20170.907%20248.07%20166.36%20243.843C162.131%20239.299%20152.974%20239.683%20140.904%20239.376Z'%20fill='%23FF6376'%3e%3c/path%3e%3cpath%20d='M21.2155%20128.398C12.6555%20128.616%206.16484%20128.339%203.16751%20131.56C-0.0538222%20134.56%200.218178%20141.054%20-0.000488281%20149.608C0.218178%20158.168%20-0.0538222%20164.659%203.16751%20167.656C6.16484%20170.878%2012.6555%20170.606%2021.2155%20170.824C25.0262%20170.726%2028.4288%20170.726%2031.2955%20170.475C32.7968%20170.342%2034.1488%20170.136%2035.3382%20169.814C35.3542%20169.811%2035.3648%20169.806%2035.3782%20169.803C35.4768%20169.774%2035.5755%20169.747%2035.6688%20169.718C37.1568%20169.272%2038.3648%20168.622%2039.2635%20167.656C40.1915%20166.795%2040.8262%20165.646%2041.2715%20164.243C41.2875%20164.174%2041.3115%20164.102%2041.3328%20164.035C41.3328%20164.035%2041.3355%20164.032%2041.3355%20164.027C41.3968%20163.827%2041.4529%20163.622%2041.5062%20163.406C41.5062%20163.398%2041.5115%20163.392%2041.5142%20163.382C41.7542%20162.392%2041.9222%20161.294%2042.0422%20160.096C42.0555%20159.944%2042.0715%20159.792%2042.0848%20159.635C42.3328%20156.779%2042.3328%20153.398%2042.4262%20149.608C42.2075%20141.054%2042.4848%20134.56%2039.2635%20131.56C36.2635%20128.339%2029.7728%20128.616%2021.2155%20128.398Z'%20fill='%23FFCCCC'%3e%3c/path%3e%3cpath%20d='M81.0595%20184.171C70.8568%20184.433%2063.1208%20184.102%2059.5475%20187.942C55.7075%20191.518%2056.0328%20199.254%2055.7742%20209.454C56.0328%20219.657%2055.7075%20227.393%2059.5475%20230.963C63.1208%20234.803%2070.8568%20234.478%2081.0595%20234.739C85.6008%20234.622%2089.6595%20234.622%2093.0728%20234.323C94.8648%20234.163%2096.4755%20233.921%2097.8942%20233.534C97.9102%20233.529%2097.9235%20233.526%2097.9422%20233.521C98.0568%20233.486%2098.1742%20233.457%2098.2888%20233.422C100.06%20232.889%20101.5%20232.113%20102.569%20230.963C103.676%20229.937%20104.433%20228.566%20104.964%20226.894C104.985%20226.811%20105.012%20226.726%20105.036%20226.646C105.041%20226.643%20105.041%20226.643%20105.041%20226.638C105.116%20226.401%20105.18%20226.153%20105.244%20225.897C105.244%20225.889%20105.249%20225.881%20105.254%20225.867C105.54%20224.689%20105.74%20223.379%20105.881%20221.953C105.9%20221.771%20105.916%20221.59%20105.934%20221.403C106.228%20218.001%20106.228%20213.969%20106.342%20209.454C106.081%20199.254%20106.412%20191.518%20102.572%20187.942C98.9955%20184.102%2091.2568%20184.433%2081.0595%20184.171Z'%20fill='%23FF939F'%3e%3c/path%3e%3cpath%20d='M260.591%20151.87C215.652%20151.87%20203.02%20164.523%20203.02%20209.462H198.476C198.476%20164.523%20185.836%20151.881%20140.895%20151.881V147.337C185.836%20147.337%20198.487%20134.705%20198.487%2089.7659H203.02C203.02%20134.705%20215.652%20147.337%20260.591%20147.337V151.87ZM286.052%20124.158C281.82%20119.614%20272.66%20120.001%20260.591%20119.689C248.521%20119.385%20239.361%20119.771%20235.129%20115.227C230.585%20110.995%20230.983%20101.846%20230.671%2089.7659C230.513%2083.7312%20230.535%2078.4272%20230.023%2074.1019C229.513%2069.7659%20228.481%2066.4219%20226.209%2064.3046C221.967%2059.7606%20212.817%2060.1472%20200.748%2059.8459C188.681%2060.1472%20179.519%2059.7606%20175.287%2064.3046C170.753%2068.5366%20171.129%2077.6966%20170.828%2089.7659C170.516%20101.835%20170.9%20110.995%20166.356%20115.227C162.124%20119.771%20152.985%20119.374%20140.905%20119.689C138.873%20119.739%20136.924%20119.771%20135.071%20119.811C119.313%20118.697%20106.337%20112.318%20106.337%2089.7659C106.212%2084.6699%20106.233%2080.1792%20105.807%2076.5206C105.367%2072.8726%20104.492%2070.0379%20102.575%2068.2566C99.0013%2064.4112%2091.2573%2064.7446%2081.0653%2064.4832C70.86%2064.7446%2063.1186%2064.4112%2059.5533%2068.2566C55.708%2071.8299%2056.0306%2079.5632%2055.7693%2089.7659C56.0306%2099.9686%2055.708%20107.702%2059.5533%20111.278C63.1186%20115.113%2070.86%20114.79%2081.0653%20115.049C103.617%20115.049%20109.996%20128.035%20111.1%20143.803C111.068%20145.659%20111.028%20147.587%20110.975%20149.619C111.121%20154.987%20111.121%20159.79%20111.476%20163.835C111.663%20165.95%20111.945%20167.857%20112.404%20169.534C112.412%20169.555%20112.412%20169.566%20112.423%20169.598C112.465%20169.734%20112.497%20169.867%20112.537%20170.003C113.164%20172.099%20114.092%20173.809%20115.447%20175.07C116.665%20176.371%20118.281%20177.278%20120.271%20177.905C120.364%20177.934%20120.46%20177.955%20120.564%20177.987C120.855%20178.081%20121.145%20178.153%20121.439%20178.238C121.46%20178.238%20121.471%20178.238%20121.479%20178.249C122.876%20178.582%20124.42%20178.822%20126.108%20178.987C126.327%20179.009%20126.545%20179.03%20126.764%20179.051C130.788%20179.395%20135.559%20179.395%20140.905%20179.529C152.975%20179.843%20162.124%20179.457%20166.356%20184.001C170.9%20188.233%20170.516%20197.371%20170.828%20209.451C171.129%20221.529%20170.743%20230.681%20175.287%20234.91C179.519%20239.454%20188.681%20239.07%20200.748%20239.371C206.127%20239.235%20210.921%20239.235%20214.975%20238.881C217.079%20238.694%20218.985%20238.403%20220.676%20237.955C220.695%20237.945%20220.705%20237.934%20220.727%20237.934C220.873%20237.891%20220.999%20237.859%20221.135%20237.819C223.228%20237.193%20224.937%20236.265%20226.209%20234.91C227.511%20233.691%20228.409%20232.065%20229.044%20230.097C229.065%20230.003%20229.095%20229.899%20229.127%20229.803V229.793C229.22%20229.513%20229.295%20229.222%20229.367%20228.918C229.367%20228.897%20229.377%20228.897%20229.377%20228.878C229.721%20227.481%20229.951%20225.937%20230.127%20224.249C230.137%20224.03%20230.169%20223.811%20230.191%20223.593C230.535%20219.571%20230.535%20214.798%20230.671%20209.451C230.972%20197.371%20230.585%20188.233%20235.129%20184.001C239.361%20179.457%20248.511%20179.843%20260.591%20179.529C272.66%20179.227%20281.82%20179.614%20286.052%20175.07C290.596%20170.838%20290.209%20161.689%20290.511%20149.619C290.209%20137.539%20290.596%20128.379%20286.052%20124.158Z'%20fill='%23FF356A'%3e%3c/path%3e%3cpath%20d='M112.405%2049.848C112.411%2049.8694%20112.416%2049.8827%20112.421%2049.904C112.461%2050.0427%20112.499%2050.1814%20112.539%2050.3147C113.171%2052.4134%20114.088%2054.1147%20115.448%2055.384C116.661%2056.6907%20118.283%2057.5894%20120.264%2058.2134C120.36%2058.24%20120.464%2058.2694%20120.555%2058.3014C120.56%2058.3067%20120.56%2058.3067%20120.565%2058.3067C120.848%2058.3947%20121.141%2058.4694%20121.443%2058.5467C121.453%2058.5467%20121.464%2058.552%20121.48%2058.5574C122.875%2058.896%20124.424%2059.1334%20126.112%2059.3014C126.325%2059.3227%20126.541%2059.3414%20126.763%2059.3627C130.789%2059.712%20135.56%2059.712%20140.904%2059.8454C152.973%2059.5387%20162.128%2059.928%20166.36%2055.384C170.907%2051.152%20170.515%2041.9947%20170.824%2029.9254C170.517%2017.8507%20170.907%208.69602%20166.363%204.46935C162.131%20-0.0746511%20152.973%200.309349%20140.904%201.52588e-05C128.829%200.309349%20119.675%20-0.0746511%20115.448%204.46935C110.904%208.69602%20111.288%2017.8507%20110.979%2029.9254C111.117%2035.3014%20111.117%2040.1014%20111.472%2044.144C111.661%2046.2614%20111.949%2048.1707%20112.405%2049.848Z'%20fill='%23FF6376'%3e%3c/path%3e%3c/g%3e%3c/svg%3e"),class:"w-4 h-4 my-0",alt:"Infographic"},null,8,Z),h("span",{class:c(["text-sm font-medium font-mono truncate",Q.isDark?"text-gray-400":"text-gray-600"])},"Infographic",2)])),e.$slots["header-center"]?(s(),u("div",H,[d(e.$slots,"header-center",{},void 0,!0)])):Q.showModeToggle?(s(),u("div",{key:3,class:c(["flex items-center gap-x-1 rounded-md p-0.5",Q.isDark?"bg-gray-700":"bg-gray-100"])},[h("button",{class:c(["px-2.5 py-1 text-xs rounded transition-colors",[ne.value?Q.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700":Q.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm"]]),onClick:o[0]||(o[0]=()=>ye("preview")),onMouseenter:o[1]||(o[1]=e=>we(e,v(W)("common.preview")||"Preview")),onFocus:o[2]||(o[2]=e=>we(e,v(W)("common.preview")||"Preview")),onMouseleave:me,onBlur:me},[h("div",I,[o[21]||(o[21]=h("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),h("circle",{cx:"12",cy:"12",r:"3"})])],-1)),h("span",null,g(v(W)("common.preview")||"Preview"),1)])],34),h("button",{class:c(["px-2.5 py-1 text-xs rounded transition-colors",[ne.value?Q.isDark?"bg-gray-600 text-gray-200 shadow-sm":"bg-white text-gray-700 shadow-sm":Q.isDark?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-700"]]),onClick:o[3]||(o[3]=()=>ye("source")),onMouseenter:o[4]||(o[4]=e=>we(e,v(W)("common.source")||"Source")),onFocus:o[5]||(o[5]=e=>we(e,v(W)("common.source")||"Source")),onMouseleave:me,onBlur:me},[h("div",P,[o[22]||(o[22]=h("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),h("span",null,g(v(W)("common.source")||"Source"),1)])],34)],2)):w("",!0),e.$slots["header-right"]?(s(),u("div",_,[d(e.$slots,"header-right",{},void 0,!0)])):(s(),u("div",X,[Q.showCollapseButton?(s(),u("button",{key:0,class:c(ze.value),"aria-pressed":oe.value,onClick:o[6]||(o[6]=e=>oe.value=!oe.value),onMouseenter:o[7]||(o[7]=e=>we(e,oe.value?v(W)("common.expand")||"Expand":v(W)("common.collapse")||"Collapse")),onFocus:o[8]||(o[8]=e=>we(e,oe.value?v(W)("common.expand")||"Expand":v(W)("common.collapse")||"Collapse")),onMouseleave:me,onBlur:me},[(s(),u("svg",{style:m({rotate:oe.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...o[23]||(o[23]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],42,O)):w("",!0),Q.showCopyButton?(s(),u("button",{key:1,class:c(ze.value),onClick:xe,onMouseenter:o[9]||(o[9]=e=>pe(e)),onFocus:o[10]||(o[10]=e=>pe(e)),onMouseleave:me,onBlur:me},[ee.value?(s(),u("svg",V,[...o[25]||(o[25]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(s(),u("svg",S,[...o[24]||(o[24]=[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),h("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],34)):w("",!0),Q.showExportButton?(s(),u("button",{key:2,class:c(`${ze.value} ${Le.value?"opacity-50 cursor-not-allowed":""}`),disabled:Le.value,onClick:Ce,onMouseenter:o[11]||(o[11]=e=>we(e,v(W)("common.export")||"Export")),onFocus:o[12]||(o[12]=e=>we(e,v(W)("common.export")||"Export")),onMouseleave:me,onBlur:me},[...o[26]||(o[26]=[h("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),h("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,Y)):w("",!0),Q.showFullscreenButton?(s(),u("button",{key:3,class:c(`${ze.value} ${Le.value?"opacity-50 cursor-not-allowed":""}`),disabled:Le.value,onClick:be,onMouseenter:o[13]||(o[13]=e=>we(e,le.value?v(W)("common.minimize")||"Minimize":v(W)("common.open")||"Open")),onFocus:o[14]||(o[14]=e=>we(e,le.value?v(W)("common.minimize")||"Minimize":v(W)("common.open")||"Open")),onMouseleave:me,onBlur:me},[le.value?(s(),u("svg",G,[...o[28]||(o[28]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(s(),u("svg",U,[...o[27]||(o[27]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],42,R)):w("",!0)]))],2)):w("",!0),p(h("div",null,[ne.value?(s(),u("div",{key:0,class:c(["p-4",Q.isDark?"bg-gray-900":"bg-gray-50"])},[h("pre",{class:c(["text-sm font-mono whitespace-pre-wrap",Q.isDark?"text-gray-300":"text-gray-700"])},g(ve.value),3)],2)):(s(),u("div",N,[Q.showZoomControls?(s(),u("div",q,[h("div",A,[h("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Me,onMouseenter:o[15]||(o[15]=e=>we(e,v(W)("common.zoomIn")||"Zoom in")),onFocus:o[16]||(o[16]=e=>we(e,v(W)("common.zoomIn")||"Zoom in")),onMouseleave:me,onBlur:me},[...o[29]||(o[29]=[h("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],34),h("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Be,onMouseenter:o[17]||(o[17]=e=>we(e,v(W)("common.zoomOut")||"Zoom out")),onFocus:o[18]||(o[18]=e=>we(e,v(W)("common.zoomOut")||"Zoom out")),onMouseleave:me,onBlur:me},[...o[30]||(o[30]=[h("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],34),h("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Fe,onMouseenter:o[19]||(o[19]=e=>we(e,v(W)("common.resetZoom")||"Reset zoom")),onFocus:o[20]||(o[20]=e=>we(e,v(W)("common.resetZoom")||"Reset zoom")),onMouseleave:me,onBlur:me},g(Math.round(100*se.value))+"% ",35)])])):w("",!0),h("div",{class:c(["min-h-[360px] relative transition-all duration-100 overflow-hidden block",Q.isDark?"bg-gray-900":"bg-gray-50"]),style:m({height:re.value}),onMousedown:De,onMousemove:je,onMouseup:Te,onMouseleave:Te,onTouchstartPassive:De,onTouchmovePassive:je,onTouchendPassive:Te},[h("div",{class:c(["absolute inset-0 cursor-grab",{"cursor-grabbing":de.value}]),style:m(Ze.value)},[h("div",{ref_key:"infographicContainer",ref:te,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],38)]))],512),[[x,!oe.value]]),(s(),y(C,{to:"body"},[h("div",J,[f(k,{name:"infographic-dialog",appear:""},{default:b(()=>[le.value?(s(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:M(ke,["self"])},[h("div",{class:c(["dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",Q.isDark?"bg-gray-900":"bg-white"])},[h("div",K,[h("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Me},[...o[31]||(o[31]=[h("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],2),h("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Be},[...o[32]||(o[32]=[h("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("circle",{cx:"11",cy:"11",r:"8"}),h("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],2),h("button",{class:c(["p-2 text-xs rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:Fe},g(Math.round(100*se.value))+"% ",3),h("button",{class:c(["inline-flex items-center justify-center p-2 rounded transition-colors",[Q.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"]]),onClick:ke},[...o[33]||(o[33]=[h("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])],2)]),h("div",{ref_key:"modalContent",ref:ae,class:c(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!de.value,"cursor-grabbing":de.value}]),onMousedown:De,onMousemove:je,onMouseup:Te,onMouseleave:Te,onTouchstartPassive:De,onTouchmovePassive:je,onTouchendPassive:Te},null,34)],2)])):w("",!0)]),_:1})])]))],2))}}),[["__scopeId","data-v-811a9bef"]]);Q.install=e=>{e.component(Q.__name,Q)};export{Q as default};
|
package/dist/index7.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=Object.defineProperty,o=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,r=(o,t,n)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,l=(e,l)=>{for(var i in l||(l={}))t.call(l,i)&&r(e,i,l[i]);if(o)for(var i of o(l))n.call(l,i)&&r(e,i,l[i]);return e},i=(e,o,t)=>new Promise((n,r)=>{var l=e=>{try{a(t.next(e))}catch(o){r(o)}},i=e=>{try{a(t.throw(e))}catch(o){r(o)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(l,i);a((t=t.apply(e,o)).next())});import{defineComponent as a,ref as u,computed as s,watch as c,nextTick as d,onMounted as v,onBeforeUnmount as p,createElementBlock as m,openBlock as f,normalizeClass as g,createCommentVNode as y,withDirectives as h,createElementVNode as w,unref as x,toDisplayString as b,normalizeStyle as k,vShow as B}from"vue";import{u as D,s as C,h as M,o as E,_ as A}from"./exports.js";const T={key:0,class:"d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},j={class:"flex items-center gap-x-2"},O=["aria-label"],F={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},H={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},I=["aria-label"],N=["aria-pressed"],L={key:0,class:"d2-source px-4 py-4"},P={class:"d2-code"},R={key:0,class:"d2-error mt-2 text-xs"},S={key:1},_={key:0,class:"d2-source px-4 py-4"},U={class:"d2-code"},X={key:0,class:"d2-error mt-2 text-xs"},Y=["innerHTML"],q={key:0,class:"d2-error px-4 pb-3 text-xs"},$=/* @__PURE__ */A(/* @__PURE__ */a({__name:"D2BlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(e){const o=e,{t}=D(),n=u(!1),r=u(!1),a=u(!1),A=u(!1),$=u(null),z=u(!1),V=u(""),G=u(0),J=u(null),K=u(null),Q=s(()=>{var e;return null!=(e=o.node.code)?e:""}),W=s(()=>a.value||!A.value||!V.value),Z=s(()=>!!V.value),ee=s(()=>{if(K.value)return{minHeight:`${K.value}px`}}),oe=s(()=>{if(o.maxHeight)return{maxHeight:"number"==typeof o.maxHeight?`${o.maxHeight}px`:String(o.maxHeight)}}),te="undefined"!=typeof window;let ne=null,re=!1,le=!1,ie=0,ae=null,ue=!1,se=null;const ce={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function de(e){return!e||e.disabled}function ve(e,t,n="top"){if(de(e.currentTarget))return;const r=e,l=null!=(null==r?void 0:r.clientX)&&null!=(null==r?void 0:r.clientY)?{x:r.clientX,y:r.clientY}:void 0;C(e.currentTarget,t,n,!1,l,o.isDark)}function pe(){M()}function me(e){if(de(e.currentTarget))return;const r=n.value?t("common.copied")||"Copied":t("common.copy")||"Copy",l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;C(e.currentTarget,r,"top",!1,i,o.isDark)}function fe(){return i(this,null,function*(){try{const e=Q.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),n.value=!0,setTimeout(()=>{n.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ge(){r.value=!r.value}function ye(e){a.value="source"===e}const he=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],we=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function xe(e){if(!e)return"";const o=e.trim();return we.test(o)?o:""}function be(){V.value=""}function ke(){return i(this,null,function*(){var e,t,n,r,u;if(!te||le)return;if(o.loading&&!o.progressiveRender)return;const s=Q.value;if(!s)return be(),void($.value=null);const c=++G.value;z.value=!0,$.value=null;try{const d=yield function(){return i(this,null,function*(){if(ne)return ne;const e=yield E();if(!e)return null;if("function"==typeof e){const o=new e;return o&&"function"==typeof o.compile?ne=o:"function"==typeof e.compile&&(ne=e),ne}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(ne=new e.D2,ne):("function"==typeof e.compile&&(ne=e),ne)})}();if(!d)return A.value=!1,a.value=!0,be(),void($.value="D2 is not available.");if("function"!=typeof d.compile||"function"!=typeof d.render)throw new TypeError("D2 instance is missing compile/render methods.");A.value=!0;const v=yield d.compile(s);if(c!==G.value)return;const p=null!=(e=null==v?void 0:v.diagram)?e:v,m=null!=(n=null!=(t=null==v?void 0:v.renderOptions)?t:null==v?void 0:v.options)?n:{},f=null!=(r=o.themeId)?r:m.themeID,g=null!=(u=o.darkThemeId)?u:m.darkThemeID,y=l({},m);if(y.themeID=o.isDark&&null!=g?g:f,y.darkThemeID=null,y.darkThemeOverrides=null,o.isDark){const e=m.themeOverrides&&"object"==typeof m.themeOverrides?m.themeOverrides:null;y.themeOverrides=l(l({},ce),e||{})}const h=yield d.render(p,y);if(c!==G.value)return;const w=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(h);if(!w)throw new Error("D2 render returned empty output.");!function(e){const o=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const o=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),t=(new DOMParser).parseFromString(o,"image/svg+xml").documentElement;if(!t||"svg"!==t.nodeName.toLowerCase())return"";const n=t;return function(e){const o=/* @__PURE__ */new Set(["script"]),t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){if(o.has(n.tagName.toLowerCase())){n.remove();continue}const e=Array.from(n.attributes);for(const o of e){const e=o.name;if(/^on/i.test(e))n.removeAttribute(e);else{if("style"===e&&o.value){const t=o.value;if(he.some(e=>e.test(t))){n.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&o.value){const t=xe(o.value);if(!t){n.removeAttribute(e);continue}t!==o.value&&n.setAttribute(e,t)}}}}}(n),n.outerHTML}(e);V.value=o||""}(w),o.loading&&(a.value=!1),$.value=null}catch(d){if(c!==G.value)return;const e=(null==d?void 0:d.message)?String(d.message):"D2 render failed.";o.loading||($.value=e),e.includes("@terrastruct/d2")&&(A.value=!1,a.value=!0)}finally{c===G.value&&(z.value=!1,ue&&(ue=!1,Be()))}})}function Be(e=!1){if(re)return;if(!te)return;if(le)return;if(z.value)return void(ue=!0);const t=Math.max(120,Number(o.progressiveIntervalMs)||0),n=Date.now()-ie;if(!e&&n<t)return ue=!0,void(null==ae&&(ae=window.setTimeout(()=>{ae=null,ue&&(ue=!1,Be(!0))},Math.max(0,t-n))));re=!0;const r=()=>{re=!1,ie=Date.now(),ke()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)}function De(){if(V.value)try{const e=new Blob([V.value],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(e);if("undefined"!=typeof document){const e=document.createElement("a");e.href=o,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(o)}catch(e){console.error("Failed to export SVG:",e)}}function Ce(){const e=J.value;if(!e)return;const o=e.getBoundingClientRect().height;o>0&&(K.value=o)}return c(()=>[o.node.code,o.loading,o.isDark],()=>{Be()},{immediate:!0}),c(()=>o.loading,(e,o)=>{o&&!e&&Be(!0)}),c(()=>[W.value,V.value,Q.value],()=>{d(()=>{Ce()})}),v(()=>{Be(),d(()=>{Ce()}),"undefined"!=typeof ResizeObserver&&(se=new ResizeObserver(()=>{Ce()}),J.value&&se.observe(J.value))}),p(()=>{le=!0,null!=ae&&(clearTimeout(ae),ae=null),null==se||se.disconnect(),se=null}),(e,l)=>(f(),m("div",{class:g(["d2-block-container my-4 rounded-lg border overflow-hidden shadow-sm",o.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"])},[o.showHeader?(f(),m("div",T,[l[16]||(l[16]=w("div",{class:"flex items-center gap-x-2"},[w("span",{class:"text-sm font-medium font-mono"},"D2")],-1)),w("div",j,[o.showModeToggle?(f(),m("div",{key:0,class:g(["flex items-center gap-x-1 rounded-md p-0.5",o.isDark?"bg-gray-700":"bg-gray-100"])},[w("button",{type:"button",class:g(["mode-btn px-2 py-1 text-xs rounded",a.value?"":"is-active"]),onClick:l[0]||(l[0]=e=>ye("preview")),onMouseenter:l[1]||(l[1]=e=>ve(e,x(t)("common.preview")||"Preview")),onFocus:l[2]||(l[2]=e=>ve(e,x(t)("common.preview")||"Preview")),onMouseleave:pe,onBlur:pe},b(x(t)("common.preview")||"Preview"),35),w("button",{type:"button",class:g(["mode-btn px-2 py-1 text-xs rounded",a.value?"is-active":""]),onClick:l[3]||(l[3]=e=>ye("source")),onMouseenter:l[4]||(l[4]=e=>ve(e,x(t)("common.source")||"Source")),onFocus:l[5]||(l[5]=e=>ve(e,x(t)("common.source")||"Source")),onMouseleave:pe,onBlur:pe},b(x(t)("common.source")||"Source"),35)],2)):y("",!0),o.showCopyButton?(f(),m("button",{key:1,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":n.value?x(t)("common.copied")||"Copied":x(t)("common.copy")||"Copy",onClick:fe,onMouseenter:l[6]||(l[6]=e=>me(e)),onFocus:l[7]||(l[7]=e=>me(e)),onMouseleave:pe,onBlur:pe},[n.value?(f(),m("svg",H,[...l[13]||(l[13]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(f(),m("svg",F,[...l[12]||(l[12]=[w("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[w("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),w("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,O)):y("",!0),o.showExportButton&&V.value?(f(),m("button",{key:2,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":x(t)("common.export")||"Export",onClick:De,onMouseenter:l[8]||(l[8]=e=>ve(e,x(t)("common.export")||"Export")),onFocus:l[9]||(l[9]=e=>ve(e,x(t)("common.export")||"Export")),onMouseleave:pe,onBlur:pe},[...l[14]||(l[14]=[w("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,I)):y("",!0),o.showCollapseButton?(f(),m("button",{key:3,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":r.value,onClick:ge,onMouseenter:l[10]||(l[10]=e=>ve(e,r.value?x(t)("common.expand")||"Expand":x(t)("common.collapse")||"Collapse")),onFocus:l[11]||(l[11]=e=>ve(e,r.value?x(t)("common.expand")||"Expand":x(t)("common.collapse")||"Collapse")),onMouseleave:pe,onBlur:pe},[(f(),m("svg",{style:k({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...l[15]||(l[15]=[w("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,N)):y("",!0)])])):y("",!0),h(w("div",{ref_key:"bodyRef",ref:J,class:"d2-block-body",style:k(ee.value)},[o.loading&&!Z.value?(f(),m("div",L,[w("pre",P,[w("code",null,b(Q.value),1)]),$.value?(f(),m("p",R,b($.value),1)):y("",!0)])):(f(),m("div",S,[W.value?(f(),m("div",_,[w("pre",U,[w("code",null,b(Q.value),1)]),$.value?(f(),m("p",X,b($.value),1)):y("",!0)])):(f(),m("div",{key:1,class:"d2-render",style:k(oe.value)},[w("div",{class:"d2-svg",innerHTML:V.value},null,8,Y),$.value?(f(),m("p",q,b($.value),1)):y("",!0)],4))]))],4),[[B,!r.value]])],2))}}),[["__scopeId","data-v-f9232822"]]);$.install=e=>{e.component($.__name,$)};export{$ as default};
|
|
1
|
+
var e=Object.defineProperty,o=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,r=(o,t,n)=>t in o?e(o,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[t]=n,l=(e,l)=>{for(var i in l||(l={}))t.call(l,i)&&r(e,i,l[i]);if(o)for(var i of o(l))n.call(l,i)&&r(e,i,l[i]);return e},i=(e,o,t)=>new Promise((n,r)=>{var l=e=>{try{a(t.next(e))}catch(o){r(o)}},i=e=>{try{a(t.throw(e))}catch(o){r(o)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(l,i);a((t=t.apply(e,o)).next())});import{defineComponent as a,ref as u,computed as s,watch as c,nextTick as d,onMounted as v,onBeforeUnmount as p,openBlock as m,createElementBlock as f,normalizeClass as g,createElementVNode as y,unref as h,toDisplayString as w,createCommentVNode as x,normalizeStyle as b,withDirectives as k,vShow as B}from"vue";import{u as D,s as C,h as M,o as E,_ as A}from"./exports.js";const T={key:0,class:"d2-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)","background-color":"var(--vscode-editor-background)"}},j={class:"flex items-center gap-x-2"},O=["aria-label"],F={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},H={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},I=["aria-label"],N=["aria-pressed"],L={key:0,class:"d2-source px-4 py-4"},P={class:"d2-code"},R={key:0,class:"d2-error mt-2 text-xs"},S={key:1},_={key:0,class:"d2-source px-4 py-4"},U={class:"d2-code"},X={key:0,class:"d2-error mt-2 text-xs"},Y=["innerHTML"],q={key:0,class:"d2-error px-4 pb-3 text-xs"},$=/* @__PURE__ */A(/* @__PURE__ */a({__name:"D2BlockNode",props:{node:{},maxHeight:{default:"500px"},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(e){const o=e,{t}=D(),n=u(!1),r=u(!1),a=u(!1),A=u(!1),$=u(null),z=u(!1),V=u(""),G=u(0),J=u(null),K=u(null),Q=s(()=>{var e;return null!=(e=o.node.code)?e:""}),W=s(()=>a.value||!A.value||!V.value),Z=s(()=>!!V.value),ee=s(()=>{if(K.value)return{minHeight:`${K.value}px`}}),oe=s(()=>{if(o.maxHeight)return{maxHeight:"number"==typeof o.maxHeight?`${o.maxHeight}px`:String(o.maxHeight)}}),te="undefined"!=typeof window;let ne=null,re=!1,le=!1,ie=0,ae=null,ue=!1,se=null;const ce={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function de(e){return!e||e.disabled}function ve(e,t,n="top"){if(de(e.currentTarget))return;const r=e,l=null!=(null==r?void 0:r.clientX)&&null!=(null==r?void 0:r.clientY)?{x:r.clientX,y:r.clientY}:void 0;C(e.currentTarget,t,n,!1,l,o.isDark)}function pe(){M()}function me(e){if(de(e.currentTarget))return;const r=n.value?t("common.copied")||"Copied":t("common.copy")||"Copy",l=e,i=null!=(null==l?void 0:l.clientX)&&null!=(null==l?void 0:l.clientY)?{x:l.clientX,y:l.clientY}:void 0;C(e.currentTarget,r,"top",!1,i,o.isDark)}function fe(){return i(this,null,function*(){try{const e=Q.value;"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&(yield navigator.clipboard.writeText(e)),n.value=!0,setTimeout(()=>{n.value=!1},1e3)}catch(e){console.error("Copy failed:",e)}})}function ge(){r.value=!r.value}function ye(e){a.value="source"===e}const he=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],we=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function xe(e){if(!e)return"";const o=e.trim();return we.test(o)?o:""}function be(){V.value=""}function ke(){return i(this,null,function*(){var e,t,n,r,u;if(!te||le)return;if(o.loading&&!o.progressiveRender)return;const s=Q.value;if(!s)return be(),void($.value=null);const c=++G.value;z.value=!0,$.value=null;try{const d=yield function(){return i(this,null,function*(){if(ne)return ne;const e=yield E();if(!e)return null;if("function"==typeof e){const o=new e;return o&&"function"==typeof o.compile?ne=o:"function"==typeof e.compile&&(ne=e),ne}return(null==e?void 0:e.D2)&&"function"==typeof e.D2?(ne=new e.D2,ne):("function"==typeof e.compile&&(ne=e),ne)})}();if(!d)return A.value=!1,a.value=!0,be(),void($.value="D2 is not available.");if("function"!=typeof d.compile||"function"!=typeof d.render)throw new TypeError("D2 instance is missing compile/render methods.");A.value=!0;const v=yield d.compile(s);if(c!==G.value)return;const p=null!=(e=null==v?void 0:v.diagram)?e:v,m=null!=(n=null!=(t=null==v?void 0:v.renderOptions)?t:null==v?void 0:v.options)?n:{},f=null!=(r=o.themeId)?r:m.themeID,g=null!=(u=o.darkThemeId)?u:m.darkThemeID,y=l({},m);if(y.themeID=o.isDark&&null!=g?g:f,y.darkThemeID=null,y.darkThemeOverrides=null,o.isDark){const e=m.themeOverrides&&"object"==typeof m.themeOverrides?m.themeOverrides:null;y.themeOverrides=l(l({},ce),e||{})}const h=yield d.render(p,y);if(c!==G.value)return;const w=function(e){return e?"string"==typeof e?e:"string"==typeof e.svg?e.svg:"string"==typeof e.data?e.data:"":""}(h);if(!w)throw new Error("D2 render returned empty output.");!function(e){const o=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";if(!e)return"";const o=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),t=(new DOMParser).parseFromString(o,"image/svg+xml").documentElement;if(!t||"svg"!==t.nodeName.toLowerCase())return"";const n=t;return function(e){const o=/* @__PURE__ */new Set(["script"]),t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){if(o.has(n.tagName.toLowerCase())){n.remove();continue}const e=Array.from(n.attributes);for(const o of e){const e=o.name;if(/^on/i.test(e))n.removeAttribute(e);else{if("style"===e&&o.value){const t=o.value;if(he.some(e=>e.test(t))){n.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&o.value){const t=xe(o.value);if(!t){n.removeAttribute(e);continue}t!==o.value&&n.setAttribute(e,t)}}}}}(n),n.outerHTML}(e);V.value=o||""}(w),o.loading&&(a.value=!1),$.value=null}catch(d){if(c!==G.value)return;const e=(null==d?void 0:d.message)?String(d.message):"D2 render failed.";o.loading||($.value=e),e.includes("@terrastruct/d2")&&(A.value=!1,a.value=!0)}finally{c===G.value&&(z.value=!1,ue&&(ue=!1,Be()))}})}function Be(e=!1){if(re)return;if(!te)return;if(le)return;if(z.value)return void(ue=!0);const t=Math.max(120,Number(o.progressiveIntervalMs)||0),n=Date.now()-ie;if(!e&&n<t)return ue=!0,void(null==ae&&(ae=window.setTimeout(()=>{ae=null,ue&&(ue=!1,Be(!0))},Math.max(0,t-n))));re=!0;const r=()=>{re=!1,ie=Date.now(),ke()};"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(r):setTimeout(r,0)}function De(){if(V.value)try{const e=new Blob([V.value],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(e);if("undefined"!=typeof document){const e=document.createElement("a");e.href=o,e.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(e),e.click(),document.body.removeChild(e)}URL.revokeObjectURL(o)}catch(e){console.error("Failed to export SVG:",e)}}function Ce(){const e=J.value;if(!e)return;const o=e.getBoundingClientRect().height;o>0&&(K.value=o)}return c(()=>[o.node.code,o.loading,o.isDark],()=>{Be()},{immediate:!0}),c(()=>o.loading,(e,o)=>{o&&!e&&Be(!0)}),c(()=>[W.value,V.value,Q.value],()=>{d(()=>{Ce()})}),v(()=>{Be(),d(()=>{Ce()}),"undefined"!=typeof ResizeObserver&&(se=new ResizeObserver(()=>{Ce()}),J.value&&se.observe(J.value))}),p(()=>{le=!0,null!=ae&&(clearTimeout(ae),ae=null),null==se||se.disconnect(),se=null}),(e,l)=>(m(),f("div",{class:g(["d2-block-container my-4 rounded-lg border overflow-hidden shadow-sm",o.isDark?"border-gray-700/30 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900"])},[o.showHeader?(m(),f("div",T,[l[16]||(l[16]=y("div",{class:"flex items-center gap-x-2"},[y("span",{class:"text-sm font-medium font-mono"},"D2")],-1)),y("div",j,[o.showModeToggle?(m(),f("div",{key:0,class:g(["flex items-center gap-x-1 rounded-md p-0.5",o.isDark?"bg-gray-700":"bg-gray-100"])},[y("button",{type:"button",class:g(["mode-btn px-2 py-1 text-xs rounded",a.value?"":"is-active"]),onClick:l[0]||(l[0]=e=>ye("preview")),onMouseenter:l[1]||(l[1]=e=>ve(e,h(t)("common.preview")||"Preview")),onFocus:l[2]||(l[2]=e=>ve(e,h(t)("common.preview")||"Preview")),onMouseleave:pe,onBlur:pe},w(h(t)("common.preview")||"Preview"),35),y("button",{type:"button",class:g(["mode-btn px-2 py-1 text-xs rounded",a.value?"is-active":""]),onClick:l[3]||(l[3]=e=>ye("source")),onMouseenter:l[4]||(l[4]=e=>ve(e,h(t)("common.source")||"Source")),onFocus:l[5]||(l[5]=e=>ve(e,h(t)("common.source")||"Source")),onMouseleave:pe,onBlur:pe},w(h(t)("common.source")||"Source"),35)],2)):x("",!0),o.showCopyButton?(m(),f("button",{key:1,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":n.value?h(t)("common.copied")||"Copied":h(t)("common.copy")||"Copy",onClick:fe,onMouseenter:l[6]||(l[6]=e=>me(e)),onFocus:l[7]||(l[7]=e=>me(e)),onMouseleave:pe,onBlur:pe},[n.value?(m(),f("svg",H,[...l[13]||(l[13]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(m(),f("svg",F,[...l[12]||(l[12]=[y("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[y("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),y("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,O)):x("",!0),o.showExportButton&&V.value?(m(),f("button",{key:2,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-label":h(t)("common.export")||"Export",onClick:De,onMouseenter:l[8]||(l[8]=e=>ve(e,h(t)("common.export")||"Export")),onFocus:l[9]||(l[9]=e=>ve(e,h(t)("common.export")||"Export")),onMouseleave:pe,onBlur:pe},[...l[14]||(l[14]=[y("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,I)):x("",!0),o.showCollapseButton?(m(),f("button",{key:3,type:"button",class:"d2-action-btn p-2 text-xs rounded-md transition-colors hover:bg-[var(--vscode-editor-selectionBackground)]","aria-pressed":r.value,onClick:ge,onMouseenter:l[10]||(l[10]=e=>ve(e,r.value?h(t)("common.expand")||"Expand":h(t)("common.collapse")||"Collapse")),onFocus:l[11]||(l[11]=e=>ve(e,r.value?h(t)("common.expand")||"Expand":h(t)("common.collapse")||"Collapse")),onMouseleave:pe,onBlur:pe},[(m(),f("svg",{style:b({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"w-3 h-3"},[...l[15]||(l[15]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,N)):x("",!0)])])):x("",!0),k(y("div",{ref_key:"bodyRef",ref:J,class:"d2-block-body",style:b(ee.value)},[o.loading&&!Z.value?(m(),f("div",L,[y("pre",P,[y("code",null,w(Q.value),1)]),$.value?(m(),f("p",R,w($.value),1)):x("",!0)])):(m(),f("div",S,[W.value?(m(),f("div",_,[y("pre",U,[y("code",null,w(Q.value),1)]),$.value?(m(),f("p",X,w($.value),1)):x("",!0)])):(m(),f("div",{key:1,class:"d2-render",style:b(oe.value)},[y("div",{class:"d2-svg",innerHTML:V.value},null,8,Y),$.value?(m(),f("p",q,w($.value),1)):x("",!0)],4))]))],4),[[B,!r.value]])],2))}}),[["__scopeId","data-v-f9232822"]]);$.install=e=>{e.component($.__name,$)};export{$ as default};
|
package/dist/safeRaf.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function i(i){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(i)}catch(t){}return globalThis.setTimeout(i,0)}function t(i){try{if(null==i)return;if("undefined"!=typeof globalThis&&"function"==typeof globalThis.cancelAnimationFrame)return void globalThis.cancelAnimationFrame(i)}catch(t){}try{globalThis.clearTimeout(i)}catch(t){}}export{t as a,i as s};
|
package/dist/tailwind.ts
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "markstream-vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.8
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"description": "Vue 3 Markdown renderer optimized for large docs: progressive Mermaid, streaming diff code blocks, and fast real-time preview.",
|
|
6
6
|
"author": "Simon He",
|
|
7
7
|
"license": "MIT",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"mermaid": ">=11",
|
|
74
74
|
"shiki": "^3.13.0",
|
|
75
75
|
"stream-markdown": ">=0.0.14",
|
|
76
|
-
"stream-monaco": ">=0.0.
|
|
76
|
+
"stream-monaco": ">=0.0.18",
|
|
77
77
|
"vue": ">=3.0.0",
|
|
78
78
|
"vue-i18n": ">=9"
|
|
79
79
|
},
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@floating-ui/dom": "^1.7.
|
|
108
|
-
"stream-markdown-parser": "0.0.
|
|
107
|
+
"@floating-ui/dom": "^1.7.6",
|
|
108
|
+
"stream-markdown-parser": "0.0.68"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
111
|
"@antfu/eslint-config": "^5.4.1",
|
|
@@ -114,18 +114,19 @@
|
|
|
114
114
|
"@vitejs/plugin-vue": "^5.2.4",
|
|
115
115
|
"@vitest/ui": "^4.0.18",
|
|
116
116
|
"@vue/test-utils": "^2.4.6",
|
|
117
|
-
"autoprefixer": "^10.4.
|
|
117
|
+
"autoprefixer": "^10.4.27",
|
|
118
118
|
"bumpp": "^8.2.1",
|
|
119
119
|
"conventional-changelog-cli": "^5.0.0",
|
|
120
|
-
"eslint": "^9.39.
|
|
120
|
+
"eslint": "^9.39.4",
|
|
121
121
|
"lint-staged": "^13.3.0",
|
|
122
122
|
"lz-string": "^1.5.0",
|
|
123
123
|
"markdown-it-emoji": "^3.0.0",
|
|
124
124
|
"picocolors": "^1.1.1",
|
|
125
|
+
"playwright-core": "^1.58.2",
|
|
125
126
|
"postcss-cli": "^11.0.1",
|
|
126
|
-
"rollup": "^3.
|
|
127
|
+
"rollup": "^3.30.0",
|
|
127
128
|
"rollup-plugin-dts": "^5.3.1",
|
|
128
|
-
"rollup-plugin-visualizer": "^6.0.
|
|
129
|
+
"rollup-plugin-visualizer": "^6.0.11",
|
|
129
130
|
"tailwindcss": "^3.4.19",
|
|
130
131
|
"terser": "^5.46.0",
|
|
131
132
|
"tsx": "^4.21.0",
|
|
@@ -135,10 +136,10 @@
|
|
|
135
136
|
"vite": "^7.3.1",
|
|
136
137
|
"vite-plugin-dts": "^4.5.4",
|
|
137
138
|
"vite-plugin-pages": "^0.33.3",
|
|
138
|
-
"vite-svg-loader": "^5.1.
|
|
139
|
+
"vite-svg-loader": "^5.1.1",
|
|
139
140
|
"vitepress": "^1.6.4",
|
|
140
141
|
"vitest": "^4.0.18",
|
|
141
|
-
"vue": "^3.5.
|
|
142
|
+
"vue": "^3.5.29",
|
|
142
143
|
"vue-tsc": "^2.2.12"
|
|
143
144
|
},
|
|
144
145
|
"lint-staged": {
|
|
@@ -147,6 +148,8 @@
|
|
|
147
148
|
"scripts": {
|
|
148
149
|
"dev": "pnpm run -C playground dev",
|
|
149
150
|
"test": "vitest",
|
|
151
|
+
"test:e2e:diff-folding": "node scripts/e2e-diff-folding.mjs",
|
|
152
|
+
"test:e2e:codeblock-highlight-stability": "node scripts/e2e-codeblock-highlight-stability.mjs",
|
|
150
153
|
"lint": "eslint . --cache",
|
|
151
154
|
"lint:fix": "pnpm run lint --fix",
|
|
152
155
|
"test:ui": "vitest --ui",
|
|
@@ -199,6 +202,9 @@
|
|
|
199
202
|
"tag:prune:v:dry": "node scripts/prune-tags.mjs --pattern 'v*' --dry-run",
|
|
200
203
|
"tag:prune:v:local": "node scripts/prune-tags.mjs --pattern 'v*' --apply --local",
|
|
201
204
|
"tag:prune:v:all": "node scripts/prune-tags.mjs --pattern 'v*' --apply --local --remote-delete",
|
|
202
|
-
"check:peer-deps": "node ./scripts/check-peer-deps.cjs"
|
|
205
|
+
"check:peer-deps": "node ./scripts/check-peer-deps.cjs",
|
|
206
|
+
"test:e2e:link-tooltip-streaming": "node scripts/e2e-link-tooltip-streaming.mjs",
|
|
207
|
+
"test:e2e:vue2-cli-smoke": "node scripts/e2e-vue2-cli-smoke.mjs",
|
|
208
|
+
"test:e2e:math-streaming-stability": "node scripts/e2e-math-streaming-stability.mjs"
|
|
203
209
|
}
|
|
204
210
|
}
|