@luhtech/site-template 0.21.0 → 0.23.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
@@ -3,8 +3,15 @@
3
3
  One Astro component library renders every LuhTech venture marketing site from
4
4
  its own `content/page.schema.json` + `content/site.schema.json` instances.
5
5
  Copy is a derived surface -- the instances are the authored source, this
6
- package is the renderer, and it validates on every build so an invalid
7
- instance fails the build instead of shipping.
6
+ package is the renderer. Since 0.18.0 the package fetches and carries no
7
+ schema: each site repo validates its instances in its own CI against
8
+ schema-registry (the reusable `content-validate.yml` workflow), so an invalid
9
+ instance fails that site's CI instead of shipping.
10
+
11
+ Current release: **0.23.0** on npmjs.com. Every release is a
12
+ `site-template-v*` tag, published by `.github/workflows/publish.yml`; CI
13
+ (`.github/workflows/ci.yml`) runs `npm install` + `npm test` on every PR and
14
+ push to `main`.
8
15
 
9
16
  ```
10
17
  npm install @luhtech/site-template
@@ -45,6 +52,8 @@ site with no way to supply one (GTM-L3 G1.4-R, 2026-09-08).
45
52
  on `hero`/`proof` sections were silently invisible before this).
46
53
  - **`<SplashHero {...} />`** (`@luhtech/site-template/components/SplashHero.astro`)
47
54
  -- a trigger-flow hero: full-bleed photo, a one-time splash intro on load
55
+ (optional since 0.20.0: `intro: 'wordmark'` is the default, `intro: 'none'`
56
+ renders the hero with no splash -- Ectropy-Business's `apps/marketing-site` home page uses `'none'`)
48
57
  (wireframe wordmark -> white-fill wave -> fly-out into the real nav logo's
49
58
  on-screen position, measured at play time), then never repeats for that
50
59
  session (`sessionStorage`, keyed by your own `sessionKey` so two on one
@@ -63,9 +72,9 @@ site with no way to supply one (GTM-L3 G1.4-R, 2026-09-08).
63
72
  as usual. See `~/dev/luhtech/Ectropy-Business/apps/marketing-site/src/pages/index.astro`
64
73
  for the reference consumer.
65
74
  - **`loadBrand(path)`** (`@luhtech/site-template/content`) reads a
66
- `content/brand/<venture>.json` file and ajv-validates it against the live,
67
- version-pinned `portfolio/brand-identity.schema.json`. Mirrors
68
- `loadPage`/`loadSite`.
75
+ `content/brand/<venture>.json` (`portfolio/brand-identity.schema.json`)
76
+ instance. Like `loadPage`/`loadSite`, it does not validate (0.18.0); the
77
+ site's CI does.
69
78
  - **`applyBrandDefaults(page, brand)`** (`@luhtech/site-template/content`) --
70
79
  GTM-L3 G1.1/G1.2: on the page whose `route` is `/`, returns a copy of
71
80
  `page` with `sections[hero].heading` replaced by `brand.identity.tagline`,
@@ -216,9 +225,10 @@ design undershot; the bespoke clickable-diagram/inspector/scenario-ledger
216
225
  layer those examples also use is deliberately out of scope -- genuinely
217
226
  bespoke per-tool illustration work, not schema-parametrizable regardless.
218
227
 
219
- `loadTool()` (new, `@luhtech/site-template/content`) reads and ajv-validates
220
- a `content/tool.schema.json` instance from disk, same convention and error
221
- handling as `loadPage`/`loadSite`. `ToolCalculator.astro` renders it: real
228
+ `loadTool()` (new, `@luhtech/site-template/content`) reads a
229
+ `content/tool.schema.json` instance from disk, same convention as
230
+ `loadPage`/`loadSite` (it validated with ajv until 0.18.0; the site's CI
231
+ validates it now). `ToolCalculator.astro` renders it: real
222
232
  inputs, a live-computed result gated behind a contact-capture form, and
223
233
  (when the instance's `presentation` block is present) the hero KPI/chart/
224
234
  method-notes/sources described above. `<Section>`/`<Article>` gained
@@ -290,7 +300,8 @@ this same section's own `diagrams[]` -- the block is a position, `diagrams[]`
290
300
  stays the data) and `image` (required `src`+`alt`, optional `caption` --
291
301
  the first real mechanism for a photo to appear inline in an article body
292
302
  at all). Existing instances validate unchanged; `PAGE_PIN` bumped to
293
- `1.3.0`.
303
+ `1.3.0` (the pin itself was removed in 0.18.0, when validation moved to
304
+ each site's CI).
294
305
 
295
306
  **`Block.astro`** renders both: `diagram` dispatches to `Diagram.astro`
296
307
  after resolving `diagramId` against a new `diagrams` prop -- a dangling
@@ -327,6 +338,47 @@ A `tsconfig.json` was added (this repo had none) extending
327
338
  diagnostics across `ToolCalculator.astro` and the diagram components that
328
339
  the repo's prior no-tsconfig default resolution wasn't catching.
329
340
 
341
+ ## Marks, the venture directory, forms, papers and figures (0.8.0 - 0.20.1)
342
+
343
+ What landed between 0.7.0 and 0.15.0, and after it, that the sections above
344
+ and below do not cover (versions from this repo's commit history):
345
+
346
+ - **Venture marks.** `VentureMark.astro` renders a venture's mark on a sibling
347
+ site, preferring its animated mark from the generated
348
+ `src/lib/venture-marks.generated.ts` and falling back to the static one.
349
+ Each animated mark is self-contained (its own scoped `<style>` and prefixed
350
+ keyframes) so several can sit on one page (0.8.0, 0.9.0; Ectropy's mark is
351
+ its brand pack's reverse reveal at small format since 0.20.0/0.20.1).
352
+ - **Venture cards.** `VentureCard.astro` renders a `crossLinks[]` entry as a
353
+ card: mark, the venture's display name and one-liner from the generated
354
+ `src/lib/venture-directory.generated.ts`, and the authored
355
+ `relationshipLine` (0.10.0; the holding company shows its name, not its id,
356
+ since 0.18.1).
357
+ - **Sync bins (local, not CI).** `luhtech-sync-marks`,
358
+ `luhtech-sync-animated-marks` and `luhtech-sync-venture-directory` read the
359
+ venture repos as sibling checkouts on disk (`~/dev/luhtech/<Repo>`, listed in
360
+ `bin/lib/ventures.mjs`) and regenerate the files above. They cannot run in
361
+ CI; run them by hand when a venture's mark or brand record changes.
362
+ `bin/lib/ventures.mjs` lists ten entries: Ectropy, Qullqa, Siltana,
363
+ JobsiteControl, Viiva, Ohjaus, Raizal, Replique, Hilja and LuhTech.
364
+ - **Shared layout pieces.** `FullBleedHeroImage.astro` (0.10.2, promoted from
365
+ LuhTech-Business), `SectionHeading.astro` (shared heading standard), a `bio` block
366
+ type (0.11.0), a nav that collapses behind a menu button below `md` (0.13.0),
367
+ and `LoginCard.astro` plus a sign-in nav button (0.14.0).
368
+ - **Gated asset request.** `AssetRequestForm.astro` renders a `cta` section
369
+ that carries `assetRequest`: name, work email, company, role and an unticked
370
+ opt-in, posted to `site.leadCapture.assetRequestEndpoint`. The page only
371
+ shows a confirmation; the capture service emails the link
372
+ (d-2026-10-01-st-asset-request-form).
373
+ - **Paper landing.** `PaperLanding.astro` (`@luhtech/site-template/lib/paperLanding`
374
+ for its helpers) is a paper's one page: its open summary and figures, then
375
+ Download, Feedback and Share, read from the whitepaper record (0.17.0,
376
+ d-2026-10-02-st-paper-landing-three-actions).
377
+ - **Figure records.** A `diagrams[]` entry that names a `figureRef` is drawn by
378
+ `@luhtech/figures` (published from `luh-tech/site-visuals`) in the site's
379
+ brand theme; an entry with `diagramType` + `data` still draws inline (0.19.0).
380
+ `ConnectionGraph.astro` renders the `connection-graph` diagram type.
381
+
330
382
  ## Browser icons, canonical URLs and search metadata (0.15.0)
331
383
 
332
384
  `SiteLayout` now emits, beyond `page.seo`'s title/description/ogImage:
@@ -373,6 +425,46 @@ Two bins go with it:
373
425
  install chromium`. `SiteLayout` emits the web-app meta for an installable
