@compa11y/core 0.1.12 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,87 @@
1
+ # @compa11y/core
2
+
3
+ ## 0.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Add `funding` and `engines` metadata fields to package.json
8
+ - Add missing sub-path exports to package exports map
9
+ - Move to full compa11y nomenclature
10
+
11
+ ## 0.1.11
12
+
13
+ ### Minor Changes
14
+
15
+ - Add Breadcrumbs accessibility utilities
16
+
17
+ ## 0.1.10
18
+
19
+ ### Minor Changes
20
+
21
+ - Add Pagination accessibility utilities
22
+
23
+ ## 0.1.9
24
+
25
+ ### Minor Changes
26
+
27
+ - Add Heading, Text, FormField, Popover, Accordion, and Table accessibility utilities
28
+
29
+ ## 0.1.8
30
+
31
+ ### Minor Changes
32
+
33
+ - Add Link accessibility utilities
34
+ - Improve announcer and live-region utilities
35
+
36
+ ## 0.1.7
37
+
38
+ ### Minor Changes
39
+
40
+ - Add VisuallyHidden, SkipLink, and Alert utilities
41
+
42
+ ## 0.1.6
43
+
44
+ ### Minor Changes
45
+
46
+ - Add Switch, Checkbox, RadioGroup accessibility primitives
47
+
48
+ ## 0.1.5
49
+
50
+ ### Minor Changes
51
+
52
+ - Add Listbox, Select, Combobox keyboard and ARIA utilities
53
+
54
+ ## 0.1.4
55
+
56
+ ### Minor Changes
57
+
58
+ - Add Input, Textarea, Button utilities
59
+ - Improve focus management primitives
60
+
61
+ ## 0.1.3
62
+
63
+ ### Minor Changes
64
+
65
+ - Add `useRovingTabindex`, `useFocusNeighbor`, `useFocusReturn` hooks
66
+ - Add `useFocusVisible`, `useFocusManager`, `useFocusWithin`
67
+
68
+ ## 0.1.2
69
+
70
+ ### Minor Changes
71
+
72
+ - Add keyboard navigation utilities (`useKeyboard`, `useMenuKeyboard`, `useTabsKeyboard`)
73
+ - Add ARIA utilities (`aria`, `buildAriaProps`, `mergeAriaIds`)
74
+
75
+ ## 0.1.1
76
+
77
+ ### Minor Changes
78
+
79
+ - Add focus trap utilities (`useFocusTrap`, `useFocusTrapControls`)
80
+ - Add live-region announcer (`announce`, `announcePolite`, `announceAssertive`)
81
+
82
+ ## 0.1.0
83
+
84
+ ### Major Changes
85
+
86
+ - Initial release of `@compa11y/core` — framework-agnostic accessibility primitives
87
+ - Focus utilities, keyboard navigation, ARIA helpers, screen-reader announcer
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-C3VZQUKG.js';var D=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","iframe"].join(","),K=['a[href]:not([tabindex="-1"])','area[href]:not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"])','[contenteditable="true"]:not([tabindex="-1"])','audio[controls]:not([tabindex="-1"])','video[controls]:not([tabindex="-1"])','details > summary:first-of-type:not([tabindex="-1"])','iframe:not([tabindex="-1"])'].join(",");function U(e){if(!(e instanceof HTMLElement)||e.hidden||e.style.display==="none"||e.style.visibility==="hidden")return false;let t=window.getComputedStyle(e);return !(t.display==="none"||t.visibility==="hidden"||!e.isConnected)}function V(e){return !(!(e instanceof HTMLElement)||!U(e)||!e.matches(D)||e.closest("[inert]"))}function I(e){return !V(e)||e.tabIndex<0?false:e.matches(K)}function oe(e){return Array.from(e.querySelectorAll(D)).filter(V)}function T(e){return Array.from(e.querySelectorAll(K)).filter(I).sort((u,r)=>{let n=Math.max(0,u.tabIndex),i=Math.max(0,r.tabIndex);return n===0&&i===0?0:n===0?1:i===0?-1:n-i})}function A(e){return T(e)[0]??null}function re(e){let t=T(e);return t[t.length-1]??null}function P(e){let t=document.activeElement;return t!==null&&e.contains(t)}function N(e,t,a=true){let u=T(e),r=u.indexOf(t);if(r===-1)return u[0]??null;let n=r+1;return n<u.length?u[n]:a?u[0]??null:null}function C(e,t,a=true){let u=T(e),r=u.indexOf(t);if(r===-1)return u[u.length-1]??null;let n=r-1;return n>=0?u[n]:a?u[u.length-1]??null:null}function ie(e,t){return t.contains(e)}function q(e,t=document.body){return e?typeof e=="string"?t.querySelector(e):typeof e=="function"?e():e:null}var F=[];function _(e,t={}){let{initialFocus:a,returnFocus:u=true,clickOutsideDeactivates:r=false,escapeDeactivates:n=true,onDeactivate:i,onEscapeFocus:c}=t,o=false,m=false,f=null;function h(l){m||!o||(l.key==="Tab"?y(l):l.key==="Escape"&&n&&(l.preventDefault(),l.stopPropagation(),v()));}function y(l){let E=T(e);if(E.length===0){l.preventDefault();return}let w=E[0],g=E[E.length-1],S=document.activeElement;l.shiftKey?(S===w||!e.contains(S))&&(l.preventDefault(),g.focus()):(S===g||!e.contains(S))&&(l.preventDefault(),w.focus());}function p(l){if(m||!o)return;let E=l.target;e.contains(E)||(c?.(E),A(e)?.focus());}function d(l){if(m||!o)return;let E=l.target;r&&!e.contains(E)&&v();}function b(){if(!o){f=document.activeElement,F.push(k);for(let l=0;l<F.length-1;l++)F[l].pause();document.addEventListener("keydown",h,true),document.addEventListener("focusin",p,true),document.addEventListener("click",d,true),o=true,requestAnimationFrame(()=>{if(!o)return;let l=q(a,e);if(l)l.focus();else {let E=A(e);E?E.focus():(e.setAttribute("tabindex","-1"),e.focus());}});}}function s(l){if(!o)return;document.removeEventListener("keydown",h,true),document.removeEventListener("focusin",p,true),document.removeEventListener("click",d,true),o=false,m=false;let E=F.indexOf(k);if(E>-1&&F.splice(E,1),F[F.length-1]?.unpause(),u&&f){let g=typeof u=="boolean"?f:u;requestAnimationFrame(()=>{g&&"focus"in g&&g.focus();});}l&&i?.();}function v(){s(true);}function L(){s(false);}function M(){!o||m||(m=true);}function H(){!o||!m||(m=false,P(e)||A(e)?.focus());}let k={activate:b,deactivate:v,destroy:L,pause:M,unpause:H,isActive:()=>o,isPaused:()=>m};return k}function z(){return F[F.length-1]??null}function W(){return F.length>0}var x={hadKeyboardEvent:true,isPointerInput:false,lastFocusSource:"unknown"},O=false,j=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter"," ","Home","End","PageUp","PageDown","Escape"]);function G(){if(!a()||O)return ()=>{};O=true;function e(n){j.has(n.key)&&(x.hadKeyboardEvent=true,x.isPointerInput=false,x.lastFocusSource="keyboard");}function t(n){x.isPointerInput=true,x.hadKeyboardEvent=false,x.lastFocusSource="pointerType"in n&&n.pointerType==="touch"?"touch":"mouse";}function a$1(n){let i=n.target;i instanceof HTMLElement&&(x.hadKeyboardEvent||Y(i))&&(i.dataset.compa11yFocusVisible="true");}function u(n){let i=n.target;i instanceof HTMLElement&&delete i.dataset.compa11yFocusVisible;}function r(){document.visibilityState==="hidden"&&(x.hadKeyboardEvent=true);}return document.addEventListener("keydown",e,true),document.addEventListener("mousedown",t,true),document.addEventListener("pointerdown",t,true),document.addEventListener("focus",a$1,true),document.addEventListener("blur",u,true),document.addEventListener("visibilitychange",r,true),()=>{document.removeEventListener("keydown",e,true),document.removeEventListener("mousedown",t,true),document.removeEventListener("pointerdown",t,true),document.removeEventListener("focus",a$1,true),document.removeEventListener("blur",u,true),document.removeEventListener("visibilitychange",r,true),O=false;}}function Y(e){let t=e.tagName.toLowerCase(),a=e.getAttribute("type")?.toLowerCase();return !!(t==="input"&&(!a||a==="text"||a==="email"||a==="password"||a==="search"||a==="tel"||a==="url"||a==="number")||t==="textarea"||e.isContentEditable)}function J(){return x.hadKeyboardEvent}function Q(e){return e.dataset.compa11yFocusVisible==="true"}function X(){return x.lastFocusSource}function Z(e,t){t?e.dataset.compa11yFocusVisible="true":delete e.dataset.compa11yFocusVisible;}function $(e,t){x.hadKeyboardEvent=true,x.lastFocusSource="keyboard",e.focus(t);}function ee(e,t={}){let{contain:a=false,restoreFocus:u=false,autoFocus:r=false}=t,n=null,i=false;u&&(n=document.activeElement);function c(){return i?[]:T(e)}function o(){let s=document.activeElement;return s&&e.contains(s)?s:null}function m(){if(i)return;c()[0]?.focus();}function f(){if(i)return;let s=c();s[s.length-1]?.focus();}function h({wrap:s=true}={}){if(i)return;let v=o();if(!v){m();return}N(e,v,s)?.focus();}function y({wrap:s=true}={}){if(i)return;let v=o();if(!v){f();return}C(e,v,s)?.focus();}function p(s){if(i)return;c()[s]?.focus();}function d(s){if(!(i||!a)&&s.key==="Tab"){let v=c();if(v.length===0){s.preventDefault();return}let L=v[0],M=v[v.length-1],H=o();s.shiftKey&&H===L?(s.preventDefault(),M.focus()):!s.shiftKey&&H===M&&(s.preventDefault(),L.focus());}}function b(){i||(i=true,document.removeEventListener("keydown",d,true),u&&n&&n.focus());}return a&&document.addEventListener("keydown",d,true),r&&requestAnimationFrame(()=>{i||m();}),{focusFirst:m,focusLast:f,focusNext:h,focusPrevious:y,focusAt:p,getFocused:o,getElements:c,destroy:b}}function te(e,t,a={}){let{initialIndex:u=0,orientation:r="both",wrap:n=true,onSelectionChange:i}=a,c=[],o=u;function m(){c=Array.from(e.querySelectorAll(t)),c.forEach((p,d)=>{p.setAttribute("tabindex",d===o?"0":"-1");});}function f(p){if(c.length===0)return;let d=p;d<0?d=n?c.length-1:0:d>=c.length&&(d=n?0:c.length-1);let b=c[o],s=c[d];b&&b.setAttribute("tabindex","-1"),s&&(s.setAttribute("tabindex","0"),s.focus(),i?.(d,s)),o=d;}function h(p){let d=p.target;if(!c.includes(d))return;let b=false;switch(p.key){case "ArrowRight":(r==="horizontal"||r==="both")&&(f(o+1),b=true);break;case "ArrowLeft":(r==="horizontal"||r==="both")&&(f(o-1),b=true);break;case "ArrowDown":(r==="vertical"||r==="both")&&(f(o+1),b=true);break;case "ArrowUp":(r==="vertical"||r==="both")&&(f(o-1),b=true);break;case "Home":f(0),b=true;break;case "End":f(c.length-1),b=true;break}b&&(p.preventDefault(),p.stopPropagation());}function y(p){let d=p.target,b=c.indexOf(d);if(b!==-1&&b!==o){let s=c[o];s&&s.setAttribute("tabindex","-1"),d.setAttribute("tabindex","0"),o=b;}}return m(),e.addEventListener("keydown",h),e.addEventListener("focusin",y),{next:()=>f(o+1),previous:()=>f(o-1),first:()=>f(0),last:()=>f(c.length-1),goto:f,getIndex:()=>o,update:m,destroy:()=>{e.removeEventListener("keydown",h),e.removeEventListener("focusin",y);}}}function B(e,t={}){let{scope:a=e.parentElement??document.body,prefer:u="previous"}=t,r=T(a),n=r.indexOf(e);n===-1&&(n=r.findIndex(f=>e.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_FOLLOWING),n===-1&&(n=r.length));let i=n-1,c=n+1,o=i>=0&&r[i]!==e?r[i]:null,m=c<r.length&&r[c]!==e?r[c]:null;return u==="previous"?o??m:m??o}function ne(e){let t=e??null;function a(n){t=n??document.activeElement??null;}function u(n={}){let{fallback:i,prefer:c="previous"}=n;if(!t){i?.focus();return}if(t.isConnected&&I(t)){t.focus(),t=null;return}if(t.isConnected){let o=B(t,{prefer:c});if(o){o.focus(),t=null;return}}i&&i.focus(),t=null;}function r(){t=null;}return {get element(){return t},save:a,return:u,clear:r}}export{ne as A,D as a,K as b,U as c,V as d,I as e,oe as f,T as g,A as h,re as i,P as j,N as k,C as l,ie as m,q as n,_ as o,z as p,W as q,G as r,J as s,Q as t,X as u,Z as v,$ as w,ee as x,te as y,B as z};
@@ -0,0 +1 @@
1
+ 'use strict';var chunk7BL2ABLF_cjs=require('./chunk-7BL2ABLF.cjs');var D=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","iframe"].join(","),K=['a[href]:not([tabindex="-1"])','area[href]:not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"])','[contenteditable="true"]:not([tabindex="-1"])','audio[controls]:not([tabindex="-1"])','video[controls]:not([tabindex="-1"])','details > summary:first-of-type:not([tabindex="-1"])','iframe:not([tabindex="-1"])'].join(",");function U(e){if(!(e instanceof HTMLElement)||e.hidden||e.style.display==="none"||e.style.visibility==="hidden")return false;let t=window.getComputedStyle(e);return !(t.display==="none"||t.visibility==="hidden"||!e.isConnected)}function V(e){return !(!(e instanceof HTMLElement)||!U(e)||!e.matches(D)||e.closest("[inert]"))}function I(e){return !V(e)||e.tabIndex<0?false:e.matches(K)}function oe(e){return Array.from(e.querySelectorAll(D)).filter(V)}function T(e){return Array.from(e.querySelectorAll(K)).filter(I).sort((u,r)=>{let n=Math.max(0,u.tabIndex),i=Math.max(0,r.tabIndex);return n===0&&i===0?0:n===0?1:i===0?-1:n-i})}function A(e){return T(e)[0]??null}function re(e){let t=T(e);return t[t.length-1]??null}function P(e){let t=document.activeElement;return t!==null&&e.contains(t)}function N(e,t,a=true){let u=T(e),r=u.indexOf(t);if(r===-1)return u[0]??null;let n=r+1;return n<u.length?u[n]:a?u[0]??null:null}function C(e,t,a=true){let u=T(e),r=u.indexOf(t);if(r===-1)return u[u.length-1]??null;let n=r-1;return n>=0?u[n]:a?u[u.length-1]??null:null}function ie(e,t){return t.contains(e)}function q(e,t=document.body){return e?typeof e=="string"?t.querySelector(e):typeof e=="function"?e():e:null}var F=[];function _(e,t={}){let{initialFocus:a,returnFocus:u=true,clickOutsideDeactivates:r=false,escapeDeactivates:n=true,onDeactivate:i,onEscapeFocus:c}=t,o=false,m=false,f=null;function h(l){m||!o||(l.key==="Tab"?y(l):l.key==="Escape"&&n&&(l.preventDefault(),l.stopPropagation(),v()));}function y(l){let E=T(e);if(E.length===0){l.preventDefault();return}let w=E[0],g=E[E.length-1],S=document.activeElement;l.shiftKey?(S===w||!e.contains(S))&&(l.preventDefault(),g.focus()):(S===g||!e.contains(S))&&(l.preventDefault(),w.focus());}function p(l){if(m||!o)return;let E=l.target;e.contains(E)||(c?.(E),A(e)?.focus());}function d(l){if(m||!o)return;let E=l.target;r&&!e.contains(E)&&v();}function b(){if(!o){f=document.activeElement,F.push(k);for(let l=0;l<F.length-1;l++)F[l].pause();document.addEventListener("keydown",h,true),document.addEventListener("focusin",p,true),document.addEventListener("click",d,true),o=true,requestAnimationFrame(()=>{if(!o)return;let l=q(a,e);if(l)l.focus();else {let E=A(e);E?E.focus():(e.setAttribute("tabindex","-1"),e.focus());}});}}function s(l){if(!o)return;document.removeEventListener("keydown",h,true),document.removeEventListener("focusin",p,true),document.removeEventListener("click",d,true),o=false,m=false;let E=F.indexOf(k);if(E>-1&&F.splice(E,1),F[F.length-1]?.unpause(),u&&f){let g=typeof u=="boolean"?f:u;requestAnimationFrame(()=>{g&&"focus"in g&&g.focus();});}l&&i?.();}function v(){s(true);}function L(){s(false);}function M(){!o||m||(m=true);}function H(){!o||!m||(m=false,P(e)||A(e)?.focus());}let k={activate:b,deactivate:v,destroy:L,pause:M,unpause:H,isActive:()=>o,isPaused:()=>m};return k}function z(){return F[F.length-1]??null}function W(){return F.length>0}var x={hadKeyboardEvent:true,isPointerInput:false,lastFocusSource:"unknown"},O=false,j=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter"," ","Home","End","PageUp","PageDown","Escape"]);function G(){if(!chunk7BL2ABLF_cjs.a()||O)return ()=>{};O=true;function e(n){j.has(n.key)&&(x.hadKeyboardEvent=true,x.isPointerInput=false,x.lastFocusSource="keyboard");}function t(n){x.isPointerInput=true,x.hadKeyboardEvent=false,x.lastFocusSource="pointerType"in n&&n.pointerType==="touch"?"touch":"mouse";}function a(n){let i=n.target;i instanceof HTMLElement&&(x.hadKeyboardEvent||Y(i))&&(i.dataset.compa11yFocusVisible="true");}function u(n){let i=n.target;i instanceof HTMLElement&&delete i.dataset.compa11yFocusVisible;}function r(){document.visibilityState==="hidden"&&(x.hadKeyboardEvent=true);}return document.addEventListener("keydown",e,true),document.addEventListener("mousedown",t,true),document.addEventListener("pointerdown",t,true),document.addEventListener("focus",a,true),document.addEventListener("blur",u,true),document.addEventListener("visibilitychange",r,true),()=>{document.removeEventListener("keydown",e,true),document.removeEventListener("mousedown",t,true),document.removeEventListener("pointerdown",t,true),document.removeEventListener("focus",a,true),document.removeEventListener("blur",u,true),document.removeEventListener("visibilitychange",r,true),O=false;}}function Y(e){let t=e.tagName.toLowerCase(),a=e.getAttribute("type")?.toLowerCase();return !!(t==="input"&&(!a||a==="text"||a==="email"||a==="password"||a==="search"||a==="tel"||a==="url"||a==="number")||t==="textarea"||e.isContentEditable)}function J(){return x.hadKeyboardEvent}function Q(e){return e.dataset.compa11yFocusVisible==="true"}function X(){return x.lastFocusSource}function Z(e,t){t?e.dataset.compa11yFocusVisible="true":delete e.dataset.compa11yFocusVisible;}function $(e,t){x.hadKeyboardEvent=true,x.lastFocusSource="keyboard",e.focus(t);}function ee(e,t={}){let{contain:a=false,restoreFocus:u=false,autoFocus:r=false}=t,n=null,i=false;u&&(n=document.activeElement);function c(){return i?[]:T(e)}function o(){let s=document.activeElement;return s&&e.contains(s)?s:null}function m(){if(i)return;c()[0]?.focus();}function f(){if(i)return;let s=c();s[s.length-1]?.focus();}function h({wrap:s=true}={}){if(i)return;let v=o();if(!v){m();return}N(e,v,s)?.focus();}function y({wrap:s=true}={}){if(i)return;let v=o();if(!v){f();return}C(e,v,s)?.focus();}function p(s){if(i)return;c()[s]?.focus();}function d(s){if(!(i||!a)&&s.key==="Tab"){let v=c();if(v.length===0){s.preventDefault();return}let L=v[0],M=v[v.length-1],H=o();s.shiftKey&&H===L?(s.preventDefault(),M.focus()):!s.shiftKey&&H===M&&(s.preventDefault(),L.focus());}}function b(){i||(i=true,document.removeEventListener("keydown",d,true),u&&n&&n.focus());}return a&&document.addEventListener("keydown",d,true),r&&requestAnimationFrame(()=>{i||m();}),{focusFirst:m,focusLast:f,focusNext:h,focusPrevious:y,focusAt:p,getFocused:o,getElements:c,destroy:b}}function te(e,t,a={}){let{initialIndex:u=0,orientation:r="both",wrap:n=true,onSelectionChange:i}=a,c=[],o=u;function m(){c=Array.from(e.querySelectorAll(t)),c.forEach((p,d)=>{p.setAttribute("tabindex",d===o?"0":"-1");});}function f(p){if(c.length===0)return;let d=p;d<0?d=n?c.length-1:0:d>=c.length&&(d=n?0:c.length-1);let b=c[o],s=c[d];b&&b.setAttribute("tabindex","-1"),s&&(s.setAttribute("tabindex","0"),s.focus(),i?.(d,s)),o=d;}function h(p){let d=p.target;if(!c.includes(d))return;let b=false;switch(p.key){case "ArrowRight":(r==="horizontal"||r==="both")&&(f(o+1),b=true);break;case "ArrowLeft":(r==="horizontal"||r==="both")&&(f(o-1),b=true);break;case "ArrowDown":(r==="vertical"||r==="both")&&(f(o+1),b=true);break;case "ArrowUp":(r==="vertical"||r==="both")&&(f(o-1),b=true);break;case "Home":f(0),b=true;break;case "End":f(c.length-1),b=true;break}b&&(p.preventDefault(),p.stopPropagation());}function y(p){let d=p.target,b=c.indexOf(d);if(b!==-1&&b!==o){let s=c[o];s&&s.setAttribute("tabindex","-1"),d.setAttribute("tabindex","0"),o=b;}}return m(),e.addEventListener("keydown",h),e.addEventListener("focusin",y),{next:()=>f(o+1),previous:()=>f(o-1),first:()=>f(0),last:()=>f(c.length-1),goto:f,getIndex:()=>o,update:m,destroy:()=>{e.removeEventListener("keydown",h),e.removeEventListener("focusin",y);}}}function B(e,t={}){let{scope:a=e.parentElement??document.body,prefer:u="previous"}=t,r=T(a),n=r.indexOf(e);n===-1&&(n=r.findIndex(f=>e.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_FOLLOWING),n===-1&&(n=r.length));let i=n-1,c=n+1,o=i>=0&&r[i]!==e?r[i]:null,m=c<r.length&&r[c]!==e?r[c]:null;return u==="previous"?o??m:m??o}function ne(e){let t=e??null;function a(n){t=n??document.activeElement??null;}function u(n={}){let{fallback:i,prefer:c="previous"}=n;if(!t){i?.focus();return}if(t.isConnected&&I(t)){t.focus(),t=null;return}if(t.isConnected){let o=B(t,{prefer:c});if(o){o.focus(),t=null;return}}i&&i.focus(),t=null;}function r(){t=null;}return {get element(){return t},save:a,return:u,clear:r}}exports.A=ne;exports.a=D;exports.b=K;exports.c=U;exports.d=V;exports.e=I;exports.f=oe;exports.g=T;exports.h=A;exports.i=re;exports.j=P;exports.k=N;exports.l=C;exports.m=ie;exports.n=q;exports.o=_;exports.p=z;exports.q=W;exports.r=G;exports.s=J;exports.t=Q;exports.u=X;exports.v=Z;exports.w=$;exports.x=ee;exports.y=te;exports.z=B;
@@ -1 +1 @@
1
- 'use strict';var chunkY2RTDE4A_cjs=require('../chunk-Y2RTDE4A.cjs');require('../chunk-7BL2ABLF.cjs');Object.defineProperty(exports,"createFocusReturn",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.A}});Object.defineProperty(exports,"createFocusScope",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.x}});Object.defineProperty(exports,"createFocusTrap",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.o}});Object.defineProperty(exports,"createRovingTabindex",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.y}});Object.defineProperty(exports,"findFocusNeighbor",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.z}});Object.defineProperty(exports,"focusWithVisibleRing",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.w}});Object.defineProperty(exports,"getActiveFocusTrap",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.p}});Object.defineProperty(exports,"getLastFocusSource",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.u}});Object.defineProperty(exports,"hasFocusTrap",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.q}});Object.defineProperty(exports,"hasVisibleFocus",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.t}});Object.defineProperty(exports,"initFocusVisible",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.r}});Object.defineProperty(exports,"isFocusVisible",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.s}});Object.defineProperty(exports,"setFocusVisible",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.v}});
1
+ 'use strict';var chunkAL3UYWIX_cjs=require('../chunk-AL3UYWIX.cjs');require('../chunk-7BL2ABLF.cjs');Object.defineProperty(exports,"createFocusReturn",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.A}});Object.defineProperty(exports,"createFocusScope",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.x}});Object.defineProperty(exports,"createFocusTrap",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.o}});Object.defineProperty(exports,"createRovingTabindex",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.y}});Object.defineProperty(exports,"findFocusNeighbor",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.z}});Object.defineProperty(exports,"focusWithVisibleRing",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.w}});Object.defineProperty(exports,"getActiveFocusTrap",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.p}});Object.defineProperty(exports,"getLastFocusSource",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.u}});Object.defineProperty(exports,"hasFocusTrap",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.q}});Object.defineProperty(exports,"hasVisibleFocus",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.t}});Object.defineProperty(exports,"initFocusVisible",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.r}});Object.defineProperty(exports,"isFocusVisible",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.s}});Object.defineProperty(exports,"setFocusVisible",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.v}});
@@ -1 +1 @@
1
- export{A as createFocusReturn,x as createFocusScope,o as createFocusTrap,y as createRovingTabindex,z as findFocusNeighbor,w as focusWithVisibleRing,p as getActiveFocusTrap,u as getLastFocusSource,q as hasFocusTrap,t as hasVisibleFocus,r as initFocusVisible,s as isFocusVisible,v as setFocusVisible}from'../chunk-QGEFH2VG.js';import'../chunk-C3VZQUKG.js';
1
+ export{A as createFocusReturn,x as createFocusScope,o as createFocusTrap,y as createRovingTabindex,z as findFocusNeighbor,w as focusWithVisibleRing,p as getActiveFocusTrap,u as getLastFocusSource,q as hasFocusTrap,t as hasVisibleFocus,r as initFocusVisible,s as isFocusVisible,v as setFocusVisible}from'../chunk-7RLRK53P.js';import'../chunk-C3VZQUKG.js';
package/dist/index.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var chunkY2RTDE4A_cjs=require('./chunk-Y2RTDE4A.cjs'),chunkEM45V5TK_cjs=require('./chunk-EM45V5TK.cjs'),chunkAQ6HEUSD_cjs=require('./chunk-AQ6HEUSD.cjs'),chunk7BL2ABLF_cjs=require('./chunk-7BL2ABLF.cjs'),chunkKQUAJKTG_cjs=require('./chunk-KQUAJKTG.cjs');var g=0,d="compa11y";function u(e){let n=++g;return e?`${d}-${e}-${n}`:`${d}-${n}`}function $e(e,n){let r=u(n),t={};for(let o of e)t[o]=`${r}-${o}`;return t}function we(){g=0;}function Ae(e){let n=u(e);return {id:n,generate:r=>`${n}-${r}`,generateMultiple:r=>{let t={};for(let o of r)t[o]=`${n}-${o}`;return t}}}var a=null,l=new Set;function p(){return typeof process<"u"&&process.env?.NODE_ENV!=="production"}function b(e){a=e;}function f(e){return `${e.component}:${e.message}`}function i(e){if(!p())return;let n=f(e);if(l.has(n))return;if(l.add(n),a){a(e);return}let r=`[compa11y/${e.component}]`,t=m(e.type),o=e.suggestion?`${e.message}
1
+ 'use strict';var chunkAL3UYWIX_cjs=require('./chunk-AL3UYWIX.cjs'),chunkEM45V5TK_cjs=require('./chunk-EM45V5TK.cjs'),chunkAQ6HEUSD_cjs=require('./chunk-AQ6HEUSD.cjs'),chunk7BL2ABLF_cjs=require('./chunk-7BL2ABLF.cjs'),chunkKQUAJKTG_cjs=require('./chunk-KQUAJKTG.cjs');var g=0,d="compa11y";function u(e){let n=++g;return e?`${d}-${e}-${n}`:`${d}-${n}`}function $e(e,n){let r=u(n),t={};for(let o of e)t[o]=`${r}-${o}`;return t}function we(){g=0;}function Ae(e){let n=u(e);return {id:n,generate:r=>`${n}-${r}`,generateMultiple:r=>{let t={};for(let o of r)t[o]=`${n}-${o}`;return t}}}var a=null,l=new Set;function p(){return typeof process<"u"&&process.env?.NODE_ENV!=="production"}function b(e){a=e;}function f(e){return `${e.component}:${e.message}`}function i(e){if(!p())return;let n=f(e);if(l.has(n))return;if(l.add(n),a){a(e);return}let r=`[compa11y/${e.component}]`,t=m(e.type),o=e.suggestion?`${e.message}
2
2
 
3
- \u{1F4A1} Suggestion: ${e.suggestion}`:e.message;switch(e.type){case "error":console.error(`%c${r}%c ${o}`,t,"");break;case "warning":console.warn(`%c${r}%c ${o}`,t,"");break;case "info":console.info(`%c${r}%c ${o}`,t,"");break}e.element&&console.log("Element:",e.element);}function m(e){switch(e){case "error":return "background: #ff5555; color: white; padding: 2px 4px; border-radius: 2px; font-weight: bold;";case "warning":return "background: #ffaa00; color: black; padding: 2px 4px; border-radius: 2px; font-weight: bold;";case "info":return "background: #5555ff; color: white; padding: 2px 4px; border-radius: 2px; font-weight: bold;"}}function x(){l.clear();}var s={accessibleLabel(e,n,r="aria-label"){e&&(chunkKQUAJKTG_cjs.d(e)||i({type:"error",component:n,message:"Missing accessible label. Screen reader users will not be able to understand this element.",suggestion:`Add ${r}, aria-labelledby, or visible text content.`,element:e}));},requiredProp(e,n,r){(e==null||e==="")&&i({type:"error",component:r,message:`Missing required prop "${n}".`,suggestion:`Provide a value for the "${n}" prop.`});},validRole(e,n,r){if(!e)return;new Set(["alert","alertdialog","application","article","banner","button","cell","columnheader","combobox","complementary","contentinfo","definition","dialog","directory","document","feed","figure","form","grid","gridcell","group","heading","img","link","list","listbox","listitem","log","main","marquee","math","menu","menubar","menuitem","navigation","none","note","option","presentation","progressbar","region","row","rowgroup","rowheader","scrollbar","search","searchbox","separator","slider","spinbutton","status","switch","tab","table","tablist","tabpanel","term","textbox","timer","toolbar","tooltip","tree","treegrid","treeitem"]).has(e)||i({type:"warning",component:n,message:`Invalid ARIA role "${e}".`,suggestion:"Use a valid ARIA role from the WAI-ARIA specification.",element:r});},keyboardAccessible(e,n,r){if(e&&r.onClick&&!r.onKeyDown){let t=e.tagName.toLowerCase(),o=e.getAttribute("role");if(["button","a","input","select","textarea"].includes(t))return;o&&["button","link","menuitem","option","tab"].includes(o)&&i({type:"warning",component:n,message:"Element has onClick but no onKeyDown handler.",suggestion:"Add keyboard event handling for Enter and Space keys.",element:e});}},tabIndex(e,n,r){e!==void 0&&e>0&&i({type:"warning",component:n,message:`Positive tabIndex (${e}) disrupts natural tab order.`,suggestion:"Use tabIndex={0} or tabIndex={-1} instead. Rely on DOM order for tab sequence.",element:r});},dialogAutoFocus(e,n){e||i({type:"info",component:n,message:"No initial focus element specified for dialog.",suggestion:"Consider setting initialFocus to guide keyboard users."});},formLabel(e,n,r){if(!e)return;n||e.getAttribute("aria-label")||e.getAttribute("aria-labelledby")||e.labels?.length||i({type:"error",component:r,message:"Form input is missing an accessible label.",suggestion:"Add a <label>, aria-label, or aria-labelledby.",element:e});},imageAlt(e,n){if(!e||e.tagName!=="IMG")return;let r=e.getAttribute("alt"),t=e.getAttribute("role");r===null&&t!=="presentation"&&t!=="none"&&i({type:"error",component:n,message:"Image is missing alt attribute.",suggestion:'Add alt="" for decorative images or descriptive alt text for meaningful images.',element:e});}};function y(e){return {error:(n,r,t)=>i({type:"error",component:e,message:n,suggestion:r,element:t}),warning:(n,r,t)=>i({type:"warning",component:e,message:n,suggestion:r,element:t}),info:(n,r,t)=>i({type:"info",component:e,message:n,suggestion:r,element:t}),checks:{accessibleLabel:(n,r)=>s.accessibleLabel(n,e,r),requiredProp:(n,r)=>s.requiredProp(n,r,e),keyboardAccessible:(n,r)=>s.keyboardAccessible(n,e,r),tabIndex:(n,r)=>s.tabIndex(n,e,r)}}}function We(){let e=[];return import('./focus/index.cjs').then(({initFocusVisible:n})=>{e.push(n());}),import('./announcer/index.cjs').then(({initAnnouncer:n})=>{e.push(n());}),()=>{e.forEach(n=>n());}}Object.defineProperty(exports,"FOCUSABLE_SELECTORS",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.a}});Object.defineProperty(exports,"TABBABLE_SELECTORS",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.b}});Object.defineProperty(exports,"containsFocus",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.j}});Object.defineProperty(exports,"createFocusReturn",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.A}});Object.defineProperty(exports,"createFocusScope",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.x}});Object.defineProperty(exports,"createFocusTrap",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.o}});Object.defineProperty(exports,"createRovingTabindex",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.y}});Object.defineProperty(exports,"findFocusNeighbor",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.z}});Object.defineProperty(exports,"focusWithVisibleRing",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.w}});Object.defineProperty(exports,"getActiveFocusTrap",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.p}});Object.defineProperty(exports,"getFirstFocusable",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.h}});Object.defineProperty(exports,"getFocusableElements",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.f}});Object.defineProperty(exports,"getLastFocusSource",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.u}});Object.defineProperty(exports,"getLastFocusable",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.i}});Object.defineProperty(exports,"getNextFocusable",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.k}});Object.defineProperty(exports,"getPreviousFocusable",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.l}});Object.defineProperty(exports,"getTabbableElements",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.g}});Object.defineProperty(exports,"hasFocusTrap",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.q}});Object.defineProperty(exports,"hasVisibleFocus",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.t}});Object.defineProperty(exports,"initFocusVisible",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.r}});Object.defineProperty(exports,"isFocusVisible",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.s}});Object.defineProperty(exports,"isFocusable",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.d}});Object.defineProperty(exports,"isTabbable",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.e}});Object.defineProperty(exports,"isVisible",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.c}});Object.defineProperty(exports,"isWithinContainer",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.m}});Object.defineProperty(exports,"resolveElement",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.n}});Object.defineProperty(exports,"setFocusVisible",{enumerable:true,get:function(){return chunkY2RTDE4A_cjs.v}});Object.defineProperty(exports,"KeyboardPatterns",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.d}});Object.defineProperty(exports,"createKeyboardManager",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.c}});Object.defineProperty(exports,"createTypeAhead",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.e}});Object.defineProperty(exports,"getKeyCombo",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.b}});Object.defineProperty(exports,"normalizeKey",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.a}});Object.defineProperty(exports,"announce",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.b}});Object.defineProperty(exports,"announceAssertive",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.d}});Object.defineProperty(exports,"announceError",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.i}});Object.defineProperty(exports,"announcePolite",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.c}});Object.defineProperty(exports,"announceProgress",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.j}});Object.defineProperty(exports,"announceStatus",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.h}});Object.defineProperty(exports,"clearAnnouncements",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.e}});Object.defineProperty(exports,"createAnnouncer",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.g}});Object.defineProperty(exports,"initAnnouncer",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.a}});Object.defineProperty(exports,"queueAnnouncement",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.f}});Object.defineProperty(exports,"createMediaQueryListener",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.k}});Object.defineProperty(exports,"getScreenReaderHints",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.j}});Object.defineProperty(exports,"isAndroid",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.d}});Object.defineProperty(exports,"isBrowser",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.a}});Object.defineProperty(exports,"isIOS",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.c}});Object.defineProperty(exports,"isMac",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.b}});Object.defineProperty(exports,"isTouchDevice",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.f}});Object.defineProperty(exports,"isWindows",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.e}});Object.defineProperty(exports,"prefersDarkMode",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.i}});Object.defineProperty(exports,"prefersHighContrast",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.h}});Object.defineProperty(exports,"prefersReducedMotion",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.g}});Object.defineProperty(exports,"aria",{enumerable:true,get:function(){return chunkKQUAJKTG_cjs.a}});Object.defineProperty(exports,"buildAriaProps",{enumerable:true,get:function(){return chunkKQUAJKTG_cjs.b}});Object.defineProperty(exports,"hasAccessibleName",{enumerable:true,get:function(){return chunkKQUAJKTG_cjs.d}});Object.defineProperty(exports,"mergeAriaIds",{enumerable:true,get:function(){return chunkKQUAJKTG_cjs.c}});exports.checks=s;exports.clearWarnings=x;exports.createComponentWarnings=y;exports.createIdScope=Ae;exports.generateId=u;exports.generateIds=$e;exports.initCompa11y=We;exports.resetIdCounter=we;exports.setWarningHandler=b;exports.warn=i;
3
+ \u{1F4A1} Suggestion: ${e.suggestion}`:e.message;switch(e.type){case "error":console.error(`%c${r}%c ${o}`,t,"");break;case "warning":console.warn(`%c${r}%c ${o}`,t,"");break;case "info":console.info(`%c${r}%c ${o}`,t,"");break}e.element&&console.log("Element:",e.element);}function m(e){switch(e){case "error":return "background: #ff5555; color: white; padding: 2px 4px; border-radius: 2px; font-weight: bold;";case "warning":return "background: #ffaa00; color: black; padding: 2px 4px; border-radius: 2px; font-weight: bold;";case "info":return "background: #5555ff; color: white; padding: 2px 4px; border-radius: 2px; font-weight: bold;"}}function x(){l.clear();}var s={accessibleLabel(e,n,r="aria-label"){e&&(chunkKQUAJKTG_cjs.d(e)||i({type:"error",component:n,message:"Missing accessible label. Screen reader users will not be able to understand this element.",suggestion:`Add ${r}, aria-labelledby, or visible text content.`,element:e}));},requiredProp(e,n,r){(e==null||e==="")&&i({type:"error",component:r,message:`Missing required prop "${n}".`,suggestion:`Provide a value for the "${n}" prop.`});},validRole(e,n,r){if(!e)return;new Set(["alert","alertdialog","application","article","banner","button","cell","columnheader","combobox","complementary","contentinfo","definition","dialog","directory","document","feed","figure","form","grid","gridcell","group","heading","img","link","list","listbox","listitem","log","main","marquee","math","menu","menubar","menuitem","navigation","none","note","option","presentation","progressbar","region","row","rowgroup","rowheader","scrollbar","search","searchbox","separator","slider","spinbutton","status","switch","tab","table","tablist","tabpanel","term","textbox","timer","toolbar","tooltip","tree","treegrid","treeitem"]).has(e)||i({type:"warning",component:n,message:`Invalid ARIA role "${e}".`,suggestion:"Use a valid ARIA role from the WAI-ARIA specification.",element:r});},keyboardAccessible(e,n,r){if(e&&r.onClick&&!r.onKeyDown){let t=e.tagName.toLowerCase(),o=e.getAttribute("role");if(["button","a","input","select","textarea"].includes(t))return;o&&["button","link","menuitem","option","tab"].includes(o)&&i({type:"warning",component:n,message:"Element has onClick but no onKeyDown handler.",suggestion:"Add keyboard event handling for Enter and Space keys.",element:e});}},tabIndex(e,n,r){e!==void 0&&e>0&&i({type:"warning",component:n,message:`Positive tabIndex (${e}) disrupts natural tab order.`,suggestion:"Use tabIndex={0} or tabIndex={-1} instead. Rely on DOM order for tab sequence.",element:r});},dialogAutoFocus(e,n){e||i({type:"info",component:n,message:"No initial focus element specified for dialog.",suggestion:"Consider setting initialFocus to guide keyboard users."});},formLabel(e,n,r){if(!e)return;n||e.getAttribute("aria-label")||e.getAttribute("aria-labelledby")||e.labels?.length||i({type:"error",component:r,message:"Form input is missing an accessible label.",suggestion:"Add a <label>, aria-label, or aria-labelledby.",element:e});},imageAlt(e,n){if(!e||e.tagName!=="IMG")return;let r=e.getAttribute("alt"),t=e.getAttribute("role");r===null&&t!=="presentation"&&t!=="none"&&i({type:"error",component:n,message:"Image is missing alt attribute.",suggestion:'Add alt="" for decorative images or descriptive alt text for meaningful images.',element:e});}};function y(e){return {error:(n,r,t)=>i({type:"error",component:e,message:n,suggestion:r,element:t}),warning:(n,r,t)=>i({type:"warning",component:e,message:n,suggestion:r,element:t}),info:(n,r,t)=>i({type:"info",component:e,message:n,suggestion:r,element:t}),checks:{accessibleLabel:(n,r)=>s.accessibleLabel(n,e,r),requiredProp:(n,r)=>s.requiredProp(n,r,e),keyboardAccessible:(n,r)=>s.keyboardAccessible(n,e,r),tabIndex:(n,r)=>s.tabIndex(n,e,r)}}}function We(){let e=[];return import('./focus/index.cjs').then(({initFocusVisible:n})=>{e.push(n());}),import('./announcer/index.cjs').then(({initAnnouncer:n})=>{e.push(n());}),()=>{e.forEach(n=>n());}}Object.defineProperty(exports,"FOCUSABLE_SELECTORS",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.a}});Object.defineProperty(exports,"TABBABLE_SELECTORS",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.b}});Object.defineProperty(exports,"containsFocus",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.j}});Object.defineProperty(exports,"createFocusReturn",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.A}});Object.defineProperty(exports,"createFocusScope",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.x}});Object.defineProperty(exports,"createFocusTrap",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.o}});Object.defineProperty(exports,"createRovingTabindex",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.y}});Object.defineProperty(exports,"findFocusNeighbor",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.z}});Object.defineProperty(exports,"focusWithVisibleRing",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.w}});Object.defineProperty(exports,"getActiveFocusTrap",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.p}});Object.defineProperty(exports,"getFirstFocusable",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.h}});Object.defineProperty(exports,"getFocusableElements",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.f}});Object.defineProperty(exports,"getLastFocusSource",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.u}});Object.defineProperty(exports,"getLastFocusable",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.i}});Object.defineProperty(exports,"getNextFocusable",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.k}});Object.defineProperty(exports,"getPreviousFocusable",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.l}});Object.defineProperty(exports,"getTabbableElements",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.g}});Object.defineProperty(exports,"hasFocusTrap",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.q}});Object.defineProperty(exports,"hasVisibleFocus",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.t}});Object.defineProperty(exports,"initFocusVisible",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.r}});Object.defineProperty(exports,"isFocusVisible",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.s}});Object.defineProperty(exports,"isFocusable",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.d}});Object.defineProperty(exports,"isTabbable",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.e}});Object.defineProperty(exports,"isVisible",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.c}});Object.defineProperty(exports,"isWithinContainer",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.m}});Object.defineProperty(exports,"resolveElement",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.n}});Object.defineProperty(exports,"setFocusVisible",{enumerable:true,get:function(){return chunkAL3UYWIX_cjs.v}});Object.defineProperty(exports,"KeyboardPatterns",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.d}});Object.defineProperty(exports,"createKeyboardManager",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.c}});Object.defineProperty(exports,"createTypeAhead",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.e}});Object.defineProperty(exports,"getKeyCombo",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.b}});Object.defineProperty(exports,"normalizeKey",{enumerable:true,get:function(){return chunkEM45V5TK_cjs.a}});Object.defineProperty(exports,"announce",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.b}});Object.defineProperty(exports,"announceAssertive",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.d}});Object.defineProperty(exports,"announceError",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.i}});Object.defineProperty(exports,"announcePolite",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.c}});Object.defineProperty(exports,"announceProgress",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.j}});Object.defineProperty(exports,"announceStatus",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.h}});Object.defineProperty(exports,"clearAnnouncements",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.e}});Object.defineProperty(exports,"createAnnouncer",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.g}});Object.defineProperty(exports,"initAnnouncer",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.a}});Object.defineProperty(exports,"queueAnnouncement",{enumerable:true,get:function(){return chunkAQ6HEUSD_cjs.f}});Object.defineProperty(exports,"createMediaQueryListener",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.k}});Object.defineProperty(exports,"getScreenReaderHints",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.j}});Object.defineProperty(exports,"isAndroid",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.d}});Object.defineProperty(exports,"isBrowser",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.a}});Object.defineProperty(exports,"isIOS",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.c}});Object.defineProperty(exports,"isMac",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.b}});Object.defineProperty(exports,"isTouchDevice",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.f}});Object.defineProperty(exports,"isWindows",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.e}});Object.defineProperty(exports,"prefersDarkMode",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.i}});Object.defineProperty(exports,"prefersHighContrast",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.h}});Object.defineProperty(exports,"prefersReducedMotion",{enumerable:true,get:function(){return chunk7BL2ABLF_cjs.g}});Object.defineProperty(exports,"aria",{enumerable:true,get:function(){return chunkKQUAJKTG_cjs.a}});Object.defineProperty(exports,"buildAriaProps",{enumerable:true,get:function(){return chunkKQUAJKTG_cjs.b}});Object.defineProperty(exports,"hasAccessibleName",{enumerable:true,get:function(){return chunkKQUAJKTG_cjs.d}});Object.defineProperty(exports,"mergeAriaIds",{enumerable:true,get:function(){return chunkKQUAJKTG_cjs.c}});exports.checks=s;exports.clearWarnings=x;exports.createComponentWarnings=y;exports.createIdScope=Ae;exports.generateId=u;exports.generateIds=$e;exports.initCompa11y=We;exports.resetIdCounter=we;exports.setWarningHandler=b;exports.warn=i;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export{a as FOCUSABLE_SELECTORS,b as TABBABLE_SELECTORS,j as containsFocus,A as createFocusReturn,x as createFocusScope,o as createFocusTrap,y as createRovingTabindex,z as findFocusNeighbor,w as focusWithVisibleRing,p as getActiveFocusTrap,h as getFirstFocusable,f as getFocusableElements,u as getLastFocusSource,i as getLastFocusable,k as getNextFocusable,l as getPreviousFocusable,g as getTabbableElements,q as hasFocusTrap,t as hasVisibleFocus,r as initFocusVisible,s as isFocusVisible,d as isFocusable,e as isTabbable,c as isVisible,m as isWithinContainer,n as resolveElement,v as setFocusVisible}from'./chunk-QGEFH2VG.js';export{d as KeyboardPatterns,c as createKeyboardManager,e as createTypeAhead,b as getKeyCombo,a as normalizeKey}from'./chunk-RE4QIUWR.js';export{b as announce,d as announceAssertive,i as announceError,c as announcePolite,j as announceProgress,h as announceStatus,e as clearAnnouncements,g as createAnnouncer,a as initAnnouncer,f as queueAnnouncement}from'./chunk-ZAQMM5TA.js';export{k as createMediaQueryListener,j as getScreenReaderHints,d as isAndroid,a as isBrowser,c as isIOS,b as isMac,f as isTouchDevice,e as isWindows,i as prefersDarkMode,h as prefersHighContrast,g as prefersReducedMotion}from'./chunk-C3VZQUKG.js';import {d as d$1}from'./chunk-TGXWODB3.js';export{a as aria,b as buildAriaProps,d as hasAccessibleName,c as mergeAriaIds}from'./chunk-TGXWODB3.js';var g=0,d="compa11y";function u(e){let n=++g;return e?`${d}-${e}-${n}`:`${d}-${n}`}function $e(e,n){let r=u(n),t={};for(let o of e)t[o]=`${r}-${o}`;return t}function we(){g=0;}function Ae(e){let n=u(e);return {id:n,generate:r=>`${n}-${r}`,generateMultiple:r=>{let t={};for(let o of r)t[o]=`${n}-${o}`;return t}}}var a=null,l=new Set;function p(){return typeof process<"u"&&process.env?.NODE_ENV!=="production"}function b(e){a=e;}function f(e){return `${e.component}:${e.message}`}function i(e){if(!p())return;let n=f(e);if(l.has(n))return;if(l.add(n),a){a(e);return}let r=`[compa11y/${e.component}]`,t=m(e.type),o=e.suggestion?`${e.message}
1
+ export{a as FOCUSABLE_SELECTORS,b as TABBABLE_SELECTORS,j as containsFocus,A as createFocusReturn,x as createFocusScope,o as createFocusTrap,y as createRovingTabindex,z as findFocusNeighbor,w as focusWithVisibleRing,p as getActiveFocusTrap,h as getFirstFocusable,f as getFocusableElements,u as getLastFocusSource,i as getLastFocusable,k as getNextFocusable,l as getPreviousFocusable,g as getTabbableElements,q as hasFocusTrap,t as hasVisibleFocus,r as initFocusVisible,s as isFocusVisible,d as isFocusable,e as isTabbable,c as isVisible,m as isWithinContainer,n as resolveElement,v as setFocusVisible}from'./chunk-7RLRK53P.js';export{d as KeyboardPatterns,c as createKeyboardManager,e as createTypeAhead,b as getKeyCombo,a as normalizeKey}from'./chunk-RE4QIUWR.js';export{b as announce,d as announceAssertive,i as announceError,c as announcePolite,j as announceProgress,h as announceStatus,e as clearAnnouncements,g as createAnnouncer,a as initAnnouncer,f as queueAnnouncement}from'./chunk-ZAQMM5TA.js';export{k as createMediaQueryListener,j as getScreenReaderHints,d as isAndroid,a as isBrowser,c as isIOS,b as isMac,f as isTouchDevice,e as isWindows,i as prefersDarkMode,h as prefersHighContrast,g as prefersReducedMotion}from'./chunk-C3VZQUKG.js';import {d as d$1}from'./chunk-TGXWODB3.js';export{a as aria,b as buildAriaProps,d as hasAccessibleName,c as mergeAriaIds}from'./chunk-TGXWODB3.js';var g=0,d="compa11y";function u(e){let n=++g;return e?`${d}-${e}-${n}`:`${d}-${n}`}function $e(e,n){let r=u(n),t={};for(let o of e)t[o]=`${r}-${o}`;return t}function we(){g=0;}function Ae(e){let n=u(e);return {id:n,generate:r=>`${n}-${r}`,generateMultiple:r=>{let t={};for(let o of r)t[o]=`${n}-${o}`;return t}}}var a=null,l=new Set;function p(){return typeof process<"u"&&process.env?.NODE_ENV!=="production"}function b(e){a=e;}function f(e){return `${e.component}:${e.message}`}function i(e){if(!p())return;let n=f(e);if(l.has(n))return;if(l.add(n),a){a(e);return}let r=`[compa11y/${e.component}]`,t=m(e.type),o=e.suggestion?`${e.message}
2
2
 
3
3
  \u{1F4A1} Suggestion: ${e.suggestion}`:e.message;switch(e.type){case "error":console.error(`%c${r}%c ${o}`,t,"");break;case "warning":console.warn(`%c${r}%c ${o}`,t,"");break;case "info":console.info(`%c${r}%c ${o}`,t,"");break}e.element&&console.log("Element:",e.element);}function m(e){switch(e){case "error":return "background: #ff5555; color: white; padding: 2px 4px; border-radius: 2px; font-weight: bold;";case "warning":return "background: #ffaa00; color: black; padding: 2px 4px; border-radius: 2px; font-weight: bold;";case "info":return "background: #5555ff; color: white; padding: 2px 4px; border-radius: 2px; font-weight: bold;"}}function x(){l.clear();}var s={accessibleLabel(e,n,r="aria-label"){e&&(d$1(e)||i({type:"error",component:n,message:"Missing accessible label. Screen reader users will not be able to understand this element.",suggestion:`Add ${r}, aria-labelledby, or visible text content.`,element:e}));},requiredProp(e,n,r){(e==null||e==="")&&i({type:"error",component:r,message:`Missing required prop "${n}".`,suggestion:`Provide a value for the "${n}" prop.`});},validRole(e,n,r){if(!e)return;new Set(["alert","alertdialog","application","article","banner","button","cell","columnheader","combobox","complementary","contentinfo","definition","dialog","directory","document","feed","figure","form","grid","gridcell","group","heading","img","link","list","listbox","listitem","log","main","marquee","math","menu","menubar","menuitem","navigation","none","note","option","presentation","progressbar","region","row","rowgroup","rowheader","scrollbar","search","searchbox","separator","slider","spinbutton","status","switch","tab","table","tablist","tabpanel","term","textbox","timer","toolbar","tooltip","tree","treegrid","treeitem"]).has(e)||i({type:"warning",component:n,message:`Invalid ARIA role "${e}".`,suggestion:"Use a valid ARIA role from the WAI-ARIA specification.",element:r});},keyboardAccessible(e,n,r){if(e&&r.onClick&&!r.onKeyDown){let t=e.tagName.toLowerCase(),o=e.getAttribute("role");if(["button","a","input","select","textarea"].includes(t))return;o&&["button","link","menuitem","option","tab"].includes(o)&&i({type:"warning",component:n,message:"Element has onClick but no onKeyDown handler.",suggestion:"Add keyboard event handling for Enter and Space keys.",element:e});}},tabIndex(e,n,r){e!==void 0&&e>0&&i({type:"warning",component:n,message:`Positive tabIndex (${e}) disrupts natural tab order.`,suggestion:"Use tabIndex={0} or tabIndex={-1} instead. Rely on DOM order for tab sequence.",element:r});},dialogAutoFocus(e,n){e||i({type:"info",component:n,message:"No initial focus element specified for dialog.",suggestion:"Consider setting initialFocus to guide keyboard users."});},formLabel(e,n,r){if(!e)return;n||e.getAttribute("aria-label")||e.getAttribute("aria-labelledby")||e.labels?.length||i({type:"error",component:r,message:"Form input is missing an accessible label.",suggestion:"Add a <label>, aria-label, or aria-labelledby.",element:e});},imageAlt(e,n){if(!e||e.tagName!=="IMG")return;let r=e.getAttribute("alt"),t=e.getAttribute("role");r===null&&t!=="presentation"&&t!=="none"&&i({type:"error",component:n,message:"Image is missing alt attribute.",suggestion:'Add alt="" for decorative images or descriptive alt text for meaningful images.',element:e});}};function y(e){return {error:(n,r,t)=>i({type:"error",component:e,message:n,suggestion:r,element:t}),warning:(n,r,t)=>i({type:"warning",component:e,message:n,suggestion:r,element:t}),info:(n,r,t)=>i({type:"info",component:e,message:n,suggestion:r,element:t}),checks:{accessibleLabel:(n,r)=>s.accessibleLabel(n,e,r),requiredProp:(n,r)=>s.requiredProp(n,r,e),keyboardAccessible:(n,r)=>s.keyboardAccessible(n,e,r),tabIndex:(n,r)=>s.tabIndex(n,e,r)}}}function We(){let e=[];return import('./focus/index.js').then(({initFocusVisible:n})=>{e.push(n());}),import('./announcer/index.js').then(({initAnnouncer:n})=>{e.push(n());}),()=>{e.forEach(n=>n());}}export{s as checks,x as clearWarnings,y as createComponentWarnings,Ae as createIdScope,u as generateId,$e as generateIds,We as initCompa11y,we as resetIdCounter,b as setWarningHandler,i as warn};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compa11y/core",
3
- "version": "0.1.12",
3
+ "version": "0.2.0",
4
4
  "description": "Framework-agnostic accessibility primitives",
5
5
  "author": "Ivan Trajkovski",
6
6
  "license": "MIT",
@@ -50,7 +50,8 @@
50
50
  "files": [
51
51
  "dist",
52
52
  "README.md",
53
- "LICENSE"
53
+ "LICENSE",
54
+ "CHANGELOG.md"
54
55
  ],
55
56
  "devDependencies": {
56
57
  "@types/node": "^20.11.0",
@@ -58,6 +59,13 @@
58
59
  "typescript": "^5.3.0",
59
60
  "vitest": "^1.2.0"
60
61
  },
62
+ "engines": {
63
+ "node": ">=18.0.0"
64
+ },
65
+ "funding": {
66
+ "type": "github",
67
+ "url": "https://github.com/sponsors/trajkovskiivan"
68
+ },
61
69
  "sideEffects": false,
62
70
  "keywords": [
63
71
  "accessibility",
@@ -1 +0,0 @@
1
- import {a}from'./chunk-C3VZQUKG.js';var D=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","iframe"].join(","),K=['a[href]:not([tabindex="-1"])','area[href]:not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"])','[contenteditable="true"]:not([tabindex="-1"])','audio[controls]:not([tabindex="-1"])','video[controls]:not([tabindex="-1"])','details > summary:first-of-type:not([tabindex="-1"])','iframe:not([tabindex="-1"])'].join(",");function U(e){if(!(e instanceof HTMLElement)||e.hidden||e.style.display==="none"||e.style.visibility==="hidden")return false;let t=window.getComputedStyle(e);return !(t.display==="none"||t.visibility==="hidden"||!e.isConnected)}function V(e){return !(!(e instanceof HTMLElement)||!U(e)||!e.matches(D)||e.closest("[inert]"))}function I(e){return !V(e)||e.tabIndex<0?false:e.matches(K)}function oe(e){return Array.from(e.querySelectorAll(D)).filter(V)}function T(e){return Array.from(e.querySelectorAll(K)).filter(I).sort((u,r)=>{let n=Math.max(0,u.tabIndex),i=Math.max(0,r.tabIndex);return n===0&&i===0?0:n===0?1:i===0?-1:n-i})}function k(e){return T(e)[0]??null}function re(e){let t=T(e);return t[t.length-1]??null}function P(e){let t=document.activeElement;return t!==null&&e.contains(t)}function N(e,t,a=true){let u=T(e),r=u.indexOf(t);if(r===-1)return u[0]??null;let n=r+1;return n<u.length?u[n]:a?u[0]??null:null}function C(e,t,a=true){let u=T(e),r=u.indexOf(t);if(r===-1)return u[u.length-1]??null;let n=r-1;return n>=0?u[n]:a?u[u.length-1]??null:null}function ie(e,t){return t.contains(e)}function q(e,t=document.body){return e?typeof e=="string"?t.querySelector(e):typeof e=="function"?e():e:null}var F=[];function _(e,t={}){let{initialFocus:a,returnFocus:u=true,clickOutsideDeactivates:r=false,escapeDeactivates:n=true,onDeactivate:i,onEscapeFocus:c}=t,o=false,b=false,f=null;function h(l){b||!o||(l.key==="Tab"?y(l):l.key==="Escape"&&n&&(l.preventDefault(),l.stopPropagation(),v()));}function y(l){let E=T(e);if(E.length===0){l.preventDefault();return}let w=E[0],g=E[E.length-1],S=document.activeElement;l.shiftKey?(S===w||!e.contains(S))&&(l.preventDefault(),g.focus()):(S===g||!e.contains(S))&&(l.preventDefault(),w.focus());}function p(l){if(b||!o)return;let E=l.target;e.contains(E)||(c?.(E),k(e)?.focus());}function d(l){if(b||!o)return;let E=l.target;r&&!e.contains(E)&&v();}function m(){if(!o){f=document.activeElement,F.push(A);for(let l=0;l<F.length-1;l++)F[l].pause();document.addEventListener("keydown",h,true),document.addEventListener("focusin",p,true),document.addEventListener("click",d,true),o=true,requestAnimationFrame(()=>{if(!o)return;let l=q(a,e);if(l)l.focus();else {let E=k(e);E?E.focus():(e.setAttribute("tabindex","-1"),e.focus());}});}}function s(l){if(!o)return;document.removeEventListener("keydown",h,true),document.removeEventListener("focusin",p,true),document.removeEventListener("click",d,true),o=false,b=false;let E=F.indexOf(A);if(E>-1&&F.splice(E,1),F[F.length-1]?.unpause(),u&&f){let g=typeof u=="boolean"?f:u;requestAnimationFrame(()=>{g&&"focus"in g&&g.focus();});}l&&i?.();}function v(){s(true);}function L(){s(false);}function M(){!o||b||(b=true);}function H(){!o||!b||(b=false,P(e)||k(e)?.focus());}let A={activate:m,deactivate:v,destroy:L,pause:M,unpause:H,isActive:()=>o,isPaused:()=>b};return A}function z(){return F[F.length-1]??null}function W(){return F.length>0}var x={hadKeyboardEvent:true,isPointerInput:false,lastFocusSource:"unknown"},O=false,j=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter"," ","Home","End","PageUp","PageDown","Escape"]);function G(){if(!a()||O)return ()=>{};O=true;function e(n){j.has(n.key)&&(x.hadKeyboardEvent=true,x.isPointerInput=false,x.lastFocusSource="keyboard");}function t(n){x.isPointerInput=true,x.hadKeyboardEvent=false,x.lastFocusSource="pointerType"in n&&n.pointerType==="touch"?"touch":"mouse";}function a$1(n){let i=n.target;i instanceof HTMLElement&&(x.hadKeyboardEvent||Y(i))&&(i.dataset.a11ykitFocusVisible="true");}function u(n){let i=n.target;i instanceof HTMLElement&&delete i.dataset.a11ykitFocusVisible;}function r(){document.visibilityState==="hidden"&&(x.hadKeyboardEvent=true);}return document.addEventListener("keydown",e,true),document.addEventListener("mousedown",t,true),document.addEventListener("pointerdown",t,true),document.addEventListener("focus",a$1,true),document.addEventListener("blur",u,true),document.addEventListener("visibilitychange",r,true),()=>{document.removeEventListener("keydown",e,true),document.removeEventListener("mousedown",t,true),document.removeEventListener("pointerdown",t,true),document.removeEventListener("focus",a$1,true),document.removeEventListener("blur",u,true),document.removeEventListener("visibilitychange",r,true),O=false;}}function Y(e){let t=e.tagName.toLowerCase(),a=e.getAttribute("type")?.toLowerCase();return !!(t==="input"&&(!a||a==="text"||a==="email"||a==="password"||a==="search"||a==="tel"||a==="url"||a==="number")||t==="textarea"||e.isContentEditable)}function J(){return x.hadKeyboardEvent}function Q(e){return e.dataset.a11ykitFocusVisible==="true"}function X(){return x.lastFocusSource}function Z(e,t){t?e.dataset.a11ykitFocusVisible="true":delete e.dataset.a11ykitFocusVisible;}function $(e,t){x.hadKeyboardEvent=true,x.lastFocusSource="keyboard",e.focus(t);}function ee(e,t={}){let{contain:a=false,restoreFocus:u=false,autoFocus:r=false}=t,n=null,i=false;u&&(n=document.activeElement);function c(){return i?[]:T(e)}function o(){let s=document.activeElement;return s&&e.contains(s)?s:null}function b(){if(i)return;c()[0]?.focus();}function f(){if(i)return;let s=c();s[s.length-1]?.focus();}function h({wrap:s=true}={}){if(i)return;let v=o();if(!v){b();return}N(e,v,s)?.focus();}function y({wrap:s=true}={}){if(i)return;let v=o();if(!v){f();return}C(e,v,s)?.focus();}function p(s){if(i)return;c()[s]?.focus();}function d(s){if(!(i||!a)&&s.key==="Tab"){let v=c();if(v.length===0){s.preventDefault();return}let L=v[0],M=v[v.length-1],H=o();s.shiftKey&&H===L?(s.preventDefault(),M.focus()):!s.shiftKey&&H===M&&(s.preventDefault(),L.focus());}}function m(){i||(i=true,document.removeEventListener("keydown",d,true),u&&n&&n.focus());}return a&&document.addEventListener("keydown",d,true),r&&requestAnimationFrame(()=>{i||b();}),{focusFirst:b,focusLast:f,focusNext:h,focusPrevious:y,focusAt:p,getFocused:o,getElements:c,destroy:m}}function te(e,t,a={}){let{initialIndex:u=0,orientation:r="both",wrap:n=true,onSelectionChange:i}=a,c=[],o=u;function b(){c=Array.from(e.querySelectorAll(t)),c.forEach((p,d)=>{p.setAttribute("tabindex",d===o?"0":"-1");});}function f(p){if(c.length===0)return;let d=p;d<0?d=n?c.length-1:0:d>=c.length&&(d=n?0:c.length-1);let m=c[o],s=c[d];m&&m.setAttribute("tabindex","-1"),s&&(s.setAttribute("tabindex","0"),s.focus(),i?.(d,s)),o=d;}function h(p){let d=p.target;if(!c.includes(d))return;let m=false;switch(p.key){case "ArrowRight":(r==="horizontal"||r==="both")&&(f(o+1),m=true);break;case "ArrowLeft":(r==="horizontal"||r==="both")&&(f(o-1),m=true);break;case "ArrowDown":(r==="vertical"||r==="both")&&(f(o+1),m=true);break;case "ArrowUp":(r==="vertical"||r==="both")&&(f(o-1),m=true);break;case "Home":f(0),m=true;break;case "End":f(c.length-1),m=true;break}m&&(p.preventDefault(),p.stopPropagation());}function y(p){let d=p.target,m=c.indexOf(d);if(m!==-1&&m!==o){let s=c[o];s&&s.setAttribute("tabindex","-1"),d.setAttribute("tabindex","0"),o=m;}}return b(),e.addEventListener("keydown",h),e.addEventListener("focusin",y),{next:()=>f(o+1),previous:()=>f(o-1),first:()=>f(0),last:()=>f(c.length-1),goto:f,getIndex:()=>o,update:b,destroy:()=>{e.removeEventListener("keydown",h),e.removeEventListener("focusin",y);}}}function B(e,t={}){let{scope:a=e.parentElement??document.body,prefer:u="previous"}=t,r=T(a),n=r.indexOf(e);n===-1&&(n=r.findIndex(f=>e.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_FOLLOWING),n===-1&&(n=r.length));let i=n-1,c=n+1,o=i>=0&&r[i]!==e?r[i]:null,b=c<r.length&&r[c]!==e?r[c]:null;return u==="previous"?o??b:b??o}function ne(e){let t=e??null;function a(n){t=n??document.activeElement??null;}function u(n={}){let{fallback:i,prefer:c="previous"}=n;if(!t){i?.focus();return}if(t.isConnected&&I(t)){t.focus(),t=null;return}if(t.isConnected){let o=B(t,{prefer:c});if(o){o.focus(),t=null;return}}i&&i.focus(),t=null;}function r(){t=null;}return {get element(){return t},save:a,return:u,clear:r}}export{ne as A,D as a,K as b,U as c,V as d,I as e,oe as f,T as g,k as h,re as i,P as j,N as k,C as l,ie as m,q as n,_ as o,z as p,W as q,G as r,J as s,Q as t,X as u,Z as v,$ as w,ee as x,te as y,B as z};
@@ -1 +0,0 @@
1
- 'use strict';var chunk7BL2ABLF_cjs=require('./chunk-7BL2ABLF.cjs');var D=["a[href]","area[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]',"audio[controls]","video[controls]","details > summary:first-of-type","iframe"].join(","),K=['a[href]:not([tabindex="-1"])','area[href]:not([tabindex="-1"])','button:not([disabled]):not([tabindex="-1"])','input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])','select:not([disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([tabindex="-1"])','[tabindex]:not([tabindex="-1"])','[contenteditable="true"]:not([tabindex="-1"])','audio[controls]:not([tabindex="-1"])','video[controls]:not([tabindex="-1"])','details > summary:first-of-type:not([tabindex="-1"])','iframe:not([tabindex="-1"])'].join(",");function U(e){if(!(e instanceof HTMLElement)||e.hidden||e.style.display==="none"||e.style.visibility==="hidden")return false;let t=window.getComputedStyle(e);return !(t.display==="none"||t.visibility==="hidden"||!e.isConnected)}function V(e){return !(!(e instanceof HTMLElement)||!U(e)||!e.matches(D)||e.closest("[inert]"))}function I(e){return !V(e)||e.tabIndex<0?false:e.matches(K)}function oe(e){return Array.from(e.querySelectorAll(D)).filter(V)}function T(e){return Array.from(e.querySelectorAll(K)).filter(I).sort((u,r)=>{let n=Math.max(0,u.tabIndex),i=Math.max(0,r.tabIndex);return n===0&&i===0?0:n===0?1:i===0?-1:n-i})}function k(e){return T(e)[0]??null}function re(e){let t=T(e);return t[t.length-1]??null}function P(e){let t=document.activeElement;return t!==null&&e.contains(t)}function N(e,t,a=true){let u=T(e),r=u.indexOf(t);if(r===-1)return u[0]??null;let n=r+1;return n<u.length?u[n]:a?u[0]??null:null}function C(e,t,a=true){let u=T(e),r=u.indexOf(t);if(r===-1)return u[u.length-1]??null;let n=r-1;return n>=0?u[n]:a?u[u.length-1]??null:null}function ie(e,t){return t.contains(e)}function q(e,t=document.body){return e?typeof e=="string"?t.querySelector(e):typeof e=="function"?e():e:null}var F=[];function _(e,t={}){let{initialFocus:a,returnFocus:u=true,clickOutsideDeactivates:r=false,escapeDeactivates:n=true,onDeactivate:i,onEscapeFocus:c}=t,o=false,b=false,f=null;function h(l){b||!o||(l.key==="Tab"?y(l):l.key==="Escape"&&n&&(l.preventDefault(),l.stopPropagation(),v()));}function y(l){let E=T(e);if(E.length===0){l.preventDefault();return}let w=E[0],g=E[E.length-1],S=document.activeElement;l.shiftKey?(S===w||!e.contains(S))&&(l.preventDefault(),g.focus()):(S===g||!e.contains(S))&&(l.preventDefault(),w.focus());}function p(l){if(b||!o)return;let E=l.target;e.contains(E)||(c?.(E),k(e)?.focus());}function d(l){if(b||!o)return;let E=l.target;r&&!e.contains(E)&&v();}function m(){if(!o){f=document.activeElement,F.push(A);for(let l=0;l<F.length-1;l++)F[l].pause();document.addEventListener("keydown",h,true),document.addEventListener("focusin",p,true),document.addEventListener("click",d,true),o=true,requestAnimationFrame(()=>{if(!o)return;let l=q(a,e);if(l)l.focus();else {let E=k(e);E?E.focus():(e.setAttribute("tabindex","-1"),e.focus());}});}}function s(l){if(!o)return;document.removeEventListener("keydown",h,true),document.removeEventListener("focusin",p,true),document.removeEventListener("click",d,true),o=false,b=false;let E=F.indexOf(A);if(E>-1&&F.splice(E,1),F[F.length-1]?.unpause(),u&&f){let g=typeof u=="boolean"?f:u;requestAnimationFrame(()=>{g&&"focus"in g&&g.focus();});}l&&i?.();}function v(){s(true);}function L(){s(false);}function M(){!o||b||(b=true);}function H(){!o||!b||(b=false,P(e)||k(e)?.focus());}let A={activate:m,deactivate:v,destroy:L,pause:M,unpause:H,isActive:()=>o,isPaused:()=>b};return A}function z(){return F[F.length-1]??null}function W(){return F.length>0}var x={hadKeyboardEvent:true,isPointerInput:false,lastFocusSource:"unknown"},O=false,j=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Enter"," ","Home","End","PageUp","PageDown","Escape"]);function G(){if(!chunk7BL2ABLF_cjs.a()||O)return ()=>{};O=true;function e(n){j.has(n.key)&&(x.hadKeyboardEvent=true,x.isPointerInput=false,x.lastFocusSource="keyboard");}function t(n){x.isPointerInput=true,x.hadKeyboardEvent=false,x.lastFocusSource="pointerType"in n&&n.pointerType==="touch"?"touch":"mouse";}function a(n){let i=n.target;i instanceof HTMLElement&&(x.hadKeyboardEvent||Y(i))&&(i.dataset.a11ykitFocusVisible="true");}function u(n){let i=n.target;i instanceof HTMLElement&&delete i.dataset.a11ykitFocusVisible;}function r(){document.visibilityState==="hidden"&&(x.hadKeyboardEvent=true);}return document.addEventListener("keydown",e,true),document.addEventListener("mousedown",t,true),document.addEventListener("pointerdown",t,true),document.addEventListener("focus",a,true),document.addEventListener("blur",u,true),document.addEventListener("visibilitychange",r,true),()=>{document.removeEventListener("keydown",e,true),document.removeEventListener("mousedown",t,true),document.removeEventListener("pointerdown",t,true),document.removeEventListener("focus",a,true),document.removeEventListener("blur",u,true),document.removeEventListener("visibilitychange",r,true),O=false;}}function Y(e){let t=e.tagName.toLowerCase(),a=e.getAttribute("type")?.toLowerCase();return !!(t==="input"&&(!a||a==="text"||a==="email"||a==="password"||a==="search"||a==="tel"||a==="url"||a==="number")||t==="textarea"||e.isContentEditable)}function J(){return x.hadKeyboardEvent}function Q(e){return e.dataset.a11ykitFocusVisible==="true"}function X(){return x.lastFocusSource}function Z(e,t){t?e.dataset.a11ykitFocusVisible="true":delete e.dataset.a11ykitFocusVisible;}function $(e,t){x.hadKeyboardEvent=true,x.lastFocusSource="keyboard",e.focus(t);}function ee(e,t={}){let{contain:a=false,restoreFocus:u=false,autoFocus:r=false}=t,n=null,i=false;u&&(n=document.activeElement);function c(){return i?[]:T(e)}function o(){let s=document.activeElement;return s&&e.contains(s)?s:null}function b(){if(i)return;c()[0]?.focus();}function f(){if(i)return;let s=c();s[s.length-1]?.focus();}function h({wrap:s=true}={}){if(i)return;let v=o();if(!v){b();return}N(e,v,s)?.focus();}function y({wrap:s=true}={}){if(i)return;let v=o();if(!v){f();return}C(e,v,s)?.focus();}function p(s){if(i)return;c()[s]?.focus();}function d(s){if(!(i||!a)&&s.key==="Tab"){let v=c();if(v.length===0){s.preventDefault();return}let L=v[0],M=v[v.length-1],H=o();s.shiftKey&&H===L?(s.preventDefault(),M.focus()):!s.shiftKey&&H===M&&(s.preventDefault(),L.focus());}}function m(){i||(i=true,document.removeEventListener("keydown",d,true),u&&n&&n.focus());}return a&&document.addEventListener("keydown",d,true),r&&requestAnimationFrame(()=>{i||b();}),{focusFirst:b,focusLast:f,focusNext:h,focusPrevious:y,focusAt:p,getFocused:o,getElements:c,destroy:m}}function te(e,t,a={}){let{initialIndex:u=0,orientation:r="both",wrap:n=true,onSelectionChange:i}=a,c=[],o=u;function b(){c=Array.from(e.querySelectorAll(t)),c.forEach((p,d)=>{p.setAttribute("tabindex",d===o?"0":"-1");});}function f(p){if(c.length===0)return;let d=p;d<0?d=n?c.length-1:0:d>=c.length&&(d=n?0:c.length-1);let m=c[o],s=c[d];m&&m.setAttribute("tabindex","-1"),s&&(s.setAttribute("tabindex","0"),s.focus(),i?.(d,s)),o=d;}function h(p){let d=p.target;if(!c.includes(d))return;let m=false;switch(p.key){case "ArrowRight":(r==="horizontal"||r==="both")&&(f(o+1),m=true);break;case "ArrowLeft":(r==="horizontal"||r==="both")&&(f(o-1),m=true);break;case "ArrowDown":(r==="vertical"||r==="both")&&(f(o+1),m=true);break;case "ArrowUp":(r==="vertical"||r==="both")&&(f(o-1),m=true);break;case "Home":f(0),m=true;break;case "End":f(c.length-1),m=true;break}m&&(p.preventDefault(),p.stopPropagation());}function y(p){let d=p.target,m=c.indexOf(d);if(m!==-1&&m!==o){let s=c[o];s&&s.setAttribute("tabindex","-1"),d.setAttribute("tabindex","0"),o=m;}}return b(),e.addEventListener("keydown",h),e.addEventListener("focusin",y),{next:()=>f(o+1),previous:()=>f(o-1),first:()=>f(0),last:()=>f(c.length-1),goto:f,getIndex:()=>o,update:b,destroy:()=>{e.removeEventListener("keydown",h),e.removeEventListener("focusin",y);}}}function B(e,t={}){let{scope:a=e.parentElement??document.body,prefer:u="previous"}=t,r=T(a),n=r.indexOf(e);n===-1&&(n=r.findIndex(f=>e.compareDocumentPosition(f)&Node.DOCUMENT_POSITION_FOLLOWING),n===-1&&(n=r.length));let i=n-1,c=n+1,o=i>=0&&r[i]!==e?r[i]:null,b=c<r.length&&r[c]!==e?r[c]:null;return u==="previous"?o??b:b??o}function ne(e){let t=e??null;function a(n){t=n??document.activeElement??null;}function u(n={}){let{fallback:i,prefer:c="previous"}=n;if(!t){i?.focus();return}if(t.isConnected&&I(t)){t.focus(),t=null;return}if(t.isConnected){let o=B(t,{prefer:c});if(o){o.focus(),t=null;return}}i&&i.focus(),t=null;}function r(){t=null;}return {get element(){return t},save:a,return:u,clear:r}}exports.A=ne;exports.a=D;exports.b=K;exports.c=U;exports.d=V;exports.e=I;exports.f=oe;exports.g=T;exports.h=k;exports.i=re;exports.j=P;exports.k=N;exports.l=C;exports.m=ie;exports.n=q;exports.o=_;exports.p=z;exports.q=W;exports.r=G;exports.s=J;exports.t=Q;exports.u=X;exports.v=Z;exports.w=$;exports.x=ee;exports.y=te;exports.z=B;