Files
hyperframes/packages/core/src/sceneParts.ts
T
Miguel Ángel 80667726e8 perf(core): a preview loads each web font once, not once per scene (#5806)
* perf(core): a preview loads each web font once, not once per scene

* test(core): count the bundle's font rules in its styles, not in the inlined runtime
2026-10-17 17:59:27 +00:00

18 lines
605 B
TypeScript

export const SCENE_PART_ATTR = "data-hf-scene";
export const SCENE_PARTS_META = "hf-scene-parts";
export const SCENE_FONTS_ATTR = "data-hf-scene-fonts";
export const fontFaceBlocks = (css: string): string[] =>
css.match(/@font-face\s*\{[^}]*\}/gi) ?? [];
/** On a scene's top-level host: why the scene cannot be swapped in place, so edits to it reload. */
export const SCENE_NO_SWAP_ATTR = "data-hf-scene-no-swap";
/** Hashes of one preview document: everything outside the scene parts, and each scene's parts. */
export interface SceneParts {
shared: string;
scenes: Record<string, string>;
}