UNPKG

h-vue-scan

Version:

A Vue 3 plugin for scanning re-rendering states and show them in the browser dom.

13 lines (12 loc) 1.21 kB
(function(o,i){typeof exports=="object"&&typeof module!="undefined"?i(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],i):(o=typeof globalThis!="undefined"?globalThis:o||self,i(o["h-vue-scan"]={},o.Vue))})(this,function(o,i){"use strict";function s(e){if(!e.enabled)return;const r=i.getCurrentInstance();r&&i.nextTick(()=>{const t=r.vnode.el;if(!t)return;const n=document.createElement("div"),u=Math.floor(e.opacity*255).toString(16).padStart(2,"0");n.style.cssText=` position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: ${e.borderWidth} solid ${e.color}; background-color: ${e.color}${u}; pointer-events: none; box-sizing: border-box; z-index: 2147483647; `;const d=getComputedStyle(t),l=t.style.position;d.position==="static"&&(t.style.position="relative"),t.appendChild(n),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),d.position==="static"&&(t.style.position=l)},e.duration)})}const a={autoInject:!0,color:"#41B883",duration:1e3,opacity:.3,borderWidth:"2px",enabled:!1},f={install(e,r=a){}};o.RenderDebugPlugin=f,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});