@zero2webmaster/starter-kit 0.41.0 → 0.43.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/README.md +2 -2
- package/dist/brand.d.ts +11 -0
- package/dist/brand.js +74 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/parse-brief.js +12 -0
- package/dist/scaffolders/common.js +5 -0
- package/dist/scaffolders/nextjs.js +187 -54
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# z2w-starter-kit
|
|
2
2
|
|
|
3
|
-
**Version:** 0.
|
|
3
|
+
**Version:** 0.43.0 | **Framework:** 2.19.0
|
|
4
4
|
|
|
5
5
|
> Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.
|
|
6
6
|
|
|
@@ -135,4 +135,4 @@ Inquiries: kerry@zero2webmaster.com.
|
|
|
135
135
|
---
|
|
136
136
|
|
|
137
137
|
*Scaffolded 2026-05-28 via the [[instantiate-z2w-project]] Claude Code skill v1; reconciled against the consolidated skill v1.1.0 (brief-first + Agent Coordination block) on 2026-05-29.*
|
|
138
|
-
*Version: 0.
|
|
138
|
+
*Version: 0.43.0 | Last Updated: 2026-10-23*
|
package/dist/brand.d.ts
CHANGED
|
@@ -70,6 +70,17 @@ export declare const CUSTOM_TYPOGRAPHY_RULE = "Large, easy-to-read type (body 18
|
|
|
70
70
|
export declare function isHexColor(s: string): boolean;
|
|
71
71
|
export declare const SAVE_THE_FROGS_PRESET: BrandPresetSpec;
|
|
72
72
|
export declare const BANSURI_BLISS_PRESET: BrandPresetSpec;
|
|
73
|
+
/**
|
|
74
|
+
* VideoMigrator — Z2W product line, populated in the skill 2026-06-04 during the
|
|
75
|
+
* videomigrator-dashboard scaffold. Ported 2026-10-17 (it was never selectable
|
|
76
|
+
* here, so the CLI could not scaffold a VideoMigrator-branded project at all).
|
|
77
|
+
*/
|
|
78
|
+
export declare const VIDEOMIGRATOR_PRESET: BrandPresetSpec;
|
|
79
|
+
/**
|
|
80
|
+
* LoomInUs — a Zero2Webmaster subsidiary (artisan-goods store), populated in the
|
|
81
|
+
* skill 2026-06-18 during the loominus workspace scaffold. Ported 2026-10-17.
|
|
82
|
+
*/
|
|
83
|
+
export declare const LOOMINUS_PRESET: BrandPresetSpec;
|
|
73
84
|
export declare const ZERO2WEBMASTER_PRESET: BrandPresetSpec;
|
|
74
85
|
export declare const BRAND_PRESETS: Readonly<Record<Exclude<BrandPreset, "custom">, BrandPresetSpec>>;
|
|
75
86
|
/**
|
package/dist/brand.js
CHANGED
|
@@ -63,19 +63,85 @@ export const BANSURI_BLISS_PRESET = {
|
|
|
63
63
|
preset: "bansuri-bliss",
|
|
64
64
|
brandName: "Bansuri Bliss",
|
|
65
65
|
brandNameRule: "title case; never 'Bonseri Bliss' or 'Bansuri Bliss Academy'",
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
// Kerry, 2026-06-18 (first used in file-server): "Almost always I use BB Blue
|
|
67
|
+
// #011351 and BB Bamboo #E9C15E and white and black as needed." The skill had
|
|
68
|
+
// these from that day; this preset stayed a `_TODO_` stub until 2026-10-17
|
|
69
|
+
// because its deferral assumed the values did not exist yet.
|
|
70
|
+
primaryColor: "#011351",
|
|
71
|
+
accentColor: "#E9C15E",
|
|
72
|
+
typographyRule: DEFAULT_TYPOGRAPHY_RULE,
|
|
69
73
|
domains: ["bansuribliss.com"],
|
|
70
74
|
githubOrg: "bansuribliss",
|
|
71
75
|
accountType: "user",
|
|
72
76
|
author: DEFAULT_AUTHOR,
|
|
73
77
|
authorUrl: DEFAULT_AUTHOR_URL,
|
|
74
|
-
extras: [
|
|
78
|
+
extras: [
|
|
79
|
+
{
|
|
80
|
+
label: "Secondary blues (use sparingly)",
|
|
81
|
+
hex: "#006cb6",
|
|
82
|
+
description: "Also used: #8bd2f4, #1a65af, #2151B4.",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
75
85
|
notes: [
|
|
76
|
-
"
|
|
86
|
+
"BB Blue is DARK, so it is the AA-safe TEXT color on white (headings, links, wordmark), and a button filled with it needs WHITE text. BB Bamboo is the bright accent and fill. This is the inverse of the bright greens of Zero2Webmaster and SAVE THE FROGS!.",
|
|
77
87
|
],
|
|
78
|
-
isStub:
|
|
88
|
+
isStub: false,
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* VideoMigrator — Z2W product line, populated in the skill 2026-06-04 during the
|
|
92
|
+
* videomigrator-dashboard scaffold. Ported 2026-10-17 (it was never selectable
|
|
93
|
+
* here, so the CLI could not scaffold a VideoMigrator-branded project at all).
|
|
94
|
+
*/
|
|
95
|
+
export const VIDEOMIGRATOR_PRESET = {
|
|
96
|
+
preset: "videomigrator",
|
|
97
|
+
brandName: "VideoMigrator",
|
|
98
|
+
brandNameRule: "one word, internal cap; never 'Video Migrator', never 'videomigrator' outside the domain name, never 'VM' as a public abbreviation",
|
|
99
|
+
primaryColor: "#7B3FE4",
|
|
100
|
+
accentColor: "#16C6D9",
|
|
101
|
+
typographyRule: DEFAULT_TYPOGRAPHY_RULE,
|
|
102
|
+
domains: ["videomigrator.com", "dash.videomigrator.com"],
|
|
103
|
+
githubOrg: "zero2webmaster",
|
|
104
|
+
accountType: "user",
|
|
105
|
+
author: DEFAULT_AUTHOR,
|
|
106
|
+
authorUrl: DEFAULT_AUTHOR_URL,
|
|
107
|
+
extras: [
|
|
108
|
+
{ label: "Primary hover", hex: "#8C3AF0" },
|
|
109
|
+
{ label: "Primary deep", hex: "#362097", description: "High-contrast accents." },
|
|
110
|
+
{ label: "Accent hover", hex: "#09B5CB" },
|
|
111
|
+
{ label: "Ink (body text)", hex: "#0f172a" },
|
|
112
|
+
{ label: "Mute (secondary text)", hex: "#64748b" },
|
|
113
|
+
],
|
|
114
|
+
notes: [
|
|
115
|
+
"Signature gradient: linear-gradient(135deg, #7B3FE4 0%, #16C6D9 100%). Logo: 'Video' in purple, 'Migrator' in cyan, with motion arrows.",
|
|
116
|
+
],
|
|
117
|
+
isStub: false,
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* LoomInUs — a Zero2Webmaster subsidiary (artisan-goods store), populated in the
|
|
121
|
+
* skill 2026-06-18 during the loominus workspace scaffold. Ported 2026-10-17.
|
|
122
|
+
*/
|
|
123
|
+
export const LOOMINUS_PRESET = {
|
|
124
|
+
preset: "loominus",
|
|
125
|
+
brandName: "LoomInUs",
|
|
126
|
+
brandNameRule: "capital L, capital I, capital U (Loom + In + Us); never 'Loominus', 'LoomInUS', 'Loom In Us', 'loomInUs' or 'LoomInus'",
|
|
127
|
+
primaryColor: "#FD9027",
|
|
128
|
+
accentColor: "#414AFF",
|
|
129
|
+
typographyRule: DEFAULT_TYPOGRAPHY_RULE,
|
|
130
|
+
domains: ["loominus.art"],
|
|
131
|
+
githubOrg: "zero2webmaster",
|
|
132
|
+
accountType: "user",
|
|
133
|
+
author: DEFAULT_AUTHOR,
|
|
134
|
+
authorUrl: DEFAULT_AUTHOR_URL,
|
|
135
|
+
extras: [
|
|
136
|
+
{ label: "'In' light blue", hex: "#648FFF" },
|
|
137
|
+
{ label: "Inner glow purple", hex: "#EC92EF" },
|
|
138
|
+
{ label: "Deep blue (darker link text)", hex: "#2A1CC8" },
|
|
139
|
+
],
|
|
140
|
+
notes: [
|
|
141
|
+
"Tagline: 'Art That Radiates From Within'. Loom Orange is a BRIGHT accent that fails WCAG AA as small text on white: use it for fills and CTAs with dark text, and the blue (#414AFF, or #2A1CC8) for links and text. The accent here is that blue, not a second orange, for exactly that reason.",
|
|
142
|
+
"Wordmark font: Pinot Grigio Modern Bold (Adobe Fonts); web use needs an Adobe Fonts web project.",
|
|
143
|
+
],
|
|
144
|
+
isStub: false,
|
|
79
145
|
};
|
|
80
146
|
export const ZERO2WEBMASTER_PRESET = {
|
|
81
147
|
preset: "zero2webmaster",
|
|
@@ -110,6 +176,8 @@ export const BRAND_PRESETS = {
|
|
|
110
176
|
"save-the-frogs": SAVE_THE_FROGS_PRESET,
|
|
111
177
|
"bansuri-bliss": BANSURI_BLISS_PRESET,
|
|
112
178
|
zero2webmaster: ZERO2WEBMASTER_PRESET,
|
|
179
|
+
videomigrator: VIDEOMIGRATOR_PRESET,
|
|
180
|
+
loominus: LOOMINUS_PRESET,
|
|
113
181
|
};
|
|
114
182
|
/**
|
|
115
183
|
* Build a one-off BrandPresetSpec from user-supplied custom-brand inputs.
|
package/dist/index.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ import type { StandardDecision } from "./standards.js";
|
|
|
23
23
|
*/
|
|
24
24
|
export declare const version: string;
|
|
25
25
|
export type ProjectType = "wp-plugin" | "cf-worker" | "cf-pages" | "nextjs" | "python-service" | "node-service" | "library" | "protocol-repo";
|
|
26
|
-
export type BrandPreset = "save-the-frogs" | "bansuri-bliss" | "zero2webmaster" | "custom";
|
|
26
|
+
export type BrandPreset = "save-the-frogs" | "bansuri-bliss" | "zero2webmaster" | "videomigrator" | "loominus" | "custom";
|
|
27
27
|
/**
|
|
28
28
|
* Who will READ the scaffolded project's agent files.
|
|
29
29
|
*
|
package/dist/index.js
CHANGED
package/dist/parse-brief.js
CHANGED
|
@@ -260,6 +260,10 @@ function inferBrand(brief) {
|
|
|
260
260
|
if (value === "bansuri-bliss" || value === "bansuri bliss") {
|
|
261
261
|
return "bansuri-bliss";
|
|
262
262
|
}
|
|
263
|
+
if (value === "videomigrator" || value === "video migrator")
|
|
264
|
+
return "videomigrator";
|
|
265
|
+
if (value === "loominus")
|
|
266
|
+
return "loominus";
|
|
263
267
|
if (value === "custom")
|
|
264
268
|
return "custom";
|
|
265
269
|
}
|
|
@@ -268,6 +272,10 @@ function inferBrand(brief) {
|
|
|
268
272
|
return "save-the-frogs";
|
|
269
273
|
if (/\bbansuri\s*bliss\b/.test(text))
|
|
270
274
|
return "bansuri-bliss";
|
|
275
|
+
if (/\bvideo\s*migrator\b/.test(text))
|
|
276
|
+
return "videomigrator";
|
|
277
|
+
if (/\bloom\s*in\s*us\b/.test(text))
|
|
278
|
+
return "loominus";
|
|
271
279
|
if (/\bzero2webmaster\b|\bz2w\b/.test(text))
|
|
272
280
|
return "zero2webmaster";
|
|
273
281
|
return null;
|
|
@@ -280,6 +288,10 @@ export function githubOrgForBrand(brand) {
|
|
|
280
288
|
return "savethefrogs";
|
|
281
289
|
case "bansuri-bliss":
|
|
282
290
|
return "bansuribliss";
|
|
291
|
+
// Both ship under the zero2webmaster account (product line / subsidiary).
|
|
292
|
+
case "videomigrator":
|
|
293
|
+
case "loominus":
|
|
294
|
+
return "zero2webmaster";
|
|
283
295
|
case "custom":
|
|
284
296
|
return null;
|
|
285
297
|
}
|
|
@@ -1118,6 +1118,11 @@ out/
|
|
|
1118
1118
|
# deploy to the original. Note \`vercel link\` appends a bare \`.vercel\` line
|
|
1119
1119
|
# itself — if you see a duplicate, that is where it came from.
|
|
1120
1120
|
.vercel/
|
|
1121
|
+
# TypeScript incremental build cache. The emitted tsconfig sets
|
|
1122
|
+
# "incremental": true, so the first \`npm run typecheck\` writes this at the repo
|
|
1123
|
+
# root and a plain \`git add .\` commits it. pharmies, estate-planning and
|
|
1124
|
+
# podcast-engine each had to add this line by hand after their first commit.
|
|
1125
|
+
*.tsbuildinfo
|
|
1121
1126
|
`,
|
|
1122
1127
|
"python-service": `.DS_Store
|
|
1123
1128
|
__pycache__/
|
|
@@ -67,7 +67,7 @@ npm test # vitest — includes the form-standards checks
|
|
|
67
67
|
\`components/FormBits.tsx\` exports \`<Field>\`, \`<Required />\` and \`<InfoHint>\`, which encode the {{brand_name}} form standards so you don't have to remember them:
|
|
68
68
|
|
|
69
69
|
- **Optional is the default** — never label a field "(optional)". Mark the required ones: \`<Field required>\`.
|
|
70
|
-
- **Help text is never a placeholder** — placeholder text vanishes the moment someone types. Pass \`help={...}\` and
|
|
70
|
+
- **Help text is never a placeholder** — placeholder text vanishes the moment someone types. Pass \`help={...}\` and a bare "i" appears right of the label; tapped, its note stays on screen while you type. Only for a field people would hesitate over: First Name, Email or Language get no "i".
|
|
71
71
|
- **Input borders are visible** — the emitted border clears the 3:1 WCAG non-text-contrast minimum.
|
|
72
72
|
|
|
73
73
|
\`test/form-standards.test.ts\` fails on the next form that breaks one of these, so the rules survive the person who wrote them. Run it with \`npm test\`.
|
|
@@ -1321,42 +1321,59 @@ export function Required() {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
|
|
1323
1323
|
/**
|
|
1324
|
-
* Click-to-open help for a field
|
|
1325
|
-
*
|
|
1326
|
-
*
|
|
1324
|
+
* Click-to-open help for a field: a bare "i" that sits on the label's row,
|
|
1325
|
+
* immediately right of the label. Collapsed by default so the form stays
|
|
1326
|
+
* scannable; open, the guidance STAYS on screen while typing, which is the
|
|
1327
|
+
* whole point of not being a placeholder.
|
|
1327
1328
|
*
|
|
1328
|
-
*
|
|
1329
|
+
* 🔴 NO visible text beside the "i" (no caption, no question) and never its
|
|
1330
|
+
* own row under the input. {{brand_name}} has rejected both, three times. The
|
|
1331
|
+
* words move to \`aria-label\`, so a screen reader still hears "About Role".
|
|
1332
|
+
*
|
|
1333
|
+
* The panel opens BELOW the row and OUT OF FLOW (see app/globals.css), so
|
|
1334
|
+
* opening it never moves the input the reader is looking at. A tap anywhere
|
|
1335
|
+
* else, or Escape, closes it: components/InfoHintCloser.tsx, mounted once in
|
|
1336
|
+
* app/layout.tsx so this file needs no \`"use client"\`.
|
|
1337
|
+
*
|
|
1338
|
+
* A native \`<details>\` — no JS of its own, works in a Server Component.
|
|
1329
1339
|
*/
|
|
1330
1340
|
export function InfoHint({
|
|
1331
|
-
|
|
1341
|
+
about,
|
|
1332
1342
|
children,
|
|
1333
1343
|
}: {
|
|
1334
|
-
|
|
1344
|
+
/** The accessible name, e.g. "About Role" (in the reader's language). */
|
|
1345
|
+
about: string;
|
|
1335
1346
|
children: ReactNode;
|
|
1336
1347
|
}) {
|
|
1337
1348
|
return (
|
|
1338
1349
|
<details className="info-hint">
|
|
1339
|
-
<summary>
|
|
1350
|
+
<summary aria-label={about} title={about}>
|
|
1340
1351
|
<span className="info-hint-icon" aria-hidden="true">
|
|
1341
1352
|
i
|
|
1342
1353
|
</span>
|
|
1343
|
-
{label}
|
|
1344
1354
|
</summary>
|
|
1345
|
-
<div className="info-hint-body">
|
|
1355
|
+
<div className="info-hint-body" role="note">
|
|
1356
|
+
{children}
|
|
1357
|
+
</div>
|
|
1346
1358
|
</details>
|
|
1347
1359
|
);
|
|
1348
1360
|
}
|
|
1349
1361
|
|
|
1350
1362
|
/**
|
|
1351
|
-
* A form field wrapper: label (
|
|
1363
|
+
* A form field wrapper: the label row (label, required marker, and the "i"
|
|
1364
|
+
* when there is help), then the control.
|
|
1352
1365
|
*
|
|
1353
1366
|
* \`htmlFor\`/\`id\` is the caller's job — this component cannot know the
|
|
1354
1367
|
* control's id, and a label that isn't wired to its input is worse than no
|
|
1355
1368
|
* label. Pass the SAME id to the control you render as \`children\`.
|
|
1356
1369
|
*
|
|
1370
|
+
* Give \`help\` ONLY to a field a reasonable person would hesitate over. An
|
|
1371
|
+
* obvious field (First Name, Last Name, Email, Language, Country) gets none:
|
|
1372
|
+
* a circle that teaches nothing trains people to ignore the ones that matter.
|
|
1373
|
+
*
|
|
1357
1374
|
* \`\`\`tsx
|
|
1358
|
-
* <Field id="
|
|
1359
|
-
* <
|
|
1375
|
+
* <Field id="role" label="Role" required help={<>Owners can invite people.</>}>
|
|
1376
|
+
* <select id="role" name="role" required>…</select>
|
|
1360
1377
|
* </Field>
|
|
1361
1378
|
* \`\`\`
|
|
1362
1379
|
*/
|
|
@@ -1365,28 +1382,81 @@ export function Field({
|
|
|
1365
1382
|
label,
|
|
1366
1383
|
required = false,
|
|
1367
1384
|
help,
|
|
1368
|
-
|
|
1385
|
+
helpAbout,
|
|
1369
1386
|
children,
|
|
1370
1387
|
}: {
|
|
1371
1388
|
id: string;
|
|
1372
1389
|
label: string;
|
|
1373
1390
|
required?: boolean;
|
|
1391
|
+
/** Only for a field people would hesitate over. Never for a name, email or language. */
|
|
1374
1392
|
help?: ReactNode;
|
|
1375
|
-
|
|
1393
|
+
/** The "i"'s accessible name; defaults to "About <label>" in English. */
|
|
1394
|
+
helpAbout?: string;
|
|
1376
1395
|
children: ReactNode;
|
|
1377
1396
|
}) {
|
|
1378
1397
|
return (
|
|
1379
1398
|
<div className="form-field">
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1399
|
+
{/* A row that CONTAINS the label, never a label containing the hint:
|
|
1400
|
+
a <details> inside a <label> is invalid HTML and a hydration error. */}
|
|
1401
|
+
<div className="form-field-label-row">
|
|
1402
|
+
<label htmlFor={id}>
|
|
1403
|
+
{label}
|
|
1404
|
+
{required && <Required />}
|
|
1405
|
+
</label>
|
|
1406
|
+
{help && <InfoHint about={helpAbout ?? \`About \${label}\`}>{help}</InfoHint>}
|
|
1407
|
+
</div>
|
|
1384
1408
|
{children}
|
|
1385
|
-
{help && <InfoHint label={helpLabel}>{help}</InfoHint>}
|
|
1386
1409
|
</div>
|
|
1387
1410
|
);
|
|
1388
1411
|
}
|
|
1389
1412
|
`;
|
|
1413
|
+
/**
|
|
1414
|
+
* Closes an open field-help "i" when the reader taps anywhere else, or presses
|
|
1415
|
+
* Escape. A native \`<details>\` only closes from its own summary, so without
|
|
1416
|
+
* this an open panel sits over the next field until the reader finds the small
|
|
1417
|
+
* "i" again. One listener for the whole page, mounted once in app/layout.tsx.
|
|
1418
|
+
*/
|
|
1419
|
+
const INFO_HINT_CLOSER_TEMPLATE = `"use client";
|
|
1420
|
+
|
|
1421
|
+
// Closes an open "i" field hint (InfoHint in components/FormBits.tsx) when the
|
|
1422
|
+
// reader taps anywhere outside it, or presses Escape (which also returns focus
|
|
1423
|
+
// to the "i", so a keyboard user is not stranded). Mounted once from
|
|
1424
|
+
// app/layout.tsx so FormBits itself stays server-rendered. Renders nothing.
|
|
1425
|
+
//
|
|
1426
|
+
// pointerdown, not click: the tap on the field underneath should land on the
|
|
1427
|
+
// field AND close the hint in one gesture. Capture phase, so a
|
|
1428
|
+
// stopPropagation() somewhere below cannot swallow it. A tap INSIDE the open
|
|
1429
|
+
// panel keeps it open, so its text can be selected and its links pressed.
|
|
1430
|
+
|
|
1431
|
+
import { useEffect } from "react";
|
|
1432
|
+
|
|
1433
|
+
const OPEN = "details.info-hint[open]";
|
|
1434
|
+
|
|
1435
|
+
export function InfoHintCloser() {
|
|
1436
|
+
useEffect(() => {
|
|
1437
|
+
function onPointerDown(event: PointerEvent) {
|
|
1438
|
+
const target = event.target instanceof Node ? event.target : null;
|
|
1439
|
+
for (const open of document.querySelectorAll<HTMLDetailsElement>(OPEN)) {
|
|
1440
|
+
if (!target || !open.contains(target)) open.open = false;
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
function onKeyDown(event: KeyboardEvent) {
|
|
1444
|
+
if (event.key !== "Escape") return;
|
|
1445
|
+
for (const open of document.querySelectorAll<HTMLDetailsElement>(OPEN)) {
|
|
1446
|
+
open.open = false;
|
|
1447
|
+
if (open.contains(document.activeElement)) open.querySelector("summary")?.focus();
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
document.addEventListener("pointerdown", onPointerDown, true);
|
|
1451
|
+
document.addEventListener("keydown", onKeyDown);
|
|
1452
|
+
return () => {
|
|
1453
|
+
document.removeEventListener("pointerdown", onPointerDown, true);
|
|
1454
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
1455
|
+
};
|
|
1456
|
+
}, []);
|
|
1457
|
+
return null;
|
|
1458
|
+
}
|
|
1459
|
+
`;
|
|
1390
1460
|
/**
|
|
1391
1461
|
* The page background every emitted surface is ultimately drawn on.
|
|
1392
1462
|
*
|
|
@@ -1415,6 +1485,7 @@ function globalsCss(primaryColor) {
|
|
|
1415
1485
|
// white — see `accessibleOn` for the measured list, which includes Z2W's and
|
|
1416
1486
|
// STF's own greens. Derived here, at scaffold time, from the actual hex.
|
|
1417
1487
|
const brandFocus = accessibleOn(primaryColor, PAGE_SURFACE, 3);
|
|
1488
|
+
const onFocus = readableInkOn(brandFocus);
|
|
1418
1489
|
return `/* Global styles.
|
|
1419
1490
|
*
|
|
1420
1491
|
* Body typography lives here, not as an inline style on <body>, so there is ONE
|
|
@@ -1444,6 +1515,11 @@ function globalsCss(primaryColor) {
|
|
|
1444
1515
|
has a measured floor. \`test/contrast.test.ts\` fails if this one stops
|
|
1445
1516
|
clearing it. */
|
|
1446
1517
|
--brand-focus: ${brandFocus};
|
|
1518
|
+
/* Ink that reads ON --brand-focus, computed the same way as
|
|
1519
|
+
--brand-on-primary. The field-help "i" is drawn with this pair: the circle
|
|
1520
|
+
IS the whole control (it has no text beside it), so its fill has the 3:1
|
|
1521
|
+
floor too, and most brand primaries do not clear it. */
|
|
1522
|
+
--brand-on-focus: ${onFocus};
|
|
1447
1523
|
--brand-ink: #3f3c36;
|
|
1448
1524
|
/* Input border. #ccc on white is ~1.6:1, below the 3:1 WCAG 2.1 minimum for a
|
|
1449
1525
|
UI component boundary — i.e. the edge of the box is genuinely not visible,
|
|
@@ -1567,46 +1643,60 @@ body {
|
|
|
1567
1643
|
cursor: help;
|
|
1568
1644
|
}
|
|
1569
1645
|
|
|
1570
|
-
/* --- Click-to-open field help (never a placeholder) -------------------------
|
|
1646
|
+
/* --- Click-to-open field help (never a placeholder) -------------------------
|
|
1647
|
+
The "i" sits on the label's row, right of the label, with no visible text.
|
|
1648
|
+
The panel is positioned against the ROW (position: relative), so opening it
|
|
1649
|
+
never moves the icon and never pushes the input down. */
|
|
1650
|
+
|
|
1651
|
+
.form-field-label-row {
|
|
1652
|
+
position: relative;
|
|
1653
|
+
display: flex;
|
|
1654
|
+
align-items: center;
|
|
1655
|
+
flex-wrap: wrap;
|
|
1656
|
+
gap: 2px;
|
|
1657
|
+
}
|
|
1571
1658
|
|
|
1572
1659
|
.info-hint {
|
|
1573
|
-
margin:
|
|
1660
|
+
margin: 0;
|
|
1574
1661
|
font-size: 15px;
|
|
1575
1662
|
}
|
|
1576
1663
|
|
|
1577
|
-
/*
|
|
1578
|
-
|
|
1664
|
+
/* A 44px tap target around a 22px icon; the negative margin keeps the big hit
|
|
1665
|
+
area from making the label row taller. */
|
|
1579
1666
|
.info-hint > summary {
|
|
1580
1667
|
display: inline-flex;
|
|
1581
1668
|
align-items: center;
|
|
1582
|
-
|
|
1669
|
+
justify-content: center;
|
|
1670
|
+
width: 44px;
|
|
1671
|
+
height: 44px;
|
|
1672
|
+
margin: -11px -11px -11px -4px;
|
|
1583
1673
|
cursor: pointer;
|
|
1584
|
-
color: #8a4b08;
|
|
1585
|
-
font-weight: 600;
|
|
1586
1674
|
list-style: none;
|
|
1587
|
-
|
|
1588
|
-
width: fit-content;
|
|
1675
|
+
border-radius: 50%;
|
|
1589
1676
|
}
|
|
1590
1677
|
|
|
1591
1678
|
.info-hint > summary::-webkit-details-marker {
|
|
1592
1679
|
display: none;
|
|
1593
1680
|
}
|
|
1594
1681
|
|
|
1595
|
-
.info-hint > summary:hover,
|
|
1596
1682
|
.info-hint > summary:focus-visible {
|
|
1597
|
-
|
|
1683
|
+
outline: 3px solid var(--brand-focus);
|
|
1684
|
+
outline-offset: -6px;
|
|
1598
1685
|
}
|
|
1599
1686
|
|
|
1600
1687
|
.info-hint-icon {
|
|
1601
1688
|
display: inline-flex;
|
|
1602
1689
|
align-items: center;
|
|
1603
1690
|
justify-content: center;
|
|
1604
|
-
width:
|
|
1605
|
-
height:
|
|
1606
|
-
flex: 0 0
|
|
1691
|
+
width: 22px;
|
|
1692
|
+
height: 22px;
|
|
1693
|
+
flex: 0 0 22px;
|
|
1607
1694
|
border-radius: 50%;
|
|
1608
|
-
|
|
1609
|
-
|
|
1695
|
+
/* --brand-focus, not --brand-primary: with no text beside it, the circle is
|
|
1696
|
+
the only thing that says "help is here", so it must clear 3:1 against the
|
|
1697
|
+
page. test/contrast.test.ts measures it. */
|
|
1698
|
+
background: var(--brand-focus);
|
|
1699
|
+
color: var(--brand-on-focus);
|
|
1610
1700
|
font-size: 13px;
|
|
1611
1701
|
font-weight: 800;
|
|
1612
1702
|
font-style: italic;
|
|
@@ -1614,7 +1704,13 @@ body {
|
|
|
1614
1704
|
}
|
|
1615
1705
|
|
|
1616
1706
|
.info-hint-body {
|
|
1617
|
-
|
|
1707
|
+
position: absolute;
|
|
1708
|
+
left: 0;
|
|
1709
|
+
top: calc(100% + 6px);
|
|
1710
|
+
z-index: 10;
|
|
1711
|
+
width: min(36rem, 100%);
|
|
1712
|
+
box-sizing: border-box;
|
|
1713
|
+
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
|
|
1618
1714
|
padding: 12px 14px;
|
|
1619
1715
|
border: 1px solid #dcd9d1;
|
|
1620
1716
|
border-left: 4px solid var(--brand-primary);
|
|
@@ -3170,22 +3266,20 @@ const PAIRS: Pair[] = [
|
|
|
3170
3266
|
},
|
|
3171
3267
|
},
|
|
3172
3268
|
{
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3269
|
+
// The trigger is the "i" circle alone, with no text beside it, so what must
|
|
3270
|
+
// be seen is the circle itself against the page. Brand-dependent: the fill
|
|
3271
|
+
// is derived from the author's brand hex.
|
|
3272
|
+
what: "the help-hint 'i' circle against the page",
|
|
3273
|
+
where: ".info-hint-icon (background)",
|
|
3274
|
+
fg: color(".info-hint-icon", "background"),
|
|
3176
3275
|
bg: PAGE,
|
|
3177
|
-
role: {
|
|
3178
|
-
kind: "text",
|
|
3179
|
-
fontPx: px(decl(".info-hint", "font-size")),
|
|
3180
|
-
fontWeight: px(decl(".info-hint > summary", "font-weight")),
|
|
3181
|
-
},
|
|
3276
|
+
role: { kind: "non-text" },
|
|
3182
3277
|
},
|
|
3183
3278
|
{
|
|
3184
|
-
// THE BRAND-DEPENDENT ROW
|
|
3185
|
-
//
|
|
3186
|
-
//
|
|
3187
|
-
|
|
3188
|
-
what: "the 'i' glyph on the BRAND FILL",
|
|
3279
|
+
// THE OTHER BRAND-DEPENDENT ROW: the brand-derived fill is the BACKGROUND
|
|
3280
|
+
// here, so it is a row that can pass for one project and fail for the
|
|
3281
|
+
// next. A 13px glyph, so the full 4.5:1 applies however bold it is.
|
|
3282
|
+
what: "the 'i' glyph on its brand-derived fill",
|
|
3189
3283
|
where: ".info-hint-icon",
|
|
3190
3284
|
fg: color(".info-hint-icon", "color"),
|
|
3191
3285
|
bg: color(".info-hint-icon", "background"),
|
|
@@ -3281,10 +3375,11 @@ const EXEMPT: Array<{ color: string; where: string; why: string }> = [
|
|
|
3281
3375
|
color: color(":root", "--brand-primary"),
|
|
3282
3376
|
where: "--brand-primary as a decorative fill / accent stripe",
|
|
3283
3377
|
why:
|
|
3284
|
-
"The author's brand color, used as the
|
|
3285
|
-
"
|
|
3286
|
-
"
|
|
3287
|
-
"
|
|
3378
|
+
"The author's brand color, used as the help panel's left stripe. It is " +
|
|
3379
|
+
"decorative next to the panel text that carries the meaning, so SC " +
|
|
3380
|
+
"1.4.11 does not apply. The 'i' circle is NOT drawn with it: with no " +
|
|
3381
|
+
"text beside it the circle is the whole control, so it uses " +
|
|
3382
|
+
"--brand-focus and is measured in PAIRS above.",
|
|
3288
3383
|
},
|
|
3289
3384
|
];
|
|
3290
3385
|
|
|
@@ -3513,6 +3608,38 @@ describe("form standards", () => {
|
|
|
3513
3608
|
expect(read("components/FormBits.tsx")).not.toMatch(/^\\s*["']use client["']/m);
|
|
3514
3609
|
});
|
|
3515
3610
|
|
|
3611
|
+
// The "i" sits right of its label and never says "What goes here?" (rejected
|
|
3612
|
+
// three times), and obvious fields get no "i" at all.
|
|
3613
|
+
it("the info circle has no visible text and sits in the label's row", () => {
|
|
3614
|
+
const bits = read("components/FormBits.tsx");
|
|
3615
|
+
expect(bits).not.toMatch(/What goes here/);
|
|
3616
|
+
const field = bits.slice(bits.indexOf("export function Field"));
|
|
3617
|
+
expect(field.indexOf("<InfoHint")).toBeGreaterThan(-1);
|
|
3618
|
+
expect(field.indexOf("<InfoHint")).toBeLessThan(field.indexOf("{children}"));
|
|
3619
|
+
// The panel floats under the row, so opening it never moves the input.
|
|
3620
|
+
expect(css()).toMatch(/\\.info-hint-body\\s*\\{[^}]*position:\\s*absolute/);
|
|
3621
|
+
});
|
|
3622
|
+
|
|
3623
|
+
it("a tap anywhere else closes an open info circle", () => {
|
|
3624
|
+
// A <details> only closes from its own summary; the closer is mounted once.
|
|
3625
|
+
expect(read("components/InfoHintCloser.tsx")).toContain("pointerdown");
|
|
3626
|
+
expect(read("app/layout.tsx")).toContain("<InfoHintCloser />");
|
|
3627
|
+
});
|
|
3628
|
+
|
|
3629
|
+
it("no obvious field (a name, an email, a language) gets an info circle", () => {
|
|
3630
|
+
const offenders: string[] = [];
|
|
3631
|
+
for (const file of TSX) {
|
|
3632
|
+
for (const m of read(file).matchAll(/<Field\\b[^>]*>/gs)) {
|
|
3633
|
+
const tag = m[0];
|
|
3634
|
+
if (!/\\bhelp=/.test(tag)) continue;
|
|
3635
|
+
if (/label="(First Name|Last Name|Name|Email|Email address|Language|Country)"/.test(tag)) {
|
|
3636
|
+
offenders.push(file + ": " + tag.slice(0, 80));
|
|
3637
|
+
}
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
expect(offenders).toEqual([]);
|
|
3641
|
+
});
|
|
3642
|
+
|
|
3516
3643
|
it("input borders clear the 3:1 non-text contrast minimum", () => {
|
|
3517
3644
|
// #ccc on white is ~1.6:1 — the edge of the box genuinely isn't visible.
|
|
3518
3645
|
expect(css()).toMatch(/--field-border:\\s*#8f8b81/);
|
|
@@ -3825,6 +3952,7 @@ const APP_LAYOUT_TEMPLATE = `// Root layout — SEO baseline wiring per Z2W stan
|
|
|
3825
3952
|
|
|
3826
3953
|
import type { Metadata, Viewport } from "next";
|
|
3827
3954
|
import { Analytics } from "@/lib/analytics/Analytics";
|
|
3955
|
+
import { InfoHintCloser } from "@/components/InfoHintCloser";
|
|
3828
3956
|
import { serializeJsonLd } from "@/lib/json-ld";
|
|
3829
3957
|
|
|
3830
3958
|
// Global styles. Body typography (18px / 1.5, per the standing Zero2Webmaster
|
|
@@ -3892,6 +4020,10 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
|
|
3892
4020
|
</head>
|
|
3893
4021
|
<body>
|
|
3894
4022
|
{children}
|
|
4023
|
+
{/* Closes an open field-help "i" on a tap anywhere else, or Escape.
|
|
4024
|
+
Mounted here once so components/FormBits.tsx stays server-rendered.
|
|
4025
|
+
Renders nothing. */}
|
|
4026
|
+
<InfoHintCloser />
|
|
3895
4027
|
{/* Fathom analytics (per [[fathom-analytics]]). \`<Analytics />\` renders
|
|
3896
4028
|
the loader AND the RouteTracker that fires trackPageview() on every
|
|
3897
4029
|
route change — the two are one pattern. It no-ops until
|
|
@@ -5632,6 +5764,7 @@ export function scaffoldNextjs(inputs, opts) {
|
|
|
5632
5764
|
{ path: "test/server-only.stub.ts", content: SERVER_ONLY_STUB_TEMPLATE },
|
|
5633
5765
|
{ path: "app/globals.css", content: globalsCss(spec.primaryColor) },
|
|
5634
5766
|
{ path: "components/FormBits.tsx", content: sub(FORM_BITS_TEMPLATE, inputs, opts, spec) },
|
|
5767
|
+
{ path: "components/InfoHintCloser.tsx", content: INFO_HINT_CLOSER_TEMPLATE },
|
|
5635
5768
|
// The contrast pair table and the math it uses. Emitted unconditionally: the
|
|
5636
5769
|
// stylesheet it measures is emitted unconditionally, and a project whose
|
|
5637
5770
|
// palette is unmeasured is exactly the project that needs measuring.
|