@orkestrel/test 0.0.17 → 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 +422 -18
- package/dist/src/browser/index.js +647 -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
|
*
|
|
@@ -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.
|
|
@@ -1133,8 +1389,9 @@ export declare function isOutsideViewport(rectangle: DOMRectReadOnly): boolean;
|
|
|
1133
1389
|
*
|
|
1134
1390
|
* @param element - The element to judge.
|
|
1135
1391
|
* @returns True if the element is connected, visible, laid out with a non-zero box, in the
|
|
1136
|
-
* sequential focus order, neither disabled nor marked `aria-disabled="true"`,
|
|
1137
|
-
* `[inert]` subtree
|
|
1392
|
+
* sequential focus order, neither disabled nor marked `aria-disabled="true"`, outside every
|
|
1393
|
+
* `[inert]` subtree, and inside every shown `[aria-modal="true"]` element its document carries;
|
|
1394
|
+
* false otherwise.
|
|
1138
1395
|
*
|
|
1139
1396
|
* @remarks
|
|
1140
1397
|
* This is the one reachability filter the layer applies. `resolveRendered`, `clickAccessibleWithin`,
|
|
@@ -1146,6 +1403,22 @@ export declare function isOutsideViewport(rectangle: DOMRectReadOnly): boolean;
|
|
|
1146
1403
|
* refuses it. Nothing here asks about the viewport: `resolveAccessible` scrolls a wholly
|
|
1147
1404
|
* off-viewport target into view and measures that separately with {@link isOutsideViewport}.
|
|
1148
1405
|
*
|
|
1406
|
+
* An open modal dialog takes the page behind it away, and the element's own facts cannot report
|
|
1407
|
+
* that: the covered control stays connected, laid out, focusable, and outside every `[inert]`
|
|
1408
|
+
* subtree while a pointer, a Tab, and a reader honouring `aria-modal` all stop at the dialog. So
|
|
1409
|
+
* this asks the document for its `[aria-modal="true"]` elements, puts each through
|
|
1410
|
+
* {@link isRendered}, and refuses the subject wherever a shown one does not contain it. A closed
|
|
1411
|
+
* dialog is hidden and excludes nothing, which is why the visibility reading is the announced one
|
|
1412
|
+
* rather than a bare `checkVisibility` call: a drawer parked at `visibility: hidden` is still laid
|
|
1413
|
+
* out. Nesting needs no separate rule, because an element inside the innermost dialog sits inside
|
|
1414
|
+
* every dialog around it.
|
|
1415
|
+
*
|
|
1416
|
+
* Containment follows the flat tree, so a subject inside a shadow tree is judged by its host chain
|
|
1417
|
+
* as well as itself and a dialog holding the host holds its shadow content too. Two arrangements
|
|
1418
|
+
* stay outside the read: a native `<dialog>` opened with `showModal` carries no `aria-modal`
|
|
1419
|
+
* attribute, and a dialog declared inside a shadow tree is not in what a document query returns.
|
|
1420
|
+
* Each leaves the page behind it reachable here.
|
|
1421
|
+
*
|
|
1149
1422
|
* Inside a shadow tree it answers for the element's own facts, in an open root and a closed one
|
|
1150
1423
|
* alike: the box, the focus order, `:disabled`, and `aria-disabled` are all the element's. The
|
|
1151
1424
|
* `[inert]` ancestor is the one read that stops at the boundary, because `closest` never leaves the
|
|
@@ -1335,6 +1608,23 @@ export declare function measureContrast(front: Color, back: Color): number;
|
|
|
1335
1608
|
*/
|
|
1336
1609
|
export declare function measureLuminance(color: Color): number;
|
|
1337
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
|
+
|
|
1338
1628
|
/**
|
|
1339
1629
|
* Puts one element into the document and hands it straight back.
|
|
1340
1630
|
*
|
|
@@ -1365,18 +1655,19 @@ export declare function measureLuminance(color: Color): number;
|
|
|
1365
1655
|
export declare function mount<T extends Element>(element: T): T;
|
|
1366
1656
|
|
|
1367
1657
|
/**
|
|
1368
|
-
* Parses
|
|
1658
|
+
* Parses computed CSS Color 4 values into clipped straight sRGB channels.
|
|
1369
1659
|
*
|
|
1370
|
-
* @param value - A computed `rgb()`, `rgba()`, or `color(
|
|
1371
|
-
* @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.
|
|
1372
1662
|
*
|
|
1373
1663
|
* @remarks
|
|
1374
|
-
*
|
|
1375
|
-
*
|
|
1376
|
-
*
|
|
1377
|
-
*
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
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.
|
|
1380
1671
|
*
|
|
1381
1672
|
* @example
|
|
1382
1673
|
* ```ts
|
|
@@ -1390,7 +1681,7 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1390
1681
|
* Resolves any CSS color expression to straight sRGB channels, by asking the browser.
|
|
1391
1682
|
*
|
|
1392
1683
|
* @param value - Any value the `color` property accepts: a keyword, a hex triple, a `var()`
|
|
1393
|
-
* reference, a `color-mix()`, or
|
|
1684
|
+
* reference, a `color-mix()`, or a computed CSS Color 4 value.
|
|
1394
1685
|
* @returns The resolved color's channels, or `undefined` when the CSSOM refuses the value or the
|
|
1395
1686
|
* computed result names no color {@link parseColor} speaks.
|
|
1396
1687
|
*
|
|
@@ -1400,6 +1691,8 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1400
1691
|
* cascade, and reads back what the engine computed — which is the only way a keyword, a hex triple,
|
|
1401
1692
|
* or a `var()` reference becomes channels at all. The read itself goes through `parseColor`, so both
|
|
1402
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.
|
|
1403
1696
|
*
|
|
1404
1697
|
* The probe is mounted, because an unmounted element inherits nothing and a `var()` reference to a
|
|
1405
1698
|
* token declared on `:root` would resolve to the initial value instead. It is removed in a `finally`,
|
|
@@ -1418,6 +1711,15 @@ export declare function parseColor(value: string): Color | undefined;
|
|
|
1418
1711
|
*/
|
|
1419
1712
|
export declare function parseCSSColor(value: string): Color | undefined;
|
|
1420
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
|
+
|
|
1421
1723
|
/** Holds the registry of capture states one run places, and the files it wrote placing them. */
|
|
1422
1724
|
export declare interface PortfolioInterface {
|
|
1423
1725
|
/** Holds the name of the variant this run renders. */
|
|
@@ -1496,10 +1798,13 @@ export declare function pressKeys(keys: string): Promise<void>;
|
|
|
1496
1798
|
* @param element - The element whose backdrop to resolve.
|
|
1497
1799
|
* @param floor - The opaque color the walk ends on when nothing above it paints.
|
|
1498
1800
|
* @returns The composited color a reader sees behind the element.
|
|
1801
|
+
* @throws Thrown when the backdrop contains an unreadable painted color layer.
|
|
1499
1802
|
*
|
|
1500
1803
|
* @remarks
|
|
1501
1804
|
* The layers {@link readLayers} collects composite top-over-bottom onto the floor, so a 3% surface
|
|
1502
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.
|
|
1503
1808
|
*
|
|
1504
1809
|
* The floor is required, because this leaf never guesses what a document sits on. Pass
|
|
1505
1810
|
* {@link CANVAS_COLOR} for the page a browser paints behind an unstyled document, or the color of
|
|
@@ -1603,7 +1908,8 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1603
1908
|
* would show through instead of assuming one.
|
|
1604
1909
|
* @returns The relative-luminance contrast ratio.
|
|
1605
1910
|
* @throws Thrown when the element exposes no computed foreground color, and — with `floor` omitted
|
|
1606
|
-
* — 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.
|
|
1607
1913
|
*
|
|
1608
1914
|
* @remarks
|
|
1609
1915
|
* A transparent or translucent background resolves through the element's ancestors: every painted
|
|
@@ -1611,6 +1917,8 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1611
1917
|
* base, so a 3% surface tint reads as a tint over what shows through it rather than as a
|
|
1612
1918
|
* full-strength paint. A translucent foreground then resolves against that effective background
|
|
1613
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.
|
|
1614
1922
|
*
|
|
1615
1923
|
* With `floor` omitted, the walk from the target upwards must reach a fully opaque layer: the
|
|
1616
1924
|
* measurement throws rather than assuming a white canvas wherever that canvas would still be part
|
|
@@ -1629,7 +1937,7 @@ export declare function readClasses(root: ParentNode): ReadonlySet<string>;
|
|
|
1629
1937
|
* ```ts
|
|
1630
1938
|
* const container = render('<p style="background: #000; color: #fff">Ready</p>')
|
|
1631
1939
|
* readContrast(requireValue(container.firstElementChild)) // 21
|
|
1632
|
-
* readContrast(requireValue(container.firstElementChild), CANVAS_COLOR) // 21
|
|
1940
|
+
* readContrast(requireValue(container.firstElementChild), CANVAS_COLOR) // 21
|
|
1633
1941
|
* ```
|
|
1634
1942
|
*/
|
|
1635
1943
|
export declare function readContrast(element: Element, floor?: Color): number;
|
|
@@ -1733,16 +2041,23 @@ export declare function readFrame(path: string): Promise<FrameReading>;
|
|
|
1733
2041
|
export declare function readHit(element: Element): Element | undefined;
|
|
1734
2042
|
|
|
1735
2043
|
/**
|
|
1736
|
-
* Collects
|
|
2044
|
+
* Collects readable background color layers and refuses an unreadable painted layer.
|
|
1737
2045
|
*
|
|
1738
2046
|
* @param element - The element to walk up from.
|
|
1739
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.
|
|
1740
2050
|
*
|
|
1741
2051
|
* @remarks
|
|
1742
2052
|
* A surface token paints one ancestor while every element between it and the text paints nothing,
|
|
1743
2053
|
* so a backdrop is found by walking up rather than by reading the element's own `background-color`,
|
|
1744
2054
|
* which is almost always transparent. A fully transparent layer paints nothing and is left out, and
|
|
1745
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.
|
|
1746
2061
|
*
|
|
1747
2062
|
* The stack is what tells a resolved backdrop from an assumed one: the walk reached an opaque
|
|
1748
2063
|
* surface exactly when its last layer's alpha is `1`. {@link readContrast} refuses on that reading,
|
|
@@ -1827,7 +2142,9 @@ export declare function readPerception(name: string): string;
|
|
|
1827
2142
|
*
|
|
1828
2143
|
* @param element - The element whose resolved style to inspect.
|
|
1829
2144
|
* @param property - The CSS property name, registered or custom.
|
|
2145
|
+
* @param pseudo - The pseudo-element selector. Omit it to read the element itself.
|
|
1830
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.
|
|
1831
2148
|
*
|
|
1832
2149
|
* @remarks
|
|
1833
2150
|
* A resolved length is text with a unit — `'12px'` — so this reads the number in front of the unit
|
|
@@ -1845,7 +2162,7 @@ export declare function readPerception(name: string): string;
|
|
|
1845
2162
|
* readPixels(button, 'width') // 0 when the width resolves to `auto`
|
|
1846
2163
|
* ```
|
|
1847
2164
|
*/
|
|
1848
|
-
export declare function readPixels(element: Element, property: string): number;
|
|
2165
|
+
export declare function readPixels(element: Element, property: string, pseudo?: string): number;
|
|
1849
2166
|
|
|
1850
2167
|
/**
|
|
1851
2168
|
* Reads the refusal one named target answers with, or nothing when it resolves.
|
|
@@ -1897,6 +2214,7 @@ export declare function readRefusal(role: string, name: string): string | undefi
|
|
|
1897
2214
|
* @param worn - The element the control's focus chrome is painted onto. Default: `control`.
|
|
1898
2215
|
* @returns The strongest ratio the painted focus chrome reaches, or `undefined` when the control is
|
|
1899
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.
|
|
1900
2218
|
*
|
|
1901
2219
|
* @remarks
|
|
1902
2220
|
* This reads and never acts. Focus arrives through the published verbs — `traverseAccessible`,
|
|
@@ -1920,6 +2238,9 @@ export declare function readRefusal(role: string, name: string): string | undefi
|
|
|
1920
2238
|
* color names neither. A focus style that only changes the control's own fill reports `undefined`
|
|
1921
2239
|
* too: the resting fill is gone by the time focus is on the control, and this never moves focus to
|
|
1922
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.
|
|
1923
2244
|
*
|
|
1924
2245
|
* @example
|
|
1925
2246
|
* ```ts
|
|
@@ -2040,12 +2361,14 @@ export declare function readRules(): readonly CSSRule[];
|
|
|
2040
2361
|
export declare function readStates(element: Element): readonly string[];
|
|
2041
2362
|
|
|
2042
2363
|
/**
|
|
2043
|
-
* 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.
|
|
2044
2365
|
*
|
|
2045
2366
|
* @param element - The element whose resolved style to inspect.
|
|
2046
2367
|
* @param property - The CSS property name, registered or custom.
|
|
2368
|
+
* @param pseudo - The pseudo-element selector. Omit it to read the element itself.
|
|
2047
2369
|
* @returns The browser's resolved property value, trimmed; an empty string when the element resolves
|
|
2048
2370
|
* none.
|
|
2371
|
+
* @throws Thrown when the pseudo argument lacks the `::` prefix or the engine does not support it.
|
|
2049
2372
|
*
|
|
2050
2373
|
* @remarks
|
|
2051
2374
|
* The value is trimmed, so what comes back is the value and never the whitespace around it. Internal
|
|
@@ -2056,7 +2379,7 @@ export declare function readStates(element: Element): readonly string[];
|
|
|
2056
2379
|
* readStyle(button, 'padding-left')
|
|
2057
2380
|
* ```
|
|
2058
2381
|
*/
|
|
2059
|
-
export declare function readStyle(element: Element, property: string): string;
|
|
2382
|
+
export declare function readStyle(element: Element, property: string, pseudo?: string): string;
|
|
2060
2383
|
|
|
2061
2384
|
/**
|
|
2062
2385
|
* Reads one element's rendered text the way a name computation reads it.
|
|
@@ -2122,6 +2445,27 @@ export declare function readToken(element: Element, name: string): string;
|
|
|
2122
2445
|
*/
|
|
2123
2446
|
export declare function readValue(role: string, name: string): string;
|
|
2124
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
|
+
|
|
2125
2469
|
/**
|
|
2126
2470
|
* Hands the tester pane back to the runner's own layout, at the viewport it had before staging.
|
|
2127
2471
|
*
|
|
@@ -2151,6 +2495,26 @@ export declare function readValue(role: string, name: string): string;
|
|
|
2151
2495
|
*/
|
|
2152
2496
|
export declare function releasePane(): Promise<void>;
|
|
2153
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
|
+
|
|
2154
2518
|
/**
|
|
2155
2519
|
* Deletes one IndexedDB database and reports what the request actually did.
|
|
2156
2520
|
*
|
|
@@ -2283,6 +2647,46 @@ export declare function resolveAccessible(role: string, name: string): HTMLEleme
|
|
|
2283
2647
|
*/
|
|
2284
2648
|
export declare function resolveRendered(first: string, second?: string): HTMLElement;
|
|
2285
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
|
+
|
|
2286
2690
|
/**
|
|
2287
2691
|
* Sets the tester's viewport and renders the runner's pane at the size that viewport claims.
|
|
2288
2692
|
*
|