Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@novemberizing/bootstrap

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@novemberizing/bootstrap - npm Package Compare versions

Comparing version 0.0.29 to 0.0.30

src/ModalUI.js

2

dist/js/main.js

@@ -1,1 +0,1 @@

const t={parent:(t,e)=>{for(;t&&t.nodeName&&t.nodeName.toLowerCase()!==e;)t=t.parentNode;return t},previous:(t,e)=>{for(;t&&t.nodeName.toLowerCase()!==e;)t=t.previousElementSibling;return t},children:{remove:t=>{for(;t.firstChild;)t.lastChild.remove()}}},e={equal:(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),str:(t,e="/")=>{function n(t){return t<10?`0${t}`:t}return`${t.getFullYear()}${e}${n(t.getMonth()+1)}${e}${n(t.getDate())}`},next:(t,e=1)=>(t.setDate(t.getDate()+e),t),month:{str:t=>{return`${t.getFullYear()}/${e=t.getMonth()+1,e<10?`0${e}`:e}`;var e},begin:t=>(t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t),previous:t=>(t.setMonth(t.getMonth()-1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t),next:t=>(t.setMonth(t.getMonth()+1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)},week:{begin:t=>(t.setDate(t.getDate()-t.getDay()),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)}};class n{static#t='<p class="d-inline-flex gap-1 star"></p>';static#e='<button type="button"></button>';static#n='<i class="fa-solid fa-star"></i>';static#s='<i class="fa-regular fa-star"></i>';static{const t=new DOMParser;n.#t=t.parseFromString(n.#t,"text/html").querySelector("p"),n.#e=t.parseFromString(n.#e,"text/html").querySelector("button"),n.#n=t.parseFromString(n.#n,"text/html").querySelector("i"),n.#s=t.parseFromString(n.#s,"text/html").querySelector("i")}#o=null;#i=null;#a=null;#r=null;#l=null;#c=null;#d=null;static load(t){const e=document.querySelectorAll("input[type='range'].form-control.star");for(const s of e)new n(s,"function"==typeof t?t(s):t)}static#u(){return n.#t.cloneNode(!0)}static#h(e,s){const o=n.#e.cloneNode(!0);return o.setAttribute("data-value",e+1),o.setAttribute("aria-pressed",s),s?o.appendChild(n.#n.cloneNode(!0)):o.appendChild(n.#s.cloneNode(!0)),o.addEventListener("click",(e=>{const n=t.parent(e.target,"button"),s=t.parent(n,"p"),o=t.previous(s,"input"),i=parseInt(n.getAttribute("data-value")),a=n.getAttribute("aria-pressed"),r=n.nextElementSibling;"true"===a?r&&"true"===r.getAttribute("aria-pressed")?o.setAttribute("value",i):o.setAttribute("value",i-1):o.setAttribute("value",i);const l=parseInt(o.getAttribute("value")),c=s.querySelectorAll("button");for(const t of c){const e=t.querySelector("i");l<parseInt(t.getAttribute("data-value"))?(e.classList.contains("fa-solid")&&e.classList.replace("fa-solid","fa-regular"),t.setAttribute("aria-pressed","false")):(e.classList.contains("fa-regular")&&e.classList.replace("fa-regular","fa-solid"),t.setAttribute("aria-pressed","true"))}})),o}constructor(t,e){this.#a=t,this.#r=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#o=this.#a.parentNode,this.#i=this.#a.nextSibling,this.#l=parseInt(this.#a.max),this.#c=parseInt(this.#a.min),this.#d=parseInt(this.#a.defaultValue);const s=n.#u();for(let t=this.#c;t<this.#l;t++){const e=n.#h(t,t<this.#d);s.appendChild(e)}this.#a.style.display="none",this.#o.insertBefore(s,this.#i)}}class s{static#b='<div class="calendar">\n <div class="input-group">\n <input type="text" class="form-control" data-date="" disabled>\n <span class="input-group-text">\n <button type="button" class="btn btn-link"><i class="fa-regular fa-calendar"></i></button>\n </span>\n </div>\n <div class="form calendar-form-ui small hide" data-focus-date="">\n <div class="calendar-header d-flex justify-content-between mb-3">\n <button type="button" class="btn btn-light btn-sm text-start month fw-bold"></button>\n <div>\n <button type="button" class="btn btn-light btn-sm up"><i class="fa-solid fa-caret-up"></i></button>\n <button type="button" class="btn btn-light btn-sm down"><i class="fa-solid fa-caret-down"></i></button>\n </div>\n </div>\n <div class="calendar-body mb-2">\n <table class="table">\n <thead>\n <tr>\n <th scope="col">Sun</th>\n <th scope="col">Mon</th>\n <th scope="col">Tue</th>\n <th scope="col">Wed</th>\n <th scope="col">Thu</th>\n <th scope="col">Fri</th>\n <th scope="col">Sat</th>\n </tr>\n </thead>\n </table>\n <div class="calendar-date">\n <table class="table">\n <tbody>\n <tr>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n <div class="calendar-footer d-flex justify-content-between">\n <button type="button" class="btn btn-light btn-sm erase">삭제</button>\n <button type="button" class="btn btn-light btn-sm today">오늘</button>\n </div>\n </div>\n</div>';static#t=null;static#p=null;static{const t=new DOMParser;s.#b=t.parseFromString(s.#b,"text/html"),s.#t=s.#b.querySelector("div.calendar");const e=s.#t.querySelector("div.calendar-date"),n=e.querySelector("tr");s.#p=n.querySelector("td"),s.#p=s.#p.cloneNode(!0),n.remove()}static load(t){const e=document.querySelectorAll('input[type="date"].form-control');for(const n of e)new s(n,"function"==typeof t?t(n):t)}#a=null;#r=null;#o=null;#i=null;#m=null;#f=null;#g=null;#w=null;#y(){this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide"),t.children.remove(this.#w);const n=e.month.begin(new Date);this.#g.setAttribute("data-focus-date",n),e.week.begin(new Date(n)),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n)}#v(t,n,o,i=null){let a=new Date(t);for(let t=0;t<6;t++)if(n.querySelector(`tr[data-date="${a}"]`))a=e.next(a,7);else{const t=document.createElement("tr");t.setAttribute("data-date",a);for(let n=0;n<7;n++){const n=s.#p.cloneNode(!0),o=n.querySelector("button");o.appendChild(document.createTextNode(a.getDate()));const i=new Date(a);o.addEventListener("click",(t=>{this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide");const n=e.month.begin(new Date(i));this.#g.setAttribute("data-focus-date",n),this.#f.setAttribute("value",e.str(i)),this.#f.setAttribute("data-date",i),this.#a.setAttribute("value",e.str(i,"-"))})),t.appendChild(n),a=e.next(a)}n.insertBefore(t,i)}a=new Date(t);const r=new Date(this.#f.getAttribute("data-date"));for(let t=0;t<6;t++){let t=n.querySelector(`tr[data-date="${a}"]`).querySelector("td");for(let n=0;n<7;n++){const n=t.querySelector("button");n.classList.remove("active"),n.classList.remove("fw-bold"),a.getMonth()!==o?n.classList.contains("not-current")||n.classList.add("not-current"):(n.classList.contains("not-current")&&n.classList.remove("not-current"),e.equal(a,r)&&(n.classList.add("active"),n.classList.add("fw-bold"))),a=e.next(a),t=t.nextElementSibling}}}#S(t){t.scrollIntoView({behavior:"smooth"})}#x(t){const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.month.previous(new Date(n)),o=e.week.begin(new Date(s)),i=e.week.begin(e.month.begin(new Date(n))),a=this.#w.querySelector(`tr[data-date="${i}"]`);this.#v(o,this.#w,s.getMonth(),a),this.#g.setAttribute("data-focus-date",s),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(s),this.#S(this.#w.querySelector(`tr[data-date="${o}"]`))}#L(t){const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.month.next(new Date(n)),o=e.week.begin(new Date(s)),i=e.next(new Date(o),42),a=this.#w.querySelector(`tr[data-date="${i}"]`);this.#v(o,this.#w,s.getMonth(),a),this.#g.setAttribute("data-focus-date",s),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(s),this.#S(this.#w.querySelector(`tr[data-date="${o}"]`))}#D(){const t=this.#f.getBoundingClientRect();this.#g.style.top=`${t.top+t.height+window.scrollY+5}px`,this.#g.style.left=`${t.left+5}px`}#A(n){const o=e.month.begin(new Date(n)),i=e.week.begin(new Date(o));this.#m=s.#t.cloneNode(!0);const a=this.#m.querySelector("div.input-group button");this.#f=this.#m.querySelector("div.input-group input"),this.#g=this.#m.querySelector("div.form"),this.#w=this.#g.querySelector("div.form div.calendar-date tbody");for(const t of this.#a.attributes)this.#f.setAttribute(t.name,t.value);this.#f.setAttribute("type","text"),this.#f.removeAttribute("id"),this.#g.querySelector("div.calendar-header button.up").addEventListener("click",(t=>this.#x(t))),this.#g.querySelector("div.calendar-header button.down").addEventListener("click",(t=>this.#L(t))),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(o),this.#g.querySelector("div.calendar-footer button.today").addEventListener("click",(t=>{const n=new Date,s=e.month.begin(new Date(n));this.#g.setAttribute("data-focus-date",s),this.#f.setAttribute("value",e.str(n)),this.#f.setAttribute("data-date",n),this.#a.setAttribute("value",e.str(n,"-")),this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):(this.#g.classList.replace("hide","show"),this.#D())})),this.#g.querySelector("div.calendar-footer button.erase").addEventListener("click",(t=>{const n=new Date,s=e.month.begin(new Date(n));this.#g.setAttribute("data-focus-date",s),this.#f.setAttribute("value",""),this.#f.setAttribute("data-date",""),this.#a.setAttribute("value",""),this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):(this.#g.classList.replace("hide","show"),this.#D())})),this.#g.setAttribute("data-focus-date",o),a.addEventListener("click",(n=>{if(this.#g.classList.contains("show")){this.#g.classList.replace("show","hide"),t.children.remove(this.#w);const n=e.month.begin(new Date);this.#g.setAttribute("data-focus-date",n),e.week.begin(new Date(n)),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n)}else if(this.#g.classList.contains("hide")){t.children.remove(this.#w);const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.week.begin(new Date(n)),o=this.#w.querySelector(`tr[data-date="${s}"]`);this.#v(s,this.#w,n.getMonth(),o),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n),this.#g.classList.replace("hide","show"),this.#D()}})),this.#v(i,this.#w,o.getMonth()),this.#o.insertBefore(this.#m,this.#i)}constructor(t,e){this.#a=t,this.#r=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#o=this.#a.parentNode,this.#i=this.#a.nextSibling;const n=this.#a.getAttribute("value")||this.#a.getAttribute("defaultValue");this.#A(n?new Date(n):new Date),this.#a.style.display="none"}}class o{static#q=new Set;static#$(){for(const t of o.#q){const e=document.getElementById(t);e.classList.contains("show")?e.classList.replace("show","hide"):e.classList.add("hide")}}static on(e,n,s){const i=document.getElementById(n);i.classList.contains("hide")?(i.classList.replace("hide","show"),o.#$(),o.#q.add(n)):(i.classList.add("show"),o.#$(),o.#q.add(n));const a=t.parent(e.target,"button").getBoundingClientRect();if(i.addEventListener("click",(t=>{o.toggle(e,n,s)}),{once:!0}),console.log(a,a.bottom,window.scrollY),s){const t=s.getBoundingClientRect();i.style.left=`${t.left+20}px`,i.style.width=t.width-40+"px"}else i.style.left=`${a.left}px`;const r=i.getBoundingClientRect();console.log(r),i.style.top=`${parseInt(a.top+window.scrollY-r.height-4)}px`}static toggle(e,n,s=void 0){const i=document.getElementById(n);if(i.classList.contains("hide")){o.#$(),i.classList.replace("hide","show"),o.#q.add(n);const a=t.parent(e.target,"button").getBoundingClientRect();if(console.log(a,a.bottom,window.scrollY),i.addEventListener("click",(t=>{o.toggle(e,n,s)}),{once:!0}),s){const t=s.getBoundingClientRect();i.style.left=`${t.left+20}px`,i.style.width=t.width-40+"px"}else i.style.left=`${a.left}px`;const r=i.getBoundingClientRect();console.log(r),i.style.top=`${parseInt(a.top+window.scrollY-r.height-4)}px`}else if(i.classList.contains("show"))o.#q.delete(n),i.classList.replace("show","hide");else{o.#$(),i.classList.add("show"),o.#q.add(n);const a=t.parent(e.target,"button").getBoundingClientRect();if(console.log(a,a.bottom,window.scrollY),i.addEventListener("click",(t=>{o.toggle(e,n,s)}),{once:!0}),s){const t=s.getBoundingClientRect();i.style.left=`${t.left+20}px`,i.style.width=t.width-40+"px"}else i.style.left=`${a.left}px`;const r=i.getBoundingClientRect();console.log(r),i.style.top=`${parseInt(a.top+window.scrollY-r.height-4)}px`}}}void 0===window.novemberizing?console.error("need to ..."):void 0===window.novemberizing.bootstrap?window.novemberizing.bootstrap={Star:n,Date:s,popover:o}:(window.novemberizing.bootstrap.Star=n,window.novemberizing.bootstrap.Date=s,window.novemberizing.bootstrap.popover=o);
const t={parent:(t,e)=>{for(;t&&t.nodeName&&t.nodeName.toLowerCase()!==e;)t=t.parentNode;return t},previous:(t,e)=>{for(;t&&t.nodeName.toLowerCase()!==e;)t=t.previousElementSibling;return t},children:{remove:t=>{for(;t.firstChild;)t.lastChild.remove()}}},e={equal:(t,e)=>t.getFullYear()===e.getFullYear()&&t.getMonth()===e.getMonth()&&t.getDate()===e.getDate(),str:(t,e="/")=>{function n(t){return t<10?`0${t}`:t}return`${t.getFullYear()}${e}${n(t.getMonth()+1)}${e}${n(t.getDate())}`},next:(t,e=1)=>(t.setDate(t.getDate()+e),t),month:{str:t=>{return`${t.getFullYear()}/${e=t.getMonth()+1,e<10?`0${e}`:e}`;var e},begin:t=>(t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t),previous:t=>(t.setMonth(t.getMonth()-1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t),next:t=>(t.setMonth(t.getMonth()+1),t.setDate(1),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)},week:{begin:t=>(t.setDate(t.getDate()-t.getDay()),t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t)}};class n{static#t='<p class="d-inline-flex gap-1 star"></p>';static#e='<button type="button"></button>';static#n='<i class="fa-solid fa-star"></i>';static#s='<i class="fa-regular fa-star"></i>';static{const t=new DOMParser;n.#t=t.parseFromString(n.#t,"text/html").querySelector("p"),n.#e=t.parseFromString(n.#e,"text/html").querySelector("button"),n.#n=t.parseFromString(n.#n,"text/html").querySelector("i"),n.#s=t.parseFromString(n.#s,"text/html").querySelector("i")}#o=null;#i=null;#a=null;#r=null;#l=null;#d=null;#c=null;static load(t){const e=document.querySelectorAll("input[type='range'].form-control.star");for(const s of e)new n(s,"function"==typeof t?t(s):t)}static#u(){return n.#t.cloneNode(!0)}static#h(e,s){const o=n.#e.cloneNode(!0);return o.setAttribute("data-value",e+1),o.setAttribute("aria-pressed",s),s?o.appendChild(n.#n.cloneNode(!0)):o.appendChild(n.#s.cloneNode(!0)),o.addEventListener("click",(e=>{const n=t.parent(e.target,"button"),s=t.parent(n,"p"),o=t.previous(s,"input"),i=parseInt(n.getAttribute("data-value")),a=n.getAttribute("aria-pressed"),r=n.nextElementSibling;"true"===a?r&&"true"===r.getAttribute("aria-pressed")?o.setAttribute("value",i):o.setAttribute("value",i-1):o.setAttribute("value",i);const l=parseInt(o.getAttribute("value")),d=s.querySelectorAll("button");for(const t of d){const e=t.querySelector("i");l<parseInt(t.getAttribute("data-value"))?(e.classList.contains("fa-solid")&&e.classList.replace("fa-solid","fa-regular"),t.setAttribute("aria-pressed","false")):(e.classList.contains("fa-regular")&&e.classList.replace("fa-regular","fa-solid"),t.setAttribute("aria-pressed","true"))}})),o}constructor(t,e){this.#a=t,this.#r=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#o=this.#a.parentNode,this.#i=this.#a.nextSibling,this.#l=parseInt(this.#a.max),this.#d=parseInt(this.#a.min),this.#c=parseInt(this.#a.defaultValue);const s=n.#u();for(let t=this.#d;t<this.#l;t++){const e=n.#h(t,t<this.#c);s.appendChild(e)}this.#a.style.display="none",this.#o.insertBefore(s,this.#i)}}class s{static#b='<div class="calendar">\n <div class="input-group">\n <input type="text" class="form-control" data-date="" disabled>\n <span class="input-group-text">\n <button type="button" class="btn btn-link"><i class="fa-regular fa-calendar"></i></button>\n </span>\n </div>\n <div class="form calendar-form-ui small hide" data-focus-date="">\n <div class="calendar-header d-flex justify-content-between mb-3">\n <button type="button" class="btn btn-light btn-sm text-start month fw-bold"></button>\n <div>\n <button type="button" class="btn btn-light btn-sm up"><i class="fa-solid fa-caret-up"></i></button>\n <button type="button" class="btn btn-light btn-sm down"><i class="fa-solid fa-caret-down"></i></button>\n </div>\n </div>\n <div class="calendar-body mb-2">\n <table class="table">\n <thead>\n <tr>\n <th scope="col">Sun</th>\n <th scope="col">Mon</th>\n <th scope="col">Tue</th>\n <th scope="col">Wed</th>\n <th scope="col">Thu</th>\n <th scope="col">Fri</th>\n <th scope="col">Sat</th>\n </tr>\n </thead>\n </table>\n <div class="calendar-date">\n <table class="table">\n <tbody>\n <tr>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n <td><button type="button" class="btn btn-link btn-sm"></button></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n <div class="calendar-footer d-flex justify-content-between">\n <button type="button" class="btn btn-light btn-sm erase">삭제</button>\n <button type="button" class="btn btn-light btn-sm today">오늘</button>\n </div>\n </div>\n</div>';static#t=null;static#p=null;static{const t=new DOMParser;s.#b=t.parseFromString(s.#b,"text/html"),s.#t=s.#b.querySelector("div.calendar");const e=s.#t.querySelector("div.calendar-date"),n=e.querySelector("tr");s.#p=n.querySelector("td"),s.#p=s.#p.cloneNode(!0),n.remove()}static load(t){const e=document.querySelectorAll('input[type="date"].form-control');for(const n of e)new s(n,"function"==typeof t?t(n):t)}#a=null;#r=null;#o=null;#i=null;#m=null;#f=null;#g=null;#w=null;#y(){this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide"),t.children.remove(this.#w);const n=e.month.begin(new Date);this.#g.setAttribute("data-focus-date",n),e.week.begin(new Date(n)),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n)}#v(t,n,o,i=null){let a=new Date(t);for(let t=0;t<6;t++)if(n.querySelector(`tr[data-date="${a}"]`))a=e.next(a,7);else{const t=document.createElement("tr");t.setAttribute("data-date",a);for(let n=0;n<7;n++){const n=s.#p.cloneNode(!0),o=n.querySelector("button");o.appendChild(document.createTextNode(a.getDate()));const i=new Date(a);o.addEventListener("click",(t=>{this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):this.#g.classList.add("hide");const n=e.month.begin(new Date(i));this.#g.setAttribute("data-focus-date",n),this.#f.setAttribute("value",e.str(i)),this.#f.setAttribute("data-date",i),this.#a.setAttribute("value",e.str(i,"-"))})),t.appendChild(n),a=e.next(a)}n.insertBefore(t,i)}a=new Date(t);const r=new Date(this.#f.getAttribute("data-date"));for(let t=0;t<6;t++){let t=n.querySelector(`tr[data-date="${a}"]`).querySelector("td");for(let n=0;n<7;n++){const n=t.querySelector("button");n.classList.remove("active"),n.classList.remove("fw-bold"),a.getMonth()!==o?n.classList.contains("not-current")||n.classList.add("not-current"):(n.classList.contains("not-current")&&n.classList.remove("not-current"),e.equal(a,r)&&(n.classList.add("active"),n.classList.add("fw-bold"))),a=e.next(a),t=t.nextElementSibling}}}#S(t){t.scrollIntoView({behavior:"smooth"})}#x(t){const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.month.previous(new Date(n)),o=e.week.begin(new Date(s)),i=e.week.begin(e.month.begin(new Date(n))),a=this.#w.querySelector(`tr[data-date="${i}"]`);this.#v(o,this.#w,s.getMonth(),a),this.#g.setAttribute("data-focus-date",s),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(s),this.#S(this.#w.querySelector(`tr[data-date="${o}"]`))}#L(t){const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.month.next(new Date(n)),o=e.week.begin(new Date(s)),i=e.next(new Date(o),42),a=this.#w.querySelector(`tr[data-date="${i}"]`);this.#v(o,this.#w,s.getMonth(),a),this.#g.setAttribute("data-focus-date",s),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(s),this.#S(this.#w.querySelector(`tr[data-date="${o}"]`))}#D(){const t=this.#f.getBoundingClientRect();this.#g.style.top=`${t.top+t.height+window.scrollY+5}px`,this.#g.style.left=`${t.left+5}px`}#A(n){const o=e.month.begin(new Date(n)),i=e.week.begin(new Date(o));this.#m=s.#t.cloneNode(!0);const a=this.#m.querySelector("div.input-group button");this.#f=this.#m.querySelector("div.input-group input"),this.#g=this.#m.querySelector("div.form"),this.#w=this.#g.querySelector("div.form div.calendar-date tbody");for(const t of this.#a.attributes)this.#f.setAttribute(t.name,t.value);this.#f.setAttribute("type","text"),this.#f.removeAttribute("id"),this.#g.querySelector("div.calendar-header button.up").addEventListener("click",(t=>this.#x(t))),this.#g.querySelector("div.calendar-header button.down").addEventListener("click",(t=>this.#L(t))),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(o),this.#g.querySelector("div.calendar-footer button.today").addEventListener("click",(t=>{const n=new Date,s=e.month.begin(new Date(n));this.#g.setAttribute("data-focus-date",s),this.#f.setAttribute("value",e.str(n)),this.#f.setAttribute("data-date",n),this.#a.setAttribute("value",e.str(n,"-")),this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):(this.#g.classList.replace("hide","show"),this.#D())})),this.#g.querySelector("div.calendar-footer button.erase").addEventListener("click",(t=>{const n=new Date,s=e.month.begin(new Date(n));this.#g.setAttribute("data-focus-date",s),this.#f.setAttribute("value",""),this.#f.setAttribute("data-date",""),this.#a.setAttribute("value",""),this.#g.classList.contains("show")?this.#g.classList.replace("show","hide"):(this.#g.classList.replace("hide","show"),this.#D())})),this.#g.setAttribute("data-focus-date",o),a.addEventListener("click",(n=>{if(this.#g.classList.contains("show")){this.#g.classList.replace("show","hide"),t.children.remove(this.#w);const n=e.month.begin(new Date);this.#g.setAttribute("data-focus-date",n),e.week.begin(new Date(n)),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n)}else if(this.#g.classList.contains("hide")){t.children.remove(this.#w);const n=new Date(this.#g.getAttribute("data-focus-date")),s=e.week.begin(new Date(n)),o=this.#w.querySelector(`tr[data-date="${s}"]`);this.#v(s,this.#w,n.getMonth(),o),this.#g.querySelector("div.calendar-header button.month").textContent=e.month.str(n),this.#g.classList.replace("hide","show"),this.#D()}})),this.#v(i,this.#w,o.getMonth()),this.#o.insertBefore(this.#m,this.#i)}constructor(t,e){this.#a=t,this.#r=e,"string"==typeof this.#a&&(this.#a=document.getElementById(this.#a)),this.#o=this.#a.parentNode,this.#i=this.#a.nextSibling;const n=this.#a.getAttribute("value")||this.#a.getAttribute("defaultValue");this.#A(n?new Date(n):new Date),this.#a.style.display="none"}}class o{static#q=new Set;static#$(){for(const t of o.#q){const e=document.getElementById(t);e.classList.contains("show")?e.classList.replace("show","hide"):e.classList.add("hide")}}static on(e,n,s){const i=document.getElementById(n);i.classList.contains("hide")?(i.classList.replace("hide","show"),o.#$(),o.#q.add(n)):(i.classList.add("show"),o.#$(),o.#q.add(n));const a=t.parent(e.target,"button").getBoundingClientRect();if(i.addEventListener("click",(t=>{o.toggle(e,n,s)}),{once:!0}),console.log(a,a.bottom,window.scrollY),s){const t=s.getBoundingClientRect();i.style.left=`${t.left+20}px`,i.style.width=t.width-40+"px"}else i.style.left=`${a.left}px`;const r=i.getBoundingClientRect();console.log(r),i.style.top=`${parseInt(a.top+window.scrollY-r.height-4)}px`}static toggle(e,n,s=void 0){const i=document.getElementById(n);if(i.classList.contains("hide")){o.#$(),i.classList.replace("hide","show"),o.#q.add(n);const a=t.parent(e.target,"button").getBoundingClientRect();if(console.log(a,a.bottom,window.scrollY),i.addEventListener("click",(t=>{o.toggle(e,n,s)}),{once:!0}),s){const t=s.getBoundingClientRect();i.style.left=`${t.left+20}px`,i.style.width=t.width-40+"px"}else i.style.left=`${a.left}px`;const r=i.getBoundingClientRect();console.log(r),i.style.top=`${parseInt(a.top+window.scrollY-r.height-4)}px`}else if(i.classList.contains("show"))o.#q.delete(n),i.classList.replace("show","hide");else{o.#$(),i.classList.add("show"),o.#q.add(n);const a=t.parent(e.target,"button").getBoundingClientRect();if(console.log(a,a.bottom,window.scrollY),i.addEventListener("click",(t=>{o.toggle(e,n,s)}),{once:!0}),s){const t=s.getBoundingClientRect();i.style.left=`${t.left+20}px`,i.style.width=t.width-40+"px"}else i.style.left=`${a.left}px`;const r=i.getBoundingClientRect();console.log(r),i.style.top=`${parseInt(a.top+window.scrollY-r.height-4)}px`}}}class i{static#k=null;static#C(t){i.#k=t,i.#k._element.addEventListener("hidden.bs.modal",(t=>{i.#k=null}),{once:!0}),i.#k.show()}static show(t){i.#k?(i.#k.hide(),i.#k._element.addEventListener("hidden.bs.modal",(e=>{i.#C(t)}),{once:!0})):i.#C(t)}}void 0===window.novemberizing?console.error("need to ..."):void 0===window.novemberizing.bootstrap?window.novemberizing.bootstrap={Star:n,Date:s,modal:i,popover:o}:(window.novemberizing.bootstrap.Star=n,window.novemberizing.bootstrap.Date=s,window.novemberizing.bootstrap.modal=i,window.novemberizing.bootstrap.popover=o);
{
"name": "@novemberizing/bootstrap",
"version": "0.0.29",
"version": "0.0.30",
"description": "novemberizing's bootstrap plugin",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

import novemberizing from "./novemberizing.js";
export default class DateUI {
static #all = /* html */ `<div class="calendar">
static #all = `<div class="calendar">
<div class="input-group">

@@ -6,0 +6,0 @@ <input type="text" class="form-control" data-date="" disabled>

import StarUI from "./StarUI.js";
import DateUI from "./DateUI.js";
import PopoverUI from "./PopoverUI.js";
import ModalUI from "./ModalUI.js";

@@ -12,2 +13,4 @@ if(typeof window.novemberizing === 'undefined') {

Date: DateUI,
modal: ModalUI,
popover: PopoverUI

@@ -18,4 +21,6 @@ };

window.novemberizing.bootstrap.Date = DateUI;
window.novemberizing.bootstrap.modal = ModalUI;
window.novemberizing.bootstrap.popover = PopoverUI;
}
}
import novemberizing from "./novemberizing.js";
/**
* TODO: onResize 적용
* TODO: remove Event Handler 적용
* TODO: 공통으로 사용하는 코드 함수화
*/
export default class PopoverUI {

@@ -4,0 +9,0 @@ static #popovers = new Set();

import novemberizing from "./novemberizing.js";
export default class Star {
static #root = /* html */ `<p class="d-inline-flex gap-1 star"></p>`;
static #button = /* html */ `<button type="button"></button>`;
static #press = /* html */ `<i class="fa-solid fa-star"></i>`;
static #unpress = /* html */ `<i class="fa-regular fa-star"></i>`;
export default class StarUI {
static #root = `<p class="d-inline-flex gap-1 star"></p>`;
static #button = `<button type="button"></button>`;
static #press = `<i class="fa-solid fa-star"></i>`;
static #unpress = `<i class="fa-regular fa-star"></i>`;

@@ -12,6 +12,6 @@ static {

Star.#root = parser.parseFromString(Star.#root, "text/html").querySelector("p");
Star.#button = parser.parseFromString(Star.#button, "text/html").querySelector("button");
Star.#press = parser.parseFromString(Star.#press, "text/html").querySelector("i");
Star.#unpress = parser.parseFromString(Star.#unpress, "text/html").querySelector("i");
StarUI.#root = parser.parseFromString(StarUI.#root, "text/html").querySelector("p");
StarUI.#button = parser.parseFromString(StarUI.#button, "text/html").querySelector("button");
StarUI.#press = parser.parseFromString(StarUI.#press, "text/html").querySelector("i");
StarUI.#unpress = parser.parseFromString(StarUI.#unpress, "text/html").querySelector("i");
}

@@ -30,3 +30,3 @@

for(const element of elements) {
const o = new Star(element, typeof options === 'function' ? options(element) : options);
const o = new StarUI(element, typeof options === 'function' ? options(element) : options);
}

@@ -36,13 +36,13 @@ }

static #createRoot() {
return Star.#root.cloneNode(true);
return StarUI.#root.cloneNode(true);
}
static #createBtn(value, press) {
const button = Star.#button.cloneNode(true);
const button = StarUI.#button.cloneNode(true);
button.setAttribute("data-value", value + 1);
button.setAttribute("aria-pressed", press);
if(press) {
button.appendChild(Star.#press.cloneNode(true));
button.appendChild(StarUI.#press.cloneNode(true));
} else {
button.appendChild(Star.#unpress.cloneNode(true));
button.appendChild(StarUI.#unpress.cloneNode(true));
}

@@ -101,6 +101,6 @@ button.addEventListener("click", e => {

const root = Star.#createRoot();
const root = StarUI.#createRoot();
for(let i = this.#min; i < this.#max; i++) {
const button = Star.#createBtn(i, i < this.#def);
const button = StarUI.#createBtn(i, i < this.#def);
root.appendChild(button);

@@ -107,0 +107,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc