@domandigital/create-site 0.7.0 → 0.7.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @domandigital/create-site
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c88e737: The site measure gate now sees sideways scroll at phone widths (DOM-774). It compared `scrollWidth` with `window.innerWidth`, which grows with the page under mobile emulation, so a 500px-wide page at 375 passed. It now measures against the layout viewport (`clientWidth`), reports a page with no `width=device-width` viewport meta, and treats a target parked past the right edge as off the page, as `@domandigital/craft/phone` does.
|
|
8
|
+
|
|
3
9
|
## 0.7.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domandigital/create-site",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The first thing that runs on a new Doman Digital client site: installs the house packages and writes the per-site files they read (the facts file, route policy, backlink register, redirects, JSON-LD, the designer credit, house docs and the SEO checks), so every build starts on the same foundation and stays upgradeable by bumping packages.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"tsup": "^8.3.5",
|
|
42
42
|
"typescript": "^5.6.3",
|
|
43
43
|
"vitest": "^4.0.0",
|
|
44
|
-
"@domandigital/craft": "^0.19.
|
|
44
|
+
"@domandigital/craft": "^0.19.3",
|
|
45
45
|
"@domandigital/graph": "^0.7.0",
|
|
46
46
|
"@domandigital/seo": "^0.3.1"
|
|
47
47
|
},
|
|
@@ -99,8 +99,12 @@ for (const route of pages) {
|
|
|
99
99
|
const small = texty
|
|
100
100
|
.map((e) => ({ tag: e.tagName.toLowerCase(), cls: String(e.className || ""), px: parseFloat(getComputedStyle(e).fontSize), text: e.textContent.trim().slice(0, 40) }))
|
|
101
101
|
.filter((t) => t.px < minFontPx);
|
|
102
|
+
// The layout viewport. Under mobile emulation innerWidth grows with the page (the phone zooms out to fit it), so it can never show sideways scroll.
|
|
103
|
+
const vw = document.documentElement.clientWidth;
|
|
102
104
|
const out = {
|
|
103
|
-
|
|
105
|
+
// No width=device-width viewport meta: the phone lays the page out at 980px and shrinks it. Otherwise, the page is wider than the phone.
|
|
106
|
+
noViewportMeta: vw > window.screen.width + 1,
|
|
107
|
+
horizontalScroll: vw <= window.screen.width + 1 && document.documentElement.scrollWidth > vw + 1,
|
|
104
108
|
fontSizesUsed: [...new Set(texty.map((e) => getComputedStyle(e).fontSize))].sort((a, b) => parseFloat(a) - parseFloat(b)),
|
|
105
109
|
smallText: small.slice(0, 10),
|
|
106
110
|
noindex: /noindex/i.test(document.querySelector('meta[name="robots"]')?.getAttribute("content") ?? ""),
|
|
@@ -111,7 +115,7 @@ for (const route of pages) {
|
|
|
111
115
|
if (phone) {
|
|
112
116
|
const name = (e) => ({ tag: e.tagName.toLowerCase(), cls: String(e.className || ""), text: (e.textContent.trim() || e.getAttribute("aria-label") || e.getAttribute("name") || "").slice(0, 40) });
|
|
113
117
|
// Visually hidden (an sr-only skip link) or parked off the page: not a target until it is shown.
|
|
114
|
-
const hidden = (e, r) => e.closest("[aria-hidden='true'], .sr-only, .visually-hidden") || r.width <= 1 || r.height <= 1 || r.right <= 0 || r.bottom <= -window.scrollY;
|
|
118
|
+
const hidden = (e, r) => e.closest("[aria-hidden='true'], .sr-only, .visually-hidden") || r.width <= 1 || r.height <= 1 || r.right <= 0 || r.bottom <= -window.scrollY || r.left >= vw;
|
|
115
119
|
// WCAG 2.5.5's inline exception: a link in a sentence is sized by the line it sits in.
|
|
116
120
|
const inline = (e) => {
|
|
117
121
|
if (e.tagName !== "A" || getComputedStyle(e).display !== "inline") return false;
|
|
@@ -156,6 +160,7 @@ for (const route of pages) {
|
|
|
156
160
|
{ labels, minFontPx, phone, minTargetPx: MIN_TARGET_PX, minFieldFontPx: MIN_FIELD_FONT_PX },
|
|
157
161
|
);
|
|
158
162
|
const at = `${route} at ${name}`;
|
|
163
|
+
if (m.noViewportMeta) failures.push(`${at}: the page lays out wider than the screen: no width=device-width viewport meta`);
|
|
159
164
|
if (m.horizontalScroll) failures.push(`${at}: the page scrolls sideways`);
|
|
160
165
|
for (const t of m.smallText) failures.push(`${at}: ${t.px}px text under ${minFontPx}px (<${t.tag}${t.cls ? ` class="${t.cls}"` : ""}> "${t.text}")`);
|
|
161
166
|
const tag = (t) => `<${t.tag}${t.cls ? ` class="${t.cls}"` : ""}>${t.text ? ` "${t.text}"` : ""}`;
|