mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-24 16:06:34 +00:00
* fix(lint): guard root_dimensions_mismatch against sub-compositions Sub-compositions mounted via data-composition-src are fetched with DOMParser and only their matched <template>/<body> subtree is imported into the live document. A sub-composition authored as a full standalone HTML document still carries its own <html>/<head>/<meta viewport>, but none of that ever reaches the rendering document, so a mismatch there was always a false positive. Guard the rule with options.isSubComposition, matching the sibling missing_timeline_registry rule's existing pattern. Split the warning wording: html/body CSS actually sizes the element that clips the root, but the CDP viewport is set from the root's own data-width/data-height (frameCapture.ts), never from <meta viewport>. A viewport-only mismatch is real drift but not a clipping risk. Co-Authored-By: Miguel Ángel <miguel.sierra@heygen.com> * fix(cli,parsers): consolidate scaffold resolution regexes into one definition applyResolutionPreset kept its own prefix-capturing regex literals for the html/body CSS size and meta viewport content, duplicating the same three patterns already defined in @hyperframes/parsers for lint's read-only root_dimensions_mismatch comparison. Merge to one definition per pattern that captures both the prefix (for in-place replace) and the digits (for comparison), so the two callers can no longer drift on where a scaffold's resolution lives. Existing applyResolutionPreset tests stay green. Co-Authored-By: Miguel Ángel <miguel.sierra@heygen.com> --------- Co-authored-by: Miguel Ángel <miguel.sierra@heygen.com>
17 lines
757 B
TypeScript
17 lines
757 B
TypeScript
/**
|
|
* Where a scaffolded project's canvas resolution lives besides the root's own
|
|
* data-width/data-height: the html/body CSS size and the meta viewport content.
|
|
*/
|
|
|
|
/** html/body CSS, width first. Groups 1/3 are the surrounding text, 2/4 the digits. */
|
|
export const HTML_BODY_CSS_WIDTH_FIRST_RE =
|
|
/(html\s*,\s*body\s*\{[^}]*?width:\s*)(\d+)px([^}]*?height:\s*)(\d+)px/i;
|
|
|
|
/** Same block, height authored first. */
|
|
export const HTML_BODY_CSS_HEIGHT_FIRST_RE =
|
|
/(html\s*,\s*body\s*\{[^}]*?height:\s*)(\d+)px([^}]*?width:\s*)(\d+)px/i;
|
|
|
|
/** Viewport meta content. Shared by lint (reads groups 2/4) and cli (replaces via 1/3). */
|
|
export const VIEWPORT_META_SIZE_RE =
|
|
/(<meta[^>]*name=["']viewport["'][^>]*content=["']width=)(\d+)(,\s*height=)(\d+)/i;
|