cyc-stack 0.9.1 → 0.11.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.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/README.md +3 -2
- package/bin/cyc.mjs +72 -20
- package/docs/README.md +2 -0
- package/docs/context.md +18 -10
- package/docs/project-tools.md +2 -12
- package/docs/runtime.md +5 -1
- package/docs/work-assessments.md +4 -4
- package/docs/work-queue.md +187 -0
- package/methods/cyc-build/SKILL.md +1 -1
- package/methods/cyc-context/SKILL.md +28 -20
- package/methods/cyc-context/references/evidence.md +1 -1
- package/methods/cyc-context/references/templates.md +30 -18
- package/methods/cyc-design/frontend-design/SKILL.md +132 -21
- package/methods/cyc-design/frontend-design/references/color.md +43 -56
- package/methods/cyc-design/frontend-design/references/craft-rules.md +17 -14
- package/methods/cyc-design/frontend-design/references/decision-sheet.md +95 -93
- package/methods/cyc-design/frontend-design/references/experience-review.md +15 -6
- package/methods/cyc-design/frontend-design/references/field-guide.md +439 -0
- package/methods/cyc-design/frontend-design/references/generic-tells.md +83 -32
- package/methods/cyc-design/frontend-design/references/layout-archetypes.md +5 -5
- package/methods/cyc-design/frontend-design/references/patterns.md +108 -0
- package/methods/cyc-design/frontend-design/references/reference-standards.md +118 -22
- package/methods/cyc-design/frontend-design/references/typography.md +59 -44
- package/methods/cyc-design/frontend-design/references/ux-foundations.md +2 -1
- package/methods/cyc-design/frontend-design/references/visual-material.md +43 -8
- package/methods/cyc-design/frontend-design/scripts/contrast.mjs +39 -0
- package/methods/cyc-design/frontend-design/scripts/first-screen.mjs +911 -0
- package/methods/cyc-design/frontend-design/scripts/photo-text.mjs +230 -0
- package/methods/cyc-verify/SKILL.md +1 -1
- package/package.json +6 -1
- package/plugin.json +1 -1
- package/scripts/catalog.mjs +5 -3
- package/scripts/context-review.mjs +364 -261
- package/scripts/hub-page.mjs +275 -0
- package/scripts/hub.mjs +139 -0
- package/scripts/project-tools.mjs +14 -6
- package/scripts/queue-board.mjs +287 -0
- package/scripts/queue.mjs +283 -0
- package/scripts/run-gate.mjs +8 -5
- package/scripts/runtime.mjs +270 -19
- package/scripts/source-snapshot.mjs +20 -2
- package/scripts/work-review.mjs +4 -3
- package/skills/cyc/SKILL.md +12 -4
- package/skills/cyc/references/playbooks/experience.md +2 -0
- package/skills/cyc/references/playbooks/plan.md +2 -0
|
@@ -0,0 +1,911 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Measures what a rendered page gives a visitor, and compares it with a floor.
|
|
3
|
+
//
|
|
4
|
+
// node first-screen.mjs --probe print the probe, to evaluate in the page
|
|
5
|
+
// node first-screen.mjs result.json judge what the probe returned
|
|
6
|
+
// node first-screen.mjs --one-page ... for a visual single-page brief
|
|
7
|
+
// node first-screen.mjs --access ... access checks for inner pages or deliberately text-led working views
|
|
8
|
+
// node first-screen.mjs --mark-text print the expression to run before the marked screenshot
|
|
9
|
+
// node first-screen.mjs --hide-text print the expression to run before the hidden screenshot
|
|
10
|
+
// node first-screen.mjs --marked desktop=m.png --hidden desktop=h.png ... result.json
|
|
11
|
+
// also measure text on photographs, from the two screenshots
|
|
12
|
+
//
|
|
13
|
+
// The probe runs in any browser: paste the printed expression into the console,
|
|
14
|
+
// or pass it to the browser tool at hand (Playwright `page.evaluate`, a DevTools
|
|
15
|
+
// protocol `Runtime.evaluate`, an in-app browser's script tool). Run it at a
|
|
16
|
+
// desktop width near 1440 and a phone width near 390, scrolled to the top.
|
|
17
|
+
// Save either one result, or {"desktop": {...}, "phone": {...}}.
|
|
18
|
+
//
|
|
19
|
+
// The floor comes from first screens measured on 2026-11-21; see
|
|
20
|
+
// references/reference-standards.md. It catches two pages: a brochure, with
|
|
21
|
+
// little to do, and a bare first screen, with little to look at. It does not
|
|
22
|
+
// measure taste, and a page that clears it can still be weak.
|
|
23
|
+
//
|
|
24
|
+
// The probe also counts, over the whole page, the access failures a script can
|
|
25
|
+
// see: missing language, alt, labels and names, tap targets under 24 px, controls
|
|
26
|
+
// that look the same focused, and text below contrast. Those numbers are WCAG 2.2
|
|
27
|
+
// AA. To read focus it focuses each control in turn, then puts focus and scroll
|
|
28
|
+
// back. Clearing them is not an audit.
|
|
29
|
+
|
|
30
|
+
import { readFileSync } from 'node:fs';
|
|
31
|
+
import { pathToFileURL } from 'node:url';
|
|
32
|
+
import { hideText, markText, measurePhotoText, readPng, validPhotoText } from './photo-text.mjs';
|
|
33
|
+
|
|
34
|
+
export const FLOOR = Object.freeze({
|
|
35
|
+
actions: 12, // desktop first screen; the eight sites measured 14 to 89 over two visits
|
|
36
|
+
phoneActions: 6, // phone first screen; the eight sites measured 7 to 30
|
|
37
|
+
destinations: 3, // other pages or views linked from this one; measured 7 to 293
|
|
38
|
+
screens: 3, // page height in screens; 4.9 to 8 on pages that do not load as you scroll
|
|
39
|
+
surfaceFactor: 2, // a first screen with twice the floor is a working surface; its height is not judged
|
|
40
|
+
pictures: 4, // desktop first screen; the eight sites measured 4 to 30 pictures over two visits...
|
|
41
|
+
pictureShare: 0.25, // ...or a single picture covering 29 to 86 percent of the screen
|
|
42
|
+
// Access. These come from WCAG 2.2 AA, not from the studied sites.
|
|
43
|
+
targetSize: 24, // px each way for anything a visitor taps, unless nothing else is within reach (2.5.8)
|
|
44
|
+
contrast: 4.5, // text against its background (1.4.3)
|
|
45
|
+
largeContrast: 3, // text 24 px and larger, or bold from 18.66 px
|
|
46
|
+
comfortTarget: 44, // the method's own height for buttons and fields; reported, not judged
|
|
47
|
+
photoCover: 0.9, // text on a photograph meets contrast against this share of what is behind it; the method's rule
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Runs in the page. Self-contained: it may not reference anything outside itself.
|
|
51
|
+
export function probe() {
|
|
52
|
+
// The layout viewport. On a phone, window.innerWidth grows to fit content that
|
|
53
|
+
// overflows, which would hide the overflow and misread the phone as a desktop.
|
|
54
|
+
const root = document.documentElement;
|
|
55
|
+
const vw = root.clientWidth || window.innerWidth;
|
|
56
|
+
const vh = root.clientHeight || window.innerHeight;
|
|
57
|
+
const shown = (el) => {
|
|
58
|
+
const box = el.getBoundingClientRect();
|
|
59
|
+
if (box.width <= 0 || box.height <= 0) return false;
|
|
60
|
+
const style = getComputedStyle(el);
|
|
61
|
+
return style.visibility !== 'hidden' && style.display !== 'none' && Number(style.opacity) !== 0;
|
|
62
|
+
};
|
|
63
|
+
const inFirstScreen = (el) => {
|
|
64
|
+
const box = el.getBoundingClientRect();
|
|
65
|
+
return shown(el) && box.bottom > 0 && box.top < vh && box.right > 0 && box.left < vw;
|
|
66
|
+
};
|
|
67
|
+
const all = [...document.body.querySelectorAll('*')];
|
|
68
|
+
const first = all.filter(inFirstScreen);
|
|
69
|
+
|
|
70
|
+
const actionSelector = 'a[href], button, [role="button"], [role="tab"], input:not([type="hidden"]), select, textarea, summary';
|
|
71
|
+
const actions = first.filter((el) => el.matches(actionSelector)).length;
|
|
72
|
+
|
|
73
|
+
const pictures = first
|
|
74
|
+
.filter((el) => el.matches('img, video, picture, canvas, svg') || getComputedStyle(el).backgroundImage.includes('url('))
|
|
75
|
+
.map((el) => el.getBoundingClientRect())
|
|
76
|
+
.filter((box) => box.width >= 80 && box.height >= 80);
|
|
77
|
+
const largest = pictures.reduce((best, box) => Math.max(best, Math.min(box.width, vw) * Math.min(box.height, vh)), 0);
|
|
78
|
+
|
|
79
|
+
const families = new Set();
|
|
80
|
+
for (const el of first) {
|
|
81
|
+
const ownText = [...el.childNodes].some((node) => node.nodeType === 3 && node.textContent.trim());
|
|
82
|
+
if (ownText) families.add(getComputedStyle(el).fontFamily.split(',')[0].replace(/["']/g, '').trim());
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Records: sets of three or more alike siblings that each carry content, such as
|
|
86
|
+
// listings, products, services with prices, events, table rows. Navigation,
|
|
87
|
+
// footers and the insides of a counted record are left out.
|
|
88
|
+
const carries = (el) => el.querySelector('img, picture, svg, video') || (el.innerText || '').trim().length >= 12;
|
|
89
|
+
const kind = (el) => `${el.tagName}.${[...el.classList].sort().join('.')}`;
|
|
90
|
+
let records = 0;
|
|
91
|
+
let largestSet = 0;
|
|
92
|
+
const walk = (parent) => {
|
|
93
|
+
if (parent.matches('nav, footer, [role="navigation"], [role="contentinfo"], select, svg')) return;
|
|
94
|
+
const sets = new Map();
|
|
95
|
+
for (const child of parent.children) {
|
|
96
|
+
if (!shown(child) || !carries(child)) continue;
|
|
97
|
+
const key = kind(child);
|
|
98
|
+
if (!sets.has(key)) sets.set(key, []);
|
|
99
|
+
sets.get(key).push(child);
|
|
100
|
+
}
|
|
101
|
+
const counted = new Set();
|
|
102
|
+
for (const members of sets.values()) {
|
|
103
|
+
if (members.length < 3) continue;
|
|
104
|
+
records += members.length;
|
|
105
|
+
largestSet = Math.max(largestSet, members.length);
|
|
106
|
+
for (const member of members) counted.add(member);
|
|
107
|
+
}
|
|
108
|
+
for (const child of parent.children) if (!counted.has(child)) walk(child);
|
|
109
|
+
};
|
|
110
|
+
walk(document.body);
|
|
111
|
+
|
|
112
|
+
const page = (url) => url.origin + url.pathname.replace(/\/(index\.html?)?$/, '/');
|
|
113
|
+
const here = page(new URL(location.href));
|
|
114
|
+
const destinations = new Set();
|
|
115
|
+
for (const link of document.querySelectorAll('a[href]')) {
|
|
116
|
+
let url;
|
|
117
|
+
try { url = new URL(link.getAttribute('href'), location.href); } catch { continue; }
|
|
118
|
+
if (!/^(https?|file):$/.test(url.protocol) || url.origin !== location.origin) continue;
|
|
119
|
+
if (page(url) !== here) destinations.add(page(url));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const controls = document.querySelectorAll(
|
|
123
|
+
'input:not([type="hidden"]), select, textarea, [role="tab"], [role="switch"], [role="combobox"], [aria-pressed], [aria-expanded], [aria-selected], details',
|
|
124
|
+
).length;
|
|
125
|
+
|
|
126
|
+
const pinned = all.filter((el) => {
|
|
127
|
+
const position = getComputedStyle(el).position;
|
|
128
|
+
if (position !== 'fixed' && position !== 'sticky') return false;
|
|
129
|
+
const box = el.getBoundingClientRect();
|
|
130
|
+
return shown(el) && box.width >= vw * 0.5 && box.height >= 32 && box.height <= vh * 0.3;
|
|
131
|
+
}).length;
|
|
132
|
+
|
|
133
|
+
const pageHeight = Math.max(root.scrollHeight, document.body.scrollHeight);
|
|
134
|
+
|
|
135
|
+
// Access, over the whole page: what a script can count. The numbers are WCAG 2.2 AA
|
|
136
|
+
// and must equal the judge's floor; the method's test compares them.
|
|
137
|
+
const access = (() => {
|
|
138
|
+
const limits = { target: 24, contrast: 4.5, largeContrast: 3, comfort: 44 };
|
|
139
|
+
const visible = all.filter(shown);
|
|
140
|
+
const unheard = (el) => Boolean(el.closest('[aria-hidden="true"], [inert]'));
|
|
141
|
+
const decorative = (el) => /^(presentation|none)$/.test(el.getAttribute('role') || '');
|
|
142
|
+
// Kept for a screen reader and clipped out of sight, as a skip link is until focused.
|
|
143
|
+
const clipped = (el) => {
|
|
144
|
+
for (let node = el, level = 0; node && level < 3; node = node.parentElement, level += 1) {
|
|
145
|
+
const style = getComputedStyle(node);
|
|
146
|
+
if ((style.clip !== 'auto' && /absolute|fixed/.test(style.position)) || /inset\((50|100)%/.test(style.clipPath)) return true;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
};
|
|
150
|
+
const words = (text) => (text || '').replace(/\s+/g, ' ').trim();
|
|
151
|
+
const labelledBy = (el) => words((el.getAttribute('aria-labelledby') || '').split(/\s+/)
|
|
152
|
+
.map((id) => (id && document.getElementById(id) ? document.getElementById(id).textContent : '')).join(' '));
|
|
153
|
+
const said = (el) => words(el.getAttribute('aria-label')) || labelledBy(el);
|
|
154
|
+
const tell = (el, extra = '') => {
|
|
155
|
+
const text = said(el) || words(el.innerText || el.textContent) || words(el.getAttribute('alt')) || words(el.getAttribute('name'))
|
|
156
|
+
|| words(el.getAttribute('placeholder')) || words((el.getAttribute('src') || el.getAttribute('href') || '').split('/').pop());
|
|
157
|
+
const mark = el.id ? `#${el.id}` : el.classList[0] ? `.${el.classList[0]}` : '';
|
|
158
|
+
return `${el.tagName.toLowerCase()}${mark}${text ? ` “${text.slice(0, 28)}”` : ''}${extra}`;
|
|
159
|
+
};
|
|
160
|
+
const examples = {};
|
|
161
|
+
const keep = (key, list, extra = () => '') => {
|
|
162
|
+
if (list.length) examples[key] = list.slice(0, 3).map((item) => tell(item.el || item, extra(item)));
|
|
163
|
+
return list.length;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const images = [...document.images].filter((el) => shown(el) && !unheard(el) && !decorative(el));
|
|
167
|
+
const noAlt = images.filter((el) => !el.hasAttribute('alt'));
|
|
168
|
+
const emptyAlt = images.filter((el) => {
|
|
169
|
+
const box = el.getBoundingClientRect();
|
|
170
|
+
return el.hasAttribute('alt') && !words(el.alt) && box.width >= 80 && box.height >= 80;
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// A styled radio or checkbox is often invisible itself and drawn by its label.
|
|
174
|
+
const reachable = (el) => shown(el) || Boolean(el.labels && [...el.labels].some(shown));
|
|
175
|
+
const fields = [...document.querySelectorAll(
|
|
176
|
+
'input:not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]), select, textarea',
|
|
177
|
+
)].filter((el) => reachable(el) && !unheard(el));
|
|
178
|
+
const unlabelled = fields.filter((el) => !(el.labels && [...el.labels].some((label) => words(label.textContent)))
|
|
179
|
+
&& !said(el) && !words(el.getAttribute('title')));
|
|
180
|
+
|
|
181
|
+
const named = visible.filter((el) => el.matches(
|
|
182
|
+
'a[href], button, [role="button"], [role="tab"], [role="link"], summary, input[type="submit"], input[type="button"], input[type="reset"], input[type="image"]',
|
|
183
|
+
) && !unheard(el));
|
|
184
|
+
const unnamed = named.filter((el) => !(said(el) || words(el.innerText || el.textContent)
|
|
185
|
+
|| words([...el.querySelectorAll('img[alt], [aria-label], svg title')]
|
|
186
|
+
.map((node) => node.getAttribute('alt') || node.getAttribute('aria-label') || node.textContent).join(' '))
|
|
187
|
+
|| words(el.getAttribute('title')) || words(el.getAttribute('alt'))
|
|
188
|
+
// An input button announces its value, and a bare submit or reset input a default word.
|
|
189
|
+
|| (el.matches('input') && (words(el.value) || /^(submit|reset)$/.test(el.type)))));
|
|
190
|
+
|
|
191
|
+
// Target size. A target under 24 px passes when a 24 px circle on its centre reaches
|
|
192
|
+
// no other target; a link inside a sentence is exempt.
|
|
193
|
+
const pageWidth = Math.max(root.scrollWidth, vw);
|
|
194
|
+
const inSentence = (el) => {
|
|
195
|
+
if (getComputedStyle(el).display !== 'inline' || !el.parentElement) return false;
|
|
196
|
+
let other = 0;
|
|
197
|
+
for (const node of el.parentElement.childNodes) if (node.nodeType === 3) other += node.textContent.replace(/\s/g, '').length;
|
|
198
|
+
return other >= 3;
|
|
199
|
+
};
|
|
200
|
+
const targets = [];
|
|
201
|
+
for (const el of document.querySelectorAll(actionSelector)) {
|
|
202
|
+
// A mock-up of a product may hold buttons nobody can press.
|
|
203
|
+
if (!reachable(el) || el.disabled || inSentence(el) || clipped(el) || el.closest('[inert]') || getComputedStyle(el).pointerEvents === 'none') continue;
|
|
204
|
+
const box = { left: Infinity, top: Infinity, right: -Infinity, bottom: -Infinity };
|
|
205
|
+
const choice = /^(checkbox|radio)$/.test(el.type || '');
|
|
206
|
+
for (const part of [el, ...el.children, ...(choice && el.labels ? el.labels : [])]) {
|
|
207
|
+
const rect = part.getBoundingClientRect();
|
|
208
|
+
if (rect.width <= 0 || rect.height <= 0) continue;
|
|
209
|
+
box.left = Math.min(box.left, rect.left); box.top = Math.min(box.top, rect.top);
|
|
210
|
+
box.right = Math.max(box.right, rect.right); box.bottom = Math.max(box.bottom, rect.bottom);
|
|
211
|
+
}
|
|
212
|
+
const width = box.right - box.left;
|
|
213
|
+
const height = box.bottom - box.top;
|
|
214
|
+
// Hidden until focused (a skip link), or parked off the page (a closed menu).
|
|
215
|
+
if (!(width > 1 && height > 1) || box.right <= 0 || box.left >= pageWidth || box.bottom + window.scrollY <= 0) continue;
|
|
216
|
+
// A pinned bar slides over the page, so it is only ever beside what is pinned with it.
|
|
217
|
+
let pin = el;
|
|
218
|
+
while (pin && !/fixed|sticky/.test(getComputedStyle(pin).position)) pin = pin.parentElement;
|
|
219
|
+
targets.push({ el, box, width, height, pin, x: (box.left + box.right) / 2, y: (box.top + box.bottom) / 2,
|
|
220
|
+
small: width < limits.target - 0.5 || height < limits.target - 0.5 });
|
|
221
|
+
}
|
|
222
|
+
const crowded = targets.filter((target) => target.small && targets.some((other) => {
|
|
223
|
+
if (other === target || other.pin !== target.pin || other.el.contains(target.el) || target.el.contains(other.el)) return false;
|
|
224
|
+
if (other.small) return Math.hypot(other.x - target.x, other.y - target.y) < limits.target;
|
|
225
|
+
const dx = Math.max(other.box.left - target.x, 0, target.x - other.box.right);
|
|
226
|
+
const dy = Math.max(other.box.top - target.y, 0, target.y - other.box.bottom);
|
|
227
|
+
return Math.hypot(dx, dy) < limits.target / 2;
|
|
228
|
+
}));
|
|
229
|
+
const underComfort = targets.filter((target) => target.el.matches('button, [role="button"], select, textarea, input')
|
|
230
|
+
&& !/^(checkbox|radio)$/.test(target.el.type || '') && target.height < limits.comfort - 0.5).length;
|
|
231
|
+
|
|
232
|
+
// Contrast, where the background can be read: a solid colour on the text's own
|
|
233
|
+
// element or an ancestor. Text over a picture or a gradient is counted, not judged.
|
|
234
|
+
// A colour written as oklch(), lab() or color() is returned that way, not as rgb();
|
|
235
|
+
// a one-pixel canvas the probe draws on itself converts it.
|
|
236
|
+
const paint = document.createElement('canvas').getContext('2d', { willReadFrequently: true });
|
|
237
|
+
const rgba = (value) => {
|
|
238
|
+
const found = /^rgba?\(([^)]+)\)$/.exec(value || '');
|
|
239
|
+
const parts = found ? found[1].split(/[\s,/]+/).filter(Boolean).map(parseFloat) : [];
|
|
240
|
+
if (parts.length >= 3 && parts.every(Number.isFinite)) return [parts[0], parts[1], parts[2], parts.length > 3 ? parts[3] : 1];
|
|
241
|
+
if (!value || !paint) return null;
|
|
242
|
+
paint.clearRect(0, 0, 1, 1);
|
|
243
|
+
paint.fillStyle = 'rgba(0, 0, 0, 0)';
|
|
244
|
+
paint.fillStyle = value;
|
|
245
|
+
paint.fillRect(0, 0, 1, 1);
|
|
246
|
+
const [r, g, b, a] = paint.getImageData(0, 0, 1, 1).data;
|
|
247
|
+
return [r, g, b, a / 255];
|
|
248
|
+
};
|
|
249
|
+
const luminance = ([r, g, b]) => {
|
|
250
|
+
const channel = (value) => (value / 255 <= 0.03928 ? value / 255 / 12.92 : ((value / 255 + 0.055) / 1.055) ** 2.4);
|
|
251
|
+
return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
|
|
252
|
+
};
|
|
253
|
+
const painted = (style) => style.backgroundImage !== 'none' || (rgba(style.backgroundColor) || [0, 0, 0, 0])[3] > 0.02;
|
|
254
|
+
const pagePictures = visible
|
|
255
|
+
.filter((el) => el.matches('img, video, picture, canvas, svg') || getComputedStyle(el).backgroundImage.includes('url('))
|
|
256
|
+
.map((el) => ({ el, box: el.getBoundingClientRect() }))
|
|
257
|
+
.filter((picture) => picture.box.width >= 80 && picture.box.height >= 80);
|
|
258
|
+
// A positioned block with a fill, such as a highlight laid behind one word, may sit
|
|
259
|
+
// under text that is not inside it. The script cannot tell which is in front.
|
|
260
|
+
for (const el of visible) {
|
|
261
|
+
const style = getComputedStyle(el);
|
|
262
|
+
if (!/absolute|fixed/.test(style.position) || !painted(style)) continue;
|
|
263
|
+
const box = el.getBoundingClientRect();
|
|
264
|
+
if (box.width >= 12 && box.height >= 12) pagePictures.push({ el, box });
|
|
265
|
+
}
|
|
266
|
+
const surfaces = new Map();
|
|
267
|
+
const surface = (el) => {
|
|
268
|
+
if (surfaces.has(el)) return surfaces.get(el);
|
|
269
|
+
const style = getComputedStyle(el);
|
|
270
|
+
let unreadable = style.backgroundImage !== 'none' || Number(style.opacity) < 1;
|
|
271
|
+
for (const which of ['::before', '::after']) {
|
|
272
|
+
const pseudo = getComputedStyle(el, which);
|
|
273
|
+
if (pseudo.content === 'none' || pseudo.content === 'normal' || !/absolute|fixed/.test(pseudo.position)) continue;
|
|
274
|
+
// An underline two pixels tall is not a background; a block behind a word is.
|
|
275
|
+
if (painted(pseudo) && Number(pseudo.opacity) > 0 && parseFloat(pseudo.width) >= 12 && parseFloat(pseudo.height) >= 12) unreadable = true;
|
|
276
|
+
}
|
|
277
|
+
const found = { unreadable, color: rgba(style.backgroundColor) };
|
|
278
|
+
surfaces.set(el, found);
|
|
279
|
+
return found;
|
|
280
|
+
};
|
|
281
|
+
const behind = (el, box) => {
|
|
282
|
+
const over = pagePictures.filter((picture) => !picture.el.contains(el) && !el.contains(picture.el)
|
|
283
|
+
&& picture.box.left < box.right && picture.box.right > box.left && picture.box.top < box.bottom && picture.box.bottom > box.top);
|
|
284
|
+
for (let node = el; node; node = node.parentElement) {
|
|
285
|
+
const found = surface(node);
|
|
286
|
+
if (found.unreadable || over.some((picture) => node.contains(picture.el))) return null;
|
|
287
|
+
if (!found.color) return null;
|
|
288
|
+
if (found.color[3] >= 0.99) return found.color;
|
|
289
|
+
if (found.color[3] > 0.02) return null;
|
|
290
|
+
}
|
|
291
|
+
return [255, 255, 255, 1];
|
|
292
|
+
};
|
|
293
|
+
let texts = 0;
|
|
294
|
+
let onPictures = 0;
|
|
295
|
+
let covered = 0;
|
|
296
|
+
const low = [];
|
|
297
|
+
const photoText = [];
|
|
298
|
+
// What of a line can be seen: the part inside every ancestor that clips its overflow.
|
|
299
|
+
const visiblePart = (el, line) => {
|
|
300
|
+
let [left, top, right, bottom] = [line.left, line.top, line.right, line.bottom];
|
|
301
|
+
for (let node = el.parentElement; node && node !== document.body; node = node.parentElement) {
|
|
302
|
+
const style = getComputedStyle(node);
|
|
303
|
+
if (style.overflowX === 'visible' && style.overflowY === 'visible') continue;
|
|
304
|
+
const clip = node.getBoundingClientRect();
|
|
305
|
+
if (style.overflowX !== 'visible') { left = Math.max(left, clip.left); right = Math.min(right, clip.right); }
|
|
306
|
+
if (style.overflowY !== 'visible') { top = Math.max(top, clip.top); bottom = Math.min(bottom, clip.bottom); }
|
|
307
|
+
}
|
|
308
|
+
return right - left > 1 && bottom - top > 1 ? [left, top, right - left, bottom - top] : null;
|
|
309
|
+
};
|
|
310
|
+
// Text under something drawn on top of it, such as a card fanned over another, is not
|
|
311
|
+
// seen. Each line's centre is brought to the middle of the screen and hit-tested with
|
|
312
|
+
// pointer events on everywhere, then the scroll is put back at once: every other box
|
|
313
|
+
// here is read at the scroll the probe started from.
|
|
314
|
+
const reach = document.createElement('style');
|
|
315
|
+
reach.textContent = '*, *::before, *::after { pointer-events: auto !important; }';
|
|
316
|
+
const resting = [window.scrollX, window.scrollY];
|
|
317
|
+
const hidden = (el, lines) => {
|
|
318
|
+
let under = 0;
|
|
319
|
+
for (const [left, top, wide, tall] of lines) {
|
|
320
|
+
const [x, y] = [left + wide / 2, top + tall / 2];
|
|
321
|
+
window.scrollTo(Math.max(0, x - vw / 2), Math.max(0, y - vh / 2));
|
|
322
|
+
const hit = document.elementFromPoint(x - window.scrollX, y - window.scrollY);
|
|
323
|
+
if (hit && hit !== el && !el.contains(hit) && !hit.contains(el)) under += 1;
|
|
324
|
+
}
|
|
325
|
+
window.scrollTo(resting[0], resting[1]);
|
|
326
|
+
return under * 2 > lines.length;
|
|
327
|
+
};
|
|
328
|
+
const range = document.createRange();
|
|
329
|
+
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
|
330
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
331
|
+
const el = node.parentElement;
|
|
332
|
+
if (!node.textContent.trim() || !el || !shown(el) || el.closest('script, style, noscript, :disabled, [aria-disabled="true"]')) continue;
|
|
333
|
+
range.selectNodeContents(node);
|
|
334
|
+
const box = range.getBoundingClientRect();
|
|
335
|
+
if (box.width <= 1 || box.height <= 1 || clipped(el)) continue;
|
|
336
|
+
const style = getComputedStyle(el);
|
|
337
|
+
// Text in an SVG drawing is painted with fill, not color, and sits on the drawing.
|
|
338
|
+
const vector = el.closest('svg');
|
|
339
|
+
const ink = vector ? (/^(none|url)/.test(style.fill) ? null : rgba(style.fill)) : rgba(style.color);
|
|
340
|
+
if (ink && vector) ink[3] *= Number.isFinite(parseFloat(style.fillOpacity)) ? parseFloat(style.fillOpacity) : 1;
|
|
341
|
+
// Text drawn in a transparent colour is not seen, so it is not judged.
|
|
342
|
+
if (ink && ink[3] <= 0.02) continue;
|
|
343
|
+
if (!ink) { onPictures += 1; continue; }
|
|
344
|
+
const size = parseFloat(style.fontSize);
|
|
345
|
+
const need = size >= 24 || (size >= 18.66 && Number(style.fontWeight) >= 700) ? limits.largeContrast : limits.contrast;
|
|
346
|
+
const back = vector ? null : behind(el, box);
|
|
347
|
+
if (!back) {
|
|
348
|
+
// One rectangle per line, in page coordinates, for a screenshot to measure.
|
|
349
|
+
const rects = [...range.getClientRects()].map((line) => visiblePart(el, line)).filter(Boolean).slice(0, 4)
|
|
350
|
+
.map(([left, top, wide, tall]) => [left + window.scrollX, top + window.scrollY, wide, tall].map((v) => Math.round(v * 10) / 10));
|
|
351
|
+
if (!rects.length) continue;
|
|
352
|
+
if (covered + onPictures < 200) {
|
|
353
|
+
document.head.appendChild(reach);
|
|
354
|
+
const under = hidden(el, rects);
|
|
355
|
+
reach.remove();
|
|
356
|
+
if (under) { covered += 1; continue; }
|
|
357
|
+
}
|
|
358
|
+
onPictures += 1;
|
|
359
|
+
if (photoText.length < 40) photoText.push({ tell: tell(el), ink, need, rects, node });
|
|
360
|
+
continue;
|
|
361
|
+
}
|
|
362
|
+
const mixed = ink.slice(0, 3).map((value, index) => value * ink[3] + back[index] * (1 - ink[3]));
|
|
363
|
+
const lighter = Math.max(luminance(mixed), luminance(back));
|
|
364
|
+
const darker = Math.min(luminance(mixed), luminance(back));
|
|
365
|
+
const ratio = (lighter + 0.05) / (darker + 0.05);
|
|
366
|
+
texts += 1;
|
|
367
|
+
if (ratio < need) low.push({ el, ratio, need });
|
|
368
|
+
}
|
|
369
|
+
low.sort((a, b) => a.ratio - b.ratio);
|
|
370
|
+
|
|
371
|
+
// With tight leading a line's box takes in the letters of the line above or below it,
|
|
372
|
+
// which the marked screenshot paints the same colour. Trim each recorded line where
|
|
373
|
+
// another piece of text overlaps it from above or below.
|
|
374
|
+
if (photoText.length) {
|
|
375
|
+
const others = [];
|
|
376
|
+
const every = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
|
377
|
+
for (let node = every.nextNode(); node && others.length < 6000; node = every.nextNode()) {
|
|
378
|
+
if (!node.textContent.trim() || !node.parentElement || !shown(node.parentElement)) continue;
|
|
379
|
+
range.selectNodeContents(node);
|
|
380
|
+
for (const line of range.getClientRects()) {
|
|
381
|
+
if (line.width > 1 && line.height > 1) {
|
|
382
|
+
others.push({ node, left: line.left + window.scrollX, right: line.right + window.scrollX, top: line.top + window.scrollY, bottom: line.bottom + window.scrollY });
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
for (const text of photoText) {
|
|
387
|
+
const trimmed = text.rects.map(([left, top, wide, tall]) => {
|
|
388
|
+
let [upper, lower] = [top, top + tall];
|
|
389
|
+
for (const other of others) {
|
|
390
|
+
if (other.node === text.node || other.right <= left || other.left >= left + wide || other.bottom <= upper || other.top >= lower) continue;
|
|
391
|
+
const middle = (other.top + other.bottom) / 2;
|
|
392
|
+
if (middle < top + tall * 0.25) upper = Math.max(upper, other.bottom);
|
|
393
|
+
else if (middle > top + tall * 0.75) lower = Math.min(lower, other.top);
|
|
394
|
+
}
|
|
395
|
+
return lower - upper > 2 ? [left, upper, wide, lower - upper].map((v) => Math.round(v * 10) / 10) : null;
|
|
396
|
+
}).filter(Boolean);
|
|
397
|
+
if (trimmed.length) text.rects = trimmed;
|
|
398
|
+
delete text.node;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// Focus, last, because it moves focus. Each control is focused from script and
|
|
403
|
+
// compared with itself unfocused, with its labels, what it contains and what wraps it:
|
|
404
|
+
// the indicator may be drawn on any of them. A control that changes nothing at all is unmarked.
|
|
405
|
+
const still = document.createElement('style');
|
|
406
|
+
still.textContent = '*, *::before, *::after { transition: none !important; }';
|
|
407
|
+
document.head.appendChild(still);
|
|
408
|
+
const look = (el) => {
|
|
409
|
+
const around = [el, ...(el.labels ? el.labels : []), ...[...el.querySelectorAll('*')].slice(0, 12)];
|
|
410
|
+
for (let up = el.parentElement, level = 0; up && level < 5; up = up.parentElement, level += 1) around.push(up);
|
|
411
|
+
const seen = [];
|
|
412
|
+
for (const node of around) {
|
|
413
|
+
for (const which of [null, '::before', '::after']) {
|
|
414
|
+
const style = getComputedStyle(node, which);
|
|
415
|
+
seen.push(style.outlineStyle, style.outlineWidth, style.outlineColor, style.outlineOffset, style.boxShadow, style.borderTopColor,
|
|
416
|
+
style.borderBottomColor, style.borderLeftColor, style.borderBottomWidth, style.backgroundColor, style.backgroundImage, style.color,
|
|
417
|
+
style.textDecorationLine, style.textDecorationColor, style.opacity, style.content);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return seen.join('|');
|
|
421
|
+
};
|
|
422
|
+
const before = document.activeElement;
|
|
423
|
+
const scroll = [window.scrollX, window.scrollY];
|
|
424
|
+
const focusable = [...document.querySelectorAll('a[href], button, input:not([type="hidden"]), select, textarea, summary, [tabindex]')]
|
|
425
|
+
.filter((el) => reachable(el) && el.tabIndex >= 0 && !el.disabled).slice(0, 200);
|
|
426
|
+
const unmarked = [];
|
|
427
|
+
let focused = 0;
|
|
428
|
+
let unread = 0;
|
|
429
|
+
for (const el of focusable) {
|
|
430
|
+
if (document.activeElement && document.activeElement !== document.body) document.activeElement.blur();
|
|
431
|
+
const resting = look(el);
|
|
432
|
+
el.focus({ preventScroll: true });
|
|
433
|
+
if (document.activeElement !== el) continue;
|
|
434
|
+
focused += 1;
|
|
435
|
+
if (look(el) !== resting) continue;
|
|
436
|
+
if (el.matches(':focus-visible')) unmarked.push(el); else unread += 1;
|
|
437
|
+
}
|
|
438
|
+
if (document.activeElement && document.activeElement !== document.body) document.activeElement.blur();
|
|
439
|
+
if (before && before !== document.body && before.focus) before.focus({ preventScroll: true });
|
|
440
|
+
still.remove();
|
|
441
|
+
window.scrollTo(scroll[0], scroll[1]);
|
|
442
|
+
|
|
443
|
+
return {
|
|
444
|
+
lang: words(root.getAttribute('lang')),
|
|
445
|
+
title: Boolean(words(document.title)),
|
|
446
|
+
images: images.length,
|
|
447
|
+
imagesNoAlt: keep('imagesNoAlt', noAlt),
|
|
448
|
+
picturesEmptyAlt: keep('picturesEmptyAlt', emptyAlt),
|
|
449
|
+
fields: fields.length,
|
|
450
|
+
fieldsUnlabelled: keep('fieldsUnlabelled', unlabelled),
|
|
451
|
+
named: named.length,
|
|
452
|
+
unnamed: keep('unnamed', unnamed),
|
|
453
|
+
targets: targets.length,
|
|
454
|
+
smallTargets: keep('smallTargets', crowded, (target) => ` ${Math.round(target.width)}×${Math.round(target.height)}`),
|
|
455
|
+
underComfort,
|
|
456
|
+
focusable: focused,
|
|
457
|
+
focusUnmarked: keep('focusUnmarked', unmarked),
|
|
458
|
+
focusUnread: unread,
|
|
459
|
+
texts,
|
|
460
|
+
lowContrast: keep('lowContrast', low, (item) => ` ${Math.floor(item.ratio * 10) / 10}:1, needs ${item.need}:1`),
|
|
461
|
+
textOnPictures: onPictures,
|
|
462
|
+
textCovered: covered,
|
|
463
|
+
photoText,
|
|
464
|
+
pixelRatio: window.devicePixelRatio || 1,
|
|
465
|
+
pageHeight: Math.round(pageHeight),
|
|
466
|
+
examples,
|
|
467
|
+
};
|
|
468
|
+
})();
|
|
469
|
+
|
|
470
|
+
// The look, read to compare with the look builds without the method chose (Step 3).
|
|
471
|
+
// What the text sits on: for each piece, the first opaque surface on it or an ancestor,
|
|
472
|
+
// weighted by its letters; the eight most used are kept. A background image is a picture.
|
|
473
|
+
// A gradient is a surface: the solid colour under it, or else its opaque stops averaged;
|
|
474
|
+
// one with no opaque stop is a glow over what is behind. The headline is the typeface
|
|
475
|
+
// with the most letters among the largest text in the first screen, so a short accent
|
|
476
|
+
// phrase set larger than the words around it does not stand for the headline.
|
|
477
|
+
const look = (() => {
|
|
478
|
+
const paint = document.createElement('canvas').getContext('2d', { willReadFrequently: true });
|
|
479
|
+
const solid = (value) => {
|
|
480
|
+
if (!paint || !value) return null;
|
|
481
|
+
paint.clearRect(0, 0, 1, 1);
|
|
482
|
+
paint.fillStyle = 'rgba(0, 0, 0, 0)';
|
|
483
|
+
paint.fillStyle = value;
|
|
484
|
+
paint.fillRect(0, 0, 1, 1);
|
|
485
|
+
const [r, g, b, a] = paint.getImageData(0, 0, 1, 1).data;
|
|
486
|
+
return a >= 252 ? [r, g, b] : null;
|
|
487
|
+
};
|
|
488
|
+
const hex = (rgb) => `#${rgb.map((n) => Math.round(n).toString(16).padStart(2, '0')).join('')}`;
|
|
489
|
+
const behind = new Map();
|
|
490
|
+
const canvasOf = (el) => {
|
|
491
|
+
for (let node = el; node; node = node.parentElement) {
|
|
492
|
+
if (behind.has(node)) return behind.get(node);
|
|
493
|
+
const style = getComputedStyle(node);
|
|
494
|
+
if (style.backgroundImage.includes('url(')) return behind.set(node, 'picture').get(node);
|
|
495
|
+
const color = solid(style.backgroundColor);
|
|
496
|
+
if (color) return behind.set(node, hex(color)).get(node);
|
|
497
|
+
if (style.backgroundImage === 'none') continue;
|
|
498
|
+
const stops = (style.backgroundImage.match(/[a-z]+\([^()]*\)|#[0-9a-f]{3,8}\b/gi) || [])
|
|
499
|
+
.filter((stop) => !/gradient/i.test(stop)).map(solid).filter(Boolean);
|
|
500
|
+
if (stops.length) return behind.set(node, hex([0, 1, 2].map((at) => stops.reduce((sum, stop) => sum + stop[at], 0) / stops.length))).get(node);
|
|
501
|
+
}
|
|
502
|
+
return '#ffffff';
|
|
503
|
+
};
|
|
504
|
+
const weight = new Map();
|
|
505
|
+
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
|
506
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
507
|
+
const el = node.parentElement;
|
|
508
|
+
const letters = node.textContent.replace(/\s+/g, '').length;
|
|
509
|
+
if (!letters || !el || el.closest('script, style, noscript, svg') || !shown(el)) continue;
|
|
510
|
+
const on = canvasOf(el);
|
|
511
|
+
weight.set(on, (weight.get(on) || 0) + letters);
|
|
512
|
+
}
|
|
513
|
+
const total = [...weight.values()].reduce((sum, n) => sum + n, 0);
|
|
514
|
+
const backgrounds = [...weight].sort((a, b) => b[1] - a[1]).slice(0, 8)
|
|
515
|
+
.map(([on, letters]) => [on, Math.round((letters / total) * 100) / 100]);
|
|
516
|
+
const sized = [];
|
|
517
|
+
for (const el of first) {
|
|
518
|
+
if (el.closest('svg, script, style, noscript')) continue;
|
|
519
|
+
const own = [...el.childNodes].filter((n) => n.nodeType === 3).map((n) => n.textContent).join('');
|
|
520
|
+
const letters = (own.match(/\p{L}/gu) || []).length;
|
|
521
|
+
if (letters < 2) continue;
|
|
522
|
+
const style = getComputedStyle(el);
|
|
523
|
+
const size = parseFloat(style.fontSize);
|
|
524
|
+
// A title kept for a screen reader and clipped out of sight is not the headline a visitor sees.
|
|
525
|
+
const box = el.getBoundingClientRect();
|
|
526
|
+
if (box.height < size * 0.6 || box.width < size) continue;
|
|
527
|
+
sized.push({ el, letters, size, family: style.fontFamily });
|
|
528
|
+
}
|
|
529
|
+
const top = sized.reduce((most, item) => Math.max(most, item.size), 0);
|
|
530
|
+
const byFamily = new Map();
|
|
531
|
+
for (const item of sized) if (item.size >= top * 0.8) byFamily.set(item.family, (byFamily.get(item.family) || 0) + item.letters);
|
|
532
|
+
const family = ([...byFamily].sort((a, b) => b[1] - a[1])[0] || [])[0];
|
|
533
|
+
const lead = sized.filter((item) => item.family === family).sort((a, b) => b.size - a.size)[0];
|
|
534
|
+
const headline = lead
|
|
535
|
+
? { family, size: Math.round(lead.size), text: lead.el.textContent.replace(/\s+/g, ' ').trim().slice(0, 40) }
|
|
536
|
+
: null;
|
|
537
|
+
return { backgrounds, headline };
|
|
538
|
+
})();
|
|
539
|
+
|
|
540
|
+
return {
|
|
541
|
+
probe: 1,
|
|
542
|
+
width: vw,
|
|
543
|
+
height: vh,
|
|
544
|
+
actions,
|
|
545
|
+
pictures: pictures.length,
|
|
546
|
+
largestPictureShare: Math.round((largest / (vw * vh)) * 100) / 100,
|
|
547
|
+
families: [...families],
|
|
548
|
+
records,
|
|
549
|
+
largestSet,
|
|
550
|
+
destinations: destinations.size,
|
|
551
|
+
controls,
|
|
552
|
+
pinned,
|
|
553
|
+
screens: Math.round((pageHeight / vh) * 10) / 10,
|
|
554
|
+
overflow: Math.max(0, root.scrollWidth - vw),
|
|
555
|
+
access,
|
|
556
|
+
look,
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
const count = (value) => Number.isFinite(value) && value >= 0;
|
|
561
|
+
|
|
562
|
+
const ACCESS_COUNTS = ['images', 'imagesNoAlt', 'picturesEmptyAlt', 'fields', 'fieldsUnlabelled', 'named', 'unnamed', 'targets', 'smallTargets',
|
|
563
|
+
'underComfort', 'focusable', 'focusUnmarked', 'focusUnread', 'texts', 'lowContrast', 'textOnPictures'];
|
|
564
|
+
|
|
565
|
+
// A result saved before the probe measured access has no `access` and still judges.
|
|
566
|
+
function validAccess(access) {
|
|
567
|
+
const positive = (value) => value === undefined || (Number.isFinite(value) && value > 0);
|
|
568
|
+
return access === undefined || (Boolean(access) && typeof access === 'object' && typeof access.lang === 'string'
|
|
569
|
+
&& typeof access.title === 'boolean' && ACCESS_COUNTS.every((key) => count(access[key]))
|
|
570
|
+
&& (access.photoText === undefined || validPhotoText(access.photoText)) && positive(access.pixelRatio) && positive(access.pageHeight)
|
|
571
|
+
&& (access.textCovered === undefined || count(access.textCovered)));
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
// A result saved before the probe read the look has no `look` and still judges.
|
|
575
|
+
function validLook(look) {
|
|
576
|
+
if (look === undefined) return true;
|
|
577
|
+
if (!look || typeof look !== 'object' || !Array.isArray(look.backgrounds) || look.backgrounds.length > 8
|
|
578
|
+
|| !look.backgrounds.every((entry) => Array.isArray(entry) && entry.length === 2 && /^(#[0-9a-f]{6}|picture)$/.test(entry[0])
|
|
579
|
+
&& Number.isFinite(entry[1]) && entry[1] >= 0 && entry[1] <= 1)) return false;
|
|
580
|
+
const { headline } = look;
|
|
581
|
+
return headline === null || (Boolean(headline) && typeof headline === 'object' && typeof headline.family === 'string'
|
|
582
|
+
&& Number.isFinite(headline.size) && headline.size > 0 && typeof headline.text === 'string');
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function validView(view) {
|
|
586
|
+
return Boolean(view) && typeof view === 'object' && view.probe === 1
|
|
587
|
+
&& ['actions', 'pictures', 'largestPictureShare', 'records', 'largestSet', 'destinations', 'controls', 'screens', 'overflow']
|
|
588
|
+
.every((key) => count(view[key]))
|
|
589
|
+
&& view.width > 0 && view.height > 0 && validAccess(view.access) && validLook(view.look);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// Serif families a builder is likely to load or fall back on. A family not named here is
|
|
593
|
+
// judged by the generic family at the end of its list, so "MyFace, serif" is a serif.
|
|
594
|
+
const SERIFS = new Set(['fraunces', 'georgia', 'times', 'times new roman', 'playfair', 'playfair display', 'cormorant', 'cormorant garamond',
|
|
595
|
+
'eb garamond', 'garamond', 'libre baskerville', 'baskerville', 'lora', 'merriweather', 'newsreader', 'spectral', 'crimson pro', 'crimson text',
|
|
596
|
+
'literata', 'bodoni moda', 'young serif', 'gloock', 'besley', 'alegreya', 'cardo', 'domine', 'gelasio', 'libre caslon text', 'libre caslon display',
|
|
597
|
+
'abril fatface', 'prata', 'yeseva one', 'charter', 'iowan old style', 'palatino', 'palatino linotype', 'book antiqua', 'cambria', 'ui-serif']);
|
|
598
|
+
|
|
599
|
+
// Whether a computed font-family list asks for a serif first.
|
|
600
|
+
export function serifFamily(list) {
|
|
601
|
+
const names = String(list || '').split(',').map((name) => name.replace(/["']/g, '').trim().toLowerCase()).filter(Boolean);
|
|
602
|
+
if (!names.length) return false;
|
|
603
|
+
const [first] = names;
|
|
604
|
+
if (/sans|mono|grotesk|grotesque|gothic/.test(first)) return false;
|
|
605
|
+
if (/serif/.test(first) || SERIFS.has(first)) return true;
|
|
606
|
+
return names[names.length - 1] === 'serif';
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
const lightness = (hex) => {
|
|
610
|
+
const [r, g, b] = [1, 3, 5].map((at) => parseInt(hex.slice(at, at + 2), 16));
|
|
611
|
+
const channel = (value) => (value / 255 <= 0.03928 ? value / 255 / 12.92 : ((value / 255 + 0.055) / 1.055) ** 2.4);
|
|
612
|
+
return { r, g, b, light: 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b) };
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
// A cream or paper canvas: light, with red above green above blue by a visible step. Four
|
|
616
|
+
// takes in #fbfaf7, the lightest warm tint color.md names, and leaves out neutral greys
|
|
617
|
+
// such as #f9f9f8 and #f4f4f1.
|
|
618
|
+
export function warmTint(hex) {
|
|
619
|
+
const { r, g, b, light } = lightness(hex);
|
|
620
|
+
return light >= 0.75 && r >= g && g >= b && r - b >= 4;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
const SURFACES = { warm: 'a warm tint', light: 'white or a neutral light surface', dark: 'a dark or coloured surface', picture: 'pictures' };
|
|
624
|
+
const surfaceOf = (on) => {
|
|
625
|
+
if (on === 'picture') return 'picture';
|
|
626
|
+
if (warmTint(on)) return 'warm';
|
|
627
|
+
return lightness(on).light >= 0.75 ? 'light' : 'dark';
|
|
628
|
+
};
|
|
629
|
+
|
|
630
|
+
// The look builds without the method chose: three of three set the page on cream, two of
|
|
631
|
+
// them under a Fraunces headline. Either alone is a choice; the pair, unasked for, is the
|
|
632
|
+
// default. The canvas is the kind of surface that holds the most text, so a page whose text
|
|
633
|
+
// is spread over several creams is read as cream.
|
|
634
|
+
function judgeLook(look, add, brand) {
|
|
635
|
+
const say = (level, text) => add(level, text, 'look');
|
|
636
|
+
if (!look) {
|
|
637
|
+
say('note', 'the canvas and the headline were not recorded: this result is from an earlier probe, so print the probe and run it again');
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
if (!look.backgrounds.length) {
|
|
641
|
+
say('note', 'no text on the page to read the canvas from');
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
const kinds = {};
|
|
645
|
+
for (const [on, share] of look.backgrounds) {
|
|
646
|
+
const kind = surfaceOf(on);
|
|
647
|
+
kinds[kind] ??= { share: 0, most: on };
|
|
648
|
+
kinds[kind].share += share;
|
|
649
|
+
}
|
|
650
|
+
const [kind, { share, most }] = Object.entries(kinds).sort((a, b) => b[1].share - a[1].share)[0];
|
|
651
|
+
const where = `${Math.round(share * 100)}% of the text on ${SURFACES[kind]}${kind === 'picture' ? '' : ` (${most} most)`}`;
|
|
652
|
+
if (!look.headline) {
|
|
653
|
+
say('note', `${where}; no text in the first screen to read as a headline`);
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
const family = look.headline.family.split(',')[0].replace(/["']/g, '').trim();
|
|
657
|
+
const named = `“${look.headline.text}” in ${family}`;
|
|
658
|
+
if (!(kind === 'warm' && serifFamily(look.headline.family))) {
|
|
659
|
+
say('pass', `${where}, headline ${named}; not the cream canvas with a serif headline that builds without this method chose`);
|
|
660
|
+
} else if (brand) {
|
|
661
|
+
say('note', `${where} and a serif headline, the look builds without this method chose; not judged, because --brand says an existing brand sets them`);
|
|
662
|
+
} else {
|
|
663
|
+
say('FAIL', `the look builds without this method chose: ${where} and a serif headline, ${named};`
|
|
664
|
+
+ ' change the canvas or the type voice, or judge with --brand when an existing brand sets both');
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// Access findings for one view: what a script can count against WCAG 2.2 AA. Passing
|
|
669
|
+
// them is not an audit; the keyboard journey and a screen reader stay manual.
|
|
670
|
+
function judgeAccess(access, add, view, shot) {
|
|
671
|
+
const say = (level, text) => add(level, text, 'access');
|
|
672
|
+
if (!access) {
|
|
673
|
+
say('note', 'access was not measured: this result is from an earlier probe, so print the probe and measure again');
|
|
674
|
+
if (shot) say('note', 'the screenshots were not used: this result has no places for text, so print the probe and measure again');
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
const examples = (key) => {
|
|
678
|
+
const list = access.examples && Array.isArray(access.examples[key]) ? access.examples[key].slice(0, 3).map(String) : [];
|
|
679
|
+
return list.length ? `: ${list.join('; ')}` : '';
|
|
680
|
+
};
|
|
681
|
+
const of = (part, whole, things) => `${part} of ${whole} ${things}`;
|
|
682
|
+
const some = (number, one, many) => `${number} ${number === 1 ? one : many}`;
|
|
683
|
+
const basics = [];
|
|
684
|
+
if (!access.lang) say('FAIL', 'no page language: set lang on the html element so a screen reader pronounces the words');
|
|
685
|
+
else basics.push(`language (${access.lang})`);
|
|
686
|
+
if (!access.title) say('FAIL', 'no page title: a screen reader announces the title first');
|
|
687
|
+
else basics.push('title');
|
|
688
|
+
if (access.imagesNoAlt) say('FAIL', `no alt attribute on ${of(access.imagesNoAlt, access.images, 'images')}${examples('imagesNoAlt')}`);
|
|
689
|
+
else basics.push(`alt on ${access.images} images`);
|
|
690
|
+
if (access.fieldsUnlabelled) {
|
|
691
|
+
say('FAIL', `no label on ${of(access.fieldsUnlabelled, access.fields, 'fields')}; a placeholder is not one${examples('fieldsUnlabelled')}`);
|
|
692
|
+
} else basics.push(`a label on ${access.fields} fields`);
|
|
693
|
+
if (access.unnamed) say('FAIL', `no name to announce on ${of(access.unnamed, access.named, 'links and buttons')}${examples('unnamed')}`);
|
|
694
|
+
else basics.push(`a name on ${access.named} links and buttons`);
|
|
695
|
+
if (basics.length) say('pass', `present: ${basics.join(', ')}`);
|
|
696
|
+
|
|
697
|
+
say(access.smallTargets ? 'FAIL' : 'pass', access.smallTargets
|
|
698
|
+
? `${of(access.smallTargets, access.targets, 'tap targets')} under ${FLOOR.targetSize} px with another target within reach${examples('smallTargets')}`
|
|
699
|
+
: `${some(access.targets, 'tap target', 'tap targets')}, none under ${FLOOR.targetSize} px with another target within reach`);
|
|
700
|
+
say(access.focusUnmarked ? 'FAIL' : 'pass', access.focusUnmarked
|
|
701
|
+
? `no visible change on focus for ${of(access.focusUnmarked, access.focusable, 'controls')}${examples('focusUnmarked')}`
|
|
702
|
+
: `${some(access.focusable - access.focusUnread, 'control changes', 'controls change')} when focused`);
|
|
703
|
+
say(access.lowContrast ? 'FAIL' : 'pass', access.lowContrast
|
|
704
|
+
? `${of(access.lowContrast, access.texts, 'pieces of text')} below contrast (${FLOOR.contrast}:1, or ${FLOOR.largeContrast}:1 from 24 px)${examples('lowContrast')}`
|
|
705
|
+
: `${some(access.texts, 'piece of text meets', 'pieces of text meet')} contrast (${FLOOR.contrast}:1, or ${FLOOR.largeContrast}:1 from 24 px)`);
|
|
706
|
+
|
|
707
|
+
if (access.focusUnread) {
|
|
708
|
+
say('note', `${some(access.focusUnread, 'control', 'controls')} did not show keyboard focus to the script in this browser; Tab there by hand`);
|
|
709
|
+
}
|
|
710
|
+
const boxes = Array.isArray(access.photoText) ? access.photoText : null;
|
|
711
|
+
if (shot && !boxes) say('note', 'the screenshots were not used: this result has no places for text, so print the probe and measure again');
|
|
712
|
+
if (access.textOnPictures && (!shot || !boxes)) {
|
|
713
|
+
say('note', `${some(access.textOnPictures, 'piece of text sits', 'pieces of text sit')} on a picture, a gradient or a see-through surface, not measured; check the render`
|
|
714
|
+
+ (boxes ? ', or measure it with a --marked and a --hidden screenshot' : ''));
|
|
715
|
+
} else if (access.textOnPictures) {
|
|
716
|
+
const found = measurePhotoText(access, view, shot, FLOOR.photoCover);
|
|
717
|
+
const rule = `${FLOOR.contrast}:1, or ${FLOOR.largeContrast}:1 from 24 px, behind ${FLOOR.photoCover * 100}% of the letters`;
|
|
718
|
+
if (found.measured) {
|
|
719
|
+
const named = found.low.slice(0, 3).map((item) => `${item.tell} ${Math.floor(item.ratio * 10) / 10}:1, needs ${item.need}:1`).join('; ');
|
|
720
|
+
say(found.low.length ? 'FAIL' : 'pass', found.low.length
|
|
721
|
+
? `${of(found.low.length, found.measured, 'pieces of text')} on a picture below contrast (${rule}): ${named}`
|
|
722
|
+
: `${some(found.measured, 'piece of text on a picture meets', 'pieces of text on a picture meet')} contrast (${rule})`);
|
|
723
|
+
}
|
|
724
|
+
const reasons = [];
|
|
725
|
+
if (found.outside) reasons.push(`${found.outside} outside the screenshots`);
|
|
726
|
+
if (found.unseen) reasons.push(`${found.unseen} whose letters do not show in them`);
|
|
727
|
+
if (found.changed) reasons.push(`${found.changed} where the page changed between the two screenshots`);
|
|
728
|
+
if (found.moved) reasons.push(`${found.moved} below the first screen, where the page moved after the probe`);
|
|
729
|
+
if (found.unrecorded) reasons.push(`${found.unrecorded} past the first ${access.photoText.length} the probe records`);
|
|
730
|
+
if (reasons.length) say('note', `text on a picture not measured: ${reasons.join(', ')}; check the render`);
|
|
731
|
+
}
|
|
732
|
+
if (access.textCovered) {
|
|
733
|
+
say('note', `${some(access.textCovered, 'piece of text lies', 'pieces of text lie')} under something drawn on top of it and ${access.textCovered === 1 ? 'was' : 'were'} not judged; make sure nothing a visitor needs is hidden`);
|
|
734
|
+
}
|
|
735
|
+
if (access.picturesEmptyAlt) {
|
|
736
|
+
say('note', `${some(access.picturesEmptyAlt, 'picture has an empty alt and a screen reader skips it', 'pictures have an empty alt and a screen reader skips them')}: right for decoration, wrong for a picture of the item${examples('picturesEmptyAlt')}`);
|
|
737
|
+
}
|
|
738
|
+
if (access.underComfort) {
|
|
739
|
+
say('note', `${some(access.underComfort, 'button or field is', 'buttons and fields are')} under ${FLOOR.comfortTarget} px tall; main buttons are ${FLOOR.comfortTarget} px or more`);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// Findings for one view. Each has `level`: 'pass', 'FAIL' or 'note'. A note reports
|
|
744
|
+
// what the probe saw without a verdict, because no number on that count separated
|
|
745
|
+
// the measured sites from a brochure.
|
|
746
|
+
export function judgeView(view, { label = 'page', onePage = false, shot, look = true, brand = false } = {}) {
|
|
747
|
+
if (!validView(view)) throw new TypeError('Expected a result from this probe.');
|
|
748
|
+
const phone = view.width < 700;
|
|
749
|
+
const floor = phone ? FLOOR.phoneActions : FLOOR.actions;
|
|
750
|
+
const surface = view.actions >= floor * FLOOR.surfaceFactor;
|
|
751
|
+
const findings = [];
|
|
752
|
+
const add = (level, text, kind = 'substance') => findings.push({ level, ok: level !== 'FAIL', kind, text: `${label}: ${text}` });
|
|
753
|
+
const verdict = (ok) => (ok ? 'pass' : 'FAIL');
|
|
754
|
+
|
|
755
|
+
add(verdict(view.actions >= floor), `${view.actions} things to act on in the first screen (floor ${floor})`);
|
|
756
|
+
if (onePage) {
|
|
757
|
+
add('note', `${view.destinations} other pages linked; not judged for a one-page brief`);
|
|
758
|
+
} else {
|
|
759
|
+
add(verdict(view.destinations >= FLOOR.destinations), `${view.destinations} other pages or views linked (floor ${FLOOR.destinations})`);
|
|
760
|
+
}
|
|
761
|
+
if (surface && view.screens < FLOOR.screens) {
|
|
762
|
+
add('pass', `working surface: ${view.actions} actions in view, so ${view.screens} screens of height is not judged`);
|
|
763
|
+
} else {
|
|
764
|
+
add(verdict(view.screens >= FLOOR.screens), `${view.screens} screens of content (floor ${FLOOR.screens})`);
|
|
765
|
+
}
|
|
766
|
+
// Pictures. Every studied desktop first screen had four or more, or one covering
|
|
767
|
+
// over a quarter of it. One studied phone page opens on text and a button, so the
|
|
768
|
+
// phone count is reported and not judged.
|
|
769
|
+
const share = Math.round(view.largestPictureShare * 100);
|
|
770
|
+
const seen = `${view.pictures} ${view.pictures === 1 ? 'picture' : 'pictures'} in the first screen`
|
|
771
|
+
+ (view.pictures ? `, the largest covering ${share}%` : '');
|
|
772
|
+
if (phone) {
|
|
773
|
+
add('note', `${seen}; seven of the eight studied phone pages showed at least one`);
|
|
774
|
+
} else {
|
|
775
|
+
const enough = view.pictures >= FLOOR.pictures || (view.pictures >= 1 && view.largestPictureShare >= FLOOR.pictureShare);
|
|
776
|
+
add(verdict(enough), `${seen} (floor ${FLOOR.pictures} pictures, or one covering ${FLOOR.pictureShare * 100}%)`, 'pictures');
|
|
777
|
+
}
|
|
778
|
+
const tolerance = phone ? 0 : 16;
|
|
779
|
+
add(verdict(view.overflow <= tolerance), view.overflow <= tolerance ? 'no sideways scroll' : `${view.overflow} px of sideways scroll`);
|
|
780
|
+
add('note', `${view.records} alike items in sets of three or more, largest set ${view.largestSet}; ${view.controls} controls that take input or change state`);
|
|
781
|
+
if (look) judgeLook(view.look, add, brand);
|
|
782
|
+
judgeAccess(view.access, add, view, shot);
|
|
783
|
+
return findings;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
// `shots` holds each view's pair of decoded screenshots, { marked, hidden }, by view:
|
|
787
|
+
// { desktop, phone } for a result with both views, or { page } for a single one.
|
|
788
|
+
export function judge(result, { shots = {}, ...options } = {}) {
|
|
789
|
+
const views = result && typeof result === 'object' && (result.desktop || result.phone) ? ['desktop', 'phone'] : ['page'];
|
|
790
|
+
for (const name of Object.keys(shots)) {
|
|
791
|
+
if (!views.includes(name) || (name !== 'page' && !result[name])) {
|
|
792
|
+
const error = new TypeError(views[0] === 'page' ? `a screenshot is named ${name}, and this result has one view: give it as --marked <file> --hidden <file>.`
|
|
793
|
+
: `a screenshot is ${name === 'page' ? 'not named' : `named ${name}`}, and this result has no such view: name it desktop=<file> or phone=<file>.`);
|
|
794
|
+
error.shot = true;
|
|
795
|
+
throw error;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
if (views[0] === 'page') return judgeView(result, { ...options, shot: shots.page });
|
|
799
|
+
// The look is the same at both widths, so it is judged once: on the desktop view when there is one.
|
|
800
|
+
return [
|
|
801
|
+
...(result.desktop ? judgeView(result.desktop, { ...options, label: 'desktop', shot: shots.desktop }) : []),
|
|
802
|
+
...(result.phone ? judgeView(result.phone, { ...options, label: 'phone', shot: shots.phone, look: !result.desktop }) : []),
|
|
803
|
+
];
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
function main(argv) {
|
|
807
|
+
if (argv[0] === '--probe' && argv.length === 1) {
|
|
808
|
+
process.stdout.write(`(${probe.toString()})()\n`);
|
|
809
|
+
return 0;
|
|
810
|
+
}
|
|
811
|
+
if (argv[0] === '--mark-text' && argv.length === 1) {
|
|
812
|
+
process.stdout.write(`(${markText.toString()})()\n`);
|
|
813
|
+
return 0;
|
|
814
|
+
}
|
|
815
|
+
if (argv[0] === '--hide-text' && argv.length === 1) {
|
|
816
|
+
process.stdout.write(`(${hideText.toString()})()\n`);
|
|
817
|
+
return 0;
|
|
818
|
+
}
|
|
819
|
+
const usage = 'Usage: node first-screen.mjs --probe | --mark-text | --hide-text | node first-screen.mjs [--one-page] [--access] [--brand]'
|
|
820
|
+
+ ' [--marked desktop=<png> --hidden desktop=<png> --marked phone=<png> --hidden phone=<png>] <result.json>\n';
|
|
821
|
+
const rest = [...argv];
|
|
822
|
+
const shotPaths = {};
|
|
823
|
+
for (const flag of ['--marked', '--hidden']) {
|
|
824
|
+
for (let at = rest.indexOf(flag); at >= 0; at = rest.indexOf(flag)) {
|
|
825
|
+
const value = rest[at + 1];
|
|
826
|
+
const named = /^(desktop|phone)=(.+)$/.exec(value || '');
|
|
827
|
+
const name = named ? named[1] : 'page';
|
|
828
|
+
const kind = flag.slice(2);
|
|
829
|
+
if (!value || value.startsWith('--') || shotPaths[name]?.[kind]) {
|
|
830
|
+
process.stderr.write(usage);
|
|
831
|
+
return 2;
|
|
832
|
+
}
|
|
833
|
+
shotPaths[name] = { ...shotPaths[name], [kind]: named ? named[2] : value };
|
|
834
|
+
rest.splice(at, 2);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
for (const [name, pair] of Object.entries(shotPaths)) {
|
|
838
|
+
if (!pair.marked || !pair.hidden) {
|
|
839
|
+
process.stderr.write(`No verdict: ${name === 'page' ? 'the view' : `the ${name} view`} has a ${pair.marked ? 'marked' : 'hidden'} screenshot`
|
|
840
|
+
+ ` and no ${pair.marked ? 'hidden' : 'marked'} one; the letters are found by comparing the two.\n`);
|
|
841
|
+
return 2;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
const onePage = rest.includes('--one-page');
|
|
845
|
+
const accessOnly = rest.includes('--access');
|
|
846
|
+
const brand = rest.includes('--brand');
|
|
847
|
+
const files = rest.filter((arg) => arg !== '--one-page' && arg !== '--access' && arg !== '--brand');
|
|
848
|
+
if (files.length !== 1 || files[0].startsWith('--')) {
|
|
849
|
+
process.stderr.write(usage);
|
|
850
|
+
return 2;
|
|
851
|
+
}
|
|
852
|
+
const shots = {};
|
|
853
|
+
for (const [name, pair] of Object.entries(shotPaths)) {
|
|
854
|
+
shots[name] = {};
|
|
855
|
+
for (const [kind, path] of Object.entries(pair)) {
|
|
856
|
+
try {
|
|
857
|
+
shots[name][kind] = readPng(readFileSync(path));
|
|
858
|
+
} catch (error) {
|
|
859
|
+
process.stderr.write(`No verdict: ${path}: ${error.code === 'ENOENT' ? 'no such file.' : error.message} Save the screenshot as a PNG.\n`);
|
|
860
|
+
return 2;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
let findings;
|
|
865
|
+
try {
|
|
866
|
+
// Windows PowerShell's redirection puts a byte-order mark first, which is not JSON.
|
|
867
|
+
findings = judge(JSON.parse(readFileSync(files[0], 'utf8').replace(/^/, '')), { onePage, brand, shots });
|
|
868
|
+
} catch (error) {
|
|
869
|
+
if (error.shot) {
|
|
870
|
+
process.stderr.write(`No verdict: ${error.message}\n`);
|
|
871
|
+
return 2;
|
|
872
|
+
}
|
|
873
|
+
process.stderr.write(`No verdict: ${error.message} Save the object the probe returned, or {"desktop": ..., "phone": ...}.\n`);
|
|
874
|
+
return 2;
|
|
875
|
+
}
|
|
876
|
+
// A page that is not the home page is held to the access lines, not to the first-screen floor.
|
|
877
|
+
if (accessOnly) findings = findings.filter((finding) => finding.kind === 'access');
|
|
878
|
+
for (const finding of findings) process.stdout.write(`${finding.level.padEnd(4)} ${finding.text}\n`);
|
|
879
|
+
const failed = findings.filter((finding) => !finding.ok);
|
|
880
|
+
const unmeasured = findings.some((finding) => finding.kind === 'access' && /access was not measured/.test(finding.text));
|
|
881
|
+
if (accessOnly && !failed.length) {
|
|
882
|
+
process.stdout.write(unmeasured ? '\nAccess was not measured.\n'
|
|
883
|
+
: '\nNo access failure a script can count. Use the page by keyboard too.\n');
|
|
884
|
+
return 0;
|
|
885
|
+
}
|
|
886
|
+
if (!failed.length) {
|
|
887
|
+
process.stdout.write('\nAt or above the floor. The floor only catches a brochure or a bare first screen; judge the design in the render.'
|
|
888
|
+
+ (unmeasured ? ' Access was not measured.\n'
|
|
889
|
+
: ' The access lines are what a script can count: use the journey by keyboard too.\n'));
|
|
890
|
+
return 0;
|
|
891
|
+
}
|
|
892
|
+
const reasons = [];
|
|
893
|
+
if (failed.some((finding) => finding.kind === 'substance')) reasons.push('this is a brochure: add what a visitor can choose and do');
|
|
894
|
+
if (failed.some((finding) => finding.kind === 'pictures')) {
|
|
895
|
+
reasons.push('this first screen is bare: give it the photographs, or the product, that a visitor came to see');
|
|
896
|
+
}
|
|
897
|
+
const closing = [];
|
|
898
|
+
if (reasons.length) closing.push(`By the measure of the studied sites ${reasons.join(', and ')}.`);
|
|
899
|
+
if (failed.some((finding) => finding.kind === 'look')) {
|
|
900
|
+
closing.push('This is the look a builder reaches for without the method: change the canvas or the type voice (Step 3).');
|
|
901
|
+
}
|
|
902
|
+
if (failed.some((finding) => finding.kind === 'access')) {
|
|
903
|
+
closing.push('By WCAG 2.2 AA this page shuts some visitors out: repair every access FAIL.');
|
|
904
|
+
}
|
|
905
|
+
process.stdout.write(`\n${failed.length} below the floor. ${closing.join(' ')} Then measure again.\n`);
|
|
906
|
+
return 0;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
910
|
+
process.exitCode = main(process.argv.slice(2));
|
|
911
|
+
}
|