@stacksjs/components 0.2.346 → 0.2.347

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/index.js CHANGED
@@ -13,7 +13,7 @@ ${n.join(`
13
13
  ${Object.entries(t).map(([a,i])=>{let n=Object.entries(i).map(([r,c])=>`${r}: ${c};`).join(" ");return`${a} { ${n} }`}).join(`
14
14
  `)}
15
15
  }
16
- `,o=document.createElement("style");o.textContent=s,document.head.appendChild(o)}function si(e,t,s={}){if(typeof e.animate!=="function")return console.warn("Web Animations API not supported"),null;let{duration:o=1000,easing:a="ease",delay:i=0,iterations:n=1,direction:r="normal",fill:c="both"}=s;return e.animate([...t],{duration:o,easing:a,delay:i,iterations:n,direction:r,fill:c})}var oi={fadeIn:[{offset:0,opacity:0},{offset:1,opacity:1}],fadeOut:[{offset:0,opacity:1},{offset:1,opacity:0}],slideInUp:[{offset:0,transform:"translateY(100%)",opacity:0},{offset:1,transform:"translateY(0)",opacity:1}],slideInDown:[{offset:0,transform:"translateY(-100%)",opacity:0},{offset:1,transform:"translateY(0)",opacity:1}],slideInLeft:[{offset:0,transform:"translateX(-100%)",opacity:0},{offset:1,transform:"translateX(0)",opacity:1}],slideInRight:[{offset:0,transform:"translateX(100%)",opacity:0},{offset:1,transform:"translateX(0)",opacity:1}],slideOutUp:[{offset:0,transform:"translateY(0)",opacity:1},{offset:1,transform:"translateY(-100%)",opacity:0}],slideOutDown:[{offset:0,transform:"translateY(0)",opacity:1},{offset:1,transform:"translateY(100%)",opacity:0}],slideOutLeft:[{offset:0,transform:"translateX(0)",opacity:1},{offset:1,transform:"translateX(-100%)",opacity:0}],slideOutRight:[{offset:0,transform:"translateX(0)",opacity:1},{offset:1,transform:"translateX(100%)",opacity:0}],zoomIn:[{offset:0,transform:"scale(0)",opacity:0},{offset:0.5,opacity:1},{offset:1,transform:"scale(1)"}],zoomOut:[{offset:0,transform:"scale(1)",opacity:1},{offset:0.5,opacity:1},{offset:1,transform:"scale(0)",opacity:0}],rotate:[{offset:0,transform:"rotate(0deg)"},{offset:1,transform:"rotate(360deg)"}],bounce:[{offset:0,transform:"translateY(0)"},{offset:0.2,transform:"translateY(0)"},{offset:0.4,transform:"translateY(-30px)"},{offset:0.43,transform:"translateY(-30px)"},{offset:0.53,transform:"translateY(0)"},{offset:0.7,transform:"translateY(-15px)"},{offset:0.8,transform:"translateY(0)"},{offset:0.9,transform:"translateY(-4px)"},{offset:1,transform:"translateY(0)"}],pulse:[{offset:0,transform:"scale(1)"},{offset:0.5,transform:"scale(1.05)"},{offset:1,transform:"scale(1)"}],shake:[{offset:0,transform:"translateX(0)"},{offset:0.1,transform:"translateX(-10px)"},{offset:0.2,transform:"translateX(10px)"},{offset:0.3,transform:"translateX(-10px)"},{offset:0.4,transform:"translateX(10px)"},{offset:0.5,transform:"translateX(-10px)"},{offset:0.6,transform:"translateX(10px)"},{offset:0.7,transform:"translateX(-10px)"},{offset:0.8,transform:"translateX(10px)"},{offset:0.9,transform:"translateX(-10px)"},{offset:1,transform:"translateX(0)"}],swing:[{offset:0,transform:"rotate(0deg)"},{offset:0.2,transform:"rotate(15deg)"},{offset:0.4,transform:"rotate(-10deg)"},{offset:0.6,transform:"rotate(5deg)"},{offset:0.8,transform:"rotate(-5deg)"},{offset:1,transform:"rotate(0deg)"}],flip:[{offset:0,transform:"perspective(400px) rotateY(0)",animationTimingFunction:"ease-out"},{offset:0.4,transform:"perspective(400px) translateZ(150px) rotateY(170deg)",animationTimingFunction:"ease-out"},{offset:0.5,transform:"perspective(400px) translateZ(150px) rotateY(190deg)",animationTimingFunction:"ease-in"},{offset:0.8,transform:"perspective(400px) rotateY(360deg)",animationTimingFunction:"ease-in"},{offset:1,transform:"perspective(400px)",animationTimingFunction:"ease-in"}],rubberBand:[{offset:0,transform:"scale(1)"},{offset:0.3,transform:"scaleX(1.25) scaleY(0.75)"},{offset:0.4,transform:"scaleX(0.75) scaleY(1.25)"},{offset:0.5,transform:"scaleX(1.15) scaleY(0.85)"},{offset:0.65,transform:"scaleX(0.95) scaleY(1.05)"},{offset:0.75,transform:"scaleX(1.05) scaleY(0.95)"},{offset:1,transform:"scale(1)"}],heartbeat:[{offset:0,transform:"scale(1)"},{offset:0.14,transform:"scale(1.3)"},{offset:0.28,transform:"scale(1)"},{offset:0.42,transform:"scale(1.3)"},{offset:0.7,transform:"scale(1)"}]};function Cp(e,t,s={}){return si(e,oi[t],s)}async function ai(){try{return(await import("ts-syntax-highlighter")).createHighlighter}catch{return null}}var se=null;function oe(e){return`<pre class="syntax"><code>${e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</code></pre>`}async function ii(){if(!se){let e=await ai();if(!e)throw Error("ts-syntax-highlighter could not be loaded");se=await e({theme:"github-light"})}return se}async function kp(e,t={}){let{theme:s="auto",language:o="typescript",lineNumbers:a=!1,wrapLines:i=!0}=t,n;try{n=await ii()}catch{return{html:oe(e),css:"",language:o,theme:"github-light"}}let r=s==="auto"?globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches?"github-dark":"github-light":s==="dark"?"github-dark":"github-light",c;try{c=await n.highlight(e,o)}catch{return{html:oe(e),css:"",language:o,theme:r}}let d=c,h=typeof d==="string"?{html:d,css:""}:{html:d?.html??oe(e),css:d?.css??""};return{html:h.html,css:h.css,language:o,theme:r}}function Sp(e){if(e.includes("<!DOCTYPE")||e.includes("<html"))return"html";if(e.includes("<?php"))return"php";if(e.includes("import")&&e.includes("from"))return"typescript";if(e.includes("function")||e.includes("const"))return"javascript";if(e.includes("{")&&e.includes("}"))return"json";if(e.includes("$")&&e.includes("|"))return"bash";if(e.includes("#")&&e.includes("##"))return"markdown";return"typescript"}function Tp(e,t){return`<div class="${t?`rounded-md overflow-auto text-sm leading-relaxed font-mono ${t}`:"rounded-md overflow-auto text-sm leading-relaxed font-mono"}">${e}</div>`}var z=null,ni=(e)=>{return e===1?0:1};function G(e,t){return t.split(".").reduce((s,o)=>s?.[o],e)}function ae(e,t={}){return e.replace(/\{(\w+)\}/g,(s,o)=>{return t[o]!==void 0?String(t[o]):s})}function Ip(e){let{locale:t,fallbackLocale:s="en",messages:o,pluralRules:a={},dateTimeFormats:i={},numberFormats:n={},missing:r,warnMissing:c=!0}=e;function d(g,x={}){let C=G(o[t],g);if(C===void 0&&s)C=G(o[s],g);if(C===void 0){if(r){let I=r(t,g);if(I)return ae(I,x)}if(c&&typeof console<"u")console.warn(`[i18n] Missing translation for key "${g}" in locale "${t}"`);return g}if(typeof C==="string")return ae(C,x);return String(C)}function h(g,x,C={}){let I=d(g,{...C,count:x});if(I.includes("|")){let P=I.split("|").map((Z)=>Z.trim()),J=(a[t]||ni)(x,t),X=P[J]||P[P.length-1];return ae(X,{...C,count:x})}return I}function p(g,x="default"){let C=typeof g==="number"?new Date(g):g,I=i[x]||i.default||{};return new Intl.DateTimeFormat(t,I).format(C)}function m(g,x="default"){let C=n[x]||n.default||{};return new Intl.NumberFormat(t,C).format(g)}function f(g){if(G(o[t],g)!==void 0)return!0;if(s)return G(o[s],g)!==void 0;return!1}function w(g){if(!o[g]){console.warn(`[i18n] Locale "${g}" not found. Available locales: ${Object.keys(o).join(", ")}`);return}t=g}function v(g,x){if(!o[g])o[g]={};o[g]={...o[g],...x}}function k(g){delete o[g]}return{get locale(){return t},get availableLocales(){return Object.keys(o)},setLocale:w,t:d,tc:h,d:p,n:m,te:f,addMessages:v,removeLocale:k}}function Np(e){z=e}function Dp(){return z}function zp(e,t){if(!z)return console.warn("[i18n] No global i18n instance set. Call setI18n() first."),e;return z.t(e,t)}function Pp(e,t,s){if(!z)return console.warn("[i18n] No global i18n instance set. Call setI18n() first."),e;return z.tc(e,t,s)}function Lp(e,t){if(!z)return console.warn("[i18n] No global i18n instance set. Call setI18n() first."),String(e);return z.d(e,t)}function Ep(e,t){if(!z)return console.warn("[i18n] No global i18n instance set. Call setI18n() first."),String(e);return z.n(e,t)}var Op={en:(e)=>e===1?0:1,de:(e)=>e===1?0:1,nl:(e)=>e===1?0:1,sv:(e)=>e===1?0:1,fr:(e)=>e===0||e===1?0:1,pt_BR:(e)=>e===0||e===1?0:1,ru:(e)=>{if(e%10===1&&e%100!==11)return 0;if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return 1;return 2},pl:(e)=>{if(e===1)return 0;if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return 1;return 2},cs:(e)=>{if(e===1)return 0;if(e>=2&&e<=4)return 1;return 2},ar:(e)=>{if(e===0)return 0;if(e===1)return 1;if(e===2)return 2;if(e%100>=3&&e%100<=10)return 3;if(e%100>=11)return 4;return 5},ja:()=>0,ko:()=>0,zh:()=>0,th:()=>0,vi:()=>0},Rp={short:{year:"numeric",month:"numeric",day:"numeric"},long:{year:"numeric",month:"long",day:"numeric"},full:{weekday:"long",year:"numeric",month:"long",day:"numeric"},time:{hour:"numeric",minute:"numeric"},datetime:{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}},Mp={decimal:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2},currency:{style:"currency",currency:"USD"},percent:{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2},compact:{notation:"compact"}};function qp(e){let t=["ar","he","fa","ur","yi"],s=e.split("-")[0].toLowerCase();return t.includes(s)}async function jp(e,t){try{return await t()}catch(s){return console.error(`[i18n] Failed to load messages for locale "${e}":`,s),{}}}var Bp={en:{common:{loading:"Loading...",error:"Error",retry:"Retry",cancel:"Cancel",confirm:"Confirm",close:"Close",save:"Save",delete:"Delete",edit:"Edit",search:"Search",clear:"Clear",submit:"Submit",reset:"Reset"},form:{required:"This field is required",invalid:"Invalid value",tooShort:"Value is too short (minimum {min} characters)",tooLong:"Value is too long (maximum {max} characters)",invalidEmail:"Invalid email address",invalidUrl:"Invalid URL"},pagination:{previous:"Previous",next:"Next",page:"Page {page}",of:"of {total}"}},es:{common:{loading:"Cargando...",error:"Error",retry:"Reintentar",cancel:"Cancelar",confirm:"Confirmar",close:"Cerrar",save:"Guardar",delete:"Eliminar",edit:"Editar",search:"Buscar",clear:"Limpiar",submit:"Enviar",reset:"Restablecer"},form:{required:"Este campo es obligatorio",invalid:"Valor inv\xE1lido",tooShort:"El valor es demasiado corto (m\xEDnimo {min} caracteres)",tooLong:"El valor es demasiado largo (m\xE1ximo {max} caracteres)",invalidEmail:"Direcci\xF3n de correo electr\xF3nico inv\xE1lida",invalidUrl:"URL inv\xE1lida"},pagination:{previous:"Anterior",next:"Siguiente",page:"P\xE1gina {page}",of:"de {total}"}},fr:{common:{loading:"Chargement...",error:"Erreur",retry:"R\xE9essayer",cancel:"Annuler",confirm:"Confirmer",close:"Fermer",save:"Enregistrer",delete:"Supprimer",edit:"Modifier",search:"Rechercher",clear:"Effacer",submit:"Soumettre",reset:"R\xE9initialiser"},form:{required:"Ce champ est obligatoire",invalid:"Valeur invalide",tooShort:"La valeur est trop courte (minimum {min} caract\xE8res)",tooLong:"La valeur est trop longue (maximum {max} caract\xE8res)",invalidEmail:"Adresse e-mail invalide",invalidUrl:"URL invalide"},pagination:{previous:"Pr\xE9c\xE9dent",next:"Suivant",page:"Page {page}",of:"sur {total}"}}};function Hp(e={}){let{max:t=10,ttl:s=0,include:o,exclude:a,hooks:i,debug:n=!1}=e,r=new Map,c=0,d=0;function h(...u){if(n)console.log("[KeepAlive]",...u)}function p(u){if(a){if(a instanceof RegExp&&a.test(u))return!1;if(Array.isArray(a)&&a.includes(u))return!1}if(o){if(o instanceof RegExp&&!o.test(u))return!1;if(Array.isArray(o)&&!o.includes(u))return!1}return!0}function m(u){if(!s||!u.expiresAt)return!1;return Date.now()>u.expiresAt}function f(u){let b=r.get(u);if(b)b.lastAccessedAt=Date.now(),b.accessCount++,b.instance.lastAccessedAt=b.lastAccessedAt,r.delete(u),r.set(u,b),h(`Touched: ${u} (access count: ${b.accessCount})`)}function w(){if(r.size===0)return!1;let u=r.keys().next().value;if(!u)return!1;let b=r.get(u);if(b){h(`Evicting LRU: ${u}`);let y=b.instance.hooks;if(y?.onDeactivate)y.onDeactivate(b.instance);if(i?.onDeactivate)i.onDeactivate(b.instance);return r.delete(u),!0}return!1}function v(u,b,y){if(!p(b.type))return h(`Type not cacheable: ${b.type}`),b;if(r.size>=t)w();let N=Date.now(),W={instance:{...b,hooks:y||b.hooks,createdAt:b.createdAt||N,lastAccessedAt:N},accessCount:0,createdAt:N,lastAccessedAt:N,expiresAt:s?N+s:void 0};if(r.set(u,W),h(`Cached: ${u} (size: ${r.size}/${t})`),y?.onMount)y.onMount(W.instance);if(i?.onMount)i.onMount(W.instance);return W.instance}function k(u){let b=r.get(u);if(!b)return d++,h(`Miss: ${u}`),null;if(m(b))return h(`Expired: ${u}`),r.delete(u),d++,null;return c++,f(u),h(`Hit: ${u}`),b.instance}function g(u){let b=r.get(u);if(!b)return!1;if(m(b))return r.delete(u),!1;return!0}function x(u){let b=r.get(u);if(!b)return!1;h(`Removing: ${u}`);let y=b.instance.hooks;if(y?.onUnmount)y.onUnmount(b.instance);if(i?.onUnmount)i.onUnmount(b.instance);return r.delete(u)}function C(){h("Clearing cache"),r.forEach((u)=>{let b=u.instance.hooks;if(b?.onUnmount)b.onUnmount(u.instance);if(i?.onUnmount)i.onUnmount(u.instance)}),r.clear(),c=0,d=0}function I(){let u=0,b=Date.now();for(let[y,N]of r.entries())if(m(N))h(`Pruning expired: ${y}`),x(y),u++;while(r.size>t)if(w())u++;else break;if(u>0)h(`Pruned ${u} entries`);return u}function P(u){let b=k(u);if(!b)return null;h(`Activating: ${u}`);let y=b.hooks;if(y?.onActivate)y.onActivate(b);if(i?.onActivate)i.onActivate(b);if(b.state&&y?.onRestore)y.onRestore(b,b.state);return b}function ne(u){let b=r.get(u);if(!b)return!1;h(`Deactivating: ${u}`);let y=b.instance,N=y.hooks;if(N?.onSave)y.state=N.onSave(y);if(N?.onDeactivate)N.onDeactivate(y);if(i?.onDeactivate)i.onDeactivate(y);return!0}function J(){let u=c+d;return{hits:c,misses:d,size:r.size,max:t,hitRate:u>0?c/u:0,keys:Array.from(r.keys())}}function X(){return Array.from(r.keys())}function Z(){return r.size}return{cache:v,get:k,has:g,remove:x,clear:C,prune:I,activate:P,deactivate:ne,getStats:J,keys:X,size:Z}}function Vp(e){let t=new Map;return{set(s,o){if(t.has(s))t.delete(s);if(t.set(s,o),t.size>e){let a=t.keys().next().value;if(a)t.delete(a)}},get(s){if(!t.has(s))return;let o=t.get(s);return t.delete(s),t.set(s,o),o},has(s){return t.has(s)},delete(s){return t.delete(s)},clear(){t.clear()},get size(){return t.size},keys(){return Array.from(t.keys())},values(){return Array.from(t.values())},forEach(s){t.forEach(s)}}}function Fp(){let e=new Map;return{save(t,s){e.set(t,JSON.parse(JSON.stringify(s)))},restore(t){let s=e.get(t);return s?JSON.parse(JSON.stringify(s)):null},has(t){return e.has(t)},remove(t){return e.delete(t)},clear(){e.clear()},keys(){return Array.from(e.keys())},get size(){return e.size}}}function Kp(e,t={}){let{maxSize:s=100,reset:o}=t,a=[];return{acquire(){if(a.length>0)return a.pop();return e()},release(i){if(a.length<s){if(o)o(i);a.push(i)}},clear(){a.length=0},get size(){return a.length},get maxSize(){return s}}}var E=new Map;async function U(e,t){let s=t||e.toString();if(E.has(s))return E.get(s);let o=e();E.set(s,o);try{return await o}catch(a){throw E.delete(s),a}}function Gp(e,t={}){let{retryAttempts:s=3,retryDelay:o=1000,onLoading:a,onLoaded:i,onError:n}=t,r="idle",c,d,h=async(p=0)=>{try{if(r==="loading"||r==="loaded"){if(c)return c}r="loading",a?.();let m=await U(e);return c=m,r="loaded",i?.(m),m}catch(m){let f=m;if(p<s)return await new Promise((w)=>setTimeout(w,o*(p+1))),h(p+1);throw r="error",d=f,n?.(f),f}};return{get state(){return r},get module(){return c},get error(){return d},load:()=>h(),preload:()=>h()}}function ri(e,t,s={}){if(!e)return console.warn("lazyLoad: element is null"),()=>{};let{root:o=null,rootMargin:a="0px",threshold:i=0.01,placeholder:n,errorContent:r,onLoading:c,onLoaded:d,onError:h}=s,p=!1,m=null;if(n)if(typeof n==="string")e.innerHTML=n;else e.innerHTML="",e.appendChild(n);return m=new IntersectionObserver(async(w)=>{for(let v of w)if(v.isIntersecting&&!p){p=!0,m?.disconnect();try{c?.();let k=await U(t);if(d?.(k),k&&typeof k.default?.render==="function"){let g=await k.default.render();e.innerHTML=g}}catch(k){let g=k;if(h?.(g),r)if(typeof r==="string")e.innerHTML=r;else e.innerHTML="",e.appendChild(r);else e.innerHTML=`<div style="color: red;">Failed to load component: ${g.message}</div>`}}},{root:o,rootMargin:a,threshold:i}),m.observe(e),()=>{m?.disconnect(),m=null}}function Up(e,t,s={}){let o=[],a=Array.from(e);for(let i of a){let n=typeof t==="function"&&t.length>0?()=>t(i):t,r=ri(i,n,s);o.push(r)}return()=>{o.forEach((i)=>i())}}function li(e){return U(e)}function Yp(e){return Promise.all(e.map((t)=>li(t)))}function Jp(e){if(e)E.delete(e);else E.clear()}function Xp(){return{size:E.size,keys:Array.from(E.keys())}}function Zp(e){return{async load(t){let s=e[t];if(!s)throw Error(`No route found for path: ${t}`);return U(s,`route:${t}`)},async preload(t){return this.load(t)},async preloadRoutes(t){return Promise.all(t.map((s)=>this.preload(s)))}}}function ci(e,t,s={}){if(!e)return()=>{};let{root:o=null,rootMargin:a="50px",threshold:i=0.01,placeholder:n,onLoading:r,onLoaded:c,onError:d}=s;if(n&&typeof n==="string")e.src=n;let h=!1,p=null;return p=new IntersectionObserver((f)=>{for(let w of f)if(w.isIntersecting&&!h)h=!0,p?.disconnect(),r?.(),e.src=t,e.addEventListener("load",()=>{c?.(e),e.classList.add("loaded")},{once:!0}),e.addEventListener("error",(v)=>{let k=Error(`Failed to load image: ${t}`);d?.(k),e.classList.add("error")},{once:!0})},{root:o,rootMargin:a,threshold:i}),p.observe(e),()=>{p?.disconnect(),p=null}}function Qp(e=document,t={}){let s=e.querySelectorAll("img[data-lazy-src]"),o=[];return s.forEach((a)=>{let i=a.getAttribute("data-lazy-src");if(i){let n=ci(a,i,t);o.push(n)}}),()=>{o.forEach((a)=>a())}}var ie={colors:{primary:"#3b82f6",secondary:"#8b5cf6",success:"#10b981",warning:"#f59e0b",danger:"#ef4444",info:"#06b6d4",gray:"#6b7280",white:"#ffffff",black:"#000000"},typography:{fontFamily:{sans:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',serif:'Georgia, Cambria, "Times New Roman", Times, serif',mono:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},fontWeight:{light:"300",normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.75"}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem","4xl":"6rem"},borderRadius:{none:"0",sm:"0.125rem",md:"0.375rem",lg:"0.5rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",none:"none"},components:{button:{borderRadius:"0.375rem",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:"500"},input:{borderRadius:"0.375rem",padding:"0.5rem 0.75rem",fontSize:"0.875rem",borderWidth:"1px"},card:{borderRadius:"0.5rem",padding:"1.5rem",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"}}};function be(e,t){let s={...e};for(let o in t)if(t[o]instanceof Object&&o in e)s[o]=be(e[o],t[o]);else s[o]=t[o];return s}function B(e){return be(ie,e)}var Y=ie;function th(){return Y}function di(e){let t=[];if(e.colors)Object.entries(e.colors).forEach(([s,o])=>{if(o)t.push(`--color-${s}: ${o};`)});if(e.typography?.fontFamily)Object.entries(e.typography.fontFamily).forEach(([s,o])=>{if(o)t.push(`--font-${s}: ${o};`)});if(e.typography?.fontSize)Object.entries(e.typography.fontSize).forEach(([s,o])=>{if(o)t.push(`--text-${s}: ${o};`)});if(e.typography?.fontWeight)Object.entries(e.typography.fontWeight).forEach(([s,o])=>{if(o)t.push(`--font-weight-${s}: ${o};`)});if(e.typography?.lineHeight)Object.entries(e.typography.lineHeight).forEach(([s,o])=>{if(o)t.push(`--leading-${s}: ${o};`)});if(e.spacing)Object.entries(e.spacing).forEach(([s,o])=>{if(o)t.push(`--spacing-${s}: ${o};`)});if(e.borderRadius)Object.entries(e.borderRadius).forEach(([s,o])=>{if(o)t.push(`--radius-${s}: ${o};`)});if(e.shadows)Object.entries(e.shadows).forEach(([s,o])=>{if(o)t.push(`--shadow-${s}: ${o};`)});if(e.components?.button)Object.entries(e.components.button).forEach(([s,o])=>{if(o)t.push(`--button-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${o};`)});if(e.components?.input)Object.entries(e.components.input).forEach(([s,o])=>{if(o)t.push(`--input-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${o};`)});if(e.components?.card)Object.entries(e.components.card).forEach(([s,o])=>{if(o)t.push(`--card-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${o};`)});return`:root {
16
+ `,o=document.createElement("style");o.textContent=s,document.head.appendChild(o)}function si(e,t,s={}){if(typeof e.animate!=="function")return console.warn("Web Animations API not supported"),null;let{duration:o=1000,easing:a="ease",delay:i=0,iterations:n=1,direction:r="normal",fill:c="both"}=s;return e.animate([...t],{duration:o,easing:a,delay:i,iterations:n,direction:r,fill:c})}var oi={fadeIn:[{offset:0,opacity:0},{offset:1,opacity:1}],fadeOut:[{offset:0,opacity:1},{offset:1,opacity:0}],slideInUp:[{offset:0,transform:"translateY(100%)",opacity:0},{offset:1,transform:"translateY(0)",opacity:1}],slideInDown:[{offset:0,transform:"translateY(-100%)",opacity:0},{offset:1,transform:"translateY(0)",opacity:1}],slideInLeft:[{offset:0,transform:"translateX(-100%)",opacity:0},{offset:1,transform:"translateX(0)",opacity:1}],slideInRight:[{offset:0,transform:"translateX(100%)",opacity:0},{offset:1,transform:"translateX(0)",opacity:1}],slideOutUp:[{offset:0,transform:"translateY(0)",opacity:1},{offset:1,transform:"translateY(-100%)",opacity:0}],slideOutDown:[{offset:0,transform:"translateY(0)",opacity:1},{offset:1,transform:"translateY(100%)",opacity:0}],slideOutLeft:[{offset:0,transform:"translateX(0)",opacity:1},{offset:1,transform:"translateX(-100%)",opacity:0}],slideOutRight:[{offset:0,transform:"translateX(0)",opacity:1},{offset:1,transform:"translateX(100%)",opacity:0}],zoomIn:[{offset:0,transform:"scale(0)",opacity:0},{offset:0.5,opacity:1},{offset:1,transform:"scale(1)"}],zoomOut:[{offset:0,transform:"scale(1)",opacity:1},{offset:0.5,opacity:1},{offset:1,transform:"scale(0)",opacity:0}],rotate:[{offset:0,transform:"rotate(0deg)"},{offset:1,transform:"rotate(360deg)"}],bounce:[{offset:0,transform:"translateY(0)"},{offset:0.2,transform:"translateY(0)"},{offset:0.4,transform:"translateY(-30px)"},{offset:0.43,transform:"translateY(-30px)"},{offset:0.53,transform:"translateY(0)"},{offset:0.7,transform:"translateY(-15px)"},{offset:0.8,transform:"translateY(0)"},{offset:0.9,transform:"translateY(-4px)"},{offset:1,transform:"translateY(0)"}],pulse:[{offset:0,transform:"scale(1)"},{offset:0.5,transform:"scale(1.05)"},{offset:1,transform:"scale(1)"}],shake:[{offset:0,transform:"translateX(0)"},{offset:0.1,transform:"translateX(-10px)"},{offset:0.2,transform:"translateX(10px)"},{offset:0.3,transform:"translateX(-10px)"},{offset:0.4,transform:"translateX(10px)"},{offset:0.5,transform:"translateX(-10px)"},{offset:0.6,transform:"translateX(10px)"},{offset:0.7,transform:"translateX(-10px)"},{offset:0.8,transform:"translateX(10px)"},{offset:0.9,transform:"translateX(-10px)"},{offset:1,transform:"translateX(0)"}],swing:[{offset:0,transform:"rotate(0deg)"},{offset:0.2,transform:"rotate(15deg)"},{offset:0.4,transform:"rotate(-10deg)"},{offset:0.6,transform:"rotate(5deg)"},{offset:0.8,transform:"rotate(-5deg)"},{offset:1,transform:"rotate(0deg)"}],flip:[{offset:0,transform:"perspective(400px) rotateY(0)",animationTimingFunction:"ease-out"},{offset:0.4,transform:"perspective(400px) translateZ(150px) rotateY(170deg)",animationTimingFunction:"ease-out"},{offset:0.5,transform:"perspective(400px) translateZ(150px) rotateY(190deg)",animationTimingFunction:"ease-in"},{offset:0.8,transform:"perspective(400px) rotateY(360deg)",animationTimingFunction:"ease-in"},{offset:1,transform:"perspective(400px)",animationTimingFunction:"ease-in"}],rubberBand:[{offset:0,transform:"scale(1)"},{offset:0.3,transform:"scaleX(1.25) scaleY(0.75)"},{offset:0.4,transform:"scaleX(0.75) scaleY(1.25)"},{offset:0.5,transform:"scaleX(1.15) scaleY(0.85)"},{offset:0.65,transform:"scaleX(0.95) scaleY(1.05)"},{offset:0.75,transform:"scaleX(1.05) scaleY(0.95)"},{offset:1,transform:"scale(1)"}],heartbeat:[{offset:0,transform:"scale(1)"},{offset:0.14,transform:"scale(1.3)"},{offset:0.28,transform:"scale(1)"},{offset:0.42,transform:"scale(1.3)"},{offset:0.7,transform:"scale(1)"}]};function Cp(e,t,s={}){return si(e,oi[t],s)}async function ai(){try{return(await import("ts-syntax-highlighter")).createHighlighter}catch{return null}}var se=null;function oe(e){return`<pre class="syntax"><code>${e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</code></pre>`}async function ii(){if(!se){let e=await ai();if(!e)throw Error("ts-syntax-highlighter could not be loaded");se=await e({theme:"github-light"})}return se}async function kp(e,t={}){let{theme:s="auto",language:o="typescript",lineNumbers:a=!1,wrapLines:i=!0}=t,n=s==="auto"?globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches?"github-dark":"github-light":s==="dark"?"github-dark":"github-light",r;try{r=await ii()}catch{return{html:oe(e),css:"",language:o,theme:n}}let c;try{c=await r.highlight(e,o,{theme:n})}catch{return{html:oe(e),css:"",language:o,theme:n}}let d=c,h=typeof d==="string"?{html:d,css:""}:{html:d?.html??oe(e),css:d?.css??""};return{html:h.html,css:h.css,language:o,theme:n}}function Sp(e){if(e.includes("<!DOCTYPE")||e.includes("<html"))return"html";if(e.includes("<?php"))return"php";if(e.includes("import")&&e.includes("from"))return"typescript";if(e.includes("function")||e.includes("const"))return"javascript";if(e.includes("{")&&e.includes("}"))return"json";if(e.includes("$")&&e.includes("|"))return"bash";if(e.includes("#")&&e.includes("##"))return"markdown";return"typescript"}function Tp(e,t){return`<div class="${t?`rounded-md overflow-auto text-sm leading-relaxed font-mono ${t}`:"rounded-md overflow-auto text-sm leading-relaxed font-mono"}">${e}</div>`}var z=null,ni=(e)=>{return e===1?0:1};function G(e,t){return t.split(".").reduce((s,o)=>s?.[o],e)}function ae(e,t={}){return e.replace(/\{(\w+)\}/g,(s,o)=>{return t[o]!==void 0?String(t[o]):s})}function Ip(e){let{locale:t,fallbackLocale:s="en",messages:o,pluralRules:a={},dateTimeFormats:i={},numberFormats:n={},missing:r,warnMissing:c=!0}=e;function d(g,x={}){let C=G(o[t],g);if(C===void 0&&s)C=G(o[s],g);if(C===void 0){if(r){let I=r(t,g);if(I)return ae(I,x)}if(c&&typeof console<"u")console.warn(`[i18n] Missing translation for key "${g}" in locale "${t}"`);return g}if(typeof C==="string")return ae(C,x);return String(C)}function h(g,x,C={}){let I=d(g,{...C,count:x});if(I.includes("|")){let P=I.split("|").map((Z)=>Z.trim()),J=(a[t]||ni)(x,t),X=P[J]||P[P.length-1];return ae(X,{...C,count:x})}return I}function p(g,x="default"){let C=typeof g==="number"?new Date(g):g,I=i[x]||i.default||{};return new Intl.DateTimeFormat(t,I).format(C)}function m(g,x="default"){let C=n[x]||n.default||{};return new Intl.NumberFormat(t,C).format(g)}function f(g){if(G(o[t],g)!==void 0)return!0;if(s)return G(o[s],g)!==void 0;return!1}function w(g){if(!o[g]){console.warn(`[i18n] Locale "${g}" not found. Available locales: ${Object.keys(o).join(", ")}`);return}t=g}function v(g,x){if(!o[g])o[g]={};o[g]={...o[g],...x}}function k(g){delete o[g]}return{get locale(){return t},get availableLocales(){return Object.keys(o)},setLocale:w,t:d,tc:h,d:p,n:m,te:f,addMessages:v,removeLocale:k}}function Np(e){z=e}function Dp(){return z}function zp(e,t){if(!z)return console.warn("[i18n] No global i18n instance set. Call setI18n() first."),e;return z.t(e,t)}function Pp(e,t,s){if(!z)return console.warn("[i18n] No global i18n instance set. Call setI18n() first."),e;return z.tc(e,t,s)}function Lp(e,t){if(!z)return console.warn("[i18n] No global i18n instance set. Call setI18n() first."),String(e);return z.d(e,t)}function Ep(e,t){if(!z)return console.warn("[i18n] No global i18n instance set. Call setI18n() first."),String(e);return z.n(e,t)}var Op={en:(e)=>e===1?0:1,de:(e)=>e===1?0:1,nl:(e)=>e===1?0:1,sv:(e)=>e===1?0:1,fr:(e)=>e===0||e===1?0:1,pt_BR:(e)=>e===0||e===1?0:1,ru:(e)=>{if(e%10===1&&e%100!==11)return 0;if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return 1;return 2},pl:(e)=>{if(e===1)return 0;if(e%10>=2&&e%10<=4&&(e%100<10||e%100>=20))return 1;return 2},cs:(e)=>{if(e===1)return 0;if(e>=2&&e<=4)return 1;return 2},ar:(e)=>{if(e===0)return 0;if(e===1)return 1;if(e===2)return 2;if(e%100>=3&&e%100<=10)return 3;if(e%100>=11)return 4;return 5},ja:()=>0,ko:()=>0,zh:()=>0,th:()=>0,vi:()=>0},Rp={short:{year:"numeric",month:"numeric",day:"numeric"},long:{year:"numeric",month:"long",day:"numeric"},full:{weekday:"long",year:"numeric",month:"long",day:"numeric"},time:{hour:"numeric",minute:"numeric"},datetime:{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}},Mp={decimal:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2},currency:{style:"currency",currency:"USD"},percent:{style:"percent",minimumFractionDigits:0,maximumFractionDigits:2},compact:{notation:"compact"}};function qp(e){let t=["ar","he","fa","ur","yi"],s=e.split("-")[0].toLowerCase();return t.includes(s)}async function jp(e,t){try{return await t()}catch(s){return console.error(`[i18n] Failed to load messages for locale "${e}":`,s),{}}}var Bp={en:{common:{loading:"Loading...",error:"Error",retry:"Retry",cancel:"Cancel",confirm:"Confirm",close:"Close",save:"Save",delete:"Delete",edit:"Edit",search:"Search",clear:"Clear",submit:"Submit",reset:"Reset"},form:{required:"This field is required",invalid:"Invalid value",tooShort:"Value is too short (minimum {min} characters)",tooLong:"Value is too long (maximum {max} characters)",invalidEmail:"Invalid email address",invalidUrl:"Invalid URL"},pagination:{previous:"Previous",next:"Next",page:"Page {page}",of:"of {total}"}},es:{common:{loading:"Cargando...",error:"Error",retry:"Reintentar",cancel:"Cancelar",confirm:"Confirmar",close:"Cerrar",save:"Guardar",delete:"Eliminar",edit:"Editar",search:"Buscar",clear:"Limpiar",submit:"Enviar",reset:"Restablecer"},form:{required:"Este campo es obligatorio",invalid:"Valor inv\xE1lido",tooShort:"El valor es demasiado corto (m\xEDnimo {min} caracteres)",tooLong:"El valor es demasiado largo (m\xE1ximo {max} caracteres)",invalidEmail:"Direcci\xF3n de correo electr\xF3nico inv\xE1lida",invalidUrl:"URL inv\xE1lida"},pagination:{previous:"Anterior",next:"Siguiente",page:"P\xE1gina {page}",of:"de {total}"}},fr:{common:{loading:"Chargement...",error:"Erreur",retry:"R\xE9essayer",cancel:"Annuler",confirm:"Confirmer",close:"Fermer",save:"Enregistrer",delete:"Supprimer",edit:"Modifier",search:"Rechercher",clear:"Effacer",submit:"Soumettre",reset:"R\xE9initialiser"},form:{required:"Ce champ est obligatoire",invalid:"Valeur invalide",tooShort:"La valeur est trop courte (minimum {min} caract\xE8res)",tooLong:"La valeur est trop longue (maximum {max} caract\xE8res)",invalidEmail:"Adresse e-mail invalide",invalidUrl:"URL invalide"},pagination:{previous:"Pr\xE9c\xE9dent",next:"Suivant",page:"Page {page}",of:"sur {total}"}}};function Hp(e={}){let{max:t=10,ttl:s=0,include:o,exclude:a,hooks:i,debug:n=!1}=e,r=new Map,c=0,d=0;function h(...u){if(n)console.log("[KeepAlive]",...u)}function p(u){if(a){if(a instanceof RegExp&&a.test(u))return!1;if(Array.isArray(a)&&a.includes(u))return!1}if(o){if(o instanceof RegExp&&!o.test(u))return!1;if(Array.isArray(o)&&!o.includes(u))return!1}return!0}function m(u){if(!s||!u.expiresAt)return!1;return Date.now()>u.expiresAt}function f(u){let b=r.get(u);if(b)b.lastAccessedAt=Date.now(),b.accessCount++,b.instance.lastAccessedAt=b.lastAccessedAt,r.delete(u),r.set(u,b),h(`Touched: ${u} (access count: ${b.accessCount})`)}function w(){if(r.size===0)return!1;let u=r.keys().next().value;if(!u)return!1;let b=r.get(u);if(b){h(`Evicting LRU: ${u}`);let y=b.instance.hooks;if(y?.onDeactivate)y.onDeactivate(b.instance);if(i?.onDeactivate)i.onDeactivate(b.instance);return r.delete(u),!0}return!1}function v(u,b,y){if(!p(b.type))return h(`Type not cacheable: ${b.type}`),b;if(r.size>=t)w();let N=Date.now(),W={instance:{...b,hooks:y||b.hooks,createdAt:b.createdAt||N,lastAccessedAt:N},accessCount:0,createdAt:N,lastAccessedAt:N,expiresAt:s?N+s:void 0};if(r.set(u,W),h(`Cached: ${u} (size: ${r.size}/${t})`),y?.onMount)y.onMount(W.instance);if(i?.onMount)i.onMount(W.instance);return W.instance}function k(u){let b=r.get(u);if(!b)return d++,h(`Miss: ${u}`),null;if(m(b))return h(`Expired: ${u}`),r.delete(u),d++,null;return c++,f(u),h(`Hit: ${u}`),b.instance}function g(u){let b=r.get(u);if(!b)return!1;if(m(b))return r.delete(u),!1;return!0}function x(u){let b=r.get(u);if(!b)return!1;h(`Removing: ${u}`);let y=b.instance.hooks;if(y?.onUnmount)y.onUnmount(b.instance);if(i?.onUnmount)i.onUnmount(b.instance);return r.delete(u)}function C(){h("Clearing cache"),r.forEach((u)=>{let b=u.instance.hooks;if(b?.onUnmount)b.onUnmount(u.instance);if(i?.onUnmount)i.onUnmount(u.instance)}),r.clear(),c=0,d=0}function I(){let u=0,b=Date.now();for(let[y,N]of r.entries())if(m(N))h(`Pruning expired: ${y}`),x(y),u++;while(r.size>t)if(w())u++;else break;if(u>0)h(`Pruned ${u} entries`);return u}function P(u){let b=k(u);if(!b)return null;h(`Activating: ${u}`);let y=b.hooks;if(y?.onActivate)y.onActivate(b);if(i?.onActivate)i.onActivate(b);if(b.state&&y?.onRestore)y.onRestore(b,b.state);return b}function ne(u){let b=r.get(u);if(!b)return!1;h(`Deactivating: ${u}`);let y=b.instance,N=y.hooks;if(N?.onSave)y.state=N.onSave(y);if(N?.onDeactivate)N.onDeactivate(y);if(i?.onDeactivate)i.onDeactivate(y);return!0}function J(){let u=c+d;return{hits:c,misses:d,size:r.size,max:t,hitRate:u>0?c/u:0,keys:Array.from(r.keys())}}function X(){return Array.from(r.keys())}function Z(){return r.size}return{cache:v,get:k,has:g,remove:x,clear:C,prune:I,activate:P,deactivate:ne,getStats:J,keys:X,size:Z}}function Vp(e){let t=new Map;return{set(s,o){if(t.has(s))t.delete(s);if(t.set(s,o),t.size>e){let a=t.keys().next().value;if(a)t.delete(a)}},get(s){if(!t.has(s))return;let o=t.get(s);return t.delete(s),t.set(s,o),o},has(s){return t.has(s)},delete(s){return t.delete(s)},clear(){t.clear()},get size(){return t.size},keys(){return Array.from(t.keys())},values(){return Array.from(t.values())},forEach(s){t.forEach(s)}}}function Fp(){let e=new Map;return{save(t,s){e.set(t,JSON.parse(JSON.stringify(s)))},restore(t){let s=e.get(t);return s?JSON.parse(JSON.stringify(s)):null},has(t){return e.has(t)},remove(t){return e.delete(t)},clear(){e.clear()},keys(){return Array.from(e.keys())},get size(){return e.size}}}function Kp(e,t={}){let{maxSize:s=100,reset:o}=t,a=[];return{acquire(){if(a.length>0)return a.pop();return e()},release(i){if(a.length<s){if(o)o(i);a.push(i)}},clear(){a.length=0},get size(){return a.length},get maxSize(){return s}}}var E=new Map;async function U(e,t){let s=t||e.toString();if(E.has(s))return E.get(s);let o=e();E.set(s,o);try{return await o}catch(a){throw E.delete(s),a}}function Gp(e,t={}){let{retryAttempts:s=3,retryDelay:o=1000,onLoading:a,onLoaded:i,onError:n}=t,r="idle",c,d,h=async(p=0)=>{try{if(r==="loading"||r==="loaded"){if(c)return c}r="loading",a?.();let m=await U(e);return c=m,r="loaded",i?.(m),m}catch(m){let f=m;if(p<s)return await new Promise((w)=>setTimeout(w,o*(p+1))),h(p+1);throw r="error",d=f,n?.(f),f}};return{get state(){return r},get module(){return c},get error(){return d},load:()=>h(),preload:()=>h()}}function ri(e,t,s={}){if(!e)return console.warn("lazyLoad: element is null"),()=>{};let{root:o=null,rootMargin:a="0px",threshold:i=0.01,placeholder:n,errorContent:r,onLoading:c,onLoaded:d,onError:h}=s,p=!1,m=null;if(n)if(typeof n==="string")e.innerHTML=n;else e.innerHTML="",e.appendChild(n);return m=new IntersectionObserver(async(w)=>{for(let v of w)if(v.isIntersecting&&!p){p=!0,m?.disconnect();try{c?.();let k=await U(t);if(d?.(k),k&&typeof k.default?.render==="function"){let g=await k.default.render();e.innerHTML=g}}catch(k){let g=k;if(h?.(g),r)if(typeof r==="string")e.innerHTML=r;else e.innerHTML="",e.appendChild(r);else e.innerHTML=`<div style="color: red;">Failed to load component: ${g.message}</div>`}}},{root:o,rootMargin:a,threshold:i}),m.observe(e),()=>{m?.disconnect(),m=null}}function Up(e,t,s={}){let o=[],a=Array.from(e);for(let i of a){let n=typeof t==="function"&&t.length>0?()=>t(i):t,r=ri(i,n,s);o.push(r)}return()=>{o.forEach((i)=>i())}}function li(e){return U(e)}function Yp(e){return Promise.all(e.map((t)=>li(t)))}function Jp(e){if(e)E.delete(e);else E.clear()}function Xp(){return{size:E.size,keys:Array.from(E.keys())}}function Zp(e){return{async load(t){let s=e[t];if(!s)throw Error(`No route found for path: ${t}`);return U(s,`route:${t}`)},async preload(t){return this.load(t)},async preloadRoutes(t){return Promise.all(t.map((s)=>this.preload(s)))}}}function ci(e,t,s={}){if(!e)return()=>{};let{root:o=null,rootMargin:a="50px",threshold:i=0.01,placeholder:n,onLoading:r,onLoaded:c,onError:d}=s;if(n&&typeof n==="string")e.src=n;let h=!1,p=null;return p=new IntersectionObserver((f)=>{for(let w of f)if(w.isIntersecting&&!h)h=!0,p?.disconnect(),r?.(),e.src=t,e.addEventListener("load",()=>{c?.(e),e.classList.add("loaded")},{once:!0}),e.addEventListener("error",(v)=>{let k=Error(`Failed to load image: ${t}`);d?.(k),e.classList.add("error")},{once:!0})},{root:o,rootMargin:a,threshold:i}),p.observe(e),()=>{p?.disconnect(),p=null}}function Qp(e=document,t={}){let s=e.querySelectorAll("img[data-lazy-src]"),o=[];return s.forEach((a)=>{let i=a.getAttribute("data-lazy-src");if(i){let n=ci(a,i,t);o.push(n)}}),()=>{o.forEach((a)=>a())}}var ie={colors:{primary:"#3b82f6",secondary:"#8b5cf6",success:"#10b981",warning:"#f59e0b",danger:"#ef4444",info:"#06b6d4",gray:"#6b7280",white:"#ffffff",black:"#000000"},typography:{fontFamily:{sans:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',serif:'Georgia, Cambria, "Times New Roman", Times, serif',mono:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},fontWeight:{light:"300",normal:"400",medium:"500",semibold:"600",bold:"700"},lineHeight:{tight:"1.25",normal:"1.5",relaxed:"1.75"}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem","2xl":"3rem","3xl":"4rem","4xl":"6rem"},borderRadius:{none:"0",sm:"0.125rem",md:"0.375rem",lg:"0.5rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",none:"none"},components:{button:{borderRadius:"0.375rem",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:"500"},input:{borderRadius:"0.375rem",padding:"0.5rem 0.75rem",fontSize:"0.875rem",borderWidth:"1px"},card:{borderRadius:"0.5rem",padding:"1.5rem",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"}}};function be(e,t){let s={...e};for(let o in t)if(t[o]instanceof Object&&o in e)s[o]=be(e[o],t[o]);else s[o]=t[o];return s}function B(e){return be(ie,e)}var Y=ie;function th(){return Y}function di(e){let t=[];if(e.colors)Object.entries(e.colors).forEach(([s,o])=>{if(o)t.push(`--color-${s}: ${o};`)});if(e.typography?.fontFamily)Object.entries(e.typography.fontFamily).forEach(([s,o])=>{if(o)t.push(`--font-${s}: ${o};`)});if(e.typography?.fontSize)Object.entries(e.typography.fontSize).forEach(([s,o])=>{if(o)t.push(`--text-${s}: ${o};`)});if(e.typography?.fontWeight)Object.entries(e.typography.fontWeight).forEach(([s,o])=>{if(o)t.push(`--font-weight-${s}: ${o};`)});if(e.typography?.lineHeight)Object.entries(e.typography.lineHeight).forEach(([s,o])=>{if(o)t.push(`--leading-${s}: ${o};`)});if(e.spacing)Object.entries(e.spacing).forEach(([s,o])=>{if(o)t.push(`--spacing-${s}: ${o};`)});if(e.borderRadius)Object.entries(e.borderRadius).forEach(([s,o])=>{if(o)t.push(`--radius-${s}: ${o};`)});if(e.shadows)Object.entries(e.shadows).forEach(([s,o])=>{if(o)t.push(`--shadow-${s}: ${o};`)});if(e.components?.button)Object.entries(e.components.button).forEach(([s,o])=>{if(o)t.push(`--button-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${o};`)});if(e.components?.input)Object.entries(e.components.input).forEach(([s,o])=>{if(o)t.push(`--input-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${o};`)});if(e.components?.card)Object.entries(e.components.card).forEach(([s,o])=>{if(o)t.push(`--card-${s.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${o};`)});return`:root {
17
17
  ${t.join(`
18
18
  `)}
19
19
  }`}function sh(e,t){if(Y=e,typeof document>"u")return;let s=t||document.documentElement;if(e.colors)Object.entries(e.colors).forEach(([o,a])=>{if(a)s.style.setProperty(`--color-${o}`,a)});if(e.typography?.fontFamily)Object.entries(e.typography.fontFamily).forEach(([o,a])=>{if(a)s.style.setProperty(`--font-${o}`,a)});if(e.typography?.fontSize)Object.entries(e.typography.fontSize).forEach(([o,a])=>{if(a)s.style.setProperty(`--text-${o}`,a)});if(e.typography?.fontWeight)Object.entries(e.typography.fontWeight).forEach(([o,a])=>{if(a)s.style.setProperty(`--font-weight-${o}`,a)});if(e.typography?.lineHeight)Object.entries(e.typography.lineHeight).forEach(([o,a])=>{if(a)s.style.setProperty(`--leading-${o}`,a)});if(e.spacing)Object.entries(e.spacing).forEach(([o,a])=>{if(a)s.style.setProperty(`--spacing-${o}`,a)});if(e.borderRadius)Object.entries(e.borderRadius).forEach(([o,a])=>{if(a)s.style.setProperty(`--radius-${o}`,a)});if(e.shadows)Object.entries(e.shadows).forEach(([o,a])=>{if(a)s.style.setProperty(`--shadow-${o}`,a)});if(e.components?.button)Object.entries(e.components.button).forEach(([o,a])=>{if(a)s.style.setProperty(`--button-${o.replace(/([A-Z])/g,"-$1").toLowerCase()}`,a)});if(e.components?.input)Object.entries(e.components.input).forEach(([o,a])=>{if(a)s.style.setProperty(`--input-${o.replace(/([A-Z])/g,"-$1").toLowerCase()}`,a)});if(e.components?.card)Object.entries(e.components.card).forEach(([o,a])=>{if(a)s.style.setProperty(`--card-${o.replace(/([A-Z])/g,"-$1").toLowerCase()}`,a)})}function oh(){return Y}function ah(e){let t=e.split("."),s=Y;for(let o of t)if(s&&typeof s==="object"&&o in s)s=s[o];else return;return s}var ih={default:ie,purple:B({colors:{primary:"#8b5cf6",secondary:"#a78bfa"}}),green:B({colors:{primary:"#10b981",secondary:"#34d399"}}),orange:B({colors:{primary:"#f97316",secondary:"#fb923c"}}),dark:B({colors:{primary:"#60a5fa",secondary:"#a78bfa",gray:"#9ca3af",white:"#1f2937",black:"#f9fafb"}}),minimal:B({borderRadius:{none:"0",sm:"0",md:"0.125rem",lg:"0.25rem",full:"0.25rem"},shadows:{sm:"none",md:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",lg:"0 1px 3px 0 rgba(0, 0, 0, 0.1)",xl:"0 4px 6px -1px rgba(0, 0, 0, 0.1)","2xl":"0 10px 15px -3px rgba(0, 0, 0, 0.1)",none:"none"}})};function nh(e){return di(e)}export{le as wrapErrorHandler,$n as warnProp,Ke as warn,ti as waitForAnimation,Dn as validateVariant,Hr as validateTextInputProps,zn as validateSize,_r as validateSearchInputProps,Ge as validateProps,Fr as validatePasswordInputProps,Kr as validateNumberInputProps,Dr as validateFormProps,Vr as validateEmailInputProps,In as validateButtonProps,pp as validateAriaRelationships,oh as useTheme,yi as useSEO,Mi as usePrefersReducedMotion,M as useMediaQuery,zi as useLocalStorage,Ii as useKeyboard,Ei as useIsMobile,Oi as useIsDesktop,Ri as useIsDarkMode,Ti as useFocusTrap,vi as useDarkMode,mi as useCopyCode,ki as useClickOutside,Li as useBreakpoint,Wi as themeVariableNames,di as themeToCSSProperties,ih as themePresets,Qt as textInputPropSchema,Pp as tc,zp as t,Bi as stxThemePreset,id as storage,mp as staggerAnimation,Dc as spaceWashGradient,Ro as spaceTintVars,Lc as spaceTintPayload,Pc as spaceIndexOf,ce as sidebarThemes,Ce as setTitle,S as setMeta,$e as setLink,Np as setI18n,bn as setErrorHandler,gp as sequenceAnimations,Oo as resolveSpaceTint,Tc as resolveSidebarTheme,Ac as resolveIconColor,bp as removeAnimation,Yp as preloadModules,li as preloadModule,rp as prefersReducedMotion,lp as prefersHighContrast,Op as pluralRules,es as numberInputPropSchema,Mp as numberFormats,zc as normalizeSpaces,Mo as normalizeSpace,Ep as n,op as moveFocus,K as macosColors,jp as loadLocaleMessages,Sa as linear,U as lazyLoadModule,Qp as lazyLoadImages,ci as lazyLoadImage,Gp as lazyLoadComponent,Up as lazyLoadAll,ri as lazyLoad,ap as isVisibleToScreenReader,qp as isRTL,kp as highlight,sp as hasFocus,V as handleError,ah as getThemeValue,th as getTheme,ye as getSystemTheme,Dp as getI18n,ii as getHighlighter,ee as getFocusableElements,Q as getEffectiveTheme,cp as getColorSchemePreference,Xp as getCacheStats,nh as generateThemeCSS,Ci as generateSEOTags,he as generateId,jt as formPropSchema,vn as errorBoundary,ja as easeOutSine,Ra as easeOutQuint,La as easeOutQuart,Aa as easeOutQuad,Ha as easeOutExpo,Ua as easeOutElastic,Da as easeOutCubic,Ka as easeOutCirc,te as easeOutBounce,Xa as easeOutBack,qa as easeInSine,Oa as easeInQuint,Pa as easeInQuart,Ta as easeInQuad,Ba as easeInOutSine,Ma as easeInOutQuint,Ea as easeInOutQuart,Ia as easeInOutQuad,Va as easeInOutExpo,Ya as easeInOutElastic,za as easeInOutCubic,_a as easeInOutCirc,Qa as easeInOutBounce,Za as easeInOutBack,Wa as easeInExpo,Ga as easeInElastic,Na as easeInCubic,Fa as easeInCirc,ue as easeInBounce,Ja as easeInBack,gn as devAssert,Sp as detectLanguage,de as deriveSpaceTint,ie as defaultTheme,Rp as dateTimeFormats,Lp as d,ei as cssAnimation,B as createTheme,nd as createStorage,Fp as createStateManager,dp as createSkipLink,np as createScreenReaderText,Nn as createSafeClickHandler,ep as createRovingTabindex,Zp as createRouteLoader,D as createPropValidator,Vp as createLRUCache,wp as createKeyframes,si as createKeyframeAnimation,Hp as createKeepAlive,Ip as createI18n,Qd as createFocusTrap,xn as createDebugger,Kp as createComponentPool,Jd as createAriaLabel,Xd as createAriaDescription,gi as copyToClipboard,Bp as componentMessages,Jp as clearModuleCache,mn as clearErrorHandler,Je as buttonPropSchema,Cn as assertProp,Fe as assert,ip as aria,sh as applyTheme,Tp as applyHeadwindClasses,fe as applyAnimation,Zd as announceToScreenReader,vp as animateWithClass,Cp as animate,$a as VirtualTable,ya as VirtualList,va as Video,Re as TwoFactorChallenge,ga as Transition,ba as Tooltip,ua as Textarea,Xt as TextInput,pa as Teleport,ca as Tabs,ia as TableRow,oa as TableHeader,ta as TableHead,Qo as TableCell,Xo as TableBody,Yo as Table,ra as TabPanel,Ts as TabBarItem,ks as TabBar,re as THEMED_FAMILIES,Go as Switch,Bs as SubscriptionCheckout,_ as StorageManager,Ko as StepperStep,Vo as Stepper,Wo as Spinner,jo as Skeleton,Ee as Signup,So as SidebarSpaces,Ao as SidebarSpaceSwitcher,$o as SidebarSpace,yo as SidebarSection,vo as SidebarPinned,go as SidebarItem,bo as SidebarHeader,uo as SidebarFooter,po as Sidebar,lo as Select,Cs as SectionCard,Yt as SearchInput,ji as SHADE_VAR_PREFIX,no as RadioGroupOption,ao as RadioGroupLabel,so as RadioGroupDescription,eo as RadioGroup,Zs as Radio,l as PropTypes,Js as Progress,Us as Portal,_s as PopoverPanel,Fs as PopoverButton,Hs as Popover,qs as PaymentMethods,Gt as PasswordInput,Ps as Pagination,Kt as NumberInput,Ds as Notification,Is as Navigator,ws as NavBar,Pe as Login,hs as ListboxOptions,ds as ListboxOption,ls as ListboxLabel,ns as ListboxButton,as as Listbox,xs as ListRow,oi as KeyframeAnimations,Ni as KeyboardShortcuts,tp as KeyboardKeys,we as Installation,Wt as Image,ve as Hero,qt as Form,xe as Footer,ms as FilterChips,fs as FilterChip,R as ErrorTypes,Vt as EmailInput,up as Easing,Rt as DropdownItems,Et as DropdownItem,Pt as DropdownButton,Dt as Dropdown,It as Drawer,Tt as DialogTitle,kt as DialogPanel,Ct as DialogDescription,wt as DialogBackdrop,xt as Dialog,Rs as DefaultPaymentMethod,A as ComponentError,mt as CommandPaletteItem,ft as CommandPalette,ht as ComboboxOptions,dt as ComboboxOption,lt as ComboboxInput,nt as ComboboxButton,at as Combobox,ge as CodeBlock,Es as Checkout,st as Checkbox,et as Card,Ze as Calendar,Ye as Button,q as Breakpoints,He as Breadcrumb,Be as Badge,qe as Avatar,De as Audio,xp as AnimationClasses,Ie as AccordionItem,Te as Accordion};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- var J=import.meta.require;async function K(){try{return(await import("ts-syntax-highlighter")).createHighlighter}catch{return null}}var A=null;function B(b){return`<pre class="syntax"><code>${b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</code></pre>`}async function N(){if(!A){let b=await K();if(!b)throw Error("ts-syntax-highlighter could not be loaded");A=await b({theme:"github-light"})}return A}async function R(b,j={}){let{theme:z="auto",language:k="typescript",lineNumbers:O=!1,wrapLines:P=!0}=j,D;try{D=await N()}catch{return{html:B(b),css:"",language:k,theme:"github-light"}}let E=z==="auto"?globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches?"github-dark":"github-light":z==="dark"?"github-dark":"github-light",F;try{F=await D.highlight(b,k)}catch{return{html:B(b),css:"",language:k,theme:E}}let q=F,G=typeof q==="string"?{html:q,css:""}:{html:q?.html??B(b),css:q?.css??""};return{html:G.html,css:G.css,language:k,theme:E}}function S(b){if(b.includes("<!DOCTYPE")||b.includes("<html"))return"html";if(b.includes("<?php"))return"php";if(b.includes("import")&&b.includes("from"))return"typescript";if(b.includes("function")||b.includes("const"))return"javascript";if(b.includes("{")&&b.includes("}"))return"json";if(b.includes("$")&&b.includes("|"))return"bash";if(b.includes("#")&&b.includes("##"))return"markdown";return"typescript"}function U(b,j){return`<div class="${j?`rounded-md overflow-auto text-sm leading-relaxed font-mono ${j}`:"rounded-md overflow-auto text-sm leading-relaxed font-mono"}">${b}</div>`}export{R as highlight,N as getHighlighter,S as detectLanguage,U as applyHeadwindClasses};
2
+ var J=import.meta.require;async function K(){try{return(await import("ts-syntax-highlighter")).createHighlighter}catch{return null}}var B=null;function D(b){return`<pre class="syntax"><code>${b.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}</code></pre>`}async function N(){if(!B){let b=await K();if(!b)throw Error("ts-syntax-highlighter could not be loaded");B=await b({theme:"github-light"})}return B}async function R(b,j={}){let{theme:A="auto",language:k="typescript",lineNumbers:O=!1,wrapLines:P=!0}=j,q=A==="auto"?globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches?"github-dark":"github-light":A==="dark"?"github-dark":"github-light",E;try{E=await N()}catch{return{html:D(b),css:"",language:k,theme:q}}let F;try{F=await E.highlight(b,k,{theme:q})}catch{return{html:D(b),css:"",language:k,theme:q}}let z=F,G=typeof z==="string"?{html:z,css:""}:{html:z?.html??D(b),css:z?.css??""};return{html:G.html,css:G.css,language:k,theme:q}}function S(b){if(b.includes("<!DOCTYPE")||b.includes("<html"))return"html";if(b.includes("<?php"))return"php";if(b.includes("import")&&b.includes("from"))return"typescript";if(b.includes("function")||b.includes("const"))return"javascript";if(b.includes("{")&&b.includes("}"))return"json";if(b.includes("$")&&b.includes("|"))return"bash";if(b.includes("#")&&b.includes("##"))return"markdown";return"typescript"}function U(b,j){return`<div class="${j?`rounded-md overflow-auto text-sm leading-relaxed font-mono ${j}`:"rounded-md overflow-auto text-sm leading-relaxed font-mono"}">${b}</div>`}export{R as highlight,N as getHighlighter,S as detectLanguage,U as applyHeadwindClasses};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.346",
4
+ "version": "0.2.347",
5
5
  "description": "A modern component library built with STX, featuring headwind utility classes and TypeScript syntax highlighting.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",
@@ -64,8 +64,8 @@
64
64
  "dependencies": {
65
65
  "@iconify-json/f7": "^1.2.2",
66
66
  "@stacksjs/ts-css": "^0.3.2",
67
- "@stacksjs/stx": "0.2.346",
68
- "bun-plugin-stx": "0.2.346",
67
+ "@stacksjs/stx": "0.2.347",
68
+ "bun-plugin-stx": "0.2.347",
69
69
  "ts-syntax-highlighter": "^0.2.17"
70
70
  },
71
71
  "devDependencies": {
@@ -4,8 +4,15 @@ import { applyHeadwindClasses, highlight } from '../utils/highlighter'
4
4
  export const code = $props.code || ''
5
5
  export const language = $props.language || 'typescript'
6
6
  export const theme = $props.theme || 'auto'
7
- export const lineNumbers = $props.lineNumbers !== false
8
- export const copyable = $props.copyable !== false
7
+ /*
8
+ * `$bool`, not `!== false`. A plain attribute arrives as a STRING, so
9
+ * `copyable="false"` was `'false' !== false` - true - and the copy button
10
+ * rendered anyway, which is half of why #2014 looked like a template-gating
11
+ * problem. Same shape as the 103 props in stacksjs/stx#2006; `!== false` is a
12
+ * third spelling of it that the library-wide sweep does not recognise.
13
+ */
14
+ export const lineNumbers = $bool($props.lineNumbers, true)
15
+ export const copyable = $bool($props.copyable, true)
9
16
  export const className = $props.className || ''
10
17
 
11
18
  const result = await highlight(code, { language, theme, lineNumbers })
@@ -16,10 +23,41 @@ export const highlightedCode = applyHeadwindClasses(result.html, className)
16
23
  // before interpolation runs, so emitting it here ships an empty tag. Until that
17
24
  // is fixed in stx, an app includes this itself (or sets its own token styles).
18
25
  export const highlightCss = result.css
26
+
27
+ /*
28
+ * The clipboard payload, decided on the SERVER.
29
+ *
30
+ * `{{ copyable ? code : '' }}` in the client script does not work:
31
+ * interpolateScriptExpressions resolves an identifier or a property path, not
32
+ * an arbitrary expression, so a ternary emits nothing at all (#1989) and the
33
+ * declaration came out as a bare `const code = `. A named export is a plain
34
+ * identifier, which is what the interpolator can resolve.
35
+ */
36
+ export const copyPayload = copyable ? code : ''
19
37
  </script>
20
38
 
21
39
  <script client>
22
- const code = {{ code }}
40
+ /*
41
+ * The code is shipped to the browser only when there is a copy button to need
42
+ * it (stacksjs/stx#2014).
43
+ *
44
+ * This was an unconditional `const code = {{ code }}`, while `copyable` gated
45
+ * only the button in the template - so `:copyable="false"` still emitted the
46
+ * full snippet as page JavaScript. An app whose blocks are install commands
47
+ * carrying a per-resource credential had no way to render one without that,
48
+ * which defeats an invariant it maintains deliberately: stx's own
49
+ * extractBridgeData skips `__` and `$` names, and `:code="__agentInstall.install"`
50
+ * routed straight around it. In the ordinary case it was dead weight - a block
51
+ * with no copy button shipping a duplicate of its own content.
52
+ *
53
+ * Reading the text out of the DOM at click time would drop the payload for
54
+ * everyone, which the report suggests and which I measured before rejecting:
55
+ * the highlighter renders line numbers as TEXT, so once `lineNumbers` is
56
+ * honoured (it is currently accepted and dropped) `textContent` copies
57
+ * "1const a = 1" rather than the code. Gating is the version that cannot
58
+ * silently corrupt what lands on the clipboard.
59
+ */
60
+ const code = {{ copyPayload }}
23
61
  const copied = state(false)
24
62
 
25
63
  async function copyToClipboard() {
@@ -40,7 +78,18 @@ async function copyToClipboard() {
40
78
  @if(copyable)
41
79
  <button
42
80
  @click="copyToClipboard()"
43
- class="absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 px-3 py-1.5 bg-neutral-800 hover:bg-neutral-700 text-white text-xs rounded-panel font-medium"
81
+ {{-- Reachable without a mouse (#2014). It was `opacity-0
82
+ group-hover:opacity-100` with no focus variant, so a keyboard user
83
+ who tabbed to it saw nothing and on a touch device it never appeared
84
+ at all - the control was there, took focus, and was invisible.
85
+
86
+ `focus-visible:opacity-100` fixes the keyboard half. The touch half
87
+ cannot be done with a hover variant, and the engine has no
88
+ `@media (hover: none)` variant to hang it on, so the button is now
89
+ always present at 60% and comes to full opacity on hover or focus.
90
+ That is a visible change - the button no longer hides until pointed
91
+ at - and it is the only arrangement that is operable on a phone. --}}
92
+ class="absolute top-2 right-2 opacity-60 group-hover:opacity-100 focus-visible:opacity-100 transition-opacity duration-200 px-3 py-1.5 bg-neutral-800 hover:bg-neutral-700 text-white text-xs rounded-panel font-medium"
44
93
  aria-label="Copy code"
45
94
  >
46
95
  <span :show="copied()" class="flex items-center gap-1.5">
@@ -75,6 +75,30 @@ export async function highlight(
75
75
  wrapLines: _wrapLines = true,
76
76
  } = options
77
77
 
78
+ /*
79
+ * Resolved before anything can return, so every exit reports the theme that
80
+ * was asked for.
81
+ *
82
+ * It used to be computed after the load guard below, which returned a
83
+ * hardcoded `github-light` on that path: a caller asking for dark and getting
84
+ * the plain-text floor was told it got light, which is a second untruth on
85
+ * top of the first (stacksjs/stx#2015).
86
+ *
87
+ * `auto` still resolves light on a server. `highlight()` is called from
88
+ * `<script server>`, where `globalThis.matchMedia` does not exist, and a
89
+ * viewer's preference is not knowable at render time anyway. Selecting a
90
+ * palette in JS cannot answer that question; emitting both and letting CSS
91
+ * choose can, and is not possible yet because this highlighter writes token
92
+ * colours as inline `style` attributes on each span rather than through its
93
+ * token classes, so no media query can override them. Its `renderDualTheme`
94
+ * is the right shape for it and takes `TokenLine[]`, which no public method
95
+ * returns. Tracked on the issue; `theme: 'dark'` is the explicit escape until
96
+ * then.
97
+ */
98
+ const effectiveTheme = theme === 'auto'
99
+ ? (globalThis.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'github-dark' : 'github-light')
100
+ : theme === 'dark' ? 'github-dark' : 'github-light'
101
+
78
102
  // A highlighter that cannot load must not take the code with it. Highlighting
79
103
  // is decoration; the code is the content. ts-syntax-highlighter@0.2.17 ships a
80
104
  // bundle that imports `bunfig` while declaring no dependencies, so it throws
@@ -86,14 +110,9 @@ export async function highlight(
86
110
  highlighter = await getHighlighter()
87
111
  }
88
112
  catch {
89
- return { html: plainCodeHtml(code), css: '', language, theme: 'github-light' }
113
+ return { html: plainCodeHtml(code), css: '', language, theme: effectiveTheme }
90
114
  }
91
115
 
92
- // Auto-detect theme based on system preference
93
- const effectiveTheme = theme === 'auto'
94
- ? (globalThis.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'github-dark' : 'github-light')
95
- : theme === 'dark' ? 'github-dark' : 'github-light'
96
-
97
116
  // ts-syntax-highlighter returns { html, css, tokens, ansi }. This read the
98
117
  // whole result as if it were the HTML string, and the `String(...)` meant to
99
118
  // be defensive turned the object into the literal text [object Object] --
@@ -101,7 +120,12 @@ export async function highlight(
101
120
  // that stringifies anything cannot tell a wrong shape from a right one.
102
121
  let result: unknown
103
122
  try {
104
- result = await highlighter.highlight(code, language)
123
+ // The theme belongs here. It was resolved above and then dropped, so every
124
+ // render came from the instance's own `github-light` and every CodeBlock in
125
+ // every app was light whatever it asked for, while the returned `theme`
126
+ // field reported the request. `RenderOptions.theme` overrides the instance
127
+ // per call, which is what keeps one shared highlighter usable for both.
128
+ result = await highlighter.highlight(code, language, { theme: effectiveTheme })
105
129
  }
106
130
  catch {
107
131
  return { html: plainCodeHtml(code), css: '', language, theme: effectiveTheme }