@ne1410s/popup
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,1 +0,2 @@ | ||
export {}; | ||
import { Popup } from './popup/popup'; | ||
export { Popup }; |
@@ -1,1 +0,1 @@ | ||
"use strict";var e=require("@ne1410s/cust-elems");class t extends e.CustomElementBase{constructor(){super("data:text/css;base64,LmJhY2sgew0KICBwb3NpdGlvbjogYWJzb2x1dGU7DQogIHRvcDogMDsgcmlnaHQ6IDA7IGJvdHRvbTogMDsgbGVmdDogMDsNCiAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAuODUpOw0KICBvcGFjaXR5OiAwOw0KICBvdmVyZmxvdzogaGlkZGVuOw0KICB0cmFuc2l0aW9uOiBvcGFjaXR5IC4zczsNCiAgei1pbmRleDogOTk5OTk7DQp9DQouYmFjazpub3QoLm9wZW4pIHsgcG9pbnRlci1ldmVudHM6IG5vbmU7IH0NCi5iYWNrLm9wZW4geyBvcGFjaXR5OiAxOyB9DQouYmFjay5vcGVuIC5mb3JlLnJlYWR5IHsgdHJhbnNpdGlvbjogYm94LXNoYWRvdyAuM3MsIGJhY2tncm91bmQtY29sb3IgLjNzOyB9DQouZm9yZS5vdmVyIHsgY3Vyc29yOiBtb3ZlOyBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDI1MCwgMjUwLCAyNTAsIDEpOyB9DQouZm9yZS5tb3ZpbmcgeyBjdXJzb3I6IGNyb3NzaGFpcjsgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgyMzAsIDIzMCwgMjMwLCAxKTsgdXNlci1zZWxlY3Q6IG5vbmU7IH0NCi5mb3JlLm92ZXIsIC5mb3JlLm1vdmluZyB7IGJveC1zaGFkb3c6IGluc2V0IDAgMCAuNWVtIGJsYWNrIWltcG9ydGFudDsgfQ0KLmZvcmUgew0KICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmOw0KICBtaW4td2lkdGg6IDFyZW07IG1heC13aWR0aDogMTAwdnc7DQogIG1pbi1oZWlnaHQ6IDFyZW07IG1heC1oZWlnaHQ6IDEwMHZoOw0KICBwb3NpdGlvbjogYWJzb2x1dGU7IG92ZXJmbG93OiBoaWRkZW47DQogIHRvcDogNTAlOyBsZWZ0OiA1MCU7DQogIHRyYW5zaXRpb246IHRyYW5zZm9ybSAuM3M7DQp9DQouZm9yZSA+IHNwYW4gew0KICBwb3NpdGlvbjogYWJzb2x1dGU7DQogIGZvbnQtc2l6ZTogMS41ZW07DQogIHVzZXItc2VsZWN0OiBub25lOw0KICBjb2xvcjogcmdiYSgwLCAwLCAwLCAuMyk7DQp9DQouZm9yZS5uby1jbG9zZSB7IG1heC13aWR0aDogY2FsYygxMDB2dyAtIDFlbSk7IG1heC1oZWlnaHQ6IGNhbGMoMTAwdmggLSAxZW0pOyB9DQouZm9yZS5uby1jbG9zZSAuY2xvc2UgeyBkaXNwbGF5OiBub25lOyB9DQouZm9yZSAuY2xvc2UgeyBjdXJzb3I6IHBvaW50ZXI7IHRvcDogLTZweDsgcmlnaHQ6IDA7IHBhZGRpbmc6IC4yZW07IH0NCi5mb3JlOm5vdCgucmVzaXplKSAuc2UtcmVzaXplIHsgZGlzcGxheTogbm9uZTsgfQ0KLmZvcmUgLnNlLXJlc2l6ZSB7IGN1cnNvcjogc2UtcmVzaXplOyBib3R0b206IC02cHg7IHJpZ2h0OiAtMnB4OyB9","data:text/html;base64,PGRpdiBjbGFzcz0iYmFjayI+DQogIDxkaXYgY2xhc3M9ImZvcmUiPg0KICAgIDxzbG90Pjwvc2xvdD4NCiAgICA8c3BhbiBjbGFzcz0iY2xvc2UiPiZ0aW1lczs8L3NwYW4+DQogICAgPHNwYW4gY2xhc3M9InNlLXJlc2l6ZSI+JiN4MjVlMjs8L3NwYW4+DQogIDwvZGl2Pg0KPC9kaXY+"),this._styles={};const e=this.root.querySelector(".back"),t=e.querySelector(".fore"),s=t.querySelector(".se-resize"),o=t.querySelector(".close");this.resetOffscreenPosition(t),o.addEventListener("click",()=>this.close()),s.addEventListener("mousedown",()=>{t.classList.toggle("over",this.canResize),t.classList.toggle("resizing",this.canResize)}),e.addEventListener("mousedown",s=>{this._drag=s.target===e?"back":s.target===t?"fore":"fore*",this._coords="fore"!==this._drag?null:{x:s.offsetX,y:s.offsetY},t.classList.toggle("moving",this.canMove&&"fore"===this._drag)}),t.addEventListener("mouseover",e=>t.classList.toggle("over",this.canMove&&e.target===t)),t.addEventListener("mouseout",()=>t.classList.remove("over")),window.addEventListener("mousemove",e=>{if(t.classList.contains("resizing")){const s=t.getBoundingClientRect(),o=5;t.style.width=o+e.pageX-s.x+"px",t.style.height=o+e.pageY-s.y+"px"}else if(this.canMove&&"fore"===this._drag&&this._coords){const s=100*Math.max(0,e.pageX-this._coords.x)/window.innerWidth,o=100*Math.max(0,e.pageY-this._coords.y)/window.innerHeight,i=`min(100vw - 100%, ${s.toFixed(2)}vw)`,a=`min(100vh - 100%, ${o.toFixed(2)}vh)`;t.style.top=t.style.left="0",t.style.transform=`translate(${i}, ${a})`}}),window.addEventListener("mouseup",()=>{this._drag=null,t.classList.remove("moving","resizing")}),e.addEventListener("mouseup",s=>{"back"===this._drag&&s.target===e&&this.dismiss(),this._drag=null,t.classList.remove("moving","resizing")}),t.addEventListener("transitionend",s=>{"transform"===s.propertyName&&(e.classList.contains("open")?t.classList.add("ready"):this.resetOffscreenPosition(t))})}get canMove(){return this.hasAttribute("move")}get canResize(){return this.hasAttribute("resize")}get canClose(){return!this.hasAttribute("no-close")}close(){this.removeAttribute("open")}open(){this.setAttribute("open","")}wrap(e){const t="function"==typeof e.append?e:document.querySelector(e+"");this.appendChild(t)}confirm(){const e=!!this.confirmCallback,t=!e||this.confirmCallback();e&&this.fire(t?"confirmaccept":"confirmreject"),t&&this.close()}dismiss(){const e=!!this.dismissCallback,t=!e||this.dismissCallback();e&&this.fire(t?"dismissaccept":"dismissreject"),t&&this.close()}attributeChangedCallback(e,s,o){switch(e){case"open":const e=this.root.querySelector(".back"),s=e.querySelector(".fore"),i=!!o||"string"==typeof o;s.classList.remove("ready","moving"),s.style.transform=i?"translate(-50%, -50%)":s.style.transform+" translateY(-100vh)",s.classList.toggle("resize",this.canResize),s.classList.toggle("no-close",!this.canClose),e.classList.toggle("open",i),i&&this.propagateSupportedStyles(e),this.fire(i?"open":"close");break;case"style":o&&(t.STYLE_KEYS.map(e=>({key:e,value:this.style[e]})).filter(e=>e.value).forEach(e=>this._styles[e.key]=e.value),this.removeAttribute("style"))}}connectedCallback(){const e=this.root.querySelector(".back"),t=e.querySelector(".fore");e.classList.contains("open")&&t.classList.add("ready")}disconnectedCallback(){}resetOffscreenPosition(e){e.style.left="50%",e.style.top="50%",e.style.transform="translate(-50%, -100vh)",e.style.width="",e.style.height=""}propagateSupportedStyles(e){["backgroundColor"].forEach(t=>{e.style[t]=this._styles[t]});const t=e.querySelector(".fore");["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"].forEach(e=>{t.style[e]=this._styles[e]})}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}}t.observedAttributes=["open","style"],t.STYLE_KEYS=["backgroundColor","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"],"customElements"in window&&window.customElements.define("ne14-pop",t); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@ne1410s/cust-elems");class t extends e.CustomElementBase{constructor(){super("data:text/css;base64,LmJhY2sgew0KICBwb3NpdGlvbjogZml4ZWQ7DQogIHRvcDogMDsgcmlnaHQ6IDA7IGJvdHRvbTogMDsgbGVmdDogMDsNCiAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAuODUpOw0KICBvcGFjaXR5OiAwOw0KICBvdmVyZmxvdzogaGlkZGVuOw0KICB0cmFuc2l0aW9uOiBvcGFjaXR5IC4zczsNCiAgei1pbmRleDogOTk5OTk7DQp9DQouYmFjazpub3QoLm9wZW4pIHsgcG9pbnRlci1ldmVudHM6IG5vbmU7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SAuY2xvc2UgeyBjdXJzb3I6IHBvaW50ZXI7IHRvcDogLTZweDsgcmlnaHQ6IDA7IHBhZGRpbmc6IC4yZW07IH0NCi5mb3JlOm5vdCgucmVzaXplKSAuc2UtcmVzaXplIHsgZGlzcGxheTogbm9uZTsgfQ0KLmZvcmUgLnNlLXJlc2l6ZSB7IGN1cnNvcjogc2UtcmVzaXplOyBib3R0b206IC02cHg7IHJpZ2h0OiAtMnB4OyB9","data:text/html;base64,PGRpdiBjbGFzcz0iYmFjayI+DQogIDxkaXYgY2xhc3M9ImZvcmUiPg0KICAgIDxzbG90Pjwvc2xvdD4NCiAgICA8c3BhbiBjbGFzcz0iY2xvc2UiPiZ0aW1lczs8L3NwYW4+DQogICAgPHNwYW4gY2xhc3M9InNlLXJlc2l6ZSI+JiN4MjVlMjs8L3NwYW4+DQogIDwvZGl2Pg0KPC9kaXY+"),this._styles={};const e=this.root.querySelector(".back"),t=e.querySelector(".fore"),s=t.querySelector(".se-resize"),o=t.querySelector(".close");this.resetOffscreenPosition(t),o.addEventListener("click",()=>this.close()),s.addEventListener("mousedown",()=>{t.classList.toggle("over",this.canResize),t.classList.toggle("resizing",this.canResize)}),e.addEventListener("mousedown",s=>{this._drag=s.target===e?"back":s.target===t?"fore":"fore*",this._coords="fore"!==this._drag?null:{x:s.offsetX,y:s.offsetY},t.classList.toggle("moving",this.canMove&&"fore"===this._drag)}),t.addEventListener("mouseover",e=>t.classList.toggle("over",this.canMove&&e.target===t)),t.addEventListener("mouseout",()=>t.classList.remove("over")),window.addEventListener("mousemove",e=>{if(t.classList.contains("resizing")){const s=t.getBoundingClientRect(),o=5;t.style.width=o+e.pageX-s.x+"px",t.style.height=o+e.pageY-s.y+"px"}else if(this.canMove&&"fore"===this._drag&&this._coords){const s=100*Math.max(0,e.pageX-this._coords.x)/window.innerWidth,o=100*Math.max(0,e.pageY-this._coords.y)/window.innerHeight,i=`min(100vw - 100%, ${s.toFixed(2)}vw)`,a=`min(100vh - 100%, ${o.toFixed(2)}vh)`;t.style.top=t.style.left="0",t.style.transform=`translate(${i}, ${a})`}}),window.addEventListener("mouseup",()=>{this._drag=null,t.classList.remove("moving","resizing")}),e.addEventListener("mouseup",s=>{"back"===this._drag&&s.target===e&&this.dismiss(),this._drag=null,t.classList.remove("moving","resizing")}),t.addEventListener("transitionend",s=>{"transform"===s.propertyName&&(e.classList.contains("open")?t.classList.add("ready"):this.resetOffscreenPosition(t))})}get canMove(){return this.hasAttribute("move")}get canResize(){return this.hasAttribute("resize")}get canClose(){return!this.hasAttribute("no-close")}close(){this.removeAttribute("open")}open(){this.setAttribute("open","")}wrap(e){const t="function"==typeof e.append?e:document.querySelector(e+"");this.appendChild(t)}confirm(){const e=!!this.confirmCallback,t=!e||this.confirmCallback();e&&this.fire(t?"confirmaccept":"confirmreject"),t&&this.close()}dismiss(){const e=!!this.dismissCallback,t=!e||this.dismissCallback();e&&this.fire(t?"dismissaccept":"dismissreject"),t&&this.close()}attributeChangedCallback(e,s,o){switch(e){case"open":const e=this.root.querySelector(".back"),s=e.querySelector(".fore"),i=!!o||"string"==typeof o;s.classList.remove("ready","moving"),s.style.transform=i?"translate(-50%, -50%)":s.style.transform+" translateY(-100vh)",s.classList.toggle("resize",this.canResize),s.classList.toggle("no-close",!this.canClose),e.classList.toggle("open",i),i&&this.propagateSupportedStyles(e),this.fire(i?"open":"close");break;case"style":o&&(t.STYLE_KEYS.map(e=>({key:e,value:this.style[e]})).filter(e=>e.value).forEach(e=>this._styles[e.key]=e.value),this.removeAttribute("style"))}}connectedCallback(){const e=this.root.querySelector(".back"),t=e.querySelector(".fore");e.classList.contains("open")&&t.classList.add("ready")}disconnectedCallback(){}resetOffscreenPosition(e){e.style.left="50%",e.style.top="50%",e.style.transform="translate(-50%, -100vh)",e.style.width="",e.style.height=""}propagateSupportedStyles(e){["backgroundColor"].forEach(t=>{e.style[t]=this._styles[t]});const t=e.querySelector(".fore");["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"].forEach(e=>{t.style[e]=this._styles[e]})}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}}t.observedAttributes=["open","style"],t.STYLE_KEYS=["backgroundColor","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"],"customElements"in window&&window.customElements.define("ne14-pop",t),exports.Popup=t; |
@@ -1,1 +0,1 @@ | ||
import{CustomElementBase as e}from"@ne1410s/cust-elems";class t extends e{constructor(){super("data:text/css;base64,LmJhY2sgew0KICBwb3NpdGlvbjogYWJzb2x1dGU7DQogIHRvcDogMDsgcmlnaHQ6IDA7IGJvdHRvbTogMDsgbGVmdDogMDsNCiAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAuODUpOw0KICBvcGFjaXR5OiAwOw0KICBvdmVyZmxvdzogaGlkZGVuOw0KICB0cmFuc2l0aW9uOiBvcGFjaXR5IC4zczsNCiAgei1pbmRleDogOTk5OTk7DQp9DQouYmFjazpub3QoLm9wZW4pIHsgcG9pbnRlci1ldmVudHM6IG5vbmU7IH0NCi5iYWNrLm9wZW4geyBvcGFjaXR5OiAxOyB9DQouYmFjay5vcGVuIC5mb3JlLnJlYWR5IHsgdHJhbnNpdGlvbjogYm94LXNoYWRvdyAuM3MsIGJhY2tncm91bmQtY29sb3IgLjNzOyB9DQouZm9yZS5vdmVyIHsgY3Vyc29yOiBtb3ZlOyBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDI1MCwgMjUwLCAyNTAsIDEpOyB9DQouZm9yZS5tb3ZpbmcgeyBjdXJzb3I6IGNyb3NzaGFpcjsgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgyMzAsIDIzMCwgMjMwLCAxKTsgdXNlci1zZWxlY3Q6IG5vbmU7IH0NCi5mb3JlLm92ZXIsIC5mb3JlLm1vdmluZyB7IGJveC1zaGFkb3c6IGluc2V0IDAgMCAuNWVtIGJsYWNrIWltcG9ydGFudDsgfQ0KLmZ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e=this.root.querySelector(".back"),t=e.querySelector(".fore"),s=t.querySelector(".se-resize"),o=t.querySelector(".close");this.resetOffscreenPosition(t),o.addEventListener("click",()=>this.close()),s.addEventListener("mousedown",()=>{t.classList.toggle("over",this.canResize),t.classList.toggle("resizing",this.canResize)}),e.addEventListener("mousedown",s=>{this._drag=s.target===e?"back":s.target===t?"fore":"fore*",this._coords="fore"!==this._drag?null:{x:s.offsetX,y:s.offsetY},t.classList.toggle("moving",this.canMove&&"fore"===this._drag)}),t.addEventListener("mouseover",e=>t.classList.toggle("over",this.canMove&&e.target===t)),t.addEventListener("mouseout",()=>t.classList.remove("over")),window.addEventListener("mousemove",e=>{if(t.classList.contains("resizing")){const s=t.getBoundingClientRect(),o=5;t.style.width=o+e.pageX-s.x+"px",t.style.height=o+e.pageY-s.y+"px"}else if(this.canMove&&"fore"===this._drag&&this._coords){const s=100*Math.max(0,e.pageX-this._coords.x)/window.innerWidth,o=100*Math.max(0,e.pageY-this._coords.y)/window.innerHeight,i=`min(100vw - 100%, ${s.toFixed(2)}vw)`,a=`min(100vh - 100%, ${o.toFixed(2)}vh)`;t.style.top=t.style.left="0",t.style.transform=`translate(${i}, ${a})`}}),window.addEventListener("mouseup",()=>{this._drag=null,t.classList.remove("moving","resizing")}),e.addEventListener("mouseup",s=>{"back"===this._drag&&s.target===e&&this.dismiss(),this._drag=null,t.classList.remove("moving","resizing")}),t.addEventListener("transitionend",s=>{"transform"===s.propertyName&&(e.classList.contains("open")?t.classList.add("ready"):this.resetOffscreenPosition(t))})}get canMove(){return this.hasAttribute("move")}get canResize(){return this.hasAttribute("resize")}get canClose(){return!this.hasAttribute("no-close")}close(){this.removeAttribute("open")}open(){this.setAttribute("open","")}wrap(e){const t="function"==typeof e.append?e:document.querySelector(e+"");this.appendChild(t)}confirm(){const e=!!this.confirmCallback,t=!e||this.confirmCallback();e&&this.fire(t?"confirmaccept":"confirmreject"),t&&this.close()}dismiss(){const e=!!this.dismissCallback,t=!e||this.dismissCallback();e&&this.fire(t?"dismissaccept":"dismissreject"),t&&this.close()}attributeChangedCallback(e,s,o){switch(e){case"open":const e=this.root.querySelector(".back"),s=e.querySelector(".fore"),i=!!o||"string"==typeof o;s.classList.remove("ready","moving"),s.style.transform=i?"translate(-50%, -50%)":s.style.transform+" translateY(-100vh)",s.classList.toggle("resize",this.canResize),s.classList.toggle("no-close",!this.canClose),e.classList.toggle("open",i),i&&this.propagateSupportedStyles(e),this.fire(i?"open":"close");break;case"style":o&&(t.STYLE_KEYS.map(e=>({key:e,value:this.style[e]})).filter(e=>e.value).forEach(e=>this._styles[e.key]=e.value),this.removeAttribute("style"))}}connectedCallback(){const e=this.root.querySelector(".back"),t=e.querySelector(".fore");e.classList.contains("open")&&t.classList.add("ready")}disconnectedCallback(){}resetOffscreenPosition(e){e.style.left="50%",e.style.top="50%",e.style.transform="translate(-50%, -100vh)",e.style.width="",e.style.height=""}propagateSupportedStyles(e){["backgroundColor"].forEach(t=>{e.style[t]=this._styles[t]});const t=e.querySelector(".fore");["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"].forEach(e=>{t.style[e]=this._styles[e]})}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}}t.observedAttributes=["open","style"],t.STYLE_KEYS=["backgroundColor","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"],"customElements"in window&&window.customElements.define("ne14-pop",t); | ||
import{CustomElementBase as e}from"@ne1410s/cust-elems";class t extends e{constructor(){super("data:text/css;base64,LmJhY2sgew0KICBwb3NpdGlvbjogZml4ZWQ7DQogIHRvcDogMDsgcmlnaHQ6IDA7IGJvdHRvbTogMDsgbGVmdDogMDsNCiAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAuODUpOw0KICBvcGFjaXR5OiAwOw0KICBvdmVyZmxvdzogaGlkZGVuOw0KICB0cmFuc2l0aW9uOiBvcGFjaXR5IC4zczsNCiAgei1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AxZW0pOyB9DQouZm9yZS5uby1jbG9zZSAuY2xvc2UgeyBkaXNwbGF5OiBub25lOyB9DQouZm9yZSAuY2xvc2UgeyBjdXJzb3I6IHBvaW50ZXI7IHRvcDogLTZweDsgcmlnaHQ6IDA7IHBhZGRpbmc6IC4yZW07IH0NCi5mb3JlOm5vdCgucmVzaXplKSAuc2UtcmVzaXplIHsgZGlzcGxheTogbm9uZTsgfQ0KLmZvcmUgLnNlLXJlc2l6ZSB7IGN1cnNvcjogc2UtcmVzaXplOyBib3R0b206IC02cHg7IHJpZ2h0OiAtMnB4OyB9","data:text/html;base64,PGRpdiBjbGFzcz0iYmFjayI+DQogIDxkaXYgY2xhc3M9ImZvcmUiPg0KICAgIDxzbG90Pjwvc2xvdD4NCiAgICA8c3BhbiBjbGFzcz0iY2xvc2UiPiZ0aW1lczs8L3NwYW4+DQogICAgPHNwYW4gY2xhc3M9InNlLXJlc2l6ZSI+JiN4MjVlMjs8L3NwYW4+DQogIDwvZGl2Pg0KPC9kaXY+"),this._styles={};const e=this.root.querySelector(".back"),t=e.querySelector(".fore"),s=t.querySelector(".se-resize"),o=t.querySelector(".close");this.resetOffscreenPosition(t),o.addEventListener("click",()=>this.close()),s.addEventListener("mousedown",()=>{t.classList.toggle("over",this.canResize),t.classList.toggle("resizing",this.canResize)}),e.addEventListener("mousedown",s=>{this._drag=s.target===e?"back":s.target===t?"fore":"fore*",this._coords="fore"!==this._drag?null:{x:s.offsetX,y:s.offsetY},t.classList.toggle("moving",this.canMove&&"fore"===this._drag)}),t.addEventListener("mouseover",e=>t.classList.toggle("over",this.canMove&&e.target===t)),t.addEventListener("mouseout",()=>t.classList.remove("over")),window.addEventListener("mousemove",e=>{if(t.classList.contains("resizing")){const s=t.getBoundingClientRect(),o=5;t.style.width=o+e.pageX-s.x+"px",t.style.height=o+e.pageY-s.y+"px"}else if(this.canMove&&"fore"===this._drag&&this._coords){const s=100*Math.max(0,e.pageX-this._coords.x)/window.innerWidth,o=100*Math.max(0,e.pageY-this._coords.y)/window.innerHeight,i=`min(100vw - 100%, ${s.toFixed(2)}vw)`,a=`min(100vh - 100%, ${o.toFixed(2)}vh)`;t.style.top=t.style.left="0",t.style.transform=`translate(${i}, ${a})`}}),window.addEventListener("mouseup",()=>{this._drag=null,t.classList.remove("moving","resizing")}),e.addEventListener("mouseup",s=>{"back"===this._drag&&s.target===e&&this.dismiss(),this._drag=null,t.classList.remove("moving","resizing")}),t.addEventListener("transitionend",s=>{"transform"===s.propertyName&&(e.classList.contains("open")?t.classList.add("ready"):this.resetOffscreenPosition(t))})}get canMove(){return this.hasAttribute("move")}get canResize(){return this.hasAttribute("resize")}get canClose(){return!this.hasAttribute("no-close")}close(){this.removeAttribute("open")}open(){this.setAttribute("open","")}wrap(e){const t="function"==typeof e.append?e:document.querySelector(e+"");this.appendChild(t)}confirm(){const e=!!this.confirmCallback,t=!e||this.confirmCallback();e&&this.fire(t?"confirmaccept":"confirmreject"),t&&this.close()}dismiss(){const e=!!this.dismissCallback,t=!e||this.dismissCallback();e&&this.fire(t?"dismissaccept":"dismissreject"),t&&this.close()}attributeChangedCallback(e,s,o){switch(e){case"open":const e=this.root.querySelector(".back"),s=e.querySelector(".fore"),i=!!o||"string"==typeof o;s.classList.remove("ready","moving"),s.style.transform=i?"translate(-50%, -50%)":s.style.transform+" translateY(-100vh)",s.classList.toggle("resize",this.canResize),s.classList.toggle("no-close",!this.canClose),e.classList.toggle("open",i),i&&this.propagateSupportedStyles(e),this.fire(i?"open":"close");break;case"style":o&&(t.STYLE_KEYS.map(e=>({key:e,value:this.style[e]})).filter(e=>e.value).forEach(e=>this._styles[e.key]=e.value),this.removeAttribute("style"))}}connectedCallback(){const e=this.root.querySelector(".back"),t=e.querySelector(".fore");e.classList.contains("open")&&t.classList.add("ready")}disconnectedCallback(){}resetOffscreenPosition(e){e.style.left="50%",e.style.top="50%",e.style.transform="translate(-50%, -100vh)",e.style.width="",e.style.height=""}propagateSupportedStyles(e){["backgroundColor"].forEach(t=>{e.style[t]=this._styles[t]});const t=e.querySelector(".fore");["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"].forEach(e=>{t.style[e]=this._styles[e]})}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}}t.observedAttributes=["open","style"],t.STYLE_KEYS=["backgroundColor","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"],"customElements"in window&&window.customElements.define("ne14-pop",t);export{t as Popup}; |
@@ -1,1 +0,1 @@ | ||
!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";class e extends HTMLElement{constructor(e,t,s="closed"){super(),this.root=this.attachShadow({mode:s}),this.root.innerHTML=this.decode(t);const o=document.createElement("style");o.textContent=this.decode(e),this.root.appendChild(o)}decode(e){const t=(e+"").indexOf("base64,");return-1===t?e:window.atob(e.substring(t+7))}}class t extends e{constructor(){super("data:text/css;base64,LmJhY2sgew0KICBwb3NpdGlvbjogYWJzb2x1dGU7DQogIHRvcDogMDsgcmlnaHQ6IDA7IGJvdHRvbTogMDsgbGVmdDogMDsNCiAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAuODUpOw0KICBvcGFjaXR5OiAwOw0KICBvdmVyZmxvdzogaGlkZGVuOw0KICB0cmFuc2l0aW9uOiBvcGFjaXR5IC4zczsNCiAgei1pbmRleDogOTk5OTk7DQp9DQouYmFjazpub3QoLm9wZW4pIHsgcG9pbnRlci1ldmVudHM6IG5vbmU7IH0NCi5iYWNrLm9wZW4geyBvcGFjaXR5OiAxOyB9DQouYmFjay5vcGVuIC5mb3JlLnJlYWR5IHsgdHJhbnNpdGlvbjogYm94LXNoYWRvdyAuM3MsIGJhY2tncm91bmQtY29sb3IgLjNzOyB9DQouZm9yZS5vdmVyIHsgY3Vyc29yOiBtb3ZlOyBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDI1MCwgMjUwLCAyNTAsIDEpOyB9DQouZm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html;base64,PGRpdiBjbGFzcz0iYmFjayI+DQogIDxkaXYgY2xhc3M9ImZvcmUiPg0KICAgIDxzbG90Pjwvc2xvdD4NCiAgICA8c3BhbiBjbGFzcz0iY2xvc2UiPiZ0aW1lczs8L3NwYW4+DQogICAgPHNwYW4gY2xhc3M9InNlLXJlc2l6ZSI+JiN4MjVlMjs8L3NwYW4+DQogIDwvZGl2Pg0KPC9kaXY+"),this._styles={};const e=this.root.querySelector(".back"),t=e.querySelector(".fore"),s=t.querySelector(".se-resize"),o=t.querySelector(".close");this.resetOffscreenPosition(t),o.addEventListener("click",()=>this.close()),s.addEventListener("mousedown",()=>{t.classList.toggle("over",this.canResize),t.classList.toggle("resizing",this.canResize)}),e.addEventListener("mousedown",s=>{this._drag=s.target===e?"back":s.target===t?"fore":"fore*",this._coords="fore"!==this._drag?null:{x:s.offsetX,y:s.offsetY},t.classList.toggle("moving",this.canMove&&"fore"===this._drag)}),t.addEventListener("mouseover",e=>t.classList.toggle("over",this.canMove&&e.target===t)),t.addEventListener("mouseout",()=>t.classList.remove("over")),window.addEventListener("mousemove",e=>{if(t.classList.contains("resizing")){const s=t.getBoundingClientRect(),o=5;t.style.width=o+e.pageX-s.x+"px",t.style.height=o+e.pageY-s.y+"px"}else if(this.canMove&&"fore"===this._drag&&this._coords){const s=100*Math.max(0,e.pageX-this._coords.x)/window.innerWidth,o=100*Math.max(0,e.pageY-this._coords.y)/window.innerHeight,i=`min(100vw - 100%, ${s.toFixed(2)}vw)`,a=`min(100vh - 100%, ${o.toFixed(2)}vh)`;t.style.top=t.style.left="0",t.style.transform=`translate(${i}, ${a})`}}),window.addEventListener("mouseup",()=>{this._drag=null,t.classList.remove("moving","resizing")}),e.addEventListener("mouseup",s=>{"back"===this._drag&&s.target===e&&this.dismiss(),this._drag=null,t.classList.remove("moving","resizing")}),t.addEventListener("transitionend",s=>{"transform"===s.propertyName&&(e.classList.contains("open")?t.classList.add("ready"):this.resetOffscreenPosition(t))})}get canMove(){return this.hasAttribute("move")}get canResize(){return this.hasAttribute("resize")}get canClose(){return!this.hasAttribute("no-close")}close(){this.removeAttribute("open")}open(){this.setAttribute("open","")}wrap(e){const t="function"==typeof e.append?e:document.querySelector(e+"");this.appendChild(t)}confirm(){const e=!!this.confirmCallback,t=!e||this.confirmCallback();e&&this.fire(t?"confirmaccept":"confirmreject"),t&&this.close()}dismiss(){const e=!!this.dismissCallback,t=!e||this.dismissCallback();e&&this.fire(t?"dismissaccept":"dismissreject"),t&&this.close()}attributeChangedCallback(e,s,o){switch(e){case"open":const e=this.root.querySelector(".back"),s=e.querySelector(".fore"),i=!!o||"string"==typeof o;s.classList.remove("ready","moving"),s.style.transform=i?"translate(-50%, -50%)":s.style.transform+" translateY(-100vh)",s.classList.toggle("resize",this.canResize),s.classList.toggle("no-close",!this.canClose),e.classList.toggle("open",i),i&&this.propagateSupportedStyles(e),this.fire(i?"open":"close");break;case"style":o&&(t.STYLE_KEYS.map(e=>({key:e,value:this.style[e]})).filter(e=>e.value).forEach(e=>this._styles[e.key]=e.value),this.removeAttribute("style"))}}connectedCallback(){const e=this.root.querySelector(".back"),t=e.querySelector(".fore");e.classList.contains("open")&&t.classList.add("ready")}disconnectedCallback(){}resetOffscreenPosition(e){e.style.left="50%",e.style.top="50%",e.style.transform="translate(-50%, -100vh)",e.style.width="",e.style.height=""}propagateSupportedStyles(e){["backgroundColor"].forEach(t=>{e.style[t]=this._styles[t]});const t=e.querySelector(".fore");["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"].forEach(e=>{t.style[e]=this._styles[e]})}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}}t.observedAttributes=["open","style"],t.STYLE_KEYS=["backgroundColor","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"],"customElements"in window&&window.customElements.define("ne14-pop",t)})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).ne_pop={})}(this,(function(e){"use strict";class t extends HTMLElement{constructor(e,t,s="closed"){super(),this.root=this.attachShadow({mode:s}),this.root.innerHTML=this.decode(t);const o=document.createElement("style");o.textContent=this.decode(e),this.root.appendChild(o)}decode(e){const t=(e+"").indexOf("base64,");return-1===t?e:window.atob(e.substring(t+7))}}class s extends t{constructor(){super("data:text/css;base64,LmJhY2sgew0KICBwb3NpdGlvbjogZml4ZWQ7DQogIHRvcDogMDsgcmlnaHQ6IDA7IGJvdHRvbTogMDsgbGVmdDogMDsNCiAgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgwLCAwLCAwLCAuODUpOw0KICBvcGFjaXR5OiAwOw0KICBvdmVyZmxvdzogaGlkZGVuOw0KICB0cmFuc2l0aW9uOiBvcGFjaXR5IC4zczsNCiAgei1pbmRleDogOTk5OTk7DQp9DQouYmFjazpub3QoLm9wZW4pIHsgcG9pbnRlci1ldmVudHM6IG5vbmU7IH0NCi5iYWNrLm9wZW4geyBvcGFjaXR5OiAxOyB9DQouYmFjay5vcGVuIC5mb3JlLnJlYWR5IHsgdHJhbnNpdGlvbjogYm94LXNoYWRvdyAuM3MsIGJhY2tncm91bmQtY29sb3IgLjNzOyB9DQouZm9yZS5vdmVyIHsgY3Vyc29yOiBtb3ZlOyBiYWNrZ3JvdW5kLWNvbG9yOiByZ2JhKDI1MCwgMjUwLCAyNTAsIDEpOyB9DQouZm9yZS5tb3ZpbmcgeyBjdXJzb3I6IGNyb3NzaGFpcjsgYmFja2dyb3VuZC1jb2xvcjogcmdiYSgyMzAsIDIzMCwgMjMwLCAxKTsgdXNlci1zZWxlY3Q6IG5vbmU7IH0NCi5mb3JlLm92ZXIsIC5mb3JlLm1vdmluZyB7IGJveC1zaGFkb3c6IGluc2V0IDAgMCAuNWVtIGJsYWNrIWltcG9ydGFudDsgfQ0KLmZvcmUgew0KICBiYWNrZ3JvdW5kLWNvbG9yOiAjZmZmOw0KICBtaW4td2lkdGg6IDFyZW07IG1heC13aWR0aDogMTAwdnc7DQogIG1pbi1oZWlnaHQ6IDFyZW07IG1heC1oZWlnaHQ6IDEwMHZoOw0KICBwb3NpdGlvbjogYWJzb2x1dGU7IG92ZXJmbG93OiBoaWRkZW47DQogIHRvcDogNTAlOyBsZWZ0OiA1MCU7DQogIHRyYW5zaXRpb246IHRyYW5zZm9ybSAuM3M7DQp9DQouZm9yZSA+IHNwYW4gew0KICBwb3NpdGlvbjogYWJzb2x1dGU7DQogIGZvbnQtc2l6ZTogMS41ZW07DQogIHVzZXItc2VsZWN0OiBub25lOw0KICBjb2xvcjogcmdiYSgwLCAwLCAwLCAuMyk7DQp9DQouZm9yZS5uby1jbG9zZSB7IG1heC13aWR0aDogY2FsYygxMDB2dyAtIDFlbSk7IG1heC1oZWlnaHQ6IGNhbGMoMTAwdmggLSAxZW0pOyB9DQouZm9yZS5uby1jbG9zZSAuY2xvc2UgeyBkaXNwbGF5OiBub25lOyB9DQouZm9yZSAuY2xvc2UgeyBjdXJzb3I6IHBvaW50ZXI7IHRvcDogLTZweDsgcmlnaHQ6IDA7IHBhZGRpbmc6IC4yZW07IH0NCi5mb3JlOm5vdCgucmVzaXplKSAuc2UtcmVzaXplIHsgZGlzcGxheTogbm9uZTsgfQ0KLmZvcmUgLnNlLXJlc2l6ZSB7IGN1cnNvcjogc2UtcmVzaXplOyBib3R0b206IC02cHg7IHJpZ2h0OiAtMnB4OyB9","data:text/html;base64,PGRpdiBjbGFzcz0iYmFjayI+DQogIDxkaXYgY2xhc3M9ImZvcmUiPg0KICAgIDxzbG90Pjwvc2xvdD4NCiAgICA8c3BhbiBjbGFzcz0iY2xvc2UiPiZ0aW1lczs8L3NwYW4+DQogICAgPHNwYW4gY2xhc3M9InNlLXJlc2l6ZSI+JiN4MjVlMjs8L3NwYW4+DQogIDwvZGl2Pg0KPC9kaXY+"),this._styles={};const e=this.root.querySelector(".back"),t=e.querySelector(".fore"),s=t.querySelector(".se-resize"),o=t.querySelector(".close");this.resetOffscreenPosition(t),o.addEventListener("click",()=>this.close()),s.addEventListener("mousedown",()=>{t.classList.toggle("over",this.canResize),t.classList.toggle("resizing",this.canResize)}),e.addEventListener("mousedown",s=>{this._drag=s.target===e?"back":s.target===t?"fore":"fore*",this._coords="fore"!==this._drag?null:{x:s.offsetX,y:s.offsetY},t.classList.toggle("moving",this.canMove&&"fore"===this._drag)}),t.addEventListener("mouseover",e=>t.classList.toggle("over",this.canMove&&e.target===t)),t.addEventListener("mouseout",()=>t.classList.remove("over")),window.addEventListener("mousemove",e=>{if(t.classList.contains("resizing")){const s=t.getBoundingClientRect(),o=5;t.style.width=o+e.pageX-s.x+"px",t.style.height=o+e.pageY-s.y+"px"}else if(this.canMove&&"fore"===this._drag&&this._coords){const s=100*Math.max(0,e.pageX-this._coords.x)/window.innerWidth,o=100*Math.max(0,e.pageY-this._coords.y)/window.innerHeight,i=`min(100vw - 100%, ${s.toFixed(2)}vw)`,c=`min(100vh - 100%, ${o.toFixed(2)}vh)`;t.style.top=t.style.left="0",t.style.transform=`translate(${i}, ${c})`}}),window.addEventListener("mouseup",()=>{this._drag=null,t.classList.remove("moving","resizing")}),e.addEventListener("mouseup",s=>{"back"===this._drag&&s.target===e&&this.dismiss(),this._drag=null,t.classList.remove("moving","resizing")}),t.addEventListener("transitionend",s=>{"transform"===s.propertyName&&(e.classList.contains("open")?t.classList.add("ready"):this.resetOffscreenPosition(t))})}get canMove(){return this.hasAttribute("move")}get canResize(){return this.hasAttribute("resize")}get canClose(){return!this.hasAttribute("no-close")}close(){this.removeAttribute("open")}open(){this.setAttribute("open","")}wrap(e){const t="function"==typeof e.append?e:document.querySelector(e+"");this.appendChild(t)}confirm(){const e=!!this.confirmCallback,t=!e||this.confirmCallback();e&&this.fire(t?"confirmaccept":"confirmreject"),t&&this.close()}dismiss(){const e=!!this.dismissCallback,t=!e||this.dismissCallback();e&&this.fire(t?"dismissaccept":"dismissreject"),t&&this.close()}attributeChangedCallback(e,t,o){switch(e){case"open":const e=this.root.querySelector(".back"),t=e.querySelector(".fore"),i=!!o||"string"==typeof o;t.classList.remove("ready","moving"),t.style.transform=i?"translate(-50%, -50%)":t.style.transform+" translateY(-100vh)",t.classList.toggle("resize",this.canResize),t.classList.toggle("no-close",!this.canClose),e.classList.toggle("open",i),i&&this.propagateSupportedStyles(e),this.fire(i?"open":"close");break;case"style":o&&(s.STYLE_KEYS.map(e=>({key:e,value:this.style[e]})).filter(e=>e.value).forEach(e=>this._styles[e.key]=e.value),this.removeAttribute("style"))}}connectedCallback(){const e=this.root.querySelector(".back"),t=e.querySelector(".fore");e.classList.contains("open")&&t.classList.add("ready")}disconnectedCallback(){}resetOffscreenPosition(e){e.style.left="50%",e.style.top="50%",e.style.transform="translate(-50%, -100vh)",e.style.width="",e.style.height=""}propagateSupportedStyles(e){["backgroundColor"].forEach(t=>{e.style[t]=this._styles[t]});const t=e.querySelector(".fore");["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"].forEach(e=>{t.style[e]=this._styles[e]})}fire(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))}}s.observedAttributes=["open","style"],s.STYLE_KEYS=["backgroundColor","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius","boxShadow"],"customElements"in window&&window.customElements.define("ne14-pop",s),e.Popup=s,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@ne1410s/popup", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A lightweight configurable popup.", | ||
@@ -5,0 +5,0 @@ "main": "dist/ne14_pop.cjs.min.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
23345
100