markstream-vue2 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/dist/Tooltip.js +1 -0
- package/dist/exports.js +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +1742 -0
- package/dist/index.js +1 -0
- package/dist/index2.js +1 -0
- package/dist/index3.js +1 -0
- package/dist/index4.js +1 -0
- package/dist/index5.js +6 -0
- package/dist/performance-monitor.js +1 -0
- package/dist/workers/katexRenderer.worker.js +55 -0
- package/dist/workers/mermaidParser.worker.js +117 -0
- package/package.json +79 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# markstream-vue2
|
|
2
|
+
|
|
3
|
+
Vue 2.6-compatible renderer for markstream-vue.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add markstream-vue2
|
|
9
|
+
# npm i markstream-vue2
|
|
10
|
+
# yarn add markstream-vue2
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage (Vue 2.6)
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import MarkdownRender, { VueRendererMarkdown } from 'markstream-vue2'
|
|
17
|
+
import Vue from 'vue'
|
|
18
|
+
import 'markstream-vue2/index.css'
|
|
19
|
+
|
|
20
|
+
Vue.use(VueRendererMarkdown)
|
|
21
|
+
|
|
22
|
+
new Vue({
|
|
23
|
+
render: h => h(MarkdownRender, {
|
|
24
|
+
props: {
|
|
25
|
+
content: '# Hello from Vue 2',
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
}).$mount('#app')
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Notes
|
|
32
|
+
|
|
33
|
+
- This is a baseline Vue 2 port focused on correct rendering.
|
|
34
|
+
- Advanced Vue 3 optimizations (virtualization, streaming code blocks, Monaco, Mermaid, KaTeX renderers, tooltip singleton) are not included yet.
|
|
35
|
+
- Custom node components are supported via `setCustomComponents` from `markstream-vue2`.
|
package/dist/Tooltip.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty,e=Object.defineProperties,n=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,l=(e,n,o)=>n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,s=(t,e)=>{for(var n in e||(e={}))i.call(e,n)&&l(t,n,e[n]);if(o)for(var n of o(e))r.call(e,n)&&l(t,n,e[n]);return t},c=(t,o)=>e(t,n(o)),a=(t,e)=>{var n={};for(var l in t)i.call(t,l)&&e.indexOf(l)<0&&(n[l]=t[l]);if(null!=t&&o)for(var l of o(t))e.indexOf(l)<0&&r.call(t,l)&&(n[l]=t[l]);return n},u=(t,e,n)=>new Promise((o,i)=>{var r=t=>{try{s(n.next(t))}catch(e){i(e)}},l=t=>{try{s(n.throw(t))}catch(e){i(e)}},s=t=>t.done?o(t.value):Promise.resolve(t.value).then(r,l);s((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),d=require("./exports.js");require("stream-markdown-parser");const p=Math.min,h=Math.max,m=Math.round,y=Math.floor,g=t=>({x:t,y:t}),x={left:"right",right:"left",bottom:"top",top:"bottom"},v={start:"end",end:"start"};function w(t,e,n){return h(t,p(e,n))}function b(t,e){return"function"==typeof t?t(e):t}function R(t){return t.split("-")[0]}function E(t){return t.split("-")[1]}function T(t){return"x"===t?"y":"x"}function L(t){return"y"===t?"height":"width"}const k=new Set(["top","bottom"]);function A(t){return k.has(R(t))?"y":"x"}function S(t){return T(A(t))}function P(t){return t.replace(/start|end/g,t=>v[t])}const O=["left","right"],D=["right","left"],C=["top","bottom"],M=["bottom","top"];function F(t){return t.replace(/left|right|bottom|top/g,t=>x[t])}function B(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function W(t,e,n){let{reference:o,floating:i}=t;const r=A(e),l=S(e),s=L(l),c=R(e),a="y"===r,u=o.x+o.width/2-i.width/2,f=o.y+o.height/2-i.height/2,d=o[s]/2-i[s]/2;let p;switch(c){case"top":p={x:u,y:o.y-i.height};break;case"bottom":p={x:u,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:f};break;case"left":p={x:o.x-i.width,y:f};break;default:p={x:o.x,y:o.y}}switch(E(e)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}function _(t,e){return u(this,null,function*(){var n;void 0===e&&(e={});const{x:o,y:i,platform:r,rects:l,elements:c,strategy:a}=t,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:d="floating",altBoundary:p=!1,padding:h=0}=b(e,t),m=function(t){return"number"!=typeof t?function(t){return s({top:0,right:0,bottom:0,left:0},t)}(t):{top:t,right:t,bottom:t,left:t}}(h),y=c[p?"floating"===d?"reference":"floating":d],g=B(yield r.getClippingRect({element:null==(n=yield null==r.isElement?void 0:r.isElement(y))||n?y:y.contextElement||(yield null==r.getDocumentElement?void 0:r.getDocumentElement(c.floating)),boundary:u,rootBoundary:f,strategy:a})),x="floating"===d?{x:o,y:i,width:l.floating.width,height:l.floating.height}:l.reference,v=yield null==r.getOffsetParent?void 0:r.getOffsetParent(c.floating),w=(yield null==r.isElement?void 0:r.isElement(v))&&(yield null==r.getScale?void 0:r.getScale(v))||{x:1,y:1},R=B(r.convertOffsetParentRelativeRectToViewportRelativeRect?yield r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:v,strategy:a}):x);return{top:(g.top-R.top+m.top)/w.y,bottom:(R.bottom-g.bottom+m.bottom)/w.y,left:(g.left-R.left+m.left)/w.x,right:(R.right-g.right+m.right)/w.x}})}const j=new Set(["left","top"]);function H(){return"undefined"!=typeof window}function N(t){return X(t)?(t.nodeName||"").toLowerCase():"#document"}function V(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function z(t){var e;return null==(e=(X(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function X(t){return!!H()&&(t instanceof Node||t instanceof V(t).Node)}function Y(t){return!!H()&&(t instanceof Element||t instanceof V(t).Element)}function $(t){return!!H()&&(t instanceof HTMLElement||t instanceof V(t).HTMLElement)}function q(t){return!(!H()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof V(t).ShadowRoot)}const I=new Set(["inline","contents"]);function U(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=lt(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!I.has(i)}const G=new Set(["table","td","th"]);function J(t){return G.has(N(t))}const K=[":popover-open",":modal"];function Q(t){return K.some(e=>{try{return t.matches(e)}catch(n){return!1}})}const Z=["transform","translate","scale","rotate","perspective"],tt=["transform","translate","scale","rotate","perspective","filter"],et=["paint","layout","strict","content"];function nt(t){const e=ot(),n=Y(t)?lt(t):t;return Z.some(t=>!!n[t]&&"none"!==n[t])||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||tt.some(t=>(n.willChange||"").includes(t))||et.some(t=>(n.contain||"").includes(t))}function ot(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const it=new Set(["html","body","#document"]);function rt(t){return it.has(N(t))}function lt(t){return V(t).getComputedStyle(t)}function st(t){return Y(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ct(t){if("html"===N(t))return t;const e=t.assignedSlot||t.parentNode||q(t)&&t.host||z(t);return q(e)?e.host:e}function at(t){const e=ct(t);return rt(e)?t.ownerDocument?t.ownerDocument.body:t.body:$(e)&&U(e)?e:at(e)}function ut(t,e,n){var o;void 0===e&&(e=[]),void 0===n&&(n=!0);const i=at(t),r=i===(null==(o=t.ownerDocument)?void 0:o.body),l=V(i);if(r){const t=ft(l);return e.concat(l,l.visualViewport||[],U(i)?i:[],t&&n?ut(t):[])}return e.concat(i,ut(i,[],n))}function ft(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function dt(t){const e=lt(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=$(t),r=i?t.offsetWidth:n,l=i?t.offsetHeight:o,s=m(n)!==r||m(o)!==l;return s&&(n=r,o=l),{width:n,height:o,$:s}}function pt(t){return Y(t)?t:t.contextElement}function ht(t){const e=pt(t);if(!$(e))return g(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=dt(e);let l=(r?m(n.width):n.width)/o,s=(r?m(n.height):n.height)/i;return l&&Number.isFinite(l)||(l=1),s&&Number.isFinite(s)||(s=1),{x:l,y:s}}const mt=g(0);function yt(t){const e=V(t);return ot()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:mt}function gt(t,e,n,o){void 0===e&&(e=!1),void 0===n&&(n=!1);const i=t.getBoundingClientRect(),r=pt(t);let l=g(1);e&&(o?Y(o)&&(l=ht(o)):l=ht(t));const s=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==V(t))&&e}(r,n,o)?yt(r):g(0);let c=(i.left+s.x)/l.x,a=(i.top+s.y)/l.y,u=i.width/l.x,f=i.height/l.y;if(r){const t=V(r),e=o&&Y(o)?V(o):o;let n=t,i=ft(n);for(;i&&o&&e!==n;){const t=ht(i),e=i.getBoundingClientRect(),o=lt(i),r=e.left+(i.clientLeft+parseFloat(o.paddingLeft))*t.x,l=e.top+(i.clientTop+parseFloat(o.paddingTop))*t.y;c*=t.x,a*=t.y,u*=t.x,f*=t.y,c+=r,a+=l,n=V(i),i=ft(n)}}return B({width:u,height:f,x:c,y:a})}function xt(t,e){const n=st(t).scrollLeft;return e?e.left+n:gt(z(t)).left+n}function vt(t,e){const n=t.getBoundingClientRect();return{x:n.left+e.scrollLeft-xt(t,n),y:n.top+e.scrollTop}}const wt=new Set(["absolute","fixed"]);function bt(t,e,n){let o;if("viewport"===e)o=function(t,e){const n=V(t),o=z(t),i=n.visualViewport;let r=o.clientWidth,l=o.clientHeight,s=0,c=0;if(i){r=i.width,l=i.height;const t=ot();(!t||t&&"fixed"===e)&&(s=i.offsetLeft,c=i.offsetTop)}const a=xt(o);if(a<=0){const t=o.ownerDocument,e=t.body,n=getComputedStyle(e),i="CSS1Compat"===t.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(o.clientWidth-e.clientWidth-i);l<=25&&(r-=l)}else a<=25&&(r+=a);return{width:r,height:l,x:s,y:c}}(t,n);else if("document"===e)o=function(t){const e=z(t),n=st(t),o=t.ownerDocument.body,i=h(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=h(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+xt(t);const s=-n.scrollTop;return"rtl"===lt(o).direction&&(l+=h(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:l,y:s}}(z(t));else if(Y(e))o=function(t,e){const n=gt(t,!0,"fixed"===e),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=$(t)?ht(t):g(1);return{width:t.clientWidth*r.x,height:t.clientHeight*r.y,x:i*r.x,y:o*r.y}}(e,n);else{const n=yt(t);o={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return B(o)}function Rt(t,e){const n=ct(t);return!(n===e||!Y(n)||rt(n))&&("fixed"===lt(n).position||Rt(n,e))}function Et(t,e,n){const o=$(e),i=z(e),r="fixed"===n,l=gt(t,!0,r,e);let s={scrollLeft:0,scrollTop:0};const c=g(0);function a(){c.x=xt(i)}if(o||!o&&!r)if(("body"!==N(e)||U(i))&&(s=st(e)),o){const t=gt(e,!0,r,e);c.x=t.x+e.clientLeft,c.y=t.y+e.clientTop}else i&&a();r&&!o&&i&&a();const u=!i||o||r?g(0):vt(i,s);return{x:l.left+s.scrollLeft-c.x-u.x,y:l.top+s.scrollTop-c.y-u.y,width:l.width,height:l.height}}function Tt(t){return"static"===lt(t).position}function Lt(t,e){if(!$(t)||"fixed"===lt(t).position)return null;if(e)return e(t);let n=t.offsetParent;return z(t)===n&&(n=n.ownerDocument.body),n}function kt(t,e){const n=V(t);if(Q(t))return n;if(!$(t)){let e=ct(t);for(;e&&!rt(e);){if(Y(e)&&!Tt(e))return e;e=ct(e)}return n}let o=Lt(t,e);for(;o&&J(o)&&Tt(o);)o=Lt(o,e);return o&&rt(o)&&Tt(o)&&!nt(o)?n:o||function(t){let e=ct(t);for(;$(e)&&!rt(e);){if(nt(e))return e;if(Q(e))return null;e=ct(e)}return null}(t)||n}const At={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r="fixed"===i,l=z(o),s=!!e&&Q(e.floating);if(o===l||s&&r)return n;let c={scrollLeft:0,scrollTop:0},a=g(1);const u=g(0),f=$(o);if((f||!f&&!r)&&(("body"!==N(o)||U(l))&&(c=st(o)),$(o))){const t=gt(o);a=ht(o),u.x=t.x+o.clientLeft,u.y=t.y+o.clientTop}const d=!l||f||r?g(0):vt(l,c);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-c.scrollLeft*a.x+u.x+d.x,y:n.y*a.y-c.scrollTop*a.y+u.y+d.y}},getDocumentElement:z,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const r=[..."clippingAncestors"===n?Q(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let o=ut(t,[],!1).filter(t=>Y(t)&&"body"!==N(t)),i=null;const r="fixed"===lt(t).position;let l=r?ct(t):t;for(;Y(l)&&!rt(l);){const e=lt(l),n=nt(l);n||"fixed"!==e.position||(i=null),(r?!n&&!i:!n&&"static"===e.position&&i&&wt.has(i.position)||U(l)&&!n&&Rt(t,l))?o=o.filter(t=>t!==l):i=e,l=ct(l)}return e.set(t,o),o}(e,this._c):[].concat(n),o],l=r[0],s=r.reduce((t,n)=>{const o=bt(e,n,i);return t.top=h(o.top,t.top),t.right=p(o.right,t.right),t.bottom=p(o.bottom,t.bottom),t.left=h(o.left,t.left),t},bt(e,l,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:kt,getElementRects:function(t){return u(this,null,function*(){const e=this.getOffsetParent||kt,n=this.getDimensions,o=yield n(t.floating);return{reference:Et(t.reference,yield e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}})},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=dt(t);return{width:e,height:n}},getScale:ht,isElement:Y,isRTL:function(t){return"rtl"===lt(t).direction}};function St(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function Pt(t,e,n,o){void 0===o&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:a="function"==typeof IntersectionObserver,animationFrame:u=!1}=o,f=pt(t),d=i||r?[...f?ut(f):[],...ut(e)]:[];d.forEach(t=>{i&&t.addEventListener("scroll",n,{passive:!0}),r&&t.addEventListener("resize",n)});const m=f&&a?function(t,e){let n,o=null;const i=z(t);function r(){var t;clearTimeout(n),null==(t=o)||t.disconnect(),o=null}return function l(a,u){void 0===a&&(a=!1),void 0===u&&(u=1),r();const f=t.getBoundingClientRect(),{left:d,top:m,width:g,height:x}=f;if(a||e(),!g||!x)return;const v={rootMargin:-y(m)+"px "+-y(i.clientWidth-(d+g))+"px "+-y(i.clientHeight-(m+x))+"px "+-y(d)+"px",threshold:h(0,p(1,u))||1};let w=!0;function b(e){const o=e[0].intersectionRatio;if(o!==u){if(!w)return l();o?l(!1,o):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==o||St(f,t.getBoundingClientRect())||l(),w=!1}try{o=new IntersectionObserver(b,c(s({},v),{root:i.ownerDocument}))}catch(R){o=new IntersectionObserver(b,v)}o.observe(t)}(!0),r}(f,n):null;let g,x=-1,v=null;l&&(v=new ResizeObserver(t=>{let[o]=t;o&&o.target===f&&v&&(v.unobserve(e),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var t;null==(t=v)||t.observe(e)})),n()}),f&&!u&&v.observe(f),v.observe(e));let w=u?gt(t):null;return u&&function e(){const o=gt(t);w&&!St(w,o)&&n(),w=o,g=requestAnimationFrame(e)}(),n(),()=>{var t;d.forEach(t=>{i&&t.removeEventListener("scroll",n),r&&t.removeEventListener("resize",n)}),null==m||m(),null==(t=v)||t.disconnect(),v=null,u&&cancelAnimationFrame(g)}}const Ot=function(t){return void 0===t&&(t={}),{name:"shift",options:t,fn(e){return u(this,null,function*(){const{x:n,y:o,placement:i}=e,r=b(t,e),{mainAxis:l=!0,crossAxis:u=!1,limiter:f={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}}}=r,d=a(r,["mainAxis","crossAxis","limiter"]),p={x:n,y:o},h=yield _(e,d),m=A(R(i)),y=T(m);let g=p[y],x=p[m];if(l){const t="y"===y?"bottom":"right";g=w(g+h["y"===y?"top":"left"],g,g-h[t])}if(u){const t="y"===m?"bottom":"right";x=w(x+h["y"===m?"top":"left"],x,x-h[t])}const v=f.fn(c(s({},e),{[y]:g,[m]:x}));return c(s({},v),{data:{x:v.x-n,y:v.y-o,enabled:{[y]:l,[m]:u}}})})}}},Dt=function(t){return void 0===t&&(t={}),{name:"flip",options:t,fn(e){return u(this,null,function*(){var n,o;const{placement:i,middlewareData:r,rects:l,initialPlacement:s,platform:c,elements:u}=e,f=b(t,e),{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:g=!0}=f,x=a(f,["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"]);if(null!=(n=r.arrow)&&n.alignmentOffset)return{};const v=R(i),w=A(s),T=R(s)===s,k=yield null==c.isRTL?void 0:c.isRTL(u.floating),B=h||(T||!g?[F(s)]:function(t){const e=F(t);return[P(t),e,P(e)]}(s)),W="none"!==y;!h&&W&&B.push(...function(t,e,n,o){const i=E(t);let r=function(t,e,n){switch(t){case"top":case"bottom":return n?e?D:O:e?O:D;case"left":case"right":return e?C:M;default:return[]}}(R(t),"start"===n,o);return i&&(r=r.map(t=>t+"-"+i),e&&(r=r.concat(r.map(P)))),r}(s,g,y,k));const j=[s,...B],H=yield _(e,x),N=[];let V=(null==(o=r.flip)?void 0:o.overflows)||[];if(d&&N.push(H[v]),p){const t=function(t,e,n){void 0===n&&(n=!1);const o=E(t),i=S(t),r=L(i);let l="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return e.reference[r]>e.floating[r]&&(l=F(l)),[l,F(l)]}(i,l,k);N.push(H[t[0]],H[t[1]])}if(V=[...V,{placement:i,overflows:N}],!N.every(t=>t<=0)){var z,X;const t=((null==(z=r.flip)?void 0:z.index)||0)+1,e=j[t];if(e&&("alignment"!==p||w===A(e)||V.every(t=>A(t.placement)!==w||t.overflows[0]>0)))return{data:{index:t,overflows:V},reset:{placement:e}};let n=null==(X=V.filter(t=>t.overflows[0]<=0).sort((t,e)=>t.overflows[1]-e.overflows[1])[0])?void 0:X.placement;if(!n)switch(m){case"bestFit":{var Y;const t=null==(Y=V.filter(t=>{if(W){const e=A(t.placement);return e===w||"y"===e}return!0}).map(t=>[t.placement,t.overflows.filter(t=>t>0).reduce((t,e)=>t+e,0)]).sort((t,e)=>t[1]-e[1])[0])?void 0:Y[0];t&&(n=t);break}case"initialPlacement":n=s}if(i!==n)return{reset:{placement:n}}}return{}})}}},Ct=f.defineComponent({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:null,content:null,placement:null,offset:null,originX:null,originY:null,id:null,isDark:{type:[Boolean,null]}},setup(t){const e=t,n=f.computed(()=>{if(void 0!==e.isDark&&null!==e.isDark)return Boolean(e.isDark);if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0;if((null==window?void 0:window.matchMedia)&&window.matchMedia("(prefers-color-scheme: dark)").matches)return!0}catch(t){}return!1}),o=f.ref(null),i=f.ref({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),r=f.ref(!1);let l=null;function a(){return u(this,null,function*(){var t,n;if(!e.anchorEl||!o.value)return;const r=[(f=null!=(t=e.offset)?t:8,void 0===f&&(f=0),{name:"offset",options:f,fn(t){return u(this,null,function*(){var e,n;const{x:o,y:i,placement:r,middlewareData:l}=t,a=yield function(t,e){return u(this,null,function*(){const{placement:n,platform:o,elements:i}=t,r=yield null==o.isRTL?void 0:o.isRTL(i.floating),l=R(n),s=E(n),c="y"===A(n),a=j.has(l)?-1:1,u=r&&c?-1:1,f=b(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:h}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),c?{x:p*u,y:d*a}:{x:d*a,y:p*u}})}(t,f);return r===(null==(e=l.offset)?void 0:e.placement)&&null!=(n=l.arrow)&&n.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:c(s({},a),{placement:r})}})}}),Dt(),Ot({padding:8})],{x:l,y:a}=yield((t,e,n)=>{const o=new Map,i=s({platform:At},n),r=c(s({},i.platform),{_c:o});return((t,e,n)=>u(exports,null,function*(){const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:l}=n,a=r.filter(Boolean),u=yield null==l.isRTL?void 0:l.isRTL(e);let f=yield l.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:p}=W(f,o,u),h=o,m={},y=0;for(let n=0;n<a.length;n++){const{name:r,fn:g}=a[n],{x,y:v,data:w,reset:b}=yield g({x:d,y:p,initialPlacement:o,placement:h,strategy:i,middlewareData:m,rects:f,platform:l,elements:{reference:t,floating:e}});d=null!=x?x:d,p=null!=v?v:p,m=c(s({},m),{[r]:s(s({},m[r]),w)}),b&&y<=50&&(y++,"object"==typeof b&&(b.placement&&(h=b.placement),b.rects&&(f=!0===b.rects?yield l.getElementRects({reference:t,floating:e,strategy:i}):b.rects),({x:d,y:p}=W(f,h,u))),n=-1)}return{x:d,y:p,placement:h,strategy:i,middlewareData:m}}))(t,e,c(s({},i),{platform:r}))})(e.anchorEl,o.value,{placement:null!=(n=e.placement)?n:"top",middleware:r,strategy:"fixed"});var f;i.value.transform=`translate3d(${Math.round(l)}px, ${Math.round(a)}px, 0)`,i.value.left="0px",i.value.top="0px"})}return f.watch(()=>e.visible,t=>u(this,null,function*(){if(t)if(r.value=!1,yield f.nextTick(),e.anchorEl&&o.value)try{const t=e.anchorEl.getBoundingClientRect();yield a();const n=i.value.transform;if(null!=e.originX&&null!=e.originY){const o=Math.abs(Number(e.originX)-t.left),l=Math.abs(Number(e.originY)-t.top);Math.hypot(o,l)>120?(i.value.transform=`translate3d(${Math.round(e.originX)}px, ${Math.round(e.originY)}px, 0)`,yield f.nextTick(),r.value=!0,yield f.nextTick(),i.value.transform=n):r.value=!0}else r.value=!0;l=Pt(e.anchorEl,o.value,a)}catch(n){yield a(),r.value=!0,l=Pt(e.anchorEl,o.value,a)}else r.value=!0;else r.value=!1,l&&(l(),l=null)})),f.watch([()=>e.anchorEl,()=>e.placement,()=>e.content],()=>u(this,null,function*(){e.visible&&e.anchorEl&&o.value&&(yield f.nextTick(),yield a())})),f.onBeforeUnmount(()=>{l&&l()}),{__sfc:!0,props:e,isDarkEffective:n,tooltip:o,style:i,ready:r,cleanupAutoUpdate:l,updatePosition:a,Portal:d.Portal}}});var Mt=function(){var t=this,e=t._self._c,n=t._self._setupProxy;return e(n.Portal,{attrs:{to:"body"}},[e("div",{staticClass:"markstream-vue"},[e("transition",{attrs:{name:"tooltip",appear:""}},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.visible&&n.ready,expression:"visible && ready"}],ref:"tooltip",staticClass:"z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none tooltip-element border",class:[n.isDarkEffective?"bg-gray-900 text-white border-gray-700 border is-dark":"bg-white text-gray-900 border-gray-200 border"],style:{position:"fixed",left:n.style.left,top:n.style.top,transform:n.style.transform},attrs:{id:n.props.id,role:"tooltip"}},[t._v(" "+t._s(t.content)+" ")])])],1)])},Ft=[];const Bt=d.normalizeComponent(Ct,Mt,Ft,!1,null,"d9fe1a2f",null,null).exports;exports.default=Bt;
|