aria-ease 6.7.0 → 6.9.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.
Files changed (39) hide show
  1. package/README.md +77 -10
  2. package/bin/AccordionComponentStrategy-4ZEIQ2V6.js +42 -0
  3. package/bin/ComboboxComponentStrategy-OGRVZXAF.js +64 -0
  4. package/bin/MenuComponentStrategy-JAMTCSNF.js +81 -0
  5. package/bin/TabsComponentStrategy-3SQURPMX.js +29 -0
  6. package/bin/buildContracts-GBOY7UXG.js +437 -0
  7. package/bin/{chunk-VPBHLMAS.js → chunk-LMSKLN5O.js} +21 -0
  8. package/bin/chunk-PK5L2SAF.js +17 -0
  9. package/bin/{chunk-2TOYEY5L.js → chunk-XERMSYEH.js} +12 -3
  10. package/bin/cli.cjs +991 -128
  11. package/bin/cli.js +33 -2
  12. package/bin/{configLoader-XRF6VM4J.js → configLoader-Q6A4JLKW.js} +1 -1
  13. package/{dist/contractTestRunnerPlaywright-UAOFNS7Z.js → bin/contractTestRunnerPlaywright-ZZNWDUYP.js} +270 -219
  14. package/bin/{test-WRIJHN6H.js → test-OND56UUL.js} +97 -10
  15. package/dist/AccordionComponentStrategy-4ZEIQ2V6.js +42 -0
  16. package/dist/ComboboxComponentStrategy-OGRVZXAF.js +64 -0
  17. package/dist/MenuComponentStrategy-JAMTCSNF.js +81 -0
  18. package/dist/TabsComponentStrategy-3SQURPMX.js +29 -0
  19. package/dist/chunk-PK5L2SAF.js +17 -0
  20. package/dist/{chunk-2TOYEY5L.js → chunk-XERMSYEH.js} +12 -3
  21. package/dist/{configLoader-IT4PWCJB.js → configLoader-WTGJAP4Z.js} +21 -0
  22. package/{bin/contractTestRunnerPlaywright-UAOFNS7Z.js → dist/contractTestRunnerPlaywright-XBWJZMR3.js} +270 -219
  23. package/dist/index.cjs +800 -96
  24. package/dist/index.d.cts +136 -1
  25. package/dist/index.d.ts +136 -1
  26. package/dist/index.js +421 -16
  27. package/dist/src/utils/test/AccordionComponentStrategy-WRHZOEN6.js +38 -0
  28. package/dist/src/utils/test/ComboboxComponentStrategy-5AECQSRN.js +60 -0
  29. package/dist/src/utils/test/MenuComponentStrategy-VKZQYLBE.js +77 -0
  30. package/dist/src/utils/test/TabsComponentStrategy-BKG53SEV.js +26 -0
  31. package/dist/src/utils/test/aria-contracts/accordion/accordion.contract.json +5 -11
  32. package/dist/src/utils/test/aria-contracts/combobox/combobox.listbox.contract.json +1 -1
  33. package/dist/src/utils/test/aria-contracts/menu/menu.contract.json +1 -1
  34. package/dist/src/utils/test/{chunk-2TOYEY5L.js → chunk-XERMSYEH.js} +12 -3
  35. package/dist/src/utils/test/{configLoader-LD4RV2WQ.js → configLoader-YE2CYGDG.js} +21 -0
  36. package/dist/src/utils/test/{contractTestRunnerPlaywright-IRJOAEMT.js → contractTestRunnerPlaywright-LC5OAVXB.js} +262 -200
  37. package/dist/src/utils/test/index.cjs +472 -88
  38. package/dist/src/utils/test/index.js +97 -12
  39. package/package.json +7 -2
package/dist/index.d.cts CHANGED
@@ -194,6 +194,141 @@ declare function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, lis
194
194
 
195
195
  declare function makeTabsAccessible({ tabListId, tabsClass, tabPanelsClass, orientation, activateOnFocus, callback }: TabsConfig): AccessibilityInstance;
196
196
 
