Skip to content

Commit

Permalink
Deploy 89bac7b
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohk committed Jan 26, 2024
1 parent 37bd14e commit fd8e210
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion assets/main-4919727f.js → assets/main-4b4140dd.js
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,7 @@ ${this.promptData.description||""}</textarea
<path d="M22.28,39.483C22.28,41.632 23.794,43.097 26.04,43.097L36.538,43.097L36.538,53.692C36.538,55.89 38.003,57.403 40.151,57.403C42.397,57.403 43.862,55.89 43.862,53.692L43.862,43.097L54.458,43.097C56.655,43.097 58.169,41.632 58.169,39.483C58.169,37.286 56.655,35.773 54.458,35.773L43.862,35.773L43.862,25.226C43.862,22.98 42.397,21.466 40.151,21.466C38.003,21.466 36.538,22.98 36.538,25.226L36.538,35.773L26.04,35.773C23.794,35.773 22.28,37.286 22.28,39.483Z" style="fill-rule:nonzero;"/>
</g>
</svg>
`;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<this.localPrompts.length){const A=this.promptContainerElement.scrollTop;this.promptLoaderElement.classList.remove("hidden","no-display"),await new Promise(Q=>{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<this.localPrompts.length){const A=this.promptContainerElement.scrollTop;this.promptLoaderElement.classList.remove("hidden","no-display"),await new Promise(Q=>{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}
<div
class="prompt-card-container"
@mouseenter=${E=>{this.promptCardMouseEntered(E,U)}}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

<link rel="stylesheet" href="/wordflow/global.css" />

<script type="module" crossorigin src="/wordflow/assets/main-4919727f.js"></script>
<script type="module" crossorigin src="/wordflow/assets/main-4b4140dd.js"></script>
</head>

<body>
Expand Down

0 comments on commit fd8e210

Please sign in to comment.