mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-04 07:19:52 +00:00
resolveBindings: scan the full tree (boundVariables + style ids, alias chains, children) and partition exact-ID-only against the binding index before any CSS is emitted per spec 7.1 - never value matching. nodeToHtml: absolute geometry at figma bounds inside a fixed-size root, solid/linear-gradient fills, corner radius, opacity, drop shadow, blur, text styles; resolved bindings emit var(--slug, literal), unresolved bake literals with data-figma-unresolved; visible:false respected; vectors/boolean ops route to a rasterize list. hyperframes figma component: tree -> bindings -> html, rasterize fallback via Phase-1 asset export with src backfill, registry-item packaging, unresolved-binding guidance in output. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
16 lines
733 B
TypeScript
16 lines
733 B
TypeScript
import { exceedsFreezeCap, MAX_FREEZE_BYTES } from "@hyperframes/core/figma";
|
|
|
|
/** Fetch a short-lived figma CDN render url into bytes. */
|
|
export async function downloadRender(url: string): Promise<Uint8Array> {
|
|
const res = await fetch(url);
|
|
if (!res.ok) throw new Error(`figma render download failed: HTTP ${res.status}`);
|
|
// Reject oversized responses before buffering the body — the freeze cap
|
|
// alone only fires after the full allocation.
|
|
const declared = Number(res.headers.get("content-length") ?? 0);
|
|
if (exceedsFreezeCap(declared))
|
|
throw new Error(
|
|
`figma render download failed: content-length ${declared} exceeds ${MAX_FREEZE_BYTES} cap`,
|
|
);
|
|
return new Uint8Array(await res.arrayBuffer());
|
|
}
|