mirror of
https://github.com/hanzoai/frames.git
synced 2026-09-24 00:08:03 +00:00
Forked from HyperFrames (Apache-2.0), full history preserved. Hosts are mapped explicitly and BEFORE the identifier rename, because hyperframes.heygen.com is not decoration: 175 of its occurrences are $schema identifiers that a validator dereferences. A blind rename would have left them naming a host that never serves them. The schema files are in this repo under docs/schema, so the mapped host is one we can actually serve -- that is the condition that makes the rewrite safe, and serving them is a deploy task, not an edit. docs/schema/hyperframes.json is renamed to frames.json to match the identifier it is now published under. api.heygen.com and the CLI auth against heygen.com are left UNRENAMED on purpose. They are a dependency on HeyGen's SaaS, not a name of ours to take, and the right move is to remove that integration rather than rebrand it. LICENSE and CREDITS.md are untouched; NOTICE records the lineage. Co-authored-by: Hanzo Dev <[email protected]>
39 lines
1.5 KiB
JavaScript
39 lines
1.5 KiB
JavaScript
// transition-registry.mjs — loader for this skill's vendored transition registry
|
|
// (./transitions.json). The registry is the curated Tier-B subset (transform /
|
|
// opacity / filter on the two frame clip wrappers `#el-<id>`, no overlay DOM) +
|
|
// each type's GSAP template. Vendored into the skill so it ships standalone; the
|
|
// recipes originate from the shared catalog skills/frames-animation/
|
|
// transitions/ (css-*.md) — keep them in step if those shared recipes change.
|
|
|
|
import { readFileSync } from "node:fs";
|
|
import { resolve, dirname } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
export const DEFAULT_REGISTRY_PATH = resolve(here, "./transitions.json");
|
|
|
|
let _cache = null;
|
|
|
|
export function loadTransitionRegistry(registryPath = DEFAULT_REGISTRY_PATH) {
|
|
if (_cache && _cache.path === registryPath) return _cache.data;
|
|
let data;
|
|
try {
|
|
data = JSON.parse(readFileSync(registryPath, "utf8"));
|
|
} catch (e) {
|
|
throw new Error(`transition registry not loadable at ${registryPath}: ${e.message}`);
|
|
}
|
|
if (!Array.isArray(data.transitions) || data.transitions.length === 0) {
|
|
throw new Error(`transition registry ${registryPath} has no transitions[]`);
|
|
}
|
|
_cache = { path: registryPath, data };
|
|
return data;
|
|
}
|
|
|
|
// Convenience: a Map name -> transition record.
|
|
export function transitionsByName(registryPath = DEFAULT_REGISTRY_PATH) {
|
|
const data = loadTransitionRegistry(registryPath);
|
|
const map = new Map();
|
|
for (const t of data.transitions) map.set(t.name, t);
|
|
return map;
|
|
}
|