@stacksjs/components 0.2.357 → 0.2.359

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.
@@ -64,7 +64,7 @@ function onRecoveryCode(event) {
64
64
  </label>
65
65
  <form @submit="onSubmit($event)">
66
66
  <div class="mt-2 flex rounded-control shadow-sm space-x-2">
67
- @for(i in Array(codeLength).keys())
67
+ @for(let i = 0; i < codeLength; i++)
68
68
  <input
69
69
  id="code-{{ i }}"
70
70
  type="text"
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  var we=import.meta.require;var ye={__stx:!0,src:"./components/CodeBlock.stx"};var Ce={__stx:!0,src:"./components/Footer.stx"};var $e={__stx:!0,src:"./components/Hero.stx"};var ke={__stx:!0,src:"./components/Installation.stx"};function Nn(e){let{code:t,onSuccess:s,onError:o,timeout:a=2000}=e,n=!1,i=null;return{copied:n,copy:async()=>{try{if(!navigator.clipboard)throw Error("Clipboard API not available");await navigator.clipboard.writeText(t),n=!0,s?.(),i=setTimeout(()=>{n=!1,i=null},a)}catch(d){let h=d instanceof Error?d:Error("Failed to copy code");o?.(h),console.error("Failed to copy code:",h)}},reset:()=>{if(n=!1,i)clearTimeout(i),i=null}}}async function En(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){return console.error("Failed to copy to clipboard:",t),!1}}function Se(){if(typeof window>"u")return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Q(e){return e==="system"?Se():e}function zn(e={}){let{storageKey:t="theme",defaultTheme:s="system"}=e,o=s;if(typeof window<"u"&&typeof localStorage<"u"){let c=localStorage.getItem(t);if(c)o=c}let a=Q(o)==="dark",n=(c)=>{let d=Q(c);if(typeof document<"u")if(d==="dark")document.documentElement.classList.add("dark");else document.documentElement.classList.remove("dark");if(typeof localStorage<"u")localStorage.setItem(t,c)},i=(c)=>{o=c,n(c)},r=()=>{let d=Q(o)==="dark"?"light":"dark";i(d)};if(n(o),typeof window<"u"&&o==="system")window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(c)=>{if(o==="system")n("system")});return{isDark:a,theme:o,toggle:r,setTheme:i}}function Te(e,t){if(typeof document>"u")return;document.title=t?t.replace("%s",e):e}function S(e,t,s=!1){if(typeof document>"u")return;let o=s?"property":"name",a=document.querySelector(`meta[${o}="${e}"]`);if(!a)a=document.createElement("meta"),a.setAttribute(o,e),document.head.appendChild(a);a.setAttribute("content",t)}function Ie(e,t){if(typeof document>"u")return;let s=document.querySelector(`link[rel="${e}"]`);if(!s)s=document.createElement("link"),s.setAttribute("rel",e),document.head.appendChild(s);s.setAttribute("href",t)}function Pn(e){let{title:t,description:s,author:o,keywords:a,ogImage:n,ogImageWidth:i,ogImageHeight:r,twitterCard:c="summary_large_image",twitterSite:d,twitterCreator:h,canonical:p}=e;if(t)Te(t),S("og:title",t,!0),S("twitter:title",t);if(s)S("description",s),S("og:description",s,!0),S("twitter:description",s);if(o)S("author",o);if(a&&a.length>0)S("keywords",a.join(", "));if(n)S("og:image",n,!0),S("twitter:image",n);if(i)S("og:image:width",i,!0);if(r)S("og:image:height",r,!0);if(S("twitter:card",c),d)S("twitter:site",d);if(h)S("twitter:creator",h);if(p)Ie("canonical",p);if(S("og:type","website",!0),typeof window<"u")S("og:url",window.location.href,!0)}function Mn(e){let t=[],{title:s,description:o,author:a,keywords:n,ogImage:i,ogImageWidth:r,ogImageHeight:c,twitterCard:d="summary_large_image",twitterSite:h,twitterCreator:p,canonical:b}=e;if(s)t.push(`<title>${T(s)}</title>`),t.push(`<meta property="og:title" content="${T(s)}" />`),t.push(`<meta name="twitter:title" content="${T(s)}" />`);if(o)t.push(`<meta name="description" content="${T(o)}" />`),t.push(`<meta property="og:description" content="${T(o)}" />`),t.push(`<meta name="twitter:description" content="${T(o)}" />`);if(a)t.push(`<meta name="author" content="${T(a)}" />`);if(n&&n.length>0)t.push(`<meta name="keywords" content="${T(n.join(", "))}" />`);if(i)t.push(`<meta property="og:image" content="${T(i)}" />`),t.push(`<meta name="twitter:image" content="${T(i)}" />`);if(r)t.push(`<meta property="og:image:width" content="${T(r)}" />`);if(c)t.push(`<meta property="og:image:height" content="${T(c)}" />`);if(t.push(`<meta name="twitter:card" content="${T(d)}" />`),h)t.push(`<meta name="twitter:site" content="${T(h)}" />`);if(p)t.push(`<meta name="twitter:creator" content="${T(p)}" />`);if(b)t.push(`<link rel="canonical" href="${T(b)}" />`);return t.push('<meta property="og:type" content="website" />'),t.join(`
3
- `)}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function jn(e,t,s={}){let{enabled:o=!0,ignore:a=[]}=s,n=(i)=>{if(!o||!e)return;let r=i.target;if(!e.contains(r)){if(!a.some((d)=>{let h=document.querySelectorAll(d);return Array.from(h).some((p)=>p.contains(r))}))t(i)}};if(typeof document<"u")document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);return()=>{if(typeof document<"u")document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}}function Bn(e,t={}){let{enabled:s=!0,initialFocus:o=null,returnFocus:a=!0,fallbackFocus:n=null}=t,i=null,r=!1;function c(){if(!e)return[];let f=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(f))}function d(f){if(!s||!r||!e)return;let w=c();if(w.length===0){f.preventDefault();return}let y=w[0],v=w[w.length-1];if(f.shiftKey){if(document.activeElement===y||document.activeElement===e)f.preventDefault(),v.focus()}else if(document.activeElement===v)f.preventDefault(),y.focus()}function h(f){if(f.key==="Escape"&&s&&r)b()}function p(){if(!s||!e||r)return;if(i=document.activeElement,o)o.focus();else{let f=c();if(f.length>0)f[0].focus();else if(n)n.focus();else e.focus()}document.addEventListener("keydown",d),document.addEventListener("keydown",h),r=!0}function b(){if(!r)return;if(document.removeEventListener("keydown",d),document.removeEventListener("keydown",h),a&&i)i.focus();r=!1}return{activate:p,deactivate:b}}function Hn(e,t={}){let{enabled:s=!0,preventDefault:o=!0,stopPropagation:a=!1,target:n=typeof document<"u"?document:null}=t,i=Array.isArray(e)?e:[e],r=(c)=>{if(!s)return;i.forEach((d)=>{if(!(Array.isArray(d.key)?d.key:[d.key]).some((b)=>b.toLowerCase()===c.key.toLowerCase()))return;if(d.ctrl!==void 0&&d.ctrl!==c.ctrlKey)return;if(d.shift!==void 0&&d.shift!==c.shiftKey)return;if(d.alt!==void 0&&d.alt!==c.altKey)return;if(d.meta!==void 0&&d.meta!==c.metaKey)return;if(o)c.preventDefault();if(a)c.stopPropagation();d.handler(c)})};if(n)n.addEventListener("keydown",r);return()=>{if(n)n.removeEventListener("keydown",r)}}var Vn={ESCAPE:"Escape",ENTER:"Enter",SPACE:" ",TAB:"Tab",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",HOME:"Home",END:"End",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown"};function _n(e,t,s={}){let{serializer:o=JSON.stringify,deserializer:a=JSON.parse,onError:n=console.error}=s,i=t;try{if(typeof window<"u"){let p=window.localStorage.getItem(e);if(p!==null)i=a(p)}}catch(p){n(p)}let r=i,c=new Set;function d(p){try{let b=typeof p==="function"?p(r):p;if(r=b,typeof window<"u")window.localStorage.setItem(e,o(b));c.forEach((f)=>f(b))}catch(b){n(b)}}function h(){try{if(r=t,typeof window<"u")window.localStorage.removeItem(e);c.forEach((p)=>p(t))}catch(p){n(p)}}if(typeof window<"u"){let p=(b)=>{if(b.key===e&&b.newValue!==null)try{let f=a(b.newValue);r=f,c.forEach((w)=>w(f))}catch(f){n(f)}else if(b.key===e&&b.newValue===null)r=t,c.forEach((f)=>f(t))};window.addEventListener("storage",p)}return{value:r,setValue:d,removeValue:h}}function R(e,t={}){let{defaultValue:s=!1}=t,o=s,a=null;if(typeof window<"u"&&"matchMedia"in window){a=window.matchMedia(e),o=a.matches;let i=(r)=>{o=r.matches};if(a.addEventListener)a.addEventListener("change",i);else a.addListener(i)}function n(){if(a)o=a.matches}return{matches:o,updateMatches:n}}var j={xs:"(min-width: 320px)",sm:"(min-width: 640px)",md:"(min-width: 768px)",lg:"(min-width: 1024px)",xl:"(min-width: 1280px)","2xl":"(min-width: 1536px)",mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)",dark:"(prefers-color-scheme: dark)",light:"(prefers-color-scheme: light)",reducedMotion:"(prefers-reduced-motion: reduce)",portrait:"(orientation: portrait)",landscape:"(orientation: landscape)"};function Gn(e){return R(j[e])}function Un(){return R(j.mobile)}function Yn(){return R(j.desktop)}function Jn(){return R(j.dark)}function Xn(){return R(j.reducedMotion)}var re=["gray","neutral","slate","zinc","red","green","yellow","blue","indigo"],Qn="--stx-color";function Ae(e,t){return t===void 0?`var(${e})`:`var(${e}, ${t})`}function ei(e={}){let t={};for(let s of re){let o=e[s];if(!o||typeof o==="string")continue;let a={};for(let[n,i]of Object.entries(o))a[n]=Ae(`--stx-color-${s}-${n}`,i);t[s]=a}return t}function ti(e={}){let t=[];for(let s of re){let o=e[s];if(!o||typeof o==="string")continue;for(let a of Object.keys(o))t.push(`--stx-color-${s}-${a}`)}return t}var Ne="./Accordion-py9ntmst.stx";var Le="./AccordionItem-asmsqxz9.stx";var Oe="./Audio-byv8kkvt.stx";var Me="./Login-j3pc04ka.stx";var je="./Signup-77y9ea7t.stx";var Be="./TwoFactorChallenge-n8fcm5ct.stx";var He="./Avatar-axrzqsdk.stx";var Fe="./Badge-4jxqhkv9.stx";var Ke="./Breadcrumb-pach6f1f.stx";import q from"process";var Ge="https://stacksjs.com/components";class I extends Error{component;context;constructor(e,t,s={}){let o=I.formatMessage(e,t,s);super(o);if(this.name="ComponentError",this.component=e,this.context={component:e,...s},Error.captureStackTrace)Error.captureStackTrace(this,I)}static formatMessage(e,t,s){let o=`[${e}] ${t}`;if(s.prop)o+=`
3
+ `)}function T(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function jn(e,t,s={}){let{enabled:o=!0,ignore:a=[]}=s,n=(i)=>{if(!o||!e)return;let r=i.target;if(!e.contains(r)){if(!a.some((d)=>{let h=document.querySelectorAll(d);return Array.from(h).some((p)=>p.contains(r))}))t(i)}};if(typeof document<"u")document.addEventListener("mousedown",n),document.addEventListener("touchstart",n);return()=>{if(typeof document<"u")document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n)}}function Bn(e,t={}){let{enabled:s=!0,initialFocus:o=null,returnFocus:a=!0,fallbackFocus:n=null}=t,i=null,r=!1;function c(){if(!e)return[];let f=["a[href]","button:not([disabled])","textarea:not([disabled])","input:not([disabled])","select:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(e.querySelectorAll(f))}function d(f){if(!s||!r||!e)return;let w=c();if(w.length===0){f.preventDefault();return}let y=w[0],v=w[w.length-1];if(f.shiftKey){if(document.activeElement===y||document.activeElement===e)f.preventDefault(),v.focus()}else if(document.activeElement===v)f.preventDefault(),y.focus()}function h(f){if(f.key==="Escape"&&s&&r)b()}function p(){if(!s||!e||r)return;if(i=document.activeElement,o)o.focus();else{let f=c();if(f.length>0)f[0].focus();else if(n)n.focus();else e.focus()}document.addEventListener("keydown",d),document.addEventListener("keydown",h),r=!0}function b(){if(!r)return;if(document.removeEventListener("keydown",d),document.removeEventListener("keydown",h),a&&i)i.focus();r=!1}return{activate:p,deactivate:b}}function Hn(e,t={}){let{enabled:s=!0,preventDefault:o=!0,stopPropagation:a=!1,target:n=typeof document<"u"?document:null}=t,i=Array.isArray(e)?e:[e],r=(c)=>{if(!s)return;i.forEach((d)=>{if(!(Array.isArray(d.key)?d.key:[d.key]).some((b)=>b.toLowerCase()===c.key.toLowerCase()))return;if(d.ctrl!==void 0&&d.ctrl!==c.ctrlKey)return;if(d.shift!==void 0&&d.shift!==c.shiftKey)return;if(d.alt!==void 0&&d.alt!==c.altKey)return;if(d.meta!==void 0&&d.meta!==c.metaKey)return;if(o)c.preventDefault();if(a)c.stopPropagation();d.handler(c)})};if(n)n.addEventListener("keydown",r);return()=>{if(n)n.removeEventListener("keydown",r)}}var Vn={ESCAPE:"Escape",ENTER:"Enter",SPACE:" ",TAB:"Tab",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",ARROW_LEFT:"ArrowLeft",ARROW_RIGHT:"ArrowRight",HOME:"Home",END:"End",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown"};function _n(e,t,s={}){let{serializer:o=JSON.stringify,deserializer:a=JSON.parse,onError:n=console.error}=s,i=t;try{if(typeof window<"u"){let p=window.localStorage.getItem(e);if(p!==null)i=a(p)}}catch(p){n(p)}let r=i,c=new Set;function d(p){try{let b=typeof p==="function"?p(r):p;if(r=b,typeof window<"u")window.localStorage.setItem(e,o(b));c.forEach((f)=>f(b))}catch(b){n(b)}}function h(){try{if(r=t,typeof window<"u")window.localStorage.removeItem(e);c.forEach((p)=>p(t))}catch(p){n(p)}}if(typeof window<"u"){let p=(b)=>{if(b.key===e&&b.newValue!==null)try{let f=a(b.newValue);r=f,c.forEach((w)=>w(f))}catch(f){n(f)}else if(b.key===e&&b.newValue===null)r=t,c.forEach((f)=>f(t))};window.addEventListener("storage",p)}return{value:r,setValue:d,removeValue:h}}function R(e,t={}){let{defaultValue:s=!1}=t,o=s,a=null;if(typeof window<"u"&&"matchMedia"in window){a=window.matchMedia(e),o=a.matches;let i=(r)=>{o=r.matches};if(a.addEventListener)a.addEventListener("change",i);else a.addListener(i)}function n(){if(a)o=a.matches}return{matches:o,updateMatches:n}}var j={xs:"(min-width: 320px)",sm:"(min-width: 640px)",md:"(min-width: 768px)",lg:"(min-width: 1024px)",xl:"(min-width: 1280px)","2xl":"(min-width: 1536px)",mobile:"(max-width: 767px)",tablet:"(min-width: 768px) and (max-width: 1023px)",desktop:"(min-width: 1024px)",dark:"(prefers-color-scheme: dark)",light:"(prefers-color-scheme: light)",reducedMotion:"(prefers-reduced-motion: reduce)",portrait:"(orientation: portrait)",landscape:"(orientation: landscape)"};function Gn(e){return R(j[e])}function Un(){return R(j.mobile)}function Yn(){return R(j.desktop)}function Jn(){return R(j.dark)}function Xn(){return R(j.reducedMotion)}var re=["gray","neutral","slate","zinc","red","green","yellow","blue","indigo"],Qn="--stx-color";function Ae(e,t){return t===void 0?`var(${e})`:`var(${e}, ${t})`}function ei(e={}){let t={};for(let s of re){let o=e[s];if(!o||typeof o==="string")continue;let a={};for(let[n,i]of Object.entries(o))a[n]=Ae(`--stx-color-${s}-${n}`,i);t[s]=a}return t}function ti(e={}){let t=[];for(let s of re){let o=e[s];if(!o||typeof o==="string")continue;for(let a of Object.keys(o))t.push(`--stx-color-${s}-${a}`)}return t}var Ne="./Accordion-py9ntmst.stx";var Le="./AccordionItem-asmsqxz9.stx";var Oe="./Audio-byv8kkvt.stx";var Me="./Login-j3pc04ka.stx";var je="./Signup-77y9ea7t.stx";var Be="./TwoFactorChallenge-28px8pyk.stx";var He="./Avatar-axrzqsdk.stx";var Fe="./Badge-4jxqhkv9.stx";var Ke="./Breadcrumb-pach6f1f.stx";import q from"process";var Ge="https://stacksjs.com/components";class I extends Error{component;context;constructor(e,t,s={}){let o=I.formatMessage(e,t,s);super(o);if(this.name="ComponentError",this.component=e,this.context={component:e,...s},Error.captureStackTrace)Error.captureStackTrace(this,I)}static formatMessage(e,t,s){let o=`[${e}] ${t}`;if(s.prop)o+=`
4
4
  Prop: "${s.prop}"`;if(s.received!==void 0)o+=`
5
5
  Received: ${JSON.stringify(s.received)}`;if(s.expected!==void 0){let a=Array.isArray(s.expected)?s.expected.map((n)=>JSON.stringify(n)).join(", "):JSON.stringify(s.expected);o+=`
6
6
  Expected: ${a}`}if(s.details)o+=`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/components",
3
3
  "type": "module",
4
- "version": "0.2.357",
4
+ "version": "0.2.359",
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.357",
68
- "bun-plugin-stx": "0.2.357",
67
+ "@stacksjs/stx": "0.2.359",
68
+ "bun-plugin-stx": "0.2.359",
69
69
  "ts-syntax-highlighter": "^0.2.17"
70
70
  },
71
71
  "devDependencies": {
@@ -64,7 +64,7 @@ function onRecoveryCode(event) {
64
64
  </label>
65
65
  <form @submit="onSubmit($event)">
66
66
  <div class="mt-2 flex rounded-control shadow-sm space-x-2">
67
- @for(i in Array(codeLength).keys())
67
+ @for(let i = 0; i < codeLength; i++)
68
68
  <input
69
69
  id="code-{{ i }}"
70
70
  type="text"