docs(registry): add caption catalog pages and overflow protection

- Add 15 .mdx doc pages under docs/catalog/components/ for all caption styles
- Add "Captions" group as first section in the Catalog tab navigation
- Add canvas-based fitFontSize to 14 caption components to prevent text overflow
- Fix parallax-layers vertical clipping by repositioning the behind safe zone
- Re-render all 15 preview videos at high quality and upload to CDN
This commit is contained in:
Miguel Ángel
2026-05-17 17:03:42 -04:00
parent bced3b6d7e
commit b725066fb5
59 changed files with 1093 additions and 39 deletions
@@ -121,6 +121,19 @@
(function () {
window.__timelines = window.__timelines || {};
var _fitCanvas = document.createElement("canvas");
var _fitCtx = _fitCanvas.getContext("2d");
function fitFontSize(text, baseFontSize, fontWeight, fontFamily, maxWidth) {
var size = baseFontSize;
var minSize = Math.floor(baseFontSize * 0.45);
while (size > minSize) {
_fitCtx.font = fontWeight + " " + size + "px " + fontFamily;
if (_fitCtx.measureText(text).width <= maxWidth) return size;
size -= 2;
}
return minSize;
}
function mulberry32(seed) {
return function () {
seed |= 0;
@@ -195,13 +208,16 @@
grp.className = "gl-group";
grp.id = "gl-grp-" + gi;
var groupText = groupWords.map(function (w) { return w.text.toUpperCase(); }).join(" ");
var computedSize = fitFontSize(groupText, BASE_FONT, "700", "Space Grotesk", 1720);
groupWords.forEach(function (w, i) {
var wi = g.wordStart + i;
var span = document.createElement("span");
span.className = "gl-word";
span.id = "gl-w-" + wi;
span.textContent = w.text.toUpperCase();
span.style.fontSize = BASE_FONT + "px";
span.style.fontSize = computedSize + "px";
grp.appendChild(span);
});
+17 -1
View File
@@ -121,6 +121,19 @@
(function () {
window.__timelines = window.__timelines || {};
var _fitCanvas = document.createElement("canvas");
var _fitCtx = _fitCanvas.getContext("2d");
function fitFontSize(text, baseFontSize, fontWeight, fontFamily, maxWidth) {
var size = baseFontSize;
var minSize = Math.floor(baseFontSize * 0.45);
while (size > minSize) {
_fitCtx.font = fontWeight + " " + size + "px " + fontFamily;
if (_fitCtx.measureText(text).width <= maxWidth) return size;
size -= 2;
}
return minSize;
}
function mulberry32(seed) {
return function () {
seed |= 0;
@@ -195,13 +208,16 @@
grp.className = "gl-group";
grp.id = "gl-grp-" + gi;
var groupText = groupWords.map(function (w) { return w.text.toUpperCase(); }).join(" ");
var computedSize = fitFontSize(groupText, BASE_FONT, "700", "Space Grotesk", 1720);
groupWords.forEach(function (w, i) {
var wi = g.wordStart + i;
var span = document.createElement("span");
span.className = "gl-word";
span.id = "gl-w-" + wi;
span.textContent = w.text.toUpperCase();
span.style.fontSize = BASE_FONT + "px";
span.style.fontSize = computedSize + "px";
grp.appendChild(span);
});
@@ -12,5 +12,5 @@
"type": "hyperframes:snippet"
}
],
"preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-glitch-rgb/preview.mp4"
"preview": "https://static.heygen.ai/hyperframes-oss/registry/components/caption-glitch-rgb/preview.mp4?v=1779051416"
}