Files
hyperframes/registry/components/text-state-swap/demo.html
T
Miguel Ángel 9734578e60 feat(registry): bring back the video-primitive moves (#3169)
Restores the 208 catalog items reverted after their previews 404'd in
production, this time on the payload mechanism rather than the .html files
that caused the outage.

The generator no longer writes a preview document to docs/public. That writer,
and the machinery under it, existed only to produce files the docs host
discards, so it is gone rather than bypassed. Items now embed the composition
itself via a payload, which is what the previous change already does for the
items that were already in the catalog.

The variables explorer is parked, not restored: it drove its preview through
the same unpublished .html path, so it would have shown an empty frame. Items
that declare variables get the live player plus the static variables table, and
reconnecting the explorer to payloads is a follow-up.
2026-08-10 18:46:03 -04:00

174 lines
4.5 KiB
HTML
Vendored

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=1920, height=1080" />
<title>Text State Swap - Demo</title>
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
<style>
* {
box-sizing: border-box;
}
html,
body {
margin: 0;
width: 1920px;
height: 1080px;
overflow: hidden;
}
#demo {
width: 1920px;
height: 1080px;
display: grid;
place-items: center;
background: #f5f5f4;
font-family: Inter, system-ui, sans-serif;
}
/* ponytail: scale on non-GSAP wrapper, safe to use transform here */
.demo-frame {
display: grid;
place-items: center;
transform: scale(2.6);
transform-origin: center center;
}
.demo-card {
background: #ffffff;
border: 1px solid #e4e4e7;
border-radius: 14px;
box-shadow: 0 24px 70px rgba(0, 0, 0, 0.08);
padding: 32px 40px;
display: flex;
flex-direction: column;
gap: 20px;
width: 340px;
}
.demo-card-header {
display: flex;
align-items: center;
justify-content: space-between;
}
.demo-card-title {
font-size: 13px;
font-weight: 600;
color: #71717a;
letter-spacing: 0.02em;
text-transform: uppercase;
}
.demo-card-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #22c55e;
}
.demo-card-body {
display: flex;
flex-direction: column;
gap: 10px;
}
.demo-card-line {
height: 10px;
border-radius: 5px;
background: #f4f4f5;
}
.demo-card-line.w-full {
width: 100%;
}
.demo-card-line.w-3q {
width: 75%;
}
.demo-card-line.w-half {
width: 50%;
}
.demo-card-footer {
display: flex;
align-items: center;
justify-content: flex-end;
padding-top: 4px;
border-top: 1px solid #f4f4f5;
}
.hf-transition-text-state-swap {
position: relative;
width: 140px;
height: 22px;
overflow: hidden;
color: #18181b;
font:
700 14px/1 Inter,
system-ui,
sans-serif;
}
.hf-transition-text-state-swap span {
position: absolute;
left: 0;
top: 0;
filter: blur(var(--hf-text-blur, 0px));
transform: translateY(var(--hf-text-y, 0px));
will-change: transform, filter, opacity;
}
.hf-transition-text-state-swap .to {
opacity: 0;
}
</style>
</head>
<body>
<div
id="demo"
data-composition-id="text-state-swap-demo"
data-start="0"
data-width="1920"
data-height="1080"
data-duration="5"
>
<div class="demo-frame">
<div class="demo-card">
<div class="demo-card-header">
<span class="demo-card-title">Draft</span>
<span class="demo-card-dot"></span>
</div>
<div class="demo-card-body">
<div class="demo-card-line w-full"></div>
<div class="demo-card-line w-3q"></div>
<div class="demo-card-line w-full"></div>
<div class="demo-card-line w-half"></div>
</div>
<div class="demo-card-footer">
<div class="hf-transition-text-state-swap">
<span class="from">Saving draft…</span><span class="to">Saved</span>
</div>
</div>
</div>
</div>
<script>
const tl = gsap.timeline({ paused: true });
const startTime = 0.5;
tl.to(
".hf-transition-text-state-swap .from",
{
opacity: 0,
"--hf-text-y": "-18px",
"--hf-text-blur": "8px",
duration: 0.18,
ease: "power2.in",
},
startTime,
);
tl.fromTo(
".hf-transition-text-state-swap .to",
{ opacity: 0, "--hf-text-y": "18px", "--hf-text-blur": "8px" },
{
opacity: 1,
"--hf-text-y": "0px",
"--hf-text-blur": "0px",
duration: 0.26,
ease: "power2.out",
},
startTime + 0.12,
);
tl.set({}, {}, 5);
window.__timelines = window.__timelines || {};
window.__timelines["text-state-swap-demo"] = tl;
</script>
</div>
</body>
</html>