@ploaness/governance 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/a11y-focus-guard.d.ts +18 -0
  2. package/dist/a11y-focus-guard.d.ts.map +1 -0
  3. package/dist/a11y-focus-guard.js +17 -0
  4. package/dist/a11y-focus-guard.js.map +1 -0
  5. package/dist/a11y-hit-target.d.ts +7 -1
  6. package/dist/a11y-hit-target.d.ts.map +1 -1
  7. package/dist/a11y-hit-target.js +11 -0
  8. package/dist/a11y-hit-target.js.map +1 -1
  9. package/dist/asset-policy.d.ts +8 -4
  10. package/dist/asset-policy.d.ts.map +1 -1
  11. package/dist/asset-policy.js +28 -19
  12. package/dist/asset-policy.js.map +1 -1
  13. package/dist/browser-discovery.d.ts +116 -0
  14. package/dist/browser-discovery.d.ts.map +1 -0
  15. package/dist/browser-discovery.js +161 -0
  16. package/dist/browser-discovery.js.map +1 -0
  17. package/dist/browser-exemptions.d.ts +107 -0
  18. package/dist/browser-exemptions.d.ts.map +1 -0
  19. package/dist/browser-exemptions.js +163 -0
  20. package/dist/browser-exemptions.js.map +1 -0
  21. package/dist/browser-findings.d.ts +54 -0
  22. package/dist/browser-findings.d.ts.map +1 -0
  23. package/dist/browser-findings.js +52 -0
  24. package/dist/browser-findings.js.map +1 -0
  25. package/dist/browser-health.d.ts +45 -0
  26. package/dist/browser-health.d.ts.map +1 -0
  27. package/dist/browser-health.js +80 -0
  28. package/dist/browser-health.js.map +1 -0
  29. package/dist/browser-rules.d.ts +169 -0
  30. package/dist/browser-rules.d.ts.map +1 -0
  31. package/dist/browser-rules.js +345 -0
  32. package/dist/browser-rules.js.map +1 -0
  33. package/dist/browser-run.d.ts +110 -0
  34. package/dist/browser-run.d.ts.map +1 -0
  35. package/dist/browser-run.js +125 -0
  36. package/dist/browser-run.js.map +1 -0
  37. package/dist/browser-viewports.d.ts +77 -0
  38. package/dist/browser-viewports.d.ts.map +1 -0
  39. package/dist/browser-viewports.js +139 -0
  40. package/dist/browser-viewports.js.map +1 -0
  41. package/dist/change-scope.d.ts +158 -0
  42. package/dist/change-scope.d.ts.map +1 -0
  43. package/dist/change-scope.js +340 -0
  44. package/dist/change-scope.js.map +1 -0
  45. package/dist/cloudfront-functions.d.ts +34 -0
  46. package/dist/cloudfront-functions.d.ts.map +1 -0
  47. package/dist/cloudfront-functions.js +124 -0
  48. package/dist/cloudfront-functions.js.map +1 -0
  49. package/dist/generated-denial.d.ts +4 -1
  50. package/dist/generated-denial.d.ts.map +1 -1
  51. package/dist/generated-denial.js +10 -3
  52. package/dist/generated-denial.js.map +1 -1
  53. package/dist/index.d.ts +12 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +12 -0
  56. package/dist/index.js.map +1 -1
  57. package/dist/javascript-runtimes.d.ts +36 -0
  58. package/dist/javascript-runtimes.d.ts.map +1 -0
  59. package/dist/javascript-runtimes.js +40 -0
  60. package/dist/javascript-runtimes.js.map +1 -0
  61. package/dist/jsx-accessibility-scope.d.ts.map +1 -1
  62. package/dist/jsx-accessibility-scope.js +3 -0
  63. package/dist/jsx-accessibility-scope.js.map +1 -1
  64. package/dist/layout-boxes.d.ts.map +1 -1
  65. package/dist/layout-boxes.js +12 -14
  66. package/dist/layout-boxes.js.map +1 -1
  67. package/dist/layout-clip.d.ts +24 -0
  68. package/dist/layout-clip.d.ts.map +1 -0
  69. package/dist/layout-clip.js +82 -0
  70. package/dist/layout-clip.js.map +1 -0
  71. package/dist/layout-defects.d.ts +47 -4
  72. package/dist/layout-defects.d.ts.map +1 -1
  73. package/dist/layout-defects.js +94 -76
  74. package/dist/layout-defects.js.map +1 -1
  75. package/dist/layout-snapshot.d.ts +60 -2
  76. package/dist/layout-snapshot.d.ts.map +1 -1
  77. package/dist/layout-snapshot.js +65 -1
  78. package/dist/layout-snapshot.js.map +1 -1
  79. package/dist/layout-text.d.ts +4 -1
  80. package/dist/layout-text.d.ts.map +1 -1
  81. package/dist/layout-text.js +56 -7
  82. package/dist/layout-text.js.map +1 -1
  83. package/dist/route-map.d.ts +13 -0
  84. package/dist/route-map.d.ts.map +1 -1
  85. package/dist/route-map.js +13 -6
  86. package/dist/route-map.js.map +1 -1
  87. package/dist/run-plan.d.ts +27 -3
  88. package/dist/run-plan.d.ts.map +1 -1
  89. package/dist/run-plan.js +20 -3
  90. package/dist/run-plan.js.map +1 -1
  91. package/dist/settings-layering.d.ts.map +1 -1
  92. package/dist/settings-layering.js +6 -4
  93. package/dist/settings-layering.js.map +1 -1
  94. package/dist/settings.d.ts +32 -0
  95. package/dist/settings.d.ts.map +1 -1
  96. package/dist/settings.js +51 -12
  97. package/dist/settings.js.map +1 -1
  98. package/dist/terraform-blocks.d.ts +13 -0
  99. package/dist/terraform-blocks.d.ts.map +1 -0
  100. package/dist/terraform-blocks.js +27 -0
  101. package/dist/terraform-blocks.js.map +1 -0
  102. package/dist/terraform-policy.d.ts.map +1 -1
  103. package/dist/terraform-policy.js +3 -14
  104. package/dist/terraform-policy.js.map +1 -1
  105. package/dist/wiring-policy.d.ts +5 -2
  106. package/dist/wiring-policy.d.ts.map +1 -1
  107. package/dist/wiring-policy.js +16 -6
  108. package/dist/wiring-policy.js.map +1 -1
  109. package/package.json +1 -1
