@gaine/core 0.0.1 → 0.1.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/dist/{chunk-CWFVLSJN.js → chunk-AB5MSEJ2.js} +1 -2
- package/dist/{chunk-P4PP32UI.js → chunk-VE6CL5DE.js} +1 -2
- package/dist/index.js +1 -2
- package/dist/speed/index.js +2 -3
- package/dist/speed/node.js +2 -3
- package/dist/tailwind/index.js +1 -2
- package/package.json +1 -1
- package/dist/chunk-CWFVLSJN.js.map +0 -1
- package/dist/chunk-P4PP32UI.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/speed/index.js.map +0 -1
- package/dist/speed/node.js.map +0 -1
- package/dist/tailwind/index.js.map +0 -1
|
@@ -1,2 +1 @@
|
|
|
1
|
-
var s=["/api/*","/_next/*","/assets/*"],a=["[rel~=nofollow]","[rel~=external]","[target=_blank]","[download]","[data-no-prefetch]"];function c(e="/"){let t=e.replace(/^\/+|\/+$/g,"");return t?`/${t}`:""}function i(e={}){let t=c(e.base),r=[{href_matches:`${t}/*`}],o=e.exclude??s.map(n=>`${t}${n}`);for(let n of o)r.push({not:{href_matches:n}});for(let n of e.excludeSelectors??a)r.push({not:{selector_matches:n}});return {[e.action??"prerender"]:[{where:{and:r},eagerness:e.eagerness??"moderate"}]}}function l(e={}){return JSON.stringify(i(e)).replace(/</g,"\\u003c")}export{c as a,i as b,l as c}
|
|
2
|
-
//# sourceMappingURL=chunk-CWFVLSJN.js.map
|
|
1
|
+
var s=["/api/*","/_next/*","/assets/*"],a=["[rel~=nofollow]","[rel~=external]","[target=_blank]","[download]","[data-no-prefetch]"];function c(e="/"){let t=e.replace(/^\/+|\/+$/g,"");return t?`/${t}`:""}function i(e={}){let t=c(e.base),r=[{href_matches:`${t}/*`}],o=e.exclude??s.map(n=>`${t}${n}`);for(let n of o)r.push({not:{href_matches:n}});for(let n of e.excludeSelectors??a)r.push({not:{selector_matches:n}});return {[e.action??"prerender"]:[{where:{and:r},eagerness:e.eagerness??"moderate"}]}}function l(e={}){return JSON.stringify(i(e)).replace(/</g,"\\u003c")}export{c as a,i as b,l as c};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
var c="theme",a=`(function(){try{var d=document.documentElement;d.classList.add("js");var t=localStorage.getItem("${c}");if(t==="dark"||(t!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches)){d.classList.add("dark");}}catch(e){}})();`;function s(){let e=document.documentElement,t=null;try{t=localStorage.getItem(c);}catch{}let o=t==="dark"||t!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches;e.classList.add("js"),e.classList.toggle("dark",o);}function r(){let e=document.documentElement,t=e.classList.contains("dark")?"light":"dark";e.classList.toggle("dark",t==="dark");try{localStorage.setItem(c,t);}catch{}}export{c as a,a as b,s as c,r as d}
|
|
2
|
-
//# sourceMappingURL=chunk-P4PP32UI.js.map
|
|
1
|
+
var c="theme",a=`(function(){try{var d=document.documentElement;d.classList.add("js");var t=localStorage.getItem("${c}");if(t==="dark"||(t!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches)){d.classList.add("dark");}}catch(e){}})();`;function s(){let e=document.documentElement,t=null;try{t=localStorage.getItem(c);}catch{}let o=t==="dark"||t!=="light"&&window.matchMedia("(prefers-color-scheme: dark)").matches;e.classList.add("js"),e.classList.toggle("dark",o);}function r(){let e=document.documentElement,t=e.classList.contains("dark")?"light":"dark";e.classList.toggle("dark",t==="dark");try{localStorage.setItem(c,t);}catch{}}export{c as a,a as b,s as c,r as d};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export{a as THEME_STORAGE_KEY,c as applyTheme,b as themeInitScript,d as toggleTheme}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export{a as THEME_STORAGE_KEY,c as applyTheme,b as themeInitScript,d as toggleTheme}from'./chunk-VE6CL5DE.js';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';function f(...e){return twMerge(clsx(e))}function L(e){let t=e.locales;return {locales:e.locales,defaultLocale:e.defaultLocale,localeLabels:e.labels,isLocale:r=>t.includes(r)}}function p(e,t,r){let o=t;for(let a of (e??"").split(",")){let l=a.trim().split(";")[0]?.toLowerCase().slice(0,2)??"";if(o.includes(l))return l}return r}function g(e=0,t="up"){return {"data-reveal":t,style:{"--reveal-delay":`${e}ms`}}}var v='(function(){var t=document.querySelectorAll("[data-reveal]:not(.is-visible)"),i;if(!("IntersectionObserver" in window)){for(i=0;i<t.length;i++)t[i].classList.add("is-visible");return}var o=new IntersectionObserver(function(e){for(var j=0;j<e.length;j++){if(!e[j].isIntersecting)continue;e[j].target.classList.add("is-visible");o.unobserve(e[j].target)}},{threshold:0.12,rootMargin:"0px 0px -6% 0px"});for(i=0;i<t.length;i++)o.observe(t[i])})();';export{f as cn,L as defineLocales,p as detectLocale,g as reveal,v as revealInitScript};
|
package/dist/speed/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {a as a$1}from'../chunk-
|
|
1
|
+
import {a as a$1}from'../chunk-VE6CL5DE.js';import {a}from'../chunk-AB5MSEJ2.js';export{a as normalizeBase,b as speculationRules,c as speculationRulesJson}from'../chunk-AB5MSEJ2.js';var u=e=>JSON.stringify(e).replace(/</g,"\\u003c"),w=e=>`var K=${u(e)},R=d.documentElement;function ap(){var s;try{s=localStorage.getItem(K)}catch(e){}R.classList.toggle("dark",s==="dark"||(s!=="light"&&w.matchMedia("(prefers-color-scheme: dark)").matches))}d.addEventListener("click",function(e){var t=e.target,b=t&&t.closest&&t.closest("[data-gaine-theme]");if(!b)return;var n=R.classList.contains("dark")?"light":"dark";R.classList.toggle("dark",n==="dark");try{localStorage.setItem(K,n)}catch(e){}});try{w.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",ap)}catch(e){}w.addEventListener("storage",ap);`,H='var S=new WeakSet,io,q=0;function sc(){q=0;var n=d.querySelectorAll("[data-reveal]:not(.is-visible)"),i,el;if(!("IntersectionObserver" in w)){for(i=0;i<n.length;i++)n[i].classList.add("is-visible");return}io=io||new IntersectionObserver(function(es){for(var j=0;j<es.length;j++){if(es[j].isIntersecting){es[j].target.classList.add("is-visible");io.unobserve(es[j].target)}}},{threshold:.12,rootMargin:"0px 0px -6% 0px"});for(i=0;i<n.length;i++){el=n[i];if(!S.has(el)){S.add(el);io.observe(el)}}}function sd(){if(!q){q=1;(w.requestAnimationFrame||setTimeout)(sc)}}sc();if(d.readyState==="loading")d.addEventListener("DOMContentLoaded",sc);if("MutationObserver" in w)new MutationObserver(function(ms){for(var i=0,j,a,x;i<ms.length;i++){a=ms[i].addedNodes;for(j=0;j<a.length;j++){x=a[j];if(x.nodeType===1&&(x.hasAttribute("data-reveal")||x.querySelector("[data-reveal]"))){sd();return}}}}).observe(d.documentElement,{childList:true,subtree:true});',L='function sm(m,o){var t=m.querySelector("[data-gaine-menu-trigger]"),c=m.querySelector("[data-gaine-menu-content]");if(!t||!c)return;c.hidden=!o;t.setAttribute("aria-expanded",o?"true":"false");t.setAttribute("data-state",o?"open":"closed")}d.addEventListener("click",function(e){var t=e.target,m=t&&t.closest&&t.closest("[data-gaine-menu]"),g=m&&t.closest("[data-gaine-menu-trigger]"),a=d.querySelectorAll("[data-gaine-menu]"),i,c;for(i=0;i<a.length;i++){c=a[i].querySelector("[data-gaine-menu-content]");if(a[i]===m&&g&&c)sm(a[i],c.hidden);else sm(a[i],false)}});d.addEventListener("keydown",function(e){if(e.key!=="Escape")return;var a=d.querySelectorAll("[data-gaine-menu]"),i,c;for(i=0;i<a.length;i++){c=a[i].querySelector("[data-gaine-menu-content]");if(c&&!c.hidden){sm(a[i],false);var t=a[i].querySelector("[data-gaine-menu-trigger]");if(t)t.focus()}}});',$=(e,t)=>`var LC=${u(e)},BS=${u(t)};d.addEventListener("click",function(e){var t=e.target,a=t&&t.closest&&t.closest("[data-gaine-locale]");if(!a||e.defaultPrevented||e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;var l=a.getAttribute("data-gaine-locale"),p=w.location.pathname,r=p;if(BS&&(p===BS||p.indexOf(BS+"/")===0))r=p.slice(BS.length)||"/";var s=r.split("/");if(LC.indexOf(s[1])>-1)s[1]=l;else s.splice(1,0,l);e.preventDefault();w.location.assign(BS+s.join("/")+w.location.search+w.location.hash)});`,R=(e,t)=>`var PD=${e},PF=${t?"true":"false"},PS={},PT;var NA=w.HTMLScriptElement&&HTMLScriptElement.supports&&HTMLScriptElement.supports("speculationrules");if(!(PF&&NA)){var pu=function(a){if(!a||!a.href||a.target==="_blank"||a.hasAttribute("download")||a.hasAttribute("data-no-prefetch"))return;var u;try{u=new URL(a.href)}catch(e){return}if(u.origin!==w.location.origin||(u.pathname===w.location.pathname&&u.search===w.location.search))return;u.hash="";return u.href};var pf=function(h){if(!h||PS[h])return;var c=navigator.connection;if(c&&(c.saveData||/2g/.test(c.effectiveType||"")))return;PS[h]=1;var l=d.createElement("link");if(l.relList&&l.relList.supports&&l.relList.supports("prefetch")){l.rel="prefetch";l.href=h;l.as="document";d.head.appendChild(l)}else if(w.fetch){w.fetch(h,{credentials:"same-origin",priority:"low"}).catch(function(){})}};var an=function(e){var t=e.target;return t&&t.closest&&t.closest("a[href]")};d.addEventListener("mouseover",function(e){var h=pu(an(e));if(!h)return;clearTimeout(PT);PT=setTimeout(function(){pf(h)},PD)},{passive:true});d.addEventListener("mouseout",function(){clearTimeout(PT)},{passive:true});d.addEventListener("touchstart",function(e){pf(pu(an(e)))},{passive:true})}`;function S(e={}){let t=[];return e.theme!==false&&t.push(w(a$1)),e.reveal!==false&&t.push(H),e.menu&&t.push(L),e.locales?.length&&t.push($(e.locales,a(e.base))),e.prefetch&&t.push(R(e.prefetch.delay??65,e.prefetch.fallbackOnly??false)),t.length?"(function(w,d){if(w.__gaine)return;w.__gaine=1;"+t.join("")+"})(window,document);":""}function E(e,t){if(/[\r\n<>"\s]/.test(e))throw new Error(`Gaine: invalid ${t}: ${JSON.stringify(e)}`)}function m(e,t="font/woff2"){return {rel:"preload",href:e,as:"font",type:t,crossorigin:"anonymous"}}function O(e){let t=[];for(let r of e.preconnect??[])t.push({rel:"preconnect",href:r,crossorigin:true});for(let r of e.dnsPrefetch??[])t.push({rel:"dns-prefetch",href:r});for(let r of e.fonts??[])t.push(m(r,k(r)));for(let r of e.styles??[])t.push({rel:"preload",href:r,as:"style"});for(let r of e.images??[])t.push({rel:"preload",href:r,as:"image",fetchpriority:"high"});return t}function k(e){let t=e.split(/[?#]/)[0]?.split(".").pop()?.toLowerCase();return t==="woff"?"font/woff":t==="ttf"?"font/ttf":t==="otf"?"font/otf":"font/woff2"}var M=e=>e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<");function p(e){E(e.href,"hint href");let t={rel:e.rel,href:e.href};return e.as&&(t.as=e.as),e.type&&(t.type=e.type),e.crossorigin&&(t.crossorigin=e.crossorigin===true?"":e.crossorigin),e.fetchpriority&&(t.fetchpriority=e.fetchpriority),e.media&&(t.media=e.media),t}function T(e){return e.map(t=>{let r=p(t);return `<link ${Object.entries(r).map(([s,a])=>a===""?s:`${s}="${M(a)}"`).join(" ")}>`}).join("")}function f(e){return e.map(t=>{let r=p(t),n=[`rel=${r.rel}`];return r.as&&n.push(`as=${r.as}`),r.type&&n.push(`type="${r.type}"`),r.crossorigin!==void 0&&n.push("crossorigin"),r.fetchpriority&&n.push(`fetchpriority=${r.fetchpriority}`),`<${r.href}>; ${n.join("; ")}`}).join(", ")}var y="public, max-age=31536000, immutable";function j(e={}){let t=a(e.base),r=[],n={};e.security!==false&&(n["X-Content-Type-Options"]="nosniff",n["Referrer-Policy"]="strict-origin-when-cross-origin"),e.preload?.length&&(n.Link=f(e.preload)),Object.keys(n).length&&r.push({path:`${t}/*`,headers:n});for(let s of e.immutable??[]){let a=s.replace(/^\/+|\/+$/g,"");r.push({path:`${t}/${a}/*`,headers:{"Cache-Control":y}});}return r}function A(e){return e.map(t=>`${t.path}
|
|
2
2
|
${Object.entries(t.headers).map(([r,n])=>` ${r}: ${n}`).join(`
|
|
3
3
|
`)}`).join(`
|
|
4
4
|
|
|
5
5
|
`)+`
|
|
6
6
|
`}function z(e){return e.map(t=>({source:t.path.replace(/\/\*$/,"/:path*"),headers:Object.entries(t.headers).map(([r,n])=>({key:r,value:n}))}))}var P=/<(script|style|textarea|pre)\b[\s\S]*?<\/\1\s*>|<!--[\s\S]*?-->/gi,C=/<img\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi,I=/<iframe\b(?:"[^"]*"|'[^']*'|[^'">])*>/gi,g=(e,t)=>new RegExp(`\\s${t}(?:\\s|=|/|>)`,"i").test(e.replace(/"[^"]*"|'[^']*'/g,'""')),b=(e,t)=>e.replace(/\s*\/?>$/,r=>` ${t}${r.trim()==="/>"?" />":">"}`);function q(e,t={}){let r=[],n=e.replace(P,i=>`\0G${r.push(i)-1}\0`),s=t.eagerImages??2,a=0;return t.lazyImages!==false&&(n=n.replace(C,i=>{a+=1;let c=[];return g(i,"decoding")||c.push('decoding="async"'),a>s&&!g(i,"loading")&&c.push('loading="lazy"'),c.length?b(i,c.join(" ")):i})),t.lazyIframes!==false&&(n=n.replace(I,i=>g(i,"loading")?i:b(i,'loading="lazy"'))),t.head&&(n=n.replace(/<\/head\s*>/i,()=>`${t.head}</head>`)),t.bodyEnd&&(n=n.replace(/<\/body\s*>/i,()=>`${t.bodyEnd}</body>`)),n.replace(/\u0000G(\d+)\u0000/g,(i,c)=>r[Number(c)]??"")}var o=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),d=(e,t)=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" class="${e}">${t}</svg>`,N=e=>d(e,'<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>'),B=e=>d(e,'<path d="M20 6 9 17l-5-5"/>'),_=e=>d(e,'<circle cx="12" cy="12" r="4"/><path d="M12 2v2"/><path d="M12 20v2"/><path d="m4.93 4.93 1.41 1.41"/><path d="m17.66 17.66 1.41 1.41"/><path d="M2 12h2"/><path d="M20 12h2"/><path d="m6.34 17.66-1.41 1.41"/><path d="m19.07 4.93-1.41 1.41"/>'),K=e=>d(e,'<path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"/>');function F(e){let t=o(e);return `<button type="button" data-gaine-theme aria-label="${t}" title="${t}" class="inline-flex size-9 items-center justify-center rounded-full border text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring">`+_("hidden size-4 dark:block")+K("size-4 dark:hidden")+"</button>"}function D(e){let t=(e.base??"/").replace(/^\/+|\/+$/g,""),r=t?`/${t}`:"",n=e.trailingSlash?"/":"",s=e.locales.map(a=>{let i=e.path?`${r}/${a}${e.path}`:`${r}/${a}${n}`;return `<a role="menuitem" lang="${o(a)}" href="${o(i)}" data-gaine-locale="${o(a)}" class="flex cursor-pointer select-none flex-row items-center justify-between rounded-xl px-3 py-2.5 text-sm no-underline text-popover-foreground outline-none transition-colors hover:bg-accent focus:bg-accent">`+o(e.labels[a]??a)+(a===e.locale?B("size-4 text-brand"):"")+"</a>"}).join("");return `<div data-gaine-menu class="relative inline-block"><button type="button" data-gaine-menu-trigger aria-label="${o(e.label)}" aria-haspopup="menu" aria-expanded="false" data-state="closed" class="inline-flex h-9 items-center gap-1.5 rounded-full border px-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent">`+N("size-3.5")+o(e.locale)+'</button><div role="menu" data-gaine-menu-content hidden class="absolute right-0 top-full z-50 mt-2.5 min-w-[11rem] overflow-hidden rounded-2xl border bg-popover p-2 text-popover-foreground shadow-xl shadow-black/5">'+s+"</div></div>"}
|
|
7
|
-
export{y as IMMUTABLE_CACHE,m as fontPreload,S as gaineRuntimeScript,p as hintAttrs,T as hintsToHtml,f as hintsToLinkHeader,q as optimizeHtml,D as renderLanguageMenu,F as renderThemeToggle,O as resourceHints,j as speedHeaders,A as toHeadersFile,z as toNextHeaders}
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
7
|
+
export{y as IMMUTABLE_CACHE,m as fontPreload,S as gaineRuntimeScript,p as hintAttrs,T as hintsToHtml,f as hintsToLinkHeader,q as optimizeHtml,D as renderLanguageMenu,F as renderThemeToggle,O as resourceHints,j as speedHeaders,A as toHeadersFile,z as toNextHeaders};
|
package/dist/speed/node.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
2
|
-
export{L as checkBudget,F as measureBuild}
|
|
3
|
-
//# sourceMappingURL=node.js.map
|
|
1
|
+
import {a}from'../chunk-AB5MSEJ2.js';import {readFile,readdir}from'fs/promises';import {relative,sep,join,posix}from'path';import {gzipSync}from'zlib';async function x(n,e=[]){for(let r of await readdir(n,{withFileTypes:true})){let s=join(n,r.name);r.isDirectory()?await x(s,e):e.push(s);}return e}var g=n=>gzipSync(n,{level:9}).length,y=(n,e)=>new RegExp(`\\s${e}=(?:"([^"]*)"|'([^']*)')`,"i").exec(n)?.slice(1).find(Boolean);async function F(n,e={}){let r=a(e.base),s=await x(n),u=new Map,d=async o=>{let t=u.get(o);return t===void 0&&(t=g(await readFile(o)),u.set(o,t)),t},S=o=>{let t=o.split(/[?#]/)[0]??"";if(/^(?:[a-z]+:)?\/\//i.test(t))return;let l=t.startsWith(r+"/")?t.slice(r.length):t;return join(n,...posix.normalize(l).split("/").filter(Boolean))},c=[];for(let o of s.filter(t=>t.endsWith(".html"))){let t=await readFile(o,"utf8"),l=new Set,f=0,p=0,h=0;for(let i of t.match(/<(?:script|link)\b[^>]*>/gi)??[]){let B=/^<script/i.test(i)?y(i,"src"):/rel=["']?(?:stylesheet|modulepreload)/i.test(i)?y(i,"href"):void 0,a=B&&S(B);!a||l.has(a)||!s.includes(a)||(l.add(a),a.endsWith(".css")?p+=await d(a):f+=await d(a));}for(let i of t.matchAll(/<(script|style)\b[^>]*>([\s\S]*?)<\/\1>/gi))i[2]&&!/\ssrc=/i.test(i[0])&&!/type=["']?(?:application\/(?:ld\+)?json|speculationrules)/i.test(i[0])&&(h+=g(i[2]));let m=g(t);c.push({page:"/"+relative(n,o).split(sep).join("/"),html:m,js:f,css:p,inline:h,total:m+f+p,files:[...l].map(i=>"/"+relative(n,i).split(sep).join("/"))});}return c.sort((o,t)=>t.total-o.total),{pages:c,worst:c[0]}}function L(n,e){let r=[];for(let s of n.pages)e.js!==void 0&&s.js>e.js&&r.push(`${s.page}: JS ${s.js} B > ${e.js} B (gzip)`),e.css!==void 0&&s.css>e.css&&r.push(`${s.page}: CSS ${s.css} B > ${e.css} B (gzip)`),e.total!==void 0&&s.total>e.total&&r.push(`${s.page}: total ${s.total} B > ${e.total} B (gzip)`);return r}
|
|
2
|
+
export{L as checkBudget,F as measureBuild};
|
package/dist/tailwind/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import i from'tailwindcss/plugin.js';import u from'tailwindcss-animate';var g={background:"0 0% 100%",foreground:"222 47% 9%",primary:"222 47% 11%","primary-foreground":"0 0% 100%",secondary:"220 14% 96%","secondary-foreground":"222 47% 11%",muted:"220 14% 96%","muted-foreground":"220 9% 38%",accent:"220 14% 95%","accent-foreground":"222 47% 11%",popover:"0 0% 100%","popover-foreground":"222 47% 9%",border:"220 13% 90%",input:"220 13% 90%",ring:"172 66% 36%",brand:"172 66% 38%","brand-foreground":"0 0% 100%"},c={background:"222 47% 6%",foreground:"210 40% 96%",primary:"210 40% 96%","primary-foreground":"222 47% 8%",secondary:"222 30% 12%","secondary-foreground":"210 40% 96%",muted:"222 30% 12%","muted-foreground":"215 18% 68%",accent:"222 30% 15%","accent-foreground":"210 40% 96%",popover:"222 40% 8%","popover-foreground":"210 40% 96%",border:"222 25% 18%",input:"222 25% 18%",ring:"172 66% 45%",brand:"172 66% 45%","brand-foreground":"222 47% 8%"};function a(r){let o={};for(let[e,n]of Object.entries(r))o[`--${e}`]=n;return o}var p=["./node_modules/@gaine/core/dist/**/*.js","./node_modules/@gaine/nextjs/dist/**/*.js","./node_modules/@gaine/vitepress/dist/**/*.js"];function m(r={}){let o={...g,...r.light},e={...c,...r.dark},n=r.radius??"0.875rem",s=i(({addBase:d,addUtilities:t})=>{d({":root":{...a(o),"--radius":n},".dark":{"color-scheme":"dark",...a(e)},"*":{"border-color":"hsl(var(--border))"},html:{"scroll-behavior":"smooth"},body:{"background-color":"hsl(var(--background))","font-family":"var(--font-sans), system-ui, sans-serif",color:"hsl(var(--foreground))","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"::selection":{background:"hsl(var(--brand) / 0.2)"},"@media (prefers-reduced-motion: reduce)":{html:{"scroll-behavior":"auto"},"*":{"animation-duration":"0.01ms !important","transition-duration":"0.01ms !important"}}}),t({".bg-dots":{"background-image":"radial-gradient(hsl(var(--foreground) / 0.18) 1px, transparent 1px)","background-size":"14px 14px"}});});return {darkMode:["class"],theme:{extend:{fontFamily:{sans:["var(--font-sans)","system-ui","sans-serif"],display:["var(--font-display)","var(--font-sans)","sans-serif"]},colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},brand:{DEFAULT:"hsl(var(--brand))",foreground:"hsl(var(--brand-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}}},plugins:[u,s]}}export{c as defaultDarkTokens,g as defaultLightTokens,p as gaineContent,m as gainePreset}
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import i from'tailwindcss/plugin.js';import u from'tailwindcss-animate';var g={background:"0 0% 100%",foreground:"222 47% 9%",primary:"222 47% 11%","primary-foreground":"0 0% 100%",secondary:"220 14% 96%","secondary-foreground":"222 47% 11%",muted:"220 14% 96%","muted-foreground":"220 9% 38%",accent:"220 14% 95%","accent-foreground":"222 47% 11%",popover:"0 0% 100%","popover-foreground":"222 47% 9%",border:"220 13% 90%",input:"220 13% 90%",ring:"172 66% 36%",brand:"172 66% 38%","brand-foreground":"0 0% 100%"},c={background:"222 47% 6%",foreground:"210 40% 96%",primary:"210 40% 96%","primary-foreground":"222 47% 8%",secondary:"222 30% 12%","secondary-foreground":"210 40% 96%",muted:"222 30% 12%","muted-foreground":"215 18% 68%",accent:"222 30% 15%","accent-foreground":"210 40% 96%",popover:"222 40% 8%","popover-foreground":"210 40% 96%",border:"222 25% 18%",input:"222 25% 18%",ring:"172 66% 45%",brand:"172 66% 45%","brand-foreground":"222 47% 8%"};function a(r){let o={};for(let[e,n]of Object.entries(r))o[`--${e}`]=n;return o}var p=["./node_modules/@gaine/core/dist/**/*.js","./node_modules/@gaine/nextjs/dist/**/*.js","./node_modules/@gaine/vitepress/dist/**/*.js"];function m(r={}){let o={...g,...r.light},e={...c,...r.dark},n=r.radius??"0.875rem",s=i(({addBase:d,addUtilities:t})=>{d({":root":{...a(o),"--radius":n},".dark":{"color-scheme":"dark",...a(e)},"*":{"border-color":"hsl(var(--border))"},html:{"scroll-behavior":"smooth"},body:{"background-color":"hsl(var(--background))","font-family":"var(--font-sans), system-ui, sans-serif",color:"hsl(var(--foreground))","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale"},"::selection":{background:"hsl(var(--brand) / 0.2)"},"@media (prefers-reduced-motion: reduce)":{html:{"scroll-behavior":"auto"},"*":{"animation-duration":"0.01ms !important","transition-duration":"0.01ms !important"}}}),t({".bg-dots":{"background-image":"radial-gradient(hsl(var(--foreground) / 0.18) 1px, transparent 1px)","background-size":"14px 14px"}});});return {darkMode:["class"],theme:{extend:{fontFamily:{sans:["var(--font-sans)","system-ui","sans-serif"],display:["var(--font-display)","var(--font-sans)","sans-serif"]},colors:{border:"hsl(var(--border))",input:"hsl(var(--input))",ring:"hsl(var(--ring))",background:"hsl(var(--background))",foreground:"hsl(var(--foreground))",primary:{DEFAULT:"hsl(var(--primary))",foreground:"hsl(var(--primary-foreground))"},secondary:{DEFAULT:"hsl(var(--secondary))",foreground:"hsl(var(--secondary-foreground))"},muted:{DEFAULT:"hsl(var(--muted))",foreground:"hsl(var(--muted-foreground))"},accent:{DEFAULT:"hsl(var(--accent))",foreground:"hsl(var(--accent-foreground))"},popover:{DEFAULT:"hsl(var(--popover))",foreground:"hsl(var(--popover-foreground))"},brand:{DEFAULT:"hsl(var(--brand))",foreground:"hsl(var(--brand-foreground))"}},borderRadius:{lg:"var(--radius)",md:"calc(var(--radius) - 2px)",sm:"calc(var(--radius) - 4px)"}}},plugins:[u,s]}}export{c as defaultDarkTokens,g as defaultLightTokens,p as gaineContent,m as gainePreset};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/speed/speculation.ts"],"names":["DEFAULT_EXCLUDE","DEFAULT_SELECTORS","normalizeBase","base","trimmed","speculationRules","options","and","exclude","p","pattern","selector","speculationRulesJson"],"mappings":"AAqCA,IAAMA,CAAAA,CAAkB,CAAC,QAAA,CAAU,UAAA,CAAY,WAAW,CAAA,CACpDC,CAAAA,CAAoB,CACxB,iBAAA,CACA,iBAAA,CACA,iBAAA,CACA,YAAA,CACA,oBACF,CAAA,CAEO,SAASC,CAAAA,CAAcC,CAAAA,CAAO,GAAA,CAAa,CAChD,IAAMC,CAAAA,CAAUD,CAAAA,CAAK,OAAA,CAAQ,YAAA,CAAc,EAAE,CAAA,CAC7C,OAAOC,CAAAA,CAAU,CAAA,CAAA,EAAIA,CAAO,CAAA,CAAA,CAAK,EACnC,CAEO,SAASC,CAAAA,CAAiBC,CAAAA,CAA8B,EAAC,CAAqB,CACnF,IAAMH,CAAAA,CAAOD,CAAAA,CAAcI,CAAAA,CAAQ,IAAI,CAAA,CACjCC,CAAAA,CAAmB,CAAC,CAAE,YAAA,CAAc,CAAA,EAAGJ,CAAI,CAAA,EAAA,CAAK,CAAC,CAAA,CACjDK,CAAAA,CAAUF,CAAAA,CAAQ,OAAA,EAAWN,CAAAA,CAAgB,GAAA,CAAKS,CAAAA,EAAM,CAAA,EAAGN,CAAI,CAAA,EAAGM,CAAC,CAAA,CAAE,CAAA,CAC3E,IAAA,IAAWC,CAAAA,IAAWF,CAAAA,CAASD,CAAAA,CAAI,IAAA,CAAK,CAAE,GAAA,CAAK,CAAE,YAAA,CAAcG,CAAQ,CAAE,CAAC,CAAA,CAC1E,IAAA,IAAWC,KAAYL,CAAAA,CAAQ,gBAAA,EAAoBL,CAAAA,CACjDM,CAAAA,CAAI,IAAA,CAAK,CAAE,GAAA,CAAK,CAAE,gBAAA,CAAkBI,CAAS,CAAE,CAAC,CAAA,CAElD,OAAO,CACL,CAACL,EAAQ,MAAA,EAAU,WAAW,EAAG,CAC/B,CAAE,KAAA,CAAO,CAAE,GAAA,CAAAC,CAAI,CAAA,CAAG,SAAA,CAAWD,CAAAA,CAAQ,SAAA,EAAa,UAAW,CAC/D,CACF,CACF,CAEO,SAASM,CAAAA,CAAqBN,CAAAA,CAA8B,EAAC,CAAW,CAC7E,OAAO,IAAA,CAAK,SAAA,CAAUD,CAAAA,CAAiBC,CAAO,CAAC,CAAA,CAAE,OAAA,CAAQ,IAAA,CAAM,SAAS,CAC1E","file":"chunk-CWFVLSJN.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type SpeculationEagerness = \"immediate\" | \"eager\" | \"moderate\" | \"conservative\";\n\nexport interface SpeculationOptions {\n action?: \"prefetch\" | \"prerender\";\n eagerness?: SpeculationEagerness;\n base?: string;\n exclude?: readonly string[];\n excludeSelectors?: readonly string[];\n}\n\ntype Condition =\n | { href_matches: string }\n | { selector_matches: string }\n | { not: Condition }\n | { and: Condition[] };\n\nexport type SpeculationRules = Record<\n string,\n Array<{ where: Condition; eagerness: SpeculationEagerness }>\n>;\n\nconst DEFAULT_EXCLUDE = [\"/api/*\", \"/_next/*\", \"/assets/*\"] as const;\nconst DEFAULT_SELECTORS = [\n \"[rel~=nofollow]\",\n \"[rel~=external]\",\n \"[target=_blank]\",\n \"[download]\",\n \"[data-no-prefetch]\",\n] as const;\n\nexport function normalizeBase(base = \"/\"): string {\n const trimmed = base.replace(/^\\/+|\\/+$/g, \"\");\n return trimmed ? `/${trimmed}` : \"\";\n}\n\nexport function speculationRules(options: SpeculationOptions = {}): SpeculationRules {\n const base = normalizeBase(options.base);\n const and: Condition[] = [{ href_matches: `${base}/*` }];\n const exclude = options.exclude ?? DEFAULT_EXCLUDE.map((p) => `${base}${p}`);\n for (const pattern of exclude) and.push({ not: { href_matches: pattern } });\n for (const selector of options.excludeSelectors ?? DEFAULT_SELECTORS) {\n and.push({ not: { selector_matches: selector } });\n }\n return {\n [options.action ?? \"prerender\"]: [\n { where: { and }, eagerness: options.eagerness ?? \"moderate\" },\n ],\n };\n}\n\nexport function speculationRulesJson(options: SpeculationOptions = {}): string {\n return JSON.stringify(speculationRules(options)).replace(/</g, \"\\\\u003c\");\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/theme/index.ts"],"names":["THEME_STORAGE_KEY","themeInitScript","applyTheme","root","stored","dark","toggleTheme","next"],"mappings":"AAgBO,IAAMA,EAAoB,OAAA,CAEpBC,CAAAA,CAAkB,CAAA,iGAAA,EAAoGD,CAAiB,wIAE7I,SAASE,CAAAA,EAAa,CAC3B,IAAMC,EAAO,QAAA,CAAS,eAAA,CAClBC,CAAAA,CAAwB,IAAA,CAC5B,GAAI,CACFA,CAAAA,CAAS,YAAA,CAAa,OAAA,CAAQJ,CAAiB,EACjD,CAAA,KAAQ,CAAC,CACT,IAAMK,CAAAA,CACJD,CAAAA,GAAW,MAAA,EACVA,CAAAA,GAAW,SAAW,MAAA,CAAO,UAAA,CAAW,8BAA8B,CAAA,CAAE,OAAA,CAC3ED,EAAK,SAAA,CAAU,GAAA,CAAI,IAAI,CAAA,CACvBA,EAAK,SAAA,CAAU,MAAA,CAAO,MAAA,CAAQE,CAAI,EACpC,CAEO,SAASC,CAAAA,EAAc,CAC5B,IAAMH,CAAAA,CAAO,QAAA,CAAS,gBAChBI,CAAAA,CAAOJ,CAAAA,CAAK,UAAU,QAAA,CAAS,MAAM,CAAA,CAAI,OAAA,CAAU,OACzDA,CAAAA,CAAK,SAAA,CAAU,MAAA,CAAO,MAAA,CAAQI,IAAS,MAAM,CAAA,CAC7C,GAAI,CACF,aAAa,OAAA,CAAQP,CAAAA,CAAmBO,CAAI,EAC9C,CAAA,KAAQ,CAAC,CACX","file":"chunk-P4PP32UI.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const THEME_STORAGE_KEY = \"theme\";\n\nexport const themeInitScript = `(function(){try{var d=document.documentElement;d.classList.add(\"js\");var t=localStorage.getItem(\"${THEME_STORAGE_KEY}\");if(t===\"dark\"||(t!==\"light\"&&window.matchMedia(\"(prefers-color-scheme: dark)\").matches)){d.classList.add(\"dark\");}}catch(e){}})();`;\n\nexport function applyTheme() {\n const root = document.documentElement;\n let stored: string | null = null;\n try {\n stored = localStorage.getItem(THEME_STORAGE_KEY);\n } catch {}\n const dark =\n stored === \"dark\" ||\n (stored !== \"light\" && window.matchMedia(\"(prefers-color-scheme: dark)\").matches);\n root.classList.add(\"js\");\n root.classList.toggle(\"dark\", dark);\n}\n\nexport function toggleTheme() {\n const root = document.documentElement;\n const next = root.classList.contains(\"dark\") ? \"light\" : \"dark\";\n root.classList.toggle(\"dark\", next === \"dark\");\n try {\n localStorage.setItem(THEME_STORAGE_KEY, next);\n } catch {}\n}\n"]}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/cn.ts","../src/i18n/index.ts","../src/reveal/index.ts"],"names":["cn","inputs","twMerge","clsx","defineLocales","input","list","value","detectLocale","acceptLanguage","locales","defaultLocale","part","code","reveal","delay","variant","revealInitScript"],"mappings":"2KAmBO,SAASA,CAAAA,CAAAA,GAAMC,CAAAA,CAAsB,CAC1C,OAAOC,QAAQC,IAAAA,CAAKF,CAAM,CAAC,CAC7B,CCEO,SAASG,EAAiDC,CAAAA,CAIxC,CACvB,IAAMC,CAAAA,CAAOD,CAAAA,CAAM,OAAA,CACnB,OAAO,CACL,OAAA,CAASA,CAAAA,CAAM,OAAA,CACf,aAAA,CAAeA,CAAAA,CAAM,cACrB,YAAA,CAAcA,CAAAA,CAAM,MAAA,CACpB,QAAA,CAAWE,CAAAA,EAAsCD,CAAAA,CAAK,SAASC,CAAK,CACtE,CACF,CAEO,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACG,CACH,IAAML,CAAAA,CAAOI,CAAAA,CACb,IAAA,IAAWE,MAASH,CAAAA,EAAkB,EAAA,EAAI,KAAA,CAAM,GAAG,CAAA,CAAG,CACpD,IAAMI,CAAAA,CAAOD,CAAAA,CAAK,IAAA,EAAK,CAAE,KAAA,CAAM,GAAG,EAAE,CAAC,CAAA,EAAG,WAAA,EAAY,CAAE,KAAA,CAAM,CAAA,CAAG,CAAC,CAAA,EAAK,EAAA,CACrE,GAAIN,CAAAA,CAAK,QAAA,CAASO,CAAI,CAAA,CAAG,OAAOA,CAClC,CACA,OAAOF,CACT,CC9BO,SAASG,EAAOC,CAAAA,CAAQ,CAAA,CAAGC,CAAAA,CAAyB,IAAA,CAAM,CAC/D,OAAO,CACL,aAAA,CAAeA,CAAAA,CACf,KAAA,CAAO,CAAE,gBAAA,CAAkB,CAAA,EAAGD,CAAK,CAAA,EAAA,CAAK,CAC1C,CACF,CAEO,IAAME,CAAAA,CAAmB","file":"index.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface LocaleKit<L extends string> {\n locales: readonly L[];\n defaultLocale: L;\n localeLabels: Record<L, string>;\n isLocale: (value: string) => value is L;\n}\n\nexport function defineLocales<const T extends readonly string[]>(input: {\n locales: T;\n defaultLocale: T[number];\n labels: Record<T[number], string>;\n}): LocaleKit<T[number]> {\n const list = input.locales as readonly string[];\n return {\n locales: input.locales,\n defaultLocale: input.defaultLocale,\n localeLabels: input.labels,\n isLocale: (value: string): value is T[number] => list.includes(value),\n };\n}\n\nexport function detectLocale<L extends string>(\n acceptLanguage: string | null | undefined,\n locales: readonly L[],\n defaultLocale: L,\n): L {\n const list = locales as readonly string[];\n for (const part of (acceptLanguage ?? \"\").split(\",\")) {\n const code = part.trim().split(\";\")[0]?.toLowerCase().slice(0, 2) ?? \"\";\n if (list.includes(code)) return code as L;\n }\n return defaultLocale;\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type RevealVariant = \"up\" | \"left\" | \"right\" | \"scale\" | \"fade\";\n\nexport function reveal(delay = 0, variant: RevealVariant = \"up\") {\n return {\n \"data-reveal\": variant,\n style: { \"--reveal-delay\": `${delay}ms` } as Record<string, string>,\n };\n}\n\nexport const revealInitScript = `(function(){var t=document.querySelectorAll(\"[data-reveal]:not(.is-visible)\"),i;if(!(\"IntersectionObserver\" in window)){for(i=0;i<t.length;i++)t[i].classList.add(\"is-visible\");return}var o=new IntersectionObserver(function(e){for(var j=0;j<e.length;j++){if(!e[j].isIntersecting)continue;e[j].target.classList.add(\"is-visible\");o.unobserve(e[j].target)}},{threshold:0.12,rootMargin:\"0px 0px -6% 0px\"});for(i=0;i<t.length;i++)o.observe(t[i])})();`;\n"]}
|
package/dist/speed/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/speed/runtime.ts","../../src/speed/hints.ts","../../src/speed/headers.ts","../../src/speed/html.ts","../../src/speed/menu.ts"],"names":["json","value","THEME","key","REVEAL","MENU","LOCALE","locales","base","PREFETCH","delay","fallbackOnly","gaineRuntimeScript","options","parts","THEME_STORAGE_KEY","normalizeBase","assertSafe","what","fontPreload","href","type","resourceHints","input","hints","fontType","ext","esc","s","hintAttrs","hint","attrs","hintsToHtml","k","v","hintsToLinkHeader","params","IMMUTABLE_CACHE","speedHeaders","rules","all","dir","clean","toHeadersFile","r","toNextHeaders","PROTECTED","IMG","IFRAME","hasAttr","tag","name","addAttrs","end","optimizeHtml","html","stash","out","m","eager","seen","add","_","i","svg","cls","body","GLOBE","c","CHECK","SUN","MOON","renderThemeToggle","label","l","renderLanguageMenu","o","prefix","tail","items"],"mappings":"sLA4BA,IAAMA,CAAAA,CAAQC,CAAAA,EAAmB,IAAA,CAAK,SAAA,CAAUA,CAAK,CAAA,CAAE,OAAA,CAAQ,IAAA,CAAM,SAAS,CAAA,CAExEC,CAAAA,CAASC,CAAAA,EACb,CAAA,MAAA,EAASH,EAAKG,CAAG,CAAC,CAAA,4iBAAA,CAAA,CAOdC,CAAAA,CACJ,k7BAAA,CAUIC,CAAAA,CACJ,+1BAAA,CAOIC,CAAAA,CAAS,CAACC,CAAAA,CAA4BC,CAAAA,GAC1C,CAAA,OAAA,EAAUR,CAAAA,CAAKO,CAAO,CAAC,CAAA,IAAA,EAAOP,CAAAA,CAAKQ,CAAI,CAAC,CAAA,meAAA,CAAA,CAQpCC,CAAAA,CAAW,CAACC,CAAAA,CAAeC,CAAAA,GAC/B,CAAA,OAAA,EAAUD,CAAK,OAAOC,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M,mBAAmB,CAAA,CAAI,IAC/C,MAEJ,CAAC,EACA,IAAA,CAAK,EAAE,EACV,OACE,CAAA,6GAAA,EAC6D1C,EAAIiD,CAAAA,CAAE,KAAK,CAAC,CAAA,yVAAA,CAAA,CACzET,CAAAA,CAAM,UAAU,CAAA,CAChBxC,CAAAA,CAAIiD,EAAE,MAAM,CAAA,CACZ,0NAAA,CAEAG,CAAAA,CACA,cAEJ","file":"index.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { THEME_STORAGE_KEY } from \"../theme/index.js\";\nimport { normalizeBase } from \"./speculation.js\";\n\nexport interface RuntimeOptions {\n theme?: boolean;\n reveal?: boolean;\n menu?: boolean;\n locales?: readonly string[];\n base?: string;\n prefetch?: false | { delay?: number; fallbackOnly?: boolean };\n}\n\nconst json = (value: unknown) => JSON.stringify(value).replace(/</g, \"\\\\u003c\");\n\nconst THEME = (key: string) =>\n `var K=${json(key)},R=d.documentElement;` +\n `function ap(){var s;try{s=localStorage.getItem(K)}catch(e){}R.classList.toggle(\"dark\",s===\"dark\"||(s!==\"light\"&&w.matchMedia(\"(prefers-color-scheme: dark)\").matches))}` +\n `d.addEventListener(\"click\",function(e){var t=e.target,b=t&&t.closest&&t.closest(\"[data-gaine-theme]\");if(!b)return;` +\n `var n=R.classList.contains(\"dark\")?\"light\":\"dark\";R.classList.toggle(\"dark\",n===\"dark\");try{localStorage.setItem(K,n)}catch(e){}});` +\n `try{w.matchMedia(\"(prefers-color-scheme: dark)\").addEventListener(\"change\",ap)}catch(e){}` +\n `w.addEventListener(\"storage\",ap);`;\n\nconst REVEAL =\n `var S=new WeakSet,io,q=0;` +\n `function sc(){q=0;var n=d.querySelectorAll(\"[data-reveal]:not(.is-visible)\"),i,el;` +\n `if(!(\"IntersectionObserver\" in w)){for(i=0;i<n.length;i++)n[i].classList.add(\"is-visible\");return}` +\n `io=io||new IntersectionObserver(function(es){for(var j=0;j<es.length;j++){if(es[j].isIntersecting){es[j].target.classList.add(\"is-visible\");io.unobserve(es[j].target)}}},{threshold:.12,rootMargin:\"0px 0px -6% 0px\"});` +\n `for(i=0;i<n.length;i++){el=n[i];if(!S.has(el)){S.add(el);io.observe(el)}}}` +\n `function sd(){if(!q){q=1;(w.requestAnimationFrame||setTimeout)(sc)}}` +\n `sc();if(d.readyState===\"loading\")d.addEventListener(\"DOMContentLoaded\",sc);` +\n `if(\"MutationObserver\" in w)new MutationObserver(function(ms){for(var i=0,j,a,x;i<ms.length;i++){a=ms[i].addedNodes;for(j=0;j<a.length;j++){x=a[j];` +\n `if(x.nodeType===1&&(x.hasAttribute(\"data-reveal\")||x.querySelector(\"[data-reveal]\"))){sd();return}}}}).observe(d.documentElement,{childList:true,subtree:true});`;\n\nconst MENU =\n `function sm(m,o){var t=m.querySelector(\"[data-gaine-menu-trigger]\"),c=m.querySelector(\"[data-gaine-menu-content]\");if(!t||!c)return;` +\n `c.hidden=!o;t.setAttribute(\"aria-expanded\",o?\"true\":\"false\");t.setAttribute(\"data-state\",o?\"open\":\"closed\")}` +\n `d.addEventListener(\"click\",function(e){var t=e.target,m=t&&t.closest&&t.closest(\"[data-gaine-menu]\"),g=m&&t.closest(\"[data-gaine-menu-trigger]\"),a=d.querySelectorAll(\"[data-gaine-menu]\"),i,c;` +\n `for(i=0;i<a.length;i++){c=a[i].querySelector(\"[data-gaine-menu-content]\");if(a[i]===m&&g&&c)sm(a[i],c.hidden);else sm(a[i],false)}});` +\n `d.addEventListener(\"keydown\",function(e){if(e.key!==\"Escape\")return;var a=d.querySelectorAll(\"[data-gaine-menu]\"),i,c;` +\n `for(i=0;i<a.length;i++){c=a[i].querySelector(\"[data-gaine-menu-content]\");if(c&&!c.hidden){sm(a[i],false);var t=a[i].querySelector(\"[data-gaine-menu-trigger]\");if(t)t.focus()}}});`;\n\nconst LOCALE = (locales: readonly string[], base: string) =>\n `var LC=${json(locales)},BS=${json(base)};` +\n `d.addEventListener(\"click\",function(e){var t=e.target,a=t&&t.closest&&t.closest(\"[data-gaine-locale]\");` +\n `if(!a||e.defaultPrevented||e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;` +\n `var l=a.getAttribute(\"data-gaine-locale\"),p=w.location.pathname,r=p;` +\n `if(BS&&(p===BS||p.indexOf(BS+\"/\")===0))r=p.slice(BS.length)||\"/\";` +\n `var s=r.split(\"/\");if(LC.indexOf(s[1])>-1)s[1]=l;else s.splice(1,0,l);` +\n `e.preventDefault();w.location.assign(BS+s.join(\"/\")+w.location.search+w.location.hash)});`;\n\nconst PREFETCH = (delay: number, fallbackOnly: boolean) =>\n `var PD=${delay},PF=${fallbackOnly ? \"true\" : \"false\"},PS={},PT;` +\n `var NA=w.HTMLScriptElement&&HTMLScriptElement.supports&&HTMLScriptElement.supports(\"speculationrules\");` +\n `if(!(PF&&NA)){` +\n `var pu=function(a){if(!a||!a.href||a.target===\"_blank\"||a.hasAttribute(\"download\")||a.hasAttribute(\"data-no-prefetch\"))return;var u;try{u=new URL(a.href)}catch(e){return}` +\n `if(u.origin!==w.location.origin||(u.pathname===w.location.pathname&&u.search===w.location.search))return;u.hash=\"\";return u.href};` +\n `var pf=function(h){if(!h||PS[h])return;var c=navigator.connection;if(c&&(c.saveData||/2g/.test(c.effectiveType||\"\")))return;PS[h]=1;var l=d.createElement(\"link\");` +\n `if(l.relList&&l.relList.supports&&l.relList.supports(\"prefetch\")){l.rel=\"prefetch\";l.href=h;l.as=\"document\";d.head.appendChild(l)}else if(w.fetch){w.fetch(h,{credentials:\"same-origin\",priority:\"low\"}).catch(function(){})}};` +\n `var an=function(e){var t=e.target;return t&&t.closest&&t.closest(\"a[href]\")};` +\n `d.addEventListener(\"mouseover\",function(e){var h=pu(an(e));if(!h)return;clearTimeout(PT);PT=setTimeout(function(){pf(h)},PD)},{passive:true});` +\n `d.addEventListener(\"mouseout\",function(){clearTimeout(PT)},{passive:true});` +\n `d.addEventListener(\"touchstart\",function(e){pf(pu(an(e)))},{passive:true})}`;\n\nexport function gaineRuntimeScript(options: RuntimeOptions = {}): string {\n const parts: string[] = [];\n if (options.theme !== false) parts.push(THEME(THEME_STORAGE_KEY));\n if (options.reveal !== false) parts.push(REVEAL);\n if (options.menu) parts.push(MENU);\n if (options.locales?.length) parts.push(LOCALE(options.locales, normalizeBase(options.base)));\n if (options.prefetch) {\n parts.push(PREFETCH(options.prefetch.delay ?? 65, options.prefetch.fallbackOnly ?? false));\n }\n if (!parts.length) return \"\";\n return (\n `(function(w,d){if(w.__gaine)return;w.__gaine=1;` + parts.join(\"\") + `})(window,document);`\n );\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface ResourceHint {\n rel: \"preload\" | \"preconnect\" | \"dns-prefetch\" | \"prefetch\" | \"modulepreload\";\n href: string;\n as?: \"font\" | \"style\" | \"script\" | \"image\" | \"fetch\" | \"document\";\n type?: string;\n crossorigin?: boolean | \"anonymous\" | \"use-credentials\";\n fetchpriority?: \"high\" | \"low\" | \"auto\";\n media?: string;\n}\n\nfunction assertSafe(value: string, what: string) {\n if (/[\\r\\n<>\"\\s]/.test(value))\n throw new Error(`Gaine: invalid ${what}: ${JSON.stringify(value)}`);\n}\n\nexport function fontPreload(href: string, type = \"font/woff2\"): ResourceHint {\n return { rel: \"preload\", href, as: \"font\", type, crossorigin: \"anonymous\" };\n}\n\nexport interface ResourceHintInput {\n preconnect?: readonly string[];\n dnsPrefetch?: readonly string[];\n fonts?: readonly string[];\n styles?: readonly string[];\n images?: readonly string[];\n}\n\nexport function resourceHints(input: ResourceHintInput): ResourceHint[] {\n const hints: ResourceHint[] = [];\n for (const href of input.preconnect ?? [])\n hints.push({ rel: \"preconnect\", href, crossorigin: true });\n for (const href of input.dnsPrefetch ?? []) hints.push({ rel: \"dns-prefetch\", href });\n for (const href of input.fonts ?? []) hints.push(fontPreload(href, fontType(href)));\n for (const href of input.styles ?? []) hints.push({ rel: \"preload\", href, as: \"style\" });\n for (const href of input.images ?? [])\n hints.push({ rel: \"preload\", href, as: \"image\", fetchpriority: \"high\" });\n return hints;\n}\n\nfunction fontType(href: string): string {\n const ext = href.split(/[?#]/)[0]?.split(\".\").pop()?.toLowerCase();\n return ext === \"woff\"\n ? \"font/woff\"\n : ext === \"ttf\"\n ? \"font/ttf\"\n : ext === \"otf\"\n ? \"font/otf\"\n : \"font/woff2\";\n}\n\nconst esc = (s: string) => s.replace(/&/g, \"&\").replace(/\"/g, \""\").replace(/</g, \"<\");\n\nexport function hintAttrs(hint: ResourceHint): Record<string, string> {\n assertSafe(hint.href, \"hint href\");\n const attrs: Record<string, string> = { rel: hint.rel, href: hint.href };\n if (hint.as) attrs.as = hint.as;\n if (hint.type) attrs.type = hint.type;\n if (hint.crossorigin) attrs.crossorigin = hint.crossorigin === true ? \"\" : hint.crossorigin;\n if (hint.fetchpriority) attrs.fetchpriority = hint.fetchpriority;\n if (hint.media) attrs.media = hint.media;\n return attrs;\n}\n\nexport function hintsToHtml(hints: readonly ResourceHint[]): string {\n return hints\n .map((hint) => {\n const attrs = hintAttrs(hint);\n const body = Object.entries(attrs)\n .map(([k, v]) => (v === \"\" ? k : `${k}=\"${esc(v)}\"`))\n .join(\" \");\n return `<link ${body}>`;\n })\n .join(\"\");\n}\n\nexport function hintsToLinkHeader(hints: readonly ResourceHint[]): string {\n return hints\n .map((hint) => {\n const attrs = hintAttrs(hint);\n const params = [`rel=${attrs.rel}`];\n if (attrs.as) params.push(`as=${attrs.as}`);\n if (attrs.type) params.push(`type=\"${attrs.type}\"`);\n if (attrs.crossorigin !== undefined) params.push(\"crossorigin\");\n if (attrs.fetchpriority) params.push(`fetchpriority=${attrs.fetchpriority}`);\n return `<${attrs.href}>; ${params.join(\"; \")}`;\n })\n .join(\", \");\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { normalizeBase } from \"./speculation.js\";\nimport { hintsToLinkHeader, type ResourceHint } from \"./hints.js\";\n\nexport interface HeaderRule {\n path: string;\n headers: Record<string, string>;\n}\n\nexport interface SpeedHeaderOptions {\n base?: string;\n immutable?: readonly string[];\n security?: boolean;\n preload?: readonly ResourceHint[];\n}\n\nexport const IMMUTABLE_CACHE = \"public, max-age=31536000, immutable\";\n\nexport function speedHeaders(options: SpeedHeaderOptions = {}): HeaderRule[] {\n const base = normalizeBase(options.base);\n const rules: HeaderRule[] = [];\n const all: Record<string, string> = {};\n if (options.security !== false) {\n all[\"X-Content-Type-Options\"] = \"nosniff\";\n all[\"Referrer-Policy\"] = \"strict-origin-when-cross-origin\";\n }\n if (options.preload?.length) all.Link = hintsToLinkHeader(options.preload);\n if (Object.keys(all).length) rules.push({ path: `${base}/*`, headers: all });\n for (const dir of options.immutable ?? []) {\n const clean = dir.replace(/^\\/+|\\/+$/g, \"\");\n rules.push({ path: `${base}/${clean}/*`, headers: { \"Cache-Control\": IMMUTABLE_CACHE } });\n }\n return rules;\n}\n\nexport function toHeadersFile(rules: readonly HeaderRule[]): string {\n return (\n rules\n .map(\n (r) =>\n `${r.path}\\n${Object.entries(r.headers)\n .map(([k, v]) => ` ${k}: ${v}`)\n .join(\"\\n\")}`,\n )\n .join(\"\\n\\n\") + \"\\n\"\n );\n}\n\nexport interface NextHeaderRule {\n source: string;\n headers: Array<{ key: string; value: string }>;\n}\n\nexport function toNextHeaders(rules: readonly HeaderRule[]): NextHeaderRule[] {\n return rules.map((r) => ({\n source: r.path.replace(/\\/\\*$/, \"/:path*\"),\n headers: Object.entries(r.headers).map(([key, value]) => ({ key, value })),\n }));\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface OptimizeHtmlOptions {\n eagerImages?: number;\n lazyImages?: boolean;\n lazyIframes?: boolean;\n head?: string;\n bodyEnd?: string;\n}\n\nconst PROTECTED = /<(script|style|textarea|pre)\\b[\\s\\S]*?<\\/\\1\\s*>|<!--[\\s\\S]*?-->/gi;\nconst IMG = /<img\\b(?:\"[^\"]*\"|'[^']*'|[^'\">])*>/gi;\nconst IFRAME = /<iframe\\b(?:\"[^\"]*\"|'[^']*'|[^'\">])*>/gi;\nconst hasAttr = (tag: string, name: string) =>\n new RegExp(`\\\\s${name}(?:\\\\s|=|/|>)`, \"i\").test(tag.replace(/\"[^\"]*\"|'[^']*'/g, '\"\"'));\nconst addAttrs = (tag: string, attrs: string) =>\n tag.replace(/\\s*\\/?>$/, (end) => ` ${attrs}${end.trim() === \"/>\" ? \" />\" : \">\"}`);\n\nexport function optimizeHtml(html: string, options: OptimizeHtmlOptions = {}): string {\n const stash: string[] = [];\n let out = html.replace(PROTECTED, (m) => `\\u0000G${stash.push(m) - 1}\\u0000`);\n\n const eager = options.eagerImages ?? 2;\n let seen = 0;\n if (options.lazyImages !== false) {\n out = out.replace(IMG, (tag) => {\n seen += 1;\n const add: string[] = [];\n if (!hasAttr(tag, \"decoding\")) add.push('decoding=\"async\"');\n if (seen > eager && !hasAttr(tag, \"loading\")) add.push('loading=\"lazy\"');\n return add.length ? addAttrs(tag, add.join(\" \")) : tag;\n });\n }\n if (options.lazyIframes !== false) {\n out = out.replace(IFRAME, (tag) =>\n hasAttr(tag, \"loading\") ? tag : addAttrs(tag, 'loading=\"lazy\"'),\n );\n }\n if (options.head) out = out.replace(/<\\/head\\s*>/i, () => `${options.head}</head>`);\n if (options.bodyEnd) out = out.replace(/<\\/body\\s*>/i, () => `${options.bodyEnd}</body>`);\n\n return out.replace(/\\u0000G(\\d+)\\u0000/g, (_, i: string) => stash[Number(i)] ?? \"\");\n}\n","/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst esc = (s: string) =>\n s.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\");\n\nconst svg = (cls: string, body: string) =>\n `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" class=\"${cls}\">${body}</svg>`;\n\nconst GLOBE = (c: string) =>\n svg(\n c,\n '<circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20\"/><path d=\"M2 12h20\"/>',\n );\nconst CHECK = (c: string) => svg(c, '<path d=\"M20 6 9 17l-5-5\"/>');\nconst SUN = (c: string) =>\n svg(\n c,\n '<circle cx=\"12\" cy=\"12\" r=\"4\"/><path d=\"M12 2v2\"/><path d=\"M12 20v2\"/><path d=\"m4.93 4.93 1.41 1.41\"/><path d=\"m17.66 17.66 1.41 1.41\"/><path d=\"M2 12h2\"/><path d=\"M20 12h2\"/><path d=\"m6.34 17.66-1.41 1.41\"/><path d=\"m19.07 4.93-1.41 1.41\"/>',\n );\nconst MOON = (c: string) => svg(c, '<path d=\"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z\"/>');\n\nexport function renderThemeToggle(label: string): string {\n const l = esc(label);\n return (\n `<button type=\"button\" data-gaine-theme aria-label=\"${l}\" title=\"${l}\" class=\"inline-flex size-9 items-center justify-center rounded-full border text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\">` +\n SUN(\"hidden size-4 dark:block\") +\n MOON(\"size-4 dark:hidden\") +\n `</button>`\n );\n}\n\nexport interface LanguageMenuOptions<L extends string> {\n locale: L;\n label: string;\n locales: readonly L[];\n labels: Record<L, string>;\n base?: string;\n trailingSlash?: boolean;\n path?: string;\n}\n\nexport function renderLanguageMenu<L extends string>(o: LanguageMenuOptions<L>): string {\n const base = (o.base ?? \"/\").replace(/^\\/+|\\/+$/g, \"\");\n const prefix = base ? `/${base}` : \"\";\n const tail = o.trailingSlash ? \"/\" : \"\";\n const items = o.locales\n .map((l) => {\n const href = o.path ? `${prefix}/${l}${o.path}` : `${prefix}/${l}${tail}`;\n return (\n `<a role=\"menuitem\" lang=\"${esc(l)}\" href=\"${esc(href)}\" data-gaine-locale=\"${esc(l)}\" class=\"flex cursor-pointer select-none flex-row items-center justify-between rounded-xl px-3 py-2.5 text-sm no-underline text-popover-foreground outline-none transition-colors hover:bg-accent focus:bg-accent\">` +\n esc(o.labels[l] ?? l) +\n (l === o.locale ? CHECK(\"size-4 text-brand\") : \"\") +\n `</a>`\n );\n })\n .join(\"\");\n return (\n `<div data-gaine-menu class=\"relative inline-block\">` +\n `<button type=\"button\" data-gaine-menu-trigger aria-label=\"${esc(o.label)}\" aria-haspopup=\"menu\" aria-expanded=\"false\" data-state=\"closed\" class=\"inline-flex h-9 items-center gap-1.5 rounded-full border px-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent\">` +\n GLOBE(\"size-3.5\") +\n esc(o.locale) +\n `</button>` +\n `<div role=\"menu\" data-gaine-menu-content hidden class=\"absolute right-0 top-full z-50 mt-2.5 min-w-[11rem] overflow-hidden rounded-2xl border bg-popover p-2 text-popover-foreground shadow-xl shadow-black/5\">` +\n items +\n `</div></div>`\n );\n}\n"]}
|
package/dist/speed/node.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/speed/node.ts"],"names":["walk","dir","out","entry","readdir","full","join","gz","buf","gzipSync","ATTR","tag","name","measureBuild","outDir","options","base","normalizeBase","files","cache","sizeOf","abs","size","readFile","resolveAsset","url","path","clean","posix","pages","file","f","html","used","js","css","inline","m","htmlSize","relative","sep","u","a","b","checkBudget","report","limits","problems","p"],"mappings":"uJA0CA,eAAeA,CAAAA,CAAKC,CAAAA,CAAaC,CAAAA,CAAgB,EAAC,CAAsB,CACtE,QAAWC,CAAAA,IAAS,MAAMC,OAAAA,CAAQH,CAAAA,CAAK,CAAE,aAAA,CAAe,IAAK,CAAC,CAAA,CAAG,CAC/D,IAAMI,CAAAA,CAAOC,IAAAA,CAAKL,EAAKE,CAAAA,CAAM,IAAI,CAAA,CAC7BA,CAAAA,CAAM,WAAA,EAAY,CAAG,MAAMH,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,CAAAA,CAAE,EAAA,CAAKF,EAAO,EAAA,EAC3CC,CAAAA,CAAS,IAAA,CAAK,CAAA,EAAGC,CAAAA,CAAE,IAAI,QAAQA,CAAAA,CAAE,EAAE,CAAA,KAAA,EAAQF,CAAAA,CAAO,EAAE,CAAA,SAAA,CAAW,EAC7DA,CAAAA,CAAO,GAAA,GAAQ,MAAA,EAAaE,CAAAA,CAAE,GAAA,CAAMF,CAAAA,CAAO,GAAA,EAC7CC,CAAAA,CAAS,IAAA,CAAK,CAAA,EAAGC,CAAAA,CAAE,IAAI,CAAA,MAAA,EAASA,CAAAA,CAAE,GAAG,CAAA,KAAA,EAAQF,CAAAA,CAAO,GAAG,CAAA,SAAA,CAAW,CAAA,CAChEA,CAAAA,CAAO,QAAU,MAAA,EAAaE,CAAAA,CAAE,KAAA,CAAQF,CAAAA,CAAO,KAAA,EACjDC,CAAAA,CAAS,KAAK,CAAA,EAAGC,CAAAA,CAAE,IAAI,CAAA,QAAA,EAAWA,CAAAA,CAAE,KAAK,CAAA,KAAA,EAAQF,CAAAA,CAAO,KAAK,CAAA,SAAA,CAAW,CAAA,CAE5E,OAAOC,CACT","file":"node.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readdir, readFile } from \"node:fs/promises\";\nimport { join, posix, relative, sep } from \"node:path\";\nimport { gzipSync } from \"node:zlib\";\nimport { normalizeBase } from \"./speculation.js\";\n\nexport interface PageWeight {\n page: string;\n html: number;\n js: number;\n css: number;\n inline: number;\n total: number;\n files: string[];\n}\n\nexport interface BudgetLimits {\n js?: number;\n css?: number;\n total?: number;\n}\n\nexport interface BuildReport {\n pages: PageWeight[];\n worst: PageWeight | undefined;\n}\n\nasync function walk(dir: string, out: string[] = []): Promise<string[]> {\n for (const entry of await readdir(dir, { withFileTypes: true })) {\n const full = join(dir, entry.name);\n if (entry.isDirectory()) await walk(full, out);\n else out.push(full);\n }\n return out;\n}\n\nconst gz = (buf: Buffer | string) => gzipSync(buf, { level: 9 }).length;\nconst ATTR = (tag: string, name: string) =>\n new RegExp(`\\\\s${name}=(?:\"([^\"]*)\"|'([^']*)')`, \"i\").exec(tag)?.slice(1).find(Boolean);\n\nexport async function measureBuild(\n outDir: string,\n options: { base?: string } = {},\n): Promise<BuildReport> {\n const base = normalizeBase(options.base);\n const files = await walk(outDir);\n const cache = new Map<string, number>();\n const sizeOf = async (abs: string) => {\n let size = cache.get(abs);\n if (size === undefined) {\n size = gz(await readFile(abs));\n cache.set(abs, size);\n }\n return size;\n };\n const resolveAsset = (url: string): string | undefined => {\n const path = url.split(/[?#]/)[0] ?? \"\";\n if (/^(?:[a-z]+:)?\\/\\//i.test(path)) return undefined;\n const clean = path.startsWith(base + \"/\") ? path.slice(base.length) : path;\n return join(outDir, ...posix.normalize(clean).split(\"/\").filter(Boolean));\n };\n\n const pages: PageWeight[] = [];\n for (const file of files.filter((f) => f.endsWith(\".html\"))) {\n const html = await readFile(file, \"utf8\");\n const used = new Set<string>();\n let js = 0;\n let css = 0;\n let inline = 0;\n for (const tag of html.match(/<(?:script|link)\\b[^>]*>/gi) ?? []) {\n const url = /^<script/i.test(tag)\n ? ATTR(tag, \"src\")\n : /rel=[\"']?(?:stylesheet|modulepreload)/i.test(tag)\n ? ATTR(tag, \"href\")\n : undefined;\n const abs = url && resolveAsset(url);\n if (!abs || used.has(abs) || !files.includes(abs)) continue;\n used.add(abs);\n if (abs.endsWith(\".css\")) css += await sizeOf(abs);\n else js += await sizeOf(abs);\n }\n for (const m of html.matchAll(/<(script|style)\\b[^>]*>([\\s\\S]*?)<\\/\\1>/gi)) {\n if (\n m[2] &&\n !/\\ssrc=/i.test(m[0]) &&\n !/type=[\"']?(?:application\\/(?:ld\\+)?json|speculationrules)/i.test(m[0])\n ) {\n inline += gz(m[2]);\n }\n }\n const htmlSize = gz(html);\n pages.push({\n page: \"/\" + relative(outDir, file).split(sep).join(\"/\"),\n html: htmlSize,\n js,\n css,\n inline,\n total: htmlSize + js + css,\n files: [...used].map((u) => \"/\" + relative(outDir, u).split(sep).join(\"/\")),\n });\n }\n pages.sort((a, b) => b.total - a.total);\n return { pages, worst: pages[0] };\n}\n\nexport function checkBudget(report: BuildReport, limits: BudgetLimits): string[] {\n const problems: string[] = [];\n for (const p of report.pages) {\n if (limits.js !== undefined && p.js > limits.js)\n problems.push(`${p.page}: JS ${p.js} B > ${limits.js} B (gzip)`);\n if (limits.css !== undefined && p.css > limits.css)\n problems.push(`${p.page}: CSS ${p.css} B > ${limits.css} B (gzip)`);\n if (limits.total !== undefined && p.total > limits.total)\n problems.push(`${p.page}: total ${p.total} B > ${limits.total} B (gzip)`);\n }\n return problems;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/tailwind/index.ts"],"names":["defaultLightTokens","defaultDarkTokens","toCssVars","tokens","vars","name","value","gaineContent","gainePreset","options","light","dark","radius","base","plugin","addBase","addUtilities","animate"],"mappings":"4EA+CaA,CAAAA,CAAkC,CAC7C,UAAA,CAAY,WAAA,CACZ,WAAY,YAAA,CACZ,OAAA,CAAS,aAAA,CACT,oBAAA,CAAsB,YACtB,SAAA,CAAW,aAAA,CACX,sBAAA,CAAwB,aAAA,CACxB,MAAO,aAAA,CACP,kBAAA,CAAoB,YAAA,CACpB,MAAA,CAAQ,cACR,mBAAA,CAAqB,aAAA,CACrB,OAAA,CAAS,WAAA,CACT,qBAAsB,YAAA,CACtB,MAAA,CAAQ,cACR,KAAA,CAAO,aAAA,CACP,KAAM,aAAA,CACN,KAAA,CAAO,aAAA,CACP,kBAAA,CAAoB,WAC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Y,8BACd,CACF,EACA,YAAA,CAAc,CACZ,EAAA,CAAI,eAAA,CACJ,GAAI,2BAAA,CACJ,EAAA,CAAI,2BACN,CACF,CACF,CAAA,CACA,OAAA,CAAS,CAACC,CAAAA,CAASJ,CAAI,CACzB,CACF","file":"index.js","sourcesContent":["/*\n * Copyright 2026 SoTeen Studio\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Config } from \"tailwindcss\";\nimport plugin from \"tailwindcss/plugin.js\";\nimport animate from \"tailwindcss-animate\";\n\nexport type GaineToken =\n | \"background\"\n | \"foreground\"\n | \"primary\"\n | \"primary-foreground\"\n | \"secondary\"\n | \"secondary-foreground\"\n | \"muted\"\n | \"muted-foreground\"\n | \"accent\"\n | \"accent-foreground\"\n | \"popover\"\n | \"popover-foreground\"\n | \"border\"\n | \"input\"\n | \"ring\"\n | \"brand\"\n | \"brand-foreground\";\n\nexport type GaineTokens = Record<GaineToken, string>;\n\nexport interface GainePresetOptions {\n light?: Partial<GaineTokens>;\n dark?: Partial<GaineTokens>;\n radius?: string;\n}\n\nexport const defaultLightTokens: GaineTokens = {\n background: \"0 0% 100%\",\n foreground: \"222 47% 9%\",\n primary: \"222 47% 11%\",\n \"primary-foreground\": \"0 0% 100%\",\n secondary: \"220 14% 96%\",\n \"secondary-foreground\": \"222 47% 11%\",\n muted: \"220 14% 96%\",\n \"muted-foreground\": \"220 9% 38%\",\n accent: \"220 14% 95%\",\n \"accent-foreground\": \"222 47% 11%\",\n popover: \"0 0% 100%\",\n \"popover-foreground\": \"222 47% 9%\",\n border: \"220 13% 90%\",\n input: \"220 13% 90%\",\n ring: \"172 66% 36%\",\n brand: \"172 66% 38%\",\n \"brand-foreground\": \"0 0% 100%\",\n};\n\nexport const defaultDarkTokens: GaineTokens = {\n background: \"222 47% 6%\",\n foreground: \"210 40% 96%\",\n primary: \"210 40% 96%\",\n \"primary-foreground\": \"222 47% 8%\",\n secondary: \"222 30% 12%\",\n \"secondary-foreground\": \"210 40% 96%\",\n muted: \"222 30% 12%\",\n \"muted-foreground\": \"215 18% 68%\",\n accent: \"222 30% 15%\",\n \"accent-foreground\": \"210 40% 96%\",\n popover: \"222 40% 8%\",\n \"popover-foreground\": \"210 40% 96%\",\n border: \"222 25% 18%\",\n input: \"222 25% 18%\",\n ring: \"172 66% 45%\",\n brand: \"172 66% 45%\",\n \"brand-foreground\": \"222 47% 8%\",\n};\n\nfunction toCssVars(tokens: GaineTokens): Record<string, string> {\n const vars: Record<string, string> = {};\n for (const [name, value] of Object.entries(tokens)) vars[`--${name}`] = value;\n return vars;\n}\n\nexport const gaineContent = [\n \"./node_modules/@gaine/core/dist/**/*.js\",\n \"./node_modules/@gaine/nextjs/dist/**/*.js\",\n \"./node_modules/@gaine/vitepress/dist/**/*.js\",\n];\n\nexport function gainePreset(options: GainePresetOptions = {}): Partial<Config> {\n const light = { ...defaultLightTokens, ...options.light };\n const dark = { ...defaultDarkTokens, ...options.dark };\n const radius = options.radius ?? \"0.875rem\";\n\n const base = plugin(({ addBase, addUtilities }) => {\n addBase({\n \":root\": { ...toCssVars(light), \"--radius\": radius },\n \".dark\": { \"color-scheme\": \"dark\", ...toCssVars(dark) },\n \"*\": { \"border-color\": \"hsl(var(--border))\" },\n html: { \"scroll-behavior\": \"smooth\" },\n body: {\n \"background-color\": \"hsl(var(--background))\",\n \"font-family\": \"var(--font-sans), system-ui, sans-serif\",\n color: \"hsl(var(--foreground))\",\n \"-webkit-font-smoothing\": \"antialiased\",\n \"-moz-osx-font-smoothing\": \"grayscale\",\n },\n \"::selection\": { background: \"hsl(var(--brand) / 0.2)\" },\n \"@media (prefers-reduced-motion: reduce)\": {\n html: { \"scroll-behavior\": \"auto\" },\n \"*\": {\n \"animation-duration\": \"0.01ms !important\",\n \"transition-duration\": \"0.01ms !important\",\n },\n },\n });\n addUtilities({\n \".bg-dots\": {\n \"background-image\": \"radial-gradient(hsl(var(--foreground) / 0.18) 1px, transparent 1px)\",\n \"background-size\": \"14px 14px\",\n },\n });\n });\n\n return {\n darkMode: [\"class\"],\n theme: {\n extend: {\n fontFamily: {\n sans: [\"var(--font-sans)\", \"system-ui\", \"sans-serif\"],\n display: [\"var(--font-display)\", \"var(--font-sans)\", \"sans-serif\"],\n },\n colors: {\n border: \"hsl(var(--border))\",\n input: \"hsl(var(--input))\",\n ring: \"hsl(var(--ring))\",\n background: \"hsl(var(--background))\",\n foreground: \"hsl(var(--foreground))\",\n primary: {\n DEFAULT: \"hsl(var(--primary))\",\n foreground: \"hsl(var(--primary-foreground))\",\n },\n secondary: {\n DEFAULT: \"hsl(var(--secondary))\",\n foreground: \"hsl(var(--secondary-foreground))\",\n },\n muted: {\n DEFAULT: \"hsl(var(--muted))\",\n foreground: \"hsl(var(--muted-foreground))\",\n },\n accent: {\n DEFAULT: \"hsl(var(--accent))\",\n foreground: \"hsl(var(--accent-foreground))\",\n },\n popover: {\n DEFAULT: \"hsl(var(--popover))\",\n foreground: \"hsl(var(--popover-foreground))\",\n },\n brand: {\n DEFAULT: \"hsl(var(--brand))\",\n foreground: \"hsl(var(--brand-foreground))\",\n },\n },\n borderRadius: {\n lg: \"var(--radius)\",\n md: \"calc(var(--radius) - 2px)\",\n sm: \"calc(var(--radius) - 4px)\",\n },\n },\n },\n plugins: [animate, base],\n };\n}\n"]}
|