( parsed: ParsedDocument, selector: string, styles: Record<string, string | null>, )
| 968 | // ─── setClassStyle handler ──────────────────────────────────────────────────── |
| 969 | |
| 970 | function 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 |
no test coverage detected