skeleton-ghost-loader 2.6.5 → 2.6.7

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) {
@@ -27,7 +29,7 @@ function getComputedStyleFromNode(node) {
27
29
  fontSize: cs.fontSize || void 0,
28
30
  margin: cs.margin || "0",
29
31
  padding: cs.padding || "0",
30
- borderRadius: cs.borderRadius || "0px"
32
+ borderRadius: cs.borderRadius || "4px"
31
33
  };
32
34
  document.body.removeChild(el);
33
35
  styleCache[key] = computed;
@@ -39,7 +41,6 @@ const SkeletonBlock = ({ children }) => {
39
41
  let newProps = { ...node.props };
40
42
  let style = { ...newProps.style };
41
43
  if (newProps.skeletonrequired === "y" && typeof node.type === "string") {
42
- const type = node.type;
43
44
  const defaults = getComputedStyleFromNode(node);
44
45
  style.height = style.height || newProps.height || defaults.height || "20px";
45
46
  style.width = style.width || newProps.width || defaults.width || "100%";
@@ -47,7 +48,7 @@ const SkeletonBlock = ({ children }) => {
47
48
  style.margin = style.margin || newProps.margin || defaults.margin || "0";
48
49
  style.padding = style.padding || newProps.padding || defaults.padding || "0";
49
50
  style.borderRadius = style.borderRadius || defaults.borderRadius || "4px";
50
- const isText = ["p", "span", "h1", "h2", "h3", "h4", "h5", "h6"].includes(type);
51
+ const isText = ["p", "span", "h1", "h2", "h3", "h4", "h5", "h6"].includes(node.type);
51
52
  style.backgroundColor = isText ? skeletonBgColors.text : skeletonBgColors.box;
52
53
  style.color = "transparent";
53
54
  style.position = "relative";
@@ -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) {
@@ -29,7 +31,7 @@
29
31
  fontSize: cs.fontSize || void 0,
30
32
  margin: cs.margin || "0",
31
33
  padding: cs.padding || "0",
32
- borderRadius: cs.borderRadius || "0px"
34
+ borderRadius: cs.borderRadius || "4px"
33
35
  };
34
36
  document.body.removeChild(el);
35
37
  styleCache[key] = computed;
@@ -41,7 +43,6 @@
41
43
  let newProps = { ...node.props };
42
44
  let style = { ...newProps.style };
43
45
  if (newProps.skeletonrequired === "y" && typeof node.type === "string") {
44
- const type = node.type;
45
46
  const defaults = getComputedStyleFromNode(node);
46
47
  style.height = style.height || newProps.height || defaults.height || "20px";
47
48
  style.width = style.width || newProps.width || defaults.width || "100%";
@@ -49,7 +50,7 @@
49
50
  style.margin = style.margin || newProps.margin || defaults.margin || "0";
50
51
  style.padding = style.padding || newProps.padding || defaults.padding || "0";
51
52
  style.borderRadius = style.borderRadius || defaults.borderRadius || "4px";
52
- const isText = ["p", "span", "h1", "h2", "h3", "h4", "h5", "h6"].includes(type);
53
+ const isText = ["p", "span", "h1", "h2", "h3", "h4", "h5", "h6"].includes(node.type);
53
54
  style.backgroundColor = isText ? skeletonBgColors.text : skeletonBgColors.box;
54
55
  style.color = "transparent";
55
56
  style.position = "relative";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skeleton-ghost-loader",
3
- "version": "2.6.5",
3
+ "version": "2.6.7",
4
4
  "description": "Smart skeleton loader that auto-detects styles (inline, class, Tailwind, browser defaults)",
5
5
  "author": "Shubh Patil",
6
6
  "license": "MIT",