bulma-turbo-themes 0.10.7 → 0.11.0

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.
@@ -1 +0,0 @@
1
- "use strict";const I={bulma:{name:"Bulma",description:"Classic Bulma themes"},catppuccin:{name:"Catppuccin",description:"Soothing pastel themes"},github:{name:"GitHub",description:"GitHub-inspired themes"},dracula:{name:"Dracula",description:"Dark vampire aesthetic"}},x=[{id:"bulma-light",name:"Light",description:"Classic Bulma look with a bright, neutral palette.",cssFile:"assets/css/themes/bulma-light.css",icon:"assets/img/bulma-logo.webp",iconFallback:"assets/img/bulma-logo.png",family:"bulma",appearance:"light",colors:{bg:"#ffffff",surface:"#f5f5f5",accent:"#00d1b2",text:"#363636"}},{id:"bulma-dark",name:"Dark",description:"Dark Bulma theme tuned for low-light reading.",cssFile:"assets/css/themes/bulma-dark.css",icon:"assets/img/bulma-logo.webp",iconFallback:"assets/img/bulma-logo.png",family:"bulma",appearance:"dark",colors:{bg:"#1a1a2e",surface:"#252540",accent:"#00d1b2",text:"#f5f5f5"}},{id:"catppuccin-latte",name:"Latte",description:"Light, soft Catppuccin palette for daytime use.",cssFile:"assets/css/themes/catppuccin-latte.css",icon:"assets/img/catppuccin-logo-latte.webp",iconFallback:"assets/img/catppuccin-logo-latte.png",family:"catppuccin",appearance:"light",colors:{bg:"#eff1f5",surface:"#e6e9ef",accent:"#8839ef",text:"#4c4f69"}},{id:"catppuccin-frappe",name:"Frapp\xE9",description:"Balanced dark Catppuccin theme for focused work.",cssFile:"assets/css/themes/catppuccin-frappe.css",icon:"assets/img/catppuccin-logo-latte.webp",iconFallback:"assets/img/catppuccin-logo-latte.png",family:"catppuccin",appearance:"dark",colors:{bg:"#303446",surface:"#414559",accent:"#ca9ee6",text:"#c6d0f5"}},{id:"catppuccin-macchiato",name:"Macchiato",description:"Deep, atmospheric Catppuccin variant with rich contrast.",cssFile:"assets/css/themes/catppuccin-macchiato.css",icon:"assets/img/catppuccin-logo-macchiato.webp",iconFallback:"assets/img/catppuccin-logo-macchiato.png",family:"catppuccin",appearance:"dark",colors:{bg:"#24273a",surface:"#363a4f",accent:"#c6a0f6",text:"#cad3f5"}},{id:"catppuccin-mocha",name:"Mocha",description:"Cozy, high-contrast Catppuccin theme for late-night sessions.",cssFile:"assets/css/themes/catppuccin-mocha.css",icon:"assets/img/catppuccin-logo-macchiato.webp",iconFallback:"assets/img/catppuccin-logo-macchiato.png",family:"catppuccin",appearance:"dark",colors:{bg:"#1e1e2e",surface:"#313244",accent:"#cba6f7",text:"#cdd6f4"}},{id:"dracula",name:"Classic",description:"Iconic Dracula dark theme with vibrant accents.",cssFile:"assets/css/themes/dracula.css",icon:"assets/img/dracula-logo.webp",iconFallback:"assets/img/dracula-logo.png",family:"dracula",appearance:"dark",colors:{bg:"#282a36",surface:"#44475a",accent:"#bd93f9",text:"#f8f8f2"}},{id:"github-light",name:"Light",description:"GitHub-inspired light theme suited for documentation and UI heavy pages.",cssFile:"assets/css/themes/github-light.css",icon:"assets/img/github-logo-light.webp",iconFallback:"assets/img/github-logo-light.png",family:"github",appearance:"light",colors:{bg:"#ffffff",surface:"#f6f8fa",accent:"#0969da",text:"#1f2328"}},{id:"github-dark",name:"Dark",description:"GitHub dark theme optimized for code-heavy views.",cssFile:"assets/css/themes/github-dark.css",icon:"assets/img/github-logo-dark.webp",iconFallback:"assets/img/github-logo-dark.png",family:"github",appearance:"dark",colors:{bg:"#0d1117",surface:"#161b22",accent:"#58a6ff",text:"#c9d1d9"}}],D="bulma-theme-flavor",T="catppuccin-mocha";let R=0;function G(e){const f=Array.from(e.classList);for(const n of f)if(n.startsWith("theme-"))return n.substring(6);return null}function q(e){const n=e.documentElement?.getAttribute("data-baseurl")||"";try{const t=new URL(n,"http://localhost");return t.origin==="http://localhost"?t.pathname.replace(/\/$/,""):""}catch{return""}}async function S(e,f){R++;const n=R,t=x.find(s=>s.id===f)||x.find(s=>s.id===T),m=q(e),c=e.getElementById("theme-flavor-trigger");c&&c.classList.add("is-loading");try{Array.from(e.documentElement.classList).forEach(h=>{h.startsWith("theme-")&&e.documentElement.classList.remove(h)}),e.documentElement.classList.add(`theme-${t.id}`);const u=`theme-${t.id}-css`;let r=e.getElementById(u);if(!r){r=e.createElement("link"),r.id=u,r.rel="stylesheet",r.type="text/css",r.setAttribute("data-theme-id",t.id);try{const h=m?`${window.location.origin}${m}/`:`${window.location.origin}/`,v=new URL(t.cssFile,h).pathname;r.href=v}catch{console.warn(`Invalid theme CSS path for ${t.id}`);return}e.head.appendChild(r);try{await new Promise((h,v)=>{const b=setTimeout(()=>{r.onload=null,r.onerror=null,v(new Error(`Theme ${t.id} load timeout`))},1e4);r.onload=()=>{clearTimeout(b),r.onload=null,r.onerror=null,h()},r.onerror=()=>{clearTimeout(b),r.onload=null,r.onerror=null,v(new Error(`Failed to load theme ${t.id}`))}})}catch(h){console.warn(`Theme CSS failed to load for ${t.id}:`,h)}}n===R&&e.querySelectorAll('link[id^="theme-"][id$="-css"]').forEach(v=>{const b=v.id.replace("theme-","").replace("-css","");b!==t.id&&b!=="base"&&v.remove()});const o=e.getElementById("theme-flavor-trigger-icon");if(o&&t.icon)try{const h=m?`${window.location.origin}${m}/`:`${window.location.origin}/`,v=new URL(t.icon,h).pathname;if(o.src=v,o.alt=`${I[t.family].name} ${t.name}`,o.title=`${I[t.family].name} ${t.name}`,t.iconFallback){const b=new URL(t.iconFallback,h).pathname;o.onerror=()=>{o.onerror=null,o.src=b}}}catch{console.warn(`Invalid theme icon path for ${t.id}`)}e.querySelectorAll("#theme-flavor-menu .dropdown-item.theme-item").forEach(h=>{h.getAttribute("data-theme-id")===t.id?(h.classList.add("is-active"),h.setAttribute("aria-checked","true")):(h.classList.remove("is-active"),h.setAttribute("aria-checked","false"))})}finally{c&&c.classList.remove("is-loading")}}export async function initTheme(e,f){const n=f.__INITIAL_THEME__,t=f.localStorage.getItem(D)||T;if(n&&n===t&&G(e.documentElement)===t){const c=`theme-${t}-css`;e.getElementById(c)||await S(e,t);return}await S(e,t)}export function initNavbar(e){const f=e.location.pathname,n=e.querySelectorAll(".navbar-item");let t=null;const m=new Set;if(n.forEach(s=>{const u=s;if(u.href)try{const r=new URL(u.href).pathname,o=f.replace(/\/$/,"")||"/",L=r.replace(/\/$/,"")||"/";m.add(s),o===L&&(t=s)}catch{}}),n.forEach(s=>{if(s!==t&&m.has(s)){s.classList.remove("is-active");const u=s;u&&"removeAttribute"in u&&typeof u.removeAttribute=="function"&&u.removeAttribute("aria-current")}}),t){t.classList.add("is-active");const s=t;s&&"setAttribute"in s&&typeof s.setAttribute=="function"&&s.setAttribute("aria-current","page")}const c=e.querySelector('[data-testid="nav-reports"]');if(c){const s=["/coverage","/playwright","/lighthouse"],u=f.replace(/\/$/,"")||"/";s.some(o=>u===o||u.startsWith(o+"/"))?c.classList.add("is-active"):c.classList.remove("is-active")}}typeof window<"u"&&(window.initNavbar=initNavbar);export function wireFlavorSelector(e,f){const n=new AbortController,t=e.getElementById("theme-flavor-menu"),m=e.getElementById("theme-flavor-trigger"),c=m?.closest(".navbar-item.has-dropdown"),s=e.getElementById("theme-flavor-select"),u=q(e);if(!t||!m||!c)return{cleanup:()=>{n.abort()}};let r=-1;const o=[],L=f.localStorage.getItem(D)||G(e.documentElement)||T;if(s){for(;s.firstChild;)s.removeChild(s.firstChild);x.forEach(a=>{const l=e.createElement("option");l.value=a.id,l.textContent=a.name,a.id===L&&(l.selected=!0),s.appendChild(l)}),s.disabled=!1,s.addEventListener("change",a=>{const i=a.target?.value||T;f.localStorage.setItem(D,i),S(e,i).catch(d=>{console.error(`Failed to apply theme ${i}:`,d)})},{signal:n.signal})}for(;t.firstChild;)t.removeChild(t.firstChild);const h=Object.keys(I);let v=0;h.forEach(a=>{const l=x.filter(p=>p.family===a);if(l.length===0)return;const i=I[a],d=e.createElement("div");d.className="theme-family-group",d.setAttribute("role","group"),d.setAttribute("aria-labelledby",`theme-family-${a}`),d.style&&typeof d.style.setProperty=="function"&&d.style.setProperty("--animation-delay",`${v}ms`),v+=30;const k=e.createElement("div");k.className="theme-family-header",k.id=`theme-family-${a}`;const N=e.createElement("span");N.className="theme-family-name",N.textContent=i.name,k.appendChild(N),d.appendChild(k);const B=e.createElement("div");B.className="theme-family-items",l.forEach(p=>{const g=e.createElement("button");g.type="button",g.className="dropdown-item theme-item",g.setAttribute("data-theme-id",p.id),g.setAttribute("data-appearance",p.appearance),g.setAttribute("role","menuitemradio"),g.setAttribute("aria-label",`${i.name} ${p.name} (${p.appearance}). ${p.description}`),g.setAttribute("tabindex","-1");const _=p.id===L;g.setAttribute("aria-checked",String(_)),_&&g.classList.add("is-active");const y=e.createElement("img");if(y.className="theme-icon",p.icon){const A=f.location.origin,C=u?`${A}${u}/${p.icon}`:`${A}/${p.icon}`;if(y.src=C,y.alt=`${i.name} ${p.name}`,p.iconFallback){const W=u?`${A}${u}/${p.iconFallback}`:`${A}/${p.iconFallback}`;y.onerror=()=>{y.onerror=null,y.src=W}}}y.width=24,y.height=24,y.loading="lazy",g.appendChild(y);const F=e.createElement("div");F.className="theme-copy";const U=e.createElement("span");U.className="theme-title",U.textContent=`${i.name} \xB7 ${p.name}`,F.appendChild(U);const M=e.createElement("span");M.className="theme-description",M.textContent=p.description,F.appendChild(M),g.appendChild(F);const H=e.createElement("span");H.className="theme-check";const E=e.createElementNS("http://www.w3.org/2000/svg","svg");E.setAttribute("width","16"),E.setAttribute("height","16"),E.setAttribute("viewBox","0 0 24 24"),E.setAttribute("fill","none"),E.setAttribute("stroke","currentColor"),E.setAttribute("stroke-width","3"),E.setAttribute("stroke-linecap","round"),E.setAttribute("stroke-linejoin","round");const z=e.createElementNS("http://www.w3.org/2000/svg","polyline");z.setAttribute("points","20 6 9 17 4 12"),E.appendChild(z),H.appendChild(E),g.appendChild(H),g.addEventListener("click",A=>{if(A.preventDefault(),f.localStorage.setItem(D,p.id),$({restoreFocus:!0}),s){s.value=p.id;const C=new Event("change",{bubbles:!0});s.dispatchEvent(C)}else S(e,p.id).catch(C=>{console.error(`Failed to apply theme ${p.id}:`,C)})}),o.push(g),B.appendChild(g)}),d.appendChild(B),t.appendChild(d)});const b=a=>{m&&m.setAttribute("aria-expanded",String(a))},w=a=>{if(a<0||a>=o.length)return;const l=o[a];o.forEach(i=>{i.setAttribute("tabindex","-1")}),l.setAttribute("tabindex","0"),l.focus(),r=a},$=(a={})=>{const{restoreFocus:l=!0}=a;c&&c.classList.remove("is-active"),b(!1),o.forEach(i=>{i.setAttribute("tabindex","-1")}),r=-1,l&&m&&m.focus()},P=(a=!1)=>{if(!c)return;const l=c.classList.toggle("is-active");b(l),l?a&&o.length>0&&w(0):(r=-1,o.forEach(i=>{if(i&&typeof i.setAttribute=="function"){i.setAttribute("tabindex","-1");const d=i.classList&&typeof i.classList.contains=="function"?i.classList.contains("is-active"):!1;i.setAttribute("aria-checked",String(d))}}))};return m&&m.addEventListener("click",a=>{a.preventDefault(),P()},{signal:n.signal}),e.addEventListener("click",a=>{c&&!c.contains(a.target)&&$({restoreFocus:!1})},{signal:n.signal}),e.addEventListener("keydown",a=>{a.key==="Escape"&&c&&c.classList.contains("is-active")&&$({restoreFocus:!0})},{signal:n.signal}),m&&m.addEventListener("keydown",a=>{if(!c)return;const l=a.key;if(l==="Enter"||l===" "){a.preventDefault();const i=c.classList.contains("is-active");P(!i)}else if(l==="ArrowDown")if(a.preventDefault(),!c.classList.contains("is-active"))c.classList.add("is-active"),b(!0),w(0);else if(r<0)w(0);else{const i=r<o.length-1?r+1:0;w(i)}else if(l==="ArrowUp")if(a.preventDefault(),!c.classList.contains("is-active"))c.classList.add("is-active"),b(!0),w(o.length-1);else{const i=r<0?o.length-1:r,d=i>0?i-1:o.length-1;w(d)}},{signal:n.signal}),o.forEach((a,l)=>{a.addEventListener("keydown",i=>{const d=i.key;if(d==="ArrowDown"){i.preventDefault();const k=l<o.length-1?l+1:0;w(k)}else if(d==="ArrowUp"){i.preventDefault();const k=l>0?l-1:o.length-1;w(k)}else d==="Escape"?(i.preventDefault(),$()):d==="Enter"||d===" "?(i.preventDefault(),a.click()):d==="Home"?(i.preventDefault(),w(0)):d==="End"&&(i.preventDefault(),w(o.length-1))},{signal:n.signal})}),b(!1),c&&c.classList.remove("is-active"),{cleanup:()=>{n.abort()}}}export function enhanceAccessibility(e){e.querySelectorAll(".highlight > pre").forEach(n=>{n.hasAttribute("tabindex")||n.setAttribute("tabindex","0"),n.hasAttribute("role")||n.setAttribute("role","region"),n.hasAttribute("aria-label")||n.setAttribute("aria-label","Code block")})}typeof document<"u"&&typeof window<"u"&&document.addEventListener("DOMContentLoaded",()=>{initTheme(document,window).then(()=>{const{cleanup:e}=wireFlavorSelector(document,window);enhanceAccessibility(document);const f=()=>{e(),window.removeEventListener("pagehide",f)};window.addEventListener("pagehide",f)}).catch(e=>{console.error("Theme switcher initialization failed:",e)})});
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module BulmaTurboThemes
4
- VERSION = "0.10.7"
5
- end
6
-