@zero2webmaster/starter-kit 0.42.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 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.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.42.0 | Last Updated: 2026-10-17*
138
+ *Version: 0.43.0 | Last Updated: 2026-10-23*
@@ -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,
@@ -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: 6px 0 0;
1660
+ margin: 0;
1574
1661
  font-size: 15px;
1575
1662
  }
1576
1663
 
1577
- /* FIXED #8a4b08 rather than the brand accent: this is small text on white, and
1578
- most brand accents fail AA at this size. */
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
- gap: 7px;
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
- padding: 2px 0;
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
- text-decoration: underline;
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: 20px;
1605
- height: 20px;
1606
- flex: 0 0 20px;
1691
+ width: 22px;
1692
+ height: 22px;
1693
+ flex: 0 0 22px;
1607
1694
  border-radius: 50%;
1608
- background: var(--brand-primary);
1609
- color: var(--brand-on-primary);
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
- margin-top: 8px;
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
- what: "the help-hint trigger on the page",
3174
- where: ".info-hint > summary",
3175
- fg: color(".info-hint > summary", "color"),
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. 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",
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 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.",
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.
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.0",
4
4
  "description": "Node CLI to scaffold new Z2W projects from canonical Templates + AGENTS.md.",
5
5
  "author": {
6
6
  "name": "Dr. Kerry Kriger",