beercss 3.0.1 → 3.0.3

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  <p align="center">
5
5
  <a href="https://github.com/beercss/beercss/blob/main/LICENSE"><img src="https://img.shields.io/github/license/beercss/beercss" alt="License"></a>
6
6
  <img src="https://img.shields.io/jsdelivr/npm/hy/beercss" alt="Downloads">
7
- <a href="https://bundlephobia.com/package/beercss"><img src="https://badgen.net/bundlephobia/minzip/beercss" alt="Size"></a>
7
+ <a href="https://img.badgesize.io/beercss/beercss/main/dist/cdn/beer.min.css?compression=brotli"><img src="https://img.badgesize.io/beercss/beercss/main/dist/cdn/beer.min.css?compression=brotli" alt="Size"></a>
8
8
  <a href="https://www.npmjs.com/package/beercss"><img src="https://img.shields.io/npm/v/beercss" alt="Version"></a>
9
9
  <a href="https://github.com/beercss/beercss/pulls"><img src="https://img.shields.io/github/issues-pr/beercss/beercss" alt="Pull Request"></a>
10
10
  <a href="https://github.com/beercss/beercss/issues"><img src="https://img.shields.io/github/issues/beercss/beercss" alt="Issues"></a>
@@ -117,9 +117,21 @@ 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.1/dist/cdn/beer.min.css" rel="stylesheet" />
121
- <script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.0.1/dist/cdn/beer.min.js"></script>
122
- <script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@0.1.4/dist/cdn/material-dynamic-colors.min.js"></script>
120
+ // with html
121
+ <link href="https://cdn.jsdelivr.net/npm/beercss@3.0.3/dist/cdn/beer.min.css" rel="stylesheet" />
122
+ <script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.0.3/dist/cdn/beer.min.js"></script>
123
+ <script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@0.1.5/dist/cdn/material-dynamic-colors.min.js"></script>
124
+ ```
125
+
126
+ ```css
127
+ // with css
128
+ @import "https://cdn.jsdelivr.net/npm/beercss@3.0.3/dist/cdn/beer.min.css";
129
+ ```
130
+
131
+ ```js
132
+ // with javascript
133
+ import "https://cdn.jsdelivr.net/npm/beercss@3.0.3/dist/cdn/beer.min.js";
134
+ import "https://cdn.jsdelivr.net/npm/material-dynamic-colors@0.1.5/dist/cdn/material-dynamic-colors.min.js";
123
135
  ```
124
136
 
125
137
  ### NPM
@@ -136,11 +148,15 @@ npm i material-dynamic-colors
136
148
  // importing as window.beercss and window.materialDynamicColors
137
149
  import "beercss";
138
150
  import "material-dynamic-colors";
151
+ ```
139
152
 
153
+ ```js
140
154
  // importing as beercss and materialDynamicColors
141
155
  import beercss from "beercss";
142
156
  import materialDynamicColors from "material-dynamic-colors";
157
+ ```
143
158
 
159
+ ```js
144
160
  // importing manually from dist
145
161
  import "beercss/dist/cdn/beer.min.css";
146
162
  import "beercss/dist/cdn/material-symbols-outlined.woff2";
@@ -152,7 +168,9 @@ import "beercss/dist/cdn/roboto-flex-latin.woff2";
152
168
  import "beercss/dist/cdn/roboto-flex-vietnamese.woff2";
153
169
  import beercss from "beercss/dist/cdn/beer.min.js";
154
170
  import materialDynamicColors from "material-dynamic-colors/dist/cdn/material-dynamic-colors.min.js";
171
+ ```
155
172
 
173
+ ```js
156
174
  // importing manually from src
157
175
  import "beercss/src/cdn/beer.css";
158
176
  import "beercss/src/cdn/material-symbols-outlined.woff2";
@@ -178,9 +196,9 @@ You can use this html to setup your project. See on [Codepen](https://codepen.io
178
196
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
179
197
  <meta name="google" content="notranslate">
180
198
  <title>Hello world</title>
181
- <link href="https://cdn.jsdelivr.net/npm/beercss@3.0.1/dist/cdn/beer.min.css" rel="stylesheet">
182
- <script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.0.1/dist/cdn/beer.min.js"></script>
183
- <script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@0.1.4/dist/cdn/material-dynamic-colors.min.js"></script>
199
+ <link href="https://cdn.jsdelivr.net/npm/beercss@3.0.3/dist/cdn/beer.min.css" rel="stylesheet">
200
+ <script type="module" src="https://cdn.jsdelivr.net/npm/beercss@3.0.3/dist/cdn/beer.min.js"></script>
201
+ <script type="module" src="https://cdn.jsdelivr.net/npm/material-dynamic-colors@0.1.5/dist/cdn/material-dynamic-colors.min.js"></script>
184
202
  </head>
185
203
  <body class="light">
186
204
  <nav class="left m l">
@@ -1 +1 @@
1
- export default(()=>{const p=globalThis;let b=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},y=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 g=n(e,"round")?1.25:.75,C=a+g+.5;t.style.clipPath=`polygon(0% 0%, ${g}rem 0%, ${g}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;y(t)},S=r=>{const t=r.currentTarget;y(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"),b&&clearTimeout(b)},_=r=>{const t=r.currentTarget;F(t)},N=r=>{const t=r.currentTarget;F(t,r)},P=()=>{x&&clearTimeout(x),x=setTimeout(w,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),y(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",$),b&&clearTimeout(b),!(e&&e==-1)&&(b=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 g=a.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();d+="--"+g+":"+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}),w())},w=(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),g=u("[data-ui='#"+a.id+"']");U(g,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),y(a)}),m(".field > input[type=file]").forEach(a=>{f(a,"change",_),F(a)})};return p.addEventListener&&p.addEventListener("load",()=>w("setup")),p.ui=w,p.ui})();
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.1",
5
+ "version": "3.0.3",
6
6
  "name": "beercss",
7
7
  "license": "MIT",
8
8
  "type": "module",
@@ -14,7 +14,7 @@
14
14
  "test": "vitest"
15
15
  },
16
16
  "dependencies": {
17
- "material-dynamic-colors": "^0.1.4",
17
+ "material-dynamic-colors": "^0.1.5",
18
18
  "sass": "^1.49.9",
19
19
  "uuid": "^8.3.2",
20
20
  "vue": "^3.2.31"
package/src/cdn/beer.ts CHANGED
@@ -396,6 +396,7 @@ export default (() => {
396
396
  };
397
397
 
398
398
  if (_window.addEventListener) _window.addEventListener("load", () => ui("setup"));
399
+ _window.beercss= ui;
399
400
  _window.ui = ui;
400
401
  return _window.ui;
401
402
  })();