allyward 0.0.0 → 1.0.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/LICENSE +21 -0
- package/README.md +10 -1
- package/THIRD-PARTY-NOTICES.txt +6201 -0
- package/chunks/chunk-34BTBUDF.mjs +49 -0
- package/chunks/chunk-6W3JS6DP.mjs +2 -0
- package/chunks/chunk-7T75TQUC.mjs +9 -0
- package/chunks/chunk-7UDH5BXX.mjs +2 -0
- package/chunks/chunk-FQWMXWVV.mjs +2 -0
- package/chunks/chunk-GMYSZQLH.mjs +2 -0
- package/chunks/chunk-KVSUD4M5.mjs +10 -0
- package/chunks/chunk-LRFMPFDN.mjs +5 -0
- package/chunks/chunk-OLLDCSVO.mjs +411 -0
- package/chunks/chunk-PX6A45SJ.mjs +2 -0
- package/chunks/chunk-RAB5WJOG.mjs +126 -0
- package/chunks/chunk-SFKKPIGE.mjs +177 -0
- package/chunks/chunk-SNU37HWC.mjs +6 -0
- package/chunks/chunk-UIPLYHZY.mjs +2 -0
- package/chunks/chunk-YX75XWC5.mjs +47 -0
- package/chunks/engine-2IR2XTU3.mjs +6 -0
- package/chunks/engine-6ZXXNROB.mjs +217 -0
- package/chunks/engine-BIE3PYS6.mjs +113 -0
- package/chunks/engine-BXEHUF3N.mjs +1207 -0
- package/chunks/engine-EIRLRZJL.mjs +91 -0
- package/chunks/engine-TPXDCC2K.mjs +2 -0
- package/cli.mjs +117 -0
- package/package.json +43 -4
- package/schema/check-result.v1.json +96 -0
- package/worker.mjs +2 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{a as k,c as x,d as I}from"./chunk-6W3JS6DP.mjs";import{c as M,d as j,g as q}from"./chunk-SNU37HWC.mjs";import{h as F}from"./chunk-7UDH5BXX.mjs";function S(t){let[e]=t.split(/\r?\n/,1);return e.length>200?`${e.slice(0,200)}\u2026`:e}var B={"23a2a8":"Image has non-empty accessible name","24afc2":"Important letter spacing in style attributes is wide enough","2779a5":"HTML page has non-empty title","2ee8b8":"Visible label is part of accessible name","2t702h":"Summary element has non-empty accessible name","307n5z":"Element with presentational children has no focusable content","46ca7f":"Element marked as decorative is not exposed","4b1c6c":"Iframe elements with identical accessible names have equivalent purpose","4e8ab6":"Element with role attribute has required states and properties","59796f":"Image button has non-empty accessible name","5b7ae0":"HTML page lang and xml:lang attributes have matching values","5c01ea":"ARIA state or property is permitted","5effbb":"Link in context is descriptive","5f99a7":"ARIA attribute is defined in WAI-ARIA","674b10":"Role attribute has valid value","6a7281":"ARIA state or property has valid value","6cfa84":"Element with aria-hidden has no content in sequential focus navigation","73f2c2":"Autocomplete attribute has valid value","78fd32":"Important line height in style attributes is wide enough","7d6734":"SVG element with explicit role has non-empty accessible name","80f0bf":"Audio or video element avoids automatically playing audio","8fc3b6":"Object element rendering non-text content has non-empty accessible name","97a4e1":"Button has non-empty accessible name","9e45ec":"Important word spacing in style attributes is wide enough",a25f45:"Headers attribute specified on a cell refers to cells in the same table element",afw4f7:"Text has minimum contrast",akn7bn:"Iframe with interactive elements is not excluded from tab-order",b33eff:"Orientation of the page is not restricted using CSS transforms",b4f0c3:"Meta viewport allows for zoom",b5c3f8:"HTML page has lang attribute",bc4a75:"ARIA required owned elements",bc659a:"Meta element has no refresh delay",bf051a:"HTML page lang attribute has valid language tag",c487ae:"Link has non-empty accessible name",cae760:"Iframe element has non-empty accessible name",cf77f2:"Bypass Blocks of Repeated Content",d0f69e:"Table header cell has assigned cells",de46e4:"Element with lang attribute has valid language tag",e086e5:"Form field has non-empty accessible name",e7aa44:"Audio element content has text alternative",eac66b:"Video element auditory content has accessible alternative",f51b46:"Video element auditory content has captions",ff89c9:"ARIA required context role",ffd0e9:"Heading has non-empty accessible name",kb1m8s:"ARIA global properties not used where prohibited",m6b1q3:"Menuitem has non-empty accessible name",qt1vmo:"Image accessible name is descriptive"},h=t=>[`jsx-a11y-x/${t}`,`astro/jsx-a11y/${t}`],m=t=>`vuejs-accessibility/${t}`,b=t=>`@angular-eslint/template/${t}`,u=t=>`svelte/${t}`,w=t=>`@html-eslint/${t}`,A=t=>`allyward/${t}`,N=[{rules:[...h("alt-text"),m("alt-text"),b("alt-text"),"image-alt"],message:"Images need a text alternative",why:"Screen reader users hear nothing, or just the file name, for an image without alt text and miss what it shows.",fix:'Add an alt attribute that says what the image conveys; use alt="" for a purely decorative image.',wcag:["1.1.1"],act:["23a2a8"],example:{bad:'<img src="chart.png">',good:'<img src="chart.png" alt="Sales rose 20% in May">'}},{rules:["input-image-alt"],message:"Image buttons need a text alternative",why:'An <input type="image"> is a button; without alt text screen readers cannot say what it does.',fix:"Add an alt attribute that names the action, not the picture.",wcag:["1.1.1","4.1.2"],act:["59796f"],example:{bad:'<input type="image" src="search.svg">',good:'<input type="image" src="search.svg" alt="Search">'}},{rules:["area-alt"],message:"Image map areas need a text alternative",why:"Each <area> with an href is a link; without alt text screen readers cannot say where it leads.",fix:"Add an alt attribute to every area that names its destination.",wcag:["2.4.4","4.1.2"],act:["c487ae"],example:{bad:`<map name="floors">
|
|
3
|
+
<area shape="rect" coords="0,0,80,40" href="/floor-1">
|
|
4
|
+
</map>`,good:`<map name="floors">
|
|
5
|
+
<area shape="rect" coords="0,0,80,40" href="/floor-1" alt="First floor">
|
|
6
|
+
</map>`}},{rules:["object-alt"],message:"<object> elements need a text alternative",why:"Screen readers cannot describe the content an <object> embeds unless it has an accessible name.",fix:"Name the object with aria-label, aria-labelledby or title.",wcag:["1.1.1"],act:["8fc3b6"],example:{bad:'<object data="org-chart.svg" type="image/svg+xml"></object>',good:'<object data="org-chart.svg" type="image/svg+xml" aria-label="Organisation chart"></object>'}},{rules:["role-img-alt"],message:'Elements with role="img" need a text alternative',why:'An element with role="img" is announced as an image; without a name screen reader users learn nothing about it.',fix:"Name it with aria-label or aria-labelledby.",wcag:["1.1.1"],act:["23a2a8"],example:{bad:'<div role="img" class="rating-4"></div>',good:'<div role="img" class="rating-4" aria-label="Rated 4 of 5"></div>'}},{rules:["svg-img-alt"],message:"SVG images need a text alternative",why:'An <svg> with role="img" is announced as an image; without a name screen reader users learn nothing about it.',fix:"Name it with aria-label, aria-labelledby or a <title> child.",wcag:["1.1.1"],act:["7d6734"],example:{bad:'<svg role="img" viewBox="0 0 24 24"><path d="M3 12h18"></path></svg>',good:'<svg role="img" aria-label="Menu" viewBox="0 0 24 24"><path d="M3 12h18"></path></svg>'}},{rules:[...h("img-redundant-alt"),u("a11y_img_redundant_alt")],message:'Alt text should not say "image" or "picture"',why:"Screen readers already announce the element as an image, so the word is heard twice and adds nothing.",fix:"Describe what the image shows instead.",wcag:["1.1.1"],act:["qt1vmo"],example:{bad:'<img src="team.jpg" alt="Image of our team">',good:'<img src="team.jpg" alt="Our team at the summer meetup">'}},{rules:[u("a11y_missing_attribute")],message:"Element is missing an attribute it needs to be accessible",why:"Some elements only work for everyone with certain attributes: alt on images, href on links, lang on <html>, title on <iframe>.",fix:"Add the attribute the warning names, with a meaningful value.",wcag:["1.1.1","2.1.1","3.1.1","4.1.2"],act:["23a2a8","b5c3f8","cae760"],example:{bad:'<img src="chart.png">',good:'<img src="chart.png" alt="Sales rose 20% in May">'}},{rules:[...h("anchor-has-content"),m("anchor-has-content"),"link-name"],message:"Links need text that names them",why:'A link without text is announced as just "link", so screen reader users cannot tell where it goes.',fix:"Put visible text in the link, or an aria-label when it only holds an icon.",wcag:["2.4.4","4.1.2"],act:["c487ae"],example:{bad:'<a href="/cart"><span class="icon-cart" aria-hidden="true"></span></a>',good:'<a href="/cart"><span class="icon-cart" aria-hidden="true"></span> Cart</a>'}},{rules:["input-button-name","aria-command-name","summary-name",u("a11y_consider_explicit_label")],message:"Buttons need text that names them",why:'A button without text is announced as just "button", so screen reader users cannot tell what it does.',fix:"Put visible text in the button, or an aria-label when it only holds an icon; give an input button a value.",wcag:["4.1.2","2.4.4"],act:["97a4e1","m6b1q3","2t702h"],example:{bad:'<button type="button"><span class="icon-close"></span></button>',good:'<button type="button" aria-label="Close"><span class="icon-close"></span></button>'}},{rules:["button-name",A("button-name")],message:"Buttons need text that names them",why:"A button without an accessible name leaves screen reader users unable to tell what it does.",fix:"Add visible button text, or provide an aria-label for an icon-only button.",wcag:["4.1.2"],act:["97a4e1"],example:{bad:'<button type="button"><span class="icon-close"></span></button>',good:'<button type="button" aria-label="Close"><span class="icon-close"></span></button>'}},{rules:[b("elements-content")],message:"Links, buttons and headings need text content",why:"Without content these elements are announced without a name, so screen reader users cannot tell what they are for.",fix:"Put text in the element, or an aria-label when it only holds an icon.",wcag:["2.4.4","4.1.2","2.4.6","1.3.1"],act:["c487ae","97a4e1","ffd0e9"],example:{bad:'<a href="/cart"></a>',good:'<a href="/cart">Cart</a>'}},{rules:[...h("heading-has-content"),m("heading-has-content"),u("a11y_missing_content")],message:"Headings need text content",why:"Screen reader users navigate by headings; an empty heading is a stop that says nothing.",fix:"Put text in the heading, or remove it.",wcag:["2.4.6","1.3.1"],act:["ffd0e9"],example:{bad:"<h2></h2>",good:"<h2>Shipping address</h2>"}},{rules:h("anchor-ambiguous-text"),message:"Link text must make sense on its own",why:'Screen reader users often list the links of a page; "click here" or "learn more" says nothing about the destination.',fix:"Name where the link goes or what it does.",wcag:["2.4.4"],act:["5effbb"],example:{bad:'<a href="/pricing">Click here</a>',good:'<a href="/pricing">See pricing</a>'}},{rules:[...h("iframe-has-title"),w("require-frame-title"),"frame-title"],message:"Frames need a title",why:"Screen readers announce a frame by its title; without one users cannot tell what the frame holds before entering it.",fix:"Add a title that describes the frame's content.",wcag:["4.1.2"],act:["cae760"],example:{bad:'<iframe src="https://maps.example.com/shop"></iframe>',good:'<iframe src="https://maps.example.com/shop" title="Map to our shop"></iframe>'}},{rules:[m("iframe-has-title")],message:"Iframes need an accessible name",why:"An accessible name tells users what the iframe contains before they enter it.",fix:"Add a title that describes the iframe's content. A title provides the broadest screen reader support.",wcag:["4.1.2"],act:["cae760"],example:{bad:'<iframe src="/map"></iframe>',good:'<iframe src="/map" title="Map to our shop"></iframe>'}},{rules:["frame-title-unique"],message:"Frames need distinct titles",why:"Frames with the same title sound identical, so screen reader users cannot tell them apart.",fix:"Give each frame a title that names its own content.",wcag:["4.1.2"],act:["4b1c6c"],example:{bad:`<div>
|
|
7
|
+
<iframe src="/videos/setup" title="Video"></iframe>
|
|
8
|
+
<iframe src="/videos/cleaning" title="Video"></iframe>
|
|
9
|
+
</div>`,good:`<div>
|
|
10
|
+
<iframe src="/videos/setup" title="Video: setting up"></iframe>
|
|
11
|
+
<iframe src="/videos/cleaning" title="Video: cleaning"></iframe>
|
|
12
|
+
</div>`}},{rules:[...h("click-events-have-key-events"),m("click-events-have-key-events"),b("click-events-have-key-events"),u("a11y_click_events_have_key_events")],message:"Click handlers need a keyboard equivalent",why:"Keyboard and switch users cannot trigger an action that only listens for mouse clicks.",fix:'Use a <button>, which fires click on Enter and Space; otherwise add a key handler, a role and tabindex="0".',wcag:["2.1.1"],example:{bad:'<div onclick="openMenu()">Menu</div>',good:'<button type="button" onclick="openMenu()">Menu</button>'}},{rules:[...h("mouse-events-have-key-events"),m("mouse-events-have-key-events"),b("mouse-events-have-key-events"),u("a11y_mouse_events_have_key_events")],message:"Hover handlers need focus equivalents",why:"What appears on mouseover never appears for keyboard users unless focus does the same.",fix:"Pair mouseover with focus and mouseout with blur.",wcag:["2.1.1"],example:{bad:'<button type="button" onmouseover="showTip()" onmouseout="hideTip()">Info</button>',good:'<button type="button" onmouseover="showTip()" onmouseout="hideTip()" onfocus="showTip()" onblur="hideTip()">Info</button>'}},{rules:[...h("interactive-supports-focus"),m("interactive-supports-focus"),b("interactive-supports-focus"),u("a11y_interactive_supports_focus")],message:"Interactive elements must be focusable",why:"An element with a handler and an interactive role that is not in the tab order cannot be reached with the keyboard.",fix:'Use the native element, such as <button>, or add tabindex="0".',wcag:["2.1.1"],example:{bad:'<div role="button" onclick="save()">Save</div>',good:'<button type="button" onclick="save()">Save</button>'}},{rules:[...h("aria-activedescendant-has-tabindex"),u("a11y_aria_activedescendant_has_tabindex")],message:"Elements with aria-activedescendant must be focusable",why:"aria-activedescendant moves the active option while focus stays on the container; a container that cannot take focus cannot be used with the keyboard.",fix:'Add tabindex="0" to the element, unless it is natively focusable.',wcag:["2.1.1"],example:{bad:`<div role="listbox" aria-label="Colour" aria-activedescendant="red">
|
|
13
|
+
<div role="option" id="red" aria-selected="true">Red</div>
|
|
14
|
+
</div>`,good:`<div role="listbox" aria-label="Colour" aria-activedescendant="red" tabindex="0">
|
|
15
|
+
<div role="option" id="red" aria-selected="true">Red</div>
|
|
16
|
+
</div>`}},{rules:[...h("tabindex-no-positive"),m("tabindex-no-positive"),b("no-positive-tabindex"),u("a11y_positive_tabindex"),w("no-positive-tabindex")],message:"Do not use a positive tabindex",why:"A tabindex above 0 jumps the element ahead of everything else, so the focus order no longer follows the page.",fix:"Remove the tabindex, or use 0, and order the markup the way it should be read.",wcag:["2.4.3"],example:{bad:'<button type="button" tabindex="1">Search</button>',good:'<button type="button">Search</button>'}},{rules:["frame-focusable-content"],message:"Frames with focusable content must stay in the tab order",why:'tabindex="-1" on an <iframe> keeps keyboard users from reaching the controls inside it.',fix:"Remove the negative tabindex from the frame.",wcag:["2.1.1"],act:["akn7bn"],example:{bad:'<iframe src="/booking-form" title="Booking form" tabindex="-1"></iframe>',good:'<iframe src="/booking-form" title="Booking form"></iframe>'}},{rules:["server-side-image-map"],message:"Do not use server-side image maps",why:"An ismap image only reacts to mouse click coordinates, so keyboard users cannot choose a region.",fix:"Use a client-side image map with <area> links, or plain links.",wcag:["2.1.1"],example:{bad:'<a href="/stores"><img src="map.png" alt="Store map" ismap></a>',good:`<div>
|
|
17
|
+
<img src="map.png" alt="Store map" usemap="#stores">
|
|
18
|
+
<map name="stores">
|
|
19
|
+
<area shape="rect" coords="0,0,80,40" href="/stores/berlin" alt="Berlin">
|
|
20
|
+
</map>
|
|
21
|
+
</div>`}},{rules:[...h("aria-props"),...h("aria-proptypes"),m("aria-props"),b("valid-aria"),"aria-valid-attr","aria-valid-attr-value",u("a11y_unknown_aria_attribute"),u("a11y_incorrect_aria_attribute_type"),...["boolean","id","idlist","integer","token","tokenlist","tristate"].map(t=>u(`a11y_incorrect_aria_attribute_type_${t}`))],message:"ARIA attributes must exist and have valid values",why:"Assistive technology ignores a misspelled ARIA attribute or a value of the wrong type, so the state it should convey is lost.",fix:"Fix the spelling and use a value of the type the attribute takes, such as true or false for aria-expanded, or an existing id for aria-controls.",wcag:["4.1.2"],act:["5f99a7","6a7281"],example:{bad:'<button type="button" aria-expanded="yes" aria-labeledby="menu-label">Menu</button>',good:'<button type="button" aria-expanded="false">Menu</button>'}},{rules:[...h("aria-role"),m("aria-role"),"aria-roles","aria-deprecated-role",u("a11y_unknown_role"),u("a11y_no_abstract_role"),w("no-abstract-roles")],message:"Roles must be valid, concrete ARIA roles",why:"An unknown, abstract or deprecated role is ignored or misread, so assistive technology cannot tell what the element is.",fix:"Use a non-abstract, non-deprecated role from WAI-ARIA, or a native element that already has the role.",wcag:["4.1.2"],act:["674b10"],example:{bad:'<div role="alrt">Saved</div>',good:'<div role="alert">Saved</div>'}},{rules:[...h("aria-unsupported-elements"),m("aria-unsupported-elements"),u("a11y_aria_attributes"),u("a11y_misplaced_role")],message:"Elements that are never rendered take no role or ARIA attributes",why:"<meta>, <html>, <script> and <style> are not exposed to assistive technology, so a role or ARIA attribute on them does nothing.",fix:"Remove the role and aria-* attributes, or move them to the element they were meant for.",wcag:["4.1.2"],example:{bad:'<meta name="description" content="Handmade shoes" aria-hidden="true">',good:'<meta name="description" content="Handmade shoes">'},overrides:{svelte:{bad:`<svelte:head>
|
|
22
|
+
<meta name="description" content="Handmade shoes" aria-hidden="true">
|
|
23
|
+
</svelte:head>`,good:`<svelte:head>
|
|
24
|
+
<meta name="description" content="Handmade shoes">
|
|
25
|
+
</svelte:head>`}}},{rules:[...h("role-has-required-aria-props"),m("role-has-required-aria-props"),b("role-has-required-aria"),u("a11y_role_has_required_aria_props"),"aria-required-attr"],message:"Roles need their required ARIA states",why:"A custom checkbox without aria-checked, for example, is announced without its state, so users cannot tell whether it is on.",fix:'Add the states the role requires and keep them updated, or use the native element, such as <input type="checkbox">.',wcag:["4.1.2"],act:["4e8ab6"],example:{bad:'<div role="checkbox" tabindex="0">Remember me</div>',good:'<div role="checkbox" aria-checked="false" tabindex="0">Remember me</div>'}},{rules:[...h("role-supports-aria-props"),u("a11y_role_supports_aria_props"),u("a11y_role_supports_aria_props_implicit"),"aria-allowed-attr","aria-conditional-attr"],message:"Use only ARIA attributes the element's role supports",why:"An ARIA attribute the role does not support is ignored or contradicts the element, so users get a wrong or no state.",fix:"Remove the attribute, use one the role supports, or change the role.",wcag:["4.1.2"],act:["5c01ea"],example:{bad:'<a href="/cart" aria-checked="true">Cart</a>',good:'<a href="/cart" aria-current="page">Cart</a>'}},{rules:["aria-prohibited-attr"],message:"This element cannot be named with aria-label",why:"Roles such as generic (a plain div or span), paragraph and presentation cannot be named, so screen readers ignore aria-label and aria-labelledby on them.",fix:"Put the text in the content, or give the element a role that can be named.",wcag:["4.1.2"],act:["kb1m8s"],example:{bad:'<span class="badge" aria-label="New"></span>',good:'<span class="badge">New</span>'}},{rules:["aria-required-children"],message:"ARIA roles must contain the children they require",why:"A list, menu or tablist without its items is announced as empty or wrong, so users cannot use what it holds.",fix:"Give the children the roles the parent role requires, such as listitem in a list.",wcag:["1.3.1"],act:["bc4a75"],example:{bad:`<div role="list">
|
|
26
|
+
<span>Apples</span>
|
|
27
|
+
</div>`,good:`<div role="list">
|
|
28
|
+
<span role="listitem">Apples</span>
|
|
29
|
+
</div>`}},{rules:["aria-required-parent"],message:"ARIA roles must sit in the parent they require",why:"A tab outside a tablist or an option outside a listbox loses its context, so assistive technology cannot convey the group.",fix:"Wrap the element in an element with the required parent role.",wcag:["1.3.1"],act:["ff89c9"],example:{bad:'<div role="tab" aria-selected="true">Profile</div>',good:`<div role="tablist">
|
|
30
|
+
<div role="tab" aria-selected="true">Profile</div>
|
|
31
|
+
</div>`}},{rules:["aria-roledescription"],message:"aria-roledescription needs an element with a semantic role",why:"A role description replaces how the role is announced; on an element without a role assistive technology has nothing to describe.",fix:'Use it only on an element with a role, such as a named <section> or role="group".',wcag:["4.1.2"],example:{bad:'<div aria-roledescription="slide">Spring collection</div>',good:'<section aria-roledescription="slide" aria-label="Spring collection">Spring collection</section>'}},{rules:["aria-braille-equivalent"],message:"Braille labels need a matching text label",why:"aria-braillelabel and aria-brailleroledescription only change the braille output; speech users still need aria-label or aria-roledescription.",fix:"Add the non-braille equivalent: an accessible name for aria-braillelabel, aria-roledescription for aria-brailleroledescription.",wcag:["4.1.2"],example:{bad:'<button type="button" aria-braillelabel="save"><span class="icon-save"></span></button>',good:'<button type="button" aria-label="Save" aria-braillelabel="save"><span class="icon-save"></span></button>'}},{rules:[...h("no-aria-hidden-on-focusable"),m("no-aria-hidden-on-focusable"),"aria-hidden-focus"],message:"Hidden content must not be focusable",why:"aria-hidden removes an element from screen readers, but keyboard focus can still land on it, so users reach a control that is announced as nothing.",fix:"Remove aria-hidden, or also take the element out of the tab order, for example with inert or hidden.",wcag:["4.1.2"],act:["6cfa84"],example:{bad:'<a href="/home" aria-hidden="true">Home</a>',good:'<a href="/home">Home</a>'}},{rules:[m("no-role-presentation-on-focusable")],message:"Focusable elements must not be marked presentational",why:'role="presentation" or "none" removes the meaning of an element that keyboard users can still focus and operate.',fix:"Remove the role, or make the element not focusable when it really is decorative.",wcag:["4.1.2"],act:["46ca7f"],example:{bad:'<button type="button" role="presentation">Close</button>',good:'<button type="button">Close</button>'}},{rules:[w("no-aria-hidden-body"),"aria-hidden-body"],message:"Do not hide the page body from assistive technology",why:'aria-hidden="true" on <body> hides the whole page from screen readers.',fix:"Remove aria-hidden from <body>; hide only the content behind a modal, for example with inert.",wcag:["1.3.1","4.1.2"],document:!0,example:{bad:`<body aria-hidden="true">
|
|
32
|
+
<main>\u2026</main>
|
|
33
|
+
</body>`,good:`<body>
|
|
34
|
+
<main>\u2026</main>
|
|
35
|
+
</body>`}},{rules:[...h("no-static-element-interactions"),m("no-static-element-interactions"),u("a11y_no_static_element_interactions")],message:"Elements with handlers need a role",why:"A div or span with a click handler has no role, so assistive technology does not announce it as something to operate.",fix:"Use a native control such as <button>, or give the element a role, tabindex and keyboard handling.",wcag:["4.1.2"],example:{bad:'<span onclick="toggle()">Details</span>',good:'<button type="button" onclick="toggle()">Details</button>'}},{rules:[...h("no-noninteractive-element-interactions"),u("a11y_no_noninteractive_element_interactions")],message:"Non-interactive elements should not handle user input",why:"A list item or heading with a click handler is announced as content, so users do not know they can operate it.",fix:"Put a <button> or link inside the element and handle the input there.",wcag:["4.1.2"],example:{bad:'<li onclick="choose()">Red</li>',good:'<li><button type="button" onclick="choose()">Red</button></li>'}},{rules:[...h("no-interactive-element-to-noninteractive-role"),u("a11y_no_interactive_element_to_noninteractive_role")],message:"Interactive elements must keep an interactive role",why:"A button given a non-interactive role, such as heading, is no longer announced as something to operate.",fix:"Remove the role, and wrap the control in the element whose meaning you wanted.",wcag:["4.1.2"],example:{bad:'<button type="button" role="heading" aria-level="2">Settings</button>',good:'<h2><button type="button">Settings</button></h2>'}},{rules:[...h("no-noninteractive-element-to-interactive-role"),u("a11y_no_noninteractive_element_to_interactive_role")],message:"Non-interactive elements must not take an interactive role",why:'A heading or list item with role="button" loses its own meaning and still lacks the keyboard behaviour of a real button.',fix:"Put a native control inside the element instead.",wcag:["4.1.2"],example:{bad:'<h3 role="button">Shipping</h3>',good:'<h3><button type="button">Shipping</button></h3>'}},{rules:["nested-interactive"],message:"Interactive controls must not be nested",why:"A button inside a link is hidden from screen readers or announced confusingly, and it is unclear which one a click or Enter triggers.",fix:"Place the controls side by side.",wcag:["4.1.2"],act:["307n5z"],example:{bad:'<a href="/post/42">Read post <button type="button">Like</button></a>',good:`<div>
|
|
36
|
+
<a href="/post/42">Read post</a>
|
|
37
|
+
<button type="button">Like</button>
|
|
38
|
+
</div>`}},{rules:["duplicate-id-aria"],message:"IDs that ARIA and labels refer to must be unique",why:"When two elements share an id, aria-describedby, aria-labelledby or a label points at the first one only, so the other text is lost or the wrong one is read.",fix:"Give every referenced element its own id.",wcag:["4.1.2"],example:{bad:`<div>
|
|
39
|
+
<label for="pw">Password</label>
|
|
40
|
+
<input type="password" id="pw" aria-describedby="hint">
|
|
41
|
+
<p id="hint">At least 12 characters</p>
|
|
42
|
+
<p id="hint">Optional</p>
|
|
43
|
+
</div>`,good:`<div>
|
|
44
|
+
<label for="pw">Password</label>
|
|
45
|
+
<input type="password" id="pw" aria-describedby="pw-hint">
|
|
46
|
+
<p id="pw-hint">At least 12 characters</p>
|
|
47
|
+
<p id="note">Optional</p>
|
|
48
|
+
</div>`}},{rules:[...h("label-has-associated-control"),m("label-has-for"),m("form-control-has-label"),b("label-has-associated-control"),u("a11y_label_has_associated_control"),"select-name"],message:"Form fields need a label tied to them",why:"Screen readers announce a field by its label; a label that is not tied to the field leaves it unnamed, and clicking the label does not focus it.",fix:"Nest the field in its <label>, or set the label's for attribute to the field's id; doing both is the most robust.",wcag:["1.3.1","4.1.2"],act:["e086e5"],example:{bad:`<div>
|
|
49
|
+
<label>Email</label>
|
|
50
|
+
<input type="email">
|
|
51
|
+
</div>`,good:'<label for="email">Email <input type="email" id="email"></label>'}},{rules:["label"],message:"Form fields need an accessible name",why:"An unnamed form field leaves screen reader users unable to tell what to enter.",fix:"Associate a visible label with the field by matching its for attribute to the field id.",wcag:["4.1.2"],act:["e086e5"],example:{bad:'<input type="text" id="name">',good:'<div><label for="name">Name</label><input type="text" id="name"></div>'}},{rules:["aria-input-field-name","aria-toggle-field-name","aria-meter-name","aria-progressbar-name","aria-tooltip-name","aria-tab-name"],message:"ARIA widgets need an accessible name",why:"A custom field, switch, meter, progress bar, tab or tooltip without a name is announced only by its role, so users cannot tell what it is for.",fix:"Name it with aria-label or aria-labelledby, or with visible text content where the role allows.",wcag:["4.1.2","1.1.1"],act:["e086e5"],example:{bad:'<div role="switch" aria-checked="false" tabindex="0"></div>',good:'<div role="switch" aria-checked="false" tabindex="0" aria-label="Dark mode"></div>'}},{rules:["form-field-multiple-labels"],message:"Form fields must not have more than one label",why:"Screen readers announce only one of several labels, or read them inconsistently, so part of the instructions is lost.",fix:"Keep one <label> and tie extra instructions with aria-describedby.",wcag:["3.3.2"],example:{bad:`<div>
|
|
52
|
+
<label for="qty">Quantity</label>
|
|
53
|
+
<label for="qty">Up to 10</label>
|
|
54
|
+
<input type="number" id="qty">
|
|
55
|
+
</div>`,good:`<div>
|
|
56
|
+
<label for="qty">Quantity</label>
|
|
57
|
+
<input type="number" id="qty" aria-describedby="qty-hint">
|
|
58
|
+
<p id="qty-hint">Up to 10</p>
|
|
59
|
+
</div>`}},{rules:["label-content-name-mismatch"],message:"The accessible name must contain the visible label",why:"Speech input users say what they see; when aria-label replaces the visible text with other words, the command does not match.",fix:"Start the accessible name with the visible text, or drop the aria-label.",wcag:["2.5.3"],act:["2ee8b8"],example:{bad:'<button type="button" aria-label="Submit form">Send</button>',good:'<button type="button">Send</button>'}},{rules:[...h("autocomplete-valid"),u("a11y_autocomplete_valid"),"autocomplete-valid",A("autocomplete-valid")],message:"autocomplete must use a valid autofill value",why:"Browsers and assistive technology use the autofill token to fill in and identify fields about the user, which helps people with memory, cognitive or motor impairments.",fix:"Use a token from the HTML standard, such as email, given-name, tel or shipping postal-code.",wcag:["1.3.5"],act:["73f2c2"],example:{bad:'<label>Email <input type="email" autocomplete="mail"></label>',good:'<label>Email <input type="email" autocomplete="email"></label>'}},{rules:[A("password-autocomplete")],message:"Password fields must let password managers fill them",why:'Logging in must not depend on remembering or retyping a password; autocomplete="off" keeps password managers out.',fix:'Use autocomplete="current-password" on a login form, or "new-password" where the password is chosen.',wcag:["3.3.8"],example:{bad:'<label>Password <input type="password" autocomplete="off"></label>',good:'<label>Password <input type="password" autocomplete="current-password"></label>'}},{rules:[...h("scope"),b("table-scope"),u("a11y_misplaced_scope")],message:"scope belongs on <th> only",why:"scope tells assistive technology which cells a header applies to; on a data cell it is ignored, so the header relationship is lost.",fix:"Make the cell a <th>, or remove scope.",wcag:["1.3.1"],example:{bad:`<table>
|
|
60
|
+
<tbody>
|
|
61
|
+
<tr><td scope="row">Total</td><td>42</td></tr>
|
|
62
|
+
</tbody>
|
|
63
|
+
</table>`,good:`<table>
|
|
64
|
+
<tbody>
|
|
65
|
+
<tr><th scope="row">Total</th><td>42</td></tr>
|
|
66
|
+
</tbody>
|
|
67
|
+
</table>`}},{rules:["td-has-header"],message:"Data cells in larger tables need headers",why:"Without header cells screen reader users hear values without knowing which row or column they belong to.",fix:"Mark the header row or column with <th> and scope.",wcag:["1.3.1"],example:{bad:`<table>
|
|
68
|
+
<tbody>
|
|
69
|
+
<tr><td>Name</td><td>Price</td><td>Stock</td></tr>
|
|
70
|
+
<tr><td>Boots</td><td>\u20AC90</td><td>12</td></tr>
|
|
71
|
+
<tr><td>Sandals</td><td>\u20AC40</td><td>30</td></tr>
|
|
72
|
+
</tbody>
|
|
73
|
+
</table>`,good:`<table>
|
|
74
|
+
<thead>
|
|
75
|
+
<tr><th scope="col">Name</th><th scope="col">Price</th><th scope="col">Stock</th></tr>
|
|
76
|
+
</thead>
|
|
77
|
+
<tbody>
|
|
78
|
+
<tr><td>Boots</td><td>\u20AC90</td><td>12</td></tr>
|
|
79
|
+
<tr><td>Sandals</td><td>\u20AC40</td><td>30</td></tr>
|
|
80
|
+
</tbody>
|
|
81
|
+
</table>`}},{rules:["td-headers-attr"],message:"headers must refer to header cells in the same table",why:"A headers attribute that points at a missing id leaves the cell without its header for screen reader users.",fix:"Use the ids of <th> cells in the same table.",wcag:["1.3.1"],act:["a25f45"],example:{bad:`<table>
|
|
82
|
+
<tbody>
|
|
83
|
+
<tr><th id="price">Price</th></tr>
|
|
84
|
+
<tr><td headers="cost">\u20AC90</td></tr>
|
|
85
|
+
</tbody>
|
|
86
|
+
</table>`,good:`<table>
|
|
87
|
+
<tbody>
|
|
88
|
+
<tr><th id="price">Price</th></tr>
|
|
89
|
+
<tr><td headers="price">\u20AC90</td></tr>
|
|
90
|
+
</tbody>
|
|
91
|
+
</table>`}},{rules:["th-has-data-cells"],message:"Table headers must have data cells",why:"A header with no cells under it suggests structure that is not there and confuses table navigation.",fix:"Add the missing data cells, or remove the header.",wcag:["1.3.1"],act:["d0f69e"],example:{bad:`<table>
|
|
92
|
+
<tbody>
|
|
93
|
+
<tr><th>Name</th><th>Price</th><th>Notes</th></tr>
|
|
94
|
+
<tr><td>Boots</td><td>\u20AC90</td></tr>
|
|
95
|
+
</tbody>
|
|
96
|
+
</table>`,good:`<table>
|
|
97
|
+
<tbody>
|
|
98
|
+
<tr><th>Name</th><th>Price</th><th>Notes</th></tr>
|
|
99
|
+
<tr><td>Boots</td><td>\u20AC90</td><td>Waterproof</td></tr>
|
|
100
|
+
</tbody>
|
|
101
|
+
</table>`}},{rules:["table-fake-caption"],message:"Use <caption> for a table caption, not a cell",why:"A first row with one cell spanning the table looks like a caption but is read as data, and the table is left without a name.",fix:"Move the text into a <caption> element.",wcag:["1.3.1"],example:{bad:`<table>
|
|
102
|
+
<tbody>
|
|
103
|
+
<tr><td colspan="2">Prices</td></tr>
|
|
104
|
+
<tr><th>Item</th><th>Price</th></tr>
|
|
105
|
+
<tr><td>Boots</td><td>\u20AC90</td></tr>
|
|
106
|
+
</tbody>
|
|
107
|
+
</table>`,good:`<table>
|
|
108
|
+
<caption>Prices</caption>
|
|
109
|
+
<tbody>
|
|
110
|
+
<tr><th>Item</th><th>Price</th></tr>
|
|
111
|
+
<tr><td>Boots</td><td>\u20AC90</td></tr>
|
|
112
|
+
</tbody>
|
|
113
|
+
</table>`}},{rules:[w("require-li-container"),"list","listitem"],message:"List items belong in a list, and lists hold only list items",why:"Screen readers announce a list and its number of items only when <li> sits directly in <ul> or <ol>.",fix:"Put <li> elements directly in a <ul> or <ol>, and nothing else but <script> or <template>.",wcag:["1.3.1"],example:{bad:`<div>
|
|
114
|
+
<li>Apples</li>
|
|
115
|
+
<li>Pears</li>
|
|
116
|
+
</div>`,good:`<ul>
|
|
117
|
+
<li>Apples</li>
|
|
118
|
+
<li>Pears</li>
|
|
119
|
+
</ul>`}},{rules:["definition-list","dlitem"],message:"Description lists hold only <dt> and <dd> groups",why:"Assistive technology conveys the term and description pairs of a <dl> only when its structure is valid.",fix:"Put <dt> and <dd> directly in <dl>, or in a <div> inside it.",wcag:["1.3.1"],example:{bad:`<dl>
|
|
120
|
+
<p>Size</p>
|
|
121
|
+
<dd>Large</dd>
|
|
122
|
+
</dl>`,good:`<dl>
|
|
123
|
+
<dt>Size</dt>
|
|
124
|
+
<dd>Large</dd>
|
|
125
|
+
</dl>`}},{rules:[u("a11y_figcaption_parent"),u("a11y_figcaption_index")],message:"<figcaption> must be the first or last child of a <figure>",why:"Only a figcaption in that place captions the figure for assistive technology.",fix:"Move the <figcaption> into its <figure>, as the first or last child.",wcag:["1.3.1"],example:{bad:`<figure>
|
|
126
|
+
<img src="bridge.jpg" alt="Golden Gate Bridge at dusk">
|
|
127
|
+
<figcaption>San Francisco, 2024</figcaption>
|
|
128
|
+
<p>Photo: A. Lee</p>
|
|
129
|
+
</figure>`,good:`<figure>
|
|
130
|
+
<img src="bridge.jpg" alt="Golden Gate Bridge at dusk">
|
|
131
|
+
<p>Photo: A. Lee</p>
|
|
132
|
+
<figcaption>San Francisco, 2024</figcaption>
|
|
133
|
+
</figure>`}},{rules:["p-as-heading"],message:"Use heading elements for headings, not styled paragraphs",why:"Bold or large text looks like a heading but screen reader users cannot find it with heading navigation.",fix:"Use <h1> to <h6> at the right level and style them as needed.",wcag:["1.3.1"],example:{bad:"<p><b>Shipping</b></p>",good:"<h2>Shipping</h2>"}},{rules:["bypass"],message:"Pages need a way to skip repeated blocks",why:"Keyboard and screen reader users otherwise go through the whole navigation on every page before reaching the content.",fix:"Add a <main> landmark, a skip link to it, or headings that start the content.",wcag:["2.4.1"],act:["cf77f2"],example:{bad:`<div>
|
|
134
|
+
<div class="nav">\u2026</div>
|
|
135
|
+
<div class="content">\u2026</div>
|
|
136
|
+
</div>`,good:`<div>
|
|
137
|
+
<a href="#main">Skip to content</a>
|
|
138
|
+
<nav>\u2026</nav>
|
|
139
|
+
<main id="main">\u2026</main>
|
|
140
|
+
</div>`}},{rules:[...h("html-has-lang"),w("require-lang"),"html-has-lang"],message:"The page needs a lang attribute",why:"Screen readers pick the pronunciation from the page language; without it text may be read with the wrong voice and rules.",fix:"Add lang with the main language of the page to <html>.",wcag:["3.1.1"],act:["b5c3f8"],document:!0,example:{bad:`<html>
|
|
141
|
+
<body>\u2026</body>
|
|
142
|
+
</html>`,good:`<html lang="en">
|
|
143
|
+
<body>\u2026</body>
|
|
144
|
+
</html>`}},{rules:[...h("lang"),"html-lang-valid","html-xml-lang-mismatch"],message:"The page language must be a valid language tag",why:"Screen readers only switch pronunciation for a lang value they recognise.",fix:'Use a BCP 47 tag such as "en" or "de-CH"; when xml:lang is set too, give it the same language.',wcag:["3.1.1"],act:["bf051a","5b7ae0"],document:!0,example:{bad:`<html lang="english">
|
|
145
|
+
<body>\u2026</body>
|
|
146
|
+
</html>`,good:`<html lang="en">
|
|
147
|
+
<body>\u2026</body>
|
|
148
|
+
</html>`}},{rules:["valid-lang"],message:"lang must be a valid language tag",why:"Screen readers only switch pronunciation for a passage in another language when its lang value is one they recognise.",fix:'Use a BCP 47 tag such as "de" or "fr-CA".',wcag:["3.1.2"],act:["de46e4"],example:{bad:'<p lang="deutsch">Guten Tag</p>',good:'<p lang="de">Guten Tag</p>'}},{rules:["document-title"],message:"The page needs a title",why:"The title is the first thing a screen reader announces and what identifies the page in tabs and history.",fix:"Add a <title> to <head> that describes the page.",wcag:["2.4.2"],act:["2779a5"],document:!0,example:{bad:`<head>
|
|
149
|
+
<meta charset="utf-8">
|
|
150
|
+
</head>`,good:`<head>
|
|
151
|
+
<meta charset="utf-8">
|
|
152
|
+
<title>Checkout \u2013 Shoe Shop</title>
|
|
153
|
+
</head>`}},{rules:[w("no-non-scalable-viewport"),"meta-viewport"],message:"Do not disable zooming",why:"user-scalable=no or a low maximum-scale keeps people with low vision from enlarging text on mobile devices.",fix:"Remove user-scalable=no and maximum-scale from the viewport meta tag.",wcag:["1.4.4"],act:["b4f0c3"],document:!0,example:{bad:'<meta name="viewport" content="width=device-width, user-scalable=no">',good:'<meta name="viewport" content="width=device-width, initial-scale=1">'}},{rules:["meta-refresh"],message:"Do not refresh or redirect the page on a timer",why:"A timed refresh moves people away before they have finished reading or using the page, and resets screen reader focus.",fix:"Remove the timed refresh; redirect on the server or immediately (delay 0), or let users reload themselves.",wcag:["2.2.1"],act:["bc659a"],document:!0,example:{bad:'<meta http-equiv="refresh" content="30">',good:'<meta http-equiv="refresh" content="0; url=/new-page">'}},{rules:[...h("media-has-caption"),m("media-has-caption"),u("a11y_media_has_caption"),"video-caption"],message:"Video needs captions",why:"Deaf and hard of hearing people miss the speech and sounds of a video without captions.",fix:'Add a <track kind="captions"> with a caption file.',wcag:["1.2.2"],act:["f51b46","eac66b"],example:{bad:'<video src="intro.mp4" controls></video>',good:`<video src="intro.mp4" controls>
|
|
154
|
+
<track kind="captions" src="intro.en.vtt" srclang="en" label="English">
|
|
155
|
+
</video>`}},{rules:["audio-caption"],message:"Audio needs a text alternative",why:"Deaf and hard of hearing people cannot follow prerecorded audio without a transcript or captions.",fix:"Provide a transcript next to the audio, or a captions track.",wcag:["1.2.1"],act:["e7aa44"],example:{bad:'<audio src="episode-12.mp3" controls></audio>',good:`<div>
|
|
156
|
+
<audio src="episode-12.mp3" controls></audio>
|
|
157
|
+
<a href="/episode-12/transcript">Read the transcript</a>
|
|
158
|
+
</div>`}},{rules:["no-autoplay-audio"],message:"Media must not play sound automatically",why:"Sound that starts by itself drowns out screen readers and is hard to stop for people who rely on them.",fix:"Remove autoplay, mute the media, or keep the sound under 3 seconds with a control to stop it.",wcag:["1.4.2"],act:["80f0bf"],example:{bad:'<video src="promo.mp4" autoplay></video>',good:'<video src="promo.mp4" controls></video>'}},{rules:[...h("no-distracting-elements"),m("no-distracting-elements"),b("no-distracting-elements"),u("a11y_distracting_elements"),"blink","marquee"],message:"Do not use <marquee> or <blink>",why:"Moving or blinking text that cannot be paused distracts people with attention or reading difficulties and is hard to read.",fix:"Use static text; if something must move, give users a way to pause it.",wcag:["2.2.2"],example:{bad:"<marquee>Summer sale!</marquee>",good:"<p>Summer sale!</p>"}},{rules:["css-orientation-lock"],message:"Do not lock the page to one orientation",why:"People with a device mounted in a fixed orientation, for example on a wheelchair, cannot rotate it to use the page.",fix:"Let the layout adapt to both orientations instead of rotating the page with a transform.",wcag:["1.3.4"],act:["b33eff"],example:{bad:`<style>
|
|
159
|
+
@media (orientation: portrait) {
|
|
160
|
+
body { transform: rotate(90deg); }
|
|
161
|
+
}
|
|
162
|
+
</style>`,good:`<style>
|
|
163
|
+
@media (orientation: portrait) {
|
|
164
|
+
.gallery { grid-template-columns: 1fr; }
|
|
165
|
+
}
|
|
166
|
+
</style>`},overrides:Object.fromEntries(["jsx","vue","svelte","angular","astro"].map(t=>[t,{language:"css",file:"styles.css",bad:`@media (orientation: portrait) {
|
|
167
|
+
body { transform: rotate(90deg); }
|
|
168
|
+
}`,good:`@media (orientation: portrait) {
|
|
169
|
+
.gallery { grid-template-columns: 1fr; }
|
|
170
|
+
}`}]))},{rules:["avoid-inline-spacing"],message:"Inline text spacing must stay adjustable",why:"People with dyslexia or low vision override letter, word and line spacing with their own styles; !important in a style attribute blocks that.",fix:"Remove !important from letter-spacing, word-spacing and line-height in style attributes.",wcag:["1.4.12"],act:["24afc2","78fd32","9e45ec"],example:{bad:'<p style="letter-spacing: 0.05em !important">Terms</p>',good:'<p style="letter-spacing: 0.05em">Terms</p>'},overrides:{jsx:{bad:"<p ref={p => p?.style.setProperty('letter-spacing', '0.05em', 'important')}>Terms</p>",good:"<p style={{ letterSpacing: '0.05em' }}>Terms</p>"}}},{rules:[A("text-contrast")],message:"Text needs enough contrast with its background",why:"Low-contrast text is hard or impossible to read for people with low vision or colour deficiencies, and for anyone in bright light.",fix:"Darken the text or lighten the background (or the other way round) until the ratio reaches 4.5:1, or 3:1 for large text (24 px, or 18.66 px bold).",wcag:["1.4.3"],act:["afw4f7"],details:!0,example:{bad:'<p style="color: #999999; background-color: #ffffff">Free returns</p>',good:'<p style="color: #595959; background-color: #ffffff">Free returns</p>'}},{rules:[A("non-text-contrast")],message:"Text field boundaries need enough contrast",why:"People with low vision cannot find a field whose border and background barely differ from what surrounds it.",fix:"Give the border, or the field's background, a contrast of at least 3:1 against the surrounding background.",wcag:["1.4.11"],details:!0,example:{bad:'<input type="text" aria-label="Search" style="border: 1px solid #dddddd; background-color: #ffffff">',good:'<input type="text" aria-label="Search" style="border: 1px solid #767676; background-color: #ffffff">'}}];var Z=["html","jsx","vue","svelte","angular","astro"];function xe(t){switch(t){case"javascriptreact":case"typescriptreact":return"jsx";case"vue":return"vue";case"svelte":return"svelte";case"angular":case"typescript":return"angular";case"astro":return"astro";default:return"html"}}var E=new Map;for(let t of N)for(let e of t.rules){if(E.has(e))throw new Error(`Rule ${e} has two docs entries`);E.set(e,t)}function ke(){return[...E.keys()].sort()}function T(t){let e=E.get(t);if(e)return{message:e.message,why:e.why,fix:e.fix,details:e.details??!1,wcag:e.wcag.map(n=>({criterion:n,title:`WCAG ${n} ${x(n)}`,url:I(n)})),act:(e.act??[]).map(n=>({title:`ACT rule: ${B[n]}`,url:`https://www.w3.org/WAI/standards-guidelines/act/rules/${n}/`})),examples:Object.fromEntries(Z.map(n=>[n,te(e,n)]))}}var U={html:"html",jsx:"jsx",vue:"vue",svelte:"svelte",angular:"html",astro:"astro"},ee={vue:"index.html",svelte:"src/app.html",angular:"src/index.html"};function te(t,e){let n=t.overrides?.[e];if(n)return{language:U[e],...n};let a=t.document?ee[e]:void 0;if(a)return{language:"html",file:a,...t.example};let s=ae[e];return{language:U[e],bad:s(t.example.bad),good:s(t.example.good)}}var L=/\son([a-z]+)="(\w+)\(\)"/g,ae={html:t=>t,astro:t=>t,jsx:ie,vue:t=>`<template>
|
|
171
|
+
${t.replace(L,' @$1="$2"').replace(/^/gm," ")}
|
|
172
|
+
</template>`,svelte:t=>t.replace(L," on$1={$2}"),angular:t=>t.replace(L,' ($1)="$2()"')},ne={click:"onClick",keydown:"onKeyDown",mouseover:"onMouseOver",mouseout:"onMouseOut",focus:"onFocus",blur:"onBlur"},W={class:"className",for:"htmlFor",tabindex:"tabIndex",srclang:"srcLang",charset:"charSet",autocomplete:"autoComplete",autoplay:"autoPlay",colspan:"colSpan",usemap:"useMap","http-equiv":"httpEquiv"},re="area|br|col|embed|hr|img|input|link|meta|source|track|wbr";function ie(t){return t.replace(L,(e,n,a)=>` ${ne[n]}={${a}}`).replace(/\sstyle="([^"]*)"/g,(e,n)=>` style={{ ${oe(n)} }}`).replace(/(\s)([a-z-]+)(?=[\s=/>])/g,(e,n,a)=>W[a]?n+W[a]:e).replace(new RegExp(`<(${re})\\b([^>]*?)\\s*>`,"g"),"<$1$2 />")}function oe(t){return t.split(";").map(e=>e.trim()).filter(Boolean).map(e=>{let[n,...a]=e.split(":");return`${n.trim().replace(/-([a-z])/g,(o,i)=>i.toUpperCase())}: '${a.join(":").trim()}'`}).join(", ")}var G={"1.1.1":{level:"A",layer:"Check"},"1.2.1":{level:"A",layer:"Person"},"1.2.2":{level:"A",layer:"Person"},"1.2.3":{level:"A",layer:"Person"},"1.2.4":{level:"AA",layer:"Person"},"1.2.5":{level:"AA",layer:"Person"},"1.3.1":{level:"A",layer:"Check"},"1.3.2":{level:"A",layer:"AI Review"},"1.3.3":{level:"A",layer:"AI Review"},"1.3.4":{level:"AA",layer:"Browser audit"},"1.3.5":{level:"AA",layer:"Check"},"1.4.1":{level:"A",layer:"AI Review"},"1.4.2":{level:"A",layer:"Browser audit"},"1.4.3":{level:"AA",layer:"Browser audit"},"1.4.4":{level:"AA",layer:"Browser audit"},"1.4.5":{level:"AA",layer:"Person"},"1.4.10":{level:"AA",layer:"Browser audit"},"1.4.11":{level:"AA",layer:"Browser audit"},"1.4.12":{level:"AA",layer:"Browser audit"},"1.4.13":{level:"AA",layer:"Browser audit"},"2.1.1":{level:"A",layer:"Check"},"2.1.2":{level:"A",layer:"Browser audit"},"2.1.4":{level:"A",layer:"Person"},"2.2.1":{level:"A",layer:"Person"},"2.2.2":{level:"A",layer:"Browser audit"},"2.3.1":{level:"A",layer:"Person"},"2.4.1":{level:"A",layer:"Browser audit"},"2.4.2":{level:"A",layer:"Check"},"2.4.3":{level:"A",layer:"Check"},"2.4.4":{level:"A",layer:"Check"},"2.4.5":{level:"AA",layer:"Person"},"2.4.6":{level:"AA",layer:"Check"},"2.4.7":{level:"AA",layer:"Browser audit"},"2.4.11":{level:"AA",layer:"Browser audit"},"2.5.1":{level:"A",layer:"Person"},"2.5.2":{level:"A",layer:"Browser audit"},"2.5.3":{level:"A",layer:"AI Review"},"2.5.4":{level:"A",layer:"Person"},"2.5.7":{level:"AA",layer:"Person"},"2.5.8":{level:"AA",layer:"Browser audit"},"3.1.1":{level:"A",layer:"Check"},"3.1.2":{level:"AA",layer:"Check"},"3.2.1":{level:"A",layer:"AI Review"},"3.2.2":{level:"A",layer:"AI Review"},"3.2.3":{level:"AA",layer:"Person"},"3.2.4":{level:"AA",layer:"Person"},"3.2.6":{level:"A",layer:"Person"},"3.3.1":{level:"A",layer:"AI Review"},"3.3.2":{level:"A",layer:"AI Review"},"3.3.3":{level:"AA",layer:"AI Review"},"3.3.4":{level:"AA",layer:"Person"},"3.3.7":{level:"A",layer:"Person"},"3.3.8":{level:"AA",layer:"Person"},"4.1.2":{level:"A",layer:"Check"},"4.1.3":{level:"AA",layer:"AI Review"}};var R={html:"HTML",javascriptreact:"JSX",typescriptreact:"TSX",vue:"Vue",svelte:"Svelte",angular:"Angular",typescript:"Angular (TS)",astro:"Astro"};function D(t){return R[t]??t}function H(){let t=G,e=M.rules,n=j,a=new Set,s=new Map;for(let[r,l]of Object.entries(n))for(let g of l??[]){a.add(`${r}:${g}`);let c=T(g);if(c)for(let p of c.wcag){let y=s.get(p.criterion)??[];y.push({languageId:r,languageLabel:D(r),ruleId:g}),s.set(p.criterion,y)}}let o=new Map;for(let[r,l]of Object.entries(e)){let g=T(r);if(!(!g||!l)){for(let[c,p]of Object.entries(l))if(!(!p?.proven||a.has(`${c}:${r}`)))for(let y of g.wcag){let C=o.get(y.criterion)??[];C.push({languageId:c,languageLabel:D(c),ruleId:r,correct:p.correct,wrong:p.wrong,lowerBound:p.lowerBound}),o.set(y.criterion,C)}}}let i=r=>[...r].sort((l,g)=>l.languageLabel.localeCompare(g.languageLabel)||l.ruleId.localeCompare(g.ruleId));return k.map(r=>{let l=t[r];if(!l)throw new Error(`Missing coverage assignment for WCAG ${r}`);let g=l.layer==="Check";return{criterion:r,name:x(r),url:I(r),level:l.level,layer:l.layer,provenRules:g?i(o.get(r)??[]):[],bestPracticeRules:g?i(s.get(r)??[]):[]}})}function Te(t){let e=H(),n=e.filter(r=>r.layer==="Check"),a=n.filter(r=>r.provenRules.length>0).length,s=t.files.filter(r=>r.status==="checked"),o=t.files.reduce((r,l)=>r+l.ignored,0);return[`# Allyward Check report: ${v(t.project)}`,"",`> This report lists what Allyward's automated Check found. Automated checking covers only part of WCAG 2.2 AA: ${a} of ${e.length} criteria are checked in code, with a Proven rule in at least one language, and ${n.length-a} more give Needs Review only; the rest need a browser audit or a person. It does not establish WCAG conformance or legal compliance and does not replace an audit.`,"","| | |","| --- | --- |",`| Project | ${v(t.project)} |`,`| Date | ${t.date.toISOString().slice(0,10)} |`,`| Allyward version | ${v(t.version)} |`,`| Files checked | ${s.length} |`,"",...le(t.files,o),"",...de(t.files),"",...ce(t.files),"","## Ignored Findings","",`${f(o,"Finding is","Findings are")} ignored by an \`allyward-ignore\` comment and not listed.`,...ue(t.files),"",...he(e)].join(`
|
|
173
|
+
`)+`
|
|
174
|
+
`}var f=(t,e,n=`${e}s`)=>`${t} ${t===1?e:n}`;function le(t,e){let n=t.flatMap(o=>o.findings),a=o=>n.filter(i=>i.severity===o).length,s=t.filter(o=>o.status==="failed").length;return["## Summary","",`- ${f(n.length,"Finding")}: ${f(a("error"),"error")}, ${f(a("warning"),"warning")}, ${a("information")} information`,`- ${f(n.filter(o=>o.baselined).length,"baselined Finding")}`,`- ${f(e,"ignored Finding")}`,`- ${f(t.reduce((o,i)=>o+i.needsReview.length,0),"Needs Review entry","Needs Review entries")}`,...s?[`- ${f(s,"file")} could not be checked`]:[]]}function de(t){let e=t.flatMap(n=>n.findings.map(a=>({file:n.file,line:a.range.start.line,criterion:a.criteria[0],finding:a})));return e.length===0?["## Findings","","The Check found no Findings."]:["## Findings","",...V(e,["Location","Severity","Rule","Message"],({file:n,line:a,finding:s})=>[$(`${n}:${a}`),s.baselined?`${s.severity}, baselined`:s.severity,$(s.ruleId),v(s.message)+(s.criteria.length>1?` (also WCAG ${s.criteria.slice(1).join(", ")})`:"")])]}function ce(t){let e=t.flatMap(n=>n.needsReview.map(a=>({file:n.file,line:a.range?.start.line??0,criterion:a.criterion,entry:a})));return["## Needs Review (not Findings)","","These are not Findings: the Check cannot decide them from source code alone, so a person, an AI Review or a browser audit has to verify each one.",...e.length?["",...V(e,["Location","Rule","Reason"],({file:n,entry:a})=>[$(a.range?`${n}:${a.range.start.line}`:n),a.ruleId?$(a.ruleId):"",v(a.reason)])]:["","The Check left nothing to review."]]}function ue(t){let e=t.filter(n=>n.status==="failed").sort((n,a)=>z(n.file,a.file));return e.length===0?[]:["","## Files not checked","","| File | Reason |","| --- | --- |",...e.map(n=>`| ${$(n.file)} | ${v(n.error??"unknown")} |`)]}function he(t){let e=Object.keys(R),n=a=>{if(a.layer!=="Check")return"";let s=e.filter(i=>a.provenRules.some(r=>r.languageId===i)),o=e.filter(i=>!s.includes(i)).map(i=>R[i]);return s.length===0?"No Proven rule yet: Needs Review only":`Proven in ${s.map(i=>R[i]).join(", ")}${o.length?`; Needs Review only in ${o.join(", ")}`:""}`};return["## WCAG 2.2 AA coverage","","Every WCAG 2.2 level A and AA criterion (4.1.1 Parsing is obsolete) with the Layer that verifies it: the Check in code, an AI Review, a browser audit or a person. A Check criterion reports Findings only in the languages where it has a Proven rule; elsewhere its matches are Needs Review.","","| Criterion | Level | Layer | Check proof status per language |","| --- | --- | --- | --- |",...t.map(a=>`| [${a.criterion} ${v(a.name)}](${a.url}) | ${a.level} | ${a.layer} | ${n(a)} |`)]}function V(t,e,n){let a=o=>{let i=k.indexOf(o);return i===-1?k.length:i};return[...new Set(t.map(o=>o.criterion))].sort((o,i)=>a(o)-a(i)||o.localeCompare(i)).flatMap(o=>[`### ${o} ${v(x(o))}`,"",`| ${e.join(" | ")} |`,`| ${e.map(()=>"---").join(" | ")} |`,...t.filter(i=>i.criterion===o).sort((i,r)=>z(i.file,r.file)||i.line-r.line).map(i=>`| ${n(i).join(" | ")} |`),""]).slice(0,-1)}var z=(t,e)=>t<e?-1:t>e?1:0;function $(t){let e=t.replace(/[\r\n]+/g," ").replace(/\|/g,"\\|"),n="`".repeat(Math.max(0,...[...e.matchAll(/`+/g)].map(a=>a[0].length))+1);return n.length>1?`${n} ${e} ${n}`:`\`${e}\``}function v(t){return t.replace(/\s*[\r\n]+\s*/g," ").replace(/[\\`*_[\]<>|#~&!]/g,e=>`\\${e}`)}var X={html:"html",htm:"html",vue:"vue",svelte:"svelte",jsx:"javascriptreact",tsx:"typescriptreact",astro:"astro",ts:"typescript"},Fe=`**/*.{${Object.keys(X).join(",")}}`;function Me(t){let e=/\.([^./]+)$/.exec(t)?.[1].toLowerCase();return e===void 0?void 0:X[e]}var Ne=1;async function Ue(t,e,n,a,s){let o={languageId:e,text:n};if(!q(o))return;let i=await a(o);if(i.status!=="done"){let r=i.status==="paused"?i.reason:"The Check was interrupted";return{file:t,languageId:e,status:"failed",error:r,findings:[],needsReview:[],ignored:0}}return ge(t,e,n,i.result,s?.(i.result)??i.result.findings.map(()=>!1))}function ge(t,e,n,a,s){let o=F(n),i=l=>{let g=o.length;for(;o[g-1]>l;)g--;return{line:g,column:l-o[g-1]+1,offset:l}},r=l=>({start:i(l.start),end:i(l.end)});return{file:t,languageId:e,status:"checked",findings:a.findings.map((l,g)=>({ruleId:l.ruleId,criteria:l.criteria,severity:l.severity,layer:"check",message:l.message,helpUrl:l.helpUrl,proof:"proven",range:r(l.range),...l.fix?{fix:l.fix.map(c=>({range:r(c.range),newText:c.newText}))}:{},baselined:s[g]})),needsReview:a.needsReview.map(l=>({criterion:l.criterion,reason:l.reason,...l.ruleId?{ruleId:l.ruleId,proof:"unproven"}:{},...l.range?{range:r(l.range)}:{}})),ignored:a.ignored??0}}var d={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",underline:"\x1B[4m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",cyan:"\x1B[36m"};function We(t=process.stdout,e=process.env){return e.NO_COLOR!==void 0&&e.NO_COLOR!==""?!1:e.FORCE_COLOR!==void 0&&e.FORCE_COLOR!=="0"?!0:!!t.isTTY}function Ge(t,e={}){let n=!!e.color,a=(o,i)=>n?`${o}${i}${d.reset}`:i;return[` ${a(d.dim,"\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E")} ${a(d.bold+d.cyan,"allyward")} ${a(d.dim,`v${t}`)}`,` ${a(d.dim,"\u2502")} ${a(d.green,"\u2593\u2593\u2593\u2593\u2593\u2593\u2593")} ${a(d.dim,"\u2502")} Local WCAG 2.2 AA accessibility checker`,` ${a(d.dim,"\u2502")} ${a(d.green,"\u2593 \u2714 \u2593")} ${a(d.dim,"\u2502")} ${a(d.dim,"HTML \xB7 React \xB7 Vue \xB7 Svelte \xB7 Angular \xB7 Astro")}`,` ${a(d.dim,"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F")} ${a(d.dim,"Offline \xB7 Zero telemetry \xB7 Zero workspace code execution")}`,""].join(`
|
|
175
|
+
`)}function De(t,e={}){let n=!!e.color,a=(r,l)=>n?`${r}${l}${d.reset}`:l,s=[];n&&s.push(a(d.dim,"\u256D\u2500 ")+a(d.bold+d.cyan,"allyward")+a(d.dim," \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));for(let r of t.files){if(r.status==="failed"){s.push(a(d.bold+d.underline,r.file),` ${a(d.red,"could not be checked:")} ${r.error}`,"");continue}let l=r.findings.filter(c=>!c.baselined),g=r.needsReview.filter(c=>c.range);if(!(l.length===0&&g.length===0)){s.push(a(d.bold+d.underline,r.file));for(let c of l){let p=a(d.dim,`${c.range.start.line}:${c.range.start.column}`),y=c.severity==="error"?d.red:c.severity==="warning"?d.yellow:d.cyan,C=a(y,c.severity.padEnd(11)),Q=a(d.dim,`WCAG ${c.criteria[0]} ${c.ruleId}`);s.push(` ${p} ${C} ${c.message} ${Q}`,` ${a(d.dim,c.helpUrl)}`)}for(let c of g){let p=a(d.dim,`${c.range.start.line}:${c.range.start.column}`);s.push(` ${p} ${a(d.yellow,"needs review")} WCAG ${c.criterion}: ${c.reason}`)}s.push("")}}let o=t.summary,i=[`${o.files} ${o.files===1?"file":"files"} checked`,`${o.blocking} blocking ${o.blocking===1?"Finding":"Findings"}`,...o.findings>o.blocking?[`${o.findings-o.blocking} not blocking`]:[],...o.baselined||o.fixedSinceBaseline?[`${o.baselined} baselined (${o.fixedSinceBaseline} fixed since the baseline)`]:[],`${o.needsReview} Needs Review`,...o.failedFiles?[`${o.failedFiles} could not be checked`]:[]];if(n){let l=o.blocking===0&&o.failedFiles===0?a(d.bold+d.green,"\u2714"):a(d.bold+d.red,"\u2716");s.push(a(d.dim,"\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),s.push(`${l} ${i.join(", ")}`)}else s.push(i.join(", "));return s.join(`
|
|
176
|
+
`)+`
|
|
177
|
+
`}var me={error:"error",warning:"warning",information:"note"};function He(t,e){let n=i=>({startLine:i.start.line,startColumn:i.start.column,endLine:i.end.line,endColumn:i.end.column}),a=(i,r)=>[{physicalLocation:{artifactLocation:{uri:i},region:n(r)}}],s=new Map,o=t.files.flatMap(i=>[...i.findings.map(r=>(s.has(r.ruleId)||s.set(r.ruleId,{id:r.ruleId,helpUri:r.helpUrl,shortDescription:{text:r.message}}),{ruleId:r.ruleId,level:me[r.severity],message:{text:`${r.message} (WCAG ${r.criteria.join(", ")})`},locations:a(i.file,r.range),...r.baselined?{suppressions:[{kind:"external",justification:"In the Allyward baseline"}]}:{}})),...i.needsReview.flatMap(r=>r.range?[{ruleId:r.ruleId??`needs-review/${r.criterion}`,level:"note",message:{text:`Needs Review, WCAG ${r.criterion}: ${r.reason}`},locations:a(i.file,r.range)}]:[]),...i.status==="failed"?[{ruleId:"allyward/not-checked",level:"error",message:{text:`Could not be checked: ${i.error}`},locations:[{physicalLocation:{artifactLocation:{uri:i.file}}}]}]:[]]);for(let i of o)s.has(i.ruleId)||s.set(i.ruleId,{id:i.ruleId,shortDescription:{text:i.message.text}});return{$schema:"https://json.schemastore.org/sarif-2.1.0.json",version:"2.1.0",runs:[{tool:{driver:{name:"Allyward",version:e,informationUri:"https://github.com/NotAisu/allyward",rules:[...s.values()]}},results:o}]}}import{Worker as pe}from"worker_threads";var _=3,Y=3*6e4,J=`${Y/6e4} minutes`,be=512,K=class{constructor(e,n={}){let a=n.now??Date.now,{log:s}=n;this.breaker=new O(a,s);let o={script:e,firstLoadMs:n.firstLoadMs??15e3,breaker:this.breaker,now:a,log:s};this.typing=new P({...o,name:"typing worker",deadlineMs:n.deadlineMs??1e3}),this.background=new P({...o,name:"background worker",deadlineMs:n.backgroundDeadlineMs??1e4})}engines(){return this.breaker.engines()}check(e,n,a={},{background:s=!1}={}){return new Promise(o=>{let[i,r]=s?[this.background,this.typing]:[this.typing,this.background];i.drop(e),r.drop(e,{running:!0}),i.add({key:e,document:n,options:a,resolve:o})})}dispose(){this.typing.dispose(),this.background.dispose()}},O=class{constructor(e,n){this.now=e;this.log=n;this.failures=new Map;this.checkedLanguages=new Set}engines(){return{used:[...this.checkedLanguages].sort(),paused:[...this.failures].filter(([,e])=>e.length>=_).map(([e])=>e).sort()}}pausedReason(e){if(!((this.failures.get(e)?.length??0)<_))return`The ${e} engine failed ${_} times within ${J} and is paused for this session`}recordUse(e){this.checkedLanguages.add(e)}recordFailure(e){let n=this.now(),a=[...(this.failures.get(e)??[]).filter(s=>n-s<=Y),n];this.failures.set(e,a),a.length===_&&this.log?.error(`${e} engine paused for this session after ${_} failures within ${J}`)}},P=class{constructor(e){this.options=e;this.pending=new Map;this.loaded=new Set}drop(e,{running:n=!1}={}){this.pending.get(e)?.resolve({status:"dropped"}),this.pending.delete(e),n&&this.running?.request.key===e&&(this.running.request.resolve({status:"dropped"}),this.running.request={...this.running.request,resolve:()=>{}})}add(e){this.pending.set(e.key,e),this.next()}dispose(){this.running&&(clearTimeout(this.running.deadline),this.running.request.resolve({status:"dropped"})),this.running=void 0,this.pending.forEach(e=>e.resolve({status:"dropped"})),this.pending.clear(),this.worker?.terminate(),this.worker=void 0}next(){if(this.running)return;let[e]=this.pending.values();if(!e)return;this.pending.delete(e.key);let{breaker:n,name:a,log:s,now:o}=this.options,i=e.document.languageId,r=n.pausedReason(i);if(r!==void 0)return e.resolve({status:"paused",reason:r,deadlineExceeded:!1}),this.next();n.recordUse(i),this.worker??=this.spawn();let l=!this.loaded.has(i),g=l?this.options.firstLoadMs:this.options.deadlineMs,c=setTimeout(()=>{this.worker?.terminate(),this.worker=void 0,s?.warn(`${i} Check took longer than ${g} ms; the ${a} is restarted`),this.finish({status:"paused",reason:`The Check took longer than ${g} ms`,deadlineExceeded:!0},!1)},g);this.running={request:e,deadline:c,started:o(),firstLoad:l},this.worker.postMessage({document:e.document,options:e.options})}finish(e,n=e.status==="paused"){this.running&&(clearTimeout(this.running.deadline),n&&this.options.breaker.recordFailure(this.running.request.document.languageId),this.running.request.resolve(e),this.running=void 0,this.next())}spawn(){let{script:e,name:n,log:a,now:s}=this.options,o=new pe(e,{resourceLimits:{maxOldGenerationSizeMb:be}});this.loaded=new Set,a?.info(`The ${n} started`),o.on("message",r=>{if(o!==this.worker||!this.running)return;let{request:l,started:g,firstLoad:c}=this.running;this.loaded.add(l.document.languageId),"result"in r?this.finish({status:"done",result:r.result,durationMs:s()-g,firstLoad:c}):"parseError"in r?(a?.warn(`${l.document.languageId} Check paused: parse error at ${S(r.position)}`),this.finish({status:"paused",reason:r.parseError,deadlineExceeded:!1},!1)):(a?.error(`${l.document.languageId} engine failed: ${S(r.error)}`),this.finish({status:"paused",reason:r.error,deadlineExceeded:!1}))});let i=r=>{o===this.worker&&(this.worker=void 0,a?.error(S(this.running?`${this.running.request.document.languageId} engine: ${r}`:r)),this.finish({status:"paused",reason:r,deadlineExceeded:!1}))};return o.on("error",r=>i(`The ${n} crashed: ${r.message}`)),o.on("exit",r=>i(`The ${n} stopped (exit code ${r})`)),o.unref(),o}};export{S as a,K as b,xe as c,ke as d,T as e,Te as f,Fe as g,Me as h,Ne as i,Ue as j,We as k,Ge as l,De as m,He as n};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
import{h as x}from"./chunk-7UDH5BXX.mjs";var F=/<!--\s*ally(?:ward|proof)-ignore\b([\s\S]*?)-->/g,k=/\/\*\s*ally(?:ward|proof)-ignore\b([\s\S]*?)\*\//g,y=["javascriptreact","typescriptreact"],v=e=>e.replace(/^allyproof\//,"allyward/");function m(e,t){let n=x(e.text),o=a=>n.filter(i=>i<=a).length,r=[...e.text.matchAll(y.includes(e.languageId)?k:F)].map(a=>({startLine:o(a.index),target:o(a.index+a[0].length)+1,rules:a[1].split(/[\s,]+/).filter(Boolean).map(v)}));for(let a of[...r].reverse())a.target=r.find(i=>i.startLine===a.target)?.target??a.target;return t.filter(a=>!r.some(i=>i.target===o(a.range.start)&&i.rules.includes(a.ruleId)))}var A=[...y,"typescript"];async function W(e,t,n){let{languageId:o,text:r}=e,a=r.lastIndexOf(`
|
|
3
|
+
`,t.range.start-1)+1,i=/^[ \t]*/.exec(r.slice(a))[0],c=r.includes(`\r
|
|
4
|
+
`)?`\r
|
|
5
|
+
`:`
|
|
6
|
+
`,l=y.includes(o)?[`{/* allyward-ignore ${t.ruleId} */}`,`/* allyward-ignore ${t.ruleId} */`]:[`<!-- allyward-ignore ${t.ruleId} -->`];for(let p of l){let u={offset:a,text:`${i}${p}${c}`};if(!A.includes(o))return u;let g=await n({languageId:o,text:r.slice(0,a)+u.text+r.slice(a)}),s=t.range.start+u.text.length;if(g?.every(d=>d.ruleId!==t.ruleId||d.range.start!==s))return u}}var S=[E,P];function h(e,t){return t.map(n=>{for(let o of S){let r=o(e,n);if(r)return{...n,...r}}return n})}function E(e,t){let n=j(e,t,"html","3.1.1");if(!n||n.some(({name:r})=>r==="lang"))return;let o=t.range.start+5;return{fix:[{range:{start:o,end:o},newText:' lang="en"'}],quickFixOnly:!0}}function P(e,t){let n=j(e,t,"body","1.3.1")?.filter(({name:o})=>o==="aria-hidden");if(n?.length)return{fix:n.map(({range:o})=>({range:o,newText:""}))}}function j(e,t,n,o){if(t.criteria[0]!==o)return;let r=t.range.start;if(!new RegExp(`^<${n}(?=[\\s/>])`,"iy").test(e.slice(r,r+n.length+2)))return;r+=1+n.length;let a=[];for(;;){let i=r;if(r=f(e,r,/\s*/y),e[r]===">"||e.startsWith("/>",r))return a;let c=e[r]==="{"?B(e,r):f(e,r,/[^\s"'<>/={}]+/y);if(c===void 0||c===r)return;let l=e.slice(r,c).toLowerCase();r=c;let p=f(e,r,/\s*=\s*/y);if(p!==r){r=p;let u=e[r],g=u==='"'||u==="'"?e.indexOf(u,r+1)+1:u==="{"?B(e,r):f(e,r,/[^\s>]+/y);if(!g||g===r)return;r=g}a.push({name:l,range:{start:i,end:r}})}}function f(e,t,n){return n.lastIndex=t,n.exec(e)?n.lastIndex:t}function B(e,t){let n=0;for(let o=t;o<e.length;o++){let r=e[o];if(r==='"'||r==="'"||r==="`"){let a=e.indexOf(r,o+1);if(a===-1)return;o=a}else if(r==="{")n++;else if(r==="}"&&--n===0)return o+1}}var b={confidence:.95,threshold:.95,rules:{"@angular-eslint/template/alt-text":{angular:{correct:108,wrong:0,lowerBound:.972,proven:!0}},"@angular-eslint/template/click-events-have-key-events":{angular:{correct:20,wrong:10,lowerBound:.5,proven:!1}},"@angular-eslint/template/elements-content":{angular:{correct:166,wrong:0,lowerBound:.982,proven:!0}},"@angular-eslint/template/interactive-supports-focus":{angular:{correct:21,wrong:16,lowerBound:.419,proven:!1}},"@angular-eslint/template/label-has-associated-control":{angular:{correct:84,wrong:1,lowerBound:.945,proven:!1}},"@angular-eslint/template/no-positive-tabindex":{angular:{correct:80,wrong:0,lowerBound:.963,proven:!1}},"@angular-eslint/template/role-has-required-aria":{angular:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"@angular-eslint/template/valid-aria":{angular:{correct:0,wrong:1,lowerBound:0,proven:!1}},"@html-eslint/no-positive-tabindex":{html:{correct:0,wrong:1,lowerBound:0,proven:!1}},"@html-eslint/require-li-container":{html:{correct:1,wrong:0,lowerBound:.05,proven:!1}},"allyward/autocomplete-valid":{angular:{correct:78,wrong:0,lowerBound:.962,proven:!0},vue:{correct:8,wrong:0,lowerBound:.687,proven:!1}},"allyward/button-name":{astro:{correct:88,wrong:0,lowerBound:.966,proven:!0},javascriptreact:{correct:86,wrong:0,lowerBound:.965,proven:!0},typescriptreact:{correct:80,wrong:1,lowerBound:.942,proven:!1}},"allyward/non-text-contrast":{astro:{correct:6,wrong:0,lowerBound:.606,proven:!1},javascriptreact:{correct:1,wrong:0,lowerBound:.05,proven:!1}},"allyward/password-autocomplete":{javascriptreact:{correct:0,wrong:1,lowerBound:0,proven:!1}},"allyward/text-contrast":{astro:{correct:18,wrong:2,lowerBound:.717,proven:!1},html:{correct:4,wrong:0,lowerBound:.472,proven:!1},javascriptreact:{correct:19,wrong:0,lowerBound:.854,proven:!1},svelte:{correct:5,wrong:0,lowerBound:.549,proven:!1},typescriptreact:{correct:1,wrong:0,lowerBound:.05,proven:!1}},"area-alt":{html:{correct:1,wrong:0,lowerBound:.05,proven:!1}},"aria-allowed-attr":{html:{correct:78,wrong:0,lowerBound:.962,proven:!0}},"aria-command-name":{html:{correct:1,wrong:0,lowerBound:.05,proven:!1}},"aria-hidden-body":{html:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"aria-input-field-name":{html:{correct:3,wrong:0,lowerBound:.368,proven:!1}},"aria-required-attr":{html:{correct:0,wrong:1,lowerBound:0,proven:!1}},"aria-required-children":{html:{correct:12,wrong:0,lowerBound:.779,proven:!1}},"aria-required-parent":{html:{correct:12,wrong:0,lowerBound:.779,proven:!1}},"aria-roles":{html:{correct:0,wrong:1,lowerBound:0,proven:!1}},"aria-valid-attr":{html:{correct:77,wrong:0,lowerBound:.961,proven:!0}},"aria-valid-attr-value":{html:{correct:0,wrong:1,lowerBound:0,proven:!1}},"astro/jsx-a11y/alt-text":{astro:{correct:109,wrong:0,lowerBound:.972,proven:!0}},"astro/jsx-a11y/anchor-ambiguous-text":{astro:{correct:26,wrong:3,lowerBound:.753,proven:!1}},"astro/jsx-a11y/anchor-has-content":{astro:{correct:105,wrong:0,lowerBound:.971,proven:!0}},"astro/jsx-a11y/aria-props":{astro:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"astro/jsx-a11y/aria-proptypes":{astro:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"astro/jsx-a11y/aria-role":{astro:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"astro/jsx-a11y/autocomplete-valid":{astro:{correct:47,wrong:1,lowerBound:.904,proven:!1}},"astro/jsx-a11y/click-events-have-key-events":{astro:{correct:1,wrong:1,lowerBound:.025,proven:!1}},"astro/jsx-a11y/heading-has-content":{astro:{correct:78,wrong:0,lowerBound:.962,proven:!0}},"astro/jsx-a11y/html-has-lang":{astro:{correct:4,wrong:0,lowerBound:.472,proven:!1}},"astro/jsx-a11y/iframe-has-title":{astro:{correct:7,wrong:0,lowerBound:.651,proven:!1}},"astro/jsx-a11y/img-redundant-alt":{astro:{correct:0,wrong:1,lowerBound:0,proven:!1}},"astro/jsx-a11y/label-has-associated-control":{astro:{correct:41,wrong:4,lowerBound:.808,proven:!1}},"astro/jsx-a11y/no-aria-hidden-on-focusable":{astro:{correct:80,wrong:4,lowerBound:.894,proven:!1}},"astro/jsx-a11y/no-noninteractive-element-interactions":{astro:{correct:0,wrong:6,lowerBound:0,proven:!1}},"astro/jsx-a11y/no-noninteractive-element-to-interactive-role":{astro:{correct:0,wrong:4,lowerBound:0,proven:!1}},"astro/jsx-a11y/no-static-element-interactions":{astro:{correct:1,wrong:1,lowerBound:.025,proven:!1}},"astro/jsx-a11y/role-has-required-aria-props":{astro:{correct:81,wrong:0,lowerBound:.963,proven:!0}},"astro/jsx-a11y/role-supports-aria-props":{astro:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"astro/jsx-a11y/tabindex-no-positive":{astro:{correct:80,wrong:0,lowerBound:.963,proven:!1}},"autocomplete-valid":{html:{correct:85,wrong:0,lowerBound:.965,proven:!0}},"button-name":{html:{correct:74,wrong:0,lowerBound:.96,proven:!0}},dlitem:{html:{correct:2,wrong:0,lowerBound:.223,proven:!1}},"document-title":{html:{correct:84,wrong:6,lowerBound:.872,proven:!1}},"frame-title":{html:{correct:2,wrong:0,lowerBound:.223,proven:!1}},"html-has-lang":{html:{correct:88,wrong:6,lowerBound:.877,proven:!1}},"html-lang-valid":{html:{correct:85,wrong:0,lowerBound:.965,proven:!0}},"image-alt":{html:{correct:205,wrong:0,lowerBound:.985,proven:!0}},"input-image-alt":{html:{correct:5,wrong:0,lowerBound:.549,proven:!1}},"jsx-a11y-x/alt-text":{javascriptreact:{correct:89,wrong:0,lowerBound:.966,proven:!0},typescriptreact:{correct:103,wrong:0,lowerBound:.971,proven:!0}},"jsx-a11y-x/anchor-ambiguous-text":{typescriptreact:{correct:1,wrong:4,lowerBound:.01,proven:!1}},"jsx-a11y-x/anchor-has-content":{javascriptreact:{correct:84,wrong:0,lowerBound:.964,proven:!0},typescriptreact:{correct:78,wrong:1,lowerBound:.941,proven:!1}},"jsx-a11y-x/aria-props":{javascriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0},typescriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"jsx-a11y-x/aria-proptypes":{javascriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0},typescriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"jsx-a11y-x/aria-role":{javascriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0},typescriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"jsx-a11y-x/autocomplete-valid":{javascriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0},typescriptreact:{correct:65,wrong:0,lowerBound:.954,proven:!0}},"jsx-a11y-x/click-events-have-key-events":{javascriptreact:{correct:68,wrong:10,lowerBound:.792,proven:!1},typescriptreact:{correct:29,wrong:33,lowerBound:.358,proven:!1}},"jsx-a11y-x/heading-has-content":{javascriptreact:{correct:76,wrong:0,lowerBound:.961,proven:!0},typescriptreact:{correct:63,wrong:0,lowerBound:.953,proven:!0}},"jsx-a11y-x/html-has-lang":{javascriptreact:{correct:1,wrong:0,lowerBound:.05,proven:!1},typescriptreact:{correct:1,wrong:1,lowerBound:.025,proven:!1}},"jsx-a11y-x/iframe-has-title":{javascriptreact:{correct:2,wrong:0,lowerBound:.223,proven:!1},typescriptreact:{correct:9,wrong:0,lowerBound:.716,proven:!1}},"jsx-a11y-x/img-redundant-alt":{javascriptreact:{correct:2,wrong:0,lowerBound:.223,proven:!1},typescriptreact:{correct:0,wrong:1,lowerBound:0,proven:!1}},"jsx-a11y-x/interactive-supports-focus":{javascriptreact:{correct:0,wrong:1,lowerBound:0,proven:!1},typescriptreact:{correct:0,wrong:4,lowerBound:0,proven:!1}},"jsx-a11y-x/label-has-associated-control":{javascriptreact:{correct:113,wrong:2,lowerBound:.946,proven:!1},typescriptreact:{correct:48,wrong:0,lowerBound:.939,proven:!1}},"jsx-a11y-x/media-has-caption":{javascriptreact:{correct:0,wrong:1,lowerBound:0,proven:!1},typescriptreact:{correct:0,wrong:4,lowerBound:0,proven:!1}},"jsx-a11y-x/mouse-events-have-key-events":{typescriptreact:{correct:1,wrong:0,lowerBound:.05,proven:!1}},"jsx-a11y-x/no-aria-hidden-on-focusable":{javascriptreact:{correct:80,wrong:1,lowerBound:.942,proven:!1},typescriptreact:{correct:79,wrong:1,lowerBound:.942,proven:!1}},"jsx-a11y-x/no-interactive-element-to-noninteractive-role":{javascriptreact:{correct:1,wrong:0,lowerBound:.05,proven:!1},typescriptreact:{correct:0,wrong:1,lowerBound:0,proven:!1}},"jsx-a11y-x/no-noninteractive-element-interactions":{javascriptreact:{correct:11,wrong:3,lowerBound:.534,proven:!1},typescriptreact:{correct:2,wrong:9,lowerBound:.033,proven:!1}},"jsx-a11y-x/no-static-element-interactions":{javascriptreact:{correct:46,wrong:6,lowerBound:.784,proven:!1},typescriptreact:{correct:30,wrong:31,lowerBound:.38,proven:!1}},"jsx-a11y-x/role-has-required-aria-props":{javascriptreact:{correct:81,wrong:0,lowerBound:.963,proven:!0},typescriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"jsx-a11y-x/role-supports-aria-props":{javascriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!0},typescriptreact:{correct:81,wrong:0,lowerBound:.963,proven:!0}},"jsx-a11y-x/tabindex-no-positive":{javascriptreact:{correct:80,wrong:0,lowerBound:.963,proven:!1},typescriptreact:{correct:79,wrong:3,lowerBound:.908,proven:!1}},label:{html:{correct:85,wrong:0,lowerBound:.965,proven:!0}},"link-name":{html:{correct:108,wrong:0,lowerBound:.972,proven:!0}},list:{html:{correct:2,wrong:0,lowerBound:.223,proven:!1}},listitem:{html:{correct:1,wrong:0,lowerBound:.05,proven:!1}},marquee:{html:{correct:1,wrong:0,lowerBound:.05,proven:!1}},"meta-refresh":{html:{correct:4,wrong:1,lowerBound:.342,proven:!1}},"meta-viewport":{html:{correct:4,wrong:0,lowerBound:.472,proven:!1}},"nested-interactive":{html:{correct:5,wrong:0,lowerBound:.549,proven:!1}},"select-name":{html:{correct:6,wrong:0,lowerBound:.606,proven:!1}},"summary-name":{html:{correct:3,wrong:0,lowerBound:.368,proven:!1}},"svelte/a11y_autocomplete_valid":{svelte:{correct:13,wrong:0,lowerBound:.794,proven:!1}},"svelte/a11y_click_events_have_key_events":{svelte:{correct:0,wrong:2,lowerBound:0,proven:!1}},"svelte/a11y_consider_explicit_label":{svelte:{correct:119,wrong:0,lowerBound:.975,proven:!0}},"svelte/a11y_incorrect_aria_attribute_type_token":{svelte:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"svelte/a11y_interactive_supports_focus":{svelte:{correct:0,wrong:1,lowerBound:0,proven:!1}},"svelte/a11y_label_has_associated_control":{svelte:{correct:3,wrong:0,lowerBound:.368,proven:!1}},"svelte/a11y_missing_attribute":{svelte:{correct:81,wrong:0,lowerBound:.963,proven:!0}},"svelte/a11y_missing_content":{svelte:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"svelte/a11y_no_static_element_interactions":{svelte:{correct:1,wrong:2,lowerBound:.016,proven:!1}},"svelte/a11y_positive_tabindex":{svelte:{correct:80,wrong:0,lowerBound:.963,proven:!1}},"svelte/a11y_role_has_required_aria_props":{svelte:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"svelte/a11y_role_supports_aria_props_implicit":{svelte:{correct:79,wrong:0,lowerBound:.962,proven:!0}},"svelte/a11y_unknown_aria_attribute":{svelte:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"svelte/a11y_unknown_role":{svelte:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"svg-img-alt":{html:{correct:4,wrong:0,lowerBound:.472,proven:!1}},"td-headers-attr":{html:{correct:4,wrong:0,lowerBound:.472,proven:!1}},"valid-lang":{html:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"vuejs-accessibility/alt-text":{vue:{correct:134,wrong:0,lowerBound:.977,proven:!0}},"vuejs-accessibility/anchor-has-content":{vue:{correct:86,wrong:0,lowerBound:.965,proven:!0}},"vuejs-accessibility/aria-props":{vue:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"vuejs-accessibility/aria-role":{vue:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"vuejs-accessibility/click-events-have-key-events":{vue:{correct:11,wrong:6,lowerBound:.419,proven:!1}},"vuejs-accessibility/form-control-has-label":{vue:{correct:15,wrong:12,lowerBound:.381,proven:!1}},"vuejs-accessibility/heading-has-content":{vue:{correct:79,wrong:0,lowerBound:.962,proven:!0}},"vuejs-accessibility/iframe-has-title":{vue:{correct:69,wrong:0,lowerBound:.957,proven:!0}},"vuejs-accessibility/label-has-for":{vue:{correct:85,wrong:1,lowerBound:.946,proven:!1}},"vuejs-accessibility/mouse-events-have-key-events":{vue:{correct:0,wrong:4,lowerBound:0,proven:!1}},"vuejs-accessibility/no-aria-hidden-on-focusable":{vue:{correct:82,wrong:0,lowerBound:.964,proven:!0}},"vuejs-accessibility/no-role-presentation-on-focusable":{vue:{correct:2,wrong:0,lowerBound:.223,proven:!1}},"vuejs-accessibility/no-static-element-interactions":{vue:{correct:17,wrong:12,lowerBound:.417,proven:!1}},"vuejs-accessibility/role-has-required-aria-props":{vue:{correct:80,wrong:0,lowerBound:.963,proven:!0}},"vuejs-accessibility/tabindex-no-positive":{vue:{correct:80,wrong:0,lowerBound:.963,proven:!1}}}};var _={angular:["@angular-eslint/template/no-positive-tabindex"],astro:["astro/jsx-a11y/anchor-ambiguous-text","astro/jsx-a11y/img-redundant-alt","astro/jsx-a11y/tabindex-no-positive"],html:["@html-eslint/no-positive-tabindex"],javascriptreact:["jsx-a11y-x/anchor-ambiguous-text","jsx-a11y-x/img-redundant-alt","jsx-a11y-x/tabindex-no-positive"],svelte:["svelte/a11y_img_redundant_alt","svelte/a11y_positive_tabindex"],typescript:["@angular-eslint/template/no-positive-tabindex"],typescriptreact:["jsx-a11y-x/anchor-ambiguous-text","jsx-a11y-x/img-redundant-alt","jsx-a11y-x/tabindex-no-positive"],vue:["vuejs-accessibility/tabindex-no-positive"]};var ee={html:["html"],jsx:["javascriptreact","typescriptreact"],vue:["vue"],svelte:["svelte"],astro:["astro"],angular:["angular","typescript"]};function re(e,t){return e==="html"&&/\.component\.html$/i.test(t)?"angular":e}function C(e){return e.languageId!=="typescript"||e.text.includes("@Component(")}var R=class extends Error{constructor(n,o){super(`Parse error at ${n}: ${o}`);this.position=n;this.name="ParseError"}},T=b.rules;function $(e,t){return T[e]?.[t]}var L=_;function I(e,t){return L[t]?.includes(e)===!0}function D(e,t){return!I(e,t)&&$(e,t)?.proven===!0}async function te(e,t={}){let{findings:n,needsReview:o}=await N(e,t.components),r=M(t.rules??{}),a=m(e,n),i=s=>r[s.ruleId]!=="off",c=a.filter(i),l=t.proven??D,p=s=>i(s)&&l(s.ruleId,e.languageId),u=c.filter(p),g=c.filter(s=>!u.includes(s));return{findings:h(e.text,u).map(s=>{let d=r[s.ruleId];return d&&d!=="off"?{...s,severity:d}:s}),needsReview:[...o,...g.flatMap(s=>s.criteria.map(d=>({criterion:d,reason:I(s.ruleId,e.languageId)?`Convention, verify: ${s.message} (${s.ruleId} is a Best-practice rule: it flags a coding convention, not a WCAG failure)`:`Likely failure, verify: ${s.message} (${s.ruleId} is not yet a Proven rule)`,range:s.range,ruleId:s.ruleId})))],ignored:n.filter(s=>!a.includes(s)&&p(s)).length}}function M(e){let t=Object.entries(e),n=t.filter(([o])=>v(o)!==o);return Object.fromEntries([...n.map(([o,r])=>[v(o),r]),...t.filter(o=>!n.includes(o))])}async function N(e,t){if(!e.text.trim())return{findings:[],needsReview:[]};if(e.languageId==="javascriptreact"||e.languageId==="typescriptreact"){let{checkJsx:i}=await import("./engine-TPXDCC2K.mjs"),{findings:c,needsReview:l}=i(e.text,e.languageId==="typescriptreact",t);return{findings:w(c),needsReview:l}}if(e.languageId==="vue"){let{checkVue:i}=await import("./engine-2IR2XTU3.mjs"),{findings:c,needsReview:l}=i(e.text,t);return{findings:w(c),needsReview:l}}if(e.languageId==="svelte"){let{checkSvelte:i}=await import("./engine-6ZXXNROB.mjs"),{findings:c,needsReview:l}=i(e.text,t);return{findings:w(c),needsReview:l}}if(e.languageId==="astro"){let{checkAstro:i}=await import("./engine-EIRLRZJL.mjs"),{findings:c,needsReview:l}=i(e.text,t);return{findings:w(c),needsReview:l}}if(!C(e))return{findings:[],needsReview:[]};if(e.languageId==="angular"||e.languageId==="typescript"){let{checkAngularTemplate:i,checkAngularComponents:c}=await import("./engine-BIE3PYS6.mjs"),l=e.languageId==="angular"?i:c,{findings:p,needsReview:u}=l(e.text,t);return{findings:w(p),needsReview:u}}if(e.languageId!=="html")return{findings:[],needsReview:[]};let{checkHtmlWithAxe:n,checkHtmlWithEslint:o}=await import("./engine-BXEHUF3N.mjs"),r=await n(e.text),a=o(e.text);return{findings:w([...r.findings,...G(r.findings,a)]),needsReview:r.needsReview}}function G(e,t){return t.filter(n=>!e.some(o=>H(o.range,n.range)&&o.criteria.some(r=>n.criteria.includes(r))))}function H(e,t){return e.start<t.end&&t.start<e.end||e.start===t.start}function w(e){return e.sort((t,n)=>t.range.start-n.range.start||t.range.end-n.range.end)}export{v as a,W as b,b as c,_ as d,ee as e,re as f,C as g,R as h,$ as i,te as j};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
|
|
2
|
+
function f(n,c,t,d=!1){if(!t)return;let o=t.polymorphicPropName?c(t.polymorphicPropName):void 0,e=typeof o=="string"&&o?o:n,r=t.components??{},i=d&&/[A-Z-]/.test(e)?Object.keys(r).find(a=>p(a)===p(e)):Object.prototype.hasOwnProperty.call(r,e)?e:void 0,s=i===void 0?e:r[i];return s===n?void 0:s}function p(n){return n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}var m=new WeakMap;export{f as a,m as b};
|