stitch2 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/audit.js
CHANGED
|
@@ -774,8 +774,9 @@ export async function audit(opts) {
|
|
|
774
774
|
}
|
|
775
775
|
// 6e. Text tiers: a sentence to read belongs in the body colour (skills/stitch2/references/typography.md, section 3). A block of reading
|
|
776
776
|
// copy, drawn in the secondary colour, is the usual reason a page reads dull although every contrast ratio passes: the strokes of small
|
|
777
|
-
// text reach only their own colour. A block is reading copy when it holds sixty characters and eight words of its own text
|
|
778
|
-
//
|
|
777
|
+
// text reach only their own colour. A block is reading copy when it holds sixty characters and eight words of its own text at 14px or
|
|
778
|
+
// more (a caption or a field's help text is smaller, and the secondary colour is for it) and sits in the page's content: not in a bar, a
|
|
779
|
+
// table, a menu, a label, a control, a link or a code sample. It needs the secondary colour, which
|
|
779
780
|
// check takes from DESIGN.md's text-muted and passes as a CSS colour the page can resolve (var(--<prefix>-text-muted)).
|
|
780
781
|
if (opts.secondary) {
|
|
781
782
|
const canvas = document.createElement('canvas');
|
|
@@ -803,7 +804,7 @@ export async function audit(opts) {
|
|
|
803
804
|
if (!ownText(el) || opacity(el) < 0.1 || el.closest(apart))
|
|
804
805
|
continue;
|
|
805
806
|
const own = [...el.childNodes].filter((n) => n.nodeType === 3).map((n) => n.textContent).join(' ').replace(/\s+/g, ' ').trim();
|
|
806
|
-
if (own.length < 60 || own.split(' ').length < 8 || !quiet(el))
|
|
807
|
+
if (own.length < 60 || own.split(' ').length < 8 || parseFloat(getComputedStyle(el).fontSize) < 14 || !quiet(el))
|
|
807
808
|
continue;
|
|
808
809
|
push('warning', 'text-tier', el, 'Reading copy in the secondary colour: a sentence to read takes the body colour, and the secondary one is for hints, captions and counts');
|
|
809
810
|
}
|
package/package.json
CHANGED
package/skills/stitch2/SKILL.md
CHANGED
|
@@ -68,7 +68,7 @@ References, read before the first screen:
|
|
|
68
68
|
Text running into other text (`text-overlap`) or out of its card (`overflow`) is an error; a short label cut
|
|
69
69
|
short with an ellipsis (`truncated`) is a warning to fix with room, not a smaller size. Google's rules are
|
|
70
70
|
warnings too (`text-small`, `edge-margin`, `measure`, `tap-spacing`, `placeholder-label`, `unnamed-control`,
|
|
71
|
-
`nav-destinations`, `focus-visible`, `text-tier`; see google.md): `text-tier` is a block of reading copy (sixty characters
|
|
71
|
+
`nav-destinations`, `focus-visible`, `text-tier`; see google.md): `text-tier` is a block of reading copy (sixty characters and eight words at 14px or more, in the page's content and not in a bar, table, control or link) drawn in DESIGN.md's `text-muted`; give it the body colour (typography.md, section 3): fix them, or say in the hand-over why the screen breaks one. When DESIGN.md has a
|
|
72
72
|
light and a dark theme, every screen is checked in both: an issue marked with a theme
|
|
73
73
|
("light theme: Low contrast…") is fixed in DESIGN.md's colours for that theme when it shows on many
|
|
74
74
|
screens, or in the screen when it is one element. Look at both renders (`--light.png`). With `i18n`, check
|
|
@@ -67,8 +67,8 @@ To make something stand out inside a row, change its weight or colour, not its s
|
|
|
67
67
|
ratio. The glyph edges are not the problem either (they render as sharp as a clean page); the colour and the tier
|
|
68
68
|
are. Measure the share of characters in each tier: when most of a page's characters are in the secondary colour,
|
|
69
69
|
or a paragraph of two sentences is, the copy is in the wrong tier. `check` warns about the second case **(check: text-tier)**: a block of
|
|
70
|
-
reading copy (sixty characters and eight words of its own text, in the page's content and not in a bar,
|
|
71
|
-
label, control or link) drawn in DESIGN.md's `text-muted`. It needs that colour in DESIGN.md and is silent without it.
|
|
70
|
+
reading copy (sixty characters and eight words of its own text at 14 px or more, in the page's content and not in a bar,
|
|
71
|
+
table, menu, label, control or link) drawn in DESIGN.md's `text-muted`. It needs that colour in DESIGN.md and is silent without it.
|
|
72
72
|
|
|
73
73
|
```js
|
|
74
74
|
// characters per computed colour and size, from the rendered page (run it with Playwright's page.evaluate)
|