MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / handleSetClassStyle

Function handleSetClassStyle

packages/sdk/src/engine/mutate.ts:970–986  ·  view source on GitHub ↗
(
  parsed: ParsedDocument,
  selector: string,
  styles: Record<string, string | null>,
)

Source from the content-addressed store, hash-verified

968// ─── setClassStyle handler ────────────────────────────────────────────────────
969
970function handleSetClassStyle(
971 parsed: ParsedDocument,
972 selector: string,
973 styles: Record<string, string | null>,
974): MutationResult {
975 const oldCss = getStyleSheet(parsed.document);
976 const newCss = upsertCssRule(oldCss, selector, styles);
977 if (newCss === oldCss) return EMPTY;
978 setStyleSheet(parsed.document, newCss);
979 const path = styleSheetPath();
980 return {
981 forward: [
982 oldCss === "" ? { op: "add", path, value: newCss } : { op: "replace", path, value: newCss },
983 ],
984 inverse: [oldCss === "" ? { op: "remove", path } : { op: "replace", path, value: oldCss }],
985 };
986}
987
988// ─── GSAP script patch helpers ───────────────────────────────────────────────
989

Callers 1

applyOpFunction · 0.85

Calls 4

getStyleSheetFunction · 0.85
upsertCssRuleFunction · 0.85
setStyleSheetFunction · 0.85
styleSheetPathFunction · 0.85

Tested by

no test coverage detected