Skip to content

Commit 274f719

Browse files
committed
v14.0.5
1 parent 329c505 commit 274f719

File tree

7 files changed

+34
-4
lines changed

7 files changed

+34
-4
lines changed

build/cjs/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/esm/index.mjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

demo/.DS_Store

0 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gleap",
3-
"version": "14.0.4",
3+
"version": "14.0.5",
44
"main": "build/cjs/index.js",
55
"module": "build/esm/index.mjs",
66
"exports": {

published/14.0.5/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

published/latest/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ScreenCapture.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,30 @@ const handleAdoptedStyleSheets = (doc, clone, shadowNodeId) => {
351351
}
352352
};
353353

354+
const extractFinalCSSState = (element) => {
355+
if (element && typeof element.getAnimations === "function") {
356+
const animations = element.getAnimations();
357+
const finalCSSState = {};
358+
359+
animations.forEach((animation) => {
360+
const keyframes = animation.effect?.getKeyframes() || [];
361+
const finalKeyframe = keyframes[keyframes.length - 1] || {};
362+
363+
// Extract only the keys (CSS properties) from the final keyframe
364+
Object.keys(finalKeyframe).forEach((property) => {
365+
if (property !== 'offset') {
366+
// Store the computed style for each animated property
367+
finalCSSState[property] = getComputedStyle(element)[property];
368+
}
369+
});
370+
});
371+
372+
return JSON.stringify(finalCSSState);
373+
}
374+
375+
return null;
376+
};
377+
354378
const deepClone = async (host) => {
355379
let shadowNodeId = 1;
356380

@@ -364,6 +388,11 @@ const deepClone = async (host) => {
364388

365389
const clone = node.cloneNode();
366390

391+
const webAnimations = extractFinalCSSState(node);
392+
if (webAnimations != null) {
393+
clone.setAttribute("bb-web-animations", webAnimations);
394+
}
395+
367396
if (typeof clone.setAttribute !== "undefined") {
368397
if (shadowRoot) {
369398
clone.setAttribute("bb-shadow-child", shadowRoot);

0 commit comments

Comments
 (0)