accented 0.0.0-20250404114312 → 0.0.0-20250618181418
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 +0 -207
- package/dist/accented.d.ts +2 -2
- package/dist/accented.d.ts.map +1 -1
- package/dist/accented.js +29 -23
- package/dist/accented.js.map +1 -1
- package/dist/common/tokens.d.ts +2 -0
- package/dist/common/tokens.d.ts.map +1 -0
- package/dist/common/tokens.js +2 -0
- package/dist/common/tokens.js.map +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/dom-updater.d.ts +1 -1
- package/dist/dom-updater.d.ts.map +1 -1
- package/dist/dom-updater.js +43 -16
- package/dist/dom-updater.js.map +1 -1
- package/dist/elements/accented-dialog.d.ts +13 -10
- package/dist/elements/accented-dialog.d.ts.map +1 -1
- package/dist/elements/accented-dialog.js +46 -69
- package/dist/elements/accented-dialog.js.map +1 -1
- package/dist/elements/accented-trigger.d.ts +12 -9
- package/dist/elements/accented-trigger.d.ts.map +1 -1
- package/dist/elements/accented-trigger.js +14 -15
- package/dist/elements/accented-trigger.js.map +1 -1
- package/dist/fullscreen-listener.d.ts +1 -1
- package/dist/fullscreen-listener.d.ts.map +1 -1
- package/dist/fullscreen-listener.js +3 -4
- package/dist/fullscreen-listener.js.map +1 -1
- package/dist/intersection-observer.d.ts +1 -1
- package/dist/intersection-observer.d.ts.map +1 -1
- package/dist/intersection-observer.js +12 -6
- package/dist/intersection-observer.js.map +1 -1
- package/dist/log-and-rethrow.d.ts +1 -1
- package/dist/log-and-rethrow.d.ts.map +1 -1
- package/dist/log-and-rethrow.js +2 -3
- package/dist/log-and-rethrow.js.map +1 -1
- package/dist/logger.d.ts +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +6 -3
- package/dist/logger.js.map +1 -1
- package/dist/register-elements.d.ts +1 -1
- package/dist/register-elements.d.ts.map +1 -1
- package/dist/register-elements.js +6 -7
- package/dist/register-elements.js.map +1 -1
- package/dist/resize-listener.d.ts +1 -1
- package/dist/resize-listener.d.ts.map +1 -1
- package/dist/resize-listener.js +3 -4
- package/dist/resize-listener.js.map +1 -1
- package/dist/scanner.d.ts +2 -2
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +39 -36
- package/dist/scanner.js.map +1 -1
- package/dist/scroll-listeners.d.ts +1 -1
- package/dist/scroll-listeners.d.ts.map +1 -1
- package/dist/scroll-listeners.js +3 -4
- package/dist/scroll-listeners.js.map +1 -1
- package/dist/state.d.ts +1 -1
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +4 -5
- package/dist/state.js.map +1 -1
- package/dist/task-queue.d.ts +4 -4
- package/dist/task-queue.d.ts.map +1 -1
- package/dist/task-queue.js +3 -2
- package/dist/task-queue.js.map +1 -1
- package/dist/types.d.ts +28 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/are-elements-with-issues-equal.d.ts +2 -2
- package/dist/utils/are-elements-with-issues-equal.d.ts.map +1 -1
- package/dist/utils/are-elements-with-issues-equal.js +3 -3
- package/dist/utils/are-elements-with-issues-equal.js.map +1 -1
- package/dist/utils/are-issue-sets-equal.d.ts +2 -2
- package/dist/utils/are-issue-sets-equal.d.ts.map +1 -1
- package/dist/utils/are-issue-sets-equal.js +3 -3
- package/dist/utils/are-issue-sets-equal.js.map +1 -1
- package/dist/utils/containing-blocks.d.ts +3 -0
- package/dist/utils/containing-blocks.d.ts.map +1 -0
- package/dist/utils/containing-blocks.js +46 -0
- package/dist/utils/containing-blocks.js.map +1 -0
- package/dist/utils/contains.d.ts +2 -0
- package/dist/utils/contains.d.ts.map +1 -0
- package/dist/utils/contains.js +19 -0
- package/dist/utils/contains.js.map +1 -0
- package/dist/utils/deduplicate-nodes.d.ts +2 -0
- package/dist/utils/deduplicate-nodes.d.ts.map +1 -0
- package/dist/utils/deduplicate-nodes.js +4 -0
- package/dist/utils/deduplicate-nodes.js.map +1 -0
- package/dist/utils/deep-merge.d.ts +1 -1
- package/dist/utils/deep-merge.d.ts.map +1 -1
- package/dist/utils/deep-merge.js +6 -5
- package/dist/utils/deep-merge.js.map +1 -1
- package/dist/utils/dom-helpers.d.ts +3 -0
- package/dist/utils/dom-helpers.d.ts.map +1 -1
- package/dist/utils/dom-helpers.js +15 -0
- package/dist/utils/dom-helpers.js.map +1 -1
- package/dist/utils/ensure-non-empty.d.ts +2 -0
- package/dist/utils/ensure-non-empty.d.ts.map +1 -0
- package/dist/utils/ensure-non-empty.js +7 -0
- package/dist/utils/ensure-non-empty.js.map +1 -0
- package/dist/utils/get-element-html.d.ts +1 -1
- package/dist/utils/get-element-html.d.ts.map +1 -1
- package/dist/utils/get-element-html.js +4 -2
- package/dist/utils/get-element-html.js.map +1 -1
- package/dist/utils/get-element-position.d.ts +10 -2
- package/dist/utils/get-element-position.d.ts.map +1 -1
- package/dist/utils/get-element-position.js +34 -23
- package/dist/utils/get-element-position.js.map +1 -1
- package/dist/utils/get-parent.d.ts +1 -1
- package/dist/utils/get-parent.d.ts.map +1 -1
- package/dist/utils/get-parent.js +1 -1
- package/dist/utils/get-parent.js.map +1 -1
- package/dist/utils/get-scan-context.d.ts +3 -0
- package/dist/utils/get-scan-context.d.ts.map +1 -0
- package/dist/utils/get-scan-context.js +28 -0
- package/dist/utils/get-scan-context.js.map +1 -0
- package/dist/utils/get-scrollable-ancestors.d.ts +1 -1
- package/dist/utils/get-scrollable-ancestors.d.ts.map +1 -1
- package/dist/utils/get-scrollable-ancestors.js +5 -5
- package/dist/utils/get-scrollable-ancestors.js.map +1 -1
- package/dist/utils/is-node-in-scan-context.d.ts +3 -0
- package/dist/utils/is-node-in-scan-context.d.ts.map +1 -0
- package/dist/utils/is-node-in-scan-context.js +26 -0
- package/dist/utils/is-node-in-scan-context.js.map +1 -0
- package/dist/utils/is-non-empty.d.ts +2 -0
- package/dist/utils/is-non-empty.d.ts.map +1 -0
- package/dist/utils/is-non-empty.js +4 -0
- package/dist/utils/is-non-empty.js.map +1 -0
- package/dist/utils/normalize-context.d.ts +3 -0
- package/dist/utils/normalize-context.d.ts.map +1 -0
- package/dist/utils/normalize-context.js +59 -0
- package/dist/utils/normalize-context.js.map +1 -0
- package/dist/utils/recalculate-positions.d.ts +1 -1
- package/dist/utils/recalculate-positions.d.ts.map +1 -1
- package/dist/utils/recalculate-positions.js +5 -5
- package/dist/utils/recalculate-positions.js.map +1 -1
- package/dist/utils/recalculate-scrollable-ancestors.d.ts +1 -1
- package/dist/utils/recalculate-scrollable-ancestors.d.ts.map +1 -1
- package/dist/utils/recalculate-scrollable-ancestors.js +4 -4
- package/dist/utils/recalculate-scrollable-ancestors.js.map +1 -1
- package/dist/utils/shadow-dom-aware-mutation-observer.d.ts +1 -1
- package/dist/utils/shadow-dom-aware-mutation-observer.d.ts.map +1 -1
- package/dist/utils/shadow-dom-aware-mutation-observer.js +19 -22
- package/dist/utils/shadow-dom-aware-mutation-observer.js.map +1 -1
- package/dist/utils/supports-anchor-positioning.d.ts +1 -1
- package/dist/utils/supports-anchor-positioning.d.ts.map +1 -1
- package/dist/utils/supports-anchor-positioning.js +1 -1
- package/dist/utils/supports-anchor-positioning.js.map +1 -1
- package/dist/utils/transform-violations.d.ts +2 -2
- package/dist/utils/transform-violations.d.ts.map +1 -1
- package/dist/utils/transform-violations.js +9 -9
- package/dist/utils/transform-violations.js.map +1 -1
- package/dist/utils/update-elements-with-issues.d.ts +11 -5
- package/dist/utils/update-elements-with-issues.d.ts.map +1 -1
- package/dist/utils/update-elements-with-issues.js +54 -26
- package/dist/utils/update-elements-with-issues.js.map +1 -1
- package/dist/validate-options.d.ts +2 -2
- package/dist/validate-options.d.ts.map +1 -1
- package/dist/validate-options.js +91 -4
- package/dist/validate-options.js.map +1 -1
- package/package.json +11 -5
- package/src/accented.test.ts +2 -2
- package/src/accented.ts +38 -28
- package/src/common/tokens.ts +1 -0
- package/src/dom-updater.ts +59 -22
- package/src/elements/accented-dialog.ts +102 -106
- package/src/elements/accented-trigger.ts +58 -48
- package/src/fullscreen-listener.ts +15 -11
- package/src/intersection-observer.ts +27 -16
- package/src/log-and-rethrow.ts +2 -3
- package/src/logger.ts +14 -4
- package/src/register-elements.ts +7 -7
- package/src/resize-listener.ts +15 -11
- package/src/scanner.ts +70 -50
- package/src/scroll-listeners.ts +27 -19
- package/src/state.ts +24 -21
- package/src/task-queue.test.ts +5 -4
- package/src/task-queue.ts +8 -6
- package/src/types.ts +74 -42
- package/src/utils/are-elements-with-issues-equal.ts +7 -5
- package/src/utils/are-issue-sets-equal.test.ts +10 -6
- package/src/utils/are-issue-sets-equal.ts +8 -6
- package/src/utils/containing-blocks.ts +60 -0
- package/src/utils/contains.test.ts +55 -0
- package/src/utils/contains.ts +19 -0
- package/src/utils/deduplicate-nodes.ts +3 -0
- package/src/utils/deep-merge.test.ts +8 -1
- package/src/utils/deep-merge.ts +11 -8
- package/src/utils/dom-helpers.ts +20 -0
- package/src/utils/ensure-non-empty.ts +6 -0
- package/src/utils/get-element-html.ts +4 -2
- package/src/utils/get-element-position.ts +51 -22
- package/src/utils/get-parent.ts +1 -1
- package/src/utils/get-scan-context.test.ts +85 -0
- package/src/utils/get-scan-context.ts +36 -0
- package/src/utils/get-scrollable-ancestors.ts +8 -5
- package/src/utils/is-node-in-scan-context.test.ts +70 -0
- package/src/utils/is-node-in-scan-context.ts +29 -0
- package/src/utils/is-non-empty.ts +3 -0
- package/src/utils/normalize-context.test.ts +105 -0
- package/src/utils/normalize-context.ts +65 -0
- package/src/utils/recalculate-positions.ts +5 -5
- package/src/utils/recalculate-scrollable-ancestors.ts +4 -4
- package/src/utils/shadow-dom-aware-mutation-observer.ts +21 -24
- package/src/utils/supports-anchor-positioning.ts +3 -3
- package/src/utils/transform-violations.test.ts +22 -20
- package/src/utils/transform-violations.ts +14 -10
- package/src/utils/update-elements-with-issues.test.ts +102 -49
- package/src/utils/update-elements-with-issues.ts +122 -58
- package/src/validate-options.ts +154 -14
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { batch } from '@preact/signals-core';
|
|
2
2
|
import { extendedElementsWithIssues } from '../state.js';
|
|
3
|
-
import getScrollableAncestors from './get-scrollable-ancestors.js';
|
|
4
|
-
export
|
|
3
|
+
import { getScrollableAncestors } from './get-scrollable-ancestors.js';
|
|
4
|
+
export function recalculateScrollableAncestors() {
|
|
5
5
|
batch(() => {
|
|
6
|
-
|
|
6
|
+
for (const { element, scrollableAncestors } of extendedElementsWithIssues.value) {
|
|
7
7
|
if (element.isConnected) {
|
|
8
8
|
scrollableAncestors.value = getScrollableAncestors(element, window);
|
|
9
9
|
}
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=recalculate-scrollable-ancestors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recalculate-scrollable-ancestors.js","sourceRoot":"","sources":["../../src/utils/recalculate-scrollable-ancestors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,sBAAsB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"recalculate-scrollable-ancestors.js","sourceRoot":"","sources":["../../src/utils/recalculate-scrollable-ancestors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,MAAM,UAAU,8BAA8B;IAC5C,KAAK,CAAC,GAAG,EAAE;QACT,KAAK,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,IAAI,0BAA0B,CAAC,KAAK,EAAE,CAAC;YAChF,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBACxB,mBAAmB,CAAC,KAAK,GAAG,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare function createShadowDOMAwareMutationObserver(name: string, callback: MutationCallback): {
|
|
2
2
|
"__#4@#shadowRoots": Set<unknown>;
|
|
3
3
|
"__#4@#options": MutationObserverInit | undefined;
|
|
4
4
|
observe(target: Node, options?: MutationObserverInit): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadow-dom-aware-mutation-observer.d.ts","sourceRoot":"","sources":["../../src/utils/shadow-dom-aware-mutation-observer.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"shadow-dom-aware-mutation-observer.d.ts","sourceRoot":"","sources":["../../src/utils/shadow-dom-aware-mutation-observer.ts"],"names":[],"mappings":"AAGA,wBAAgB,oCAAoC,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB;;qBAI/E,oBAAoB,GAAG,SAAS;oBA2BjB,IAAI,YAAY,oBAAoB,GAAG,IAAI;kBAQ7C,IAAI;iCAKJ,UAAU,KAAK,CAAC,OAAO,GAAG,QAAQ,GAAG,gBAAgB,CAAC;gCAcvD,UAAU,KAAK,CAAC,OAAO,GAAG,QAAQ,GAAG,gBAAgB,CAAC;;EAa/E"}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import { isElement, isDocument, isDocumentFragment } from './dom-helpers.js';
|
|
2
1
|
import { getAccentedElementNames } from '../constants.js';
|
|
3
|
-
|
|
2
|
+
import { isDocument, isDocumentFragment, isElement } from './dom-helpers.js';
|
|
3
|
+
export function createShadowDOMAwareMutationObserver(name, callback) {
|
|
4
4
|
class ShadowDOMAwareMutationObserver extends MutationObserver {
|
|
5
5
|
#shadowRoots = new Set();
|
|
6
6
|
#options;
|
|
7
7
|
constructor(callback) {
|
|
8
8
|
super((mutations, observer) => {
|
|
9
9
|
const accentedElementNames = getAccentedElementNames(name);
|
|
10
|
-
const childListMutations = mutations
|
|
11
|
-
.filter(mutation => mutation.type === 'childList');
|
|
10
|
+
const childListMutations = mutations.filter((mutation) => mutation.type === 'childList');
|
|
12
11
|
const newElements = childListMutations
|
|
13
|
-
.
|
|
14
|
-
.
|
|
15
|
-
.filter(node =>
|
|
16
|
-
.filter(node => !accentedElementNames.includes(node.nodeName.toLowerCase()));
|
|
12
|
+
.flatMap((mutation) => [...mutation.addedNodes])
|
|
13
|
+
.filter((node) => isElement(node))
|
|
14
|
+
.filter((node) => !accentedElementNames.includes(node.nodeName.toLowerCase()));
|
|
17
15
|
this.#observeShadowRoots(newElements);
|
|
18
16
|
const removedElements = childListMutations
|
|
19
|
-
.
|
|
20
|
-
.
|
|
21
|
-
.filter(node =>
|
|
22
|
-
.filter(node => !accentedElementNames.includes(node.nodeName.toLowerCase()));
|
|
17
|
+
.flatMap((mutation) => [...mutation.removedNodes])
|
|
18
|
+
.filter((node) => isElement(node))
|
|
19
|
+
.filter((node) => !accentedElementNames.includes(node.nodeName.toLowerCase()));
|
|
23
20
|
// Mutation observer has no "unobserve" method, so we're simply deleting
|
|
24
21
|
// the elements from the set of shadow roots.
|
|
25
22
|
this.#deleteShadowRoots(removedElements);
|
|
@@ -39,21 +36,21 @@ export default function createShadowDOMAwareMutationObserver(name, callback) {
|
|
|
39
36
|
}
|
|
40
37
|
#observeShadowRoots = (elements) => {
|
|
41
38
|
const shadowRoots = elements
|
|
42
|
-
.
|
|
43
|
-
.
|
|
44
|
-
.
|
|
45
|
-
.map(element => element.shadowRoot);
|
|
39
|
+
.flatMap((element) => [...element.querySelectorAll('*')])
|
|
40
|
+
.filter((element) => element.shadowRoot)
|
|
41
|
+
.map((element) => element.shadowRoot);
|
|
46
42
|
for (const shadowRoot of shadowRoots) {
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
if (shadowRoot) {
|
|
44
|
+
this.#shadowRoots.add(shadowRoot);
|
|
45
|
+
this.observe(shadowRoot, this.#options);
|
|
46
|
+
}
|
|
49
47
|
}
|
|
50
48
|
};
|
|
51
49
|
#deleteShadowRoots = (elements) => {
|
|
52
50
|
const shadowRoots = elements
|
|
53
|
-
.
|
|
54
|
-
.
|
|
55
|
-
.
|
|
56
|
-
.map(element => element.shadowRoot);
|
|
51
|
+
.flatMap((element) => [...element.querySelectorAll('*')])
|
|
52
|
+
.filter((element) => element.shadowRoot)
|
|
53
|
+
.map((element) => element.shadowRoot);
|
|
57
54
|
for (const shadowRoot of shadowRoots) {
|
|
58
55
|
this.#shadowRoots.delete(shadowRoot);
|
|
59
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shadow-dom-aware-mutation-observer.js","sourceRoot":"","sources":["../../src/utils/shadow-dom-aware-mutation-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"shadow-dom-aware-mutation-observer.js","sourceRoot":"","sources":["../../src/utils/shadow-dom-aware-mutation-observer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,UAAU,oCAAoC,CAAC,IAAY,EAAE,QAA0B;IAC3F,MAAM,8BAA+B,SAAQ,gBAAgB;QAC3D,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;QAEzB,QAAQ,CAAmC;QAE3C,YAAY,QAA0B;YACpC,KAAK,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE;gBAC5B,MAAM,oBAAoB,GAAG,uBAAuB,CAAC,IAAI,CAAC,CAAC;gBAC3D,MAAM,kBAAkB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;gBAEzF,MAAM,WAAW,GAAG,kB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Q,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type WindowWithCSS = Window & {
|
|
2
2
|
CSS: typeof CSS;
|
|
3
3
|
};
|
|
4
|
-
export
|
|
4
|
+
export declare function supportsAnchorPositioning(win: WindowWithCSS): boolean;
|
|
5
5
|
export {};
|
|
6
6
|
//# sourceMappingURL=supports-anchor-positioning.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supports-anchor-positioning.d.ts","sourceRoot":"","sources":["../../src/utils/supports-anchor-positioning.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG,MAAM,GAAG;IAC5B,GAAG,EAAE,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"supports-anchor-positioning.d.ts","sourceRoot":"","sources":["../../src/utils/supports-anchor-positioning.ts"],"names":[],"mappings":"AAAA,KAAK,aAAa,GAAG,MAAM,GAAG;IAC5B,GAAG,EAAE,OAAO,GAAG,CAAC;CACjB,CAAC;AAEF,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,aAAa,WAE3D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supports-anchor-positioning.js","sourceRoot":"","sources":["../../src/utils/supports-anchor-positioning.ts"],"names":[],"mappings":"AAIA,MAAM,
|
|
1
|
+
{"version":3,"file":"supports-anchor-positioning.js","sourceRoot":"","sources":["../../src/utils/supports-anchor-positioning.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,yBAAyB,CAAC,GAAkB;IAC1D,OAAO,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;AAC9F,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AxeResults } from 'axe-core';
|
|
2
|
-
import type { ElementWithIssues } from '../types';
|
|
3
|
-
export
|
|
2
|
+
import type { ElementWithIssues } from '../types.ts';
|
|
3
|
+
export declare function transformViolations(violations: typeof AxeResults.violations, name: string): ElementWithIssues[];
|
|
4
4
|
//# sourceMappingURL=transform-violations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-violations.d.ts","sourceRoot":"","sources":["../../src/utils/transform-violations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"transform-violations.d.ts","sourceRoot":"","sources":["../../src/utils/transform-violations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAe,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAS,MAAM,aAAa,CAAC;AA0B5D,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,OAAO,UAAU,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,uBA8CzF"}
|
|
@@ -7,17 +7,17 @@ const violationsAffectedByAccentedTriggers = [
|
|
|
7
7
|
'label-content-name-mismatch',
|
|
8
8
|
'list',
|
|
9
9
|
'nested-interactive',
|
|
10
|
-
'scrollable-region-focusable' // The Accented trigger might make the content grow such that scrolling is required.
|
|
10
|
+
'scrollable-region-focusable', // The Accented trigger might make the content grow such that scrolling is required.
|
|
11
11
|
];
|
|
12
12
|
function maybeCausedByAccented(violationId, element, name) {
|
|
13
|
-
return violationsAffectedByAccentedTriggers.includes(violationId)
|
|
14
|
-
|
|
13
|
+
return (violationsAffectedByAccentedTriggers.includes(violationId) &&
|
|
14
|
+
Boolean(element.querySelector(`${name}-trigger`)));
|
|
15
15
|
}
|
|
16
16
|
function impactCompare(a, b) {
|
|
17
17
|
const impactOrder = [null, 'minor', 'moderate', 'serious', 'critical'];
|
|
18
18
|
return impactOrder.indexOf(a) - impactOrder.indexOf(b);
|
|
19
19
|
}
|
|
20
|
-
export
|
|
20
|
+
export function transformViolations(violations, name) {
|
|
21
21
|
const elementsWithIssues = [];
|
|
22
22
|
for (const violation of violations) {
|
|
23
23
|
for (const node of violation.nodes) {
|
|
@@ -35,18 +35,18 @@ export default function transformViolations(violations, name) {
|
|
|
35
35
|
title: violation.help,
|
|
36
36
|
description: node.failureSummary ?? violation.description,
|
|
37
37
|
url: violation.helpUrl,
|
|
38
|
-
impact: violation.impact ?? null
|
|
38
|
+
impact: violation.impact ?? null,
|
|
39
39
|
};
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
40
|
+
const existingElement = elementsWithIssues.find((elementWithIssues) => elementWithIssues.element === element);
|
|
41
|
+
if (existingElement === undefined) {
|
|
42
42
|
elementsWithIssues.push({
|
|
43
43
|
element,
|
|
44
44
|
rootNode: element.getRootNode(),
|
|
45
|
-
issues: [issue]
|
|
45
|
+
issues: [issue],
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
else {
|
|
49
|
-
|
|
49
|
+
existingElement.issues.push(issue);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transform-violations.js","sourceRoot":"","sources":["../../src/utils/transform-violations.ts"],"names":[],"mappings":"AAGA,oFAAoF;AACpF,2FAA2F;AAC3F,MAAM,oCAAoC,GAAG;IAC3C,mBAAmB;IACnB,WAAW;IACX,iBAAiB;IACjB,6BAA6B;IAC7B,MAAM;IACN,oBAAoB;IACpB,6BAA6B,
|
|
1
|
+
{"version":3,"file":"transform-violations.js","sourceRoot":"","sources":["../../src/utils/transform-violations.ts"],"names":[],"mappings":"AAGA,oFAAoF;AACpF,2FAA2F;AAC3F,MAAM,oCAAoC,GAAG;IAC3C,mBAAmB;IACnB,WAAW;IACX,iBAAiB;IACjB,6BAA6B;IAC7B,MAAM;IACN,oBAAoB;IACpB,6BAA6B,EAAE,oFAAoF;CACpH,CAAC;AAEF,SAAS,qBAAqB,CAAC,WAAmB,EAAE,OAAoB,EAAE,IAAY;IACpF,OAAO,CACL,oCAAoC,C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,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,KAAK,OAAO,CAC7D,CAAC;gBACF,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;oBAClC,kBAAkB,CAAC,IAAI,CAAC;wBACtB,OAAO;wBACP,QAAQ,EAAE,OAAO,CAAC,WAAW,EAAE;wBAC/B,MAAM,EAAE,CAAC,KAAK,CAAC;qBAChB,CAAC,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACN,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,KAAK,MAAM,iBAAiB,IAAI,kBAAkB,EAAE,CAAC;QACnD,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACrC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxE,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import type { AxeResults } from 'axe-core';
|
|
2
1
|
import type { Signal } from '@preact/signals-core';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import type { AxeResults } from 'axe-core';
|
|
3
|
+
import type { ExtendedElementWithIssues, ScanContext } from '../types.ts';
|
|
4
|
+
export declare function updateElementsWithIssues({ extendedElementsWithIssues, scanContext, violations, win, name, }: {
|
|
5
|
+
extendedElementsWithIssues: Signal<Array<ExtendedElementWithIssues>>;
|
|
6
|
+
scanContext: ScanContext;
|
|
7
|
+
violations: typeof AxeResults.violations;
|
|
8
|
+
win: Window & {
|
|
9
|
+
CSS: typeof CSS;
|
|
10
|
+
};
|
|
11
|
+
name: string;
|
|
12
|
+
}): void;
|
|
7
13
|
//# sourceMappingURL=update-elements-with-issues.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-elements-with-issues.d.ts","sourceRoot":"","sources":["../../src/utils/update-elements-with-issues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"update-elements-with-issues.d.ts","sourceRoot":"","sources":["../../src/utils/update-elements-with-issues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,KAAK,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA6B1E,wBAAgB,wBAAwB,CAAC,EACvC,0BAA0B,EAC1B,WAAW,EACX,UAAU,EACV,GAAG,EACH,IAAI,GACL,EAAE;IACD,0BAA0B,EAAE,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC,CAAC;IACrE,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,EAAE,OAAO,UAAU,CAAC,UAAU,CAAC;IACzC,GAAG,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,OAAO,GAAG,CAAA;KAAE,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;CACd,QAiGA"}
|
|
@@ -1,38 +1,63 @@
|
|
|
1
1
|
import { batch, signal } from '@preact/signals-core';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import getElementPosition from './get-element-position.js';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import { areElementsWithIssuesEqual } from './are-elements-with-issues-equal.js';
|
|
3
|
+
import { areIssueSetsEqual } from './are-issue-sets-equal.js';
|
|
4
|
+
import { isSvgElement } from './dom-helpers.js';
|
|
5
|
+
import { getElementPosition } from './get-element-position.js';
|
|
6
|
+
import { getParent } from './get-parent.js';
|
|
7
|
+
import { getScrollableAncestors } from './get-scrollable-ancestors.js';
|
|
8
|
+
import { isNodeInScanContext } from './is-node-in-scan-context.js';
|
|
9
|
+
import { supportsAnchorPositioning } from './supports-anchor-positioning.js';
|
|
10
|
+
import { transformViolations } from './transform-violations.js';
|
|
11
|
+
function shouldSkipRender(element) {
|
|
12
|
+
// Skip rendering if the element is inside an SVG:
|
|
13
|
+
// https://github.com/pomerantsev/accented/issues/62
|
|
14
|
+
const parent = getParent(element);
|
|
15
|
+
const isInsideSvg = Boolean(parent && isSvgElement(parent));
|
|
16
|
+
// Some issues, such as meta-viewport, are on <head> descendants,
|
|
17
|
+
// but since <head> is never rendered, we don't want to output anything
|
|
18
|
+
// for those in the DOM.
|
|
19
|
+
// We're not anticipating the use of shadow DOM in <head>,
|
|
20
|
+
// so the use of .closest() should be fine.
|
|
21
|
+
const isInsideHead = element.closest('head') !== null;
|
|
22
|
+
return isInsideSvg || isInsideHead;
|
|
23
|
+
}
|
|
8
24
|
let count = 0;
|
|
9
|
-
export
|
|
25
|
+
export function updateElementsWithIssues({ extendedElementsWithIssues, scanContext, violations, win, name, }) {
|
|
10
26
|
const updatedElementsWithIssues = transformViolations(violations, name);
|
|
11
27
|
batch(() => {
|
|
12
28
|
for (const updatedElementWithIssues of updatedElementsWithIssues) {
|
|
13
|
-
const existingElementIndex = extendedElementsWithIssues.value.findIndex(extendedElementWithIssues => areElementsWithIssuesEqual(extendedElementWithIssues, updatedElementWithIssues));
|
|
14
|
-
if (existingElementIndex > -1 &&
|
|
15
|
-
extendedElementsWithIssues.value[existingElementIndex]
|
|
29
|
+
const existingElementIndex = extendedElementsWithIssues.value.findIndex((extendedElementWithIssues) => areElementsWithIssuesEqual(extendedElementWithIssues, updatedElementWithIssues));
|
|
30
|
+
if (existingElementIndex > -1 &&
|
|
31
|
+
extendedElementsWithIssues.value[existingElementIndex] &&
|
|
32
|
+
!areIssueSetsEqual(extendedElementsWithIssues.value[existingElementIndex].issues.value, updatedElementWithIssues.issues)) {
|
|
33
|
+
extendedElementsWithIssues.value[existingElementIndex].issues.value =
|
|
34
|
+
updatedElementWithIssues.issues;
|
|
16
35
|
}
|
|
17
36
|
}
|
|
18
|
-
const addedElementsWithIssues = updatedElementsWithIssues.filter(updatedElementWithIssues => {
|
|
19
|
-
return !extendedElementsWithIssues.value.some(extendedElementWithIssues => areElementsWithIssuesEqual(extendedElementWithIssues, updatedElementWithIssues));
|
|
37
|
+
const addedElementsWithIssues = updatedElementsWithIssues.filter((updatedElementWithIssues) => {
|
|
38
|
+
return !extendedElementsWithIssues.value.some((extendedElementWithIssues) => areElementsWithIssuesEqual(extendedElementWithIssues, updatedElementWithIssues));
|
|
20
39
|
});
|
|
21
|
-
|
|
22
|
-
|
|
40
|
+
// Only consider an element to be removed in two cases:
|
|
41
|
+
// 1. It has been removed from the DOM.
|
|
42
|
+
// 2. It is within the scan context, but not among updatedElementsWithIssues.
|
|
43
|
+
const removedElementsWithIssues = extendedElementsWithIssues.value.filter((extendedElementWithIssues) => {
|
|
44
|
+
const isConnected = extendedElementWithIssues.element.isConnected;
|
|
45
|
+
const hasNoMoreIssues = isNodeInScanContext(extendedElementWithIssues.element, scanContext) &&
|
|
46
|
+
!updatedElementsWithIssues.some((updatedElementWithIssues) => areElementsWithIssuesEqual(updatedElementWithIssues, extendedElementWithIssues));
|
|
47
|
+
return !isConnected || hasNoMoreIssues;
|
|
23
48
|
});
|
|
24
49
|
if (addedElementsWithIssues.length > 0 || removedElementsWithIssues.length > 0) {
|
|
25
50
|
extendedElementsWithIssues.value = [...extendedElementsWithIssues.value]
|
|
26
|
-
.filter(extendedElementWithIssues => {
|
|
27
|
-
return !removedElementsWithIssues.some(removedElementWithIssues => areElementsWithIssuesEqual(removedElementWithIssues, extendedElementWithIssues));
|
|
51
|
+
.filter((extendedElementWithIssues) => {
|
|
52
|
+
return !removedElementsWithIssues.some((removedElementWithIssues) => areElementsWithIssuesEqual(removedElementWithIssues, extendedElementWithIssues));
|
|
28
53
|
})
|
|
29
54
|
.concat(addedElementsWithIssues
|
|
30
|
-
.filter(addedElementWithIssues => addedElementWithIssues.element.isConnected)
|
|
31
|
-
.map(addedElementWithIssues => {
|
|
55
|
+
.filter((addedElementWithIssues) => addedElementWithIssues.element.isConnected)
|
|
56
|
+
.map((addedElementWithIssues) => {
|
|
32
57
|
const id = count++;
|
|
33
58
|
const trigger = win.document.createElement(`${name}-trigger`);
|
|
34
|
-
const elementZIndex = parseInt(win.getComputedStyle(addedElementWithIssues.element).zIndex, 10);
|
|
35
|
-
if (!isNaN(elementZIndex)) {
|
|
59
|
+
const elementZIndex = Number.parseInt(win.getComputedStyle(addedElementWithIssues.element).zIndex, 10);
|
|
60
|
+
if (!Number.isNaN(elementZIndex)) {
|
|
36
61
|
trigger.style.setProperty('z-index', (elementZIndex + 1).toString(), 'important');
|
|
37
62
|
}
|
|
38
63
|
trigger.style.setProperty('position-anchor', `--${name}-anchor-${id}`, 'important');
|
|
@@ -43,23 +68,26 @@ export default function updateElementsWithIssues(extendedElementsWithIssues, vio
|
|
|
43
68
|
trigger.position = signal(position);
|
|
44
69
|
trigger.visible = signal(true);
|
|
45
70
|
trigger.element = addedElementWithIssues.element;
|
|
46
|
-
const scrollableAncestors = supportsAnchorPositioning(win)
|
|
47
|
-
new Set()
|
|
48
|
-
getScrollableAncestors(addedElementWithIssues.element, win);
|
|
71
|
+
const scrollableAncestors = supportsAnchorPositioning(win)
|
|
72
|
+
? new Set()
|
|
73
|
+
: getScrollableAncestors(addedElementWithIssues.element, win);
|
|
49
74
|
const issues = signal(addedElementWithIssues.issues);
|
|
50
75
|
accentedDialog.issues = issues;
|
|
51
76
|
accentedDialog.element = addedElementWithIssues.element;
|
|
52
77
|
return {
|
|
53
78
|
id,
|
|
54
79
|
element: addedElementWithIssues.element,
|
|
80
|
+
skipRender: shouldSkipRender(addedElementWithIssues.element),
|
|
55
81
|
rootNode: addedElementWithIssues.rootNode,
|
|
56
82
|
visible: trigger.visible,
|
|
57
83
|
position: trigger.position,
|
|
58
84
|
scrollableAncestors: signal(scrollableAncestors),
|
|
59
|
-
anchorNameValue: addedElementWithIssues.element.style.getPropertyValue('anchor-name')
|
|
60
|
-
|
|
85
|
+
anchorNameValue: addedElementWithIssues.element.style.getPropertyValue('anchor-name') ||
|
|
86
|
+
win
|
|
87
|
+
.getComputedStyle(addedElementWithIssues.element)
|
|
88
|
+
.getPropertyValue('anchor-name'),
|
|
61
89
|
trigger,
|
|
62
|
-
issues
|
|
90
|
+
issues,
|
|
63
91
|
};
|
|
64
92
|
}));
|
|
65
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-elements-with-issues.js","sourceRoot":"","sources":["../../src/utils/update-elements-with-issues.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-elements-with-issues.js","sourceRoot":"","sources":["../../src/utils/update-elements-with-issues.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAKrD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,SAAS,gBAAgB,CAAC,OAAgB;IACxC,kDAAkD;IAClD,oDAAoD;IACpD,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,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GAAG,sBAAsB,CAAC,OAAO,CAAC;gBACxD,OAAO;oBACL,EAAE;oBACF,OAAO,EAAE,sBAAsB,CAAC,OAAO;oBACvC,UAAU,EAAE,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,CAAC;oBAC5D,QAAQ,EAAE,sBAAsB,CAAC,QAAQ;oBACzC,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,QAAQ,EAAE,OAAO,CAAC,QAAQ;oBAC1B,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,CAAC;oBAChD,eAAe,EACb,sBAAsB,CAAC,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC;wBACpE,GAAG;6BACA,gBAAgB,CAAC,sBAAsB,CAAC,OAAO,CAAC;6BAChD,gBAAgB,CAAC,aAAa,CAAC;oBACpC,OAAO;oBACP,MAAM;iBACP,CAAC;YACJ,CAAC,CAAC,CACL,CAAC;QACN,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AccentedOptions } from './types';
|
|
2
|
-
export
|
|
1
|
+
import type { AccentedOptions } from './types.ts';
|
|
2
|
+
export declare function validateOptions(options: AccentedOptions): void;
|
|
3
3
|
//# sourceMappingURL=validate-options.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../src/validate-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../src/validate-options.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAMhB,MAAM,YAAY,CAAC;AA+GpB,wBAAgB,eAAe,CAAC,OAAO,EAAE,eAAe,QAgEvD"}
|
package/dist/validate-options.js
CHANGED
|
@@ -1,9 +1,91 @@
|
|
|
1
1
|
import { allowedAxeOptions } from './types.js';
|
|
2
|
+
import { isNode, isNodeList } from './utils/dom-helpers.js';
|
|
3
|
+
function isSelector(contextFragment) {
|
|
4
|
+
return (typeof contextFragment === 'string' ||
|
|
5
|
+
isNode(contextFragment) ||
|
|
6
|
+
'fromShadowDom' in contextFragment);
|
|
7
|
+
}
|
|
8
|
+
function validateSelector(selector) {
|
|
9
|
+
if (typeof selector === 'string') {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (isNode(selector)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if ('fromShadowDom' in selector) {
|
|
16
|
+
if (!Array.isArray(selector.fromShadowDom) ||
|
|
17
|
+
selector.fromShadowDom.length < 2 ||
|
|
18
|
+
!selector.fromShadowDom.every((item) => typeof item === 'string')) {
|
|
19
|
+
throw new TypeError(`Accented: invalid argument. \`fromShadowDom\` must be an array of strings with at least 2 elements. It’s currently set to ${selector.fromShadowDom}.`);
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const neverSelector = selector;
|
|
24
|
+
throw new TypeError(`Accented: invalid argument. The selector must be one of: string, Node, or an object with a \`fromShadowDom\` property. It’s currently set to ${neverSelector}.`);
|
|
25
|
+
}
|
|
26
|
+
function isSelectorList(contextFragment) {
|
|
27
|
+
return ((typeof contextFragment === 'object' && isNodeList(contextFragment)) ||
|
|
28
|
+
(Array.isArray(contextFragment) && contextFragment.every((item) => isSelector(item))));
|
|
29
|
+
}
|
|
30
|
+
function validateSelectorList(selectorList) {
|
|
31
|
+
if (isNodeList(selectorList)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(selectorList)) {
|
|
35
|
+
for (const selector of selectorList) {
|
|
36
|
+
validateSelector(selector);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const neverSelectorList = selectorList;
|
|
41
|
+
throw new TypeError(`Accented: invalid argument. The selector list must either be a NodeList or an array. It’s currently set to ${neverSelectorList}.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function isContextProp(contextFragment) {
|
|
45
|
+
return isSelector(contextFragment) || isSelectorList(contextFragment);
|
|
46
|
+
}
|
|
47
|
+
function validateContextProp(context) {
|
|
48
|
+
if (isSelector(context)) {
|
|
49
|
+
validateSelector(context);
|
|
50
|
+
}
|
|
51
|
+
else if (isSelectorList(context)) {
|
|
52
|
+
validateSelectorList(context);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const neverContext = context;
|
|
56
|
+
throw new TypeError(`Accented: invalid argument. The context property must either be a selector or a selector list. It’s currently set to ${neverContext}.`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function isContextObject(contextFragment) {
|
|
60
|
+
return (typeof contextFragment === 'object' &&
|
|
61
|
+
contextFragment !== null &&
|
|
62
|
+
('include' in contextFragment || 'exclude' in contextFragment));
|
|
63
|
+
}
|
|
64
|
+
function validateContextObject(contextObject) {
|
|
65
|
+
if ('include' in contextObject && contextObject.include !== undefined) {
|
|
66
|
+
validateContextProp(contextObject.include);
|
|
67
|
+
}
|
|
68
|
+
if ('exclude' in contextObject && contextObject.exclude !== undefined) {
|
|
69
|
+
validateContextProp(contextObject.exclude);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function validateContext(context) {
|
|
73
|
+
if (isContextProp(context)) {
|
|
74
|
+
validateContextProp(context);
|
|
75
|
+
}
|
|
76
|
+
else if (isContextObject(context)) {
|
|
77
|
+
validateContextObject(context);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const neverContext = context;
|
|
81
|
+
throw new TypeError(`Accented: invalid context argument. It’s currently set to ${neverContext}.`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
2
84
|
// The space of valid CSS and HTML names is wider than this,
|
|
3
85
|
// but with Unicode it gets complicated quickly, so I'm sticking to only allowing
|
|
4
86
|
// lowercase alphanumeric names that possibly contain dashes that start with a letter.
|
|
5
87
|
const nameRegex = /^[a-z]([a-z0-9]|-)+$/;
|
|
6
|
-
export
|
|
88
|
+
export function validateOptions(options) {
|
|
7
89
|
if (typeof options !== 'object' || options === null) {
|
|
8
90
|
throw new TypeError(`Accented: invalid argument. The options parameter must be an object if provided. It’s currently set to ${options}.`);
|
|
9
91
|
}
|
|
@@ -11,7 +93,8 @@ export default function validateOptions(options) {
|
|
|
11
93
|
if (typeof options.throttle !== 'object' || options.throttle === null) {
|
|
12
94
|
throw new TypeError(`Accented: invalid argument. \`throttle\` option must be an object if provided. It’s currently set to ${options.throttle}.`);
|
|
13
95
|
}
|
|
14
|
-
if (options.throttle.wait !== undefined &&
|
|
96
|
+
if (options.throttle.wait !== undefined &&
|
|
97
|
+
(typeof options.throttle.wait !== 'number' || options.throttle.wait < 0)) {
|
|
15
98
|
throw new TypeError(`Accented: invalid argument. \`throttle.wait\` option must be a non-negative number if provided. It’s currently set to ${options.throttle.wait}.`);
|
|
16
99
|
}
|
|
17
100
|
}
|
|
@@ -26,17 +109,21 @@ export default function validateOptions(options) {
|
|
|
26
109
|
if (options.callback !== undefined && typeof options.callback !== 'function') {
|
|
27
110
|
throw new TypeError(`Accented: invalid argument. \`callback\` option must be a function if provided. It’s currently set to ${options.callback}.`);
|
|
28
111
|
}
|
|
29
|
-
if (options.name !== undefined &&
|
|
112
|
+
if (options.name !== undefined &&
|
|
113
|
+
(typeof options.name !== 'string' || !options.name.match(nameRegex))) {
|
|
30
114
|
throw new TypeError(`Accented: invalid argument. \`name\` option must be a string that starts with a lowercase letter and only contains lowercase alphanumeric characters and dashes. It’s currently set to ${options.name}.`);
|
|
31
115
|
}
|
|
32
116
|
if (options.axeOptions !== undefined) {
|
|
33
117
|
if (typeof options.axeOptions !== 'object' || options.axeOptions === null) {
|
|
34
118
|
throw new TypeError(`Accented: invalid argument. \`axeOptions\` option must be an object if provided. It’s currently set to ${options.axeOptions}.`);
|
|
35
119
|
}
|
|
36
|
-
const unsupportedKeys = Object.keys(options.axeOptions).filter(key => !allowedAxeOptions.includes(key));
|
|
120
|
+
const unsupportedKeys = Object.keys(options.axeOptions).filter((key) => !allowedAxeOptions.includes(key));
|
|
37
121
|
if (unsupportedKeys.length > 0) {
|
|
38
122
|
throw new TypeError(`Accented: invalid argument. \`axeOptions\` contains the following unsupported keys: ${unsupportedKeys.join(', ')}. Valid options are: ${allowedAxeOptions.join(', ')}.`);
|
|
39
123
|
}
|
|
40
124
|
}
|
|
125
|
+
if (options.context !== undefined) {
|
|
126
|
+
validateContext(options.context);
|
|
127
|
+
}
|
|
41
128
|
}
|
|
42
129
|
//# sourceMappingURL=validate-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-options.js","sourceRoot":"","sources":["../src/validate-options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-options.js","sourceRoot":"","sources":["../src/validate-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAS/C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE5D,SAAS,UAAU,CAAC,eAAwB;IAC1C,OAAO,CACL,OAAO,eAAe,KAAK,QAAQ;QACnC,MAAM,CAAC,eAAe,CAAC;QACvB,eAAe,IAAI,eAAe,CACnC,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAkB;IAC1C,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,IAAI,eAAe,IAAI,QAAQ,EAAE,CAAC;QAChC,IACE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC;YACtC,QAAQ,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC;YACjC,CAAC,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,EACjE,CAAC;YACD,MAAM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AC7H,CAAC;IACJ,CAAC;IACD,IACE,OAAO,CAAC,IAAI,KAAK,SAAS;QAC1B,CAAC,OAAO,OAAO,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EACpE,CAAC;QACD,MAAM,IAAI,SAAS,CACjB,0LAA0L,OAAO,CAAC,IAAI,GAAG,CAC1M,CAAC;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACrC,IAAI,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ,IAAI,OAAO,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;YAC1E,MAAM,IAAI,SAAS,CACjB,0GAA0G,OAAO,CAAC,UAAU,GAAG,CAChI,CAAC;QACJ,CAAC;QACD,MAAM,eAAe,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,CAC5D,CAAC,GAAG,EAAE,EAAE,CAAC,CAAE,iBAA8C,CAAC,QAAQ,CAAC,GAAG,CAAC,CACxE,CAAC;QACF,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,SAAS,CACjB,uFAAuF,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACzK,CAAC;QACJ,CAAC;IACH,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAClC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "accented",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-20250618181418",
|
|
4
4
|
"description": "Continuous accessibility testing and issue highlighting for web development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/accented.js",
|
|
@@ -20,21 +20,27 @@
|
|
|
20
20
|
"axe-core"
|
|
21
21
|
],
|
|
22
22
|
"author": "Pavel Pomerantsev",
|
|
23
|
-
"license": "MIT
|
|
23
|
+
"license": "MIT",
|
|
24
24
|
"bugs": {
|
|
25
25
|
"url": "https://github.com/pomerantsev/accented/issues"
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/pomerantsev/accented#readme",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@preact/signals-core": "^1.8.0",
|
|
30
|
-
"axe-core": "^4.10.
|
|
30
|
+
"axe-core": "^4.10.3"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/jsdom": "^21.1.7",
|
|
34
|
+
"jsdom": "^26.0.0"
|
|
31
35
|
},
|
|
32
36
|
"scripts": {
|
|
33
|
-
"build": "tsc",
|
|
37
|
+
"build": "pnpm copyCommon && tsc",
|
|
38
|
+
"copyCommon": "node --import tsx ./scripts/copy-common.ts",
|
|
39
|
+
"watchCommon": "node --import tsx ./scripts/watch-common.ts",
|
|
34
40
|
"checkBuiltFiles": "node --import tsx ./scripts/check-built-files.ts",
|
|
35
41
|
"checkImportsInBuiltFiles": "node ./dist/accented.js",
|
|
36
42
|
"typecheckTests": "tsc -p ./tsconfig.test.json",
|
|
37
|
-
"watch": "tsc --watch",
|
|
43
|
+
"watch": "pnpm copyCommon && (pnpm watchCommon & tsc --watch)",
|
|
38
44
|
"test": "node --test --import tsx \"./**/*.test.ts\""
|
|
39
45
|
}
|
|
40
46
|
}
|
package/src/accented.test.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import assert from 'node:assert/strict';
|
|
2
|
-
import {suite, test} from 'node:test';
|
|
2
|
+
import { suite, test } from 'node:test';
|
|
3
3
|
import type { Mock } from 'node:test';
|
|
4
4
|
|
|
5
|
-
import accented from './accented
|
|
5
|
+
import { accented } from './accented';
|
|
6
6
|
|
|
7
7
|
suite('Accented', () => {
|
|
8
8
|
test('runs without errors in NodeJS and issues a warning and a trace (it’s meant to be a no-op on the server side)', (t) => {
|