jbmui

VideoPrint

  • UI Bits
  • adjustable

A printed video still on a Paper sheet: a pale 16:9 line sketch, an ink scrub rule with anchor ticks, title and date, and an optional punched link tag.

Sample talk

Video · 4 nov 2025

example.com/watch?v=sample-talk

Install

npx shadcn@latest add @jbm/video-print

Needs the @jbm entry in components.json; see Install once.

Also installs @jbm/tokens, @jbm/scene-geometry, @jbm/paper, @jbm/punched-tag.

Docs

Usage

Video print with an opened link
import { VideoPrint } from "@/jbm/ui/video-print"<VideoPrint  scrub={1}  title="Sample talk"  date="Video · 4 nov 2025"  link="example.com/watch?v=sample-talk"/>
Tie a thread to a scrub tick
import { VideoPrint, videoPrintLayout } from "@/jbm/ui/video-print"import { Hilo } from "@/jbm/ui/hilo" // install @jbm/hilo separatelydeclare const scrub: numberconst at = { x: 1200, y: 300 }const marks = [0.2, 0.45, 0.7]const tick = videoPrintLayout({ marks }, at).marks[1]<div style={{ position: "relative", width: 1920, height: 1080 }}>  <VideoPrint scrub={scrub} marks={marks} title="Sample talk" date="Video · 4 nov 2025" style={{ position: "absolute", left: at.x, top: at.y }} />  <svg viewBox="0 0 1920 1080" style={{ position: "absolute", inset: 0 }}>    <Hilo from={tick} to={{ x: 520, y: 400 }} curve="s" bend={0.5} draw={scrub >= 0.45 ? 1 : 0} />  </svg></div>

API

Stage px
Declared at the documented defaults
Landscape
480 by 394
Vertical
480 by 394
Basis

At the default w 480: 22px padding, a 436 × 245.25 frame, the rule 12px under it, the title 18px under the rule, the date 30px under the title, then 18 + 22px: a 367.25px sheet. With link, the tag straddles the bottom edge and half of it (15.1 × w/480 + the 3px outline) hangs below, plus the 8 × w/480 it settles up from while opened is below 1: 393.35px in all, declared as 394. Every measurement scales with w (sheet height = 0.765 × w); videoPrintLayout().bounds gives the exact box. The tag never extends past the right edge: long URLs end in an ellipsis.

VideoPrintcomponent

A Paper sheet (radius 10, ink edge, paper shadow) carrying a 16:9 frame in pale ink (an opaque 8% ink-on-card tint, identical with or without the sheet, and an ink outline at the shared outline weight, the same as the sheet edge at every w) with a head-and-shoulders line sketch, a pale scrub track whose ink bar advances with scrub, ink ticks at the marks the bar has passed, the title (Geist 700) and date (Geist, Graphite), and, when link is set, a PunchedTag with the URL in Geist Mono hanging over the bottom edge. Composes Paper and PunchedTag unchanged. Controlled; no timers.

PropTypeDefaultDescription
scrubnumberrequiredPlayhead 0–1: how far the ink scrub bar has advanced along the rule. Clamped; NaN is 0.
marksreadonly number[][]Positions 0–1 along the rule. A mark leaves an ink tick once scrub reaches it; its anchor point exists from the start (videoPrintLayout().marks), so a thread can tie on as the tick appears.
titlestringrequiredThe video's title in bold type under the rule; one line, ellipsis when long.
datestringrequiredThe line under the title, usually source and date ("Video · 4 nov 2025").
linkstringnoneA URL set in mono on a punched tag straddling the bottom edge: the sign that this page was opened. One line; a URL longer than the print ends in an ellipsis, so the tag never passes the sheet's right edge. Omit for a print nobody opened.
openednumber10–1: the tag fades in over the first half and settles up 8 × w/480 px into place from just below its resting spot, so it never rises past it or crosses the date line. Only used with link; 0 hides it.
wnumberBASEWidth in stage pixels (default 480). Everything scales with it; the height is 0.765 × w.
sheetbooleantrueDraw the Paper sheet (default). false keeps the same layout, anchors, and still tint without the sheet, for nesting on a Paper you already have.
styleCSSPropertiesnoneInline styles merged onto the outer box, e.g. position and left/top on a stage.

videoPrintLayoutfunction

Where everything on the print sits, so Hilo threads and hands can reach it. Pass the print's stage position as at to get stage coordinates.

ParamTypeDefaultDescription
linkstringnoneThe URL, when the print carries a link tag; only its presence matters here.
wnumberBASEPrint width in stage pixels (default 480); the layout scales with it.
marksreadonly number[][]Positions 0–1 along the scrub rule.
atPt{ x: 0, y: 0 }The print's top-left corner on your stage (default { x: 0, y: 0 }); every returned point is offset by it.

Returns { scale, w, h, pad, frame: { x, y, w, h }, rule: { x, y, w }, titleY, dateY, marks: Pt[], tag: Pt | null, tagX, tagMaxW, bounds: { w, h } }. marks[i] is mark i's point on the rule's centreline; tag is the punched hole's centre (on the sheet's bottom edge), or null without a link; tagMaxW is the tag's widest extent from tagX (it stops a padding short of the sheet's right edge); bounds is the box everything draws in, the sheet plus, with a link, the half of the tag that hangs below it.

VideoPrintPropstype

Props of VideoPrint.

QA checks

  • Drag Scrub from 0 to 1: the ink bar grows from the left edge of the frame, each tick appears exactly when the bar reaches it, and nothing inks ahead of the bar.
  • The frame reads as a pale sketch (tinted fill, ink outline, head circle and shoulder arc), never a solid ink block; compare with the video and puertas board panels.
  • Toggle the link and drag Tag drops in: the mono URL tag straddles the bottom edge, its hole ringed in ink and scaled with the print (PunchedTag scale = w/480), and stays inside the declared bounds; a long URL ends in an ellipsis instead of wrapping or passing the sheet's right edge. At every step of the drop the tag's top edge stays below the date line, and at Half it is opaque.
  • Turn the sheet off: the frame, rule, and type keep their positions (anchors unchanged), and the still keeps exactly the same tint.
  • Check a thread tied to videoPrintLayout().marks lands on the tick centreline, at w 300 and 480.
  • The print uses no vermilion of its own.