197
+ type Level = "required" | "recommended" | "optional";
198
+ type ContractMeta = {
199
+ id?: string;
200
+ version?: string;
201
+ description?: string;
202
+ source?: {
203
+ apg?: string;
204
+ wcag?: string[];
205
+ };
206
+ W3CName?: string;
207
+ };
208
+ type SelectorsMap = Record<string, string>;
209
+ type RelationshipInvariant = {
210
+ type: "aria-reference";
211
+ from: string;
212
+ attribute: string;
213
+ to: string;
214
+ level?: Level;
215
+ } | {
216
+ type: "contains";
217
+ parent: string;
218
+ child: string;
219
+ level?: Level;
220
+ };
221
+ type StaticAssertion = {
222
+ target: string;
223
+ attribute: string;
224
+ expectedValue?: string;
225
+ failureMessage: string;
226
+ level: Level;
227
+ };
228
+ type DynamicAction = {
229
+ type: "focus" | "type" | "click" | "keypress" | "hover";
230
+ target: string;
231
+ key?: string;
232
+ value?: string;
233
+ relativeTarget?: string;
234
+ };
235
+ type DynamicAssertion = {
236
+ target: string;
237
+ assertion: "toBeVisible" | "notToBeVisible" | "toHaveAttribute" | "toHaveValue" | "toHaveFocus" | "toHaveRole";
238
+ attribute?: string;
239
+ expectedValue?: string;
240
+ failureMessage?: string;
241
+ relativeTarget?: string;
242
+ level?: Level;
243
+ };
244
+ type DynamicTest = {
245
+ description: string;
246
+ level?: Level;
247
+ action: DynamicAction[];
248
+ assertions: DynamicAssertion[];
249
+ };
250
+ type JsonContract = {
251
+ meta?: ContractMeta;
252
+ selectors: SelectorsMap;
253
+ relationships?: RelationshipInvariant[];
254
+ static: Array<{
255
+ assertions: StaticAssertion[];
256
+ }>;
257
+ dynamic: DynamicTest[];
258
+ };
259
+ declare class FluentContract {
260
+ private readonly jsonContract;
261
+ constructor(jsonContract: JsonContract);
262
+ toJSON(): JsonContract;
263
+ }
264
+ declare class StaticTargetBuilder {
265
+ private readonly targetName;
266
+ private readonly sink;
267
+ constructor(targetName: string, sink: StaticAssertion[]);
268
+ has(attribute: string, expectedValue?: string): {
269
+ required: () => void;
270
+ recommended: () => void;
271
+ optional: () => void;
272
+ };
273
+ }
274
+ declare class StaticBuilder {
275
+ private readonly sink;
276
+ constructor(sink: StaticAssertion[]);
277
+ target(targetName: string): StaticTargetBuilder;
278
+ }
279
+ declare class DynamicChain {
280
+ private readonly key;
281
+ private readonly testsSink;
282
+ private readonly selectors;
283
+ private selectorTarget;
284
+ private readonly actions;
285
+ private readonly assertions;
286
+ private explicitDescription;
287
+ constructor(key: string, testsSink: DynamicTest[], selectors: SelectorsMap);
288
+ on(target: string): this;
289
+ describe(description: string): this;
290
+ focus(targetExpression: string): this;
291
+ visible(target: string): this;
292
+ hidden(target: string): this;
293
+ has(target: string, attribute: string, expectedValue?: string): this;
294
+ required(): void;
295
+ recommended(): void;
296
+ optional(): void;
297
+ private finalize;
298
+ private parseRelativeExpression;
299
+ }
300
+ declare class ContractBuilder {
301
+ private readonly componentName;
302
+ private metaValue;
303
+ private selectorsValue;
304
+ private readonly relationshipInvariants;
305
+ private readonly staticAssertions;
306
+ private readonly dynamicTests;
307
+ constructor(componentName: string);
308
+ meta(meta: ContractMeta): this;
309
+ selectors(selectors: SelectorsMap): this;
310
+ relationship(invariant: RelationshipInvariant): this;
311
+ relationships(builderFn: (r: {
312
+ ariaReference: (from: string, attribute: string, to: string) => {
313
+ required: () => void;
314
+ recommended: () => void;
315
+ optional: () => void;
316
+ };
317
+ contains: (parent: string, child: string) => {
318
+ required: () => void;
319
+ recommended: () => void;
320
+ optional: () => void;
321
+ };
322
+ }) => void): this;
323
+ static(builderFn: (s: StaticBuilder) => void): this;
324
+ when(key: string): DynamicChain;
325
+ private validateRelationshipInvariants;
326
+ private validateStaticTargets;
327
+ private validateDynamicTargets;
328
+ build(): JsonContract;
329
+ }
330
+ declare function contract(componentName: string, define: (c: ContractBuilder) => void): FluentContract;
331
+
197
332
  type StrictnessMode = 'minimal' | 'balanced' | 'strict' | 'paranoid';
198
333
 
199
334
  /**
@@ -213,4 +348,4 @@ declare function testUiComponent(componentName: string, component: HTMLElement |
213
348
  */
214
349
  declare function cleanupTests(): Promise<void>;
215
350
 
