aria-ease 6.9.0 → 6.10.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 (43) hide show
  1. package/README.md +3 -3
  2. package/bin/{buildContracts-GBOY7UXG.js → buildContracts-S22V7AGV.js} +28 -0
  3. package/bin/{chunk-LMSKLN5O.js → chunk-NI3MQCAS.js} +34 -0
  4. package/bin/cli.cjs +235 -20
  5. package/bin/cli.js +4 -4
  6. package/bin/{configLoader-Q6A4JLKW.js → configLoader-UJZHQBYS.js} +1 -1
  7. package/{dist/contractTestRunnerPlaywright-XBWJZMR3.js → bin/contractTestRunnerPlaywright-QDXSK3FE.js} +173 -20
  8. package/bin/{test-OND56UUL.js → test-O3J4ZPQR.js} +2 -2
  9. package/dist/{configLoader-WTGJAP4Z.js → configLoader-DWHOHXHL.js} +34 -0
  10. package/{bin/contractTestRunnerPlaywright-ZZNWDUYP.js → dist/contractTestRunnerPlaywright-WNWQYSXZ.js} +173 -20
  11. package/dist/index.cjs +506 -312
  12. package/dist/index.d.cts +54 -54
  13. package/dist/index.d.ts +54 -54
  14. package/dist/index.js +298 -291
  15. package/dist/src/{Types.d-DYfYR3Vc.d.cts → Types.d-yGC2bBaB.d.cts} +1 -1
  16. package/dist/src/{Types.d-DYfYR3Vc.d.ts → Types.d-yGC2bBaB.d.ts} +1 -1
  17. package/dist/src/accordion/index.d.cts +1 -1
  18. package/dist/src/accordion/index.d.ts +1 -1
  19. package/dist/src/block/index.d.cts +1 -1
  20. package/dist/src/block/index.d.ts +1 -1
  21. package/dist/src/checkbox/index.d.cts +1 -1
  22. package/dist/src/checkbox/index.d.ts +1 -1
  23. package/dist/src/combobox/index.cjs +21 -7
  24. package/dist/src/combobox/index.d.cts +1 -1
  25. package/dist/src/combobox/index.d.ts +1 -1
  26. package/dist/src/combobox/index.js +21 -7
  27. package/dist/src/menu/index.d.cts +1 -1
  28. package/dist/src/menu/index.d.ts +1 -1
  29. package/dist/src/radio/index.d.cts +1 -1
  30. package/dist/src/radio/index.d.ts +1 -1
  31. package/dist/src/tabs/index.d.cts +1 -1
  32. package/dist/src/tabs/index.d.ts +1 -1
  33. package/dist/src/toggle/index.d.cts +1 -1
  34. package/dist/src/toggle/index.d.ts +1 -1
  35. package/dist/src/utils/test/{configLoader-YE2CYGDG.js → configLoader-SHJSRG2A.js} +34 -0
  36. package/dist/src/utils/test/{contractTestRunnerPlaywright-LC5OAVXB.js → contractTestRunnerPlaywright-Z2AHXSNM.js} +173 -20
  37. package/dist/src/utils/test/dsl/index.cjs +313 -0
  38. package/dist/src/utils/test/dsl/index.d.cts +136 -0
  39. package/dist/src/utils/test/dsl/index.d.ts +136 -0
  40. package/dist/src/utils/test/dsl/index.js +311 -0
  41. package/dist/src/utils/test/index.cjs +207 -20
  42. package/dist/src/utils/test/index.js +2 -2
  43. package/package.json +7 -6
package/dist/index.d.cts CHANGED
@@ -194,6 +194,11 @@ 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 StatePack = Record<string, {
198
+ setup?: DynamicAction[];
199
+ assertion?: DynamicAssertion[] | DynamicAssertion;
200
+ requires?: string[];
201
+ }>;
197
202
  type Level = "required" | "recommended" | "optional";
