{"name":"tokens","entry":"component","title":"Tokens","description":"Cream, ink, and vermilion palette, Geist font stacks and tab-name metrics, radii, the shared ink outline weight, surface shadows and borders, stage safe areas, and a CSS variables string.","category":"Foundations","capabilities":[],"needsRemotion":false,"registryDependencies":[],"install":"npx shadcn@latest add @jbm/tokens","installName":"tokens","page":"https://jbm-ui.bns.studio/c/tokens","registryItem":"https://jbm-ui.bns.studio/r/tokens.json","sourcePath":"registry/jbm/lib/tokens.ts","files":[{"source":"registry/jbm/lib/tokens.ts","target":"src/jbm/lib/tokens.ts","import":"@/jbm/lib/tokens","type":"registry:lib"}],"endpoints":{"markdown":"https://jbm-ui.bns.studio/catalog/tokens.md","json":"https://jbm-ui.bns.studio/catalog/tokens.json"},"snippet":"import { color, font } from \"@/jbm/lib/tokens\"\n\n<div style={{ color: color.ink, background: color.bg, fontFamily: font.sans }} />","api":[{"export":"color","kind":"constant","summary":"Two-colour palette as hex strings: bg (cream canvas), card (raised surface), ink (text), dim (muted text), line (rules and borders), accent (vermilion, the one accent), accent2 (annotations), soft (emphasis on dark), dimOnDark (cream at 62% for muted text on ink), codeBg, and codeGreen."},{"export":"font","kind":"constant","summary":"Font stacks for sans and mono: the host's --font-sans / --font-mono CSS variable when set (for example by next/font), else Geist and Geist Mono, then system fallbacks."},{"export":"sansWidth","kind":"function","summary":"Estimated advance width of a line set in Geist 800 (tab names) or Geist 400 italic (sublabels), from a built-in per-glyph table measured in the browser, so layouts that size tabs match before fonts load and in Remotion. Accented letters measure as their base letter; other non-ASCII glyphs as an average. Kerning is ignored, so it errs slightly wide.","params":[{"name":"text","type":"string","required":true,"default":null,"description":"The line."},{"name":"size","type":"number","required":true,"default":null,"description":"Font size in the units you want back."},{"name":"italic","type":"boolean","required":false,"default":"false","description":"true for Geist 400 italic; default false (Geist 800)."}],"returns":"Width in the same units as size."},{"export":"radius","kind":"constant","summary":"Corner radii in pixels: chip 14, code 12, card 28, pill 10."},{"export":"stroke","kind":"constant","summary":"The shared ink outline, `stroke.outline`, in stage px: 3 (3px on a 1080 stage). Every desk, paper, and thread object (Hand, Folder, Cajon, FileCabinet, Escritorio, DeskTop, DeskProp, Bandeja, ToolCaddy, Document, Paper, Tear, Register, Slip, Hilo, VideoPrint, PunchedTag) draws its outline at this weight, so a composed scene reads as one line weight."},{"export":"outlineIn","kind":"function","summary":"The shared outline converted to a local unit system, for art whose viewBox or transform scales against the stage (Hand's 30-unit viewBox at 180 px, a scaled DeskProp group).","params":[{"name":"unitsPerPx","type":"number","required":false,"default":"1","description":"Local units per stage px; default 1. Non-finite or non-positive values count as 1."}],"returns":"stroke.outline × unitsPerPx, in local units."},{"export":"shadowLayers","kind":"constant","summary":"The surface recipes split into inset (edge light), contact, and ambient box-shadow layers for `card` and `cardDark`. Use it to compose or inspect individual layers; see docs/surface-depth.md."},{"export":"shadow","kind":"constant","summary":"Complete box-shadow strings `card` and `cardDark`, joined from shadowLayers (inset, contact, then ambient). Used by Card, StatCard, and CodeCard."},{"export":"surfaceBorder","kind":"constant","summary":"1px ink-tinted border shorthands `card` (12% ink) and `cardDark` (65% ink) that pair with the matching shadow."},{"export":"stage","kind":"constant","summary":"Stage size and safe area per orientation, in stage pixels: landscape 1920×1080 with 120 side padding, top 90, content bottom 920; vertical 1080×1920 with 72 side padding, top 100, content bottom 1440. Captions live below `bottom`."},{"export":"Orientation","kind":"type","summary":"The keys of `stage`: \"landscape\" or \"vertical\"."},{"export":"cssVars","kind":"constant","summary":"A `:root{…}` CSS string defining --jbm-bg, --jbm-card, --jbm-ink, --jbm-dim, --jbm-line, --jbm-accent, --jbm-accent2, and --jbm-soft for Tailwind or shadcn consumers. It omits dimOnDark, codeBg, and codeGreen."}],"stage":{"mode":"n/a","reason":"Token values only; nothing renders. The gallery shows the color entries as swatches."},"examples":[{"title":"Inline styles from tokens","code":"import { color, font } from \"@/jbm/lib/tokens\"\n\n<div style={{ color: color.ink, background: color.bg, fontFamily: font.sans }} />"},{"title":"Keep content inside the safe area","code":"import { stage, type Orientation } from \"@/jbm/lib/tokens\"\n\nconst o: Orientation = \"vertical\"\nconst { w, pad, top, bottom } = stage[o]\nconst contentWidth = w - pad * 2 // 936 stage px in vertical\nconst contentHeight = bottom - top // 1340 stage px in vertical"},{"title":"CSS variables for Tailwind","code":"import { cssVars } from \"@/jbm/lib/tokens\"\n\n<style>{cssVars}</style>\n// or paste the string into globals.css and use var(--jbm-accent)"}],"qa":["Check each swatch against the cream, ink, and vermilion palette; the accent stays the only saturated color.","After changing shadowLayers, compare light and dark Card, StatCard, and CodeCard; shadow.card must still equal the joined card layers for existing consumers.","When adding a color, decide whether cssVars should expose it; today it exports eight of the eleven colors.","Verify text using dim or dimOnDark keeps readable contrast on its background."],"related":[{"name":"label","relation":"installed-by"},{"name":"big","relation":"installed-by"},{"name":"card","relation":"installed-by"},{"name":"chip","relation":"installed-by"},{"name":"stat-card","relation":"installed-by"},{"name":"callout","relation":"installed-by"},{"name":"bullet-list","relation":"installed-by"},{"name":"brand","relation":"installed-by"},{"name":"paper","relation":"installed-by"},{"name":"replay-button","relation":"installed-by"},{"name":"scene","relation":"installed-by"},{"name":"prob-bar","relation":"installed-by"},{"name":"code-card","relation":"installed-by"},{"name":"captions","relation":"installed-by"},{"name":"catalog","relation":"installed-by"},{"name":"propagate","relation":"installed-by"},{"name":"shelf","relation":"installed-by"},{"name":"scene-spec","relation":"installed-by"},{"name":"ui-button","relation":"installed-by"},{"name":"ui-input","relation":"installed-by"},{"name":"ui-card","relation":"installed-by"},{"name":"phone-frame","relation":"installed-by"},{"name":"badge","relation":"installed-by"},{"name":"token-glyph","relation":"installed-by"},{"name":"text-fill","relation":"installed-by"},{"name":"scroll-text-fill","relation":"installed-by"},{"name":"flip-text","relation":"installed-by"},{"name":"scroll-stack","relation":"installed-by"},{"name":"rule","relation":"installed-by"},{"name":"action-link","relation":"installed-by"},{"name":"index-row","relation":"installed-by"},{"name":"figure-caption","relation":"installed-by"},{"name":"ticket","relation":"installed-by"},{"name":"chat-bubble","relation":"installed-by"},{"name":"document","relation":"installed-by"},{"name":"folder","relation":"installed-by"},{"name":"score-scale","relation":"installed-by"},{"name":"comparison-bars","relation":"installed-by"},{"name":"clock","relation":"installed-by"},{"name":"cajon","relation":"installed-by"},{"name":"hand","relation":"installed-by"},{"name":"mano","relation":"installed-by"},{"name":"pluma","relation":"installed-by"},{"name":"bandeja","relation":"installed-by"},{"name":"tool-caddy","relation":"installed-by"},{"name":"escritorio","relation":"installed-by"},{"name":"desk-top","relation":"installed-by"},{"name":"ejes","relation":"installed-by"},{"name":"desk-prop","relation":"installed-by"},{"name":"burbuja","relation":"installed-by"},{"name":"file-cabinet","relation":"installed-by"},{"name":"paper-clip","relation":"installed-by"},{"name":"clipped-note","relation":"installed-by"},{"name":"punched-tag","relation":"installed-by"},{"name":"video-print","relation":"installed-by"},{"name":"hilo","relation":"installed-by"},{"name":"tear","relation":"installed-by"},{"name":"paper-line","relation":"installed-by"},{"name":"register","relation":"installed-by"},{"name":"slip","relation":"installed-by"},{"name":"stamp","relation":"installed-by"},{"name":"tape-marker","relation":"installed-by"},{"name":"paper-tape","relation":"installed-by"},{"name":"frontmatter","relation":"installed-by"},{"name":"folder-contents","relation":"installed-by"},{"name":"folder-carry","relation":"installed-by"},{"name":"icons","relation":"installed-by"}],"docs":[{"title":"Surface depth guide","url":"https://jbm-ui.bns.studio/docs/surface-depth.md"}],"setup":{"namespace":"@jbm","componentsJson":{"registries":{"@jbm":"https://jbm-ui.bns.studio/r/{name}.json"}},"command":"npx shadcn@latest add @jbm/<name>","target":"src/jbm/","importAlias":"@/jbm/…","tsconfigPaths":{"@/*":["./src/*"]}},"rules":["Install through the @jbm namespace: each registry item JSON (/r/<name>.json) carries its files' contents and each guide is served at /docs/<slug>.md, so agents never need the source repository (it is public on GitHub for people browsing the code).","Files install to src/jbm/ and import as @/jbm/…, which needs the @/* → ./src/* path alias in tsconfig.json.","Items marked needsRemotion require the remotion package and must render inside a Remotion composition or Player; every other item works in any React page.","Use one vermilion accent per composition; accent2 is for annotations only and soft is for dark surfaces only.","Stages are 1920×1080 landscape and 1080×1920 vertical with declared safe areas; each item's stage field declares its size in stage pixels, and scenes compose from YAML-shaped specs with @jbm/scene-spec."],"links":{"catalog":"https://jbm-ui.bns.studio/catalog.json","llms":"https://jbm-ui.bns.studio/llms.txt"}}