216
- export { cleanupTests, makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeTabsAccessible, makeToggleAccessible, testUiComponent };
351
+ export { ContractBuilder, type JsonContract, type RelationshipInvariant, cleanupTests, contract, makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeTabsAccessible, makeToggleAccessible, testUiComponent };
package/dist/index.d.ts CHANGED
@@ -194,6 +194,141 @@ declare function makeComboboxAccessible({ comboboxInputId, comboboxButtonId, lis
194
194
 
195
195
  declare function makeTabsAccessible({ tabListId, tabsClass, tabPanelsClass, orientation, activateOnFocus, callback }: TabsConfig): AccessibilityInstance;
196
196
 
197
+ type Level = "required" | "recommended" | "optional";
198
+ type ContractMeta = {
199
+ id?: string;
200
+ version?: string;
201
+ description?: string;
202
+ source?: {
203
+ apg?: string;
204
+ wcag?: string[];
205
+ };
206
+ W3CName?: string;
207
+ };
208
+ type SelectorsMap = Record<string, string>;
209
+ type RelationshipInvariant = {
210
+ type: "aria-reference";
211
+ from: string;
212
+ attribute: string;
213
+ to: string;
214
+ level?: Level;
215
+ } | {
216
+ type: "contains";
217
+ parent: string;
218
+ child: string;
219
+ level?: Level;
220
+ };
221
+ type StaticAssertion = {
222
+ target: string;
223
+ attribute: string;
224
+ expectedValue?: string;
225
+ failureMessage: string;
226
+ level: Level;
227
+ };
228
+ type DynamicAction = {
229
+ type: "focus" | "type" | "click" | "keypress" | "hover";
230
+ target: string;
231
+ key?: string;
232
+ value?: string;
233
+ relativeTarget?: string;
234
+ };
235
+ type DynamicAssertion = {
236
+ target: string;
237
+ assertion: "toBeVisible" | "notToBeVisible" | "toHaveAttribute" | "toHaveValue" | "toHaveFocus" | "toHaveRole";
238
+ attribute?: string;
239
+ expectedValue?: string;
240
+ failureMessage?: string;
241
+ relativeTarget?: string;
242
+ level?: Level;
243
+ };
244
+ type DynamicTest = {
245
+ description: string;
246
+ level?: Level;
247
+ action: DynamicAction[];
248
+ assertions: DynamicAssertion[];
249
+ };
250
+ type JsonContract = {
251
+ meta?: ContractMeta;
252
+ selectors: SelectorsMap;
253
+ relationships?: RelationshipInvariant[];
254
+ static: Array<{
255
+ assertions: StaticAssertion[];
256
+ }>;
257
+ dynamic: DynamicTest[];
258
+ };
259
+ declare class FluentContract {
260
+ private readonly jsonContract;
261
+ constructor(jsonContract: JsonContract);
262
+ toJSON(): JsonContract;
263
+ }
264
+ declare class StaticTargetBuilder {
265
+ private readonly targetName;
266
+ private readonly sink;
267
+ constructor(targetName: string, sink: StaticAssertion[]);
268
+ has(attribute: string, expectedValue?: string): {
269
+ required: () => void;
270
+ recommended: () => void;
271
+ optional: () => void;
272
+ };
273
+ }
274
+ declare class StaticBuilder {
275
+ private readonly sink;
276
+ constructor(sink: StaticAssertion[]);
277
+ target(targetName: string): StaticTargetBuilder;
278
+ }
279
+ declare class DynamicChain {
280
+ private readonly key;
281
+ private readonly testsSink;
282
+ private readonly selectors;
283
+ private selectorTarget;
284
+ private readonly actions;
285
+ private readonly assertions;
286
+ private explicitDescription;
287
+ constructor(key: string, testsSink: DynamicTest[], selectors: SelectorsMap);
288
+ on(target: string): this;
289
+ describe(description: string): this;
290
+ focus(targetExpression: string): this;
291
+ visible(target: string): this;
292
+ hidden(target: string): this;
293
+ has(target: string, attribute: string, expectedValue?: string): this;
294
+ required(): void;
295
+ recommended(): void;
296
+ optional(): void;
297
+ private finalize;
298
+ private parseRelativeExpression;
299
+ }
300
+ declare class ContractBuilder {
301
+ private readonly componentName;
302
+ private metaValue;
303
+ private selectorsValue;
304
+ private readonly relationshipInvariants;
305
+ private readonly staticAssertions;
306
+ private readonly dynamicTests;
307
+ constructor(componentName: string);
308
+ meta(meta: ContractMeta): this;
309
+ selectors(selectors: SelectorsMap): this;
310
+ relationship(invariant: RelationshipInvariant): this;
311
+ relationships(builderFn: (r: {
312
+ ariaReference: (from: string, attribute: string, to: string) => {
313
+ required: () => void;
314
+ recommended: () => void;
315
+ optional: () => void;
316
+ };
317
+ contains: (parent: string, child: string) => {
318
+ required: () => void;
319
+ recommended: () => void;
320
+ optional: () => void;
321
+ };
322
+ }) => void): this;
323
+ static(builderFn: (s: StaticBuilder) => void): this;
324
+ when(key: string): DynamicChain;
325
+ private validateRelationshipInvariants;
326
+ private validateStaticTargets;
327
+ private validateDynamicTargets;
328
+ build(): JsonContract;
329
+ }
330
+ declare function contract(componentName: string, define: (c: ContractBuilder) => void): FluentContract;
331
+
197
332
  type StrictnessMode = 'minimal' | 'balanced' | 'strict' | 'paranoid';
198
333
 
199
334
  /**
@@ -213,4 +348,4 @@ declare function testUiComponent(componentName: string, component: HTMLElement |
213
348
  */
214
349
  declare function cleanupTests(): Promise<void>;
215
350
 
216
- export { cleanupTests, makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeTabsAccessible, makeToggleAccessible, testUiComponent };
351
+ export { ContractBuilder, type JsonContract, type RelationshipInvariant, cleanupTests, contract, makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeTabsAccessible, makeToggleAccessible, testUiComponent };