@contentstack/live-preview-utils
Version:
Contentstack provides the Live Preview SDK to establish a communication channel between the various Contentstack SDKs and your website, transmitting live changes to the preview pane.
1 lines • 2.11 kB
Source Map (JSON)
{"version":3,"sources":["../../../../src/visualBuilder/generators/generateHoverOutline.tsx"],"sourcesContent":["import { visualBuilderStyles } from \"../visualBuilder.style\";\n\n/**\n * Adds a hover outline to the target element.\n * @param targetElement - The element to add the hover outline to.\n * @param isAnchorElement - Boolean to check for anchor elements.\n * @returns void\n */\nexport function addHoverOutline(\n targetElement: Element,\n disabled?: boolean\n): void {\n const targetElementDimension = targetElement.getBoundingClientRect();\n\n const hoverOutline = document.querySelector<HTMLDivElement>(\n \".visual-builder__hover-outline\"\n );\n\n if (hoverOutline) {\n hoverOutline.classList.remove(\n visualBuilderStyles()[\"visual-builder__hover-outline--hidden\"]\n );\n\n if (disabled) {\n hoverOutline.classList.add(\n visualBuilderStyles()[\"visual-builder__hover-outline--disabled\"]\n );\n } else {\n hoverOutline.classList.remove(\n visualBuilderStyles()[\"visual-builder__hover-outline--disabled\"]\n );\n }\n\n hoverOutline.style.top = `${\n targetElementDimension.top + window.scrollY\n }px`;\n hoverOutline.style.left = `${targetElementDimension.left}px`;\n hoverOutline.style.width = `${targetElementDimension.width}px`;\n hoverOutline.style.height = `${targetElementDimension.height}px`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAoC;AAQ7B,SAAS,gBACZ,eACA,UACI;AACJ,QAAM,yBAAyB,cAAc,sBAAsB;AAEnE,QAAM,eAAe,SAAS;AAAA,IAC1B;AAAA,EACJ;AAEA,MAAI,cAAc;AACd,iBAAa,UAAU;AAAA,UACnB,0CAAoB,EAAE,uCAAuC;AAAA,IACjE;AAEA,QAAI,UAAU;AACV,mBAAa,UAAU;AAAA,YACnB,0CAAoB,EAAE,yCAAyC;AAAA,MACnE;AAAA,IACJ,OAAO;AACH,mBAAa,UAAU;AAAA,YACnB,0CAAoB,EAAE,yCAAyC;AAAA,MACnE;AAAA,IACJ;AAEA,iBAAa,MAAM,MAAM,GACrB,uBAAuB,MAAM,OAAO,OACxC;AACA,iBAAa,MAAM,OAAO,GAAG,uBAAuB,IAAI;AACxD,iBAAa,MAAM,QAAQ,GAAG,uBAAuB,KAAK;AAC1D,iBAAa,MAAM,SAAS,GAAG,uBAAuB,MAAM;AAAA,EAChE;AACJ;","names":[]}