@stacksjs/components 0.2.460 → 0.2.461
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.
|
@@ -34,7 +34,7 @@ const statusColorClasses = {
|
|
|
34
34
|
busy: 'bg-danger',
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export const containerClasses = `relative inline-
|
|
37
|
+
export const containerClasses = `relative inline-flex shrink-0 align-top ${className}`.trim()
|
|
38
38
|
export const avatarClasses = `flex items-center justify-center overflow-hidden bg-surface-sunken ${sizeClasses[size] || sizeClasses.md} ${shapeClasses[shape] || shapeClasses.circle}`.trim()
|
|
39
39
|
export const imageClasses = `w-full h-full object-cover`.trim()
|
|
40
40
|
export const initialsClasses = `font-medium text-fg-muted uppercase select-none`.trim()
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
var _e={__stx:!0,src:"./components/CodeBlock.stx"};var Ue={__stx:!0,src:"./components/Footer.stx"};var Je={__stx:!0,src:"./components/Hero.stx"};var Ge={__stx:!0,src:"./components/Installation.stx"};function dr(e){let{code:t,onSuccess:s,onError:o,timeout:n=2000}=e,a=!1,r=null;return{copied:a,copy:async()=>{try{if(!navigator.clipboard)throw Error("Clipboard API not available");await navigator.clipboard.writeText(t),a=!0,s?.(),r=setTimeout(()=>{a=!1,r=null},n)}catch(p){let u=p instanceof Error?p:Error("Failed to copy code");o?.(u),console.error("Failed to copy code:",u)}},reset:()=>{if(a=!1,r)clearTimeout(r),r=null}}}async function pr(e){try{return await navigator.clipboard.writeText(e),!0}catch(t){return console.error("Failed to copy to clipboard:",t),!1}}function Ye(){if(typeof window>"u")return"light";return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function xe(e){return e==="system"?Ye():e}function hr(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 n=xe(o)==="dark",a=(c)=>{let p=xe(c);if(typeof document<"u")if(p==="dark")document.documentElement.classList.add("dark");else document.documentElement.classList.remove("dark");if(typeof localStorage<"u")localStorage.setItem(t,c)},r=(c)=>{o=c,a(c)},i=()=>{let p=xe(o)==="dark"?"light":"dark";r(p)};if(a(o),typeof window<"u"&&o==="system")window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",(c)=>{if(o==="system")a("system")});return{isDark:n,theme:o,toggle:i,setTheme:r}}function Xe(e,t){if(typeof document>"u")return;document.title=t?t.replace("%s",e):e}function O(e,t,s=!1){if(typeof document>"u")return;let o=s?"property":"name",n=document.querySelector(`meta[${o}="${e}"]`);if(!n)n=document.createElement("meta"),n.setAttribute(o,e),document.head.appendChild(n);n.setAttribute("content",t)}function Qe(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 mr(e){let{title:t,description:s,author:o,keywords:n,ogImage:a,ogImageWidth:r,ogImageHeight:i,twitterCard:c="summary_large_image",twitterSite:p,twitterCreator:u,canonical:d}=e;if(t)Xe(t),O("og:title",t,!0),O("twitter:title",t);if(s)O("description",s),O("og:description",s,!0),O("twitter:description",s);if(o)O("author",o);if(n&&n.length>0)O("keywords",n.join(", "));if(a)O("og:image",a,!0),O("twitter:image",a);if(r)O("og:image:width",r,!0);if(i)O("og:image:height",i,!0);if(O("twitter:card",c),p)O("twitter:site",p);if(u)O("twitter:creator",u);if(d)Qe("canonical",d);if(O("og:type","website",!0),typeof window<"u")O("og:url",window.location.href,!0)}function gr(e){let t=[],{title:s,description:o,author:n,keywords:a,ogImage:r,ogImageWidth:i,ogImageHeight:c,twitterCard:p="summary_large_image",twitterSite:u,twitterCreator:d,canonical:g}=e;if(s)t.push(`<title>${N(s)}</title>`),t.push(`<meta property="og:title" content="${N(s)}" />`),t.push(`<meta name="twitter:title" content="${N(s)}" />`);if(o)t.push(`<meta name="description" content="${N(o)}" />`),t.push(`<meta property="og:description" content="${N(o)}" />`),t.push(`<meta name="twitter:description" content="${N(o)}" />`);if(n)t.push(`<meta name="author" content="${N(n)}" />`);if(a&&a.length>0)t.push(`<meta name="keywords" content="${N(a.join(", "))}" />`);if(r)t.push(`<meta property="og:image" content="${N(r)}" />`),t.push(`<meta name="twitter:image" content="${N(r)}" />`);if(i)t.push(`<meta property="og:image:width" content="${N(i)}" />`);if(c)t.push(`<meta property="og:image:height" content="${N(c)}" />`);if(t.push(`<meta name="twitter:card" content="${N(p)}" />`),u)t.push(`<meta name="twitter:site" content="${N(u)}" />`);if(d)t.push(`<meta name="twitter:creator" content="${N(d)}" />`);if(g)t.push(`<link rel="canonical" href="${N(g)}" />`);return t.push('<meta property="og:type" content="website" />'),t.join(`
|
|
3
|
-
`)}function N(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function xr(e,t,s={}){let{enabled:o=!0,ignore:n=[]}=s,a=(r)=>{if(!o||!e)return;let i=r.target;if(!e.contains(i)){if(!n.some((p)=>{let u=document.querySelectorAll(p);return Array.from(u).some((d)=>d.contains(i))}))t(r)}};if(typeof document<"u")document.addEventListener("mousedown",a),document.addEventListener("touchstart",a);return()=>{if(typeof document<"u")document.removeEventListener("mousedown",a),document.removeEventListener("touchstart",a)}}function wr(e,t={}){let{enabled:s=!0,initialFocus:o=null,returnFocus:n=!0,fallbackFocus:a=null}=t,r=null,i=!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 p(f){if(!s||!i||!e)return;let y=c();if(y.length===0){f.preventDefault();return}let C=y[0],k=y[y.length-1];if(f.shiftKey){if(document.activeElement===C||document.activeElement===e)f.preventDefault(),k.focus()}else if(document.activeElement===k)f.preventDefault(),C.focus()}function u(f){if(f.key==="Escape"&&s&&i)g()}function d(){if(!s||!e||i)return;if(r=document.activeElement,o)o.focus();else{let f=c();if(f.length>0)f[0].focus();else if(a)a.focus();else e.focus()}document.addEventListener("keydown",p),document.addEventListener("keydown",u),i=!0}function g(){if(!i)return;if(document.removeEventListener("keydown",p),document.removeEventListener("keydown",u),n&&r)r.focus();i=!1}return{activate:d,deactivate:g}}function kr(e,t={}){let{enabled:s=!0,preventDefault:o=!0,stopPropagation:n=!1,target:a=typeof document<"u"?document:null}=t,r=Array.isArray(e)?e:[e],i=(c)=>{if(!s)return;r.forEach((p)=>{if(!(Array.isArray(p.key)?p.key:[p.key]).some((g)=>g.toLowerCase()===c.key.toLowerCase()))return;if(p.ctrl!==void 0&&p.ctrl!==c.ctrlKey)return;if(p.shift!==void 0&&p.shift!==c.shiftKey)return;if(p.alt!==void 0&&p.alt!==c.altKey)return;if(p.meta!==void 0&&p.meta!==c.metaKey)return;if(o)c.preventDefault();if(n)c.stopPropagation();p.handler(c)})};if(a)a.addEventListener("keydown",i);return()=>{if(a)a.removeEventListener("keydown",i)}}var Cr={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 Sr(e,t,s={}){let{serializer:o=JSON.stringify,deserializer:n=JSON.parse,onError:a=console.error}=s,r=t;try{if(typeof window<"u"){let d=window.localStorage.getItem(e);if(d!==null)r=n(d)}}catch(d){a(d)}let i=r,c=new Set;function p(d){try{let g=typeof d==="function"?d(i):d;if(i=g,typeof window<"u")window.localStorage.setItem(e,o(g));c.forEach((f)=>f(g))}catch(g){a(g)}}function u(){try{if(i=t,typeof window<"u")window.localStorage.removeItem(e);c.forEach((d)=>d(t))}catch(d){a(d)}}if(typeof window<"u"){let d=(g)=>{if(g.key===e&&g.newValue!==null)try{let f=n(g.newValue);i=f,c.forEach((y)=>y(f))}catch(f){a(f)}else if(g.key===e&&g.newValue===null)i=t,c.forEach((f)=>f(t))};window.addEventListener("storage",d)}return{value:i,setValue:p,removeValue:u}}function Y(e,t={}){let{defaultValue:s=!1}=t,o=s,n=null;if(typeof window<"u"&&"matchMedia"in window){n=window.matchMedia(e),o=n.matches;let r=(i)=>{o=i.matches};if(n.addEventListener)n.addEventListener("change",r);else n.addListener(r)}function a(){if(n)o=n.matches}return{matches:o,updateMatches:a}}var X={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 Tr(e){return Y(X[e])}function Ir(){return Y(X.mobile)}function Ar(){return Y(X.desktop)}function Pr(){return Y(X.dark)}function Lr(){return Y(X.reducedMotion)}var Ie=["gray","neutral","slate","zinc","red","green","yellow","blue","indigo"],Nr="--stx-color";function Ze(e,t){return t===void 0?`var(${e})`:`var(${e}, ${t})`}function Dr(e={}){let t={};for(let s of Ie){let o=e[s];if(!o||typeof o==="string")continue;let n={};for(let[a,r]of Object.entries(o))n[a]=Ze(`--stx-color-${s}-${a}`,r);t[s]=n}return t}function Mr(e={}){let t=[];for(let s of Ie){let o=e[s];if(!o||typeof o==="string")continue;for(let n of Object.keys(o))t.push(`--stx-color-${s}-${n}`)}return t}var tt="./Accordion-ehpymjam.stx";var ot="./AccordionItem-fc4ekdqf.stx";var at="./Audio-byv8kkvt.stx";var it="./Login-4666t7j4.stx";var ct="./Signup-pm2r0f2m.stx";var pt="./TwoFactorChallenge-3tsbfdsd.stx";var ht="./Avatar-
|
|
3
|
+
`)}function N(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function xr(e,t,s={}){let{enabled:o=!0,ignore:n=[]}=s,a=(r)=>{if(!o||!e)return;let i=r.target;if(!e.contains(i)){if(!n.some((p)=>{let u=document.querySelectorAll(p);return Array.from(u).some((d)=>d.contains(i))}))t(r)}};if(typeof document<"u")document.addEventListener("mousedown",a),document.addEventListener("touchstart",a);return()=>{if(typeof document<"u")document.removeEventListener("mousedown",a),document.removeEventListener("touchstart",a)}}function wr(e,t={}){let{enabled:s=!0,initialFocus:o=null,returnFocus:n=!0,fallbackFocus:a=null}=t,r=null,i=!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 p(f){if(!s||!i||!e)return;let y=c();if(y.length===0){f.preventDefault();return}let C=y[0],k=y[y.length-1];if(f.shiftKey){if(document.activeElement===C||document.activeElement===e)f.preventDefault(),k.focus()}else if(document.activeElement===k)f.preventDefault(),C.focus()}function u(f){if(f.key==="Escape"&&s&&i)g()}function d(){if(!s||!e||i)return;if(r=document.activeElement,o)o.focus();else{let f=c();if(f.length>0)f[0].focus();else if(a)a.focus();else e.focus()}document.addEventListener("keydown",p),document.addEventListener("keydown",u),i=!0}function g(){if(!i)return;if(document.removeEventListener("keydown",p),document.removeEventListener("keydown",u),n&&r)r.focus();i=!1}return{activate:d,deactivate:g}}function kr(e,t={}){let{enabled:s=!0,preventDefault:o=!0,stopPropagation:n=!1,target:a=typeof document<"u"?document:null}=t,r=Array.isArray(e)?e:[e],i=(c)=>{if(!s)return;r.forEach((p)=>{if(!(Array.isArray(p.key)?p.key:[p.key]).some((g)=>g.toLowerCase()===c.key.toLowerCase()))return;if(p.ctrl!==void 0&&p.ctrl!==c.ctrlKey)return;if(p.shift!==void 0&&p.shift!==c.shiftKey)return;if(p.alt!==void 0&&p.alt!==c.altKey)return;if(p.meta!==void 0&&p.meta!==c.metaKey)return;if(o)c.preventDefault();if(n)c.stopPropagation();p.handler(c)})};if(a)a.addEventListener("keydown",i);return()=>{if(a)a.removeEventListener("keydown",i)}}var Cr={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 Sr(e,t,s={}){let{serializer:o=JSON.stringify,deserializer:n=JSON.parse,onError:a=console.error}=s,r=t;try{if(typeof window<"u"){let d=window.localStorage.getItem(e);if(d!==null)r=n(d)}}catch(d){a(d)}let i=r,c=new Set;function p(d){try{let g=typeof d==="function"?d(i):d;if(i=g,typeof window<"u")window.localStorage.setItem(e,o(g));c.forEach((f)=>f(g))}catch(g){a(g)}}function u(){try{if(i=t,typeof window<"u")window.localStorage.removeItem(e);c.forEach((d)=>d(t))}catch(d){a(d)}}if(typeof window<"u"){let d=(g)=>{if(g.key===e&&g.newValue!==null)try{let f=n(g.newValue);i=f,c.forEach((y)=>y(f))}catch(f){a(f)}else if(g.key===e&&g.newValue===null)i=t,c.forEach((f)=>f(t))};window.addEventListener("storage",d)}return{value:i,setValue:p,removeValue:u}}function Y(e,t={}){let{defaultValue:s=!1}=t,o=s,n=null;if(typeof window<"u"&&"matchMedia"in window){n=window.matchMedia(e),o=n.matches;let r=(i)=>{o=i.matches};if(n.addEventListener)n.addEventListener("change",r);else n.addListener(r)}function a(){if(n)o=n.matches}return{matches:o,updateMatches:a}}var X={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 Tr(e){return Y(X[e])}function Ir(){return Y(X.mobile)}function Ar(){return Y(X.desktop)}function Pr(){return Y(X.dark)}function Lr(){return Y(X.reducedMotion)}var Ie=["gray","neutral","slate","zinc","red","green","yellow","blue","indigo"],Nr="--stx-color";function Ze(e,t){return t===void 0?`var(${e})`:`var(${e}, ${t})`}function Dr(e={}){let t={};for(let s of Ie){let o=e[s];if(!o||typeof o==="string")continue;let n={};for(let[a,r]of Object.entries(o))n[a]=Ze(`--stx-color-${s}-${a}`,r);t[s]=n}return t}function Mr(e={}){let t=[];for(let s of Ie){let o=e[s];if(!o||typeof o==="string")continue;for(let n of Object.keys(o))t.push(`--stx-color-${s}-${n}`)}return t}var tt="./Accordion-ehpymjam.stx";var ot="./AccordionItem-fc4ekdqf.stx";var at="./Audio-byv8kkvt.stx";var it="./Login-4666t7j4.stx";var ct="./Signup-pm2r0f2m.stx";var pt="./TwoFactorChallenge-3tsbfdsd.stx";var ht="./Avatar-6gexb2xv.stx";var mt="./Badge-33phrqza.stx";var bt="./Breadcrumb-cgw1bb6s.stx";import Q from"process";var xt="https://stacksjs.com/components";class R extends Error{component;context;constructor(e,t,s={}){let o=R.formatMessage(e,t,s);super(o);if(this.name="ComponentError",this.component=e,this.context={component:e,...s},Error.captureStackTrace)Error.captureStackTrace(this,R)}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 n=Array.isArray(s.expected)?s.expected.map((a)=>JSON.stringify(a)).join(", "):JSON.stringify(s.expected);o+=`
|
|
6
6
|
Expected: ${n}`}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.
|
|
4
|
+
"version": "0.2.461",
|
|
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",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@iconify-json/f7": "^1.2.2",
|
|
71
71
|
"@stacksjs/ts-css": "^0.3.2",
|
|
72
|
-
"@stacksjs/stx": "0.2.
|
|
73
|
-
"bun-plugin-stx": "0.2.
|
|
72
|
+
"@stacksjs/stx": "0.2.461",
|
|
73
|
+
"bun-plugin-stx": "0.2.461",
|
|
74
74
|
"ts-syntax-highlighter": "^0.2.17"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
package/src/ui/avatar/Avatar.stx
CHANGED
|
@@ -34,7 +34,7 @@ const statusColorClasses = {
|
|
|
34
34
|
busy: 'bg-danger',
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export const containerClasses = `relative inline-
|
|
37
|
+
export const containerClasses = `relative inline-flex shrink-0 align-top ${className}`.trim()
|
|
38
38
|
export const avatarClasses = `flex items-center justify-center overflow-hidden bg-surface-sunken ${sizeClasses[size] || sizeClasses.md} ${shapeClasses[shape] || shapeClasses.circle}`.trim()
|
|
39
39
|
export const imageClasses = `w-full h-full object-cover`.trim()
|
|
40
40
|
export const initialsClasses = `font-medium text-fg-muted uppercase select-none`.trim()
|