diff --git a/assets/main-4919727f.js b/assets/main-4b4140dd.js similarity index 99% rename from assets/main-4919727f.js rename to assets/main-4b4140dd.js index e98e2ca..56d1bdc 100644 --- a/assets/main-4919727f.js +++ b/assets/main-4b4140dd.js @@ -1358,7 +1358,7 @@ ${this.promptData.description||""} -`;var Cw=Object.defineProperty,Iw=Object.getOwnPropertyDescriptor,AB=(B,A,Q,U)=>{for(var F=U>1?void 0:U?Iw(A,Q):A,E=B.length-1,R;E>=0;E--)(R=B[E])&&(F=(U?R(A,Q,F):R(F))||F);return U&&F&&Cw(A,Q,F),F};const Vw=nl,gw=20;let HQ=class extends TQ{constructor(){super(),this.localPrompts=[],this.totalLocalPrompts=0,this.favPrompts=[null,null,null],this.maxPromptCount=24,this.isDraggingPromptCard=!1,this.hoveringPromptCardIndex=null,this.hoveringFavPromptCardIndex=null,this.selectedPrompt=Vw[0],this.shouldCreateNewPrompt=!1,this.showSearchBarCancelButton=!1,this.tooltipConfig=null,this.draggingImageElement=null,this.searchBarDebounceTimer=null}firstUpdated(){this.popperElement&&(this.tooltipConfig={tooltipElement:this.popperElement,mouseenterTimer:null,mouseleaveTimer:null})}willUpdate(B){}async initData(){}promptCardClicked(B){if(this.promptModalElement===void 0||this.promptContentElement===void 0)throw Error("promptModalElement is undefined.");this.shouldCreateNewPrompt=!1,this.selectedPrompt=B,this.promptModalElement.style.setProperty("top",`${this.promptContentElement.scrollTop}px`),this.promptModalElement.classList.remove("hidden")}async promptContainerScrolled(){if(this.promptContainerElement===void 0||this.promptLoaderElement===void 0)throw Error("promptContainerElement is undefined");if(this.promptContainerElement.scrollHeight-this.promptContainerElement.scrollTop<=this.promptContainerElement.clientHeight+5&&this.maxPromptCount{setTimeout(()=>{Q()},800)}),this.maxPromptCount+=gw,await this.updateComplete,this.promptLoaderElement.classList.add("hidden"),this.promptContainerElement.scrollTop=A}this.maxPromptCount>=this.localPrompts.length&&this.promptLoaderElement.classList.add("no-display")}promptCardDragStarted(B){var C;this.isDraggingPromptCard=!0;const A=B.target;A.classList.add("dragging"),document.body.style.setProperty("cursor","grabbing"),document.body.style.setProperty("overflow","hidden"),this.hoveringPromptCardIndex=null,B.dataTransfer&&(B.dataTransfer.dropEffect="copy",B.dataTransfer.effectAllowed="copy",B.dataTransfer.setData("newPromptData",JSON.stringify(A.promptData)));let Q=200;this.shadowRoot&&(Q=this.shadowRoot.querySelector(".fav-prompt-slot").getBoundingClientRect().width);const U=document.createElement("div");U.classList.add("fav-prompt-slot"),U.setAttribute("is-temp","true"),U.style.setProperty("width",`${Q}px`);const F=document.createElement("div");F.classList.add("prompt-mini-card");const E=document.createElement("span");E.classList.add("icon"),E.innerText=A.promptData.icon;const R=document.createElement("span");R.classList.add("title"),R.innerText=A.promptData.title,F.appendChild(E),F.appendChild(R),U.appendChild(F),document.body.appendChild(U),this.draggingImageElement=U,(C=B.dataTransfer)==null||C.setDragImage(U,10,10)}promptCardDragEnded(B){var Q;this.isDraggingPromptCard=!1,B.target.classList.remove("dragging"),document.body.style.removeProperty("cursor"),document.body.style.removeProperty("overflow"),(Q=this.draggingImageElement)==null||Q.remove(),this.draggingImageElement=null}favPromptSlotDragEntered(B){B.currentTarget.classList.add("drag-over")}favPromptSlotDragLeft(B){B.currentTarget.classList.remove("drag-over")}favPromptSlotDropped(B,A){if(B.dataTransfer){const U=B.dataTransfer.getData("newPromptData"),F=JSON.parse(U);this.favPrompts[A]=F;const E=structuredClone(this.favPrompts);E[A]=F,this.promptManager.setFavPrompt(A,F)}B.currentTarget.classList.remove("drag-over"),B.preventDefault()}promptCardMouseEntered(B,A){B.preventDefault(),this.hoveringPromptCardIndex=A}promptCardMouseLeft(B){B.preventDefault(),this.hoveringPromptCardIndex=null}modalCloseClickHandler(){if(this.promptModalElement===void 0)throw Error("promptModalElement is undefined.");this.promptModalElement.classList.add("hidden")}creteButtonClicked(){if(this.promptModalElement===void 0)throw Error("promptModalElement is undefined.");this.selectedPrompt=bC(),this.shouldCreateNewPrompt=!0,this.promptModalElement.classList.remove("hidden")}sortOptionChanged(B){const Q=B.currentTarget.value;(Q==="created"||Q==="name"||Q==="runCount")&&this.promptManager.sortPrompts(Q)}menuIconMouseEntered(B,A){const Q=B.currentTarget;let U="";switch(A){case"edit":{U="Edit";break}case"delete":{U="Delete";break}case"remove":{U="Remove favorite prompt";break}default:console.error(`Unknown button ${A}`)}nR(B,U,"top",this.tooltipConfig,200,Q,10)}menuIconMouseLeft(){J0(this.tooltipConfig,0)}menuDeleteClicked(B){if(this.confirmDialogComponent===void 0)throw Error("confirmDialogComponent is undefined");const A={header:"Delete Prompt",message:"Are you sure you want to delete this prompt? This action cannot be undone.",yesButtonText:"Delete",actionKey:"delete-prompt-local"};this.confirmDialogComponent.show(A,()=>{this.promptManager.deletePrompt(B)})}searchBarEntered(B){const Q=B.currentTarget.value;Q.length>0?(this.showSearchBarCancelButton||(this.totalLocalPrompts=this.localPrompts.length),this.showSearchBarCancelButton=!0):this.showSearchBarCancelButton=!1,this.searchBarDebounceTimer!==null&&(clearTimeout(this.searchBarDebounceTimer),this.searchBarDebounceTimer=null),this.searchBarDebounceTimer=setTimeout(()=>{this.promptManager.searchPrompt(Q),this.searchBarDebounceTimer=null},150)}showSearchBarCancelButtonClicked(){if(this.shadowRoot===null)throw Error("shadowRoot is null.");const B=this.shadowRoot.querySelector("#search-bar-input");B.value="",this.showSearchBarCancelButton=!1,this.searchBarDebounceTimer!==null&&(clearTimeout(this.searchBarDebounceTimer),this.searchBarDebounceTimer=null),this.searchBarDebounceTimer=setTimeout(()=>{this.promptManager.searchPrompt(""),this.searchBarDebounceTimer=null},150)}render(){let B=FA``;for(const[U,F]of this.localPrompts.slice(0,Math.min(this.maxPromptCount,this.localPrompts.length)).entries())B=FA`${B} +`;var Cw=Object.defineProperty,Iw=Object.getOwnPropertyDescriptor,AB=(B,A,Q,U)=>{for(var F=U>1?void 0:U?Iw(A,Q):A,E=B.length-1,R;E>=0;E--)(R=B[E])&&(F=(U?R(A,Q,F):R(F))||F);return U&&F&&Cw(A,Q,F),F};const Vw=nl,gw=20;let HQ=class extends TQ{constructor(){super(),this.localPrompts=[],this.totalLocalPrompts=0,this.favPrompts=[null,null,null],this.maxPromptCount=24,this.isDraggingPromptCard=!1,this.hoveringPromptCardIndex=null,this.hoveringFavPromptCardIndex=null,this.selectedPrompt=Vw[0],this.shouldCreateNewPrompt=!1,this.showSearchBarCancelButton=!1,this.tooltipConfig=null,this.draggingImageElement=null,this.searchBarDebounceTimer=null}firstUpdated(){this.popperElement&&(this.tooltipConfig={tooltipElement:this.popperElement,mouseenterTimer:null,mouseleaveTimer:null})}willUpdate(B){}async initData(){}promptCardClicked(B){if(this.promptModalElement===void 0||this.promptContentElement===void 0)throw Error("promptModalElement is undefined.");this.shouldCreateNewPrompt=!1,this.selectedPrompt=B,this.promptModalElement.style.setProperty("top",`${this.promptContentElement.scrollTop}px`),this.promptModalElement.classList.remove("hidden")}async promptContainerScrolled(){if(this.promptContainerElement===void 0||this.promptLoaderElement===void 0)throw Error("promptContainerElement is undefined");if(this.promptContainerElement.scrollHeight-this.promptContainerElement.scrollTop<=this.promptContainerElement.clientHeight+5&&this.maxPromptCount{setTimeout(()=>{Q()},800)}),this.maxPromptCount+=gw,await this.updateComplete,this.promptLoaderElement.classList.add("hidden"),this.promptContainerElement.scrollTop=A}this.maxPromptCount>=this.localPrompts.length&&this.promptLoaderElement.classList.add("no-display")}promptCardDragStarted(B){var C;this.isDraggingPromptCard=!0;const A=B.target;A.classList.add("dragging"),document.body.style.setProperty("cursor","grabbing"),this.hoveringPromptCardIndex=null,B.dataTransfer&&(B.dataTransfer.dropEffect="copy",B.dataTransfer.effectAllowed="copy",B.dataTransfer.setData("newPromptData",JSON.stringify(A.promptData)));let Q=200;this.shadowRoot&&(Q=this.shadowRoot.querySelector(".fav-prompt-slot").getBoundingClientRect().width);const U=document.createElement("div");U.classList.add("fav-prompt-slot"),U.setAttribute("is-temp","true"),U.style.setProperty("width",`${Q}px`);const F=document.createElement("div");F.classList.add("prompt-mini-card");const E=document.createElement("span");E.classList.add("icon"),E.innerText=A.promptData.icon;const R=document.createElement("span");R.classList.add("title"),R.innerText=A.promptData.title,F.appendChild(E),F.appendChild(R),U.appendChild(F),document.body.appendChild(U),this.draggingImageElement=U,(C=B.dataTransfer)==null||C.setDragImage(U,10,10)}promptCardDragEnded(B){var Q;this.isDraggingPromptCard=!1,B.target.classList.remove("dragging"),document.body.style.removeProperty("cursor"),(Q=this.draggingImageElement)==null||Q.remove(),this.draggingImageElement=null}favPromptSlotDragEntered(B){B.currentTarget.classList.add("drag-over")}favPromptSlotDragLeft(B){B.currentTarget.classList.remove("drag-over")}favPromptSlotDropped(B,A){if(B.dataTransfer){const U=B.dataTransfer.getData("newPromptData"),F=JSON.parse(U);this.favPrompts[A]=F;const E=structuredClone(this.favPrompts);E[A]=F,this.promptManager.setFavPrompt(A,F)}B.currentTarget.classList.remove("drag-over"),B.preventDefault()}promptCardMouseEntered(B,A){B.preventDefault(),this.hoveringPromptCardIndex=A}promptCardMouseLeft(B){B.preventDefault(),this.hoveringPromptCardIndex=null}modalCloseClickHandler(){if(this.promptModalElement===void 0)throw Error("promptModalElement is undefined.");this.promptModalElement.classList.add("hidden")}creteButtonClicked(){if(this.promptModalElement===void 0)throw Error("promptModalElement is undefined.");this.selectedPrompt=bC(),this.shouldCreateNewPrompt=!0,this.promptModalElement.classList.remove("hidden")}sortOptionChanged(B){const Q=B.currentTarget.value;(Q==="created"||Q==="name"||Q==="runCount")&&this.promptManager.sortPrompts(Q)}menuIconMouseEntered(B,A){const Q=B.currentTarget;let U="";switch(A){case"edit":{U="Edit";break}case"delete":{U="Delete";break}case"remove":{U="Remove favorite prompt";break}default:console.error(`Unknown button ${A}`)}nR(B,U,"top",this.tooltipConfig,200,Q,10)}menuIconMouseLeft(){J0(this.tooltipConfig,0)}menuDeleteClicked(B){if(this.confirmDialogComponent===void 0)throw Error("confirmDialogComponent is undefined");const A={header:"Delete Prompt",message:"Are you sure you want to delete this prompt? This action cannot be undone.",yesButtonText:"Delete",actionKey:"delete-prompt-local"};this.confirmDialogComponent.show(A,()=>{this.promptManager.deletePrompt(B)})}searchBarEntered(B){const Q=B.currentTarget.value;Q.length>0?(this.showSearchBarCancelButton||(this.totalLocalPrompts=this.localPrompts.length),this.showSearchBarCancelButton=!0):this.showSearchBarCancelButton=!1,this.searchBarDebounceTimer!==null&&(clearTimeout(this.searchBarDebounceTimer),this.searchBarDebounceTimer=null),this.searchBarDebounceTimer=setTimeout(()=>{this.promptManager.searchPrompt(Q),this.searchBarDebounceTimer=null},150)}showSearchBarCancelButtonClicked(){if(this.shadowRoot===null)throw Error("shadowRoot is null.");const B=this.shadowRoot.querySelector("#search-bar-input");B.value="",this.showSearchBarCancelButton=!1,this.searchBarDebounceTimer!==null&&(clearTimeout(this.searchBarDebounceTimer),this.searchBarDebounceTimer=null),this.searchBarDebounceTimer=setTimeout(()=>{this.promptManager.searchPrompt(""),this.searchBarDebounceTimer=null},150)}render(){let B=FA``;for(const[U,F]of this.localPrompts.slice(0,Math.min(this.maxPromptCount,this.localPrompts.length)).entries())B=FA`${B}
{this.promptCardMouseEntered(E,U)}} diff --git a/index.html b/index.html index fd58a43..4899e6c 100644 --- a/index.html +++ b/index.html @@ -76,7 +76,7 @@ - +