skeleton-ghost-loader 2.6.9 → 2.7.0

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.
@@ -26,8 +26,14 @@ function getComputedStyleFromNode(node) {
26
26
  height: cs.height,
27
27
  width: cs.width,
28
28
  fontSize: cs.fontSize,
29
- margin: cs.margin,
30
- padding: cs.padding,
29
+ marginTop: cs.marginTop,
30
+ marginBottom: cs.marginBottom,
31
+ marginLeft: cs.marginLeft,
32
+ marginRight: cs.marginRight,
33
+ paddingTop: cs.paddingTop,
34
+ paddingBottom: cs.paddingBottom,
35
+ paddingLeft: cs.paddingLeft,
36
+ paddingRight: cs.paddingRight,
31
37
  borderRadius: cs.borderRadius
32
38
  };
33
39
  document.body.removeChild(el);
@@ -56,13 +62,10 @@ const SkeletonBlock = ({ children }) => {
56
62
  const defaults = getComputedStyleFromNode(node);
57
63
  style.width = style.width || defaults.width || "100%";
58
64
  style.fontSize = style.fontSize || defaults.fontSize || "16px";
59
- style.margin = style.margin || defaults.margin || "0";
60
- style.padding = style.padding || defaults.padding || "0";
61
65
  style.borderRadius = style.borderRadius || defaults.borderRadius || "4px";
62
66
  if (isText) {
63
- const computedHeight = parseFloat(defaults.height || "0");
64
- style.height = computedHeight > 0 ? defaults.height : TEXT_HEIGHT_MAP[type] || "1em";
65
- style.minHeight = TEXT_HEIGHT_MAP[type] || "1em";
67
+ style.height = TEXT_HEIGHT_MAP[type];
68
+ style.minHeight = TEXT_HEIGHT_MAP[type];
66
69
  } else {
67
70
  style.height = style.height || defaults.height || "20px";
68
71
  }
@@ -85,10 +88,7 @@ const SkeletonBlock = ({ children }) => {
85
88
  if (typeof node.type === "function") {
86
89
  return traverse(node.type(newProps));
87
90
  }
88
- const childrenNodes = React.Children.map(
89
- node.props.children,
90
- traverse
91
- );
91
+ const childrenNodes = React.Children.map(node.props.children, traverse);
92
92
  return React.cloneElement(node, newProps, childrenNodes);
93
93
  }
94
94
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -28,8 +28,14 @@
28
28
  height: cs.height,
29
29
  width: cs.width,
30
30
  fontSize: cs.fontSize,
31
- margin: cs.margin,
32
- padding: cs.padding,
31
+ marginTop: cs.marginTop,
32
+ marginBottom: cs.marginBottom,
33
+ marginLeft: cs.marginLeft,
34
+ marginRight: cs.marginRight,
35
+ paddingTop: cs.paddingTop,
36
+ paddingBottom: cs.paddingBottom,
37
+ paddingLeft: cs.paddingLeft,
38
+ paddingRight: cs.paddingRight,
33
39
  borderRadius: cs.borderRadius
34
40
  };
35
41
  document.body.removeChild(el);
@@ -58,13 +64,10 @@
58
64
  const defaults = getComputedStyleFromNode(node);
59
65
  style.width = style.width || defaults.width || "100%";
60
66
  style.fontSize = style.fontSize || defaults.fontSize || "16px";
61
- style.margin = style.margin || defaults.margin || "0";
62
- style.padding = style.padding || defaults.padding || "0";
63
67
  style.borderRadius = style.borderRadius || defaults.borderRadius || "4px";
64
68
  if (isText) {
65
- const computedHeight = parseFloat(defaults.height || "0");
66
- style.height = computedHeight > 0 ? defaults.height : TEXT_HEIGHT_MAP[type] || "1em";
67
- style.minHeight = TEXT_HEIGHT_MAP[type] || "1em";
69
+ style.height = TEXT_HEIGHT_MAP[type];
70
+ style.minHeight = TEXT_HEIGHT_MAP[type];
68
71
  } else {
69
72
  style.height = style.height || defaults.height || "20px";
70
73
  }
@@ -87,10 +90,7 @@
87
90
  if (typeof node.type === "function") {
88
91
  return traverse(node.type(newProps));
89
92
  }
90
- const childrenNodes = React.Children.map(
91
- node.props.children,
92
- traverse
93
- );
93
+ const childrenNodes = React.Children.map(node.props.children, traverse);
94
94
  return React.cloneElement(node, newProps, childrenNodes);
95
95
  }
96
96
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skeleton-ghost-loader",
3
- "version": "2.6.9",
3
+ "version": "2.7.0",
4
4
  "description": "Smart skeleton loader that auto-detects styles (inline, class, Tailwind, browser defaults)",
5
5
  "author": "Shubh Patil",
6
6
  "license": "MIT",