mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
* fix(catalog): make component previews answer their variables panel Every control on a component's catalog page did nothing. Asking caption-camera-follow for a violet accent rendered gold, and so did green and blue, on 166 of the 168 components that declare variables. A component ships a snippet, which is what the page hands you to paste and which carries the declaration plus the script that turns a chosen value into a CSS custom property, and a demo.html which stages and animates it. The preview is built from the demo, and the demo was authored as a copy of the snippet rather than a reference to it. The copies drifted until almost none of them carried the declaration or the reader, so the payload for that page never contained the word violet at all. Components come in two shapes, so the repair does too. 123 ship a snippet that registers its own paused timeline. That snippet is a whole piece, so their preview is now built from it and carries markup, variables and motion together. 45 are markup plus a commented recipe, where the demo owns the motion. Those demos now carry the snippet's declaration, reader and var-driven CSS in the registry itself, written by scripts/catalog/sync-demo-variables.ts. Nothing is patched in at build time. A test runs that tool in dry mode and fails when a demo has drifted again, naming the command that repairs it. It also asserts it inspected more than a hundred components, because a check that silently matches nothing is how this rotted in the first place. Measured by rendering every payload in a real player rather than by reading markup: payloads declaring their variables go from 2 of 168 to 168 of 168, previews that animate go from 166 to 167, and nothing that moved stopped moving. ascii-render-pass and star-rating-fill render a still frame when built from their snippet, so they keep the demo path as a recorded exception and stay in the state they were already in. * refactor(catalog): give the preview pipeline one lookup and one entrypoint guard Follow-up on the same branch, no behaviour change: 42 tests still pass and `sync-demo-variables --check` still reports all 168 components clean. The payload generator and the demo sync had each grown their own copy of "given a component directory, find the snippet and the demo". Both now call `componentFiles`, which is the same duplication-by-copying that broke the previews in the first place. Both catalog generators also carried a byte-identical 12-line guard for "only run main() when this file is the entrypoint". That clone was already in the tree, but nothing had touched both files at once before, so it had never surfaced. It is now `runAsCommand`, and the sync script's variant of the same condition is `isEntrypoint`. The rest is flattening: the layering guards read as a table of conditions instead of a chain, the reporting splits by what it reports, and the entry resolution comes out of `buildPayload` rather than being spliced into it. Also runs the formatter over the demos this branch rewrote. Whitespace only, and `notes-typing` is the only component demo that renders pre-formatted text, which this does not touch.
423 lines
15 KiB
HTML
Vendored
423 lines
15 KiB
HTML
Vendored
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=1920, height=1080" />
|
|
<title>Streaming Text</title>
|
|
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
|
<style>
|
|
html,
|
|
body {
|
|
margin: 0;
|
|
width: 1920px;
|
|
height: 1080px;
|
|
overflow: hidden;
|
|
}
|
|
body {
|
|
background: #101413;
|
|
font-family:
|
|
ui-sans-serif,
|
|
-apple-system,
|
|
"Segoe UI",
|
|
sans-serif;
|
|
}
|
|
.hf-ui-demo-canvas {
|
|
position: relative;
|
|
width: 1920px;
|
|
height: 1080px;
|
|
overflow: hidden;
|
|
background:
|
|
radial-gradient(
|
|
ellipse 70% 90% at 26% 30%,
|
|
rgba(60, 230, 172, 0.07) 0%,
|
|
rgba(60, 230, 172, 0) 60%
|
|
),
|
|
linear-gradient(160deg, #1a201d 0%, #121614 55%, #0e1210 100%);
|
|
}
|
|
/* the device */
|
|
.spec-phone {
|
|
position: absolute;
|
|
left: 430px;
|
|
top: 158px;
|
|
width: 438px;
|
|
height: 764px;
|
|
border-radius: 64px;
|
|
background: #3a3d42;
|
|
box-shadow:
|
|
inset 0 2px 3px rgba(255, 255, 255, 0.22),
|
|
0 34px 80px rgba(0, 0, 0, 0.55);
|
|
}
|
|
.spec-screen {
|
|
position: absolute;
|
|
left: 14px;
|
|
top: 14px;
|
|
width: 410px;
|
|
height: 736px;
|
|
border-radius: 52px;
|
|
overflow: hidden;
|
|
background: #000;
|
|
}
|
|
/* interior is authored at 1080x1920 and scaled into the screen */
|
|
.spec-int {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
width: 1080px;
|
|
height: 1920px;
|
|
transform: scale(0.3796);
|
|
transform-origin: 0 0;
|
|
}
|
|
/* the caption column */
|
|
.spec-cap {
|
|
position: absolute;
|
|
left: 1010px;
|
|
top: 300px;
|
|
width: 730px;
|
|
}
|
|
.spec-cap .name {
|
|
font:
|
|
600 46px/1.1 ui-monospace,
|
|
"SF Mono",
|
|
Menlo,
|
|
monospace;
|
|
color: #3ce6ac;
|
|
letter-spacing: -0.5px;
|
|
}
|
|
.spec-cap .rule {
|
|
width: 84px;
|
|
height: 3px;
|
|
background: #3ce6ac;
|
|
margin: 26px 0;
|
|
}
|
|
.spec-cap .desc {
|
|
font:
|
|
400 21px/1.6 ui-sans-serif,
|
|
-apple-system,
|
|
sans-serif;
|
|
color: #b9c2bd;
|
|
max-width: 620px;
|
|
}
|
|
.spec-cap .stats {
|
|
margin-top: 30px;
|
|
display: grid;
|
|
gap: 12px;
|
|
}
|
|
.spec-cap .stat {
|
|
font:
|
|
500 16px/1.5 ui-monospace,
|
|
"SF Mono",
|
|
Menlo,
|
|
monospace;
|
|
color: #78827d;
|
|
}
|
|
.spec-cap .stat b {
|
|
color: #e8ece9;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.st-screen {
|
|
position: absolute;
|
|
inset: 0;
|
|
background: #fdfdfd;
|
|
}
|
|
.st-hdr {
|
|
position: absolute;
|
|
left: 0;
|
|
top: 90px;
|
|
width: 1080px;
|
|
text-align: center;
|
|
font-size: 34px;
|
|
font-weight: 600;
|
|
color: #0d0d0d;
|
|
}
|
|
.st-bubble {
|
|
position: absolute;
|
|
top: 190px;
|
|
right: 48px;
|
|
max-width: 760px;
|
|
background: #f3f3f3;
|
|
border-radius: 44px;
|
|
padding: 28px 40px;
|
|
font-size: 38px;
|
|
line-height: 1.4;
|
|
color: #111;
|
|
}
|
|
.st-answer {
|
|
position: absolute;
|
|
top: 420px;
|
|
left: 48px;
|
|
width: 960px;
|
|
font-size: 40px;
|
|
line-height: 1.5;
|
|
color: #141414;
|
|
}
|
|
.st-answer .w {
|
|
opacity: 0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div
|
|
id="hf-st-demo-root"
|
|
class="hf-ui-demo-canvas"
|
|
data-composition-id="streaming-text-demo"
|
|
data-start="0"
|
|
data-width="1920"
|
|
data-height="1080"
|
|
data-duration="5.5"
|
|
data-composition-variables='[
|
|
{ "id": "size", "type": "number", "role": "style", "label": "Size", "description": "Type size of the streamed words.", "default": 27, "min": 18, "max": 64, "step": 1, "unit": "px" },
|
|
{ "id": "tone", "type": "enum", "role": "style", "label": "Tone", "description": "Ink pair: dark words on a light ground, or light words on a dark ground.", "default": "dark-on-light", "options": [{ "value": "dark-on-light", "label": "Dark on light" }, { "value": "light-on-dark", "label": "Light on dark" }] }
|
|
]'
|
|
>
|
|
<section
|
|
class="clip"
|
|
data-start="0"
|
|
data-duration="5.5"
|
|
data-track-index="1"
|
|
style="position: absolute; inset: 0"
|
|
>
|
|
<div class="spec-phone">
|
|
<div class="spec-screen">
|
|
<div class="spec-int">
|
|
<div class="st-screen"></div>
|
|
<div class="st-hdr">Assistant</div>
|
|
<div class="st-bubble">how do I turn my HTML into real video?</div>
|
|
<div class="st-answer" id="st-p">
|
|
<span class="w">You</span> <span class="w">don't</span>
|
|
<span class="w">need</span> <span class="w">a</span> <span class="w">video</span>
|
|
<span class="w">editor.</span> <span class="w">HyperFrames</span>
|
|
<span class="w">renders</span> <span class="w">the</span>
|
|
<span class="w">HTML</span> <span class="w">you</span>
|
|
<span class="w">already</span> <span class="w">write</span>
|
|
<span class="w">into</span> <span class="w">pixel-perfect,</span>
|
|
<span class="w">deterministic</span> <span class="w">video.</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="spec-cap">
|
|
<div class="name">streaming-text</div>
|
|
<div class="rule"></div>
|
|
<div class="desc">
|
|
Words arrive the way an AI answer streams — in uneven bursts on a measured token rhythm,
|
|
each word landing grey and inking to full colour. Not a typewriter.
|
|
</div>
|
|
<div class="stats">
|
|
<div class="stat"><b>29 gaps</b> — the measured token rhythm, cycled</div>
|
|
<div class="stat"><b>0.27s</b> — fresh-grey to ink ramp, per word</div>
|
|
<div class="stat"><b>bursts</b> — two together, a pause, three more</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<script>
|
|
(function () {
|
|
"use strict";
|
|
|
|
var vars =
|
|
window.__hyperframes && window.__hyperframes.getVariables
|
|
? window.__hyperframes.getVariables()
|
|
: {};
|
|
|
|
// Unrecognised overrides return to their declared defaults.
|
|
function pick(table, value, fallback) {
|
|
return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;
|
|
}
|
|
|
|
function clampNumber(value, min, max, fallback) {
|
|
var n = typeof value === "number" ? value : parseFloat(value);
|
|
if (!isFinite(n)) {
|
|
return fallback;
|
|
}
|
|
return Math.min(max, Math.max(min, n));
|
|
}
|
|
|
|
var tones = {
|
|
"dark-on-light": { ink: "#141414", fresh: "#767676" },
|
|
"light-on-dark": { ink: "#f3f3f3", fresh: "#5f5f5f" },
|
|
};
|
|
|
|
var size = clampNumber(vars.size, 18, 64, 27);
|
|
var tone = tones[pick(tones, vars.tone, "dark-on-light")];
|
|
|
|
var roots = document.querySelectorAll(".hf-ui-streaming-text");
|
|
for (var i = 0; i < roots.length; i += 1) {
|
|
roots[i].style.setProperty("--hf-st-size", size + "px");
|
|
roots[i].style.setProperty("--hf-st-ink", tone.ink);
|
|
roots[i].style.setProperty("--hf-st-fresh", tone.fresh);
|
|
}
|
|
})();
|
|
</script>
|
|
<script>
|
|
window.__timelines = window.__timelines || {};
|
|
var tl = gsap.timeline({ paused: true });
|
|
/* the measured token rhythm, cycled */
|
|
var GAPS = [
|
|
0.167, 0.1, 0.0, 0.367, 0.0, 0.167, 0.133, 0.1, 0.1, 0.133, 0.167, 0.133, 0.0, 0.233, 0.167,
|
|
0.1, 0.0, 0.133, 0.133, 0.1, 0.167, 0.133, 0.1, 0.133, 0.167, 0.1, 0.133, 0.1, 0.133,
|
|
];
|
|
var t = 0.8;
|
|
gsap.utils.toArray("#st-p .w").forEach(function (w, i) {
|
|
if (i > 0) t += GAPS[i % GAPS.length];
|
|
tl.set(w, { opacity: 1 }, t);
|
|
tl.fromTo(w, { color: "#767676" }, { color: "#141414", duration: 0.2667, ease: "none" }, t);
|
|
});
|
|
tl.set({}, {}, 5.5);
|
|
window.__timelines["streaming-text-demo"] = tl;
|
|
</script>
|
|
<style>
|
|
/* hf-ui:tokens:start */
|
|
/* prettier-ignore */
|
|
[data-hf-ui-root] {
|
|
--_hf-ui-accent: var(--hf-ui-accent, #3ce6ac);
|
|
--_hf-ui-action: var(--hf-ui-action, #eeeeee);
|
|
--_hf-ui-action-contrast: var(--hf-ui-action-contrast, #111111);
|
|
--_hf-ui-border: var(--hf-ui-border, #2a2a2a);
|
|
--_hf-ui-border-strong: var(--hf-ui-border-strong, #383838);
|
|
--_hf-ui-canvas: var(--hf-ui-canvas, #0a0a0a);
|
|
--_hf-ui-control-border: var(--hf-ui-control-border, #686868);
|
|
--_hf-ui-control-border-hover: var(--hf-ui-control-border-hover, #777777);
|
|
--_hf-ui-control-height: var(--hf-ui-control-height, 40px);
|
|
--_hf-ui-danger: var(--hf-ui-danger, #ff7878);
|
|
--_hf-ui-data-1: var(--hf-ui-data-1, #3ce6ac);
|
|
--_hf-ui-data-2: var(--hf-ui-data-2, #63a5ff);
|
|
--_hf-ui-data-3: var(--hf-ui-data-3, #e9ab55);
|
|
--_hf-ui-data-4: var(--hf-ui-data-4, #a78bfa);
|
|
--_hf-ui-data-5: var(--hf-ui-data-5, #ff8a75);
|
|
--_hf-ui-duration-drawer-enter: var(--hf-ui-duration-drawer-enter, 360ms);
|
|
--_hf-ui-duration-drawer-exit: var(--hf-ui-duration-drawer-exit, 240ms);
|
|
--_hf-ui-duration-modal-enter: var(--hf-ui-duration-modal-enter, 280ms);
|
|
--_hf-ui-duration-modal-exit: var(--hf-ui-duration-modal-exit, 180ms);
|
|
--_hf-ui-duration-overlay-enter: var(--hf-ui-duration-overlay-enter, 210ms);
|
|
--_hf-ui-duration-overlay-exit: var(--hf-ui-duration-overlay-exit, 140ms);
|
|
--_hf-ui-duration-press: var(--hf-ui-duration-press, 120ms);
|
|
--_hf-ui-duration-state: var(--hf-ui-duration-state, 160ms);
|
|
--_hf-ui-ease-enter: var(--hf-ui-ease-enter, cubic-bezier(0.32, 0.72, 0, 1));
|
|
--_hf-ui-ease-exit: var(--hf-ui-ease-exit, cubic-bezier(0.23, 1, 0.32, 1));
|
|
--_hf-ui-ease-response: var(--hf-ui-ease-response, cubic-bezier(0.23, 1, 0.32, 1));
|
|
--_hf-ui-font-mono: var(--hf-ui-font-mono, ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace);
|
|
--_hf-ui-font-sans: var(--hf-ui-font-sans, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
|
|
--_hf-ui-hit-target: var(--hf-ui-hit-target, 44px);
|
|
--_hf-ui-radius-control: var(--hf-ui-radius-control, 5px);
|
|
--_hf-ui-radius-overlay: var(--hf-ui-radius-overlay, 10px);
|
|
--_hf-ui-radius-surface: var(--hf-ui-radius-surface, 7px);
|
|
--_hf-ui-shadow-contact: var(--hf-ui-shadow-contact, 0 8px 18px rgba(0, 0, 0, 0.38));
|
|
--_hf-ui-shadow-inset: var(--hf-ui-shadow-inset, inset 0 1px 0 rgba(255, 255, 255, 0.035));
|
|
--_hf-ui-shadow-modal: var(--hf-ui-shadow-modal, 0 18px 46px rgba(0, 0, 0, 0.52));
|
|
--_hf-ui-space-1: var(--hf-ui-space-1, 4px);
|
|
--_hf-ui-space-12: var(--hf-ui-space-12, 48px);
|
|
--_hf-ui-space-16: var(--hf-ui-space-16, 64px);
|
|
--_hf-ui-space-2: var(--hf-ui-space-2, 8px);
|
|
--_hf-ui-space-3: var(--hf-ui-space-3, 12px);
|
|
--_hf-ui-space-4: var(--hf-ui-space-4, 16px);
|
|
--_hf-ui-space-6: var(--hf-ui-space-6, 24px);
|
|
--_hf-ui-space-8: var(--hf-ui-space-8, 32px);
|
|
--_hf-ui-surface: var(--hf-ui-surface, #141414);
|
|
--_hf-ui-surface-inset: var(--hf-ui-surface-inset, #101010);
|
|
--_hf-ui-surface-raised: var(--hf-ui-surface-raised, #1a1a1a);
|
|
--_hf-ui-text: var(--hf-ui-text, #e5e5e5);
|
|
--_hf-ui-text-faint: var(--hf-ui-text-faint, #7e7e7e);
|
|
--_hf-ui-text-muted: var(--hf-ui-text-muted, #929292);
|
|
--_hf-ui-text-strong: var(--hf-ui-text-strong, #f3f3f3);
|
|
--_hf-ui-warning: var(--hf-ui-warning, #e9ab55);
|
|
--_hf-ui-weight-medium: var(--hf-ui-weight-medium, 500);
|
|
--_hf-ui-weight-regular: var(--hf-ui-weight-regular, 400);
|
|
--_hf-ui-weight-semibold: var(--hf-ui-weight-semibold, 600);
|
|
box-sizing: border-box;
|
|
color-scheme: dark;
|
|
font-family: var(--_hf-ui-font-sans);
|
|
}
|
|
/* prettier-ignore */
|
|
[data-hf-ui-root] *,
|
|
[data-hf-ui-root] *::before,
|
|
[data-hf-ui-root] *::after {
|
|
box-sizing: border-box;
|
|
}
|
|
/* prettier-ignore */
|
|
[data-hf-theme="light"] [data-hf-ui-root],
|
|
[data-hf-ui-root][data-hf-theme="light"] {
|
|
--_hf-ui-accent: var(--hf-ui-accent, #087a57);
|
|
--_hf-ui-action: var(--hf-ui-action, #171717);
|
|
--_hf-ui-action-contrast: var(--hf-ui-action-contrast, #ffffff);
|
|
--_hf-ui-border: var(--hf-ui-border, #e0dfdb);
|
|
--_hf-ui-border-strong: var(--hf-ui-border-strong, #cbc9c3);
|
|
--_hf-ui-canvas: var(--hf-ui-canvas, #f6f5f1);
|
|
--_hf-ui-control-border: var(--hf-ui-control-border, #888888);
|
|
--_hf-ui-control-border-hover: var(--hf-ui-control-border-hover, #6f6e68);
|
|
--_hf-ui-danger: var(--hf-ui-danger, #a61b1b);
|
|
--_hf-ui-data-1: var(--hf-ui-data-1, #087a57);
|
|
--_hf-ui-data-2: var(--hf-ui-data-2, #245ea8);
|
|
--_hf-ui-data-3: var(--hf-ui-data-3, #8a4b00);
|
|
--_hf-ui-data-4: var(--hf-ui-data-4, #6d3fc0);
|
|
--_hf-ui-data-5: var(--hf-ui-data-5, #a83d2d);
|
|
--_hf-ui-shadow-contact: var(--hf-ui-shadow-contact, 0 7px 16px rgba(26, 24, 20, 0.13));
|
|
--_hf-ui-shadow-inset: var(--hf-ui-shadow-inset, inset 0 1px 0 rgba(255, 255, 255, 0.78));
|
|
--_hf-ui-shadow-modal: var(--hf-ui-shadow-modal, 0 18px 46px rgba(26, 24, 20, 0.18));
|
|
--_hf-ui-surface: var(--hf-ui-surface, #ffffff);
|
|
--_hf-ui-surface-inset: var(--hf-ui-surface-inset, #f0efeb);
|
|
--_hf-ui-surface-raised: var(--hf-ui-surface-raised, #ffffff);
|
|
--_hf-ui-text: var(--hf-ui-text, #171717);
|
|
--_hf-ui-text-faint: var(--hf-ui-text-faint, #6f6e68);
|
|
--_hf-ui-text-muted: var(--hf-ui-text-muted, #5f5f5a);
|
|
--_hf-ui-text-strong: var(--hf-ui-text-strong, #0a0a0a);
|
|
--_hf-ui-warning: var(--hf-ui-warning, #8a4b00);
|
|
color-scheme: light;
|
|
}
|
|
/* prettier-ignore */
|
|
[data-hf-ui-root]:focus-visible {
|
|
outline: 2px solid var(--_hf-ui-accent);
|
|
outline-offset: 3px;
|
|
}
|
|
/* prettier-ignore */
|
|
[data-hf-rendering="true"][data-hf-ui-root],
|
|
[data-hf-rendering="true"] [data-hf-ui-root],
|
|
[data-hf-rendering="true"][data-hf-ui-root] *,
|
|
[data-hf-rendering="true"] [data-hf-ui-root] *,
|
|
[data-hf-rendering="true"][data-hf-ui-root]::before,
|
|
[data-hf-rendering="true"][data-hf-ui-root]::after,
|
|
[data-hf-rendering="true"] [data-hf-ui-root]::before,
|
|
[data-hf-rendering="true"] [data-hf-ui-root]::after,
|
|
[data-hf-rendering="true"][data-hf-ui-root] *::before,
|
|
[data-hf-rendering="true"][data-hf-ui-root] *::after,
|
|
[data-hf-rendering="true"] [data-hf-ui-root] *::before,
|
|
[data-hf-rendering="true"] [data-hf-ui-root] *::after {
|
|
animation-duration: 0s !important;
|
|
animation-delay: 0s !important;
|
|
transition-duration: 0s !important;
|
|
transition-delay: 0s !important;
|
|
}
|
|
/* prettier-ignore */
|
|
@media (prefers-reduced-motion: reduce) {
|
|
[data-hf-ui-root],
|
|
[data-hf-ui-root] *,
|
|
[data-hf-ui-root] *::before,
|
|
[data-hf-ui-root] *::after {
|
|
animation-duration: 0s !important;
|
|
animation-delay: 0s !important;
|
|
transition-duration: 0s !important;
|
|
transition-delay: 0s !important;
|
|
scroll-behavior: auto !important;
|
|
}
|
|
}
|
|
/* hf-ui:tokens:end */
|
|
|
|
.hf-ui-streaming-text {
|
|
font-size: var(--hf-st-size, 27px);
|
|
color: var(--hf-st-ink, #141414);
|
|
font-family: var(--_hf-ui-font-sans);
|
|
}
|
|
.hf-st-p {
|
|
margin: 0;
|
|
line-height: 1.43;
|
|
letter-spacing: 0.046em;
|
|
max-width: 24.5em;
|
|
}
|
|
.hf-ui-streaming-text .w {
|
|
opacity: 0;
|
|
}
|
|
</style>
|
|
</body>
|
|
</html>
|