/* ============================================================ gp-atoms.jsx — shared UI primitives (OverMont / zinc vocabulary) ============================================================ */ var { useState, useEffect, useRef, useMemo } = React; // uppercase mono micro-label function Label({ children, color = "var(--fg-3)", style }) { return {children}; } function Mono({ children, color = "var(--fg)", size = 12, weight = 400, style }) { return {children}; } // status pill — winner / survivor / rejected / verified / flagged / regime const PILL = { winner: { fg: "var(--emerald)", bg: "color-mix(in oklab, var(--emerald) 16%, transparent)" }, survivor: { fg: "var(--info)", bg: "color-mix(in oklab, var(--info) 16%, transparent)" }, rejected: { fg: "var(--rose)", bg: "color-mix(in oklab, var(--rose) 14%, transparent)" }, verified: { fg: "var(--emerald)", bg: "color-mix(in oklab, var(--emerald) 15%, transparent)" }, flagged: { fg: "var(--rose)", bg: "color-mix(in oklab, var(--rose) 15%, transparent)" }, neutral: { fg: "var(--fg-2)", bg: "var(--bg-2)" }, accent: { fg: "var(--cyan)", bg: "color-mix(in oklab, var(--cyan) 13%, transparent)" }, warn: { fg: "var(--amber)", bg: "color-mix(in oklab, var(--amber) 14%, transparent)" }, }; function Pill({ kind = "neutral", children, dot = false, style }) { const m = PILL[kind] || PILL.neutral; return ( {dot && } {children} ); } // verification dot — emerald (verified) / rose (flagged) function VerdictDot({ verdict, size = 7, pulse = false }) { const color = verdict === "VERIFIED" ? "var(--emerald)" : "var(--rose)"; return ; } // pass/fail glyph function CheckMark({ pass, size = 13 }) { return ( {pass ? "✓" : "✕"} ); } // param chip k=v, with optional diff highlight function ParamChip({ k, v, changed = false, highlight = false }) { return ( {k} {v} ); } // metric value, colored by sign for returns/dd function MetricVal({ metricKey, value, size = 12, weight = 500 }) { const m = window.GP.verify.metricByKey(metricKey); let color = "var(--fg)"; if (metricKey === "total_return") color = value > 0 ? "var(--emerald)" : "var(--rose)"; if (metricKey === "max_drawdown") color = "var(--rose)"; if (metricKey === "win_rate_frac") color = "var(--fg)"; return {m.fmt(value)}; } // section header bar function SectionBar({ num, title, right, style }) { return (
{num != null && {num}}
{right &&
{right}
}
); } // regime tag const REGIME_COLOR = { TRENDING_BULL: "var(--emerald)", TRENDING_BEAR: "var(--rose)", CHOPPY: "var(--amber)", RANGE_BOUND: "var(--indigo)", BREAKOUT: "var(--cyan)", }; function RegimeTag({ regime, small = false }) { if (!regime) return null; const c = REGIME_COLOR[regime] || "var(--fg-2)"; return ( {regime.replace("_", " ")} ); } // horizontal bar (for score scales) function Bar({ frac, color = "var(--cyan)", height = 6, bg = "var(--bg-2)", glow = false, radius = 1 }) { return ( ); } // generic icon button / tab function Tab({ active, children, onClick, badge }) { return ( ); } function Panel({ children, style }) { return
{children}
; } Object.assign(window, { Label, Mono, Pill, VerdictDot, CheckMark, ParamChip, MetricVal, SectionBar, RegimeTag, Bar, Tab, Panel, REGIME_COLOR, });