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

Function setElementStyles

packages/sdk/src/engine/model.ts:210–228  ·  view source on GitHub ↗
(el: Element, updates: Record<string, string | null>)

Source from the content-addressed store, hash-verified

208}
209
210export function setElementStyles(el: Element, updates: Record<string, string | null>): void {
211 const current = getElementStyles(el);
212 for (const [prop, value] of Object.entries(updates)) {
213 // Stored map is keyed camelCase (parseStyleAttr); custom props (--foo) stay
214 // verbatim. Normalize the incoming key the same way for both set and delete.
215 const key = toCamel(prop);
216 if (value === null) {
217 delete current[key];
218 } else {
219 current[key] = value;
220 }
221 }
222 const serialized = serializeStyleAttr(current);
223 if (serialized) {
224 el.setAttribute("style", serialized);
225 } else {
226 el.removeAttribute("style");
227 }
228}
229
230// ─── Text helpers ─────────────────────────────────────────────────────────────
231

Callers 5

mutate.test.tsFile · 0.85
applyOneFunction · 0.85
handleSetStyleFunction · 0.85
handleSetVariableValueFunction · 0.85

Calls 5

getElementStylesFunction · 0.85
toCamelFunction · 0.85
serializeStyleAttrFunction · 0.85
entriesMethod · 0.80
setAttributeMethod · 0.65

Tested by

no test coverage detected