198
203
  type ContractMeta = {
199
204
  id?: string;
@@ -225,13 +230,6 @@ type StaticAssertion = {
225
230
  failureMessage: string;
226
231
  level: Level;
227
232
  };
228
- type DynamicAction = {
229
- type: "focus" | "type" | "click" | "keypress" | "hover";
230
- target: string;
231
- key?: string;
232
- value?: string;
233
- relativeTarget?: string;
234
- };
235
233
  type DynamicAssertion = {
236
234
  target: string;
237
235
  assertion: "toBeVisible" | "notToBeVisible" | "toHaveAttribute" | "toHaveValue" | "toHaveFocus" | "toHaveRole";
@@ -239,8 +237,22 @@ type DynamicAssertion = {
239
237
  expectedValue?: string;
240
238
  failureMessage?: string;
241
239
  relativeTarget?: string;
240
+ virtualId?: string;
241
+ selectorKey?: string;
242
242
  level?: Level;
243
243
  };
244
+ type DynamicAction = {
245
+ type: "focus";
246
+ target: string;
247
+ relativeTarget?: "first" | "last" | "next" | "previous";
248
+ virtualId?: string;
249
+ } | {
250
+ type: "click" | "keypress" | "type" | "hover";
251
+ target: string;
252
+ key?: string;
253
+ value?: string;
254
+ relativeTarget?: string;
255
+ };
244
256
  type DynamicTest = {
245
257
  description: string;
246
258
  level?: Level;
@@ -261,42 +273,6 @@ declare class FluentContract {
261
273
  constructor(jsonContract: JsonContract);
262
274
  toJSON(): JsonContract;
263
275
  }
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
276
  declare class ContractBuilder {
301
277
  private readonly componentName;
302
278
  private metaValue;
@@ -304,30 +280,54 @@ declare class ContractBuilder {
304
280
  private readonly relationshipInvariants;
305
281
  private readonly staticAssertions;
306
282
  private readonly dynamicTests;
283
+ private statePack;
307
284
  constructor(componentName: string);
308
285
  meta(meta: ContractMeta): this;
309
286
  selectors(selectors: SelectorsMap): this;
310
- relationship(invariant: RelationshipInvariant): this;
311
- relationships(builderFn: (r: {
287
+ relationships(fn: (r: {
312
288
  ariaReference: (from: string, attribute: string, to: string) => {
313
289
  required: () => void;
314
- recommended: () => void;
315
290
  optional: () => void;
316
291
  };
317
292
  contains: (parent: string, child: string) => {
318
293
  required: () => void;
319
- recommended: () => void;
320
294
  optional: () => void;
321
295
  };
322
296
  }) => void): this;
323
- static(builderFn: (s: StaticBuilder) => void): this;
324
- when(key: string): DynamicChain;
325
- private validateRelationshipInvariants;
326
- private validateStaticTargets;
327
- private validateDynamicTargets;
297
+ static(fn: (s: {
298
+ target: (target: string) => {
299
+ has: (attribute: string, expectedValue: string) => {
300
+ required: () => void;
301
+ optional: () => void;
302
+ };
303
+ };
304
+ }) => void): this;
305
+ when(event: string): DynamicTestBuilder;
306
+ addDynamicTest(test: DynamicTest): void;
328
307
  build(): JsonContract;
329
308
  }
330
- declare function contract(componentName: string, define: (c: ContractBuilder) => void): FluentContract;
309
+ declare class DynamicTestBuilder {
310
+ private parent;
311
+ private statePack;
312
+ private event;
313
+ private _as;
314
+ private _on;
315
+ private _given;
316
+ private _then;
317
+ private _desc;
318
+ private _level;
319
+ constructor(parent: ContractBuilder, statePack: StatePack, event: string);
320
+ as(actionType: string): this;
321
+ on(target: string): this;
322
+ given(states: string | string[]): this;
323
+ then(states: string | string[]): this;
324
+ describe(desc: string): this;
325
+ required(): ContractBuilder;
326
+ optional(): ContractBuilder;
327
+ recommended(): ContractBuilder;
328
+ private _finalize;
329
+ }
330
+ declare function createContract(componentName: string, define: (c: ContractBuilder) => void): FluentContract;
331
331
 
332
332
  type StrictnessMode = 'minimal' | 'balanced' | 'strict' | 'paranoid';
333
333
 
@@ -348,4 +348,4 @@ declare function testUiComponent(componentName: string, component: HTMLElement |
348
348
  */
349
349
  declare function cleanupTests(): Promise<void>;
350
350
 
351
- export { ContractBuilder, type JsonContract, type RelationshipInvariant, cleanupTests, contract, makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeTabsAccessible, makeToggleAccessible, testUiComponent };
351
+ export { cleanupTests, createContract, makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeTabsAccessible, makeToggleAccessible, testUiComponent };
package/dist/index.d.ts CHANGED
@@ -194,6 +194,11 @@ 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 StatePack = Record<string, {
198
+ setup?: DynamicAction[];
199
+ assertion?: DynamicAssertion[] | DynamicAssertion;
200
+ requires?: string[];
201
+ }>;
197
202
  type Level = "required" | "recommended" | "optional";
198
203
  type ContractMeta = {
199
204
  id?: string;
@@ -225,13 +230,6 @@ type StaticAssertion = {
225
230
  failureMessage: string;
226
231
  level: Level;
227
232
  };
228
- type DynamicAction = {
229
- type: "focus" | "type" | "click" | "keypress" | "hover";
230
- target: string;
231
- key?: string;
232
- value?: string;
233
- relativeTarget?: string;
234
- };
235
233
  type DynamicAssertion = {
236
234
  target: string;
237
235
  assertion: "toBeVisible" | "notToBeVisible" | "toHaveAttribute" | "toHaveValue" | "toHaveFocus" | "toHaveRole";
@@ -239,8 +237,22 @@ type DynamicAssertion = {
239
237
  expectedValue?: string;
240
238
  failureMessage?: string;
241
239
  relativeTarget?: string;
240
+ virtualId?: string;
241
+ selectorKey?: string;
242
242
  level?: Level;
243
243
  };
244
+ type DynamicAction = {
245
+ type: "focus";
246
+ target: string;
247
+ relativeTarget?: "first" | "last" | "next" | "previous";
248
+ virtualId?: string;
249
+ } | {
250
+ type: "click" | "keypress" | "type" | "hover";
251
+ target: string;
252
+ key?: string;
253
+ value?: string;
254
+ relativeTarget?: string;
255
+ };
244
256
  type DynamicTest = {
245
257
  description: string;
246
258
  level?: Level;
@@ -261,42 +273,6 @@ declare class FluentContract {
261
273
  constructor(jsonContract: JsonContract);
262
274
  toJSON(): JsonContract;
263
275
  }
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
276
  declare class ContractBuilder {
301
277
  private readonly componentName;
302
278
  private metaValue;
@@ -304,30 +280,54 @@ declare class ContractBuilder {
304
280
  private readonly relationshipInvariants;
305
281
  private readonly staticAssertions;
306
282
  private readonly dynamicTests;
283
+ private statePack;
307
284
  constructor(componentName: string);
308
285
  meta(meta: ContractMeta): this;
309
286
  selectors(selectors: SelectorsMap): this;
310
- relationship(invariant: RelationshipInvariant): this;
311
- relationships(builderFn: (r: {
287
+ relationships(fn: (r: {
312
288
  ariaReference: (from: string, attribute: string, to: string) => {
313
289
  required: () => void;
314
- recommended: () => void;
315
290
  optional: () => void;
316
291
  };
317
292
  contains: (parent: string, child: string) => {
318
293
  required: () => void;
319
- recommended: () => void;
320
294
  optional: () => void;
321
295
  };
322
296
  }) => void): this;
323
- static(builderFn: (s: StaticBuilder) => void): this;
324
- when(key: string): DynamicChain;
325
- private validateRelationshipInvariants;
326
- private validateStaticTargets;
327
- private validateDynamicTargets;
297
+ static(fn: (s: {
298
+ target: (target: string) => {
299
+ has: (attribute: string, expectedValue: string) => {
300
+ required: () => void;
301
+ optional: () => void;
302
+ };
303
+ };
304
+ }) => void): this;
305
+ when(event: string): DynamicTestBuilder;
306
+ addDynamicTest(test: DynamicTest): void;
328
307
  build(): JsonContract;
329
308
  }
330
- declare function contract(componentName: string, define: (c: ContractBuilder) => void): FluentContract;
309
+ declare class DynamicTestBuilder {
310
+ private parent;
311
+ private statePack;
312
+ private event;
313
+ private _as;
314
+ private _on;
315
+ private _given;
316
+ private _then;
317
+ private _desc;
318
+ private _level;
319
+ constructor(parent: ContractBuilder, statePack: StatePack, event: string);
320
+ as(actionType: string): this;
321
+ on(target: string): this;
322
+ given(states: string | string[]): this;
323
+ then(states: string | string[]): this;
324
+ describe(desc: string): this;
325
+ required(): ContractBuilder;
326
+ optional(): ContractBuilder;
327
+ recommended(): ContractBuilder;
328
+ private _finalize;
329
+ }
330
+ declare function createContract(componentName: string, define: (c: ContractBuilder) => void): FluentContract;
331
331
 
332
332
  type StrictnessMode = 'minimal' | 'balanced' | 'strict' | 'paranoid';
333
333
 
@@ -348,4 +348,4 @@ declare function testUiComponent(componentName: string, component: HTMLElement |
348
348
  */
349
349
  declare function cleanupTests(): Promise<void>;
350
350
 
351
- export { ContractBuilder, type JsonContract, type RelationshipInvariant, cleanupTests, contract, makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeTabsAccessible, makeToggleAccessible, testUiComponent };
351
+ export { cleanupTests, createContract, makeAccordionAccessible, makeBlockAccessible, makeCheckboxAccessible, makeComboboxAccessible, makeMenuAccessible, makeRadioAccessible, makeTabsAccessible, makeToggleAccessible, testUiComponent };