@bquery/bquery 1.6.0 → 1.7.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/README.md +716 -586
- package/dist/a11y/announce.d.ts +43 -0
- package/dist/a11y/announce.d.ts.map +1 -0
- package/dist/a11y/audit.d.ts +42 -0
- package/dist/a11y/audit.d.ts.map +1 -0
- package/dist/a11y/index.d.ts +53 -0
- package/dist/a11y/index.d.ts.map +1 -0
- package/dist/a11y/media-preferences.d.ts +77 -0
- package/dist/a11y/media-preferences.d.ts.map +1 -0
- package/dist/a11y/roving-tab-index.d.ts +38 -0
- package/dist/a11y/roving-tab-index.d.ts.map +1 -0
- package/dist/a11y/skip-link.d.ts +37 -0
- package/dist/a11y/skip-link.d.ts.map +1 -0
- package/dist/a11y/trap-focus.d.ts +49 -0
- package/dist/a11y/trap-focus.d.ts.map +1 -0
- package/dist/a11y/types.d.ts +152 -0
- package/dist/a11y/types.d.ts.map +1 -0
- package/dist/a11y-C5QOVvRn.js +421 -0
- package/dist/a11y-C5QOVvRn.js.map +1 -0
- package/dist/a11y.es.mjs +14 -0
- package/dist/component/component.d.ts.map +1 -1
- package/dist/component/html.d.ts.map +1 -1
- package/dist/component/index.d.ts +2 -1
- package/dist/component/index.d.ts.map +1 -1
- package/dist/component/library.d.ts.map +1 -1
- package/dist/component/scope.d.ts +138 -0
- package/dist/component/scope.d.ts.map +1 -0
- package/dist/component/types.d.ts +53 -1
- package/dist/component/types.d.ts.map +1 -1
- package/dist/component-CuuTijA6.js +684 -0
- package/dist/component-CuuTijA6.js.map +1 -0
- package/dist/component.es.mjs +9 -6
- package/dist/{config-DRmZZno3.js → config-BW35FKuA.js} +4 -4
- package/dist/{config-DRmZZno3.js.map → config-BW35FKuA.js.map} +1 -1
- package/dist/constraints-3lV9yyBw.js +100 -0
- package/dist/constraints-3lV9yyBw.js.map +1 -0
- package/dist/core/collection.d.ts +48 -0
- package/dist/core/collection.d.ts.map +1 -1
- package/dist/core/element.d.ts +92 -0
- package/dist/core/element.d.ts.map +1 -1
- package/dist/core/env.d.ts +18 -0
- package/dist/core/env.d.ts.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/shared.d.ts +8 -0
- package/dist/core/shared.d.ts.map +1 -1
- package/dist/core/utils/index.d.ts +52 -41
- package/dist/core/utils/index.d.ts.map +1 -1
- package/dist/core-Cjl7GUu8.js +717 -0
- package/dist/core-Cjl7GUu8.js.map +1 -0
- package/dist/core-DnlyjbF2.js +112 -0
- package/dist/core-DnlyjbF2.js.map +1 -0
- package/dist/core.es.mjs +45 -44
- package/dist/custom-directives-7wAShnnd.js +9 -0
- package/dist/custom-directives-7wAShnnd.js.map +1 -0
- package/dist/devtools/devtools.d.ts +212 -0
- package/dist/devtools/devtools.d.ts.map +1 -0
- package/dist/devtools/index.d.ts +20 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/types.d.ts +69 -0
- package/dist/devtools/types.d.ts.map +1 -0
- package/dist/devtools-D2fQLhDN.js +122 -0
- package/dist/devtools-D2fQLhDN.js.map +1 -0
- package/dist/devtools.es.mjs +19 -0
- package/dist/dnd/draggable.d.ts +51 -0
- package/dist/dnd/draggable.d.ts.map +1 -0
- package/dist/dnd/droppable.d.ts +38 -0
- package/dist/dnd/droppable.d.ts.map +1 -0
- package/dist/dnd/index.d.ts +47 -0
- package/dist/dnd/index.d.ts.map +1 -0
- package/dist/dnd/sortable.d.ts +43 -0
- package/dist/dnd/sortable.d.ts.map +1 -0
- package/dist/dnd/types.d.ts +250 -0
- package/dist/dnd/types.d.ts.map +1 -0
- package/dist/dnd-B8EgyzaI.js +244 -0
- package/dist/dnd-B8EgyzaI.js.map +1 -0
- package/dist/dnd.es.mjs +6 -0
- package/dist/env-NeVmr4Gf.js +19 -0
- package/dist/env-NeVmr4Gf.js.map +1 -0
- package/dist/forms/create-form.d.ts +49 -0
- package/dist/forms/create-form.d.ts.map +1 -0
- package/dist/forms/index.d.ts +39 -0
- package/dist/forms/index.d.ts.map +1 -0
- package/dist/forms/types.d.ts +139 -0
- package/dist/forms/types.d.ts.map +1 -0
- package/dist/forms/validators.d.ts +179 -0
- package/dist/forms/validators.d.ts.map +1 -0
- package/dist/forms-C3yovgH9.js +141 -0
- package/dist/forms-C3yovgH9.js.map +1 -0
- package/dist/forms.es.mjs +14 -0
- package/dist/full.d.ts +35 -7
- package/dist/full.d.ts.map +1 -1
- package/dist/full.es.mjs +182 -91
- package/dist/full.iife.js +47 -31
- package/dist/full.iife.js.map +1 -1
- package/dist/full.umd.js +47 -31
- package/dist/full.umd.js.map +1 -1
- package/dist/i18n/formatting.d.ts +40 -0
- package/dist/i18n/formatting.d.ts.map +1 -0
- package/dist/i18n/i18n.d.ts +48 -0
- package/dist/i18n/i18n.d.ts.map +1 -0
- package/dist/i18n/index.d.ts +57 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/translate.d.ts +83 -0
- package/dist/i18n/translate.d.ts.map +1 -0
- package/dist/i18n/types.d.ts +156 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n-BnnhTFOS.js +89 -0
- package/dist/i18n-BnnhTFOS.js.map +1 -0
- package/dist/i18n.es.mjs +6 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.mjs +227 -136
- package/dist/media/battery.d.ts +35 -0
- package/dist/media/battery.d.ts.map +1 -0
- package/dist/media/breakpoints.d.ts +51 -0
- package/dist/media/breakpoints.d.ts.map +1 -0
- package/dist/media/clipboard.d.ts +30 -0
- package/dist/media/clipboard.d.ts.map +1 -0
- package/dist/media/device-sensors.d.ts +54 -0
- package/dist/media/device-sensors.d.ts.map +1 -0
- package/dist/media/geolocation.d.ts +38 -0
- package/dist/media/geolocation.d.ts.map +1 -0
- package/dist/media/index.d.ts +42 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/media-query.d.ts +36 -0
- package/dist/media/media-query.d.ts.map +1 -0
- package/dist/media/network.d.ts +35 -0
- package/dist/media/network.d.ts.map +1 -0
- package/dist/media/types.d.ts +173 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/media/viewport.d.ts +32 -0
- package/dist/media/viewport.d.ts.map +1 -0
- package/dist/media-Di2Ta22s.js +340 -0
- package/dist/media-Di2Ta22s.js.map +1 -0
- package/dist/media.es.mjs +12 -0
- package/dist/motion/index.d.ts +7 -3
- package/dist/motion/index.d.ts.map +1 -1
- package/dist/motion/morph.d.ts +27 -0
- package/dist/motion/morph.d.ts.map +1 -0
- package/dist/motion/parallax.d.ts +30 -0
- package/dist/motion/parallax.d.ts.map +1 -0
- package/dist/motion/reduced-motion.d.ts +36 -3
- package/dist/motion/reduced-motion.d.ts.map +1 -1
- package/dist/motion/types.d.ts +58 -0
- package/dist/motion/types.d.ts.map +1 -1
- package/dist/motion/typewriter.d.ts +31 -0
- package/dist/motion/typewriter.d.ts.map +1 -0
- package/dist/motion-qPj_TYGv.js +530 -0
- package/dist/motion-qPj_TYGv.js.map +1 -0
- package/dist/motion.es.mjs +27 -23
- package/dist/{view-C70lA3vf.js → mount-SM07RUa6.js} +166 -160
- package/dist/mount-SM07RUa6.js.map +1 -0
- package/dist/{object-qGpWr6-J.js → object-BCk-1c8T.js} +5 -4
- package/dist/{object-qGpWr6-J.js.map → object-BCk-1c8T.js.map} +1 -1
- package/dist/{platform-Dr9b6fsq.js → platform-CPbCprb6.js} +21 -22
- package/dist/{platform-Dr9b6fsq.js.map → platform-CPbCprb6.js.map} +1 -1
- package/dist/platform.es.mjs +2 -2
- package/dist/plugin/index.d.ts +22 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/registry.d.ts +108 -0
- package/dist/plugin/registry.d.ts.map +1 -0
- package/dist/plugin/types.d.ts +110 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin-cPoOHFLY.js +64 -0
- package/dist/plugin-cPoOHFLY.js.map +1 -0
- package/dist/plugin.es.mjs +9 -0
- package/dist/reactive/computed.d.ts +7 -0
- package/dist/reactive/computed.d.ts.map +1 -1
- package/dist/reactive-Cfv0RK6x.js +233 -0
- package/dist/reactive-Cfv0RK6x.js.map +1 -0
- package/dist/reactive.es.mjs +19 -20
- package/dist/registry-CWf368tT.js +26 -0
- package/dist/registry-CWf368tT.js.map +1 -0
- package/dist/router/bq-link.d.ts +112 -0
- package/dist/router/bq-link.d.ts.map +1 -0
- package/dist/router/constraints.d.ts +9 -0
- package/dist/router/constraints.d.ts.map +1 -0
- package/dist/router/index.d.ts +14 -6
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/match.d.ts +0 -1
- package/dist/router/match.d.ts.map +1 -1
- package/dist/router/path-pattern.d.ts +14 -0
- package/dist/router/path-pattern.d.ts.map +1 -0
- package/dist/router/query.d.ts.map +1 -1
- package/dist/router/router.d.ts +3 -1
- package/dist/router/router.d.ts.map +1 -1
- package/dist/router/types.d.ts +48 -4
- package/dist/router/types.d.ts.map +1 -1
- package/dist/router/use-route.d.ts +50 -0
- package/dist/router/use-route.d.ts.map +1 -0
- package/dist/router/utils.d.ts +3 -0
- package/dist/router/utils.d.ts.map +1 -1
- package/dist/router-BrthaP_z.js +473 -0
- package/dist/router-BrthaP_z.js.map +1 -0
- package/dist/router.es.mjs +13 -10
- package/dist/{sanitize-Bs2dkMby.js → sanitize-B1V4JswB.js} +2 -1
- package/dist/{sanitize-Bs2dkMby.js.map → sanitize-B1V4JswB.js.map} +1 -1
- package/dist/security/index.d.ts +2 -2
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security.es.mjs +1 -1
- package/dist/ssr/hydrate.d.ts +65 -0
- package/dist/ssr/hydrate.d.ts.map +1 -0
- package/dist/ssr/index.d.ts +59 -0
- package/dist/ssr/index.d.ts.map +1 -0
- package/dist/ssr/render.d.ts +62 -0
- package/dist/ssr/render.d.ts.map +1 -0
- package/dist/ssr/serialize.d.ts +118 -0
- package/dist/ssr/serialize.d.ts.map +1 -0
- package/dist/ssr/types.d.ts +70 -0
- package/dist/ssr/types.d.ts.map +1 -0
- package/dist/ssr-B2qd_WBB.js +248 -0
- package/dist/ssr-B2qd_WBB.js.map +1 -0
- package/dist/ssr.es.mjs +9 -0
- package/dist/store/create-store.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/persisted.d.ts +38 -4
- package/dist/store/persisted.d.ts.map +1 -1
- package/dist/store/types.d.ts +138 -1
- package/dist/store/types.d.ts.map +1 -1
- package/dist/store/utils.d.ts +2 -2
- package/dist/store/utils.d.ts.map +1 -1
- package/dist/store-DWpyH6p5.js +338 -0
- package/dist/store-DWpyH6p5.js.map +1 -0
- package/dist/store.es.mjs +11 -10
- package/dist/storybook/index.d.ts.map +1 -1
- package/dist/storybook.es.mjs +1 -1
- package/dist/storybook.es.mjs.map +1 -1
- package/dist/testing/index.d.ts +23 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/testing.d.ts +156 -0
- package/dist/testing/testing.d.ts.map +1 -0
- package/dist/testing/types.d.ts +134 -0
- package/dist/testing/types.d.ts.map +1 -0
- package/dist/testing-CsqjNUyy.js +224 -0
- package/dist/testing-CsqjNUyy.js.map +1 -0
- package/dist/testing.es.mjs +9 -0
- package/dist/type-guards-Do9DWgNp.js +44 -0
- package/dist/type-guards-Do9DWgNp.js.map +1 -0
- package/dist/untrack-DJVQQ2WM.js +33 -0
- package/dist/untrack-DJVQQ2WM.js.map +1 -0
- package/dist/view/custom-directives.d.ts +20 -0
- package/dist/view/custom-directives.d.ts.map +1 -0
- package/dist/view/evaluate.d.ts.map +1 -1
- package/dist/view/process.d.ts.map +1 -1
- package/dist/view.es.mjs +9 -9
- package/package.json +177 -141
- package/src/a11y/announce.ts +131 -0
- package/src/a11y/audit.ts +314 -0
- package/src/a11y/index.ts +68 -0
- package/src/a11y/media-preferences.ts +255 -0
- package/src/a11y/roving-tab-index.ts +164 -0
- package/src/a11y/skip-link.ts +255 -0
- package/src/a11y/trap-focus.ts +184 -0
- package/src/a11y/types.ts +183 -0
- package/src/component/component.ts +104 -29
- package/src/component/html.ts +5 -5
- package/src/component/index.ts +2 -0
- package/src/component/library.ts +26 -2
- package/src/component/scope.ts +212 -0
- package/src/component/types.ts +94 -40
- package/src/core/collection.ts +707 -628
- package/src/core/element.ts +981 -774
- package/src/core/env.ts +60 -0
- package/src/core/index.ts +49 -48
- package/src/core/shared.ts +62 -13
- package/src/core/utils/index.ts +148 -83
- package/src/devtools/devtools.ts +410 -0
- package/src/devtools/index.ts +48 -0
- package/src/devtools/types.ts +104 -0
- package/src/dnd/draggable.ts +296 -0
- package/src/dnd/droppable.ts +228 -0
- package/src/dnd/index.ts +62 -0
- package/src/dnd/sortable.ts +307 -0
- package/src/dnd/types.ts +293 -0
- package/src/forms/create-form.ts +278 -0
- package/src/forms/index.ts +65 -0
- package/src/forms/types.ts +154 -0
- package/src/forms/validators.ts +265 -0
- package/src/full.ts +253 -2
- package/src/i18n/formatting.ts +67 -0
- package/src/i18n/i18n.ts +200 -0
- package/src/i18n/index.ts +67 -0
- package/src/i18n/translate.ts +182 -0
- package/src/i18n/types.ts +171 -0
- package/src/index.ts +108 -36
- package/src/media/battery.ts +116 -0
- package/src/media/breakpoints.ts +131 -0
- package/src/media/clipboard.ts +80 -0
- package/src/media/device-sensors.ts +158 -0
- package/src/media/geolocation.ts +119 -0
- package/src/media/index.ts +76 -0
- package/src/media/media-query.ts +92 -0
- package/src/media/network.ts +115 -0
- package/src/media/types.ts +177 -0
- package/src/media/viewport.ts +84 -0
- package/src/motion/index.ts +57 -48
- package/src/motion/morph.ts +151 -0
- package/src/motion/parallax.ts +120 -0
- package/src/motion/reduced-motion.ts +66 -17
- package/src/motion/types.ts +271 -208
- package/src/motion/typewriter.ts +164 -0
- package/src/plugin/index.ts +37 -0
- package/src/plugin/registry.ts +269 -0
- package/src/plugin/types.ts +137 -0
- package/src/reactive/computed.ts +130 -92
- package/src/router/bq-link.ts +279 -0
- package/src/router/constraints.ts +201 -0
- package/src/router/index.ts +49 -41
- package/src/router/match.ts +312 -106
- package/src/router/path-pattern.ts +52 -0
- package/src/router/query.ts +38 -35
- package/src/router/router.ts +402 -211
- package/src/router/types.ts +139 -93
- package/src/router/use-route.ts +68 -0
- package/src/router/utils.ts +157 -116
- package/src/security/index.ts +2 -7
- package/src/security/sanitize.ts +70 -70
- package/src/security/trusted-html.ts +71 -71
- package/src/ssr/hydrate.ts +82 -0
- package/src/ssr/index.ts +70 -0
- package/src/ssr/render.ts +508 -0
- package/src/ssr/serialize.ts +296 -0
- package/src/ssr/types.ts +81 -0
- package/src/store/create-store.ts +467 -329
- package/src/store/define-store.ts +49 -49
- package/src/store/index.ts +27 -22
- package/src/store/mapping.ts +74 -74
- package/src/store/persisted.ts +206 -19
- package/src/store/types.ts +157 -2
- package/src/store/utils.ts +135 -141
- package/src/store/watch.ts +53 -53
- package/src/storybook/index.ts +2 -1
- package/src/testing/index.ts +42 -0
- package/src/testing/testing.ts +593 -0
- package/src/testing/types.ts +170 -0
- package/src/view/custom-directives.ts +30 -0
- package/src/view/evaluate.ts +292 -290
- package/src/view/process.ts +108 -92
- package/dist/component-BEQgt5hl.js +0 -600
- package/dist/component-BEQgt5hl.js.map +0 -1
- package/dist/core-BGQJVw0-.js +0 -35
- package/dist/core-BGQJVw0-.js.map +0 -1
- package/dist/core-CCEabVHl.js +0 -648
- package/dist/core-CCEabVHl.js.map +0 -1
- package/dist/effect-AFRW_Plg.js +0 -84
- package/dist/effect-AFRW_Plg.js.map +0 -1
- package/dist/motion-D9TcHxOF.js +0 -415
- package/dist/motion-D9TcHxOF.js.map +0 -1
- package/dist/reactive-DSkct0dO.js +0 -254
- package/dist/reactive-DSkct0dO.js.map +0 -1
- package/dist/router-CbDhl8rS.js +0 -188
- package/dist/router-CbDhl8rS.js.map +0 -1
- package/dist/store-BwDvI45q.js +0 -263
- package/dist/store-BwDvI45q.js.map +0 -1
- package/dist/untrack-B0rVscTc.js +0 -7
- package/dist/untrack-B0rVscTc.js.map +0 -1
- package/dist/view-C70lA3vf.js.map +0 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Screen reader announcement utility using ARIA live regions.
|
|
3
|
+
*
|
|
4
|
+
* Creates and manages off-screen live regions to announce dynamic
|
|
5
|
+
* content changes to assistive technologies.
|
|
6
|
+
*
|
|
7
|
+
* @module bquery/a11y
|
|
8
|
+
*/
|
|
9
|
+
import type { AnnouncePriority } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Announces a message to screen readers via an ARIA live region.
|
|
12
|
+
*
|
|
13
|
+
* The message is injected into a visually-hidden live region element.
|
|
14
|
+
* Screen readers will pick up the change and announce it to the user.
|
|
15
|
+
*
|
|
16
|
+
* @param message - The text message to announce
|
|
17
|
+
* @param priority - The urgency level: `'polite'` (default) or `'assertive'`
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { announceToScreenReader } from '@bquery/bquery/a11y';
|
|
22
|
+
*
|
|
23
|
+
* // Polite announcement (waits for idle)
|
|
24
|
+
* announceToScreenReader('3 search results found');
|
|
25
|
+
*
|
|
26
|
+
* // Assertive announcement (interrupts current speech)
|
|
27
|
+
* announceToScreenReader('Error: Please fix the form', 'assertive');
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const announceToScreenReader: (message: string, priority?: AnnouncePriority) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Removes all live region elements created by `announceToScreenReader`.
|
|
33
|
+
* Useful for cleanup in tests or when unmounting an application.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* import { clearAnnouncements } from '@bquery/bquery/a11y';
|
|
38
|
+
*
|
|
39
|
+
* clearAnnouncements();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare const clearAnnouncements: () => void;
|
|
43
|
+
//# sourceMappingURL=announce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"announce.d.ts","sourceRoot":"","sources":["../../src/a11y/announce.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAoDhD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,MAAM,EACf,WAAU,gBAA2B,KACpC,IAuBF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,QAAO,IAUrC,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development-time accessibility audit utility.
|
|
3
|
+
*
|
|
4
|
+
* Scans DOM elements for common accessibility issues such as missing
|
|
5
|
+
* alt text on images, missing labels on form inputs, empty links/buttons,
|
|
6
|
+
* and incorrect ARIA usage.
|
|
7
|
+
*
|
|
8
|
+
* @module bquery/a11y
|
|
9
|
+
*/
|
|
10
|
+
import type { AuditResult } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Runs a development-time accessibility audit on a container element.
|
|
13
|
+
*
|
|
14
|
+
* Checks for common accessibility issues including:
|
|
15
|
+
* - Missing alt text on images
|
|
16
|
+
* - Missing labels on form inputs
|
|
17
|
+
* - Empty buttons and links
|
|
18
|
+
* - Heading hierarchy issues
|
|
19
|
+
* - Invalid ARIA references
|
|
20
|
+
* - Missing document landmarks
|
|
21
|
+
*
|
|
22
|
+
* This is intended as a development tool — not a replacement for
|
|
23
|
+
* manual testing or professional accessibility audits.
|
|
24
|
+
*
|
|
25
|
+
* @param container - The element to audit (defaults to `document.body`)
|
|
26
|
+
* @returns An audit result with findings, counts, and pass/fail status
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* import { auditA11y } from '@bquery/bquery/a11y';
|
|
31
|
+
*
|
|
32
|
+
* const result = auditA11y();
|
|
33
|
+
* if (!result.passed) {
|
|
34
|
+
* console.warn(`Found ${result.errors} accessibility errors:`);
|
|
35
|
+
* for (const f of result.findings) {
|
|
36
|
+
* console.warn(`[${f.severity}] ${f.message}`, f.element);
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const auditA11y: (container?: Element) => AuditResult;
|
|
42
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/a11y/audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAgB,WAAW,EAAiB,MAAM,SAAS,CAAC;AAmPxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,SAAS,GAAI,YAAY,OAAO,KAAG,WA8B/C,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accessibility (a11y) utilities module for bQuery.js.
|
|
3
|
+
*
|
|
4
|
+
* Provides essential accessibility helpers for building inclusive
|
|
5
|
+
* web applications: focus trapping, screen reader announcements,
|
|
6
|
+
* keyboard navigation patterns, skip navigation, media preference
|
|
7
|
+
* signals, and development-time auditing.
|
|
8
|
+
*
|
|
9
|
+
* @module bquery/a11y
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* import {
|
|
14
|
+
* trapFocus,
|
|
15
|
+
* announceToScreenReader,
|
|
16
|
+
* rovingTabIndex,
|
|
17
|
+
* skipLink,
|
|
18
|
+
* prefersReducedMotion,
|
|
19
|
+
* prefersColorScheme,
|
|
20
|
+
* auditA11y,
|
|
21
|
+
* } from '@bquery/bquery/a11y';
|
|
22
|
+
*
|
|
23
|
+
* // Trap focus in a modal
|
|
24
|
+
* const trap = trapFocus(dialogElement);
|
|
25
|
+
*
|
|
26
|
+
* // Announce changes to screen readers
|
|
27
|
+
* announceToScreenReader('Form submitted successfully');
|
|
28
|
+
*
|
|
29
|
+
* // Arrow key navigation in a toolbar
|
|
30
|
+
* const roving = rovingTabIndex(toolbar, 'button', {
|
|
31
|
+
* orientation: 'horizontal',
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* // Auto-generate skip navigation
|
|
35
|
+
* const skip = skipLink('#main-content');
|
|
36
|
+
*
|
|
37
|
+
* // Reactive media preferences
|
|
38
|
+
* const reduced = prefersReducedMotion();
|
|
39
|
+
* const scheme = prefersColorScheme();
|
|
40
|
+
*
|
|
41
|
+
* // Development-time audit
|
|
42
|
+
* const result = auditA11y();
|
|
43
|
+
* if (!result.passed) console.warn(result.findings);
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export { announceToScreenReader, clearAnnouncements } from './announce';
|
|
47
|
+
export { auditA11y } from './audit';
|
|
48
|
+
export { prefersColorScheme, prefersContrast, prefersReducedMotion } from './media-preferences';
|
|
49
|
+
export { rovingTabIndex } from './roving-tab-index';
|
|
50
|
+
export { skipLink } from './skip-link';
|
|
51
|
+
export { getFocusableElements, releaseFocus, trapFocus } from './trap-focus';
|
|
52
|
+
export type { AnnouncePriority, AuditFinding, AuditResult, AuditSeverity, ColorScheme, ContrastPreference, FocusTrapHandle, MediaPreferenceSignal, RovingTabIndexHandle, RovingTabIndexOptions, SkipLinkHandle, SkipLinkOptions, TrapFocusOptions, } from './types';
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/a11y/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7E,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactive media preference signals for accessibility.
|
|
3
|
+
*
|
|
4
|
+
* Provides reactive signals that track the user's system-level
|
|
5
|
+
* accessibility preferences (reduced motion, color scheme, contrast).
|
|
6
|
+
*
|
|
7
|
+
* @module bquery/a11y
|
|
8
|
+
*/
|
|
9
|
+
import type { ColorScheme, ContrastPreference, MediaPreferenceSignal } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Returns a reactive signal indicating whether the user prefers reduced motion.
|
|
12
|
+
*
|
|
13
|
+
* Tracks the `(prefers-reduced-motion: reduce)` media query. Returns `true`
|
|
14
|
+
* when the user has requested reduced motion in their system settings.
|
|
15
|
+
*
|
|
16
|
+
* @returns A readonly reactive signal handle. Call `destroy()` to remove listeners.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { prefersReducedMotion } from '@bquery/bquery/a11y';
|
|
21
|
+
* import { effect } from '@bquery/bquery/reactive';
|
|
22
|
+
*
|
|
23
|
+
* const reduced = prefersReducedMotion();
|
|
24
|
+
* effect(() => {
|
|
25
|
+
* if (reduced.value) {
|
|
26
|
+
* console.log('User prefers reduced motion');
|
|
27
|
+
* }
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare const prefersReducedMotion: () => MediaPreferenceSignal<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Returns a reactive signal tracking the user's preferred color scheme.
|
|
34
|
+
*
|
|
35
|
+
* Tracks the `(prefers-color-scheme: dark)` media query. Returns `'dark'`
|
|
36
|
+
* when the user prefers a dark color scheme, `'light'` otherwise.
|
|
37
|
+
*
|
|
38
|
+
* @returns A readonly reactive signal handle with `'light'` or `'dark'`
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { prefersColorScheme } from '@bquery/bquery/a11y';
|
|
43
|
+
* import { effect } from '@bquery/bquery/reactive';
|
|
44
|
+
*
|
|
45
|
+
* const scheme = prefersColorScheme();
|
|
46
|
+
* effect(() => {
|
|
47
|
+
* document.body.dataset.theme = scheme.value;
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const prefersColorScheme: () => MediaPreferenceSignal<ColorScheme>;
|
|
52
|
+
/**
|
|
53
|
+
* Returns a reactive signal tracking the user's contrast preference.
|
|
54
|
+
*
|
|
55
|
+
* Tracks the `(prefers-contrast)` media query. Returns:
|
|
56
|
+
* - `'more'` — user prefers higher contrast
|
|
57
|
+
* - `'less'` — user prefers lower contrast
|
|
58
|
+
* - `'custom'` — user has set a custom contrast level
|
|
59
|
+
* - `'no-preference'` — no explicit preference
|
|
60
|
+
*
|
|
61
|
+
* @returns A readonly reactive signal handle
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* import { prefersContrast } from '@bquery/bquery/a11y';
|
|
66
|
+
* import { effect } from '@bquery/bquery/reactive';
|
|
67
|
+
*
|
|
68
|
+
* const contrast = prefersContrast();
|
|
69
|
+
* effect(() => {
|
|
70
|
+
* if (contrast.value === 'more') {
|
|
71
|
+
* document.body.classList.add('high-contrast');
|
|
72
|
+
* }
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare const prefersContrast: () => MediaPreferenceSignal<ContrastPreference>;
|
|
77
|
+
//# sourceMappingURL=media-preferences.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-preferences.d.ts","sourceRoot":"","sources":["../../src/a11y/media-preferences.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAyFtF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,QAAO,qBAAqB,CAAC,OAAO,CAEpE,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,kBAAkB,QAAO,qBAAqB,CAAC,WAAW,CA4BtE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,eAAe,QAAO,qBAAqB,CAAC,kBAAkB,CAyD1E,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Roving tab index utility for arrow-key navigation within groups.
|
|
3
|
+
*
|
|
4
|
+
* Implements the WAI-ARIA roving tabindex pattern: only one item
|
|
5
|
+
* in the group has tabindex="0" (the active item), while all others
|
|
6
|
+
* have tabindex="-1". Arrow keys move focus between items.
|
|
7
|
+
*
|
|
8
|
+
* @module bquery/a11y
|
|
9
|
+
*/
|
|
10
|
+
import type { RovingTabIndexHandle, RovingTabIndexOptions } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Sets up roving tab index navigation for a group of elements.
|
|
13
|
+
*
|
|
14
|
+
* Only the active item receives `tabindex="0"`, making it the only
|
|
15
|
+
* tabbable element in the group. Arrow keys move focus between items,
|
|
16
|
+
* and Home/End jump to the first/last item.
|
|
17
|
+
*
|
|
18
|
+
* @param container - The parent element containing the navigable items
|
|
19
|
+
* @param itemSelector - CSS selector for the navigable items within the container
|
|
20
|
+
* @param options - Configuration options
|
|
21
|
+
* @returns A handle with `destroy()`, `focusItem()`, and `activeIndex()`
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { rovingTabIndex } from '@bquery/bquery/a11y';
|
|
26
|
+
*
|
|
27
|
+
* const toolbar = document.querySelector('[role="toolbar"]');
|
|
28
|
+
* const handle = rovingTabIndex(toolbar, 'button', {
|
|
29
|
+
* orientation: 'horizontal',
|
|
30
|
+
* wrap: true,
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Later, clean up
|
|
34
|
+
* handle.destroy();
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const rovingTabIndex: (container: HTMLElement, itemSelector: string, options?: RovingTabIndexOptions) => RovingTabIndexHandle;
|
|
38
|
+
//# sourceMappingURL=roving-tab-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roving-tab-index.d.ts","sourceRoot":"","sources":["../../src/a11y/roving-tab-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAE3E;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,cAAc,GACzB,WAAW,WAAW,EACtB,cAAc,MAAM,EACpB,UAAS,qBAA0B,KAClC,oBAyHF,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated skip navigation link utility.
|
|
3
|
+
*
|
|
4
|
+
* Creates a visually-hidden (but keyboard-focusable) "Skip to content"
|
|
5
|
+
* link that becomes visible on focus, letting keyboard users bypass
|
|
6
|
+
* repeated navigation.
|
|
7
|
+
*
|
|
8
|
+
* @module bquery/a11y
|
|
9
|
+
*/
|
|
10
|
+
import type { SkipLinkHandle, SkipLinkOptions } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Creates a skip navigation link that jumps to the specified target.
|
|
13
|
+
*
|
|
14
|
+
* The link is visually hidden by default and becomes visible when
|
|
15
|
+
* it receives keyboard focus. This follows the WCAG 2.4.1 "Bypass Blocks"
|
|
16
|
+
* success criterion.
|
|
17
|
+
*
|
|
18
|
+
* @param targetSelector - CSS selector for the main content area (e.g. `'#main'`, `'main'`)
|
|
19
|
+
* @param options - Configuration options
|
|
20
|
+
* @returns A handle with `destroy()` method and reference to the created element
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* import { skipLink } from '@bquery/bquery/a11y';
|
|
25
|
+
*
|
|
26
|
+
* // Creates a "Skip to main content" link pointing to <main>
|
|
27
|
+
* const handle = skipLink('#main-content');
|
|
28
|
+
*
|
|
29
|
+
* // Custom text
|
|
30
|
+
* const handle2 = skipLink('#content', { text: 'Jump to content' });
|
|
31
|
+
*
|
|
32
|
+
* // Remove when no longer needed
|
|
33
|
+
* handle.destroy();
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const skipLink: (targetSelector: string, options?: SkipLinkOptions) => SkipLinkHandle;
|
|
37
|
+
//# sourceMappingURL=skip-link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip-link.d.ts","sourceRoot":"","sources":["../../src/a11y/skip-link.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA6C/D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,QAAQ,GAAI,gBAAgB,MAAM,EAAE,UAAS,eAAoB,KAAG,cA8KhF,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus trapping utility for modals, dialogs, and popover content.
|
|
3
|
+
*
|
|
4
|
+
* Constrains keyboard focus within a container so that Tab and Shift+Tab
|
|
5
|
+
* cycle only through the container's focusable elements.
|
|
6
|
+
*
|
|
7
|
+
* @module bquery/a11y
|
|
8
|
+
*/
|
|
9
|
+
import type { FocusTrapHandle, TrapFocusOptions } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Gets all focusable elements within a container.
|
|
12
|
+
*
|
|
13
|
+
* @param container - The container element
|
|
14
|
+
* @returns Array of focusable elements
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const getFocusableElements: (container: Element) => HTMLElement[];
|
|
18
|
+
/**
|
|
19
|
+
* Traps keyboard focus within a container element.
|
|
20
|
+
*
|
|
21
|
+
* When activated, Tab and Shift+Tab will cycle only through focusable
|
|
22
|
+
* elements within the container. Useful for modals, dialogs, and
|
|
23
|
+
* dropdown menus.
|
|
24
|
+
*
|
|
25
|
+
* @param container - The DOM element to trap focus within
|
|
26
|
+
* @param options - Configuration options
|
|
27
|
+
* @returns A handle with a `release()` method to deactivate the trap
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { trapFocus } from '@bquery/bquery/a11y';
|
|
32
|
+
*
|
|
33
|
+
* const dialog = document.querySelector('#my-dialog');
|
|
34
|
+
* const trap = trapFocus(dialog, { escapeDeactivates: true });
|
|
35
|
+
*
|
|
36
|
+
* // Later, release the trap
|
|
37
|
+
* trap.release();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare const trapFocus: (container: HTMLElement, options?: TrapFocusOptions) => FocusTrapHandle;
|
|
41
|
+
/**
|
|
42
|
+
* Releases a focus trap handle.
|
|
43
|
+
* This is a convenience function — in most cases, use the `release()`
|
|
44
|
+
* method on the individual trap handle directly.
|
|
45
|
+
*
|
|
46
|
+
* @deprecated Prefer using the handle returned by `trapFocus()` directly.
|
|
47
|
+
*/
|
|
48
|
+
export declare const releaseFocus: (handle: FocusTrapHandle) => void;
|
|
49
|
+
//# sourceMappingURL=trap-focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trap-focus.d.ts","sourceRoot":"","sources":["../../src/a11y/trap-focus.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgBjE;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,WAAW,OAAO,KAAG,WAAW,EAKpE,CAAC;AAiBF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,SAAS,GACpB,WAAW,WAAW,EACtB,UAAS,gBAAqB,KAC7B,eA6FF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,eAAe,KAAG,IAEtD,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for the bQuery accessibility (a11y) module.
|
|
3
|
+
*
|
|
4
|
+
* @module bquery/a11y
|
|
5
|
+
*/
|
|
6
|
+
import type { ReadonlySignal } from '../reactive/index';
|
|
7
|
+
/**
|
|
8
|
+
* Options for configuring focus trapping behavior.
|
|
9
|
+
*/
|
|
10
|
+
export interface TrapFocusOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Element to receive initial focus when the trap activates.
|
|
13
|
+
* If not provided, the first focusable element is focused.
|
|
14
|
+
*/
|
|
15
|
+
initialFocus?: HTMLElement | string;
|
|
16
|
+
/**
|
|
17
|
+
* Element to receive focus when the trap is released.
|
|
18
|
+
* If not provided, focus returns to the element that was focused
|
|
19
|
+
* before the trap was activated.
|
|
20
|
+
*/
|
|
21
|
+
returnFocus?: HTMLElement | string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether pressing Escape releases the focus trap.
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
escapeDeactivates?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Callback invoked when the trap is deactivated via Escape.
|
|
29
|
+
*/
|
|
30
|
+
onEscape?: () => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Handle returned by `trapFocus()` for managing the focus trap lifecycle.
|
|
34
|
+
*/
|
|
35
|
+
export interface FocusTrapHandle {
|
|
36
|
+
/** Release the focus trap, restoring focus to the previous element. */
|
|
37
|
+
release: () => void;
|
|
38
|
+
/** Whether the trap is currently active. */
|
|
39
|
+
active: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Priority level for screen reader announcements.
|
|
43
|
+
* - `'polite'` — announced when the user is idle (default)
|
|
44
|
+
* - `'assertive'` — announced immediately, interrupting current speech
|
|
45
|
+
*/
|
|
46
|
+
export type AnnouncePriority = 'polite' | 'assertive';
|
|
47
|
+
/**
|
|
48
|
+
* Options for configuring roving tab index behavior.
|
|
49
|
+
*/
|
|
50
|
+
export interface RovingTabIndexOptions {
|
|
51
|
+
/**
|
|
52
|
+
* Whether navigation wraps around from last to first (and vice versa).
|
|
53
|
+
* @default true
|
|
54
|
+
*/
|
|
55
|
+
wrap?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Orientation of the group — determines which arrow keys are used.
|
|
58
|
+
* - `'horizontal'` — Left/Right arrows
|
|
59
|
+
* - `'vertical'` — Up/Down arrows
|
|
60
|
+
* - `'both'` — All arrow keys
|
|
61
|
+
* @default 'vertical'
|
|
62
|
+
*/
|
|
63
|
+
orientation?: 'horizontal' | 'vertical' | 'both';
|
|
64
|
+
/**
|
|
65
|
+
* Callback fired when the active item changes.
|
|
66
|
+
*/
|
|
67
|
+
onActivate?: (element: Element, index: number) => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Handle returned by `rovingTabIndex()` for cleanup.
|
|
71
|
+
*/
|
|
72
|
+
export interface RovingTabIndexHandle {
|
|
73
|
+
/** Remove event listeners and restore original tabindex values. */
|
|
74
|
+
destroy: () => void;
|
|
75
|
+
/** Programmatically focus a specific item by index. */
|
|
76
|
+
focusItem: (index: number) => void;
|
|
77
|
+
/** Get the currently active index. */
|
|
78
|
+
activeIndex: () => number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Options for configuring auto-generated skip navigation.
|
|
82
|
+
*/
|
|
83
|
+
export interface SkipLinkOptions {
|
|
84
|
+
/**
|
|
85
|
+
* Text content of the skip link.
|
|
86
|
+
* @default 'Skip to main content'
|
|
87
|
+
*/
|
|
88
|
+
text?: string;
|
|
89
|
+
/**
|
|
90
|
+
* CSS class applied to the skip link element.
|
|
91
|
+
* @default 'bq-skip-link'
|
|
92
|
+
*/
|
|
93
|
+
className?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Handle returned by `skipLink()` for cleanup.
|
|
97
|
+
*/
|
|
98
|
+
export interface SkipLinkHandle {
|
|
99
|
+
/** Remove the skip link from the DOM. */
|
|
100
|
+
destroy: () => void;
|
|
101
|
+
/**
|
|
102
|
+
* The created skip link element, or `null` when `skipLink()` is called in a
|
|
103
|
+
* non-DOM environment and returns a no-op handle.
|
|
104
|
+
*/
|
|
105
|
+
element: HTMLAnchorElement | null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Color scheme preference value.
|
|
109
|
+
*/
|
|
110
|
+
export type ColorScheme = 'light' | 'dark';
|
|
111
|
+
/**
|
|
112
|
+
* Contrast preference value.
|
|
113
|
+
*/
|
|
114
|
+
export type ContrastPreference = 'no-preference' | 'more' | 'less' | 'custom';
|
|
115
|
+
/**
|
|
116
|
+
* Readonly media preference signal with an explicit cleanup hook.
|
|
117
|
+
*/
|
|
118
|
+
export interface MediaPreferenceSignal<T> extends ReadonlySignal<T> {
|
|
119
|
+
/** Releases underlying media-query listeners. Safe to call multiple times. */
|
|
120
|
+
destroy(): void;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Severity level for audit findings.
|
|
124
|
+
*/
|
|
125
|
+
export type AuditSeverity = 'error' | 'warning' | 'info';
|
|
126
|
+
/**
|
|
127
|
+
* A single accessibility audit finding.
|
|
128
|
+
*/
|
|
129
|
+
export interface AuditFinding {
|
|
130
|
+
/** Severity level of the finding. */
|
|
131
|
+
severity: AuditSeverity;
|
|
132
|
+
/** Human-readable description of the issue. */
|
|
133
|
+
message: string;
|
|
134
|
+
/** The DOM element with the issue. */
|
|
135
|
+
element: Element;
|
|
136
|
+
/** The audit rule that triggered this finding. */
|
|
137
|
+
rule: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Result of an accessibility audit.
|
|
141
|
+
*/
|
|
142
|
+
export interface AuditResult {
|
|
143
|
+
/** All findings from the audit. */
|
|
144
|
+
findings: AuditFinding[];
|
|
145
|
+
/** Number of errors found. */
|
|
146
|
+
errors: number;
|
|
147
|
+
/** Number of warnings found. */
|
|
148
|
+
warnings: number;
|
|
149
|
+
/** Whether the audit passed (no errors). */
|
|
150
|
+
passed: boolean;
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/a11y/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIxD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAEpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IAEnC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;CACjB;AAID;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAItD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAAC;IAEjD;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,mEAAmE;IACnE,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,uDAAuD;IACvD,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,sCAAsC;IACtC,WAAW,EAAE,MAAM,MAAM,CAAC;CAC3B;AAID;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAC;CACnC;AAID;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE9E;;GAEG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IACjE,8EAA8E;IAC9E,OAAO,IAAI,IAAI,CAAC;CACjB;AAID;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IACrC,QAAQ,EAAE,aAAa,CAAC;IACxB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mCAAmC;IACnC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;CACjB"}
|