beercss 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/cdn/beer.min.js +1 -1
- package/package.json +1 -1
- package/src/cdn/beer.ts +1 -0
package/README.md
CHANGED
|
@@ -117,8 +117,8 @@ This project was guided by the **"Germany Beer Purity Law"** or **"Reinheitsgebo
|
|
|
117
117
|
From jsdelivr.net.
|
|
118
118
|
|
|
119
119
|
```html
|
|
120
|
-
<link href="https://cdn.jsdelivr.net/npm/beercss@3.0.
|
|
121
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.0.
|
|
120
|
+
<link href="https://cdn.jsdelivr.net/npm/beercss@3.0.2/dist/cdn/beer.min.css" rel="stylesheet" />
|
|
121
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.0.2/dist/cdn/beer.min.js"></script>
|
|
122
122
|
<script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@0.1.4/dist/cdn/material-dynamic-colors.min.js"></script>
|
|
123
123
|
```
|
|
124
124
|
|
|
@@ -178,8 +178,8 @@ You can use this html to setup your project. See on [Codepen](https://codepen.io
|
|
|
178
178
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
|
179
179
|
<meta name="google" content="notranslate">
|
|
180
180
|
<title>Hello world</title>
|
|
181
|
-
<link href="https://cdn.jsdelivr.net/npm/beercss@3.0.
|
|
182
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.0.
|
|
181
|
+
<link href="https://cdn.jsdelivr.net/npm/beercss@3.0.2/dist/cdn/beer.min.css" rel="stylesheet">
|
|
182
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.0.2/dist/cdn/beer.min.js"></script>
|
|
183
183
|
<script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@0.1.4/dist/cdn/material-dynamic-colors.min.js"></script>
|
|
184
184
|
</head>
|
|
185
185
|
<body class="light">
|
package/dist/cdn/beer.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default(()=>{const p=globalThis;let
|
|
1
|
+
export default(()=>{const p=globalThis;let g=null,x=null,k=null;const c={light:"",dark:""},A=async r=>await new Promise(t=>setTimeout(t,r)),B=()=>"fxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const t=Math.random()*16|0;return(r=="x"?t:t&3|8).toString(16)}),u=(r,t)=>{try{return typeof r=="string"?(t||document).querySelector(r):r}catch{}},m=(r,t)=>{try{return typeof r=="string"?(t||document).querySelectorAll(r):r}catch{}},n=(r,t)=>r?r.classList.contains(t):!1,s=(r,t)=>{!r||r.classList.add(t)},l=(r,t)=>{!r||r.classList.remove(t)},f=(r,t,e)=>{r.addEventListener(t,e,!0)},D=(r,t,e)=>{r.removeEventListener(t,e,!0)},T=(r,t)=>{if(!!t)return t.parentNode.insertBefore(r,t)},z=r=>{if(!!r)return r.previousElementSibling},Y=r=>{if(!!r)return r.nextElementSibling},h=r=>{if(!!r)return r.parentElement},R=r=>{const t=document.createElement("div");for(const e in r)t[e]=r[e];return t},w=r=>{const t=r,e=h(r),o=u("label",e),i=n(e,"border")&&!n(e,"fill");if(document.activeElement==r||t.value||/date|time/.test(t.type)){if(i&&o){let a=n(o,"active")?o.offsetWidth:Math.round(o.offsetWidth/1.33);a=a/16;const b=n(e,"round")?1.25:.75,C=a+b+.5;t.style.clipPath=`polygon(0% 0%, ${b}rem 0%, ${b}rem 0.5rem, ${C}rem 0.5rem, ${C}rem 0%, 100% 0%, 100% 100%, 0% 100%)`}else t.style.clipPath="";s(o,"active")}else l(o,"active"),t.style.clipPath="";r.getAttribute("data-ui")&&U(r)},j=r=>{const t=r.currentTarget;/input/i.test(t.tagName)||U(t)},q=r=>{const t=r.currentTarget,e=u("input:not([type=file]):not([type=checkbox]):not([type=radio]), select, textarea",h(t));e&&e.focus()},L=r=>{const t=r.currentTarget;w(t)},S=r=>{const t=r.currentTarget;w(t)},E=r=>{const t=r.currentTarget;m(".dropdown.active").forEach(o=>l(o,"active")),D(t,"click",E)},$=r=>{const t=r.currentTarget;l(t,"active"),g&&clearTimeout(g)},_=r=>{const t=r.currentTarget;F(t)},N=r=>{const t=r.currentTarget;F(t,r)},P=()=>{x&&clearTimeout(x),x=setTimeout(y,180)},F=(r,t)=>{if(t){if(t.key!=="Enter")return;const i=t.currentTarget,d=Y(i);return!d||!/file/i.test(d.type)?void 0:d.click()}const e=r,o=z(r);!o||!/text/i.test(o.type)||(o.value=Array.from(e.files).map(i=>i.name).join(", "),o.readOnly=!0,o.addEventListener("keydown",N),w(o))},U=(r,t,e)=>{if(t||(t=u(r.getAttribute("data-ui"))),n(t,"modal"))return O(r,t);if(n(t,"dropdown"))return M(r,t);if(n(t,"toast"))return H(r,t,e);if(n(t,"page"))return I(r,t);if(n(t,"progress"))return V(t,e);if(v(r),n(t,"active"))return l(t,"active");s(t,"active")},v=r=>{const t=h(r);if(!n(t,"tabs"))return;m("a",t).forEach(o=>l(o,"active")),s(r,"active")},I=(r,t)=>{v(r);const e=h(t);for(let o=0;o<e.children.length;o++)n(e.children[o],"page")&&l(e.children[o],"active");s(t,"active")},M=(r,t)=>{if(v(r),n(t,"active"))return l(t,"active");m(".dropdown.active").forEach(o=>l(o,"active")),s(t,"active"),f(document.body,"click",E)},O=async(r,t)=>{v(r);let e=z(t);n(e,"overlay")||(e=R({className:"overlay"}),T(e,t),await A(90)),e.onclick=()=>{l(r,"active"),l(t,"active"),l(e,"active")};const o=n(t,"active"),i=h(t);/nav/i.test(i.tagName)&&m(".modal, a, .overlay",i).forEach(a=>l(a,"active")),o?(l(r,"active"),l(e,"active"),l(t,"active")):(!/button/i.test(r.tagName)&&!n(r,"button")&&!n(r,"chip")&&s(r,"active"),s(e,"active"),s(t,"active"))},H=(r,t,e)=>{v(r),m(".toast.active").forEach(i=>l(i,"active")),s(t,"active"),f(t,"click",$),g&&clearTimeout(g),!(e&&e==-1)&&(g=setTimeout(()=>{l(t,"active")},e&&e?e:6e3))},V=(r,t)=>{const e=r;if(n(e,"left"))return e.style.clipPath=`polygon(0% 0%, 0% 100%, ${t}% 100%, ${t}% 0%)`;if(n(e,"top"))return e.style.clipPath=`polygon(0% 0%, 100% 0%, 100% ${t}%, 0% ${t}%)`;if(n(e,"right"))return e.style.clipPath=`polygon(100% 0%, 100% 100%, ${100-t}% 100%, ${100-t}% 0%)`;if(n(e,"bottom"))return e.style.clipPath=`polygon(0% 100%, 100% 100%, 100% ${100-t}%, 0% ${100-t}%)`},W=()=>{if(c.light&&c.dark)return c;const r=document.createElement("body");r.className="light",document.body.appendChild(r);const t=document.createElement("body");t.className="dark",document.body.appendChild(t);const e=getComputedStyle(r),o=getComputedStyle(t),i=["--primary","--on-primary","--primary-container","--on-primary-container","--secondary","--on-secondary","--secondary-container","--on-secondary-container","--tertiary","--on-tertiary","--tertiary-container","--on-tertiary-container","--error","--on-error","--error-container","--on-error-container","--background","--on-background","--surface","--on-surface","--outline","--surface-variant","--on-surface-variant","--inverse-surface","--inverse-on-surface"];for(let d=0;d<i.length;d++)c.light+=i[d]+":"+e.getPropertyValue(i[d])+";",c.dark+=i[d]+":"+o.getPropertyValue(i[d])+";";return document.body.removeChild(r),document.body.removeChild(t),c},Z=r=>{if(!r||!p.materialDynamicColors)return W();const t=/dark/i.test(document.body.className)?"dark":"light";return r&&r.light&&r.dark?(c.light=r.light,c.dark=r.dark,document.body.setAttribute("style",r[t]),r):p.materialDynamicColors(r).then(e=>{const o=i=>{let d="";for(const a in i){const b=a.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();d+="--"+b+":"+i[a]+";"}return d};return c.light=o(e.light),c.dark=o(e.dark),document.body.setAttribute("style",c[t]),c})},K=r=>r?(document.body.classList.remove("light","dark"),document.body.classList.add(r),p.materialDynamicColors&&document.body.setAttribute("style",c[r]),r):/dark/i.test(document.body.className)?"dark":"light",G=()=>{k||(k=new MutationObserver(P),k.observe(document.body,{childList:!0,subtree:!0}),y())},y=(r,t)=>{if(r){if(r=="setup")return G();if(r=="guid")return B();if(r=="mode")return K(t);if(r=="theme")return Z(t);const a=u(r),b=u("[data-ui='#"+a.id+"']");U(b,a,t)}m("[data-ui]").forEach(a=>f(a,"click",j)),m(".field > label").forEach(a=>f(a,"click",q)),m(".field > input:not([type=file]):not([type=checkbox]):not([type=radio]), .field > select, .field > textarea").forEach(a=>{f(a,"focus",L),f(a,"blur",S),w(a)}),m(".field > input[type=file]").forEach(a=>{f(a,"change",_),F(a)})};return p.addEventListener&&p.addEventListener("load",()=>y("setup")),p.beercss=y,p.ui=y,p.ui})();
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Everton and Leonardo",
|
|
3
3
|
"description": "Build material design interfaces in record time... without stress for devs.",
|
|
4
4
|
"homepage": "https://www.beercss.com/",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.2",
|
|
6
6
|
"name": "beercss",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"type": "module",
|