@zero2webmaster/starter-kit 0.42.0 → 0.43.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # z2w-starter-kit
2
2
 
3
- **Version:** 0.42.0 | **Framework:** 2.19.0
3
+ **Version:** 0.43.1 | **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.42.0 | Last Updated: 2026-10-17*
138
+ *Version: 0.43.1 | Last Updated: 2026-10-25*
@@ -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 it stays on screen.
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. Collapsed by default so the form stays
1325
- * scannable; the guidance is one click away and STAYS on screen while typing,
1326
- * which is the whole point of not being a placeholder.
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
- * A native \`<details>\` — no JS, no hydration, works in a Server Component.
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
- label = "What goes here?",
1341
+ about,
1332
1342
  children,
1333
1343
  }: {
1334
- label?: string;
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">{children}</div>
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 (+ required marker) and optional help.
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="email" label="Email address" required help={<>We only use this to reply.</>}>
1359
- * <input id="email" name="email" type="email" required />
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
- helpLabel,
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
- helpLabel?: string;
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
- <label htmlFor={id}>
1381
- {label}
1382
- {required && <Required />}
1383
- </label>
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,
@@ -1469,6 +1545,13 @@ html {
1469
1545
  box-sizing: inherit;
1470
1546
  }
1471
1547
 
1548
+ /* Chrome wraps a <details> body in ::details-content, which * does not match,
1549
+ so without this everything inside a <details> is content-box. Its own rule:
1550
+ an unknown pseudo-element would void the whole selector list above. */
1551
+ ::details-content {
1552
+ box-sizing: inherit;
1553
+ }
1554
+
1472
1555
  body {
1473
1556
  margin: 0;
1474
1557
  font-family: system-ui, -apple-system, sans-serif;
@@ -1567,46 +1650,60 @@ body {
1567
1650
  cursor: help;
1568
1651
  }
1569
1652
 
1570
- /* --- Click-to-open field help (never a placeholder) ------------------------- */
1653
+ /* --- Click-to-open field help (never a placeholder) -------------------------
1654
+ The "i" sits on the label's row, right of the label, with no visible text.
1655
+ The panel is positioned against the ROW (position: relative), so opening it
1656
+ never moves the icon and never pushes the input down. */
1657
+
1658
+ .form-field-label-row {
1659
+ position: relative;
1660
+ display: flex;
1661
+ align-items: center;
1662
+ flex-wrap: wrap;
1663
+ gap: 2px;
1664
+ }
1571
1665
 
1572
1666
  .info-hint {
1573
- margin: 6px 0 0;
1667
+ margin: 0;
1574
1668
  font-size: 15px;
1575
1669
  }
1576
1670
 
1577
- /* FIXED #8a4b08 rather than the brand accent: this is small text on white, and
1578
- most brand accents fail AA at this size. */
1671
+ /* A 44px tap target around a 22px icon; the negative margin keeps the big hit
1672
+ area from making the label row taller. */
1579
1673
  .info-hint > summary {
1580
1674
  display: inline-flex;
1581
1675
  align-items: center;
1582
- gap: 7px;
1676
+ justify-content: center;
1677
+ width: 44px;
1678
+ height: 44px;
1679
+ margin: -11px -11px -11px -4px;
1583
1680
  cursor: pointer;
1584
- color: #8a4b08;
1585
- font-weight: 600;
1586
1681
  list-style: none;
1587
- padding: 2px 0;
1588
- width: fit-content;
1682
+ border-radius: 50%;
1589
1683
  }
1590
1684
 
1591
1685
  .info-hint > summary::-webkit-details-marker {
1592
1686
  display: none;
1593
1687
  }
1594
1688
 
1595
- .info-hint > summary:hover,
1596
1689
  .info-hint > summary:focus-visible {
1597
- text-decoration: underline;
1690
+ outline: 3px solid var(--brand-focus);
1691
+ outline-offset: -6px;
1598
1692
  }
1599
1693
 
1600
1694
  .info-hint-icon {
1601
1695
  display: inline-flex;
1602
1696
  align-items: center;
1603
1697
  justify-content: center;
1604
- width: 20px;
1605
- height: 20px;
1606
- flex: 0 0 20px;
1698
+ width: 22px;
1699
+ height: 22px;
1700
+ flex: 0 0 22px;
1607
1701
  border-radius: 50%;
1608
- background: var(--brand-primary);
1609
- color: var(--brand-on-primary);
1702
+ /* --brand-focus, not --brand-primary: with no text beside it, the circle is
1703
+ the only thing that says "help is here", so it must clear 3:1 against the
1704
+ page. test/contrast.test.ts measures it. */
1705
+ background: var(--brand-focus);
1706
+ color: var(--brand-on-focus);
1610
1707
  font-size: 13px;
1611
1708
  font-weight: 800;
1612
1709
  font-style: italic;
@@ -1614,7 +1711,13 @@ body {
1614
1711
  }
1615
1712
 
1616
1713
  .info-hint-body {
1617
- margin-top: 8px;
1714
+ position: absolute;
1715
+ left: 0;
1716
+ top: calc(100% + 6px);
1717
+ z-index: 10;
1718
+ width: min(36rem, 100%);
1719
+ box-sizing: border-box;
1720
+ box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
1618
1721
  padding: 12px 14px;
1619
1722
  border: 1px solid #dcd9d1;
1620
1723
  border-left: 4px solid var(--brand-primary);
@@ -3170,22 +3273,20 @@ const PAIRS: Pair[] = [
3170
3273
  },
3171
3274
  },
3172
3275
  {
3173
- what: "the help-hint trigger on the page",
3174
- where: ".info-hint > summary",
3175
- fg: color(".info-hint > summary", "color"),
3276
+ // The trigger is the "i" circle alone, with no text beside it, so what must
3277
+ // be seen is the circle itself against the page. Brand-dependent: the fill
3278
+ // is derived from the author's brand hex.
3279
+ what: "the help-hint 'i' circle against the page",
3280
+ where: ".info-hint-icon (background)",
3281
+ fg: color(".info-hint-icon", "background"),
3176
3282
  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
- },
3283
+ role: { kind: "non-text" },
3182
3284
  },
3183
3285
  {
3184
- // THE BRAND-DEPENDENT ROW. Every other pair is fixed at scaffold time; this
3185
- // one has the author's brand hex as its BACKGROUND, so it is the row that
3186
- // can pass for one project and fail for the next. A 13px glyph, so the full
3187
- // 4.5:1 applies however bold it is.
3188
- what: "the 'i' glyph on the BRAND FILL",
3286
+ // THE OTHER BRAND-DEPENDENT ROW: the brand-derived fill is the BACKGROUND
3287
+ // here, so it is a row that can pass for one project and fail for the
3288
+ // next. A 13px glyph, so the full 4.5:1 applies however bold it is.
3289
+ what: "the 'i' glyph on its brand-derived fill",
3189
3290
  where: ".info-hint-icon",
3190
3291
  fg: color(".info-hint-icon", "color"),
3191
3292
  bg: color(".info-hint-icon", "background"),
@@ -3281,10 +3382,11 @@ const EXEMPT: Array<{ color: string; where: string; why: string }> = [
3281
3382
  color: color(":root", "--brand-primary"),
3282
3383
  where: "--brand-primary as a decorative fill / accent stripe",
3283
3384
  why:
3284
- "The author's brand color, used as the info-icon fill and the panel's " +
3285
- "left stripe. Both are decorative next to a text label that carries the " +
3286
- "meaning, so SC 1.4.11 does not apply to the SHAPES. The GLYPH painted " +
3287
- "on this fill is a different question and is measured in PAIRS above.",
3385
+ "The author's brand color, used as the help panel's left stripe. It is " +
3386
+ "decorative next to the panel text that carries the meaning, so SC " +
3387
+ "1.4.11 does not apply. The 'i' circle is NOT drawn with it: with no " +
3388
+ "text beside it the circle is the whole control, so it uses " +
3389
+ "--brand-focus and is measured in PAIRS above.",
3288
3390
  },
3289
3391
  ];
3290
3392
 
@@ -3513,6 +3615,38 @@ describe("form standards", () => {
3513
3615
  expect(read("components/FormBits.tsx")).not.toMatch(/^\\s*["']use client["']/m);
3514
3616
  });
3515
3617
 
3618
+ // The "i" sits right of its label and never says "What goes here?" (rejected
3619
+ // three times), and obvious fields get no "i" at all.
3620
+ it("the info circle has no visible text and sits in the label's row", () => {
3621
+ const bits = read("components/FormBits.tsx");
3622
+ expect(bits).not.toMatch(/What goes here/);
3623
+ const field = bits.slice(bits.indexOf("export function Field"));
3624
+ expect(field.indexOf("<InfoHint")).toBeGreaterThan(-1);
3625
+ expect(field.indexOf("<InfoHint")).toBeLessThan(field.indexOf("{children}"));
3626
+ // The panel floats under the row, so opening it never moves the input.
3627
+ expect(css()).toMatch(/\\.info-hint-body\\s*\\{[^}]*position:\\s*absolute/);
3628
+ });
3629
+
3630
+ it("a tap anywhere else closes an open info circle", () => {
3631
+ // A <details> only closes from its own summary; the closer is mounted once.
3632
+ expect(read("components/InfoHintCloser.tsx")).toContain("pointerdown");
3633
+ expect(read("app/layout.tsx")).toContain("<InfoHintCloser />");
3634
+ });
3635
+
3636
+ it("no obvious field (a name, an email, a language) gets an info circle", () => {
3637
+ const offenders: string[] = [];
3638
+ for (const file of TSX) {
3639
+ for (const m of read(file).matchAll(/<Field\\b[^>]*>/gs)) {
3640
+ const tag = m[0];
3641
+ if (!/\\bhelp=/.test(tag)) continue;
3642
+ if (/label="(First Name|Last Name|Name|Email|Email address|Language|Country)"/.test(tag)) {
3643
+ offenders.push(file + ": " + tag.slice(0, 80));
3644
+ }
3645
+ }
3646
+ }
3647
+ expect(offenders).toEqual([]);
3648
+ });
3649
+
3516
3650
  it("input borders clear the 3:1 non-text contrast minimum", () => {
3517
3651
  // #ccc on white is ~1.6:1 — the edge of the box genuinely isn't visible.
3518
3652
  expect(css()).toMatch(/--field-border:\\s*#8f8b81/);
@@ -3825,6 +3959,7 @@ const APP_LAYOUT_TEMPLATE = `// Root layout — SEO baseline wiring per Z2W stan
3825
3959
 
