pico/docs/js/pico.docs.min.js

1 line
11 KiB
JavaScript
Raw Normal View History

2020-09-29 10:54:26 +07:00
!function(){if(window.matchMedia("(min-width: 992px)").matches){var e=document.querySelector("aside nav"),t=document.querySelectorAll("aside details");if(e.clientHeight<e.scrollHeight)for(var r=1;r<t.length;r++)t[r].removeAttribute("open")}}(),function(){function a(e){if("light"==e)var t=n.button.on;else t=n.button.off;document.querySelector("html").setAttribute("data-theme",e);for(var r=document.querySelectorAll(n.selector),a=0;a<r.length;a++)r[a].innerHTML=t,r[a].setAttribute("aria-label",t.replace(/<[^>]*>?/gm,""));n.currentTheme=e}var n={button:{element:"BUTTON",class:"contrast switcher theme-switcher",on:"<i>Turn on dark mode</i>",off:"<i>Turn off dark mode</i>"},target:"body",selector:"button.theme-switcher",currentTheme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"};!function(){var e=document.createElement(n.button.element);e.className=n.button.class,document.querySelector(n.target).appendChild(e),a(n.currentTheme);for(var t=document.querySelectorAll(n.selector),r=0;r<t.length;r++)t[r].addEventListener("click",function(e){"light"==n.currentTheme?a("dark"):a("light")},!1)}()}(),function(){function e(e){for(var t="",r="",a=0;a<e;a++)t+="<div>"+(a+1)+"</div>",r+=" &lt;<b>div</b>&gt;"+(a+1)+"&lt;/<b>div</b>&gt;\n";document.querySelector(n.targetGrid).innerHTML=t,document.querySelector(n.targetCode).innerHTML='&lt;<b>div</b> <i>class</i>=<u>"grid"</u>&gt;\n'+r+"&lt;/<b>div</b>&gt;"}var t,n={columnsCurrent:4,columnsMin:1,columnsMax:12,targetButtons:"#grids article",targetGrid:"#grids .grid",targetCode:"#grids pre code",selectorAdd:"#grids button.add",selectorRemove:"#grids button.remove"};(t=document.createElement("P")).innerHTML='<button class="secondary add"><svg xmlns="http://www.w3.org/2000/svg" height="1rem" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg> Add column</button><button class="secondary remove"><svg xmlns="http://www.w3.org/2000/svg" height="1rem" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line></svg> Remove column</button>',document.querySelector(n.targetButtons).before(t),document.querySelector(n.selectorAdd).addEventListener("click",function(){n.columnsCurrent<n.columnsMax&&(n.columnsCurrent++,e(n.columnsCurrent))},!1),document.querySelector(n.selectorRemove).addEventListener("click",function(){n.columnsCurrent>n.columnsMin&&(n.columnsCurrent--,e(n.columnsCurrent))},!1)}(),function(){function c(e,t){!function(e,t){var a={".name":e.charAt(0).toUpperCase()+e.substring(1)+" ",".c500":t[500],".c600":t[600],".c700":t[700],".c600-outline-light":n(t[600],.125),".c600-outline-dark":n(t[600],.25),".inverse":t.inverse};Object.keys(a).forEach(function(e){for(var t=document.querySelectorAll(i.selectorTheme+" "+e),r=0;r<t.length;++r)t[r].innerHTML=a[e]});var r='[data-theme="generated"] {--h4:'+t[700]+";--primary:"+t[600]+";--primary-hover:"+t[700]+";--primary-focus:"+n(t[600],.125)+";--primary-inverse:"+t.inverse+';}@media only screen and (prefers-color-scheme: dark) {:root:not([data-theme="light"]) [data-theme="generated"] {--h4:'+t[400]+";--primary:"+t[600]+";--primary-hover:"+t[500]+";--primary-focus:"+n(t[600],.25)+";--primary-inverse:"+t.inverse+';}}[data-theme="dark"] [data-theme="generated"] {--h4:'+t[500]+";--primary:"+t[600]+";--primary-hover:"+t[500]+";--primary-focus:"+n(t[600],.25)+";--primary-inverse:"+t.inverse+';}[data-theme="generated"] {--primary-border: var(--primary);--primary-hover-border: var(--primary-hover);--input-hover-border: var(--primary-hover);--input-focus: var(--primary-focus);--input-inverse: var(--primary-inverse);}';document.querySelector('style[title="color-picker"]').innerHTML=i.styles+r}(e,t);for(var r=document.querySelectorAll(i.selectorButton),a=0;a<r.length;a++)r[a].removeAttribute("class");document.querySelector(i.selectorButton+'[data-color="'+e+'"]').setAttribute("clas