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]>
51 lines
1.7 KiB
JavaScript
51 lines
1.7 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readdirSync, readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
import { fileURLToPath } from "node:url";
|
|
import { buildFromSkin } from "./captions.mjs";
|
|
|
|
const presetsDir = fileURLToPath(
|
|
new URL("../../frames-creative/frame-presets/", import.meta.url),
|
|
);
|
|
const skins = readdirSync(presetsDir, { withFileTypes: true })
|
|
.filter((entry) => entry.isDirectory())
|
|
.map((entry) => ({
|
|
name: entry.name,
|
|
source: readFileSync(
|
|
new URL(
|
|
`../../frames-creative/frame-presets/${entry.name}/caption-skin.html`,
|
|
import.meta.url,
|
|
),
|
|
"utf8",
|
|
),
|
|
}))
|
|
.filter(({ source }) => source.includes(".caption-word.is-active"));
|
|
|
|
for (const canvas of ["#f7f3e8", "#111827"]) {
|
|
for (const skin of skins) {
|
|
test(`${skin.name} preserves word-state rules on ${canvas}`, () => {
|
|
const active = skin.source.match(/\.caption-word\.is-active\s*\{[^}]*\}/s)?.[0];
|
|
const spoken = skin.source.match(/\.caption-word\.is-spoken\s*\{[^}]*\}/s)?.[0];
|
|
assert.ok(active, "skin must define an active-word rule");
|
|
assert.ok(spoken, "skin must define a spoken-word rule");
|
|
|
|
const output = buildFromSkin(
|
|
skin.source,
|
|
[],
|
|
1,
|
|
1920,
|
|
1080,
|
|
`:root { --cap-canvas: ${canvas}; --cap-ink: #111111; --cap-accent: #ffcc00; }`,
|
|
(message) => {
|
|
throw new Error(message);
|
|
},
|
|
);
|
|
|
|
assert.ok(output.includes(active));
|
|
assert.ok(output.includes(spoken));
|
|
assert.equal(output.match(/\.caption-word\.is-active\s*\{/g)?.length, 1);
|
|
assert.equal(output.match(/\.caption-word\.is-spoken\s*\{/g)?.length, 1);
|
|
});
|
|
}
|
|
}
|