@@ -0,0 +1,169 @@
1
+ import type { CandidateFinding } from './browser-exemptions.js';
2
+ import { type LayoutSnapshot } from './layout-snapshot.js';
3
+ /** The tolerance every geometric comparison allows, in CSS pixels. */
4
+ export declare const GEOMETRY_TOLERANCE: number;
5
+ /** The smallest rendered text size, in CSS pixels. */
6
+ export declare const MINIMUM_TEXT_SIZE: number;
7
+ /** How far an image may be enlarged beyond its natural resolution before it is judged upscaled. */
8
+ export declare const UPSCALE_ALLOWANCE: number;
9
+ /** The device pixel ratio every viewport is rendered at. */
10
+ export declare const DEVICE_SCALE_FACTOR: number;
11
+ /** The width of the ring around a focused element whose pixels the focus-visible rule compares. */
12
+ export declare const FOCUS_RING_WIDTH: number;
13
+ /** The element rules of the resting scan beyond geometry: T4 and M1 to M4. */
14
+ export declare const RESTING_ELEMENT_RULES: readonly string[];
15
+ /** The page rule of the resting scan: T6. */
16
+ export declare const FONT_LOAD_RULE: string;
17
+ /**
18
+ * Text rendered smaller than 12 CSS pixels (rule `small-text`).
19
+ * @param snapshot the measured page.
20
+ * @returns one candidate per element whose own text is too small.
21
+ */
22
+ export declare const findSmallText: (snapshot: LayoutSnapshot) => readonly CandidateFinding[];
23
+ /**
24
+ * Visible images that did not load (rule `image-load`).
25
+ * @param snapshot the measured page.
26
+ * @returns one candidate per incomplete or empty image.
27
+ */
28
+ export declare const findUnloadedImages: (snapshot: LayoutSnapshot) => readonly CandidateFinding[];
29
+ /**
30
+ * Images stretched out of their natural aspect ratio (rule `image-distorted`).
31
+ * @param snapshot the measured page.
32
+ * @returns one candidate per image whose `object-fit: fill` rendering changes its proportions.
33
+ */
34
+ export declare const findDistortedImages: (snapshot: LayoutSnapshot) => readonly CandidateFinding[];
35
+ /**
36
+ * Images displayed larger than their source resolution allows (rule `image-upscaled`).
37
+ * @param snapshot the measured page.
38
+ * @returns one candidate per raster image enlarged by more than 10%.
39
+ */
40
+ export declare const findUpscaledImages: (snapshot: LayoutSnapshot) => readonly CandidateFinding[];
41
+ /**
42
+ * Media whose box changes once its source loads, shifting what follows it (rule `media-space`).
43
+ * @param snapshot the measured page.
44
+ * @returns one candidate per in-flow element that does not reserve its rendered size.
45
+ */
46
+ export declare const findUnreservedMedia: (snapshot: LayoutSnapshot) => readonly CandidateFinding[];
47
+ /**
48
+ * The declared font families the page's text asks for first.
49
+ * @param snapshot the measured page.
50
+ * @returns for each text element, the first family in its stack that has a `@font-face`.
51
+ */
52
+ export declare const usedFontFamilies: (snapshot: LayoutSnapshot) => readonly string[];
53
+ /**
54
+ * The `@font-face` families the page's text uses that did not load (rule `font-load`).
55
+ *
56
+ * A face the browser never needed stays `unloaded`, which is not a defect. A used family with no face
57
+ * loaded, or with a face that failed or is still loading after the page settled, is one. This proves the
58
+ * face loaded, not that every glyph avoided a fallback.
59
+ * @param snapshot the measured page.
60
+ * @returns one message per family.
61
+ */
62
+ export declare const findUnloadedFonts: (snapshot: LayoutSnapshot) => readonly string[];
63
+ /** One point of a focused element, and whether fixed or sticky content covers it. */
64
+ export interface FocusSample {
65
+ readonly isCovered: boolean;
66
+ /** The label of what covers it, empty when nothing does. */
67
+ readonly coveredBy: string;
68
+ }
69
+ /**
70
+ * Whether a focused element is entirely hidden by fixed or sticky content (rule `focus-obscured`).
71
+ * @param samples points spread over the part of the element inside the viewport.
72
+ * @returns the label of the covering content, or undefined when any part of the element shows.
73
+ */
74
+ export declare const obscuringContent: (samples: readonly FocusSample[]) => string | undefined;
75
+ /**
76
+ * Whether two renderings of the same region differ, which is what a visible focus indicator does.
77
+ * @param unfocused the region's pixels with the element blurred.
78
+ * @param focused the same region with the element focused by keyboard.
79
+ * @returns true when at least one byte differs.
80
+ */
81
+ export declare const hasVisibleFocus: (unfocused: Uint8Array, focused: Uint8Array) => boolean;
82
+ /** The contrast a focus indicator's changed pixels need against what they replaced (WCAG 1.4.11). */
83
+ export declare const FOCUS_CONTRAST_RATIO: number;
84
+ /**
85
+ * The WCAG contrast ratio between two relative luminances.
86
+ * @param first one luminance.
87
+ * @param second the other.
88
+ * @returns the ratio, from 1 to 21.
89
+ */
90
+ export declare const contrastRatio: (first: number, second: number) => number;
91
+ /** A focused element's region rendered focused and unfocused, decoded to RGBA. */
92
+ export interface FocusRenderings {
93
+ readonly unfocused: readonly number[];
94
+ readonly focused: readonly number[];
95
+ /** Device pixels per CSS pixel along one side. */
96
+ readonly scale: number;
97
+ /** The longer side of the element's visible box, in CSS pixels. */
98
+ readonly extent: number;
99
+ }
100
+ /**
101
+ * Whether a focus indicator contrasts with what it replaced (rule `focus-contrast`). The pixels whose
102
+ * focused colour contrasts at least 3:1 with their unfocused colour must cover as much as a one-pixel line
103
+ * along half the element's longer side, so an outline, a ring, an underline or a strong fill passes and a
104
+ * faint tint or glow does not.
105
+ * @param renderings the two renderings, their scale, and the element's longer side.
106
+ * @returns true when enough of the change contrasts.
107
+ */
108
+ export declare const hasContrastingFocus: (renderings: FocusRenderings) => boolean;
109
+ /** Where a keyboard-focused element sits, for the order focus moves in (rule `focus-order`). */
110
+ export interface FocusPosition {
111
+ /** Its box in document coordinates, in CSS pixels. */
112
+ readonly top: number;
113
+ readonly bottom: number;
114
+ readonly left: number;
115
+ readonly right: number;
116
+ /** The landmark it sits in; positions are compared only within one. */
117
+ readonly landmark: string;
118
+ /**
119
+ * Whether its position says nothing about order: it is in a dialog, in fixed or sticky content whose
120
+ * place moves with scrolling, or visually hidden.
121
+ */
122
+ readonly isUnplaced: boolean;
123
+ readonly isRightToLeft: boolean;
124
+ }
125
+ /**
126
+ * Whether focus moved backwards (rule `focus-order`): the next element sits entirely above the previous
127
+ * one in the same landmark. A next element in a column further along the line is not backwards, because
128
+ * that is where a reader goes after the foot of a column.
129
+ * @param previous where the previously focused element sits.
130
+ * @param next where the next focused element sits.
131
+ * @returns true when the move goes back up the page.
132
+ */
133
+ export declare const isFocusBackwards: (previous: FocusPosition, next: FocusPosition) => boolean;
134
+ /** What driving one opened disclosure with the keyboard showed. */
135
+ export interface DisclosureProbe {
136
+ /** Whether the control declares a popup, which the keyboard pattern says `Escape` dismisses. */
137
+ readonly isPopup: boolean;
138
+ /** Whether `Escape` closed it. */
139
+ readonly closedOnEscape: boolean;
140
+ /** Whether focus was on the control after it closed. */
141
+ readonly focusReturned: boolean;
142
+ /** Whether it opened a modal dialog. */
143
+ readonly isModal: boolean;
144
+ /** Whether focus stayed inside that dialog while tabbing. */
145
+ readonly focusTrapped: boolean;
146
+ }
147
+ /**
148
+ * What is wrong with how a disclosure answers the keyboard (rule `disclosure-keyboard`).
149
+ *
150
+ * Only a popup or a modal dialog is required to close on `Escape`: the disclosure pattern for an
151
+ * accordion or a native `<details>` has no such key, and judging one by it would report the platform.
152
+ * @param probe what the keyboard showed.
153
+ * @returns one message per defect.
154
+ */
155
+ export declare const disclosureDefects: (probe: DisclosureProbe) => readonly string[];
156
+ /**
157
+ * Where two measurements of a settled page disagree (rule `page-not-stable`).
158
+ * @param first the first measurement.
159
+ * @param second the second, taken after it.
160
+ * @returns what moved, or undefined when the geometry held within the tolerance.
161
+ */
162
+ export declare const instability: (first: LayoutSnapshot, second: LayoutSnapshot) => string | undefined;
163
+ /**
164
+ * Every element candidate the resting scan's text and media rules find on one page.
165
+ * @param snapshot the measured page.
166
+ * @returns the candidates of T4 and M1 to M4.
167
+ */
168
+ export declare const restingCandidates: (snapshot: LayoutSnapshot) => readonly CandidateFinding[];
169
+ //# sourceMappingURL=browser-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-rules.d.ts","sourceRoot":"","sources":["../src/browser-rules.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,EAOL,KAAK,cAAc,EAEpB,MAAM,sBAAsB,CAAA;AAE7B,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,EAAE,MAAU,CAAA;AAE3C,sDAAsD;AACtD,eAAO,MAAM,iBAAiB,EAAE,MAAW,CAAA;AAE3C,mGAAmG;AACnG,eAAO,MAAM,iBAAiB,EAAE,MAAY,CAAA;AAI5C,4DAA4D;AAC5D,eAAO,MAAM,mBAAmB,EAAE,MAAU,CAAA;AAE5C,mGAAmG;AACnG,eAAO,MAAM,gBAAgB,EAAE,MAAU,CAAA;AAEzC,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,EAAE,SAAS,MAAM,EAMlD,CAAA;AAED,6CAA6C;AAC7C,eAAO,MAAM,cAAc,EAAE,MAAoB,CAAA;AAQjD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,cAAc,KAAG,SAAS,gBAAgB,EAe7E,CAAA;AAcL;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,UAAU,cAAc,KAAG,SAAS,gBAA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A"}
@@ -0,0 +1,345 @@
1
+ import { hasArea, isInAriaHidden, isInClip, } from './layout-snapshot.js';
2
+ /** The tolerance every geometric comparison allows, in CSS pixels. */
3
+ export const GEOMETRY_TOLERANCE = 1;
4
+ /** The smallest rendered text size, in CSS pixels. */
5
+ export const MINIMUM_TEXT_SIZE = 12;
6
+ /** How far an image may be enlarged beyond its natural resolution before it is judged upscaled. */
7
+ export const UPSCALE_ALLOWANCE = 0.1;
8
+ const PERCENT = 100;
9
+ /** The device pixel ratio every viewport is rendered at. */
10
+ export const DEVICE_SCALE_FACTOR = 1;
11
+ /** The width of the ring around a focused element whose pixels the focus-visible rule compares. */
12
+ export const FOCUS_RING_WIDTH = 4;
13
+ /** The element rules of the resting scan beyond geometry: T4 and M1 to M4. */
14
+ export const RESTING_ELEMENT_RULES = [
15
+ 'small-text',
16
+ 'image-load',
17
+ 'image-distorted',
18
+ 'image-upscaled',
19
+ 'media-space',
20
+ ];
21
+ /** The page rule of the resting scan: T6. */
22
+ export const FONT_LOAD_RULE = 'font-load';
23
+ const isRendered = (snapshot, node) => node.visibility === 'visible' &&
24
+ node.rects.some((rect) => hasArea(rect)) &&
25
+ !isInClip(snapshot, node) &&
26
+ !isInAriaHidden(snapshot, node);
27
+ /**
28
+ * Text rendered smaller than 12 CSS pixels (rule `small-text`).
29
+ * @param snapshot the measured page.
30
+ * @returns one candidate per element whose own text is too small.
31
+ */
32
+ export const findSmallText = (snapshot) => snapshot.nodes
33
+ .filter((node) => node.textRects.some((rect) => hasArea(rect)) &&
34
+ node.fontSize > 0 &&
35
+ node.fontSize < MINIMUM_TEXT_SIZE &&
36
+ isRendered(snapshot, node))
37
+ .map((node) => ({
38
+ rule: 'small-text',
39
+ subjects: [node],
40
+ message: `text rendered at ${String(node.fontSize)}px, below ${String(MINIMUM_TEXT_SIZE)}px: ${node.label}`,
41
+ }));
42
+ const renderedMedia = (snapshot) => snapshot.nodes.flatMap((node) => node.media !== undefined && isRendered(snapshot, node) ? [{ node, media: node.media }] : []);
43
+ const isImage = (node) => node.tag === 'img';
44
+ /**
45
+ * Visible images that did not load (rule `image-load`).
46
+ * @param snapshot the measured page.
47
+ * @returns one candidate per incomplete or empty image.
48
+ */
49
+ export const findUnloadedImages = (snapshot) => renderedMedia(snapshot)
50
+ .filter(({ node, media }) => isImage(node) && (!media.isComplete || (!media.isVector && media.naturalWidth === 0)))
51
+ .map(({ node, media }) => ({
52
+ rule: 'image-load',
53
+ subjects: [node],
54
+ message: `image did not load (complete ${String(media.isComplete)}, ` +
55
+ `natural width ${String(media.naturalWidth)}): ${node.label}`,
56
+ }));
57
+ const hasRaster = (media) => !media.isVector && media.naturalWidth > 0 && media.naturalHeight > 0 && media.contentWidth > 0;
58
+ /**
59
+ * Images stretched out of their natural aspect ratio (rule `image-distorted`).
60
+ * @param snapshot the measured page.
61
+ * @returns one candidate per image whose `object-fit: fill` rendering changes its proportions.
62
+ */
63
+ export const findDistortedImages = (snapshot) => renderedMedia(snapshot).flatMap(({ node, media }) => {
64
+ if (!(isImage(node) && hasRaster(media)) || media.objectFit !== 'fill') {
65
+ return [];
66
+ }
67
+ const expectedHeight = (media.contentWidth * media.naturalHeight) / media.naturalWidth;
68
+ return Math.abs(expectedHeight - media.contentHeight) > GEOMETRY_TOLERANCE
69
+ ? [
70
+ {
71
+ rule: 'image-distorted',
72
+ subjects: [node],
73
+ message: `image rendered at ${String(media.contentWidth)}x${String(media.contentHeight)}px from a ` +
74
+ `${String(media.naturalWidth)}x${String(media.naturalHeight)}px source, out of proportion: ${node.label}`,
75
+ },
76
+ ]
77
+ : [];
78
+ });
79
+ const displayedScale = (media) => {
80
+ const horizontal = media.contentWidth / media.naturalWidth;
81
+ const vertical = media.contentHeight / media.naturalHeight;
82
+ switch (media.objectFit) {
83
+ case 'cover': {
84
+ return Math.max(horizontal, vertical);
85
+ }
86
+ case 'contain': {
87
+ return Math.min(horizontal, vertical);
88
+ }
89
+ case 'none': {
90
+ return 1;
91
+ }
92
+ case 'scale-down': {
93
+ return Math.min(1, horizontal, vertical);
94
+ }
95
+ default: {
96
+ return Math.max(horizontal, vertical);
97
+ }
98
+ }
99
+ };
100
+ /**
101
+ * Images displayed larger than their source resolution allows (rule `image-upscaled`).
102
+ * @param snapshot the measured page.
103
+ * @returns one candidate per raster image enlarged by more than 10%.
104
+ */
105
+ export const findUpscaledImages = (snapshot) => renderedMedia(snapshot).flatMap(({ node, media }) => {
106
+ if (!(isImage(node) && hasRaster(media))) {
107
+ return [];
108
+ }
109
+ const scale = displayedScale(media) * DEVICE_SCALE_FACTOR;
110
+ return scale > 1 + UPSCALE_ALLOWANCE
111
+ ? [
112
+ {
113
+ rule: 'image-upscaled',
114
+ subjects: [node],
115
+ message: `image source ${String(media.naturalWidth)}x${String(media.naturalHeight)}px displayed at ` +
116
+ `${String(Math.round(scale * PERCENT))}% in a ` +
117
+ `${String(media.contentWidth)}x${String(media.contentHeight)}px ` +
118
+ `box; serve a larger source: ${node.label}`,
119
+ },
120
+ ]
121
+ : [];
122
+ });
123
+ const OUT_OF_FLOW = new Set(['absolute', 'fixed']);
124
+ /**
125
+ * Media whose box changes once its source loads, shifting what follows it (rule `media-space`).
126
+ * @param snapshot the measured page.
127
+ * @returns one candidate per in-flow element that does not reserve its rendered size.
128
+ */
129
+ export const findUnreservedMedia = (snapshot) => renderedMedia(snapshot).flatMap(({ node, media }) => {
130
+ if (OUT_OF_FLOW.has(node.position)) {
131
+ return [];
132
+ }
133
+ const rendered = node.rects[0];
134
+ if (rendered === undefined) {
135
+ return [];
136
+ }
137
+ const width = rendered.right - rendered.left;
138
+ const height = rendered.bottom - rendered.top;
139
+ return Math.abs(media.reservedWidth - width) > GEOMETRY_TOLERANCE ||
140
+ Math.abs(media.reservedHeight - height) > GEOMETRY_TOLERANCE
141
+ ? [
142
+ {
143
+ rule: 'media-space',
144
+ subjects: [node],
145
+ message: `${node.tag} reserves ${String(media.reservedWidth)}x${String(media.reservedHeight)}px before loading ` +
146
+ `and takes ${String(width)}x${String(height)}px after; give it width and height attributes or an ` +
147
+ `aspect-ratio: ${node.label}`,
148
+ },
149
+ ]
150
+ : [];
151
+ });
152
+ const GENERIC_FAMILIES = new Set([
153
+ 'serif',
154
+ 'sans-serif',
155
+ 'monospace',
156
+ 'cursive',
157
+ 'fantasy',
158
+ 'system-ui',
159
+ 'ui-serif',
160
+ 'ui-sans-serif',
161
+ 'ui-monospace',
162
+ 'ui-rounded',
163
+ 'math',
164
+ 'emoji',
165
+ 'fangsong',
166
+ ]);
167
+ const familyName = (family) => family
168
+ .trim()
169
+ .replaceAll(/^["']|["']$/gu, '')
170
+ .toLowerCase();
171
+ const familiesOf = (stack) => stack
172
+ .split(',')
173
+ .map((family) => familyName(family))
174
+ .filter((family) => family.length > 0 && !GENERIC_FAMILIES.has(family));
175
+ /**
176
+ * The declared font families the page's text asks for first.
177
+ * @param snapshot the measured page.
178
+ * @returns for each text element, the first family in its stack that has a `@font-face`.
179
+ */
180
+ export const usedFontFamilies = (snapshot) => {
181
+ const declared = new Set(snapshot.fontFaces.map((face) => familyName(face.family)));
182
+ return [
183
+ ...new Set(snapshot.nodes
184
+ .filter((node) => node.textRects.length > 0)
185
+ .flatMap((node) => {
186
+ const first = familiesOf(node.fontFamily).find((family) => declared.has(family));
187
+ return first === undefined ? [] : [first];
188
+ })),
189
+ ];
190
+ };
191
+ /**
192
+ * The `@font-face` families the page's text uses that did not load (rule `font-load`).
193
+ *
194
+ * A face the browser never needed stays `unloaded`, which is not a defect. A used family with no face
195
+ * loaded, or with a face that failed or is still loading after the page settled, is one. This proves the
196
+ * face loaded, not that every glyph avoided a fallback.
197
+ * @param snapshot the measured page.
198
+ * @returns one message per family.
199
+ */
200
+ export const findUnloadedFonts = (snapshot) => usedFontFamilies(snapshot).flatMap((family) => {
201
+ const faces = snapshot.fontFaces.filter((face) => familyName(face.family) === family);
202
+ const failed = faces.filter((face) => face.status === 'error' || face.status === 'loading');
203
+ if (failed.length > 0) {
204
+ return failed.map((face) => `@font-face "${face.family}" ${face.weight} ${face.style} is ${face.status} after the page settled`);
205
+ }
206
+ return faces.some((face) => face.status === 'loaded')
207
+ ? []
208
+ : [`@font-face "${family}" is used by the page's text and none of its faces loaded`];
209
+ });
210
+ /**
211
+ * Whether a focused element is entirely hidden by fixed or sticky content (rule `focus-obscured`).
212
+ * @param samples points spread over the part of the element inside the viewport.
213
+ * @returns the label of the covering content, or undefined when any part of the element shows.
214
+ */
215
+ export const obscuringContent = (samples) => samples.length > 0 && samples.every((sample) => sample.isCovered)
216
+ ? [...new Set(samples.map((sample) => sample.coveredBy))].join(', ')
217
+ : undefined;
218
+ /**
219
+ * Whether two renderings of the same region differ, which is what a visible focus indicator does.
220
+ * @param unfocused the region's pixels with the element blurred.
221
+ * @param focused the same region with the element focused by keyboard.
222
+ * @returns true when at least one byte differs.
223
+ */
224
+ export const hasVisibleFocus = (unfocused, focused) => unfocused.length !== focused.length ||
225
+ unfocused.some((byte, index) => byte !== focused[index]);
226
+ /** The contrast a focus indicator's changed pixels need against what they replaced (WCAG 1.4.11). */
227
+ export const FOCUS_CONTRAST_RATIO = 3;
228
+ const RGBA_BYTES = 4;
229
+ const CHANNEL_MAX = 255;
230
+ const LINEAR_KNEE = 0.04045;
231
+ const LINEAR_SLOPE = 12.92;
232
+ const GAMMA_OFFSET = 0.055;
233
+ const GAMMA_SCALE = 1.055;
234
+ const GAMMA = 2.4;
235
+ const RED_WEIGHT = 0.2126;
236
+ const GREEN_WEIGHT = 0.7152;
237
+ const BLUE_WEIGHT = 0.0722;
238
+ const FLARE = 0.05;
239
+ const BLUE_OFFSET = 2;
240
+ // The share of the element's longer side a contrasting one-pixel line must cover.
241
+ const LINE_SHARE = 0.5;
242
+ const linearChannel = (value) => {
243
+ const fraction = value / CHANNEL_MAX;
244
+ return fraction <= LINEAR_KNEE ? fraction / LINEAR_SLOPE : ((fraction + GAMMA_OFFSET) / GAMMA_SCALE) ** GAMMA;
245
+ };
246
+ const luminanceAt = (pixels, offset) => RED_WEIGHT * linearChannel(pixels[offset] ?? 0) +
247
+ GREEN_WEIGHT * linearChannel(pixels[offset + 1] ?? 0) +
248
+ BLUE_WEIGHT * linearChannel(pixels[offset + BLUE_OFFSET] ?? 0);
249
+ /**
250
+ * The WCAG contrast ratio between two relative luminances.
251
+ * @param first one luminance.
252
+ * @param second the other.
253
+ * @returns the ratio, from 1 to 21.
254
+ */
255
+ export const contrastRatio = (first, second) => (Math.max(first, second) + FLARE) / (Math.min(first, second) + FLARE);
256
+ /**
257
+ * Whether a focus indicator contrasts with what it replaced (rule `focus-contrast`). The pixels whose
258
+ * focused colour contrasts at least 3:1 with their unfocused colour must cover as much as a one-pixel line
259
+ * along half the element's longer side, so an outline, a ring, an underline or a strong fill passes and a
260
+ * faint tint or glow does not.
261
+ * @param renderings the two renderings, their scale, and the element's longer side.
262
+ * @returns true when enough of the change contrasts.
263
+ */
264
+ export const hasContrastingFocus = (renderings) => {
265
+ const { unfocused, focused, scale, extent } = renderings;
266
+ const pixels = Math.floor(Math.min(unfocused.length, focused.length) / RGBA_BYTES);
267
+ const contrasting = Array.from({ length: pixels }, (_unused, pixel) => pixel).filter((pixel) => contrastRatio(luminanceAt(unfocused, pixel * RGBA_BYTES), luminanceAt(focused, pixel * RGBA_BYTES)) >=
268
+ FOCUS_CONTRAST_RATIO).length;
269
+ return contrasting / (scale * scale) >= extent * LINE_SHARE;
270
+ };
271
+ /**
272
+ * Whether focus moved backwards (rule `focus-order`): the next element sits entirely above the previous
273
+ * one in the same landmark. A next element in a column further along the line is not backwards, because
274
+ * that is where a reader goes after the foot of a column.
275
+ * @param previous where the previously focused element sits.
276
+ * @param next where the next focused element sits.
277
+ * @returns true when the move goes back up the page.
278
+ */
279
+ export const isFocusBackwards = (previous, next) => {
280
+ if (previous.isUnplaced || next.isUnplaced || previous.landmark !== next.landmark) {
281
+ return false;
282
+ }
283
+ const isFurtherAlong = previous.isRightToLeft ? next.right <= previous.left : next.left >= previous.right;
284
+ return next.bottom <= previous.top && !isFurtherAlong;
285
+ };
286
+ const escapeDefects = (probe) => {
287
+ if (!(probe.isPopup || probe.isModal)) {
288
+ return [];
289
+ }
290
+ if (!probe.closedOnEscape) {
291
+ return ['Escape does not close it'];
292
+ }
293
+ return probe.focusReturned ? [] : ['focus does not return to its control after Escape'];
294
+ };
295
+ /**
296
+ * What is wrong with how a disclosure answers the keyboard (rule `disclosure-keyboard`).
297
+ *
298
+ * Only a popup or a modal dialog is required to close on `Escape`: the disclosure pattern for an
299
+ * accordion or a native `<details>` has no such key, and judging one by it would report the platform.
300
+ * @param probe what the keyboard showed.
301
+ * @returns one message per defect.
302
+ */
303
+ export const disclosureDefects = (probe) => [
304
+ ...escapeDefects(probe),
305
+ ...(probe.isModal && !probe.focusTrapped ? ['focus leaves the open modal dialog while tabbing'] : []),
306
+ ];
307
+ const isSameRect = (left, right) => Math.abs(left.left - right.left) <= GEOMETRY_TOLERANCE &&
308
+ Math.abs(left.top - right.top) <= GEOMETRY_TOLERANCE &&
309
+ Math.abs(left.right - right.right) <= GEOMETRY_TOLERANCE &&
310
+ Math.abs(left.bottom - right.bottom) <= GEOMETRY_TOLERANCE;
311
+ const isSameNode = (left, right) => left.label === right.label &&
312
+ left.rects.length === right.rects.length &&
313
+ left.rects.every((rect, index) => {
314
+ const other = right.rects[index];
315
+ return other !== undefined && isSameRect(rect, other);
316
+ });
317
+ /**
318
+ * Where two measurements of a settled page disagree (rule `page-not-stable`).
319
+ * @param first the first measurement.
320
+ * @param second the second, taken after it.
321
+ * @returns what moved, or undefined when the geometry held within the tolerance.
322
+ */
323
+ export const instability = (first, second) => {
324
+ if (first.nodes.length !== second.nodes.length) {
325
+ return `the element count changed from ${String(first.nodes.length)} to ${String(second.nodes.length)}`;
326
+ }
327
+ const moved = first.nodes.find((node, index) => {
328
+ const other = second.nodes[index];
329
+ return other === undefined || !isSameNode(node, other);
330
+ });
331
+ return moved === undefined ? undefined : `${moved.label} moved between two measurements`;
332
+ };
333
+ /**
334
+ * Every element candidate the resting scan's text and media rules find on one page.
335
+ * @param snapshot the measured page.
336
+ * @returns the candidates of T4 and M1 to M4.
337
+ */
338
+ export const restingCandidates = (snapshot) => [
339
+ ...findSmallText(snapshot),
340
+ ...findUnloadedImages(snapshot),
341
+ ...findDistortedImages(snapshot),
342
+ ...findUpscaledImages(snapshot),
343
+ ...findUnreservedMedia(snapshot),
344
+ ];
345
+ //# sourceMappingURL=browser-rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-rules.js","sourceRoot":"","sources":["../src/browser-rules.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,OAAO,EACP,cAAc,EACd,QAAQ,GAKT,MAAM,sBAAsB,CAAA;AAE7B,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAW,CAAC,CAAA;AAE3C,sDAAsD;AACtD,MAAM,CAAC,MAAM,iBAAiB,GAAW,EAAE,CAAA;AAE3C,mGAAmG;AACnG,MAAM,CAAC,MAAM,iBAAiB,GAAW,GAAG,CAAA;AAE5C,MAAM,OAAO,GAAW,GAAG,CAAA;AAE3B,4DAA4D;AAC5D,MAAM,CAAC,MAAM,mBAAmB,GAAW,CAAC,CAAA;AAE5C,mGAAmG;AACnG,MAAM,CAAC,MAAM,gBAAgB,GAAW,CAAC,CAAA;AAEzC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,qBAAqB,GAAsB;IACtD,YAAY;IACZ,YAAY;IACZ,iBAAiB;IACjB,gBAAgB;IAChB,aAAa;CACd,CAAA;AAED,6CAA6C;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAW,WAAW,CAAA;AAEjD,MAAM,UAAU,GAAG,CAAC,QAAwB,EAAE,IAAgB,EAAW,EAAE,CACzE,IAAI,CAAC,UAAU,KAAK,SAAS;IAC7B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAgB,EAAW,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;I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,OAAO,KAAK,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACxD,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,iCAAiC,CAAA;AAC1F,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,QAAwB,EAA+B,EAAE,CAAC;IAC1F,GAAG,aAAa,CAAC,QAAQ,CAAC;IAC1B,GAAG,kBAAkB,CAAC,QAAQ,CAAC;IAC/B,GAAG,mBAAmB,CAAC,QAAQ,CAAC;IAChC,GAAG,kBAAkB,CAAC,QAAQ,CAAC;IAC/B,GAAG,mBAAmB,CAAC,QAAQ,CAAC;CACjC,CAAA"}
@@ -0,0 +1,110 @@
1
+ /** The variable naming the instant the application's clock starts at, or absent for the real clock. */
2
+ export declare const CLOCK_ENVIRONMENT_VARIABLE: string;
3
+ /**
4
+ * The instant every verification run starts its clocks at.
5
+ *
6
+ * Far in the future on purpose. The browser's cookie store keeps real time, so a shifted server that
7
+ * believed it was earlier than now would set absolute cookie expiries the browser already considers
8
+ * past, and every sign-in would fail. Noon, so that a run lasting hours still sees one date.
9
+ */
10
+ export declare const DEFAULT_CLOCK_INSTANT: string;
11
+ /** The clock setting that leaves every clock real. */
12
+ export declare const REAL_CLOCK: string;
13
+ /**
14
+ * The clock a project declared: an ISO instant, `"real"`, or the default instant for anything else.
15
+ * @param declared the raw `ploaness.clock` value.
16
+ * @returns the ISO instant to start at, or `"real"`.
17
+ */
18
+ export declare const clockOf: (declared: unknown) => string;
19
+ /**
20
+ * The time a shifted clock reads: the instant it started at, advanced by the real time since.
21
+ * @param instantMs the instant the clock started at.
22
+ * @param startedMs the real time it started.
23
+ * @param realMs the real time now.
24
+ * @returns the shifted time now.
25
+ */
26
+ export declare const shiftedTime: (instantMs: number, startedMs: number, realMs: number) => number;
27
+ /** The variable naming the pinned browser server the suite connects to. */
28
+ export declare const BROWSER_ENDPOINT_ENVIRONMENT_VARIABLE: string;
29
+ /**
30
+ * The pinned Playwright image whose browsers a verification run measures in.
31
+ * @param version the `@playwright/test` version ploaness pins.
32
+ * @returns the image reference.
33
+ */
34
+ export declare const playwrightImageOf: (version: string) => string;
35
+ /** The engines a verification run measures in. Outside verification only the first runs. */
36
+ export declare const BROWSER_ENGINES: readonly string[];
37
+ /** The passes the sweep runs, in order. */
38
+ export type SweepPass = 'discovery' | 'resting' | 'interaction' | 'disclosures' | 'text-stress' | 'width-sweep' | 'dark-scheme' | 'engine';
39
+ /** The rule a pass that ran out of time reports. */
40
+ export declare const PASS_BUDGET_RULE: string;
41
+ /**
42
+ * The time a pass may take, derived from the work it discovered.
43
+ * @param pass the pass.
44
+ * @param units how many units of work it has.
45
+ * @returns its budget in milliseconds.
46
+ */
47
+ export declare const passBudgetMs: (pass: SweepPass, units: number) => number;
48
+ /** The workers a browser run spreads the sweep's tests over. */
49
+ export declare const SWEEP_WORKERS: number;
50
+ /** How many tests each sweep pass is split into, so its parts run on parallel workers. */
51
+ export declare const SWEEP_SHARDS: number;
52
+ /** One part of a sweep pass: its zero-based index among `count` parts. */
53
+ export interface Shard {
54
+ readonly index: number;
55
+ readonly count: number;
56
+ }
57
+ /** An item a shard visits, with its index in the whole pass. */
58
+ export interface ShardItem<Item> {
59
+ readonly item: Item;
60
+ readonly index: number;
61
+ }
62
+ /**
63
+ * The time one part of a pass may take. The parts take the pass's items from one queue, so each does an
64
+ * equal share of the work whatever items it happens to take.
65
+ * @param pass the pass.
66
+ * @param units how many units of work the whole pass has.
67
+ * @param shard the part.
68
+ * @returns its budget in milliseconds.
69
+ */
70
+ export declare const partBudgetMs: (pass: SweepPass, units: number, shard: Shard) => number;
71
+ /** What starting the pinned browser server needs to know. */
72
+ export interface PinnedBrowserServer {
73
+ readonly image: string;
74
+ readonly name: string;
75
+ readonly port: number;
76
+ /** The host's resolved `playwright-core` directory, which the container runs. */
77
+ readonly playwrightCore: string;
78
+ /**
79
+ * Whether the container shares the host's network. It then reaches the application's loopback
80
+ * origins directly; otherwise every request a page makes travels through the client's tunnel, which
81
+ * costs several times the load itself.
82
+ */
83
+ readonly isHostNetwork: boolean;
84
+ /**
85
+ * A random path the server answers on. The port is free when it is chosen and taken by the container
86
+ * a moment later, so another local process could take it first and pose as the browser server; it
87
+ * cannot complete the handshake on a path it was never told.
88
+ */
89
+ readonly secret: string;
90
+ }
91
+ /** The variable telling the suite its pinned browsers reach the application only through the tunnel. */
92
+ export declare const BROWSER_TUNNEL_ENVIRONMENT_VARIABLE: string;
93
+ /**
94
+ * The `docker` arguments that start the pinned browser server.
95
+ *
96
+ * The container runs the host's own `playwright-core` against the image's browsers, so nothing is
97
+ * fetched at test time and the protocol on both ends is one version. It listens on loopback only: on the
98
+ * host's own when the container shares the host network, or on a port published to it.
99
+ * @param server the server to start.
100
+ * @returns the arguments after `docker`.
101
+ */
102
+ export declare const pinnedBrowserServerArguments: (server: PinnedBrowserServer) => readonly string[];
103
+ /**
104
+ * The endpoint the suite connects to.
105
+ * @param port the published port.
106
+ * @param secret the path the server answers on.
107
+ * @returns the WebSocket URL.
108
+ */
109
+ export declare const pinnedBrowserEndpoint: (port: number, secret: string) => string;
110
+ //# sourceMappingURL=browser-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-run.d.ts","sourceRoot":"","sources":["../src/browser-run.ts"],"names":[],"mappings":"AAGA,uGAAuG;AACvG,eAAO,MAAM,0BAA0B,EAAE,MAAyB,CAAA;AAElE;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAmC,CAAA;AAEvE,sDAAsD;AACtD,eAAO,MAAM,UAAU,EAAE,MAAe,CAAA;AAIxC;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,UAAU,OAAO,KAAG,MAO3C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,WAAW,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