@atelic-action/ui 8.0.0 → 8.1.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.
Files changed (56) hide show
  1. package/README.md +135 -14
  2. package/bin/atelic-check-sentry.ts +5 -0
  3. package/dist/gate/middleware.js +15 -1
  4. package/dist/monitoring/server.d.ts +72 -0
  5. package/dist/monitoring/server.js +201 -0
  6. package/dist/vite/index.d.ts +1 -1
  7. package/dist/vite/index.js +1 -1
  8. package/dist/vite/marketing-config.d.ts +28 -1
  9. package/dist/vite/marketing-config.js +62 -0
  10. package/package.json +10 -2
  11. package/src/app/layout/DesktopRail.tsx +6 -4
  12. package/src/app/layout/MobileMenu.tsx +10 -5
  13. package/src/app/layout/MobileTabBar.tsx +3 -2
  14. package/src/app/layout/PageError.tsx +2 -2
  15. package/src/app/layout/SectionCards.tsx +7 -2
  16. package/src/app/layout/UserMenu.tsx +1 -1
  17. package/src/app/ui/alert.tsx +1 -1
  18. package/src/app/ui/form.tsx +2 -2
  19. package/src/artifact/AppErrorBoundary.tsx +12 -7
  20. package/src/chrome/BrandLockup.tsx +35 -5
  21. package/src/chrome/ContactDock.tsx +45 -13
  22. package/src/chrome/Footer.tsx +97 -25
  23. package/src/chrome/NavMegaPanel.tsx +17 -6
  24. package/src/chrome/SiteHeader.tsx +35 -7
  25. package/src/chrome/SiteMenu.tsx +6 -3
  26. package/src/chrome/SiteShell.tsx +22 -2
  27. package/src/chrome/StickyCTABar.tsx +12 -8
  28. package/src/components/NotFound.tsx +3 -2
  29. package/src/gate/middleware.ts +15 -1
  30. package/src/lib/emailText.tsx +26 -0
  31. package/src/lib/phoneText.tsx +40 -0
  32. package/src/monitoring/ErrorCatcherScript.tsx +15 -0
  33. package/src/monitoring/catcher.ts +118 -0
  34. package/src/monitoring/index.ts +25 -0
  35. package/src/monitoring/sdk.ts +112 -0
  36. package/src/monitoring/server.ts +244 -0
  37. package/src/monitoring/start.ts +118 -0
  38. package/src/primitives/Button.tsx +3 -1
  39. package/src/primitives/Eyebrow.tsx +6 -2
  40. package/src/routing/index.ts +1 -0
  41. package/src/routing/miss.ts +32 -0
  42. package/src/scripts/check-sentry.ts +77 -0
  43. package/src/sections/FullBleedVideo.tsx +13 -4
  44. package/src/sections/Hero.tsx +8 -1
  45. package/src/sections/LinkColumns.tsx +30 -14
  46. package/src/sections/Locations.tsx +1 -1
  47. package/src/sections/siteConfig.ts +35 -5
  48. package/src/styles/app.css +9 -0
  49. package/src/styles/base.css +26 -0
  50. package/src/styles/chrome.css +218 -28
  51. package/src/styles/defaults.css +5 -2
  52. package/src/styles/primitives.css +11 -4
  53. package/src/styles/sections.css +26 -3
  54. package/src/types.ts +8 -1
  55. package/src/vite/index.ts +4 -0
  56. package/src/vite/marketing-config.ts +81 -1
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Whether the router's matches are a miss: the catch all route took the
3
+ * path (an unknown page), or a route with params says its params name a page
4
+ * it does not have (a blog slug nobody wrote) through `staticData.missing`.
5
+ * Router free: it reads the plain fields every TanStack match carries, so a
6
+ * site's root route asks it from `head` and from `useMatches`.
7
+ *
8
+ * Under `staticNotFoundRouting` a miss is still pending while the page
9
+ * hydrates, and a route's `notFound()` lands as late, so the question is
10
+ * answered from the matches alone, before anything has loaded. A site's root
11
+ * uses it twice: to emit the 404's head tags from the root (tags on the
12
+ * pending catch all route would be emitted twice), and to draw a miss inside
13
+ * the site's shell from the root layout, so the shell stays mounted while
14
+ * the not found body swaps from its pending render to its own.
15
+ */
16
+ export interface MissMatch {
17
+ routeId: string;
18
+ params: Record<string, string>;
19
+ staticData?: { missing?: (params: Record<string, string>) => boolean };
20
+ }
21
+
22
+ /** The catch all route's id in a TanStack file route tree. */
23
+ export const CATCH_ALL_ROUTE_ID = "/$";
24
+
25
+ export function isMiss(
26
+ matches: ReadonlyArray<MissMatch>,
27
+ catchAllId: string = CATCH_ALL_ROUTE_ID,
28
+ ): boolean {
29
+ return matches.some(
30
+ (match) => match.routeId === catchAllId || match.staticData?.missing?.(match.params) === true,
31
+ );
32
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Fails a production deploy that would ship without error reporting. The
3
+ * first step of a marketing site's `bun run build`: on Vercel's production
4
+ * build (`VERCEL_ENV=production`) an empty `VITE_SENTRY_DSN` stops the build,
5
+ * since a site never launches without Sentry. A preview or a local build
6
+ * passes with a one line note. A site with a real reason to launch without
7
+ * it passes `--allow-missing`, which lets the build go on under a loud
8
+ * warning.
9
+ *
10
+ * The DSN is read the way Vite will read it for the build: the environment,
11
+ * then the site's `.env` files for production mode. A DSN that is set but
12
+ * malformed fails every build, since it would send nothing.
13
+ *
14
+ * Usage: atelic-check-sentry [--allow-missing] (from the site's root)
15
+ */
16
+ import { loadEnv } from "vite";
17
+ import { parseDSN } from "../monitoring/server";
18
+
19
+ export interface SentryCheckInput {
20
+ /** The build's environment, where `VERCEL_ENV` and the DSN are read. */
21
+ env: Record<string, string | undefined>;
22
+ /** The command's arguments. */
23
+ args: readonly string[];
24
+ }
25
+
26
+ export interface SentryCheckResult {
27
+ /** The exit code: 1 only for a production build with no DSN and no waiver. */
28
+ code: 0 | 1;
29
+ /** What the command prints, one line, or a warning block for a waiver. */
30
+ message: string;
31
+ }
32
+
33
+ /** The check, kept pure so it can be tested without a build. */
34
+ export function checkSentry({ env, args }: SentryCheckInput): SentryCheckResult {
35
+ const production = env.VERCEL_ENV === "production";
36
+ const dsn = (env.VITE_SENTRY_DSN ?? "").trim();
37
+ // A DSN that is set but cannot be read sends nothing, whatever the build:
38
+ // it fails here, on any environment, waiver or not.
39
+ if (dsn && !parseDSN(dsn)) {
40
+ return {
41
+ code: 1,
42
+ message:
43
+ "[sentry] VITE_SENTRY_DSN is set but is not a DSN (https://<key>@<host>/<project>). Copy it again from the Sentry project's Client Keys.",
44
+ };
45
+ }
46
+ if (dsn) return { code: 0, message: "[sentry] VITE_SENTRY_DSN is set; errors will be reported." };
47
+ if (!production) {
48
+ return {
49
+ code: 0,
50
+ message: `[sentry] no VITE_SENTRY_DSN on this ${env.VERCEL_ENV ?? "local"} build; errors are not reported, which only a production deploy forbids.`,
51
+ };
52
+ }
53
+ if (args.includes("--allow-missing")) {
54
+ return {
55
+ code: 0,
56
+ message: [
57
+ "[sentry] ************************************************************",
58
+ "[sentry] WARNING: this PRODUCTION build has no VITE_SENTRY_DSN and ships with --allow-missing.",
59
+ "[sentry] Nothing that breaks on this site will be reported. Set the DSN on the Vercel project.",
60
+ ].join("\n"),
61
+ };
62
+ }
63
+ return {
64
+ code: 1,
65
+ message:
66
+ "[sentry] this production build has no VITE_SENTRY_DSN. Set it on the Vercel project (README, Error Reporting), or pass --allow-missing for a site with a real reason to launch without Sentry.",
67
+ };
68
+ }
69
+
70
+ /** The command: checks the build in the working directory and exits with the result. */
71
+ export function main(args: readonly string[] = process.argv.slice(2)): void {
72
+ const env = { ...loadEnv("production", process.cwd(), "VITE_"), ...process.env };
73
+ const result = checkSentry({ env, args });
74
+ if (result.code === 0) console.log(result.message);
75
+ else console.error(result.message);
76
+ process.exit(result.code);
77
+ }
@@ -11,7 +11,11 @@ export interface FullBleedVideoProps {
11
11
  poster?: string;
12
12
  /** What the video shows, for a screen reader. Site copy, so it always comes in as a prop. */
13
13
  label: string;
14
- /** A shot brief rendered as a labeled block until the first frame exists. */
14
+ /**
15
+ * A shot brief rendered as a labeled block until the first frame exists.
16
+ * Given without a `poster`, it says the footage does not exist yet, so the
17
+ * band draws the brief alone and never requests `src`.
18
+ */
15
19
  placeholder?: string;
16
20
  /** The band's height, any CSS length. Defaults to clamp(260px, 42vw, 560px). */
17
21
  height?: string;
@@ -60,10 +64,15 @@ export function FullBleedVideo({
60
64
  // A pause the reader asked for holds until they ask to play again.
61
65
  const [held, setHeld] = useState(false);
62
66
 
67
+ // A brief with no first frame is a band whose footage is not shot yet:
68
+ // there is no clip to fetch, so the video never mounts.
69
+ const footage = src !== "" && (poster !== undefined || placeholder === undefined);
70
+
63
71
  useEffect(() => {
72
+ if (!footage) return;
64
73
  if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return;
65
74
  setLoad(true);
66
- }, []);
75
+ }, [footage]);
67
76
 
68
77
  useEffect(() => {
69
78
  const band = bandRef.current;
@@ -127,7 +136,7 @@ export function FullBleedVideo({
127
136
  {placeholder ?? label}
128
137
  </div>
129
138
  )}
130
- {load && near && (
139
+ {footage && load && near && (
131
140
  <video
132
141
  ref={ref}
133
142
  className={["fbv-video", playing && "is-on"].filter(Boolean).join(" ")}
@@ -143,7 +152,7 @@ export function FullBleedVideo({
143
152
  <source src={withBase(src)} type={type} />
144
153
  </video>
145
154
  )}
146
- {controls && load && near && (
155
+ {controls && footage && load && near && (
147
156
  <button
148
157
  type="button"
149
158
  className="fbv-toggle"
@@ -16,6 +16,8 @@ export interface HeroTrustItem {
16
16
 
17
17
  export interface HeroProps {
18
18
  eyebrow?: string;
19
+ /** Draws the eyebrow's trailing rule. Defaults to true; false sets the kicker alone. */
20
+ eyebrowRule?: boolean;
19
21
  /** Headline; use <em className="serif"> spans for the serif accent. */
20
22
  title: ReactNode;
21
23
  subtitle?: ReactNode;
@@ -48,6 +50,7 @@ export interface HeroProps {
48
50
  /** Full-bleed image hero with scrim, headline, CTA pair, and trust stats. */
49
51
  export function Hero({
50
52
  eyebrow,
53
+ eyebrowRule = true,
51
54
  title,
52
55
  subtitle,
53
56
  image,
@@ -66,7 +69,11 @@ export function Hero({
66
69
 
67
70
  const copy = (
68
71
  <>
69
- {eyebrow && <Eyebrow onDark>{eyebrow}</Eyebrow>}
72
+ {eyebrow && (
73
+ <Eyebrow onDark rule={eyebrowRule}>
74
+ {eyebrow}
75
+ </Eyebrow>
76
+ )}
70
77
  <h1>{title}</h1>
71
78
  {subtitle && <p className="hero-sub">{subtitle}</p>}
72
79
  {(primaryCTA || secondaryCTA) && (
@@ -5,7 +5,11 @@ import { useWithBase } from "../routing/BasePathProvider";
5
5
  /** One link in a column, with a figure set right aligned on its line when it has one. */
6
6
  export interface LinkColumnLink {
7
7
  label: string;
8
- href: string;
8
+ /**
9
+ * The row's page. Left out, the row is plain words (its name and its
10
+ * count) with no link, for a page that does not exist yet.
11
+ */
12
+ href?: string;
9
13
  /**
10
14
  * A figure the row carries, e.g. a city's count of finished jobs. It sits
11
15
  * right aligned on the label's line in tabular numerals, so a column of
@@ -32,28 +36,40 @@ export interface LinkColumnsProps {
32
36
  * Columns of links under a section's heading, each column a heading over
33
37
  * its links, as many across as fit: a site's service areas by region, or a
34
38
  * hub page's children. A link can carry a figure on its own line, right
35
- * aligned, so a list of cities reads with their counts in one column.
39
+ * aligned, so a list of cities reads with their counts in one column. A
40
+ * row with no `href` is words alone. The least a column narrows to is
41
+ * `--link-columns-min` (170px), so a theme can fit two across a phone.
36
42
  */
37
43
  export function LinkColumns({ columns, className }: LinkColumnsProps) {
38
44
  const withBase = useWithBase();
39
45
  return (
40
46
  <div className={["link-columns", className].filter(Boolean).join(" ")}>
41
- {columns.map((column) => (
42
- <div className="lc-col" key={column.heading}>
47
+ {columns.map((column, place) => (
48
+ // biome-ignore lint/suspicious/noArrayIndexKey: two columns may share a heading, so the place keeps the key unique; columns never reorder
49
+ <div className="lc-col" key={`${place} ${column.heading}`}>
43
50
  <h3 className="lc-head">
44
51
  {column.href ? <a href={withBase(column.href)}>{column.heading}</a> : column.heading}
45
52
  </h3>
46
53
  <ul>
47
- {column.links.map((link) => (
48
- <li key={link.href}>
49
- <a
50
- className="lc-link"
51
- href={withBase(link.href)}
52
- {...newTabProps(link.href, link.external)}
53
- >
54
- <span className="lc-label">{link.label}</span>
55
- {link.count != null && <span className="lc-count">{link.count}</span>}
56
- </a>
54
+ {column.links.map((link, at) => (
55
+ // biome-ignore lint/suspicious/noArrayIndexKey: a column may link one page twice, so the place keeps the key unique; links never reorder
56
+ <li key={`${at} ${link.href ?? ""}`}>
57
+ {link.href ? (
58
+ <a
59
+ className="lc-link"
60
+ href={withBase(link.href)}
61
+ {...newTabProps(link.href, link.external)}
62
+ >
63
+ <span className="lc-label">{link.label}</span>
64
+ {link.count != null && <span className="lc-count">{link.count}</span>}
65
+ </a>
66
+ ) : (
67
+ // No page yet: the name and its count as words, nothing to follow.
68
+ <span className="lc-link">
69
+ <span className="lc-label">{link.label}</span>
70
+ {link.count != null && <span className="lc-count">{link.count}</span>}
71
+ </span>
72
+ )}
57
73
  </li>
58
74
  ))}
59
75
  </ul>
@@ -67,7 +67,7 @@ export function Locations({
67
67
  <div className="loc-links">
68
68
  <a href={`tel:${loc.phoneE164}`}>
69
69
  <Phone size={14} aria-hidden />
70
- {loc.phoneDisplay}
70
+ <span className="tel-number">{loc.phoneDisplay}</span>
71
71
  </a>
72
72
  <a href={loc.mapLink} {...newTabProps(loc.mapLink, true)}>
73
73
  <Navigation size={14} aria-hidden />
@@ -60,6 +60,14 @@ export interface CTA {
60
60
  href: string;
61
61
  /** Opens in a new tab with rel="noopener" when true (e.g. a booking portal). */
62
62
  external?: boolean;
63
+ /** The header's button carries the arrow the hero's primary button shows. Defaults to false. */
64
+ arrow?: boolean;
65
+ /**
66
+ * The phone's sticky bar's own words, when they should differ from
67
+ * `label` (a shorter "Book" where the header says "Book a visit").
68
+ * Defaults to `label`.
69
+ */
70
+ stickyLabel?: string;
63
71
  }
64
72
 
65
73
  /** How opening hours print: "12h" reads "9a to 5p", "24h" reads "09:00 to 17:00". */
@@ -68,7 +76,7 @@ export type Clock = "12h" | "24h";
68
76
  export interface OpeningHours {
69
77
  /** Row label as displayed, e.g. "Monday" or "Friday to Sunday". */
70
78
  label: string;
71
- /** Compact label for the footer, e.g. "Mon" or "Fri to Sun". */
79
+ /** Compact label for the footer's hours column, e.g. "Mon" or "Fri to Sun". */
72
80
  labelShort: string;
73
81
  /** schema.org day names covered by this row (empty for closed spans). */
74
82
  days: string[];
@@ -217,14 +225,25 @@ export interface SiteConfig {
217
225
  attribution?: string;
218
226
  /**
219
227
  * What the footer needs beyond the fields above. The default footer is a
220
- * brand column (the logo, the rating, `address` linked to `mapLinkURL`,
221
- * `phone`, `email`) and four link columns: Company from `nav`, Resources
222
- * from `footerLinks`, Social from `socialLinks`, and Legal from
228
+ * brand column (the logo, the rating linked to the Google profile,
229
+ * `address` linked to `mapLinkURL`, `phone`, `email`), the `hours` as a
230
+ * column of their own, and four link columns: Company from `nav`,
231
+ * Resources from `footerLinks`, Social from `socialLinks`, and Legal from
223
232
  * `legalLinks`.
224
233
  */
225
234
  footer?: {
226
- /** The Google rating as printed, e.g. "4.8 on Google". Plain text, never a link. */
235
+ /** The Google rating as printed, e.g. "4.8 on Google". */
227
236
  rating?: string;
237
+ /**
238
+ * Where the rating links, the profile holding the reviews. Defaults to
239
+ * `mapLinkURL`, the business's Google profile, whenever a rating is set.
240
+ */
241
+ ratingHref?: string;
242
+ /**
243
+ * The rating link's accessible name when it should say more than the
244
+ * rating's words, e.g. "4.8 on Google, opens the Google profile".
245
+ */
246
+ ratingLabel?: string;
228
247
  /** The link columns, named outright, in place of the four the config derives. */
229
248
  columns?: FooterColumn[];
230
249
  /** The site's own words for the closing bar's right side, in place of the practice's credit. */
@@ -235,6 +254,12 @@ export interface SiteConfig {
235
254
  * visit). Defaults to true.
236
255
  */
237
256
  showAddress?: boolean;
257
+ /**
258
+ * Set false to keep the hours out of the footer while `hours` still
259
+ * feeds the structured data and the sections that print them. Defaults
260
+ * to true: a site whose config holds hours shows them in its footer.
261
+ */
262
+ showHours?: boolean;
238
263
  };
239
264
  ogImage?: string;
240
265
  /** Profile URLs for the schema.org sameAs entity graph (socials, listings). */
@@ -273,6 +298,11 @@ export interface SiteConfig {
273
298
  gate?: GateConfig;
274
299
  /** The section spacing every page wears (see Density). Defaults to `default`. */
275
300
  density?: Density;
301
+ /**
302
+ * Words shown beside the burger on a phone, e.g. "Menu", which then also
303
+ * name the button. Absent, the burger stands alone as it always has.
304
+ */
305
+ menuLabel?: string;
276
306
  /** What the header shows beyond the nav and the CTA. */
277
307
  header?: {
278
308
  /** Up to two numbers in the bar, each a tel link; the first is the phone's call button. */
@@ -46,6 +46,11 @@
46
46
  grey highlight: darker than the fill, never lighter, so white words on
47
47
  it and it on the grey both stay above 4.5 to 1. */
48
48
  --color-destructive-hover: color-mix(in srgb, hsl(var(--destructive)) 85%, black);
49
+ /* Destructive words, as against the destructive fill: the light theme's
50
+ one red does both, so it falls back to --destructive, and the dark
51
+ theme, whose fill is too deep to read as words on a dark card, sets its
52
+ own. */
53
+ --color-destructive-ink: hsl(var(--destructive-ink, var(--destructive)));
49
54
 
50
55
  --color-muted: hsl(var(--muted));
51
56
  --color-muted-foreground: hsl(var(--muted-foreground));
@@ -146,6 +151,10 @@
146
151
  --accent-foreground: 30 8% 95%;
147
152
  --destructive: 0 62.8% 30.6%;
148
153
  --destructive-foreground: 30 8% 95%;
154
+ /* #f87171 (red 400) for destructive words: the fill above reads 1.79
155
+ to 1 as words on the card; this reads 6.48 on the card and 5.62 on
156
+ the grey highlight. */
157
+ --destructive-ink: 0 90.6% 70.8%;
149
158
  --border: 30 5% 18%;
150
159
  --input: 30 5% 18%;
151
160
  --ring: 30 4.9% 83.9%;
@@ -110,6 +110,32 @@
110
110
  text-wrap: balance;
111
111
  margin: 0;
112
112
  }
113
+ /* A brand's headline style, set by tokens rather than a site's rules: the
114
+ page and section headings (h1, h2) take the case, the weight, the
115
+ tracking, and the color a theme sets, each defaulting to the look
116
+ above. The color never reaches a heading on a filled or dark ground,
117
+ which resets it below, nor one a component colors itself (the hero's,
118
+ a dark section heading's). */
119
+ .atelic-ui h1,
120
+ .atelic-ui h2 {
121
+ text-transform: var(--heading-transform, none);
122
+ font-weight: var(--heading-weight, var(--weight-heavy));
123
+ letter-spacing: var(--heading-tracking, -0.02em);
124
+ color: var(--heading-color, inherit);
125
+ }
126
+ .atelic-ui
127
+ :is(
128
+ .on-primary,
129
+ .on-dark,
130
+ .hero,
131
+ .creds,
132
+ .callout-panel,
133
+ .price-band,
134
+ .process,
135
+ .contact-info-card
136
+ ) {
137
+ --heading-color: currentColor;
138
+ }
113
139
  .atelic-ui h1 {
114
140
  font-size: clamp(2.6rem, 8vw, 5rem);
115
141
  }