beer_rails 0.1.1 → 0.1.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cf170afa3fe4c8fad2b6aa01d277b1611b55c7ac02a49f2c8f777052317f941c
|
|
4
|
+
data.tar.gz: 348b17e128e1722d2a4807efbf9f409886bb798de65109b20a68c9e553424b0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a251b5aaf51c3940aa7c2084dac4a0865486d4cb4fb241ce11ca17f5fbd6ed4bd029016a725ff279c4930f57db23d5ccf24d48edbc6d633a50754fa90e67a5b0
|
|
7
|
+
data.tar.gz: 1a733b3546d28e76817ffee7383bf77a256fe9308c4d9d86a0af463b743dd9fe091db1a21884c7ffc84c698aa6ddb4ae9a231ee3e9748d2c8150ad0f0d04ed54
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
//= link_directory ../stylesheets/
|
|
1
|
+
//= link_directory ../stylesheets/beer_rails .css
|
|
2
|
+
//= link_directory ../javascript/beer_rails .js
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export default (() => {
|
|
2
|
+
let m,$,N,P;const l={light:"",dark:""},R=[];async function Q(t){return await new Promise(n=>setTimeout(n,t))}function U(){return"fxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=Math.random()*16|0;return(t==="x"?n:n&3|8).toString(16)})}function b(t,n){try{return typeof t=="string"?(n!=null?n:document).querySelector(t):t}catch{return null}}function f(t,n){try{return typeof t=="string"?(n!=null?n:document).querySelectorAll(t):t!=null?t:R}catch{return R}}function d(t,n){var e,r;return(r=(e=t==null?void 0:t.classList)==null?void 0:e.contains(n))!=null?r:!1}function L(t,n){var e;return((e=t==null?void 0:t.tagName)==null?void 0:e.toLowerCase())===n}function k(t,n){var e;return((e=t==null?void 0:t.type)==null?void 0:e.toLowerCase())===n}function v(t,n){var e;(e=t==null?void 0:t.classList)==null||e.add(n)}function u(t,n){var e;(e=t==null?void 0:t.classList)==null||e.remove(n)}function g(t,n,e){t==null||t.addEventListener(n,e,!0)}function X(t,n,e){t==null||t.removeEventListener(n,e,!0)}function Y(t,n){var e;(e=n==null?void 0:n.parentNode)==null||e.insertBefore(t,n)}function _(t){return t==null?void 0:t.previousElementSibling}function j(t){return t==null?void 0:t.nextElementSibling}function x(t){return t==null?void 0:t.parentElement}function J(t){const n=document.createElement("div");for(const e in t)n.setAttribute(e,t[e]);return n}function T(t){const n=t;k(n,"number")&&!n.value&&(n.value=""),n.placeholder||(n.placeholder=" "),t.getAttribute("data-ui")&&q(t,null)}function tt(t){q(t.currentTarget,null,null,t)}function nt(t){const n=t.currentTarget,e=x(n),r=b("input:not([type=file], [type=checkbox], [type=radio]), select, textarea",e);r&&r.focus()}function et(t){const n=t.currentTarget;T(n)}function rt(t){const n=t.currentTarget;T(n)}function W(t){X(document.body,"click",W);const n=t.target;f("menu.active").forEach(r=>V(n,r,t))}function at(t){const n=t.currentTarget;u(n,"active"),m&&clearTimeout(m)}function it(t){const n=t.currentTarget;D(n)}function ot(t){const n=t.currentTarget;I(n)}function ct(t){const n=t.currentTarget;D(n,t)}function ut(t){const n=t.currentTarget;I(n,t)}function st(t){const n=t.currentTarget;G(n)}function Z(){$&&clearTimeout($),$=setTimeout(()=>{A()},180)}function D(t,n){if(n&&n.key==="Enter"){const i=_(t);return k(i,"file")?i.click():void 0}const e=t,r=j(t);!k(r,"text")||(r.value=e.files?Array.from(e.files).map(i=>i.name).join(", "):"",r.readOnly=!0,r.addEventListener("keydown",ct),T(r))}function I(t,n){if(n&&n.key==="Enter"){const i=_(t);return k(i,"color")?i.click():void 0}const e=t,r=j(t);!k(r,"text")||(r.readOnly=!0,r.value=e.value,r.addEventListener("keydown",ut),T(r))}function G(t){const n=x(t),e=b("span",n),r=f("input",n);if(!r.length||!e)return;const i=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--size"))||16,c=1.25*i*100/r[0].offsetWidth,o=[],s=[];for(let y=0;y<r.length;y++){const z=parseFloat(r[y].min),B=parseFloat(r[y].max),O=parseFloat(r[y].value),C=z||0,F=B||100,w=O||0,K=(w-C)*100/(F-C),H=c/2-c*K/100;o.push(K+H),s.push(w),z!==C&&(r[y].min=`${C}`),B!==F&&(r[y].max=`${F}`),O!==w&&(r[y].value=`${w}`)}let a=o[0],p=0,h=100-p-a,S=s[0],M=s[1]||0;r.length>1&&(a=Math.abs(o[1]-o[0]),p=o[1]>o[0]?o[0]:o[1],h=100-p-a,M>S&&(S=s[1]||0,M=s[0])),n.style.setProperty("---start",`${p}%`),n.style.setProperty("---end",`${h}%`),n.style.setProperty("---value1",`'${S}'`),n.style.setProperty("---value2",`'${M}'`)}async function q(t,n,e,r){if(!(!n&&(n=b(t.getAttribute("data-ui")),!n))){if(L(n,"dialog"))return await ft(t,n);if(L(n,"menu"))return V(t,n,r);if(d(n,"snackbar"))return dt(t,n,e);if(d(n,"page"))return lt(t,n);if(E(t),d(n,"active"))return u(n,"active");v(n,"active")}}function E(t){const n=x(t);if(!d(n,"tabs"))return;f("a",n).forEach(r=>u(r,"active")),v(t,"active")}function lt(t,n){E(t);const e=x(n);if(e)for(let r=0;r<e.children.length;r++)d(e.children[r],"page")&&u(e.children[r],"active");v(n,"active")}function V(t,n,e){N&&clearTimeout(N),N=setTimeout(()=>{var i,c;if(g(document.body,"click",W),E(t),d(n,"active")){if(!e)return u(n,"active");const o=e.target,s=b((i=o.getAttribute("data-ui"))!=null?i:""),a=o.closest("menu"),p=!b("menu",(c=o.closest("[data-ui]"))!=null?c:void 0);return s&&s!==a?V(o,s):!s&&!p&&a?!1:u(n,"active")}f("menu.active").forEach(o=>u(o,"active")),v(n,"active")},90)}async function ft(t,n){var a;(a=document.activeElement)==null||a.blur(),E(t);let e=_(n);const r=n,i=d(n,"active")||r.open,c=d(n,"modal"),o=x(n),s=L(o,"nav");d(e,"overlay")||(e=J({class:"overlay"}),Y(e,n),await Q(90)),e.onclick=()=>{c||(u(t,"active"),u(n,"active"),u(e,"active"),r.close())},s&&f("dialog, a, .overlay",o).forEach(h=>{u(h,"active"),h.open&&h.close()}),i?(u(t,"active"),u(e,"active"),u(n,"active"),r.close()):(!L(t,"button")&&!d(t,"button")&&!d(t,"chip")&&v(t,"active"),v(e,"active"),v(n,"active"),c?r.showModal():r.show())}function dt(t,n,e){var i;(i=document.activeElement)==null||i.blur(),E(t),f(".snackbar.active").forEach(c=>u(c,"active")),v(n,"active"),g(n,"click",at),m&&clearTimeout(m),e!==-1&&(m=setTimeout(()=>{u(n,"active")},e!=null?e:6e3))}function gt(){if(l.light&&l.dark)return l;const t=document.createElement("body");t.className="light",document.body.appendChild(t);const n=document.createElement("body");n.className="dark",document.body.appendChild(n);const e=getComputedStyle(t),r=getComputedStyle(n),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","--surface-variant","--on-surface-variant","--outline","--outline-variant","--shadow","--scrim","--inverse-surface","--inverse-on-surface","--inverse-primary","--surface-dim","--surface-bright","--surface-container-lowest","--surface-container-low","--surface-container","--surface-container-high","--surface-container-highest"];for(let c=0;c<i.length;c++)l.light+=i[c]+":"+e.getPropertyValue(i[c])+";",l.dark+=i[c]+":"+r.getPropertyValue(i[c])+";";return document.body.removeChild(t),document.body.removeChild(n),l}function yt(t){if(!t||!globalThis.materialDynamicColors)return gt();const n=/dark/i.test(document.body.className)?"dark":"light";return t.light&&t.dark?(l.light=t.light,l.dark=t.dark,document.body.setAttribute("style",t[n]),t):globalThis.materialDynamicColors(t).then(e=>{const r=i=>{let c="";for(const o in i){const s=o.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),a=i[o];c+="--"+s+":"+a+";"}return c};return l.light=r(e.light),l.dark=r(e.dark),document.body.setAttribute("style",l[n]),l})}function vt(t){if(!t)return/dark/i.test(document.body.className)?"dark":"light";document.body.classList.remove("light","dark"),document.body.classList.add(t);const n=t==="light"?l.light:l.dark;return globalThis.materialDynamicColors&&document.body.setAttribute("style",n),t}function pt(){P||(P=new MutationObserver(Z),P.observe(document.body,{attributes:!0,attributeFilter:["value","max","min"],childList:!0,subtree:!0}),Z())}function A(t,n){if(t){if(t==="setup")return pt();if(t==="guid")return U();if(t==="mode")return vt(n);if(t==="theme")return yt(n);const a=b(t);if(!a)return;q(a,a,n)}f("[data-ui]").forEach(a=>g(a,"click",tt)),f(".field > label").forEach(a=>g(a,"click",nt)),f(".field > input:not([type=file], [type=color], [type=range]), .field > select, .field > textarea").forEach(a=>{g(a,"focus",et),g(a,"blur",rt),T(a)}),f(".field > input[type=file]").forEach(a=>{g(a,"change",it),D(a)}),f(".field > input[type=color]").forEach(a=>{g(a,"change",ot),I(a)}),f(".slider > input[type=range]").forEach(a=>{g(a,"input",st),G(a)})}globalThis.addEventListener&&globalThis.addEventListener("load",async()=>await A("setup"));globalThis.beercss=A;globalThis.ui=A;
|
|
3
|
+
return globalThis.ui;
|
|
4
|
+
})();
|
data/lib/beer_rails/engine.rb
CHANGED
data/lib/beer_rails/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: beer_rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bruno Pavarine de Sá Campos
|
|
@@ -24,7 +24,7 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: 7.1.2
|
|
27
|
-
description:
|
|
27
|
+
description: This gem adds Beer CSS (CSS and JS) to your Rails 7 project.
|
|
28
28
|
email:
|
|
29
29
|
- pavarine@gmail.com
|
|
30
30
|
executables: []
|
|
@@ -35,6 +35,7 @@ files:
|
|
|
35
35
|
- README.md
|
|
36
36
|
- Rakefile
|
|
37
37
|
- app/assets/config/beer_rails_manifest.js
|
|
38
|
+
- app/assets/javascripts/beer_rails/beer.min.js
|
|
38
39
|
- app/assets/stylesheets/beer_rails/application.css
|
|
39
40
|
- app/assets/stylesheets/beer_rails/beer.min.css
|
|
40
41
|
- config/routes.rb
|
|
@@ -68,5 +69,5 @@ requirements: []
|
|
|
68
69
|
rubygems_version: 3.2.3
|
|
69
70
|
signing_key:
|
|
70
71
|
specification_version: 4
|
|
71
|
-
summary:
|
|
72
|
+
summary: Add Beer CSS Framework to your Rails 7+ project.
|
|
72
73
|
test_files: []
|