@orkestrel/test 0.0.18 → 0.0.19
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 +403 -16
- package/dist/src/browser/index.js +621 -44
- 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
|
*
|
|
@@ -1092,6 +1279,75 @@ export declare interface HarnessOptions<TState extends string, TEvent extends st
|
|
|
1092
1279
|
*/
|
|
1093
1280
|
export declare const HEADER_ROLES: Readonly<Record<string, string>>;
|
|
1094
1281
|
|
|
1282
|
+
/**
|
|
1283
|
+
* Holds the primary pointer button on one visible, focus-reachable control by its accessible name.
|
|
1284
|
+
*
|
|
1285
|
+
* @param name - The target's exact accessible name.
|
|
1286
|
+
* @returns A promise resolving after the control enters its pressed state.
|
|
1287
|
+
* @throws Thrown when the resolver refuses the target, a pointer is already held, or the press
|
|
1288
|
+
* misses. A missed press that also fails to release carries the release rejection as its cause.
|
|
1289
|
+
*
|
|
1290
|
+
* @remarks
|
|
1291
|
+
* The centre maps through the tester iframe's painted scale into page coordinates. The `:active`
|
|
1292
|
+
* reading verifies delivery. A missed press releases before refusing; if that release also
|
|
1293
|
+
* rejects, the refusal carries it as its cause. Register {@link releasePointer} in teardown
|
|
1294
|
+
* before holding; release can produce a click on the pressed control. A rejected button-down send
|
|
1295
|
+
* leaves no hold marker.
|
|
1296
|
+
*
|
|
1297
|
+
* @example
|
|
1298
|
+
* ```ts
|
|
1299
|
+
* await holdAccessible('Apply')
|
|
1300
|
+
* await releasePointer()
|
|
1301
|
+
* ```
|
|
1302
|
+
*/
|
|
1303
|
+
export declare function holdAccessible(name: string): Promise<void>;
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* Holds the primary pointer button on one control by its exact ARIA role and accessible name.
|
|
1307
|
+
*
|
|
1308
|
+
* @param role - The control's exact ARIA role.
|
|
1309
|
+
* @param name - The target's exact accessible name.
|
|
1310
|
+
* @returns A promise resolving after the control enters its pressed state.
|
|
1311
|
+
* @throws Thrown when the resolver refuses the target, a pointer is already held, or the press
|
|
1312
|
+
* misses. A missed press that also fails to release carries the release rejection as its cause.
|
|
1313
|
+
*
|
|
1314
|
+
* @example
|
|
1315
|
+
* ```ts
|
|
1316
|
+
* await holdAccessible('tab', 'Drafts')
|
|
1317
|
+
* await releasePointer()
|
|
1318
|
+
* ```
|
|
1319
|
+
*/
|
|
1320
|
+
export declare function holdAccessible(role: string, name: string): Promise<void>;
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Hovers one visible, focus-reachable control by its accessible name through the browser provider.
|
|
1324
|
+
*
|
|
1325
|
+
* @param name - The target's exact accessible name.
|
|
1326
|
+
* @returns A promise resolving after the pointer reaches the control.
|
|
1327
|
+
* @throws Thrown when the resolver refuses the target.
|
|
1328
|
+
*
|
|
1329
|
+
* @example
|
|
1330
|
+
* ```ts
|
|
1331
|
+
* await hoverAccessible('Apply')
|
|
1332
|
+
* ```
|
|
1333
|
+
*/
|
|
1334
|
+
export declare function hoverAccessible(name: string): Promise<void>;
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Hovers one visible, focus-reachable control by its exact ARIA role and accessible name.
|
|
1338
|
+
*
|
|
1339
|
+
* @param role - The control's exact ARIA role.
|
|
1340
|
+
* @param name - The target's exact accessible name.
|
|
1341
|
+
* @returns A promise resolving after the pointer reaches the control.
|
|
1342
|
+
* @throws Thrown when the resolver refuses the target.
|
|
1343
|
+
*
|
|
1344
|
+
* @example
|
|
1345
|
+
* ```ts
|
|
1346
|
+
* await hoverAccessible('tab', 'Drafts')
|
|
1347
|
+
* ```
|
|
1348
|
+
*/
|
|
1349
|
+
export declare function hoverAccessible(role: string, name: string): Promise<void>;
|
|
1350
|
+
|
|
1095
1351
|
/**
|
|
1096
1352
|
* Names the role each listed tag carries in the accessibility tree when it declares none of its
|
|
1097
1353
|
* own.
|
|
@@ -1352,6 +1608,23 @@ export declare function measureContrast(front: Color, back: Color): number;
|
|
|
1352
1608
|
*/
|
|
1353
1609
|
export declare function measureLuminance(color: Color): number;
|
|
1354
1610
|
|
|
1611
|
+
/**
|
|
1612
|
+
* Names the tester root's attribute holding the media readings observed before the first stage.
|
|
1613
|
+
*
|
|
1614
|
+
* @remarks
|
|
1615
|
+
* The value is a bit string in print, reduced motion, dark colour scheme, and forced colours order.
|
|
1616
|
+
* Each bit is `1` for a matching query and `0` otherwise, for example `0100`.
|
|
1617
|
+
*/
|
|
1618
|
+
export declare const MEDIA_STAGE = "data-media-stage";
|
|
1619
|
+
|
|
1620
|
+
/** Configures the tester's print medium and motion preference. */
|
|
1621
|
+
export declare interface MediaOptions {
|
|
1622
|
+
/** Determines whether the tester lays out for print. Omit it to leave the medium alone. */
|
|
1623
|
+
readonly print?: boolean;
|
|
1624
|
+
/** Determines whether the tester prefers motion. Omit it to leave the preference alone. */
|
|
1625
|
+
readonly motion?: boolean;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1355
1628
|
/**
|
|
1356
1629
|
* Puts one element into the document and hands it straight back.
|
|
1357
1630
|
*
|
|
@@ -1382,18 +1655,19 @@ export declare function measureLuminance(color: Color): number;
|
|
|
1382
1655
|
export declare function mount<T extends Element>(element: T): T;
|
|
1383
1656
|
|
|
1384
1657
|
/**
|
|
1385
|
-
* Parses
|
|
1658
|
+
* Parses computed CSS Color 4 values into clipped straight sRGB channels.
|
|
1386
1659
|
*
|
|
1387
|
-
* @param value - A computed `rgb()`, `rgba()`, or `color(
|
|
1388
|
-
* @returns
|
|
1660
|
+
* @param value - A computed `rgb()`, `rgba()`, `oklab()`, `oklch()`, `lab()`, `lch()`, or `color()` value.
|
|
1661
|
+
* @returns Frozen channels, or `undefined` for an unsupported syntax or non-finite channel.
|
|
1389
1662
|
*
|
|
1390
1663
|
* @remarks
|
|
1391
|
-
*
|
|
1392
|
-
*
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
1664
|
+
* Reads signed channels, scientific notation, percentage lightness, degree hues, and `none` as
|
|
1665
|
+
* zero. The `color()` spaces are `srgb`, `srgb-linear`, `display-p3`, `a98-rgb`, `prophoto-rgb`,
|
|
1666
|
+
* `rec2020`, `xyz`, `xyz-d50`, and `xyz-d65`. Conversion uses the CSS Color 4 matrices and white
|
|
1667
|
+
* point adaptation, then clips each encoded sRGB channel to 0–255 rather than gamut-mapping it.
|
|
1668
|
+
* Alpha is clipped to 0–1. Keywords, hex colors, unresolved expressions, and non-finite calculations
|
|
1669
|
+
* such as `color(srgb calc(infinity) 0 0)` remain unreadable; use {@link parseCSSColor} to resolve
|
|
1670
|
+
* ordinary authored expressions through the cascade.
|
|
1397
1671
|
*
|
|
1398
1672
|
* @example
|
|
1399
1673
|
* ```ts
|
|
@@ -1407,7 +1681,7 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1407
1681
|
* Resolves any CSS color expression to straight sRGB channels, by asking the browser.
|
|
1408
1682
|
*
|
|
1409
1683
|
* @param value - Any value the `color` property accepts: a keyword, a hex triple, a `var()`
|
|
1410
|
-
* reference, a `color-mix()`, or
|
|
1684
|
+
* reference, a `color-mix()`, or a computed CSS Color 4 value.
|
|
1411
1685
|
* @returns The resolved color's channels, or `undefined` when the CSSOM refuses the value or the
|
|
1412
1686
|
* computed result names no color {@link parseColor} speaks.
|
|
1413
1687
|
*
|
|
@@ -1417,6 +1691,8 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1417
1691
|
* cascade, and reads back what the engine computed — which is the only way a keyword, a hex triple,
|
|
1418
1692
|
* or a `var()` reference becomes channels at all. The read itself goes through `parseColor`, so both
|
|
1419
1693
|
* halves agree on what a computed value means.
|
|
1694
|
+
* Modern perceptual and predefined RGB/XYZ spaces resolve through that parser's conversions;
|
|
1695
|
+
* out-of-gamut sRGB channels are clipped to 0–255 after conversion.
|
|
1420
1696
|
*
|
|
1421
1697
|
* The probe is mounted, because an unmounted element inherits nothing and a `var()` reference to a
|
|
1422
1698
|
* token declared on `:root` would resolve to the initial value instead. It is removed in a `finally`,
|
|
@@ -1435,6 +1711,15 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1435
1711
|
*/
|
|
1436
1712
|
export declare function parseCSSColor(value: string): Color | undefined;
|
|
1437
1713
|
|
|
1714
|
+
/**
|
|
1715
|
+
* Names the tester root's attribute holding the pressed pointer's page coordinates.
|
|
1716
|
+
*
|
|
1717
|
+
* @remarks
|
|
1718
|
+
* The value has the form `<x>x<y>`. The release removes it only after the button-up send resolves,
|
|
1719
|
+
* so a rejected send keeps the marker for a retry.
|
|
1720
|
+
*/
|
|
1721
|
+
export declare const POINTER_HOLD = "data-pointer-hold";
|
|
1722
|
+
|
|
1438
1723
|
/** Holds the registry of capture states one run places, and the files it wrote placing them. */
|
|
1439
1724
|
export declare interface PortfolioInterface {
|
|
1440
1725
|
/** Holds the name of the variant this run renders. */
|
|
@@ -1513,10 +1798,13 @@ export declare function pressKeys(keys: string): Promise<void>;
|
|
|
1513
1798
|
* @param element - The element whose backdrop to resolve.
|
|
1514
1799
|
* @param floor - The opaque color the walk ends on when nothing above it paints.
|
|
1515
1800
|
* @returns The composited color a reader sees behind the element.
|
|
1801
|
+
* @throws Thrown when the backdrop contains an unreadable painted color layer.
|
|
1516
1802
|
*
|
|
1517
1803
|
* @remarks
|
|
1518
1804
|
* The layers {@link readLayers} collects composite top-over-bottom onto the floor, so a 3% surface
|
|
1519
1805
|
* tint reads as a tint over what shows through it rather than as a full-strength paint.
|
|
1806
|
+
* Those layers include the modern CSS Color 4 spaces, converted and clipped to sRGB by
|
|
1807
|
+
* {@link parseColor}; an unreadable painted layer refuses the entire reading.
|
|
1520
1808
|
*
|
|
1521
1809
|
* The floor is required, because this leaf never guesses what a document sits on. Pass
|
|
1522
1810
|
* {@link CANVAS_COLOR} for the page a browser paints behind an unstyled document, or the color of
|
|
@@ -1620,7 +1908,8 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1620
1908
|
* would show through instead of assuming one.
|
|
1621
1909
|
* @returns The relative-luminance contrast ratio.
|
|
1622
1910
|
* @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.
|
|
1911
|
+
* — when the walk from the element upwards reaches no opaque layer. An unreadable painted
|
|
1912
|
+
* background layer throws even when a floor is supplied.
|
|
1624
1913
|
*
|
|
1625
1914
|
* @remarks
|
|
1626
1915
|
* A transparent or translucent background resolves through the element's ancestors: every painted
|
|
@@ -1628,6 +1917,8 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1628
1917
|
* base, so a 3% surface tint reads as a tint over what shows through it rather than as a
|
|
1629
1918
|
* full-strength paint. A translucent foreground then resolves against that effective background
|
|
1630
1919
|
* before luminance is measured.
|
|
1920
|
+
* Text and background colors can use the modern CSS Color 4 spaces {@link parseColor} reads;
|
|
1921
|
+
* each is converted to sRGB and clipped before composition and luminance measurement.
|
|
1631
1922
|
*
|
|
1632
1923
|
* With `floor` omitted, the walk from the target upwards must reach a fully opaque layer: the
|
|
1633
1924
|
* measurement throws rather than assuming a white canvas wherever that canvas would still be part
|
|
@@ -1646,7 +1937,7 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1646
1937
|
* ```ts
|
|
1647
1938
|
* const container = render('<p style="background: #000; color: #fff">Ready</p>')
|
|
1648
1939
|
* readContrast(requireValue(container.firstElementChild)) // 21
|
|
1649
|
-
* readContrast(requireValue(container.firstElementChild), CANVAS_COLOR) // 21
|
|
1940
|
+
* readContrast(requireValue(container.firstElementChild), CANVAS_COLOR) // 21
|
|
1650
1941
|
* ```
|
|
1651
1942
|
*/
|
|
1652
1943
|
export declare function readContrast(element: Element, floor?: Color): number;
|
|
@@ -1750,16 +2041,23 @@ export declare function readFrame(path: string): Promise<FrameReading>;
|
|
|
1750
2041
|
export declare function readHit(element: Element): Element | undefined;
|
|
1751
2042
|
|
|
1752
2043
|
/**
|
|
1753
|
-
* Collects
|
|
2044
|
+
* Collects readable background color layers and refuses an unreadable painted layer.
|
|
1754
2045
|
*
|
|
1755
2046
|
* @param element - The element to walk up from.
|
|
1756
2047
|
* @returns Every layer the walk paints, the element's own first and the deepest last.
|
|
2048
|
+
* @throws Thrown when a painted background color is unreadable; the error names the element and
|
|
2049
|
+
* its computed value.
|
|
1757
2050
|
*
|
|
1758
2051
|
* @remarks
|
|
1759
2052
|
* A surface token paints one ancestor while every element between it and the text paints nothing,
|
|
1760
2053
|
* so a backdrop is found by walking up rather than by reading the element's own `background-color`,
|
|
1761
2054
|
* which is almost always transparent. A fully transparent layer paints nothing and is left out, and
|
|
1762
2055
|
* the walk stops at the first fully opaque layer, because nothing above that layer is visible.
|
|
2056
|
+
* Legacy and modern CSS Color 4 values resolve through {@link parseColor}, with sRGB channels
|
|
2057
|
+
* clipped after conversion. Non-finite calculations such as `color(srgb calc(infinity) 0 0)` are
|
|
2058
|
+
* deliberately unreadable. An unreadable value with an explicit zero alpha paints nothing and is
|
|
2059
|
+
* skipped. An empty detached-element reading paints nothing too. Background images remain outside
|
|
2060
|
+
* this color reader.
|
|
1763
2061
|
*
|
|
1764
2062
|
* The stack is what tells a resolved backdrop from an assumed one: the walk reached an opaque
|
|
1765
2063
|
* surface exactly when its last layer's alpha is `1`. {@link readContrast} refuses on that reading,
|
|
@@ -1844,7 +2142,9 @@ export declare function readPerception(name: string): string;
|
|
|
1844
2142
|
*
|
|
1845
2143
|
* @param element - The element whose resolved style to inspect.
|
|
1846
2144
|
* @param property - The CSS property name, registered or custom.
|
|
2145
|
+
* @param pseudo - The pseudo-element selector. Omit it to read the element itself.
|
|
1847
2146
|
* @returns The leading numeric part of the resolved value, and `0` when it carries none.
|
|
2147
|
+
* @throws Thrown when the pseudo argument lacks the `::` prefix or the engine does not support it.
|
|
1848
2148
|
*
|
|
1849
2149
|
* @remarks
|
|
1850
2150
|
* A resolved length is text with a unit — `'12px'` — so this reads the number in front of the unit
|
|
@@ -1862,7 +2162,7 @@ export declare function readPerception(name: string): string;
|
|
|
1862
2162
|
* readPixels(button, 'width') // 0 when the width resolves to `auto`
|
|
1863
2163
|
* ```
|
|
1864
2164
|
*/
|
|
1865
|
-
export declare function readPixels(element: Element, property: string): number;
|
|
2165
|
+
export declare function readPixels(element: Element, property: string, pseudo?: string): number;
|
|
1866
2166
|
|
|
1867
2167
|
/**
|
|
1868
2168
|
* Reads the refusal one named target answers with, or nothing when it resolves.
|
|
@@ -1914,6 +2214,7 @@ export declare function readRefusal(role: string, name: string): string | undefi
|
|
|
1914
2214
|
* @param worn - The element the control's focus chrome is painted onto. Default: `control`.
|
|
1915
2215
|
* @returns The strongest ratio the painted focus chrome reaches, or `undefined` when the control is
|
|
1916
2216
|
* not showing `:focus-visible` or the cascade paints no chrome of its own.
|
|
2217
|
+
* @throws Thrown when the focused control's backdrop contains an unreadable painted color layer.
|
|
1917
2218
|
*
|
|
1918
2219
|
* @remarks
|
|
1919
2220
|
* This reads and never acts. Focus arrives through the published verbs — `traverseAccessible`,
|
|
@@ -1937,6 +2238,9 @@ export declare function readRefusal(role: string, name: string): string | undefi
|
|
|
1937
2238
|
* color names neither. A focus style that only changes the control's own fill reports `undefined`
|
|
1938
2239
|
* too: the resting fill is gone by the time focus is on the control, and this never moves focus to
|
|
1939
2240
|
* go and read it.
|
|
2241
|
+
* Outline and shadow colors include `oklch()`, `oklab()`, `lab()`, `lch()`, and predefined
|
|
2242
|
+
* `color()` spaces. Each readable color converts to clipped sRGB through {@link parseColor}, and
|
|
2243
|
+
* the result remains a contrast ratio rather than a ring width.
|
|
1940
2244
|
*
|
|
1941
2245
|
* @example
|
|
1942
2246
|
* ```ts
|
|
@@ -2057,12 +2361,14 @@ export declare function readRules(): readonly CSSRule[];
|
|
|
2057
2361
|
export declare function readStates(element: Element): readonly string[];
|
|
2058
2362
|
|
|
2059
2363
|
/**
|
|
2060
|
-
* Reads one resolved CSS property from a real browser element.
|
|
2364
|
+
* Reads one resolved CSS property from a real browser element or a named pseudo-element.
|
|
2061
2365
|
*
|
|
2062
2366
|
* @param element - The element whose resolved style to inspect.
|
|
2063
2367
|
* @param property - The CSS property name, registered or custom.
|
|
2368
|
+
* @param pseudo - The pseudo-element selector. Omit it to read the element itself.
|
|
2064
2369
|
* @returns The browser's resolved property value, trimmed; an empty string when the element resolves
|
|
2065
2370
|
* none.
|
|
2371
|
+
* @throws Thrown when the pseudo argument lacks the `::` prefix or the engine does not support it.
|
|
2066
2372
|
*
|
|
2067
2373
|
* @remarks
|
|
2068
2374
|
* The value is trimmed, so what comes back is the value and never the whitespace around it. Internal
|
|
@@ -2073,7 +2379,7 @@ export declare function readStates(element: Element): readonly string[];
|
|
|
2073
2379
|
* readStyle(button, 'padding-left')
|
|
2074
2380
|
* ```
|
|
2075
2381
|
*/
|
|
2076
|
-
export declare function readStyle(element: Element, property: string): string;
|
|
2382
|
+
export declare function readStyle(element: Element, property: string, pseudo?: string): string;
|
|
2077
2383
|
|
|
2078
2384
|
/**
|
|
2079
2385
|
* Reads one element's rendered text the way a name computation reads it.
|
|
@@ -2139,6 +2445,27 @@ export declare function readToken(element: Element, name: string): string;
|
|
|
2139
2445
|
*/
|
|
2140
2446
|
export declare function readValue(role: string, name: string): string;
|
|
2141
2447
|
|
|
2448
|
+
/**
|
|
2449
|
+
* Restores the media readings observed before the first stage as explicit emulation. With nothing
|
|
2450
|
+
* staged, clears every override and waits for a stable reading, not a proved engine baseline. Checks
|
|
2451
|
+
* the budget between polls, so a frame that never paints is not bounded by it.
|
|
2452
|
+
*
|
|
2453
|
+
* @returns A promise resolving after the media readings settle.
|
|
2454
|
+
* @throws Thrown when a media read-back exhausts its 1000 millisecond budget between polls.
|
|
2455
|
+
*
|
|
2456
|
+
* @remarks
|
|
2457
|
+
* Restores print, reduced motion, colour scheme, and forced colours from {@link MEDIA_STAGE},
|
|
2458
|
+
* waits per axis for the recorded value, and removes the marker after every axis agrees. With no
|
|
2459
|
+
* marker, sends the empty reset and compares readings taken strictly after that send. Each poll
|
|
2460
|
+
* waits for a frame; the interval is 10 milliseconds. The provider must expose a DevTools session.
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* ```ts
|
|
2464
|
+
* await releaseMedia()
|
|
2465
|
+
* ```
|
|
2466
|
+
*/
|
|
2467
|
+
export declare function releaseMedia(): Promise<void>;
|
|
2468
|
+
|
|
2142
2469
|
/**
|
|
2143
2470
|
* Hands the tester pane back to the runner's own layout, at the viewport it had before staging.
|
|
2144
2471
|
*
|
|
@@ -2168,6 +2495,26 @@ export declare function readValue(role: string, name: string): string;
|
|
|
2168
2495
|
*/
|
|
2169
2496
|
export declare function releasePane(): Promise<void>;
|
|
2170
2497
|
|
|
2498
|
+
/**
|
|
2499
|
+
* Releases a held pointer and parks it at the page origin, clearing hover.
|
|
2500
|
+
*
|
|
2501
|
+
* @returns A promise resolving after the released pointer's frame paints.
|
|
2502
|
+
* @throws Thrown when the release or the park rejects. If both reject, the aggregate carries the
|
|
2503
|
+
* park rejection as its cause and the release rejection in its errors.
|
|
2504
|
+
*
|
|
2505
|
+
* @remarks
|
|
2506
|
+
* An idle pointer sends no button release. Calling this after an explicit release is safe in an
|
|
2507
|
+
* `afterEach` hook. A rejected release keeps the marker for a later retry. The pointer still moves
|
|
2508
|
+
* to the origin in cleanup, and a rejection there joins the aggregate described under `@throws`.
|
|
2509
|
+
* The provider must expose a DevTools session.
|
|
2510
|
+
*
|
|
2511
|
+
* @example
|
|
2512
|
+
* ```ts
|
|
2513
|
+
* await releasePointer()
|
|
2514
|
+
* ```
|
|
2515
|
+
*/
|
|
2516
|
+
export declare function releasePointer(): Promise<void>;
|
|
2517
|
+
|
|
2171
2518
|
/**
|
|
2172
2519
|
* Deletes one IndexedDB database and reports what the request actually did.
|
|
2173
2520
|
*
|
|
@@ -2300,6 +2647,46 @@ export declare function resolveAccessible(role: string, name: string): HTMLEleme
|
|
|
2300
2647
|
*/
|
|
2301
2648
|
export declare function resolveRendered(first: string, second?: string): HTMLElement;
|
|
2302
2649
|
|
|
2650
|
+
/**
|
|
2651
|
+
* Sends one DevTools protocol command through the browser provider.
|
|
2652
|
+
*
|
|
2653
|
+
* @param method - The protocol method name.
|
|
2654
|
+
* @param params - The protocol parameters.
|
|
2655
|
+
* @returns A promise resolving after the command completes, discarding its response.
|
|
2656
|
+
* @throws Thrown when the provider exposes no DevTools session, or the command fails.
|
|
2657
|
+
*
|
|
2658
|
+
* @example
|
|
2659
|
+
* ```ts
|
|
2660
|
+
* await sendProtocol('Emulation.setEmulatedMedia', { media: '', features: [] })
|
|
2661
|
+
* ```
|
|
2662
|
+
*/
|
|
2663
|
+
export declare function sendProtocol(method: string, params: Readonly<Record<string, unknown>>): Promise<void>;
|
|
2664
|
+
|
|
2665
|
+
/**
|
|
2666
|
+
* Stages the tester's print medium and motion preference through the browser provider.
|
|
2667
|
+
*
|
|
2668
|
+
* @param options - The media axes to override.
|
|
2669
|
+
* @returns A promise resolving after a bounded read-back for `print: true` and either
|
|
2670
|
+
* `motion` value. A `print: false` stage is sent and followed by a frame wait without a read-back.
|
|
2671
|
+
* @throws Thrown when no axis is supplied or a staged query does not reach the tester.
|
|
2672
|
+
*
|
|
2673
|
+
* @remarks
|
|
2674
|
+
* If `print` is true, uses print; if false, uses screen. If `motion` is true, uses no preference;
|
|
2675
|
+
* if false, uses reduced motion. The print medium, reduced motion, colour scheme, and forced colours
|
|
2676
|
+
* keep their effective readings when omitted. Any other emulated feature the provider configured
|
|
2677
|
+
* is cleared. Each staged query waits up to 1000 milliseconds, polling every 10 milliseconds.
|
|
2678
|
+
* A refused read-back restores the carried pre-call readings before throwing and can take two
|
|
2679
|
+
* budgets. A restoration failure is attached as the refusal's cause. Register
|
|
2680
|
+
* {@link releaseMedia} in teardown; it restores the readings observed before the first stage.
|
|
2681
|
+
*
|
|
2682
|
+
* @example
|
|
2683
|
+
* ```ts
|
|
2684
|
+
* await stageMedia({ motion: false, print: true })
|
|
2685
|
+
* await releaseMedia()
|
|
2686
|
+
* ```
|
|
2687
|
+
*/
|
|
2688
|
+
export declare function stageMedia(options: MediaOptions): Promise<void>;
|
|
2689
|
+
|
|
2303
2690
|
/**
|
|
2304
2691
|
* Sets the tester's viewport and renders the runner's pane at the size that viewport claims.
|
|
2305
2692
|
*
|