3826
3960
  import type { Metadata, Viewport } from "next";
3827
3961
  import { Analytics } from "@/lib/analytics/Analytics";
3962
+ import { InfoHintCloser } from "@/components/InfoHintCloser";
3828
3963
  import { serializeJsonLd } from "@/lib/json-ld";
3829
3964
 
3830
3965
  // Global styles. Body typography (18px / 1.5, per the standing Zero2Webmaster
@@ -3892,6 +4027,10 @@ export default function RootLayout({ children }: { children: React.ReactNode })
3892
4027
  </head>
3893
4028
  <body>
3894
4029
  {children}
4030
+ {/* Closes an open field-help "i" on a tap anywhere else, or Escape.
4031
+ Mounted here once so components/FormBits.tsx stays server-rendered.
4032
+ Renders nothing. */}
4033
+ <InfoHintCloser />
3895
4034
  {/* Fathom analytics (per [[fathom-analytics]]). \`<Analytics />\` renders
3896
4035
  the loader AND the RouteTracker that fires trackPageview() on every
3897
4036
  route change — the two are one pattern. It no-ops until
@@ -5632,6 +5771,7 @@ export function scaffoldNextjs(inputs, opts) {
5632
5771
  { path: "test/server-only.stub.ts", content: SERVER_ONLY_STUB_TEMPLATE },
5633
5772
  { path: "app/globals.css", content: globalsCss(spec.primaryColor) },
5634
5773
  { path: "components/FormBits.tsx", content: sub(FORM_BITS_TEMPLATE, inputs, opts, spec) },
5774
+ { path: "components/InfoHintCloser.tsx", content: INFO_HINT_CLOSER_TEMPLATE },
5635
5775
  // The contrast pair table and the math it uses. Emitted unconditionally: the
5636
5776
  // stylesheet it measures is emitted unconditionally, and a project whose
5637
5777
  // palette is unmeasured is exactly the project that needs measuring.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zero2webmaster/starter-kit",
3
- "version": "0.42.0",
3
+ "version": "0.43.1",
4
4
  "description": "Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.",
5
5
  "author": {
6
6
  "name": "Dr. Kerry Kriger",