skeleton-ghost-loader 2.1.1 → 2.2.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.
|
@@ -635,9 +635,7 @@ function hr(p) {
|
|
|
635
635
|
const R = typeof p.type == "string" ? p.type : "div", _ = `${R}-${p.props.id || ""}-${p.props.className || ""}`;
|
|
636
636
|
if (Q[_]) return Q[_];
|
|
637
637
|
const l = document.createElement(R);
|
|
638
|
-
p.props.id && (l.id = p.props.id), p.props.className && (l.className = p.props.className), p.props.style && Object.entries(p.props.style).forEach(([T, h]) =>
|
|
639
|
-
l.style[T] = h;
|
|
640
|
-
}), l.style.display = "none", document.body.appendChild(l);
|
|
638
|
+
p.props.id && (l.id = p.props.id), p.props.className && (l.className = p.props.className), p.props.style && Object.entries(p.props.style).forEach(([T, h]) => l.style[T] = h), l.style.display = "none", document.body.appendChild(l);
|
|
641
639
|
const f = window.getComputedStyle(l), s = {
|
|
642
640
|
height: f.height || void 0,
|
|
643
641
|
width: f.width || "100%",
|
|
@@ -27,7 +27,7 @@ Check the top-level render call using <`+t+">.")}return r}}function Pe(e,r){{if(
|
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,te,k,yr,k),je[k+te]=!0}}return e===s?dr(v):cr(v),v}}function vr(e,r,t){return ke(e,r,t,!0)}function pr(e,r,t){return ke(e,r,t,!1)}var gr=pr,hr=vr;I.Fragment=s,I.jsx=gr,I.jsxs=hr}()),I}process.env.NODE_ENV==="production"?q.exports=Fe():q.exports=Ae();var J=q.exports;const M={text:"#ccc",box:"#e0e0e0"},K={};function $e(f){if(typeof document>"u")return{};const y=typeof f.type=="string"?f.type:"div",E=`${y}-${f.props.id||""}-${f.props.className||""}`;if(K[E])return K[E];const s=document.createElement(y);f.props.id&&(s.id=f.props.id),f.props.className&&(s.className=f.props.className),f.props.style&&Object.entries(f.props.style).forEach(([S,g])=>
|
|
30
|
+
<%s key={someKey} {...props} />`,te,k,yr,k),je[k+te]=!0}}return e===s?dr(v):cr(v),v}}function vr(e,r,t){return ke(e,r,t,!0)}function pr(e,r,t){return ke(e,r,t,!1)}var gr=pr,hr=vr;I.Fragment=s,I.jsx=gr,I.jsxs=hr}()),I}process.env.NODE_ENV==="production"?q.exports=Fe():q.exports=Ae();var J=q.exports;const M={text:"#ccc",box:"#e0e0e0"},K={};function $e(f){if(typeof document>"u")return{};const y=typeof f.type=="string"?f.type:"div",E=`${y}-${f.props.id||""}-${f.props.className||""}`;if(K[E])return K[E];const s=document.createElement(y);f.props.id&&(s.id=f.props.id),f.props.className&&(s.className=f.props.className),f.props.style&&Object.entries(f.props.style).forEach(([S,g])=>s.style[S]=g),s.style.display="none",document.body.appendChild(s);const c=window.getComputedStyle(s),u={height:c.height||void 0,width:c.width||"100%",fontSize:c.fontSize||void 0,margin:c.margin||"0",padding:c.padding||"0",borderRadius:c.borderRadius||"4px"};return document.body.removeChild(s),K[E]=u,u}const ie=({children:f})=>{function y(s){if(!N.isValidElement(s))return s;if(typeof s.type=="string"){const c={...s.props};let u={...c.style};if(c.skeletonrequired==="y"){const g=$e(s);u.height=u.height||c.height||g.height||"20px",u.width=u.width||c.width||g.width||"100%",u.fontSize=u.fontSize||c.fontSize||g.fontSize||"16px",u.margin=u.margin||c.margin||g.margin||"0",u.padding=u.padding||c.padding||g.padding||"0",u.borderRadius=u.borderRadius||g.borderRadius||"4px";const p=s.type,T=["p","span","h1","h2","h3","h4","h5","h6"].includes(p);u.backgroundColor=T?M.text:M.box,u.color="transparent",u.position="relative",u.overflow="hidden";const h=T?M.text:M.box;u.backgroundImage=`linear-gradient(90deg, ${h} 0%, #f5f5f5 50%, ${h} 100%)`,u.backgroundSize="200% 100%",u.animation="shimmer 1.5s infinite",delete c.skeletonrequired,c.style=u}const S=N.Children.map(s.props.children,y);return N.cloneElement(s,c,S)}return s}const E=N.Children.map(f,y);return J.jsxs(J.Fragment,{children:[J.jsx("style",{children:`
|
|
31
31
|
@keyframes shimmer {
|
|
32
32
|
0% { background-position: -200% 0; }
|
|
33
33
|
100% { background-position: 200% 0; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "skeleton-ghost-loader",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.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",
|
|
@@ -8,13 +8,6 @@
|
|
|
8
8
|
"main": "dist/skeleton-loader.umd.js",
|
|
9
9
|
"module": "dist/skeleton-loader.es.js",
|
|
10
10
|
"types": "types/index.d.ts",
|
|
11
|
-
"exports": {
|
|
12
|
-
".": {
|
|
13
|
-
"import": "./dist/skeleton-loader.es.js",
|
|
14
|
-
"require": "./dist/skeleton-loader.umd.js",
|
|
15
|
-
"types": "./types/index.d.ts"
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
11
|
"files": [
|
|
19
12
|
"dist",
|
|
20
13
|
"types"
|