Skip to content

Commit

Permalink
v14.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Oct 9, 2024
1 parent 329c505 commit 274f719
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build/cjs/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/esm/index.mjs

Large diffs are not rendered by default.

Binary file modified demo/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gleap",
"version": "14.0.4",
"version": "14.0.5",
"main": "build/cjs/index.js",
"module": "build/esm/index.mjs",
"exports": {
Expand Down
1 change: 1 addition & 0 deletions published/14.0.5/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion published/latest/index.js

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions src/ScreenCapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,30 @@ const handleAdoptedStyleSheets = (doc, clone, shadowNodeId) => {
}
};

const extractFinalCSSState = (element) => {
if (element && typeof element.getAnimations === "function") {
const animations = element.getAnimations();
const finalCSSState = {};

animations.forEach((animation) => {
const keyframes = animation.effect?.getKeyframes() || [];
const finalKeyframe = keyframes[keyframes.length - 1] || {};

// Extract only the keys (CSS properties) from the final keyframe
Object.keys(finalKeyframe).forEach((property) => {
if (property !== 'offset') {
// Store the computed style for each animated property
finalCSSState[property] = getComputedStyle(element)[property];
}
});
});

return JSON.stringify(finalCSSState);
}

return null;
};

const deepClone = async (host) => {
let shadowNodeId = 1;

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

const clone = node.cloneNode();

const webAnimations = extractFinalCSSState(node);
if (webAnimations != null) {
clone.setAttribute("bb-web-animations", webAnimations);
}

if (typeof clone.setAttribute !== "undefined") {
if (shadowRoot) {
clone.setAttribute("bb-shadow-child", shadowRoot);
Expand Down

0 comments on commit 274f719

Please sign in to comment.