diff --git a/app/globals.css b/app/globals.css index 7b9c2d7f..e755e208 100644 --- a/app/globals.css +++ b/app/globals.css @@ -425,3 +425,9 @@ a { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -72; } } + +/* An export capture shows the slide alone: hide the Next.js dev overlay and + its issue badge, which exist only under `next dev`. */ +body:has(main[data-export]) nextjs-portal { + display: none !important; +} diff --git a/components/core/SlideshowViewer.tsx b/components/core/SlideshowViewer.tsx index 1e7ae772..5893e54a 100644 --- a/components/core/SlideshowViewer.tsx +++ b/components/core/SlideshowViewer.tsx @@ -110,6 +110,7 @@ function SlideshowViewerClient({ config }: SlideshowViewerProps) { onClick={handleMainClick} data-total-steps={totalSteps} data-current-step={currentStep} + data-export={exportMode ? '' : undefined} > {mounted && config.slides.map((slide, slideIndex) => { const SlideComponent = getSlideComponent(slide); diff --git a/lib/slideshows.ts b/lib/slideshows.ts index 15a7f6ea..acf05d80 100644 --- a/lib/slideshows.ts +++ b/lib/slideshows.ts @@ -1,4 +1,5 @@ import { SlideshowConfig, SlideshowMetadata, flattenSlides } from "./types"; +import { jrcSevilleHarness2026Config } from "@/slideshows/jrc-seville-harness-2026/config"; import { aiWebinarConfig } from "@/slideshows/ai-webinar/config"; import { abundanceDmvConfig } from "@/slideshows/abundance-dmv/config"; import { vanderbilt2025Config } from "@/slideshows/vanderbilt-2025/config"; @@ -36,6 +37,7 @@ import { appam2026Config } from "@/slideshows/appam-2026/config"; import { studentDebt2026Config } from "@/slideshows/student-debt-2026/config"; export const slideshows: SlideshowConfig[] = [ + jrcSevilleHarness2026Config, bist2026Config, appam2026Config, prop40Webinar2026Config, diff --git a/public/images/jrc-seville-harness-2026/cbo-2012-table-1.png b/public/images/jrc-seville-harness-2026/cbo-2012-table-1.png new file mode 100644 index 00000000..16dd7e7d Binary files /dev/null and b/public/images/jrc-seville-harness-2026/cbo-2012-table-1.png differ diff --git a/public/images/jrc-seville-harness-2026/dashboard-calibration-error-map.png b/public/images/jrc-seville-harness-2026/dashboard-calibration-error-map.png new file mode 100644 index 00000000..bbd982be Binary files /dev/null and b/public/images/jrc-seville-harness-2026/dashboard-calibration-error-map.png differ diff --git a/public/images/jrc-seville-harness-2026/macro-models.png b/public/images/jrc-seville-harness-2026/macro-models.png new file mode 100644 index 00000000..56fd039b Binary files /dev/null and b/public/images/jrc-seville-harness-2026/macro-models.png differ diff --git a/public/images/jrc-seville-harness-2026/sspp-bulletin-top.png b/public/images/jrc-seville-harness-2026/sspp-bulletin-top.png new file mode 100644 index 00000000..61ed98b5 Binary files /dev/null and b/public/images/jrc-seville-harness-2026/sspp-bulletin-top.png differ diff --git a/public/images/jrc-seville-harness-2026/thesis-snap-forecast.png b/public/images/jrc-seville-harness-2026/thesis-snap-forecast.png new file mode 100644 index 00000000..038973ce Binary files /dev/null and b/public/images/jrc-seville-harness-2026/thesis-snap-forecast.png differ diff --git a/public/images/jrc-seville-harness-2026/thesis-spm-conditional-arithmetic.png b/public/images/jrc-seville-harness-2026/thesis-spm-conditional-arithmetic.png new file mode 100644 index 00000000..7fd84852 Binary files /dev/null and b/public/images/jrc-seville-harness-2026/thesis-spm-conditional-arithmetic.png differ diff --git a/public/images/jrc-seville-harness-2026/thesis-spm-conditional-pe-call.png b/public/images/jrc-seville-harness-2026/thesis-spm-conditional-pe-call.png new file mode 100644 index 00000000..7a2940fa Binary files /dev/null and b/public/images/jrc-seville-harness-2026/thesis-spm-conditional-pe-call.png differ diff --git a/public/images/jrc-seville-harness-2026/thesis-spm-conditional-top.png b/public/images/jrc-seville-harness-2026/thesis-spm-conditional-top.png new file mode 100644 index 00000000..2e578138 Binary files /dev/null and b/public/images/jrc-seville-harness-2026/thesis-spm-conditional-top.png differ diff --git a/public/images/jrc-seville-harness-2026/thesis-stronger-start-spm.png b/public/images/jrc-seville-harness-2026/thesis-stronger-start-spm.png new file mode 100644 index 00000000..de6c32b6 Binary files /dev/null and b/public/images/jrc-seville-harness-2026/thesis-stronger-start-spm.png differ diff --git a/slideshows/jrc-seville-harness-2026/builds.ts b/slideshows/jrc-seville-harness-2026/builds.ts new file mode 100644 index 00000000..8071bef3 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/builds.ts @@ -0,0 +1,8 @@ +// How many builds each multi-build slide has. This file holds plain data, so the server reads the numbers when it +// counts the deck's steps; a number exported from a client component reaches the server as a reference, not a value. +import { walkthrough } from './text'; + +/** One build per caption in text.walkthrough.steps. */ +export const WALKTHROUGH_BUILDS = walkthrough.steps.length; +/** The models alone, then with the tool. */ +export const POLICYBENCH_BUILDS = 2; diff --git a/slideshows/jrc-seville-harness-2026/config.ts b/slideshows/jrc-seville-harness-2026/config.ts new file mode 100644 index 00000000..5cb72c63 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/config.ts @@ -0,0 +1,85 @@ +import { SlideshowConfig } from '@/lib/types'; +import { speakers } from '@/lib/speakers'; +import CoverSlide from './slides/CoverSlide'; +import NeedsSlide from './slides/NeedsSlide'; +import AiChangeSlide from './slides/AiChangeSlide'; +import HarnessSlide from './slides/HarnessSlide'; +import { + CommunicationSection, + DataSection, + PredictionsSection, + ResponsesSection, + RulesSection, +} from './slides/SectionSlide'; +import EncoderWalkthroughSlide from './slides/EncoderWalkthroughSlide'; +import LadderSlide from './slides/LadderSlide'; +import SurveysSlide from './slides/SurveysSlide'; +import TargetsSlide from './slides/TargetsSlide'; +import DashboardSlide from './slides/DashboardSlide'; +import CboSlide from './slides/CboSlide'; +import BeliefsSlide from './slides/BeliefsSlide'; +import SsppSlide from './slides/SsppSlide'; +import MacroSlide from './slides/MacroSlide'; +import PredictSlide from './slides/PredictSlide'; +import ForecastSlide from './slides/ForecastSlide'; +import { ThesisBill, ThesisConditional, ThesisUnconditional } from './slides/ThesisSlides'; +import PolicyBenchNonzeroSlide from './slides/PolicyBenchNonzeroSlide'; +import NextSkillsSlide from './slides/NextSkillsSlide'; +import MillionsSlide from './slides/MillionsSlide'; +import AbundanceSlide from './slides/AbundanceSlide'; +import DeliberationSlide from './slides/DeliberationSlide'; +import EndSlide from './slides/EndSlide'; +import { POLICYBENCH_BUILDS, WALKTHROUGH_BUILDS } from './builds'; +import { cover } from './text'; + +/** + * Max Ghenis at the JRC workshop in Seville, 23 November 2026: what a policymaker needs (rules, data, responses, + * predictions, communication), how AI changes that, the five pieces again as what AI needs to hill-climb on, then one + * section per piece; PolicyBench, alone and then with a tool (two builds of one slide), opens the fifth, and a slide on + * what AI should get right next follows it. Three slides on abundant policy analysis and a thank-you slide close the + * deck. Most slides are headings, icons, charts or screenshots. Their words come from text.ts; chart tick labels and a + * few other strings sit in the slide files. + */ +export const jrcSevilleHarness2026Config: SlideshowConfig = { + id: 'jrc-seville-harness-2026', + title: cover.title, + description: + 'Max Ghenis at the JRC workshop "Building blocks for future economic analysis and modelling: the role of AI": evals for the rules, data, responses, predictions and communication behind policy analysis.', + date: '2026-11-23', + location: 'JRC workshop, Seville', + footerText: `${cover.title} · Seville · 23 November 2026`, + partnerLogo: { src: '/logos/axiom-foundation-white.svg', alt: 'Axiom Foundation' }, + speakers: [{ ...speakers['max-ghenis'], title: 'PolicyEngine and the Axiom Foundation' }], + clickerKeys: true, + slides: [ + CoverSlide, + NeedsSlide, + AiChangeSlide, + HarnessSlide, + RulesSection, + { component: EncoderWalkthroughSlide, builds: WALKTHROUGH_BUILDS }, + LadderSlide, + DataSection, + SurveysSlide, + TargetsSlide, + DashboardSlide, + ResponsesSection, + CboSlide, + BeliefsSlide, + SsppSlide, + MacroSlide, + PredictionsSection, + PredictSlide, + ForecastSlide, + ThesisUnconditional, + ThesisConditional, + ThesisBill, + CommunicationSection, + { component: PolicyBenchNonzeroSlide, builds: POLICYBENCH_BUILDS }, + NextSkillsSlide, + MillionsSlide, + AbundanceSlide, + DeliberationSlide, + EndSlide, + ], +}; diff --git a/slideshows/jrc-seville-harness-2026/deck.tsx b/slideshows/jrc-seville-harness-2026/deck.tsx new file mode 100644 index 00000000..23007f0f --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/deck.tsx @@ -0,0 +1,222 @@ +'use client'; + +import { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react'; +import { useSearchParams } from 'next/navigation'; +import Slide from '@/components/core/Slide'; +import SlideHeader from '@/components/layout/SlideHeader'; + +/** + * Shared pieces for this deck. Sizes are in vh so a slide fits a laptop and a projector alike, as in the APPAM + * deck's frame. Slides take their words from text.ts, apart from a few labels that a slide file defines for itself. + */ + +/** + * On a slide built on Frame, `?bare=1` renders the body alone, with no title, sources or footer, so a picture of it + * can sit in another deck's template under that template's own title. Slides that do not use Frame ignore it. It has + * no effect on normal viewing or export. + */ +/** + * The bare body's height, about 465 px at 810: close to the height a body has under a title (about 493 px under a + * one-line title, about 451 px under a two-line one), so its type stays close to its size. + */ +export const BARE_BODY_HEIGHT = '57.4vh'; + +export function useBare(): boolean { + return useSearchParams()?.get('bare') === '1'; +} + +/** + * `&bzoom=Z` (1 to 1.6) zooms the bare body by Z, so its type is Z times larger, in a box of the same rendered size: + * CSS zoom scales the height given in vh, so that is divided by Z, while a percentage width is left as it is. + */ +function useBareZoom(): number { + const z = parseFloat(useSearchParams()?.get('bzoom') ?? '1'); + return Number.isFinite(z) ? Math.min(Math.max(z, 1), 1.6) : 1; +} + +type BareReport = { view: number[]; box: number[]; spill: number; minPx: number; minSvgPx: number; images: number }; + +/** + * A report on `root`: the smallest rendered type inside it (HTML and SVG text apart), how far anything reaches past + * its box, the window's and the box's sizes, and the image count. + */ +function measureBare(root: HTMLElement): BareReport { + const box = root.getBoundingClientRect(); + let spill = 0; + let minPx = Infinity; + let minSvgPx = Infinity; + root.querySelectorAll('*').forEach((el) => { + const r = el.getBoundingClientRect(); + if (r.width === 0 || r.height === 0) return; + spill = Math.max(spill, r.bottom - box.bottom, r.right - box.right, box.top - r.top, box.left - r.left); + const ownText = Array.from(el.childNodes).some((n) => n.nodeType === Node.TEXT_NODE && n.textContent?.trim()); + if (!ownText) return; + if (el instanceof SVGTextContentElement) { + minSvgPx = Math.min(minSvgPx, r.height / 1.2); + } else { + const zoom = (el as HTMLElement & { currentCSSZoom?: number }).currentCSSZoom ?? 1; + minPx = Math.min(minPx, parseFloat(getComputedStyle(el).fontSize) * zoom); + } + }); + const round = (x: number) => (Number.isFinite(x) ? Math.round(x * 10) / 10 : -1); + return { view: [window.innerWidth, window.innerHeight], box: [round(box.width), round(box.height)], spill: round(spill), minPx: round(minPx), minSvgPx: round(minSvgPx), images: root.querySelectorAll('img').length }; +} + +/** + * The bare body's box. With `&measure=1` it also writes a JSON report into a hidden element after layout (how far + * anything reaches past the box, in CSS px, and the smallest type), for a script that loads the page to read. + */ +export function BareBody({ children, className = '', style }: { children: ReactNode; className?: string; style?: CSSProperties }) { + const zoom = useBareZoom(); + const measure = useSearchParams()?.get('measure') === '1'; + const ref = useRef(null); + const [report, setReport] = useState(null); + useEffect(() => { + if (!measure) return; + const timer = setTimeout(() => ref.current && setReport(measureBare(ref.current)), 400); + return () => clearTimeout(timer); + }, [measure]); + return ( + <> +
+ {children} +
+ {report && ( + + )} + + ); +} + +export function Frame({ + title, + kicker, + sources, + children, +}: { + title: string; + kicker?: string; + sources?: ReactNode; + children: ReactNode; +}) { + const bare = useBare(); + if (bare) { + return ( + + + {children} + + + ); + } + return ( + +
+ + {kicker &&
{kicker}
} +

+ {title} +

+
+
+ {children} +
+ {sources && {sources}} +
+
+ ); +} + +/** Small print at the foot of a slide: sources, definitions and the qualifications a claim needs. */ +export function Sources({ children }: { children: ReactNode }) { + return ( +
+ {children} +
+ ); +} + +/** A full-bleed statement, for the turns in the talk. */ +export function Statement({ title, sub, kicker }: { title: string; sub?: string; kicker?: string }) { + return ( + +
+ {kicker && ( +
+ {kicker} +
+ )} +

+ {title} +

+
+ {sub && ( +

+ {sub} +

+ )} +
+ + ); +} + +/** A card with the deck's teal left rule; `tone` swaps the rule to amber or gray. */ +export function Card({ + children, + tone = 'teal', + tag, + className = '', +}: { + children: ReactNode; + tone?: 'teal' | 'amber' | 'gray'; + tag?: string; + className?: string; +}) { + const rule = tone === 'amber' ? 'var(--pe-amber)' : tone === 'gray' ? 'var(--color-gray-300)' : undefined; + return ( +
+ {tag && ( +
+ {tag} +
+ )} + {children} +
+ ); +} + +/** A row of steps joined by arrows. */ +export function Steps({ steps, active }: { steps: string[]; active?: number }) { + return ( +
+ {steps.map((step, i) => ( +
+
+ {step} +
+ {i < steps.length - 1 && ( + + → + + )} +
+ ))} +
+ ); +} diff --git a/slideshows/jrc-seville-harness-2026/slides/AbundanceSlide.tsx b/slideshows/jrc-seville-harness-2026/slides/AbundanceSlide.tsx new file mode 100644 index 00000000..21ee37c3 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/AbundanceSlide.tsx @@ -0,0 +1,9 @@ +'use client'; + +import PieceCards from './PieceCards'; +import { abundance } from '../text'; + +/** What abundant policy analysis could look like, one card per piece of the stack, in NeedsSlide's format. */ +export default function AbundanceSlide() { + return ; +} diff --git a/slideshows/jrc-seville-harness-2026/slides/AiChangeSlide.tsx b/slideshows/jrc-seville-harness-2026/slides/AiChangeSlide.tsx new file mode 100644 index 00000000..68261c03 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/AiChangeSlide.tsx @@ -0,0 +1,24 @@ +'use client'; + +import { Frame } from '../deck'; +import { aiChange } from '../text'; + +/** Three points on how AI changes the analyst's job, each with a large numeral. */ +export default function AiChangeSlide() { + return ( + +
    + {aiChange.points.map((point, i) => ( +
  1. + + {i + 1} + +

    + {point} +

    +
  2. + ))} +
+ + ); +} diff --git a/slideshows/jrc-seville-harness-2026/slides/BeliefsSlide.data.json b/slideshows/jrc-seville-harness-2026/slides/BeliefsSlide.data.json new file mode 100644 index 00000000..c71d3b40 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/BeliefsSlide.data.json @@ -0,0 +1,142 @@ +{ + "source": "github.com/PolicyEngine/llm-econ-beliefs at commit d177a3423d95cc9c3d2b64c100894e63e2029d6f (main, 2026-11-16): results/-elasticities-batch15/summary.csv, column pooled_point_estimate, row quantity_id tax.elasticity_of_taxable_income.top_earners (the per-model files the dashboard reads; one experiment per model, 15 successful runs each). Literature range from paper/tables/benchmark-comparison-labor-tax.csv line 3 at the same commit.", + "read": "2026-11-22", + "quantity": "tax.elasticity_of_taxable_income.top_earners", + "literatureRange": [ + 0.25, + 0.5 + ], + "check": { + "models": 31, + "insideRange": 28, + "minCenter": 0.3347, + "maxCenter": 0.554, + "matchesCsv": "28 / 31, 0.335, 0.554" + }, + "models": [ + { + "model": "claude-opus-5", + "center": 0.3347 + }, + { + "model": "gemini-3.1-pro-preview", + "center": 0.35 + }, + { + "model": "gemini-3.5-flash", + "center": 0.3553 + }, + { + "model": "gpt-5.5", + "center": 0.3667 + }, + { + "model": "kimi-k3", + "center": 0.37 + }, + { + "model": "qwen3.8-max", + "center": 0.3713 + }, + { + "model": "gpt-5.6-luna", + "center": 0.3733 + }, + { + "model": "claude-opus-4.8", + "center": 0.3833 + }, + { + "model": "gemini-3.1-flash-lite-preview", + "center": 0.3867 + }, + { + "model": "claude-opus-4.7", + "center": 0.4 + }, + { + "model": "gemini-3-flash-preview", + "center": 0.4 + }, + { + "model": "grok-4.1-fast", + "center": 0.4 + }, + { + "model": "grok-4.5", + "center": 0.41 + }, + { + "model": "gpt-5.4", + "center": 0.4167 + }, + { + "model": "gemini-3.6-flash", + "center": 0.42 + }, + { + "model": "gpt-5.4-mini", + "center": 0.43 + }, + { + "model": "gpt-5.6-sol", + "center": 0.43 + }, + { + "model": "claude-fable-5", + "center": 0.4367 + }, + { + "model": "grok-4.3", + "center": 0.4367 + }, + { + "model": "inkling", + "center": 0.4367 + }, + { + "model": "minimax-m3", + "center": 0.4367 + }, + { + "model": "claude-sonnet-5", + "center": 0.4733 + }, + { + "model": "gpt-5.6-terra", + "center": 0.49 + }, + { + "model": "deepseek-v4-pro", + "center": 0.4933 + }, + { + "model": "glm-5.2", + "center": 0.4967 + }, + { + "model": "claude-sonnet-4.6", + "center": 0.5 + }, + { + "model": "grok-4.20", + "center": 0.5 + }, + { + "model": "kimi-k2.6", + "center": 0.5 + }, + { + "model": "claude-haiku-4.5", + "center": 0.5073 + }, + { + "model": "gpt-5.4-nano", + "center": 0.552 + }, + { + "model": "qwen-3.7-max", + "center": 0.554 + } + ] +} \ No newline at end of file diff --git a/slideshows/jrc-seville-harness-2026/slides/BeliefsSlide.tsx b/slideshows/jrc-seville-harness-2026/slides/BeliefsSlide.tsx new file mode 100644 index 00000000..d7537e4a --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/BeliefsSlide.tsx @@ -0,0 +1,157 @@ +'use client'; + +// Strings defined in this file (all on the chart; the title and "Our literature band" come from text.ts): +// Y_TITLE "Elasticity of taxable income, high-income US taxpayers" (value-axis title, above the axis) +// X_TITLE "Each dot marks one AI model’s average point estimate over 15 runs, from lowest to highest" (under the dots) +// band ": 0.25 to 0.50" (range read from the data) and BAND_SOURCE +// "We drew on Gruber and Saez (2002) and Saez, Slemrod and Giertz (2012)" (the band is ours; these papers informed it) +// models "Claude Opus 5", "GPT-5.6 Sol", "Qwen 3.7 Max" (the display names policyengine.org/ai-beliefs gives these +// data ids, read 22 Nov 2026), below or to the right of their dots +// ticks 0.2 to 0.6 +// aria the chart's aria-label, built from the data (not shown on screen) +import { Frame } from '../deck'; +import { beliefs } from '../text'; +import data from './BeliefsSlide.data.json'; + +/** + * Each of the 31 AI models' pooled central estimate of the elasticity of taxable income of top earners, one dot per + * model, sorted from lowest to highest, over our rough literature band, 0.25 to 0.5. The slide is the title and this + * chart alone; text.beliefs.footnotes holds the sources. Data: BeliefsSlide.data.json (its `source` field). + */ + +const [LO, HI] = data.literatureRange as [number, number]; +// Sorted by estimate; ties keep the data file's order, so each labelled name sits on its own dot. +const models = [...data.models].sort((a, b) => a.center - b.center); +const inside = models.filter((m) => m.center >= LO && m.center <= HI).length; +// text.beliefs.chartCaption says "28 of 31"; the data drawn must agree. +if (models.length !== 31 || inside !== 28) { + throw new Error(`beliefs chart: expected 28 of 31 centers in range, found ${inside} of ${models.length}`); +} + +// The viewBox matches the chart's box under a one-line title at 1440 x 810 (1312 x ~484 px: the body less this +// slide's 0.5vh of padding above and below), so a unit is a pixel there; in the bare view the box is 1312 x ~457 and +// the chart draws at about 0.94. +const WIDTH = 1312; +const HEIGHT = 484; +const LEFT = 64; +const DOTS_RIGHT = 175; // room right of the last dot for its label +const TOP = 50; +const BOTTOM = 52; +const MIN = 0.2; +const MAX = 0.6; +const TICKS = [0.2, 0.3, 0.4, 0.5, 0.6]; +const plotBottom = HEIGHT - BOTTOM; +const COL = (WIDTH - LEFT - DOTS_RIGHT) / models.length; +const R = 9; +const y = (v: number) => plotBottom - ((v - MIN) / (MAX - MIN)) * (plotBottom - TOP); +const x = (i: number) => LEFT + i * COL + COL / 2; +const fmt = (v: number) => v.toFixed(2); + +const Y_TITLE = 'Elasticity of taxable income, high-income US taxpayers'; +const X_TITLE = 'Each dot marks one AI model’s average point estimate over 15 runs, from lowest to highest'; +const BAND_LABEL = `${beliefs.bandLabel}: ${fmt(LO)} to ${fmt(HI)}`; +const BAND_SOURCE = 'We drew on Gruber and Saez (2002) and Saez, Slemrod and Giertz (2012)'; +const ARIA = `${models.length} AI models' central estimates of the elasticity of taxable income for high-income US taxpayers, from ${fmt(models[0].center)} to ${fmt(models[models.length - 1].center)}; ${inside} of ${models.length} fall inside our literature band, ${fmt(LO)} to ${fmt(HI)}.`; + +/** + * Models named on the chart: the lowest, one in the middle and the highest. `place` sets where the name sits: + * below the dot (with a short leader) or to its right. + */ +const LABELLED: { model: string; name: string; place: 'below' | 'belowStart' | 'right' }[] = [ + { model: 'claude-opus-5', name: 'Claude Opus 5', place: 'belowStart' }, + { model: 'gpt-5.6-sol', name: 'GPT-5.6 Sol', place: 'below' }, + { model: 'qwen-3.7-max', name: 'Qwen 3.7 Max', place: 'right' }, +]; +const labelled = LABELLED.map(({ model, name, place }) => { + const i = models.findIndex((m) => m.model === model); + if (i < 0) throw new Error(`beliefs chart: no model ${model} in the data`); + return { model, name, place, i, cx: x(i), cy: y(models[i].center) }; +}); + +const LABEL_SIZE = 23; +const DROP = 56; // baseline of a "below" name under its dot's center + +function ModelLabel({ name, place, cx, cy }: (typeof labelled)[number]) { + const text = { fontSize: LABEL_SIZE, fontWeight: 600, fill: 'var(--pe-dark)' } as const; + if (place === 'right') { + return ( + + {name} + + ); + } + return ( + + + + {name} + + + ); +} + +function BeliefsChart() { + const named = new Set(labelled.map((l) => l.i)); + return ( + + {/* Value axis: title above, ticks to the left */} + + {Y_TITLE} + + + {TICKS.map((tick) => ( + + + + {tick.toFixed(1)} + + + ))} + + {/* Literature band, named in its empty lower-right corner */} + + + + + {BAND_LABEL} + + + {BAND_SOURCE} + + + {/* One dot per model, lowest on the left; amber outside the band; named ones ringed */} + {models.map((m, i) => { + const inRange = m.center >= LO && m.center <= HI; + return ( + + ); + })} + {labelled.map((l) => ( + + ))} + + + + {X_TITLE} + + + ); +} + +export default function BeliefsSlide() { + return ( + +
+ +
+ + ); +} diff --git a/slideshows/jrc-seville-harness-2026/slides/CboSlide.tsx b/slideshows/jrc-seville-harness-2026/slides/CboSlide.tsx new file mode 100644 index 00000000..63e56651 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/CboSlide.tsx @@ -0,0 +1,18 @@ +'use client'; + +import Shot from './Shot'; +import { Frame } from '../deck'; +import { cbo } from '../text'; + +/** + * Responses, slide 1: CBO's 2012 Table 1, the labor-supply elasticities our US model starts from, as the table alone. + */ +const SHOT = { src: '/images/jrc-seville-harness-2026/cbo-2012-table-1.png', width: 2887, height: 1822 }; + +export default function CboSlide() { + return ( + + + + ); +} diff --git a/slideshows/jrc-seville-harness-2026/slides/CoverSlide.tsx b/slideshows/jrc-seville-harness-2026/slides/CoverSlide.tsx new file mode 100644 index 00000000..9e696265 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/CoverSlide.tsx @@ -0,0 +1,35 @@ +'use client'; + +import Image from '@/components/core/BasePathImage'; +import Slide from '@/components/core/Slide'; +import { speakers } from '@/lib/speakers'; +import { cover } from '../text'; + +/** + * The cover, in markup of its own rather than the shared cover template: the template sets the event line in title + * case (CSS `capitalize`), which would turn the workshop's name into "Building Blocks For Future…". + */ +export default function CoverSlide() { + const max = speakers['max-ghenis']; + const { name, affiliation, event } = cover; + return ( + +
+
+

{cover.title}

+

{cover.subtitle}

+
+
+ {name} +
+

{name}

+

{affiliation}

+
+
+

{event[0]}

+

{event[1]}

+
+
+ + ); +} diff --git a/slideshows/jrc-seville-harness-2026/slides/DashboardSlide.tsx b/slideshows/jrc-seville-harness-2026/slides/DashboardSlide.tsx new file mode 100644 index 00000000..5578ec69 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/DashboardSlide.tsx @@ -0,0 +1,19 @@ +'use client'; + +import Shot from './Shot'; +import { Frame } from '../deck'; +import { dashboard } from '../text'; + +/** The public calibration dashboard's calibration map, alone. */ +// The map is sized by weighted target error, so it shows where the release misses its targets. The screenshot was +// taken in a 1640x700 CSS window so the map is wide enough for a 1312x465 body. It hides the page's one line that +// names the parent build by an internal id. +const MAP = { src: '/images/jrc-seville-harness-2026/dashboard-calibration-error-map.png', width: 2708, height: 1084 }; + +export default function DashboardSlide() { + return ( + + + + ); +} diff --git a/slideshows/jrc-seville-harness-2026/slides/DeliberationSlide.tsx b/slideshows/jrc-seville-harness-2026/slides/DeliberationSlide.tsx new file mode 100644 index 00000000..fe41ebd8 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/DeliberationSlide.tsx @@ -0,0 +1,12 @@ +'use client'; + +import { Statement } from '../deck'; +import { deliberation } from '../text'; + +/** + * The last turn: abundant analysis still needs a democratic answer about goals. Title only: text.deliberation.lead is + * not rendered. + */ +export default function DeliberationSlide() { + return ; +} diff --git a/slideshows/jrc-seville-harness-2026/slides/EncoderWalkthroughSlide.test.tsx b/slideshows/jrc-seville-harness-2026/slides/EncoderWalkthroughSlide.test.tsx new file mode 100644 index 00000000..33054ad3 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/EncoderWalkthroughSlide.test.tsx @@ -0,0 +1,144 @@ +import { act, useMemo, useSyncExternalStore } from 'react'; +import { createRoot, type Root } from 'react-dom/client'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import SlideshowViewer from '@/components/core/SlideshowViewer'; +import type { SlideshowConfig } from '@/lib/types'; +import { WALKTHROUGH_BUILDS } from '../builds'; +import { walkthrough } from '../text'; +import EncoderWalkthroughSlide, { ANNOUNCE_MS } from './EncoderWalkthroughSlide'; + +// Next's app router mirrors window.history.replaceState into useSearchParams; reproduce that, so the viewer sees its +// own URL writes as it does in the browser. +const locationStore = vi.hoisted(() => { + const listeners = new Set<() => void>(); + return { + subscribe(listener: () => void) { + listeners.add(listener); + return () => listeners.delete(listener); + }, + notify() { + listeners.forEach((listener) => listener()); + }, + }; +}); + +vi.mock('next/navigation', () => ({ + useSearchParams() { + const search = useSyncExternalStore(locationStore.subscribe, () => window.location.search); + return useMemo(() => new URLSearchParams(search), [search]); + }, +})); + +const Blank = () => null; + +// A blank slide, then the walkthrough: the walkthrough mounts as a neighbour before the viewer reaches it. +const deck: SlideshowConfig = { + id: 'walkthrough-test', + title: 'Walkthrough test', + description: 'The walkthrough slide in a mounted viewer', + date: '2026-11-23', + slides: [Blank, { component: EncoderWalkthroughSlide, builds: WALKTHROUGH_BUILDS }], +}; + +const originalReplaceState = window.history.replaceState; +let container: HTMLDivElement; +let root: Root; + +const region = () => container.querySelector('[aria-live="polite"]'); +const heading = () => region()?.querySelector('h2')?.textContent ?? null; +const body = () => region()?.querySelector('p')?.textContent ?? null; +const figure = () => container.querySelector('[data-walkthrough-figure]')?.getAttribute('data-walkthrough-figure') ?? null; + +async function press(key: string) { + await act(async () => { + window.dispatchEvent(new KeyboardEvent('keydown', { key })); + }); +} + +async function wait(ms: number) { + await act(async () => { + vi.advanceTimersByTime(ms); + }); +} + +beforeEach(async () => { + (globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true; + vi.useFakeTimers(); + vi.stubGlobal( + 'ResizeObserver', + class { + observe() {} + disconnect() {} + }, + ); + window.history.replaceState = function (...args) { + originalReplaceState.apply(window.history, args); + locationStore.notify(); + }; + container = document.createElement('div'); + document.body.appendChild(container); + root = createRoot(container); + originalReplaceState.call(window.history, null, '', '/slides/walkthrough-test'); + await act(async () => { + root.render(); + }); +}); + +afterEach(() => { + act(() => root.unmount()); + container.remove(); + window.history.replaceState = originalReplaceState; + vi.unstubAllGlobals(); + vi.useRealTimers(); +}); + +describe('the walkthrough’s live region in a mounted viewer', () => { + it('is in the page, polite and empty, before the viewer reaches the slide', async () => { + await wait(ANNOUNCE_MS * 4); + expect(region()).not.toBeNull(); + expect(region()?.getAttribute('aria-atomic')).toBe('true'); + expect(heading()).toBe(''); + expect(body()).toBe(''); + }); + + it('writes the first caption after the slide comes up, not with it', async () => { + await press('ArrowRight'); + expect(heading()).toBe(''); + await wait(ANNOUNCE_MS); + expect(heading()).toBe(walkthrough.steps[0].title); + expect(body()).toBe(walkthrough.steps[0].about); + }); + + it('writes each build’s caption as the viewer steps through the eight builds', async () => { + await press('ArrowRight'); + for (const [i, step] of walkthrough.steps.entries()) { + if (i > 0) await press('ArrowRight'); + await wait(ANNOUNCE_MS); + expect(region()?.getAttribute('data-walkthrough-caption')).toBe(String(i + 1)); + expect(heading()).toBe(step.title); + expect(body()).toBe(step.about); + expect(figure()).toBe(step.figure ?? null); + } + }); + + it('empties the region when the viewer leaves the slide, and fills it again on return', async () => { + await press('ArrowRight'); + await wait(ANNOUNCE_MS); + expect(heading()).toBe(walkthrough.steps[0].title); + await press('ArrowLeft'); + expect(heading()).toBe(''); + await press('ArrowRight'); + await wait(ANNOUNCE_MS); + expect(heading()).toBe(walkthrough.steps[0].title); + }); + + it('keeps the frame and the figure out of the accessibility tree', async () => { + await press('ArrowRight'); + await wait(ANNOUNCE_MS); + expect(container.querySelector('iframe')?.getAttribute('aria-hidden')).toBe('true'); + for (let i = 1; i < 4; i += 1) await press('ArrowRight'); + await wait(ANNOUNCE_MS); + expect(figure()).toBe('gates'); + expect(container.querySelector('[data-walkthrough-figure]')?.getAttribute('aria-hidden')).toBe('true'); + }); +}); diff --git a/slideshows/jrc-seville-harness-2026/slides/EncoderWalkthroughSlide.tsx b/slideshows/jrc-seville-harness-2026/slides/EncoderWalkthroughSlide.tsx new file mode 100644 index 00000000..b0413373 --- /dev/null +++ b/slideshows/jrc-seville-harness-2026/slides/EncoderWalkthroughSlide.tsx @@ -0,0 +1,286 @@ +'use client'; + +// The encoder walkthrough: one build per caption in text.walkthrough.steps. +// +// Most builds show one step of axiom.org's walkthrough in a frame (the caption's `n`). A caption with a `figure` shows +// a figure this deck draws instead (slides/WalkthroughFigures.tsx), adapted from axiom.org's drawing of that step. +// +// The slide prints its title, the label "Illustration using 7 U.S.C. § 2017(a)" and the card. Our caption for the +// build, title and explanation, is visually hidden text in a polite live region. The slide writes it there once the +// slide is on screen and again at each build, so a screen reader announces it; the frame and the figures are hidden +// from screen readers. The caption axiom.org sends is +// never shown. data-walkthrough-site on the card says whether the frame's picture belongs to the caption: "match", +// "differs" (the site reports another step, or a title other than the caption's `site`), "waiting" or "figure". The +// slide does not act on that value; it is there for a check that loads the page. +// +// data-walkthrough-caption is the build; data-walkthrough-want is the axiom.org step it shows. +import { type CSSProperties, type RefObject, useCallback, useEffect, useRef, useState } from 'react'; +import { useSearchParams } from 'next/navigation'; +import { useSlideshowContext } from '@/components/core/SlideshowContext'; +import { Frame, useBare } from '../deck'; +import { WALKTHROUGH_BUILDS } from '../builds'; +import { walkthrough } from '../text'; +import WalkthroughFigure from './WalkthroughFigures'; + +/** How many steps axiom.org's walkthrough has. */ +const SITE_STEPS = 8; + +/** + * The frame protocol of axiom.org's embeddable walkthrough (WALKTHROUGH_SRC), as postMessage data: + * in { type: "axiom-walkthrough:go", step, play } step 0 is the start, 1 to 8 the rest of that step; + * play moves there as a clip, otherwise it cuts + * out { type: "axiom-walkthrough:ready" } the frame now listens + * out { type: "axiom-walkthrough:step", step, total, title, about } on load and on each change of step + */ +const WALKTHROUGH_ORIGIN = (process.env.NEXT_PUBLIC_WALKTHROUGH_ORIGIN ?? 'https://axiom.org').replace(/\/$/, ''); +const WALKTHROUGH_SRC = `${WALKTHROUGH_ORIGIN}/present/encoder?embed=1`; +const MSG = 'axiom-walkthrough'; +/** How long a caption waits before it enters the live region, so the region is in the page, empty, first. */ +export const ANNOUNCE_MS = 150; +/** How long the frame has to say anything before the card shows where to find the walkthrough. */ +const ANSWER_MS = 6000; +/** + * The width, in CSS px, of the window axiom.org lays its picture out in: 937 / 0.72, about 1,301. axiom.org's stage + * stops growing near this width, so a wider window leaves its picture in the card's top-left corner. The frame keeps + * this window at every card size and scales it to the card's measured width. + */ +const FRAME_WIDTH = 937 / 0.72; +/** + * The card's shape, 937 to 435 (width to height), as large as the body allows. FRAME_RATIO sits a little above + * CARD_RATIO, so the frame's floor stays just under the card and never pokes out of it. + */ +const CARD_RATIO = 937 / 435; +const FRAME_RATIO = 2.16; + +/** + * How far to move the frame up (+) or down (-) at a step, in percent of its height, where the site's picture sits off + * centre in the card. At step 5 the line under the code card ("the rule quotes the words it encodes") straddles the + * card's bottom edge unless the frame moves up a little. + */ +const SHIFT: Record = { 5: 0.6 }; + +const NOTICE = 'Walkthrough: axiom.org/slides/encoder-walkthrough'; + +type WalkthroughStep = { step: number; total: number; title: string; about: string }; + +/** Our caption for a build (1 to WALKTHROUGH_BUILDS), with the step of axiom.org's walkthrough it shows (n). */ +export function captionFor(build: number) { + return walkthrough.steps[build - 1]; +} + +/** + * Drive the frame from the deck's build. `up` is false while the slide is mounted but not on screen; then the frame + * goes back to the start, so the next visit plays from there. `still` (export and bare captures) cuts to each step's + * rest instead of playing to it. `live` is false on a build that shows a figure in place of the frame: the frame then + * stays where it is, and the next live build cuts to its step. + */ +function useWalkthrough({ step, up, still, live }: { step: number; up: boolean; still: boolean; live: boolean }) { + const frameRef = useRef(null); + const [now, setNow] = useState(null); + const [ready, setReady] = useState(false); + const [answered, setAnswered] = useState(false); + const [late, setLate] = useState(false); + const previous = useRef(undefined); + + const send = useCallback((msg: Record) => { + frameRef.current?.contentWindow?.postMessage(msg, WALKTHROUGH_ORIGIN); + }, []); + + useEffect(() => { + const onMessage = (e: MessageEvent) => { + if (e.origin !== WALKTHROUGH_ORIGIN || e.source !== frameRef.current?.contentWindow) return; + const d = e.data as ({ type?: unknown } & Partial) | null; + if (!d || typeof d.type !== 'string' || !d.type.startsWith(`${MSG}:`)) return; + setAnswered(true); + if (d.type === `${MSG}:ready`) setReady(true); + else if (d.type === `${MSG}:step` && typeof d.step === 'number' && typeof d.title === 'string') { + setNow({ step: d.step, total: d.total ?? SITE_STEPS, title: d.title, about: d.about ?? '' }); + } + }; + window.addEventListener('message', onMessage); + const timer = setTimeout(() => setLate(true), ANSWER_MS); + return () => { + window.removeEventListener('message', onMessage); + clearTimeout(timer); + }; + }, []); + + useEffect(() => { + if (!ready) return; + if (!up) { + if (previous.current !== undefined) send({ type: `${MSG}:go`, step: 0, play: false }); + previous.current = undefined; + return; + } + if (!live) { + previous.current = undefined; + return; + } + // Unless `still`, a move to axiom.org's next step plays as a clip (the first build plays from the start); any + // other move cuts. A build that shows a figure clears `previous` above, so the frame build after it cuts to its + // step and the clip never plays through the step the figure stands for. + const last = previous.current; + const play = !still && (last === undefined ? step === 1 : step === last + 1); + send({ type: `${MSG}:go`, step, play }); + previous.current = step; + }, [ready, up, step, still, live, send]); + + return { frameRef, now, failed: late && !answered, state: late && !answered ? 'failed' : ready ? 'ready' : answered ? 'answered' : 'waiting' }; +} + +/** The frame's height and transform for a card of size `box`: FRAME_WIDTH wide, scaled to the card's width. */ +function geometry(box: { w: number; h: number }, ratio: number, shift: number) { + const scale = box.w / FRAME_WIDTH; + return { + height: `${Math.max(box.h, box.w / ratio) / scale}px`, + transform: `scale(${scale}) translateY(${-50 - shift}%)`, + }; +} + +/** + * The frame, laid out FRAME_WIDTH wide (about 1,300 px, a desktop window) and scaled to the card's width, so the site + * lays its picture out the same way at every card size. A ResizeObserver measures the card, and `geometry` turns its + * size into the frame's height and scale. + * + * Scaled, the frame's height never drops below the card's width over `ratio`; the frame is centred on the card and + * cropped by it. A headless capture lays the page out in a shorter window and grows it to full height just before the + * screenshot; with this floor the frame keeps one size through that resize, so the site's picture has no time to fall + * behind. + */ +function ScaledFrame({ + frameRef, + hidden, + ratio, + shift, +}: { + frameRef: RefObject; + hidden: boolean; + ratio: number; + shift: number; +}) { + // The card's size, measured; the frame stays hidden until the first measure, so it never shows at the wrong scale. + const holder = useRef(null); + const [box, setBox] = useState<{ w: number; h: number } | null>(null); + const shape = useRef({ ratio, shift }); + useEffect(() => { + shape.current = { ratio, shift }; + }, [ratio, shift]); + useEffect(() => { + const el = holder.current; + if (!el) return; + const observer = new ResizeObserver(([entry]) => { + const next = { w: entry.contentRect.width, h: entry.contentRect.height }; + // Apply the new size to the frame at once, inside the observer's callback, which runs before the browser paints: + // a headless capture grows the window just before its screenshot, and a React render scheduled from here could + // land a frame late, leaving the frame at the old, smaller scale. React's own render below sets the same values. + const frame = frameRef.current; + if (frame && next.w > 0) { + const g = geometry(next, shape.current.ratio, shape.current.shift); + frame.style.height = g.height; + frame.style.transform = g.transform; + } + setBox(next); + }); + observer.observe(el); + return () => observer.disconnect(); + }, [frameRef]); + const g = box && box.w > 0 ? geometry(box, ratio, shift) : null; + // Before the first measure the frame takes its final shape (FRAME_WIDTH by FRAME_WIDTH / ratio), not a height of zero. + const style: CSSProperties = { + width: `${FRAME_WIDTH}px`, + height: g ? g.height : `${FRAME_WIDTH / ratio}px`, + top: '50%', + transform: g ? g.transform : `translateY(${-50 - shift}%)`, + transformOrigin: '0 0', + visibility: hidden || !box ? 'hidden' : undefined, + }; + return ( +
+