@orkestrel/test 0.0.18 → 0.0.20
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/dist/src/browser/index.d.ts +526 -16
- package/dist/src/browser/index.js +760 -47
- package/dist/src/browser/index.js.map +1 -1
- package/package.json +6 -5
|
@@ -506,6 +506,193 @@ export declare interface ContrastFixture {
|
|
|
506
506
|
readonly accepted: HTMLElement;
|
|
507
507
|
}
|
|
508
508
|
|
|
509
|
+
/**
|
|
510
|
+
* Converts encoded A98 RGB channels to clipped sRGB paint channels.
|
|
511
|
+
*
|
|
512
|
+
* @param red - The normalized encoded red channel.
|
|
513
|
+
* @param green - The normalized encoded green channel.
|
|
514
|
+
* @param blue - The normalized encoded blue channel.
|
|
515
|
+
* @param alpha - The opacity. Default: `1`.
|
|
516
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
517
|
+
*
|
|
518
|
+
* @remarks
|
|
519
|
+
* Decodes the signed 563/256 power curve and uses the CSS Color 4 A98 RGB to XYZ D65 matrix.
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* ```ts
|
|
523
|
+
* convertA98RGB(0, 0, 0) // [0, 0, 0, 1]
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
export declare function convertA98RGB(red: number, green: number, blue: number, alpha?: number): Color;
|
|
527
|
+
|
|
528
|
+
/**
|
|
529
|
+
* Converts encoded Display P3 channels to clipped sRGB paint channels.
|
|
530
|
+
*
|
|
531
|
+
* @param red - The normalized encoded red channel.
|
|
532
|
+
* @param green - The normalized encoded green channel.
|
|
533
|
+
* @param blue - The normalized encoded blue channel.
|
|
534
|
+
* @param alpha - The opacity. Default: `1`.
|
|
535
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
536
|
+
*
|
|
537
|
+
* @remarks
|
|
538
|
+
* Decodes the extended sRGB transfer curve and uses the CSS Color 4 P3 to XYZ D65 matrix.
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
* ```ts
|
|
542
|
+
* convertDisplayP3(0, 0, 0) // [0, 0, 0, 1]
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
export declare function convertDisplayP3(red: number, green: number, blue: number, alpha?: number): Color;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Converts CIE Lab coordinates relative to D50 to clipped sRGB paint channels.
|
|
549
|
+
*
|
|
550
|
+
* @param lightness - The CIE lightness on the 0–100 scale.
|
|
551
|
+
* @param a - The signed green-to-red axis.
|
|
552
|
+
* @param b - The signed blue-to-yellow axis.
|
|
553
|
+
* @param alpha - The opacity. Default: `1`.
|
|
554
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
555
|
+
*
|
|
556
|
+
* @remarks
|
|
557
|
+
* Resolves the CSS Color 4 Lab curve against the D50 white point before adapting to D65.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* ```ts
|
|
561
|
+
* convertLab(0, 0, 0) // [0, 0, 0, 1]
|
|
562
|
+
* ```
|
|
563
|
+
*/
|
|
564
|
+
export declare function convertLab(lightness: number, a: number, b: number, alpha?: number): Color;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Converts linear sRGB channels to encoded, clipped paint channels.
|
|
568
|
+
*
|
|
569
|
+
* @param red - The linear red channel on the normalized scale.
|
|
570
|
+
* @param green - The linear green channel.
|
|
571
|
+
* @param blue - The linear blue channel.
|
|
572
|
+
* @param alpha - The opacity. Default: `1`.
|
|
573
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
574
|
+
*
|
|
575
|
+
* @remarks
|
|
576
|
+
* Applies the CSS Color 4 extended sRGB transfer function before clipping.
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```ts
|
|
580
|
+
* convertLinearSRGB(0, 0, 0) // [0, 0, 0, 1]
|
|
581
|
+
* ```
|
|
582
|
+
*/
|
|
583
|
+
export declare function convertLinearSRGB(red: number, green: number, blue: number, alpha?: number): Color;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Converts OKLab coordinates to clipped sRGB paint channels.
|
|
587
|
+
*
|
|
588
|
+
* @param lightness - The OKLab lightness on the 0–1 scale.
|
|
589
|
+
* @param a - The signed green-to-red axis.
|
|
590
|
+
* @param b - The signed blue-to-yellow axis.
|
|
591
|
+
* @param alpha - The opacity. Default: `1`.
|
|
592
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
593
|
+
*
|
|
594
|
+
* @remarks
|
|
595
|
+
* Cubes the transformed cone responses before applying the linear sRGB matrix.
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* ```ts
|
|
599
|
+
* convertOKLab(0, 0, 0) // [0, 0, 0, 1]
|
|
600
|
+
* ```
|
|
601
|
+
*/
|
|
602
|
+
export declare function convertOKLab(lightness: number, a: number, b: number, alpha?: number): Color;
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Converts encoded ProPhoto RGB channels to clipped sRGB paint channels.
|
|
606
|
+
*
|
|
607
|
+
* @param red - The normalized encoded red channel.
|
|
608
|
+
* @param green - The normalized encoded green channel.
|
|
609
|
+
* @param blue - The normalized encoded blue channel.
|
|
610
|
+
* @param alpha - The opacity. Default: `1`.
|
|
611
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
612
|
+
*
|
|
613
|
+
* @remarks
|
|
614
|
+
* Decodes the signed ProPhoto curve, converts to XYZ D50, and adapts to D65 before clipping.
|
|
615
|
+
*
|
|
616
|
+
* @example
|
|
617
|
+
* ```ts
|
|
618
|
+
* convertProPhotoRGB(0, 0, 0) // [0, 0, 0, 1]
|
|
619
|
+
* ```
|
|
620
|
+
*/
|
|
621
|
+
export declare function convertProPhotoRGB(red: number, green: number, blue: number, alpha?: number): Color;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Converts encoded Rec. 2020 channels to clipped sRGB paint channels.
|
|
625
|
+
*
|
|
626
|
+
* @param red - The normalized encoded red channel.
|
|
627
|
+
* @param green - The normalized encoded green channel.
|
|
628
|
+
* @param blue - The normalized encoded blue channel.
|
|
629
|
+
* @param alpha - The opacity. Default: `1`.
|
|
630
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
631
|
+
*
|
|
632
|
+
* @remarks
|
|
633
|
+
* Uses the piecewise Rec. 2020 transfer curve Chromium computes and the CSS Color 4 XYZ matrix.
|
|
634
|
+
*
|
|
635
|
+
* @example
|
|
636
|
+
* ```ts
|
|
637
|
+
* convertRec2020(0, 0, 0) // [0, 0, 0, 1]
|
|
638
|
+
* ```
|
|
639
|
+
*/
|
|
640
|
+
export declare function convertRec2020(red: number, green: number, blue: number, alpha?: number): Color;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Converts normalized encoded sRGB channels to the clipped paint scale.
|
|
644
|
+
*
|
|
645
|
+
* @param red - The encoded red channel, with `1` representing full intensity.
|
|
646
|
+
* @param green - The encoded green channel.
|
|
647
|
+
* @param blue - The encoded blue channel.
|
|
648
|
+
* @param alpha - The opacity. Default: `1`.
|
|
649
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* ```ts
|
|
653
|
+
* convertSRGB(1.2, -0.1, 0.5) // [255, 0, 127.5, 1]
|
|
654
|
+
* ```
|
|
655
|
+
*/
|
|
656
|
+
export declare function convertSRGB(red: number, green: number, blue: number, alpha?: number): Color;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Converts D50 XYZ coordinates to clipped sRGB paint channels.
|
|
660
|
+
*
|
|
661
|
+
* @param x - The normalized X coordinate relative to D50.
|
|
662
|
+
* @param y - The normalized Y coordinate relative to D50.
|
|
663
|
+
* @param z - The normalized Z coordinate relative to D50.
|
|
664
|
+
* @param alpha - The opacity. Default: `1`.
|
|
665
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
666
|
+
*
|
|
667
|
+
* @remarks
|
|
668
|
+
* Applies the CSS Color 4 Bradford adaptation from D50 to D65 before converting to sRGB.
|
|
669
|
+
*
|
|
670
|
+
* @example
|
|
671
|
+
* ```ts
|
|
672
|
+
* convertXYZD50(0, 0, 0) // [0, 0, 0, 1]
|
|
673
|
+
* ```
|
|
674
|
+
*/
|
|
675
|
+
export declare function convertXYZD50(x: number, y: number, z: number, alpha?: number): Color;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Converts D65 XYZ coordinates to clipped sRGB paint channels.
|
|
679
|
+
*
|
|
680
|
+
* @param x - The normalized X coordinate.
|
|
681
|
+
* @param y - The normalized Y coordinate.
|
|
682
|
+
* @param z - The normalized Z coordinate.
|
|
683
|
+
* @param alpha - The opacity. Default: `1`.
|
|
684
|
+
* @returns Frozen straight sRGB channels clipped to 0–255, with alpha clipped to 0–1.
|
|
685
|
+
*
|
|
686
|
+
* @remarks
|
|
687
|
+
* Uses the CSS Color 4 XYZ D65 to linear sRGB matrix, then the sRGB transfer function.
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* ```ts
|
|
691
|
+
* convertXYZD65(0, 0, 0) // [0, 0, 0, 1]
|
|
692
|
+
* ```
|
|
693
|
+
*/
|
|
694
|
+
export declare function convertXYZD65(x: number, y: number, z: number, alpha?: number): Color;
|
|
695
|
+
|
|
509
696
|
/**
|
|
510
697
|
* Creates one console channel that records every call it receives and hands that call on unchanged.
|
|
511
698
|
*
|
|
@@ -788,6 +975,54 @@ export declare function describeFocus(element: Element): string;
|
|
|
788
975
|
*/
|
|
789
976
|
export declare function describeTree(element: Element): string;
|
|
790
977
|
|
|
978
|
+
/**
|
|
979
|
+
* Holds the primary pointer button on the control a resolver returns, through the browser provider.
|
|
980
|
+
*
|
|
981
|
+
* @param resolve - The resolver that returns the target, called after the held-pointer refusal.
|
|
982
|
+
* @param name - The target's name, as the refusals voice it.
|
|
983
|
+
* @returns A promise resolving after the control enters its pressed state.
|
|
984
|
+
* @throws Thrown when a pointer is already held, the resolver refuses, the target stays outside
|
|
985
|
+
* the viewport after scrolling, or the press misses. A missed press that also fails to release
|
|
986
|
+
* carries the release rejection as its cause.
|
|
987
|
+
*
|
|
988
|
+
* @remarks
|
|
989
|
+
* This is the one pointer drive every hold verb shares: the held-marker refusal, a scroll that
|
|
990
|
+
* brings a wholly off-viewport target into view and a refusal for one that stays outside, the
|
|
991
|
+
* centre mapped through the tester iframe's painted scale into page coordinates, the trusted move
|
|
992
|
+
* and press, the marker, a frame wait, and the `:active` read-back that releases before refusing a
|
|
993
|
+
* missed press. The refusal precedes resolution, so a double hold is refused before an absent
|
|
994
|
+
* name is.
|
|
995
|
+
*
|
|
996
|
+
* @example
|
|
997
|
+
* ```ts
|
|
998
|
+
* await driveHold(() => resolveAccessible('Apply'), 'Apply')
|
|
999
|
+
* await releasePointer()
|
|
1000
|
+
* ```
|
|
1001
|
+
*/
|
|
1002
|
+
export declare function driveHold(resolve: () => HTMLElement, name: string): Promise<void>;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Reaches the control a resolver returns, only through natural forward Tab traversal from the
|
|
1006
|
+
* current focus.
|
|
1007
|
+
*
|
|
1008
|
+
* @param resolve - The resolver that returns the target, called before the first step and again on
|
|
1009
|
+
* every step, because a framework may replace the node between resolution and focus arrival.
|
|
1010
|
+
* @param name - The target's name, as the refusal voices it.
|
|
1011
|
+
* @returns The target after the browser moves focus to it.
|
|
1012
|
+
* @throws When the resolver refuses, or one complete traversal cannot reach the target.
|
|
1013
|
+
*
|
|
1014
|
+
* @remarks
|
|
1015
|
+
* This is the one loop every traversal verb shares. A step counts only when focus lands on an
|
|
1016
|
+
* element, the traversal is over when focus revisits one, and the cap is counted off
|
|
1017
|
+
* {@link FOCUSABLE_SELECTOR}.
|
|
1018
|
+
*
|
|
1019
|
+
* @example
|
|
1020
|
+
* ```ts
|
|
1021
|
+
* await driveTraversal(() => resolveRendered('Evaluate'), 'Evaluate')
|
|
1022
|
+
* ```
|
|
1023
|
+
*/
|
|
1024
|
+
export declare function driveTraversal(resolve: () => HTMLElement, name: string): Promise<HTMLElement>;
|
|
1025
|
+
|
|
791
1026
|
/**
|
|
792
1027
|
* Configures one built element: its class list, its text, and its attributes.
|
|
793
1028
|
*
|
|
@@ -1092,6 +1327,99 @@ export declare interface HarnessOptions<TState extends string, TEvent extends st
|
|
|
1092
1327
|
*/
|
|
1093
1328
|
export declare const HEADER_ROLES: Readonly<Record<string, string>>;
|
|
1094
1329
|
|
|
1330
|
+
/**
|
|
1331
|
+
* Holds the primary pointer button on one visible, focus-reachable control by its accessible name.
|
|
1332
|
+
*
|
|
1333
|
+
* @param name - The target's exact accessible name.
|
|
1334
|
+
* @returns A promise resolving after the control enters its pressed state.
|
|
1335
|
+
* @throws Thrown when the resolver refuses the target, a pointer is already held, or the press
|
|
1336
|
+
* misses. A missed press that also fails to release carries the release rejection as its cause.
|
|
1337
|
+
*
|
|
1338
|
+
* @remarks
|
|
1339
|
+
* The centre maps through the tester iframe's painted scale into page coordinates. The `:active`
|
|
1340
|
+
* reading verifies delivery. A missed press releases before refusing; if that release also
|
|
1341
|
+
* rejects, the refusal carries it as its cause. Register {@link releasePointer} in teardown
|
|
1342
|
+
* before holding; release can produce a click on the pressed control. A rejected button-down send
|
|
1343
|
+
* leaves no hold marker. The hold itself is {@link driveHold}.
|
|
1344
|
+
*
|
|
1345
|
+
* @example
|
|
1346
|
+
* ```ts
|
|
1347
|
+
* await holdAccessible('Apply')
|
|
1348
|
+
* await releasePointer()
|
|
1349
|
+
* ```
|
|
1350
|
+
*/
|
|
1351
|
+
export declare function holdAccessible(name: string): Promise<void>;
|
|
1352
|
+
|
|
1353
|
+
/**
|
|
1354
|
+
* Holds the primary pointer button on one control by its exact ARIA role and accessible name.
|
|
1355
|
+
*
|
|
1356
|
+
* @param role - The control's exact ARIA role.
|
|
1357
|
+
* @param name - The target's exact accessible name.
|
|
1358
|
+
* @returns A promise resolving after the control enters its pressed state.
|
|
1359
|
+
* @throws Thrown when the resolver refuses the target, a pointer is already held, or the press
|
|
1360
|
+
* misses. A missed press that also fails to release carries the release rejection as its cause.
|
|
1361
|
+
*
|
|
1362
|
+
* @example
|
|
1363
|
+
* ```ts
|
|
1364
|
+
* await holdAccessible('tab', 'Drafts')
|
|
1365
|
+
* await releasePointer()
|
|
1366
|
+
* ```
|
|
1367
|
+
*/
|
|
1368
|
+
export declare function holdAccessible(role: string, name: string): Promise<void>;
|
|
1369
|
+
|
|
1370
|
+
/**
|
|
1371
|
+
* Holds the primary pointer button on one control by role and accessible-name text inside a named
|
|
1372
|
+
* region.
|
|
1373
|
+
*
|
|
1374
|
+
* @param region - The containing region's exact accessible name.
|
|
1375
|
+
* @param role - The control's exact ARIA role.
|
|
1376
|
+
* @param name - The rendered accessible-name text that identifies the control in that region.
|
|
1377
|
+
* @returns A promise resolving after the control enters its pressed state.
|
|
1378
|
+
* @throws Thrown when a pointer is already held, the region refuses the target, or the press
|
|
1379
|
+
* misses. A missed press that also fails to release carries the release rejection as its cause.
|
|
1380
|
+
*
|
|
1381
|
+
* @remarks
|
|
1382
|
+
* The resolution is {@link resolveAccessibleWithin} and the hold is {@link driveHold}, so a twin
|
|
1383
|
+
* of the same name in another region is left alone. Register {@link releasePointer} in teardown
|
|
1384
|
+
* before holding.
|
|
1385
|
+
*
|
|
1386
|
+
* @example
|
|
1387
|
+
* ```ts
|
|
1388
|
+
* await holdAccessibleWithin('Ledger', 'button', 'Apply')
|
|
1389
|
+
* await releasePointer()
|
|
1390
|
+
* ```
|
|
1391
|
+
*/
|
|
1392
|
+
export declare function holdAccessibleWithin(region: string, role: string, name: string): Promise<void>;
|
|
1393
|
+
|
|
1394
|
+
/**
|
|
1395
|
+
* Hovers one visible, focus-reachable control by its accessible name through the browser provider.
|
|
1396
|
+
*
|
|
1397
|
+
* @param name - The target's exact accessible name.
|
|
1398
|
+
* @returns A promise resolving after the pointer reaches the control.
|
|
1399
|
+
* @throws Thrown when the resolver refuses the target.
|
|
1400
|
+
*
|
|
1401
|
+
* @example
|
|
1402
|
+
* ```ts
|
|
1403
|
+
* await hoverAccessible('Apply')
|
|
1404
|
+
* ```
|
|
1405
|
+
*/
|
|
1406
|
+
export declare function hoverAccessible(name: string): Promise<void>;
|
|
1407
|
+
|
|
1408
|
+
/**
|
|
1409
|
+
* Hovers one visible, focus-reachable control by its exact ARIA role and accessible name.
|
|
1410
|
+
*
|
|
1411
|
+
* @param role - The control's exact ARIA role.
|
|
1412
|
+
* @param name - The target's exact accessible name.
|
|
1413
|
+
* @returns A promise resolving after the pointer reaches the control.
|
|
1414
|
+
* @throws Thrown when the resolver refuses the target.
|
|
1415
|
+
*
|
|
1416
|
+
* @example
|
|
1417
|
+
* ```ts
|
|
1418
|
+
* await hoverAccessible('tab', 'Drafts')
|
|
1419
|
+
* ```
|
|
1420
|
+
*/
|
|
1421
|
+
export declare function hoverAccessible(role: string, name: string): Promise<void>;
|
|
1422
|
+
|
|
1095
1423
|
/**
|
|
1096
1424
|
* Names the role each listed tag carries in the accessibility tree when it declares none of its
|
|
1097
1425
|
* own.
|
|
@@ -1352,6 +1680,25 @@ export declare function measureContrast(front: Color, back: Color): number;
|
|
|
1352
1680
|
*/
|
|
1353
1681
|
export declare function measureLuminance(color: Color): number;
|
|
1354
1682
|
|
|
1683
|
+
/**
|
|
1684
|
+
* Names the tester root's attribute holding the media readings observed before the first stage.
|
|
1685
|
+
*
|
|
1686
|
+
* @remarks
|
|
1687
|
+
* The value is a bit string in print, reduced motion, dark colour scheme, and forced colours order.
|
|
1688
|
+
* Each bit is `1` for a matching query and `0` otherwise, for example `0100`.
|
|
1689
|
+
*/
|
|
1690
|
+
export declare const MEDIA_STAGE = "data-media-stage";
|
|
1691
|
+
|
|
1692
|
+
/** Configures the tester's print medium, motion preference, and forced colours. */
|
|
1693
|
+
export declare interface MediaOptions {
|
|
1694
|
+
/** Determines whether the tester lays out for print. Omit it to leave the medium alone. */
|
|
1695
|
+
readonly print?: boolean;
|
|
1696
|
+
/** Determines whether the tester prefers motion. Omit it to leave the preference alone. */
|
|
1697
|
+
readonly motion?: boolean;
|
|
1698
|
+
/** Determines whether the tester runs under forced colours. Omit it to leave the colours alone. */
|
|
1699
|
+
readonly forced?: boolean;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1355
1702
|
/**
|
|
1356
1703
|
* Puts one element into the document and hands it straight back.
|
|
1357
1704
|
*
|
|
@@ -1382,18 +1729,19 @@ export declare function measureLuminance(color: Color): number;
|
|
|
1382
1729
|
export declare function mount<T extends Element>(element: T): T;
|
|
1383
1730
|
|
|
1384
1731
|
/**
|
|
1385
|
-
* Parses
|
|
1732
|
+
* Parses computed CSS Color 4 values into clipped straight sRGB channels.
|
|
1386
1733
|
*
|
|
1387
|
-
* @param value - A computed `rgb()`, `rgba()`, or `color(
|
|
1388
|
-
* @returns
|
|
1734
|
+
* @param value - A computed `rgb()`, `rgba()`, `oklab()`, `oklch()`, `lab()`, `lch()`, or `color()` value.
|
|
1735
|
+
* @returns Frozen channels, or `undefined` for an unsupported syntax or non-finite channel.
|
|
1389
1736
|
*
|
|
1390
1737
|
* @remarks
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
1738
|
+
* Reads signed channels, scientific notation, percentage lightness, degree hues, and `none` as
|
|
1739
|
+
* zero. The `color()` spaces are `srgb`, `srgb-linear`, `display-p3`, `a98-rgb`, `prophoto-rgb`,
|
|
1740
|
+
* `rec2020`, `xyz`, `xyz-d50`, and `xyz-d65`. Conversion uses the CSS Color 4 matrices and white
|
|
1741
|
+
* point adaptation, then clips each encoded sRGB channel to 0–255 rather than gamut-mapping it.
|
|
1742
|
+
* Alpha is clipped to 0–1. Keywords, hex colors, unresolved expressions, and non-finite calculations
|
|
1743
|
+
* such as `color(srgb calc(infinity) 0 0)` remain unreadable; use {@link parseCSSColor} to resolve
|
|
1744
|
+
* ordinary authored expressions through the cascade.
|
|
1397
1745
|
*
|
|
1398
1746
|
* @example
|
|
1399
1747
|
* ```ts
|
|
@@ -1407,7 +1755,7 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1407
1755
|
* Resolves any CSS color expression to straight sRGB channels, by asking the browser.
|
|
1408
1756
|
*
|
|
1409
1757
|
* @param value - Any value the `color` property accepts: a keyword, a hex triple, a `var()`
|
|
1410
|
-
* reference, a `color-mix()`, or
|
|
1758
|
+
* reference, a `color-mix()`, or a computed CSS Color 4 value.
|
|
1411
1759
|
* @returns The resolved color's channels, or `undefined` when the CSSOM refuses the value or the
|
|
1412
1760
|
* computed result names no color {@link parseColor} speaks.
|
|
1413
1761
|
*
|
|
@@ -1417,6 +1765,8 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1417
1765
|
* cascade, and reads back what the engine computed — which is the only way a keyword, a hex triple,
|
|
1418
1766
|
* or a `var()` reference becomes channels at all. The read itself goes through `parseColor`, so both
|
|
1419
1767
|
* halves agree on what a computed value means.
|
|
1768
|
+
* Modern perceptual and predefined RGB/XYZ spaces resolve through that parser's conversions;
|
|
1769
|
+
* out-of-gamut sRGB channels are clipped to 0–255 after conversion.
|
|
1420
1770
|
*
|
|
1421
1771
|
* The probe is mounted, because an unmounted element inherits nothing and a `var()` reference to a
|
|
1422
1772
|
* token declared on `:root` would resolve to the initial value instead. It is removed in a `finally`,
|
|
@@ -1435,6 +1785,15 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1435
1785
|
*/
|
|
1436
1786
|
export declare function parseCSSColor(value: string): Color | undefined;
|
|
1437
1787
|
|
|
1788
|
+
/**
|
|
1789
|
+
* Names the tester root's attribute holding the pressed pointer's page coordinates.
|
|
1790
|
+
*
|
|
1791
|
+
* @remarks
|
|
1792
|
+
* The value has the form `<x>x<y>`. The release removes it only after the button-up send resolves,
|
|
1793
|
+
* so a rejected send keeps the marker for a retry.
|
|
1794
|
+
*/
|
|
1795
|
+
export declare const POINTER_HOLD = "data-pointer-hold";
|
|
1796
|
+
|
|
1438
1797
|
/** Holds the registry of capture states one run places, and the files it wrote placing them. */
|
|
1439
1798
|
export declare interface PortfolioInterface {
|
|
1440
1799
|
/** Holds the name of the variant this run renders. */
|
|
@@ -1513,10 +1872,13 @@ export declare function pressKeys(keys: string): Promise<void>;
|
|
|
1513
1872
|
* @param element - The element whose backdrop to resolve.
|
|
1514
1873
|
* @param floor - The opaque color the walk ends on when nothing above it paints.
|
|
1515
1874
|
* @returns The composited color a reader sees behind the element.
|
|
1875
|
+
* @throws Thrown when the backdrop contains an unreadable painted color layer.
|
|
1516
1876
|
*
|
|
1517
1877
|
* @remarks
|
|
1518
1878
|
* The layers {@link readLayers} collects composite top-over-bottom onto the floor, so a 3% surface
|
|
1519
1879
|
* tint reads as a tint over what shows through it rather than as a full-strength paint.
|
|
1880
|
+
* Those layers include the modern CSS Color 4 spaces, converted and clipped to sRGB by
|
|
1881
|
+
* {@link parseColor}; an unreadable painted layer refuses the entire reading.
|
|
1520
1882
|
*
|
|
1521
1883
|
* The floor is required, because this leaf never guesses what a document sits on. Pass
|
|
1522
1884
|
* {@link CANVAS_COLOR} for the page a browser paints behind an unstyled document, or the color of
|
|
@@ -1620,7 +1982,8 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1620
1982
|
* would show through instead of assuming one.
|
|
1621
1983
|
* @returns The relative-luminance contrast ratio.
|
|
1622
1984
|
* @throws Thrown when the element exposes no computed foreground color, and — with `floor` omitted
|
|
1623
|
-
* — when the walk from the element upwards reaches no opaque layer.
|
|
1985
|
+
* — when the walk from the element upwards reaches no opaque layer. An unreadable painted
|
|
1986
|
+
* background layer throws even when a floor is supplied.
|
|
1624
1987
|
*
|
|
1625
1988
|
* @remarks
|
|
1626
1989
|
* A transparent or translucent background resolves through the element's ancestors: every painted
|
|
@@ -1628,6 +1991,8 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1628
1991
|
* base, so a 3% surface tint reads as a tint over what shows through it rather than as a
|
|
1629
1992
|
* full-strength paint. A translucent foreground then resolves against that effective background
|
|
1630
1993
|
* before luminance is measured.
|
|
1994
|
+
* Text and background colors can use the modern CSS Color 4 spaces {@link parseColor} reads;
|
|
1995
|
+
* each is converted to sRGB and clipped before composition and luminance measurement.
|
|
1631
1996
|
*
|
|
1632
1997
|
* With `floor` omitted, the walk from the target upwards must reach a fully opaque layer: the
|
|
1633
1998
|
* measurement throws rather than assuming a white canvas wherever that canvas would still be part
|
|
@@ -1646,7 +2011,7 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1646
2011
|
* ```ts
|
|
1647
2012
|
* const container = render('<p style="background: #000; color: #fff">Ready</p>')
|
|
1648
2013
|
* readContrast(requireValue(container.firstElementChild)) // 21
|
|
1649
|
-
* readContrast(requireValue(container.firstElementChild), CANVAS_COLOR) // 21
|
|
2014
|
+
* readContrast(requireValue(container.firstElementChild), CANVAS_COLOR) // 21
|
|
1650
2015
|
* ```
|
|
1651
2016
|
*/
|
|
1652
2017
|
export declare function readContrast(element: Element, floor?: Color): number;
|
|
@@ -1750,16 +2115,23 @@ export declare function readFrame(path: string): Promise<FrameReading>;
|
|
|
1750
2115
|
export declare function readHit(element: Element): Element | undefined;
|
|
1751
2116
|
|
|
1752
2117
|
/**
|
|
1753
|
-
* Collects
|
|
2118
|
+
* Collects readable background color layers and refuses an unreadable painted layer.
|
|
1754
2119
|
*
|
|
1755
2120
|
* @param element - The element to walk up from.
|
|
1756
2121
|
* @returns Every layer the walk paints, the element's own first and the deepest last.
|
|
2122
|
+
* @throws Thrown when a painted background color is unreadable; the error names the element and
|
|
2123
|
+
* its computed value.
|
|
1757
2124
|
*
|
|
1758
2125
|
* @remarks
|
|
1759
2126
|
* A surface token paints one ancestor while every element between it and the text paints nothing,
|
|
1760
2127
|
* so a backdrop is found by walking up rather than by reading the element's own `background-color`,
|
|
1761
2128
|
* which is almost always transparent. A fully transparent layer paints nothing and is left out, and
|
|
1762
2129
|
* the walk stops at the first fully opaque layer, because nothing above that layer is visible.
|
|
2130
|
+
* Legacy and modern CSS Color 4 values resolve through {@link parseColor}, with sRGB channels
|
|
2131
|
+
* clipped after conversion. Non-finite calculations such as `color(srgb calc(infinity) 0 0)` are
|
|
2132
|
+
* deliberately unreadable. An unreadable value with an explicit zero alpha paints nothing and is
|
|
2133
|
+
* skipped. An empty detached-element reading paints nothing too. Background images remain outside
|
|
2134
|
+
* this color reader.
|
|
1763
2135
|
*
|
|
1764
2136
|
* The stack is what tells a resolved backdrop from an assumed one: the walk reached an opaque
|
|
1765
2137
|
* surface exactly when its last layer's alpha is `1`. {@link readContrast} refuses on that reading,
|
|
@@ -1844,7 +2216,9 @@ export declare function readPerception(name: string): string;
|
|
|
1844
2216
|
*
|
|
1845
2217
|
* @param element - The element whose resolved style to inspect.
|
|
1846
2218
|
* @param property - The CSS property name, registered or custom.
|
|
2219
|
+
* @param pseudo - The pseudo-element selector. Omit it to read the element itself.
|
|
1847
2220
|
* @returns The leading numeric part of the resolved value, and `0` when it carries none.
|
|
2221
|
+
* @throws Thrown when the pseudo argument lacks the `::` prefix or the engine does not support it.
|
|
1848
2222
|
*
|
|
1849
2223
|
* @remarks
|
|
1850
2224
|
* A resolved length is text with a unit — `'12px'` — so this reads the number in front of the unit
|
|
@@ -1862,7 +2236,7 @@ export declare function readPerception(name: string): string;
|
|
|
1862
2236
|
* readPixels(button, 'width') // 0 when the width resolves to `auto`
|
|
1863
2237
|
* ```
|
|
1864
2238
|
*/
|
|
1865
|
-
export declare function readPixels(element: Element, property: string): number;
|
|
2239
|
+
export declare function readPixels(element: Element, property: string, pseudo?: string): number;
|
|
1866
2240
|
|
|
1867
2241
|
/**
|
|
1868
2242
|
* Reads the refusal one named target answers with, or nothing when it resolves.
|
|
@@ -1914,6 +2288,7 @@ export declare function readRefusal(role: string, name: string): string | undefi
|
|
|
1914
2288
|
* @param worn - The element the control's focus chrome is painted onto. Default: `control`.
|
|
1915
2289
|
* @returns The strongest ratio the painted focus chrome reaches, or `undefined` when the control is
|
|
1916
2290
|
* not showing `:focus-visible` or the cascade paints no chrome of its own.
|
|
2291
|
+
* @throws Thrown when the focused control's backdrop contains an unreadable painted color layer.
|
|
1917
2292
|
*
|
|
1918
2293
|
* @remarks
|
|
1919
2294
|
* This reads and never acts. Focus arrives through the published verbs — `traverseAccessible`,
|
|
@@ -1937,6 +2312,9 @@ export declare function readRefusal(role: string, name: string): string | undefi
|
|
|
1937
2312
|
* color names neither. A focus style that only changes the control's own fill reports `undefined`
|
|
1938
2313
|
* too: the resting fill is gone by the time focus is on the control, and this never moves focus to
|
|
1939
2314
|
* go and read it.
|
|
2315
|
+
* Outline and shadow colors include `oklch()`, `oklab()`, `lab()`, `lch()`, and predefined
|
|
2316
|
+
* `color()` spaces. Each readable color converts to clipped sRGB through {@link parseColor}, and
|
|
2317
|
+
* the result remains a contrast ratio rather than a ring width.
|
|
1940
2318
|
*
|
|
1941
2319
|
* @example
|
|
1942
2320
|
* ```ts
|
|
@@ -2057,12 +2435,14 @@ export declare function readRules(): readonly CSSRule[];
|
|
|
2057
2435
|
export declare function readStates(element: Element): readonly string[];
|
|
2058
2436
|
|
|
2059
2437
|
/**
|
|
2060
|
-
* Reads one resolved CSS property from a real browser element.
|
|
2438
|
+
* Reads one resolved CSS property from a real browser element or a named pseudo-element.
|
|
2061
2439
|
*
|
|
2062
2440
|
* @param element - The element whose resolved style to inspect.
|
|
2063
2441
|
* @param property - The CSS property name, registered or custom.
|
|
2442
|
+
* @param pseudo - The pseudo-element selector. Omit it to read the element itself.
|
|
2064
2443
|
* @returns The browser's resolved property value, trimmed; an empty string when the element resolves
|
|
2065
2444
|
* none.
|
|
2445
|
+
* @throws Thrown when the pseudo argument lacks the `::` prefix or the engine does not support it.
|
|
2066
2446
|
*
|
|
2067
2447
|
* @remarks
|
|
2068
2448
|
* The value is trimmed, so what comes back is the value and never the whitespace around it. Internal
|
|
@@ -2073,7 +2453,7 @@ export declare function readStates(element: Element): readonly string[];
|
|
|
2073
2453
|
* readStyle(button, 'padding-left')
|
|
2074
2454
|
* ```
|
|
2075
2455
|
*/
|
|
2076
|
-
export declare function readStyle(element: Element, property: string): string;
|
|
2456
|
+
export declare function readStyle(element: Element, property: string, pseudo?: string): string;
|
|
2077
2457
|
|
|
2078
2458
|
/**
|
|
2079
2459
|
* Reads one element's rendered text the way a name computation reads it.
|
|
@@ -2139,6 +2519,27 @@ export declare function readToken(element: Element, name: string): string;
|
|
|
2139
2519
|
*/
|
|
2140
2520
|
export declare function readValue(role: string, name: string): string;
|
|
2141
2521
|
|
|
2522
|
+
/**
|
|
2523
|
+
* Restores the media readings observed before the first stage as explicit emulation. With nothing
|
|
2524
|
+
* staged, clears every override and waits for a stable reading, not a proved engine baseline. Checks
|
|
2525
|
+
* the budget between polls, so a frame that never paints is not bounded by it.
|
|
2526
|
+
*
|
|
2527
|
+
* @returns A promise resolving after the media readings settle.
|
|
2528
|
+
* @throws Thrown when a media read-back exhausts its 1000 millisecond budget between polls.
|
|
2529
|
+
*
|
|
2530
|
+
* @remarks
|
|
2531
|
+
* Restores print, reduced motion, colour scheme, and forced colours from {@link MEDIA_STAGE},
|
|
2532
|
+
* waits per axis for the recorded value, and removes the marker after every axis agrees. With no
|
|
2533
|
+
* marker, sends the empty reset and compares readings taken strictly after that send. Each poll
|
|
2534
|
+
* waits for a frame; the interval is 10 milliseconds. The provider must expose a DevTools session.
|
|
2535
|
+
*
|
|
2536
|
+
* @example
|
|
2537
|
+
* ```ts
|
|
2538
|
+
* await releaseMedia()
|
|
2539
|
+
* ```
|
|
2540
|
+
*/
|
|
2541
|
+
export declare function releaseMedia(): Promise<void>;
|
|
2542
|
+
|
|
2142
2543
|
/**
|
|
2143
2544
|
* Hands the tester pane back to the runner's own layout, at the viewport it had before staging.
|
|
2144
2545
|
*
|
|
@@ -2168,6 +2569,26 @@ export declare function readValue(role: string, name: string): string;
|
|
|
2168
2569
|
*/
|
|
2169
2570
|
export declare function releasePane(): Promise<void>;
|
|
2170
2571
|
|
|
2572
|
+
/**
|
|
2573
|
+
* Releases a held pointer and parks it at the page origin, clearing hover.
|
|
2574
|
+
*
|
|
2575
|
+
* @returns A promise resolving after the released pointer's frame paints.
|
|
2576
|
+
* @throws Thrown when the release or the park rejects. If both reject, the aggregate carries the
|
|
2577
|
+
* park rejection as its cause and the release rejection in its errors.
|
|
2578
|
+
*
|
|
2579
|
+
* @remarks
|
|
2580
|
+
* An idle pointer sends no button release. Calling this after an explicit release is safe in an
|
|
2581
|
+
* `afterEach` hook. A rejected release keeps the marker for a later retry. The pointer still moves
|
|
2582
|
+
* to the origin in cleanup, and a rejection there joins the aggregate described under `@throws`.
|
|
2583
|
+
* The provider must expose a DevTools session.
|
|
2584
|
+
*
|
|
2585
|
+
* @example
|
|
2586
|
+
* ```ts
|
|
2587
|
+
* await releasePointer()
|
|
2588
|
+
* ```
|
|
2589
|
+
*/
|
|
2590
|
+
export declare function releasePointer(): Promise<void>;
|
|
2591
|
+
|
|
2171
2592
|
/**
|
|
2172
2593
|
* Deletes one IndexedDB database and reports what the request actually did.
|
|
2173
2594
|
*
|
|
@@ -2271,6 +2692,28 @@ export declare function resolveAccessible(name: string): HTMLElement;
|
|
|
2271
2692
|
*/
|
|
2272
2693
|
export declare function resolveAccessible(role: string, name: string): HTMLElement;
|
|
2273
2694
|
|
|
2695
|
+
/**
|
|
2696
|
+
* Resolves one human-reachable control by role and accessible-name text inside a named region.
|
|
2697
|
+
*
|
|
2698
|
+
* @param region - The containing region's exact accessible name.
|
|
2699
|
+
* @param role - The control's exact ARIA role.
|
|
2700
|
+
* @param name - The rendered accessible-name text that identifies the control in that region.
|
|
2701
|
+
* @returns The one reachable element carrying that role and name inside the region.
|
|
2702
|
+
* @throws When the named control is absent, unreachable, or ambiguous inside the region.
|
|
2703
|
+
*
|
|
2704
|
+
* @remarks
|
|
2705
|
+
* The region's name is matched exactly and the control's name loosely, over a computed name that
|
|
2706
|
+
* includes hidden subtrees, so a glyph joins the text rather than displacing it. One pass answers
|
|
2707
|
+
* this: a control the region cannot reach is refused whether it is absent or hidden. This is the
|
|
2708
|
+
* resolver the region-scoped verbs share.
|
|
2709
|
+
*
|
|
2710
|
+
* @example
|
|
2711
|
+
* ```ts
|
|
2712
|
+
* resolveAccessibleWithin('Ledger', 'button', 'Monthly income')
|
|
2713
|
+
* ```
|
|
2714
|
+
*/
|
|
2715
|
+
export declare function resolveAccessibleWithin(region: string, role: string, name: string): HTMLElement;
|
|
2716
|
+
|
|
2274
2717
|
/**
|
|
2275
2718
|
* Resolves one rendered, focus-reachable interactive element without requiring it to intersect the
|
|
2276
2719
|
* viewport yet.
|
|
@@ -2300,6 +2743,49 @@ export declare function resolveAccessible(role: string, name: string): HTMLEleme
|
|
|
2300
2743
|
*/
|
|
2301
2744
|
export declare function resolveRendered(first: string, second?: string): HTMLElement;
|
|
2302
2745
|
|
|
2746
|
+
/**
|
|
2747
|
+
* Sends one DevTools protocol command through the browser provider.
|
|
2748
|
+
*
|
|
2749
|
+
* @param method - The protocol method name.
|
|
2750
|
+
* @param params - The protocol parameters.
|
|
2751
|
+
* @returns A promise resolving after the command completes, discarding its response.
|
|
2752
|
+
* @throws Thrown when the provider exposes no DevTools session, or the command fails.
|
|
2753
|
+
*
|
|
2754
|
+
* @example
|
|
2755
|
+
* ```ts
|
|
2756
|
+
* await sendProtocol('Emulation.setEmulatedMedia', { media: '', features: [] })
|
|
2757
|
+
* ```
|
|
2758
|
+
*/
|
|
2759
|
+
export declare function sendProtocol(method: string, params: Readonly<Record<string, unknown>>): Promise<void>;
|
|
2760
|
+
|
|
2761
|
+
/**
|
|
2762
|
+
* Stages the tester's print medium, motion preference, and forced colours through the browser
|
|
2763
|
+
* provider.
|
|
2764
|
+
*
|
|
2765
|
+
* @param options - The media axes to override.
|
|
2766
|
+
* @returns A promise resolving after a bounded read-back for `print: true`, either `motion` value,
|
|
2767
|
+
* and either `forced` value. A `print: false` stage is sent and followed by a frame wait without a
|
|
2768
|
+
* read-back.
|
|
2769
|
+
* @throws Thrown when no axis is supplied or a staged query does not reach the tester.
|
|
2770
|
+
*
|
|
2771
|
+
* @remarks
|
|
2772
|
+
* If `print` is true, uses print; if false, uses screen. If `motion` is true, uses no preference;
|
|
2773
|
+
* if false, uses reduced motion. If `forced` is true, uses active forced colours; if false, uses
|
|
2774
|
+
* none. The print medium, reduced motion, colour scheme, and forced colours keep their effective
|
|
2775
|
+
* readings when omitted. Any other emulated feature the provider configured
|
|
2776
|
+
* is cleared. Each staged query waits up to 1000 milliseconds, polling every 10 milliseconds.
|
|
2777
|
+
* A refused read-back restores the carried pre-call readings before throwing and can take two
|
|
2778
|
+
* budgets. A restoration failure is attached as the refusal's cause. Register
|
|
2779
|
+
* {@link releaseMedia} in teardown; it restores the readings observed before the first stage.
|
|
2780
|
+
*
|
|
2781
|
+
* @example
|
|
2782
|
+
* ```ts
|
|
2783
|
+
* await stageMedia({ motion: false, print: true })
|
|
2784
|
+
* await releaseMedia()
|
|
2785
|
+
* ```
|
|
2786
|
+
*/
|
|
2787
|
+
export declare function stageMedia(options: MediaOptions): Promise<void>;
|
|
2788
|
+
|
|
2303
2789
|
/**
|
|
2304
2790
|
* Sets the tester's viewport and renders the runner's pane at the size that viewport claims.
|
|
2305
2791
|
*
|
|
@@ -2394,6 +2880,9 @@ export declare interface StorageOptions {
|
|
|
2394
2880
|
* @returns The target after the browser moves focus to it.
|
|
2395
2881
|
* @throws When one complete traversal cannot reach the target.
|
|
2396
2882
|
*
|
|
2883
|
+
* @remarks
|
|
2884
|
+
* The loop is {@link driveTraversal} over {@link resolveRendered}.
|
|
2885
|
+
*
|
|
2397
2886
|
* @example
|
|
2398
2887
|
* ```ts
|
|
2399
2888
|
* await traverseAccessible('Evaluate')
|
|
@@ -2401,6 +2890,27 @@ export declare interface StorageOptions {
|
|
|
2401
2890
|
*/
|
|
2402
2891
|
export declare function traverseAccessible(name: string): Promise<HTMLElement>;
|
|
2403
2892
|
|
|
2893
|
+
/**
|
|
2894
|
+
* Reaches a control by role and accessible-name text inside a named region, only through natural
|
|
2895
|
+
* forward Tab traversal from the current focus.
|
|
2896
|
+
*
|
|
2897
|
+
* @param region - The containing region's exact accessible name.
|
|
2898
|
+
* @param role - The control's exact ARIA role.
|
|
2899
|
+
* @param name - The rendered accessible-name text that identifies the control in that region.
|
|
2900
|
+
* @returns The target after the browser moves focus to it.
|
|
2901
|
+
* @throws When the region refuses the target, or one complete traversal cannot reach it.
|
|
2902
|
+
*
|
|
2903
|
+
* @remarks
|
|
2904
|
+
* The resolution is {@link resolveAccessibleWithin} and the loop is {@link driveTraversal}, so a
|
|
2905
|
+
* twin of the same name earlier in the tab order is passed over rather than reached.
|
|
2906
|
+
*
|
|
2907
|
+
* @example
|
|
2908
|
+
* ```ts
|
|
2909
|
+
* await traverseAccessibleWithin('Ledger', 'button', 'Evaluate')
|
|
2910
|
+
* ```
|
|
2911
|
+
*/
|
|
2912
|
+
export declare function traverseAccessibleWithin(region: string, role: string, name: string): Promise<HTMLElement>;
|
|
2913
|
+
|
|
2404
2914
|
/**
|
|
2405
2915
|
* Replaces a named field's value through focus, select-all, deletion, and real keystrokes.
|
|
2406
2916
|
*
|