374
426
  site.
375
427
 
428
+ ## A figure renders its label (0.23.0)
429
+
430
+ content/page 2.9.0 and whitepaper 1.4.0 give a figure a `label` (what the
431
+ value is) and a `measure` (the value as money, a quantity, a fraction or a
432
+ date, by reference to the open standard's units definitions), and deprecate
433
+ `unit`, which carried both. `Figure` and the `sources` section render
434
+ `label`, and fall back to `unit` for a record not yet moved;
435
+ `paperSections` carries `label` and `measure` onto the proof section.
436
+ `figureLabel` (`@luhtech/site-template/lib/figureLabel`) is the one rule.
437
+
438
+ ## An animated mark replays when clicked (0.22.0)
439
+
440
+ Every animated mark ran once on load and then sat on its last frame;
441
+ clicking it did nothing. `SiteLayout` now installs one replay for every
442
+ element on the page carrying `data-mark-replay="<group>"`:
443
+
444
+ - **Inline markup** (an `<svg>`, or a wrapper around one, animated with
445
+ CSS) restarts its animations in place. `VentureMark` sets
446
+ `data-mark-replay="venture"` on an animated mark.
447
+ - **An `<img>` of an animated SVG** gets a fresh `data:` URL of the
448
+ animated file, so the browser draws it from frame 0. Point
449
+ `data-mark-replay-src` at the animated file when the `<img>` shows a
450
+ static one at rest (Ectropy's lockup, which its reveal ends on). `data:`
451
+ rather than `blob:`, because a CSP like ectropy.ai's allows `data:`
452
+ images and not `blob:`.
453
+
454
+ A click on a mark whose link opens this same page replays it and does not
455
+ reload, so the nav logo (linked to `/`) replays on the landing page. From
456
+ any other page it is an ordinary link home. A link to another origin, or
457
+ one opened in a new tab, is left alone. Under
458
+ `prefers-reduced-motion: reduce` nothing replays.
459
+
460
+ A site opts its nav logo in on the element it passes to the `logo` slot:
461
+
462
+ ```astro
463
+ <Fragment slot="logo">
464
+ <img src="/brand/x-lockup.svg" data-mark-replay="nav" data-mark-replay-src="/brand/x-mark-animated.svg" alt="X" />
465
+ </Fragment>
466
+ ```
467
+
376
468
  ## Migrating a venture site
377
469
 
378
470
  A migration is: author `content/site.<venture>.json` + `content/pages/*.json`
@@ -414,4 +506,12 @@ in `predev`/`prebuild` as before. Run both check bins in CI against every
414
506
 
415
507
  ## Peer dependencies
416
508
 
417
- `astro ^7.2`, `tailwindcss ^4`.
509
+ `astro ^7.2`, `tailwindcss ^4`, and `playwright >=1.40` as an optional peer
510
+ (only `luhtech-device-smoke` needs it).
511
+
512
+ Dependencies: `@lucide/astro` (icons), `@resvg/resvg-js` (`luhtech-sync-icons`)
513
+ and `@luhtech/figures` (figure records).
514
+
515
+ Deliverable records for this package's changes (`d-<date>-st-<slug>`) live in
516
+ `luh-tech/Ectropy-Business` `.dlp/deliverables/`; this repo carries no `.roadmap/`
517
+ or `.dlp/`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luhtech/site-template",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "description": "Shared Astro component library + content-instance contract for LuhTech venture marketing sites -- one template renders every site from content/page.schema.json + content/site.schema.json instances.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -23,6 +23,7 @@
23
23
  "exports": {
24
24
  "./content": "./src/content/index.ts",
25
25
  "./lib/paperLanding": "./src/lib/paperLanding.ts",
26
+ "./lib/figureLabel": "./src/lib/figureLabel.ts",
26
27
  "./layouts/SiteLayout.astro": "./src/layouts/SiteLayout.astro",
27
28
  "./components/*": "./src/components/*",
28
29
  "./components/sections/*": "./src/components/sections/*"
@@ -12,16 +12,21 @@ export interface Props {
12
12
  figure: {
13
13
  figureId: string;
14
14
  value: string;
15
+ label?: string;
16
+ measure?: Record<string, unknown>;
17
+ /** Deprecated by content/page 2.9.0; read only when label is absent. */
15
18
  unit?: string;
16
19
  provenance: { sourceRef: string; observedAt?: string };
17
20
  };
18
21
  }
22
+ import { figureLabel } from '../lib/figureLabel';
19
23
  const { figure } = Astro.props;
24
+ const label = figureLabel(figure);
20
25
  ---
21
26
  <div class="relative rounded-md border border-ink/15 bg-canvas p-5 overflow-hidden" id={figure.figureId}>
22
27
  <span class="absolute top-0 left-0 right-0 h-1 bg-accent-primary" aria-hidden="true"></span>
23
28
  <span class="font-display text-4xl font-bold leading-none block">{figure.value}</span>
24
- {figure.unit && <span class="text-sm text-ink/70 font-medium mt-2 block">{figure.unit}</span>}
29
+ {label && <span class="text-sm text-ink/70 font-medium mt-2 block">{label}</span>}
25
30
  <span class="text-xs text-ink/50 mt-4 pt-3 border-t border-ink/10 block">
26
31
  {figure.provenance.sourceRef}
27
32
  {figure.provenance.observedAt && ` (${figure.provenance.observedAt})`}
@@ -10,7 +10,8 @@
10
10
  // /brand/{brandRef}-mark.svg file (onerror-hidden if even that's missing)
11
11
  // for every venture that doesn't have one yet. Not every venture needs an
12
12
  // animated mark for this to work; it degrades honestly per-venture
13
- // instead of assuming universal coverage.
13
+ // instead of assuming universal coverage. An animated mark replays when
14
+ // clicked (data-mark-replay="venture", SiteLayout's installMarkReplay, 0.22.0).
14
15
  import { VENTURE_MARKS } from '../lib/venture-marks.generated';
15
16
 
16
17
  export interface Props {
@@ -21,7 +22,7 @@ const { brandRef, class: className = 'h-6 w-6 mb-2' } = Astro.props;
21
22
  const animated = VENTURE_MARKS[brandRef];
22
23
  ---
23
24
  {animated ? (
24
- <svg xmlns="http://www.w3.org/2000/svg" viewBox={animated.viewBox} class={className} role="img" aria-label={brandRef} set:html={animated.markup} />
25
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox={animated.viewBox} class={className} role="img" aria-label={brandRef} data-mark-replay="venture" set:html={animated.markup} />
25
26
  ) : (
26
27
  <img
27
28
  src={`/brand/${brandRef}-mark.svg`}
@@ -2,6 +2,7 @@
2
2
  // sectionKind: sources -- citations for every figure used on the page,
3
3
  // each figure's provenance.sourceRef rendered as a full citation.
4
4
  import SectionHeading from '../SectionHeading.astro';
5
+ import { figureLabel } from '../../lib/figureLabel';
5
6
 
6
7
  export interface Props { section: any }
7
8
  const { section } = Astro.props;
@@ -11,7 +12,7 @@ const { section } = Astro.props;
11
12
  <ol class="space-y-2 text-sm text-ink/70">
12
13
  {section.figures?.map((f: any) => (
13
14
  <li>
14
- <strong>{f.value}{f.unit ? ` ${f.unit}` : ''}</strong> — {f.provenance.sourceRef}
15
+ <strong>{f.value}{figureLabel(f) ? ` ${figureLabel(f)}` : ''}</strong> — {f.provenance.sourceRef}
15
16
  {f.provenance.observedAt && ` (observed ${f.provenance.observedAt})`}
16
17
  </li>
17
18
  ))}
@@ -167,6 +167,11 @@ const linkItems = nav.filter((item) => item !== ctaItem);
167
167
  </div>
168
168
  </footer>
169
169
  <script>
170
+ // An animated mark replays when it is clicked: any [data-mark-replay]
171
+ // on the page, the nav logo and VentureMark included (0.22.0).
172
+ import { installMarkReplay } from '../lib/markReplay';
173
+ installMarkReplay();
174
+
170
175
  // Mobile nav toggle. Plain click handler + classList, no
171
176
  // framework/island needed for something this small -- matches
172
177
  // this file's own existing no-js/reveal scripts' own approach.
@@ -0,0 +1,13 @@
1
+ // A figure's caption under its value: content/page 2.9.0 and whitepaper 1.4.0
2
+ // give a figure a `label` (what the value is) and a structured `measure`
3
+ // (money, quantity, fraction or date by reference to the open standard's
4
+ // units definitions), and deprecate `unit`, a free-text label that carried
5
+ // both meanings. A record that still carries only `unit` renders as before.
6
+ export interface LabelledFigure {
7
+ label?: string;
8
+ unit?: string;
9
+ }
10
+
11
+ export function figureLabel(figure: LabelledFigure): string | undefined {
12
+ return figure.label ?? figure.unit;
13
+ }
@@ -0,0 +1,89 @@
1
+ // A venture's animated mark plays again when it is clicked (0.22.0,
2
+ // d-2026-10-20-st-mark-replay). L4 2026-10-20: "the logo does not animate
3
+ // when you click ... this applies on all svg animations per the template".
4
+ // Every animated mark in the pack ran once on load and then sat on its last
5
+ // frame: Ectropy's reveal once per browser session, luh.tech's drop-in and
6
+ // the VentureMark marks once per page. Clicking a mark did nothing visible.
7
+ //
8
+ // An element opts in with data-mark-replay="<group>". Two kinds of mark:
9
+ // - inline markup (an <svg> or a wrapper around one) whose CSS animations
10
+ // are restarted in place;
11
+ // - an <img> of an animated SVG, which a page cannot restart, so it gets
12
+ // a fresh data: URL of the animated file (data-mark-replay-src, else its
13
+ // own src). data:, not blob:, because ectropy.ai's CSP allows data: and
14
+ // https: images but not blob:. Each replay's URL differs by a trailing
15
+ // comment, so the browser draws a new image and its timeline starts at 0.
16
+ // A click that opens this same page replays in place and does not reload,
17
+ // so the nav logo (linked to "/") replays on the landing page. A click that
18
+ // opens any other page is an ordinary navigation (L4 2026-10-20: "logo
19
+ // replay only needs to happen on the landing page"). Reduced motion:
20
+ // nothing replays.
21
+
22
+ export const REPLAY_ATTR = 'data-mark-replay';
23
+ export const REPLAY_SRC_ATTR = 'data-mark-replay-src';
24
+
25
+ export type ReplayTarget = 'here' | 'next' | 'away';
26
+
27
+ /** Where a click on a mark lands: 'here' with no link or a link to this
28
+ * page, 'next' for another page of this site, 'away' for another origin. */
29
+ export function replayTarget(href: string | null | undefined, current: string): ReplayTarget {
30
+ if (!href) return 'here';
31
+ let to: URL;
32
+ let from: URL;
33
+ try {
34
+ from = new URL(current);
35
+ to = new URL(href, from);
36
+ } catch {
37
+ return 'here';
38
+ }
39
+ if (to.origin !== from.origin) return 'away';
40
+ const path = (u: URL) => u.pathname.replace(/\/index\.html$/, '/').replace(/(.)\/$/, '$1');
41
+ return path(to) === path(from) && to.search === from.search ? 'here' : 'next';
42
+ }
43
+
44
+ /** The data: URL for replay number n of an SVG's text. */
45
+ export function replayDataUrl(svgText: string, n: number): string {
46
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(`${svgText}<!--replay ${n}-->`)}`;
47
+ }
48
+
49
+ const svgText = new Map<string, Promise<string>>();
50
+ let replays = 0;
51
+
52
+ /** Play one mark from its first frame. */
53
+ export function replayMark(el: Element): void {
54
+ if (el.tagName === 'IMG') {
55
+ const img = el as HTMLImageElement;
56
+ const src = img.getAttribute(REPLAY_SRC_ATTR) || img.currentSrc || img.src;
57
+ if (!src) return;
58
+ if (!svgText.has(src)) {
59
+ svgText.set(src, fetch(src).then((r) => (r.ok ? r.text() : Promise.reject(new Error(`${r.status}`)))));
60
+ }
61
+ const n = ++replays;
62
+ svgText.get(src)!.then(
63
+ (text) => { img.src = replayDataUrl(text, n); },
64
+ () => { svgText.delete(src); },
65
+ );
66
+ return;
67
+ }
68
+ if (typeof el.getAnimations === 'function') {
69
+ for (const a of el.getAnimations({ subtree: true })) {
70
+ a.cancel();
71
+ a.play();
72
+ }
73
+ }
74
+ }
75
+
76
+ /** Wire every [data-mark-replay] on the page: a click on one whose link
77
+ * opens this page replays it. */
78
+ export function installMarkReplay(doc: Document = document, win: Window = window): void {
79
+ if (win.matchMedia('(prefers-reduced-motion: reduce)').matches) return;
80
+ doc.addEventListener('click', (e) => {
81
+ const el = (e.target as Element | null)?.closest?.(`[${REPLAY_ATTR}]`);
82
+ if (!el) return;
83
+ const link = el.closest('a[href]') as HTMLAnchorElement | null;
84
+ if (link && (link.target === '_blank' || e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0)) return;
85
+ if (replayTarget(link?.getAttribute('href'), win.location.href) !== 'here') return;
86
+ if (link && new URL(link.href).hash === win.location.hash) e.preventDefault();
87
+ replayMark(el);
88
+ });
89
+ }
@@ -111,6 +111,9 @@ export function feedbackMessage(status: number, error?: string): string {
111
111
  interface PaperFigure {
112
112
  figureId: string;
113
113
  value: string;
114
+ label?: string;
115
+ measure?: Record<string, unknown>;
116
+ /** Deprecated by whitepaper 1.4.0; read only when label is absent. */
114
117
  unit?: string;
115
118
  caption?: string;
116
119
  estimate?: boolean;
@@ -173,6 +176,8 @@ export function paperSections(paper: PaperRecord, slug: string) {
173
176
  figures: open.map((f) => ({
174
177
  figureId: f.figureId,
175
178
  value: f.estimate && !/estimate/i.test(f.value) ? `${f.value} (estimate)` : f.value,
179
+ ...(f.label ? { label: f.label } : {}),
180
+ ...(f.measure ? { measure: f.measure } : {}),
176
181
  ...(f.unit ? { unit: f.unit } : {}),
177
182
  provenance: f.provenance,
178
183
  })),