// @ts-nocheck import { onCleanup } from "solid-js" import { createStore } from "solid-js/store" import { TextReveal } from "./text-reveal" export default { title: "UI/TextReveal", id: "components-text-reveal", tags: ["autodocs"], parameters: { docs: { description: { component: `### Overview Playground for the TextReveal text transition component. **Hybrid** — mask wipe + vertical slide: gradient sweeps AND text moves downward. **Wipe only** — pure mask wipe: gradient sweeps top-to-bottom, text stays in place.`, }, }, }, } const TEXTS = [ "Refactor ToolStatusTitle DOM measurement", "Remove inline measure nodes", "Run typechecks and report changes", "Verify reduced-motion behavior", "Review diff for animation edge cases", "Check keyboard semantics", undefined, "Planning key generation details", "Analyzing error handling", "Considering edge cases", ] const btn = (accent?: boolean) => ({ padding: "5px 12px", "border-radius": "6px", border: accent ? "1px solid var(--color-accent, #58f)" : "1px solid var(--color-divider, #333)", background: accent ? "var(--color-accent, #58f)" : "var(--color-fill-element, #222)", color: "var(--color-text, #eee)", cursor: "pointer", "font-size": "12px", }) as const const sliderLabel = { width: "90px", "font-size": "12px", color: "var(--color-text-secondary, #a3a3a3)", "flex-shrink": "0", } as const const cardStyle = { padding: "20px 24px", "border-radius": "10px", border: "1px solid var(--color-divider, #333)", background: "var(--color-fill-element, #1a1a1a)", display: "grid", gap: "12px", } as const const cardLabel = { "font-size": "11px", "font-family": "monospace", color: "var(--color-text-weak, #666)", } as const const previewRow = { display: "flex", "align-items": "center", gap: "8px", "font-size": "14px", "font-weight": "500", "line-height": "20px", color: "var(--text-weak, #aaa)", "min-height": "20px", overflow: "visible", } as const const headingSlot = { "min-width": "0", overflow: "visible", color: "var(--text-weaker, #888)", "font-weight": "400", } as const export const Playground = { render: () => { const [state, setState] = createStore({ index: 0, cycling: false, growOnly: true, duration: 600, bounce: 1.0, bounceSoft: 1.0, hybridTravel: 25, hybridEdge: 17, edge: 17, revealTravel: 0, }) const index = () => state.index const cycling = () => state.cycling const growOnly = () => state.growOnly const duration = () => state.duration const bounce = () => state.bounce const bounceSoft = () => state.bounceSoft const hybridTravel = () => state.hybridTravel const hybridEdge = () => state.hybridEdge const edge = () => state.edge const revealTravel = () => state.revealTravel let timer: number | undefined const text = () => TEXTS[index()] const next = () => setState("index", (value) => (value + 1) % TEXTS.length) const prev = () => setState("index", (value) => (value - 1 + TEXTS.length) % TEXTS.length) const toggleCycle = () => { if (cycling()) { if (timer) clearTimeout(timer) timer = undefined setState("cycling", false) return } setState("cycling", true) const tick = () => { next() timer = window.setTimeout(tick, 700 + Math.floor(Math.random() * 600)) } timer = window.setTimeout(tick, 700 + Math.floor(Math.random() * 600)) } onCleanup(() => { if (timer) clearTimeout(timer) }) const spring = () => `cubic-bezier(0.34, ${bounce()}, 0.64, 1)` const springSoft = () => `cubic-bezier(0.34, ${bounceSoft()}, 0.64, 1)` return (
text-reveal (mask wipe + slide)
Thinking
text-reveal (mask wipe only)
Thinking
{TEXTS.map((t, i) => ( ))}
Hybrid (wipe + slide)
Shared
Wipe only
text: {text() ?? "(none)"} · growOnly: {growOnly() ? "on" : "off"}
) }, }