skeleton-ghost-loader 2.6.6 → 2.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,7 +2,9 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
const skeletonBgColors = {
|
|
4
4
|
text: "#ccc",
|
|
5
|
+
// lighter for text
|
|
5
6
|
box: "#e0e0e0"
|
|
7
|
+
// darker for boxes/buttons
|
|
6
8
|
};
|
|
7
9
|
const styleCache = {};
|
|
8
10
|
function getComputedStyleFromNode(node) {
|
|
@@ -14,7 +16,9 @@ function getComputedStyleFromNode(node) {
|
|
|
14
16
|
if (node.props.id) el.id = node.props.id;
|
|
15
17
|
if (node.props.className) el.className = node.props.className;
|
|
16
18
|
if (node.props.style) {
|
|
17
|
-
Object.entries(node.props.style).forEach(([k, v]) =>
|
|
19
|
+
Object.entries(node.props.style).forEach(([k, v]) => {
|
|
20
|
+
el.style[k] = v;
|
|
21
|
+
});
|
|
18
22
|
}
|
|
19
23
|
el.style.display = "none";
|
|
20
24
|
document.body.appendChild(el);
|
|
@@ -56,10 +60,6 @@ const SkeletonBlock = ({ children }) => {
|
|
|
56
60
|
delete newProps.skeletonrequired;
|
|
57
61
|
newProps.style = style;
|
|
58
62
|
}
|
|
59
|
-
if (typeof node.type === "function") {
|
|
60
|
-
const element = React.createElement(node.type, node.props);
|
|
61
|
-
return traverse(element);
|
|
62
|
-
}
|
|
63
63
|
const childrenNodes = React.Children.map(node.props.children, traverse);
|
|
64
64
|
return React.cloneElement(node, newProps, childrenNodes);
|
|
65
65
|
}
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
"use strict";
|
|
5
5
|
const skeletonBgColors = {
|
|
6
6
|
text: "#ccc",
|
|
7
|
+
// lighter for text
|
|
7
8
|
box: "#e0e0e0"
|
|
9
|
+
// darker for boxes/buttons
|
|
8
10
|
};
|
|
9
11
|
const styleCache = {};
|
|
10
12
|
function getComputedStyleFromNode(node) {
|
|
@@ -16,7 +18,9 @@
|
|
|
16
18
|
if (node.props.id) el.id = node.props.id;
|
|
17
19
|
if (node.props.className) el.className = node.props.className;
|
|
18
20
|
if (node.props.style) {
|
|
19
|
-
Object.entries(node.props.style).forEach(([k, v]) =>
|
|
21
|
+
Object.entries(node.props.style).forEach(([k, v]) => {
|
|
22
|
+
el.style[k] = v;
|
|
23
|
+
});
|
|
20
24
|
}
|
|
21
25
|
el.style.display = "none";
|
|
22
26
|
document.body.appendChild(el);
|
|
@@ -58,10 +62,6 @@
|
|
|
58
62
|
delete newProps.skeletonrequired;
|
|
59
63
|
newProps.style = style;
|
|
60
64
|
}
|
|
61
|
-
if (typeof node.type === "function") {
|
|
62
|
-
const element = React.createElement(node.type, node.props);
|
|
63
|
-
return traverse(element);
|
|
64
|
-
}
|
|
65
65
|
const childrenNodes = React.Children.map(node.props.children, traverse);
|
|
66
66
|
return React.cloneElement(node, newProps, childrenNodes);
|
|
67
67
|
}
|