PageSourceSearch

https://veronicabeard.com/cdn/shop/t/2004/assets/wishlist-toast.js?v=30300837811088011121790692789

js veronicabeard.com collected 2026-10-02 03:32:35 UTC 4,135 bytes, 2 lines download raw bytes

1import{Component}from"@theme/component";export class WishlistToast extends Component{requiredRefs=["popover","message"];#hideTimeout=null;#previousFocus=null;#autoHideDelay=3e3;#originalParent=null;connectedCallback(){super.connectedCallback(),this.#autoHideDelay=parseInt(this.dataset.autoHideDelay||"5000",10),this.#setupEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this.#clearHideTimeout(),this.#removeEventListeners()}#setupEventListeners(){document.addEventListener("ooo-wishlist:product-added",this.#handleProductAdded),document.addEventListener("ooo-wishlist:product-removed",this.#handleProductRemoved),document.addEventListener("wk:wishlist:add:success",this.#handleProductAdded),document.addEventListener("wk:wishlist:remove:success",this.#handleProductRemoved)}#removeEventListeners(){document.removeEventListener("ooo-wishlist:product-added",this.#handleProductAdded),document.removeEventListener("ooo-wishlist:product-removed",this.#handleProductRemoved),document.removeEventListener("wk:wishlist:add:success",this.#handleProductAdded),document.removeEventListener("wk:wishlist:remove:success",this.#handleProductRemoved)}#handleProductAdded=()=>{this.show("added")};#handleProductRemoved=()=>{this.show("removed")};#setSuccessIcon(){this.refs.iconCheck&&(this.refs.iconCheck.hidden=!1),this.refs.iconClose&&(this.refs.iconClose.hidden=!0)}#reparentForModal(popover){const openDialogs=document.querySelectorAll("dialog[open]"),topmostDialog=openDialogs.length?openDialogs[openDialogs.length-1]:null;topmostDialog&&!topmostDialog.contains(popover)&&(this.#originalParent=popover.parentElement,topmostDialog.appendChild(popover))}#restoreParent(){const popover=this.refs.popover;this.#originalParent&&popover.parentElement!==this.#originalParent&&this.#originalParent.appendChild(popover),this.#originalParent=null}#focusToast(){const popover=this.refs.popover;(this.refs.viewLink??popover).focus()}#showPopover(){this.#clearHideTimeout(),this.#previousFocus=document.activeElement;const popover=this.refs.popover;if(popover.classList.remove("wishlist-toast--hiding"),this.#reparentForModal(popover),typeof popover.showPopover=="function"){const onToggle=e=>{e.newState==="open"&&(popover.removeEventListener("toggle",onToggle),this.#focusToast())};popover.addEventListener("toggle",onToggle),popover.showPopover()}else popover.style.display="block",setTimeout(()=>this.#focusToast(),0);this.#hideTimeout=window.setTimeout(()=>this.hide(),this.#autoHideDelay)}show(action){this.#clearHideTimeout(),this.#previousFocus=document.activeElement;const message=action==="added"?this.dataset.addedMessage:this.dataset.removedMessage;this.refs.message.textContent=message||"",this.refs.viewLink&&(this.refs.viewLink.href=this.dataset.wishlistUrl||"#",this.refs.viewLink.textContent=this.dataset.viewLabel||""),this.#setSuccessIcon();const popover=this.refs.popover,viewLink=this.refs.viewLink;if(popover.classList.remove("wishlist-toast--hiding"),this.#reparentForModal(popover),typeof popover.showPopover=="function"){const onToggle=e=>{e.newState==="open"&&(popover.removeEventListener("toggle",onToggle),this.#focusToast())};popover.addEventListener("toggle",onToggle),popover.showPopover()}else popover.style.display="block",setTimeout(()=>this.#focusToast(),0);this.#hideTimeout=window.setTimeout(()=>{this.hide()},this.#autoHideDelay)}hide(){this.#clearHideTimeout();const popover=this.refs.popover;popover.classList.add("wishlist-toast--hiding");const onAnimationEnd=()=>{popover.classList.remove("wishlist-toast--hiding"),typeof popover.hidePopover=="function"?popover.hidePopover():popover.style.display="none",popover.removeEventListener("animationend",onAnimationEnd),this.#restoreParent(),this.#previousFocus?.focus(),this.#previousFocus=null};popover.addEventListener("animationend",onAnimationEnd)}#clearHideTimeout(){this.#hideTimeout!==null&&(clearTimeout(this.#hideTimeout),this.#hideTimeout=null)}}customElements.get("wishlist-toast")||customElements.define("wishlist-toast",WishlistToast);
2//# sourceMappingURL=/cdn/shop/t/2004/assets/wishlist-toast.js.map?v=30300837811088011121790692789

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.