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

Function flashElements

packages/core/src/runtime/bridge.ts:98–128  ·  view source on GitHub ↗

* Flash elements — briefly highlight them with a blue outline. * Used by the chat-canvas bridge to show what changed after an agent edit.

(selectors: string[], duration: number)

Source from the content-addressed store, hash-verified

96 * Used by the chat-canvas bridge to show what changed after an agent edit.
97 */
98function flashElements(selectors: string[], duration: number): void {
99 if (!document.getElementById("__hf-flash-styles")) {
100 const style = document.createElement("style");
101 style.id = "__hf-flash-styles";
102 style.textContent = `
103 .__hf-flash {
104 outline: 2px solid rgba(59, 130, 246, 0.6) !important;
105 outline-offset: 2px !important;
106 animation: __hf-flash-pulse ${duration}ms ease-out forwards !important;
107 }
108 @keyframes __hf-flash-pulse {
109 0% { outline-color: rgba(59, 130, 246, 0.8); }
110 100% { outline-color: transparent; }
111 }
112 `;
113 document.head.appendChild(style);
114 }
115
116 for (const selector of selectors) {
117 try {
118 const els = document.querySelectorAll(selector);
119 els.forEach((el) => {
120 el.classList.add("__hf-flash");
121 setTimeout(() => el.classList.remove("__hf-flash"), duration);
122 });
123 } catch (err) {
124 // Invalid selector — skip
125 swallow("bridge.flashElements.querySelector", err);
126 }
127 }
128}

Callers 1

handleFlashElementsFunction · 0.85

Calls 2

swallowFunction · 0.90
addMethod · 0.80

Tested by

no test coverage detected