mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-01 19:42:03 +00:00
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.
134 lines
5.2 KiB
HTML
Vendored
134 lines
5.2 KiB
HTML
Vendored
<!--
|
|
Panel Reveal - transitions.dev-inspired primitive for HyperFrames.
|
|
|
|
Paste the markup, CSS and script into a composition. Use the timeline
|
|
integration note at the bottom as the starting point for deterministic GSAP
|
|
animation.
|
|
|
|
Variables. The script reads each one, falls back to the declared default on
|
|
anything missing or unrecognised, and writes the result as a custom property
|
|
the CSS below consumes. The timeline recipe at the end is untouched by them:
|
|
it keeps driving the single open value from 0 to 1.
|
|
|
|
- title (string, default "Motion tokens"): the header line above the fold.
|
|
- width (narrow | standard | wide, default standard): how wide the panel
|
|
sits, 280, 360 or 480 px.
|
|
- tone (paper | ink, default paper): the surface family. paper is the
|
|
white card on a light frame, ink is the same card inverted for dark
|
|
frames, border and body copy included.
|
|
- reveal (fade | solid, default fade): whether the body fades in with the
|
|
height. fade is the shipped motion, solid keeps the body at full opacity
|
|
so only the height opens. Both look the same once the panel is open.
|
|
|
|
On every default the result is identical to the original: a 360px white card
|
|
whose body fades in as it grows.
|
|
-->
|
|
|
|
<section
|
|
class="hf-transition-panel-reveal"
|
|
data-composition-variables='[
|
|
{ "id": "title", "type": "string", "role": "content", "label": "Title", "description": "The header line that sits above the folded body.", "default": "Motion tokens" },
|
|
{ "id": "width", "type": "enum", "role": "layout", "label": "Width", "description": "How wide the panel sits, 280, 360 or 480 px.", "default": "standard", "options": [{ "value": "narrow", "label": "Narrow" }, { "value": "standard", "label": "Standard" }, { "value": "wide", "label": "Wide" }] },
|
|
{ "id": "tone", "type": "enum", "role": "style", "label": "Tone", "description": "Surface family: paper is the white card for light frames, ink inverts it for dark frames.", "default": "paper", "options": [{ "value": "paper", "label": "Paper" }, { "value": "ink", "label": "Ink" }] },
|
|
{ "id": "reveal", "type": "enum", "role": "motion", "label": "Reveal", "description": "Whether the body fades in with the height. fade is the shipped motion, solid opens the height only.", "default": "fade", "options": [{ "value": "fade", "label": "Fade" }, { "value": "solid", "label": "Solid" }] }
|
|
]'
|
|
>
|
|
<header>Motion tokens</header>
|
|
<div>
|
|
<p>Duration 420ms</p>
|
|
<p>Easing power3.out</p>
|
|
</div>
|
|
</section>
|
|
|
|
<style>
|
|
.hf-transition-panel-reveal {
|
|
--hf-panel-open: 1;
|
|
width: var(--hf-panel-width, 360px);
|
|
overflow: hidden;
|
|
border: 1px solid var(--hf-panel-border, #e4e4e7);
|
|
border-radius: 14px;
|
|
background: var(--hf-panel-surface, #fff);
|
|
color: var(--hf-panel-text, #18181b);
|
|
font-family: Inter, system-ui, sans-serif;
|
|
box-shadow: 0 20px 56px rgba(24, 24, 27, 0.1);
|
|
}
|
|
.hf-transition-panel-reveal header {
|
|
padding: 15px 17px;
|
|
font-weight: 900;
|
|
}
|
|
.hf-transition-panel-reveal div {
|
|
max-height: calc(var(--hf-panel-open) * 120px);
|
|
opacity: calc(1 - var(--hf-panel-fade, 1) * (1 - var(--hf-panel-open)));
|
|
padding: 0 17px calc(var(--hf-panel-open) * 17px);
|
|
overflow: hidden;
|
|
}
|
|
.hf-transition-panel-reveal p {
|
|
margin: 0 0 8px;
|
|
color: var(--hf-panel-muted, #71717a);
|
|
font-size: 14px;
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
(function () {
|
|
"use strict";
|
|
|
|
var vars =
|
|
window.__hyperframes && window.__hyperframes.getVariables
|
|
? window.__hyperframes.getVariables()
|
|
: {};
|
|
|
|
// Unrecognised overrides return to their declared defaults.
|
|
var widths = { narrow: "280px", standard: "360px", wide: "480px" };
|
|
var tones = {
|
|
paper: {
|
|
surface: "#fff",
|
|
border: "#e4e4e7",
|
|
text: "#18181b",
|
|
muted: "#71717a",
|
|
},
|
|
ink: {
|
|
surface: "#18181b",
|
|
border: "#3f3f46",
|
|
text: "#fafafa",
|
|
muted: "#a1a1aa",
|
|
},
|
|
};
|
|
var reveals = { fade: 1, solid: 0 };
|
|
|
|
function pick(table, value, fallback) {
|
|
return Object.prototype.hasOwnProperty.call(table, value) ? value : fallback;
|
|
}
|
|
|
|
var width = widths[pick(widths, vars.width, "standard")];
|
|
var tone = tones[pick(tones, vars.tone, "paper")];
|
|
var fade = reveals[pick(reveals, vars.reveal, "fade")];
|
|
|
|
var title = typeof vars.title === "string" ? vars.title.trim() : "";
|
|
if (!title) {
|
|
title = "Motion tokens";
|
|
}
|
|
|
|
var roots = document.querySelectorAll(".hf-transition-panel-reveal");
|
|
for (var i = 0; i < roots.length; i += 1) {
|
|
var root = roots[i];
|
|
root.style.setProperty("--hf-panel-width", width);
|
|
root.style.setProperty("--hf-panel-surface", tone.surface);
|
|
root.style.setProperty("--hf-panel-border", tone.border);
|
|
root.style.setProperty("--hf-panel-text", tone.text);
|
|
root.style.setProperty("--hf-panel-muted", tone.muted);
|
|
root.style.setProperty("--hf-panel-fade", String(fade));
|
|
|
|
var header = root.querySelector("header");
|
|
if (header) {
|
|
header.textContent = title;
|
|
}
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<!--
|
|
Timeline integration:
|
|
tl.fromTo('.hf-transition-panel-reveal', { '--hf-panel-open': 0 }, { '--hf-panel-open': 1, duration: 0.44, ease: 'power3.inOut' }, startTime);
|
|
-->
|