mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 12:54:29 +00:00
## What PR 2/17 of the catalog system rollout. **Physical directory rename.** Stacks on #252. - `git mv templates/ registry/examples/` — all 8 example directories (`decision-tree`, `kinetic-type`, `nyt-graph`, `play-mode`, `product-promo`, `swiss-grid`, `vignelli`, `warm-grain`) plus `templates.json` - `packages/cli/src/templates/remote.ts` — `TEMPLATES_DIR` constant from `"templates"` → `"registry/examples"`, exported for regression testing - `scripts/generate-template-previews.ts` — `remoteTemplatesDir` resolved to the new path - Comment updates in `packages/cli/src/templates/generators.ts` and `packages/cli/src/commands/init.ts` - New regression test `packages/cli/src/templates/remote.test.ts` pinning the path constants so future reverts fail a test instead of silently breaking installed CLIs Design doc: [Hyperframes Catalog System](https://www.notion.so/heygen/Hyperframes-Catalog-System-Design-Plan-341449792c69813f899dcd53b4c0383a). ## Why The current `templates/` directory is a flat "things that scaffold projects" bucket. The catalog model splits content into three tiers: **examples** (full projects — what today's templates are), **blocks** (sub-compositions), and **components** (effect snippets). `registry/examples/` is the canonical home for what was previously at `templates/`, and this PR makes room for `registry/blocks/` and `registry/components/` in future PRs without top-level clutter. ## How - `git mv` preserves file history — GitHub renders these as renames, not deletions + additions. - Remote template fetch via giget reads `TEMPLATES_DIR`, so updating that one constant is sufficient for the CLI's remote code path. - The CLI's **internal** `packages/cli/src/templates/` directory (which holds the `blank` and `_shared` bundled assets plus `generators.ts`/`remote.ts`) is a separate concept and is **not** touched here. Renaming that module belongs to PR 3 where the abstraction changes to a registry resolver. - `templates.json` keeps its existing shape and location (now at `registry/examples/templates.json`). **PR 3 will transform it** to the new `registry.json` shape introduced in PR 1 and generate a per-item `registry-item.json` for each example. Leaving the shape change to PR 3 keeps this PR a pure physical move. ## ⚠️ Breaking change for previously-installed CLIs (`hyperframes@0.1.0` – `0.3.0`) **What happens:** every published CLI version has `TEMPLATES_DIR = "templates"` baked in. After this PR lands on `main`, those CLIs will 404 on: - `raw.githubusercontent.com/heygen-com/hyperframes/main/templates/templates.json` (manifest list) — caught silently in `listRemoteTemplates`, so the template picker falls back to showing only `blank` - `github:heygen-com/hyperframes/templates/<id>#main` (giget download) — raises "Template downloaded but missing index.html" **Decision: accept the break.** Hyperframes is pre-1.0 OSS with a small installed base; complex mitigations (dual-path fetch, redirect stubs, manifest-at-old-path with empty array) add permanent maintenance cost for a one-time rename. **Rollout plan:** 1. Merge #252 (PR 1 — types & schemas) first 2. Merge this PR (#253) 3. Ship a patched CLI release (`hyperframes@0.3.1`) in the same work-day. Already-pinned old CLIs break on remote examples, but upgrading restores full functionality 4. Note the break in release notes + `CHANGELOG.md` under the `0.3.1` entry Users still on an older CLI will see the failure only if they invoke `hyperframes init` with `--template <non-blank>`; `--template blank` (bundled) continues to work offline on every version. ## Test plan - [x] `bun run test` in `packages/cli`: **57 passed** (was 55 on main, +2 regression tests for the path constants). Same 4 pre-existing failures (SRT/VTT whisper normalizer + `lintProject` clean-project test) — unchanged from main. No regressions - [x] **Manual smoke test**: `hyperframes init /tmp/x --template blank` works (bundled code path, unchanged) - [x] `bunx oxfmt --check` + `bunx oxlint`: clean - [x] `bun run typecheck` (core + studio, pre-commit hook): clean - [ ] **Manual smoke test for remote fetch (`--template warm-grain`)** — not verifiable locally before merge. Remote fetch resolves `github:heygen-com/hyperframes/registry/examples/<id>#main`, which doesn't exist until this PR lands. Will work on `main` immediately after merge. ## Breaking / migration - Internal repo path changes only. `--template` CLI flag continues to accept the same template names. - See "Breaking change for previously-installed CLIs" above — decision is to ship a simultaneous CLI release rather than add a compat shim. ## Commits 1. `d691bd1` — initial rename + CLI path constant update 2. `fc0c642` — review feedback: docstring fix, regression tests, clarifying comment in `init.ts`, export constants for testing ## Stacks on #252 — base branch. When #252 merges, this rebases onto `main`. ## Next in stack PR 3 — `feat(cli): registry resolver + installer`. Transforms `templates.json` to the new `registry.json` shape (from PR 1's schema), generates `registry-item.json` for every existing example, introduces `packages/cli/src/registry/{resolver,installer,remote}.ts`, renames the `packages/cli/src/templates/` CLI module, and refactors `init` to call through the new abstraction. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
435 lines
13 KiB
HTML
Vendored
435 lines
13 KiB
HTML
Vendored
<template id="decision-tree-template">
|
|
<div data-composition-id="decision-tree" data-width="1920" data-height="1080" data-duration="12">
|
|
<div class="canvas">
|
|
<svg class="connectors" width="1920" height="1080" viewBox="0 0 1920 1080">
|
|
<!-- Level 1 to 2 -->
|
|
<path
|
|
id="path-1-L"
|
|
class="connector"
|
|
d="M 960 130 L 960 200 L 600 200 L 600 270"
|
|
fill="none"
|
|
stroke="#333"
|
|
stroke-width="4"
|
|
/>
|
|
<path
|
|
id="path-1-R"
|
|
class="connector"
|
|
d="M 960 130 L 960 200 L 1320 200 L 1320 270"
|
|
fill="none"
|
|
stroke="#333"
|
|
stroke-width="4"
|
|
/>
|
|
|
|
<!-- Level 2 to 3 (Left side) -->
|
|
<path
|
|
id="path-2-LL"
|
|
class="connector"
|
|
d="M 600 330 L 600 400 L 400 400 L 400 470"
|
|
fill="none"
|
|
stroke="#333"
|
|
stroke-width="4"
|
|
/>
|
|
<path
|
|
id="path-2-LR"
|
|
class="connector"
|
|
d="M 600 330 L 600 400 L 800 400 L 800 470"
|
|
fill="none"
|
|
stroke="#333"
|
|
stroke-width="4"
|
|
/>
|
|
|
|
<!-- Level 2 to 3 (Right side) -->
|
|
<path
|
|
id="path-2-RL"
|
|
class="connector"
|
|
d="M 1320 330 L 1320 400 L 1120 400 L 1120 470"
|
|
fill="none"
|
|
stroke="#333"
|
|
stroke-width="4"
|
|
/>
|
|
<path
|
|
id="path-2-RR"
|
|
class="connector"
|
|
d="M 1320 330 L 1320 400 L 1520 400 L 1520 470"
|
|
fill="none"
|
|
stroke="#333"
|
|
stroke-width="4"
|
|
/>
|
|
</svg>
|
|
|
|
<div id="label-yes" class="connector-label">Yes</div>
|
|
<div id="label-not-sure" class="connector-label">Not sure</div>
|
|
|
|
<!-- Level 1 -->
|
|
<div id="node-root" class="node sticky yellow" style="left: 960px; top: 100px">
|
|
Should I learn to code?
|
|
</div>
|
|
|
|
<!-- Level 2 -->
|
|
<div id="node-yes" class="node sticky green" style="left: 600px; top: 300px">Yes</div>
|
|
<div id="node-not-sure" class="node sticky peach" style="left: 1320px; top: 300px">
|
|
Not sure
|
|
</div>
|
|
|
|
<!-- Level 3 -->
|
|
<div id="node-python" class="node sticky lavender" style="left: 400px; top: 500px">
|
|
<div style="position: relative; display: inline-block">
|
|
<span id="python-text">Start with Pythom</span>
|
|
<svg class="squiggle-container" width="64" height="6" viewBox="0 0 64 6">
|
|
<path
|
|
id="squiggle"
|
|
d="M 0 3 Q 2 0 4 3 T 8 3 T 12 3 T 16 3 T 20 3 T 24 3 T 28 3 T 32 3 T 36 3 T 40 3 T 44 3 T 48 3 T 52 3 T 56 3 T 60 3 T 64 3"
|
|
fill="none"
|
|
stroke="#E53935"
|
|
stroke-width="2"
|
|
/>
|
|
</svg>
|
|
</div>
|
|
</div>
|
|
<div id="node-nocode" class="node sticky blue" style="left: 800px; top: 500px">
|
|
Try no-code first
|
|
</div>
|
|
<div id="node-website" class="node sticky pink" style="left: 1120px; top: 500px">
|
|
Build a personal website
|
|
</div>
|
|
<div id="node-course" class="node sticky yellow" style="left: 1520px; top: 500px">
|
|
Take a free intro course
|
|
</div>
|
|
|
|
<!-- Cursor -->
|
|
<div id="cursor" class="cursor-container">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
<path
|
|
d="M5.65376 12.3673H5.46026L5.31717 12.4976L0.500002 16.8829L0.500002 1.19841L11.7841 12.3673H5.65376Z"
|
|
fill="white"
|
|
stroke="black"
|
|
/>
|
|
</svg>
|
|
<div class="cursor-tag">You</div>
|
|
</div>
|
|
|
|
<!-- Emoji -->
|
|
<div id="emoji-thumb" class="emoji">👍</div>
|
|
|
|
<!-- Overlay -->
|
|
<div id="fade-overlay"></div>
|
|
</div>
|
|
|
|
<style>
|
|
[data-composition-id="decision-tree"] {
|
|
width: 1920px;
|
|
height: 1080px;
|
|
background-color: #ffffff;
|
|
background-image: radial-gradient(#e5e5e5 1px, transparent 1px);
|
|
background-size: 20px 20px;
|
|
position: absolute;
|
|
overflow: hidden;
|
|
font-family: "Inter", sans-serif;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .canvas {
|
|
width: 100%;
|
|
height: 100%;
|
|
position: absolute;
|
|
transform: scale(1.2);
|
|
transform-origin: 960px 300px;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .node {
|
|
position: absolute;
|
|
transform: translate(-50%, -50%) scale(0);
|
|
padding: 16px 24px;
|
|
border-radius: 12px;
|
|
font-size: 18px;
|
|
font-weight: 500;
|
|
color: #333;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
white-space: nowrap;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 10;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .node.yellow {
|
|
background-color: #e8d44d;
|
|
}
|
|
[data-composition-id="decision-tree"] .node.green {
|
|
background-color: #c2e8a0;
|
|
}
|
|
[data-composition-id="decision-tree"] .node.peach {
|
|
background-color: #f5c5a3;
|
|
}
|
|
[data-composition-id="decision-tree"] .node.lavender {
|
|
background-color: #d4c5f9;
|
|
}
|
|
[data-composition-id="decision-tree"] .node.blue {
|
|
background-color: #a8d8f0;
|
|
}
|
|
[data-composition-id="decision-tree"] .node.pink {
|
|
background-color: #f8b4c8;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .connectors {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
z-index: 5;
|
|
pointer-events: none;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .connector {
|
|
stroke-dasharray: 1000;
|
|
stroke-dashoffset: 1000;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .connector-label {
|
|
position: absolute;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: #333;
|
|
background: white;
|
|
padding: 2px 6px;
|
|
border-radius: 4px;
|
|
opacity: 0;
|
|
z-index: 6;
|
|
transform: translate(-50%, -50%);
|
|
}
|
|
|
|
#label-yes {
|
|
left: 780px;
|
|
top: 230px;
|
|
}
|
|
#label-not-sure {
|
|
left: 1140px;
|
|
top: 230px;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .cursor-container {
|
|
position: absolute;
|
|
left: 1920px;
|
|
top: 1080px;
|
|
z-index: 100;
|
|
pointer-events: none;
|
|
display: flex;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .cursor-tag {
|
|
background-color: #9747ff;
|
|
color: white;
|
|
padding: 2px 8px;
|
|
border-radius: 4px;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
margin-left: 4px;
|
|
margin-top: 12px;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .squiggle-container {
|
|
position: absolute;
|
|
right: 0;
|
|
bottom: -4px;
|
|
opacity: 0;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] .emoji {
|
|
position: absolute;
|
|
font-size: 32px;
|
|
left: 510px;
|
|
top: 500px;
|
|
transform: translate(-50%, -50%) scale(0);
|
|
z-index: 20;
|
|
}
|
|
|
|
[data-composition-id="decision-tree"] #fade-overlay {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: white;
|
|
opacity: 0;
|
|
z-index: 1000;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.selection-border {
|
|
position: absolute;
|
|
top: -4px;
|
|
left: -4px;
|
|
right: -4px;
|
|
bottom: -4px;
|
|
border: 2px solid #0b84f3;
|
|
border-radius: 16px;
|
|
pointer-events: none;
|
|
opacity: 0;
|
|
}
|
|
|
|
.text-highlight {
|
|
background-color: #d0e4ff;
|
|
}
|
|
</style>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
|
|
<script>
|
|
(function () {
|
|
const tl = gsap.timeline({ paused: true });
|
|
|
|
// 1. Root node scales from 0→100% over 0.4s
|
|
tl.to("#node-root", { scale: 1, duration: 0.4, ease: "power2.out" });
|
|
|
|
// 2. Hold 0.6s
|
|
tl.addLabel("hold1", "+=0.6");
|
|
|
|
// 3. Two elbow connectors draw downward-left and downward-right simultaneously (0.5s)
|
|
tl.to(
|
|
".connector#path-1-L, .connector#path-1-R",
|
|
{
|
|
strokeDashoffset: 0,
|
|
duration: 0.5,
|
|
ease: "none",
|
|
},
|
|
"hold1",
|
|
);
|
|
|
|
// Labels fade in at midpoint
|
|
tl.to(
|
|
"#label-yes, #label-not-sure",
|
|
{
|
|
opacity: 1,
|
|
duration: 0.2,
|
|
},
|
|
"hold1+=0.25",
|
|
);
|
|
|
|
// 4. Level 2 nodes scale in at endpoints with 0.2s stagger
|
|
tl.to("#node-yes", { scale: 1, duration: 0.4, ease: "back.out(1.7)" }, "hold1+=0.4");
|
|
tl.to("#node-not-sure", { scale: 1, duration: 0.4, ease: "back.out(1.7)" }, "hold1+=0.6");
|
|
|
|
// 5. Hold 0.5s
|
|
tl.addLabel("hold2", "+=0.5");
|
|
|
|
// 6. Four connectors draw down from level 2 (0.4s)
|
|
tl.to(
|
|
".connector#path-2-LL, .connector#path-2-LR, .connector#path-2-RL, .connector#path-2-RR",
|
|
{
|
|
strokeDashoffset: 0,
|
|
duration: 0.4,
|
|
ease: "none",
|
|
},
|
|
"hold2",
|
|
);
|
|
|
|
// 7. Four leaf nodes scale in with 0.15s stagger
|
|
const leafNodes = ["#node-python", "#node-nocode", "#node-website", "#node-course"];
|
|
leafNodes.forEach((id, i) => {
|
|
tl.to(id, { scale: 1, duration: 0.4, ease: "back.out(1.7)" }, `hold2+=${0.3 + i * 0.15}`);
|
|
});
|
|
|
|
// Red wavy underline appears with text
|
|
tl.to(".squiggle-container", { opacity: 1, duration: 0.1 }, "hold2+=0.3");
|
|
|
|
// 8. Hold 0.8s
|
|
tl.addLabel("hold3", "+=0.8");
|
|
|
|
// 9. Cursor drifts in from bottom-right (1s) to lavender sticky
|
|
tl.to(
|
|
"#cursor",
|
|
{
|
|
left: 450,
|
|
top: 540,
|
|
duration: 1,
|
|
ease: "power1.inOut",
|
|
},
|
|
"hold3",
|
|
);
|
|
|
|
// 10. Cursor clicks. Selection border appears.
|
|
tl.add(() => {
|
|
const node = document.querySelector("#node-python");
|
|
if (!node) return;
|
|
if (!node.querySelector(".selection-border")) {
|
|
const border = document.createElement("div");
|
|
border.className = "selection-border";
|
|
node.appendChild(border);
|
|
}
|
|
gsap.set(".selection-border", { opacity: 1 });
|
|
}, "hold3+=1");
|
|
|
|
// Visual click feedback
|
|
tl.to(
|
|
"#cursor",
|
|
{ scale: 0.8, duration: 0.05, yoyo: true, repeat: 1, overwrite: "auto" },
|
|
"hold3+=1",
|
|
);
|
|
|
|
// 11. Hold 0.3s
|
|
tl.addLabel("hold4", "+=0.3");
|
|
|
|
// 12. Cursor double-clicks "Pythom" — highlight in blue
|
|
tl.to(
|
|
"#cursor",
|
|
{ scale: 0.8, duration: 0.05, yoyo: true, repeat: 3, overwrite: "auto" },
|
|
"hold4",
|
|
);
|
|
tl.add(() => {
|
|
const textEl = document.querySelector("#python-text");
|
|
if (!textEl) return;
|
|
textEl.innerHTML = 'Start with <span class="text-highlight">Pythom</span>';
|
|
}, "hold4+=0.1");
|
|
|
|
// 13. Hold 0.2s
|
|
tl.addLabel("hold5", "+=0.2");
|
|
|
|
// 14. Highlighted text deletes and "Python" types in (fast)
|
|
// Squiggle disappears when last char lands
|
|
const typingStart = tl.labels["hold5"];
|
|
const words = ["P", "Py", "Pyt", "Pyth", "Pytho", "Python"];
|
|
words.forEach((word, i) => {
|
|
tl.add(
|
|
() => {
|
|
const el = document.querySelector("#python-text");
|
|
if (el) el.innerHTML = `Start with <span class="text-highlight">${word}</span>`;
|
|
},
|
|
typingStart + i * 0.05,
|
|
);
|
|
});
|
|
|
|
// Remove highlight and squiggle at the end of typing
|
|
const typingEnd = typingStart + words.length * 0.05;
|
|
tl.add(() => {
|
|
const pyEl = document.querySelector("#python-text");
|
|
if (pyEl) pyEl.innerHTML = "Start with Python";
|
|
gsap.set(".squiggle-container", { opacity: 0 });
|
|
}, typingEnd);
|
|
|
|
// 15. Hold 0.5s
|
|
tl.addLabel("hold6", typingEnd + 0.5);
|
|
|
|
// 16. Cursor moves slightly and clicks away to deselect
|
|
tl.to("#cursor", { left: 500, top: 580, duration: 0.3, overwrite: "auto" }, "hold6");
|
|
tl.to(
|
|
"#cursor",
|
|
{ scale: 0.8, duration: 0.05, yoyo: true, repeat: 1, overwrite: "auto" },
|
|
"hold6+=0.3",
|
|
);
|
|
tl.to(".selection-border", { opacity: 0, duration: 0.1 }, "hold6+=0.3");
|
|
|
|
// 17. 👍 emoji pops in
|
|
tl.to("#emoji-thumb", { scale: 1, duration: 0.15, ease: "back.out(2)" }, "hold6+=0.4");
|
|
|
|
// 18. Hold 2s
|
|
tl.addLabel("hold7", "+=2");
|
|
|
|
// 19. Fade entire screen to white over 0.5s
|
|
tl.to("#fade-overlay", { opacity: 1, duration: 0.5 }, "hold7");
|
|
|
|
window.__timelines = window.__timelines || {};
|
|
window.__timelines["decision-tree"] = tl;
|
|
})();
|
|
</script>
|
|
</div>
|
|
</template>
|