@aejkatappaja/phantom-ui 0.6.1 → 0.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.
package/README.md CHANGED
@@ -174,7 +174,7 @@ function UserProfile({ userId }: { userId: string }) {
174
174
  });
175
175
 
176
176
  return (
177
- <phantom-ui loading={isLoading || undefined}>
177
+ <phantom-ui loading={isLoading}>
178
178
  <div className="card">
179
179
  <img src={user?.avatar ?? "/placeholder.png"} width="48" height="48" />
180
180
  <h3>{user?.name ?? "Placeholder Name"}</h3>
@@ -197,7 +197,7 @@ function UserProfile({ userId }: { userId: string }) {
197
197
  const { data: user, isLoading } = useSWR(`/api/users/${userId}`);
198
198
 
199
199
  return (
200
- <phantom-ui loading={isLoading || undefined}>
200
+ <phantom-ui loading={isLoading}>
201
201
  <div className="card">
202
202
  <img src={user?.avatar ?? "/placeholder.png"} width="48" height="48" />
203
203
  <h3>{user?.name ?? "Placeholder Name"}</h3>
@@ -219,7 +219,7 @@ const { data: users, isLoading } = useQuery({
219
219
  });
220
220
 
221
221
  return (
222
- <phantom-ui loading={isLoading || undefined} count={5} count-gap={8}>
222
+ <phantom-ui loading={isLoading} count={5} count-gap={8}>
223
223
  {isLoading ? (
224
224
  <div className="row">
225
225
  <img src="/placeholder.png" width="32" height="32" />
@@ -248,7 +248,7 @@ import "@aejkatappaja/phantom-ui";
248
248
 
249
249
  function ProfileCard({ user, isLoading }: Props) {
250
250
  return (
251
- <phantom-ui loading={isLoading || undefined} animation="pulse" reveal={0.3}>
251
+ <phantom-ui loading={isLoading} animation="pulse" reveal={0.3}>
252
252
  <div className="card">
253
253
  <img src={user?.avatar ?? "/placeholder.png"} className="avatar" />
254
254
  <h3>{user?.name ?? "Placeholder Name"}</h3>
@@ -261,7 +261,7 @@ function ProfileCard({ user, isLoading }: Props) {
261
261
  // List with repeat mode
262
262
  function UserList({ users, isLoading }: Props) {
263
263
  return (
264
- <phantom-ui loading={isLoading || undefined} count={5} count-gap={8}>
264
+ <phantom-ui loading={isLoading} count={5} count-gap={8}>
265
265
  <div className="row">
266
266
  <img src="/placeholder.png" width="32" height="32" />
267
267
  <span>Placeholder Name</span>
@@ -343,7 +343,7 @@ function ProfileCard() {
343
343
  const [loading, setLoading] = createSignal(true);
344
344
 
345
345
  return (
346
- <phantom-ui attr:loading={loading() || undefined} animation="shimmer" stagger={0.05}>
346
+ <phantom-ui attr:loading={loading()} animation="shimmer" stagger={0.05}>
347
347
  <div class="card">
348
348
  <img src="/avatar.png" class="avatar" />
349
349
  <h3>Ada Lovelace</h3>
@@ -162,7 +162,7 @@
162
162
  ${n}
163
163
  "
164
164
  ></div>
165
- `})}};p.styles=Tt,g([_({type:Boolean,reflect:!0})],p.prototype,"loading",2),g([_({attribute:"shimmer-color"})],p.prototype,"shimmerColor",2),g([_({attribute:"background-color"})],p.prototype,"backgroundColor",2),g([_({type:Number})],p.prototype,"duration",2),g([_({type:Number,attribute:"fallback-radius"})],p.prototype,"fallbackRadius",2),g([_({reflect:!0})],p.prototype,"animation",2),g([_({type:Number})],p.prototype,"stagger",2),g([_({type:Number})],p.prototype,"reveal",2),g([_({type:Number,converter:e=>Math.max(1,Math.round(Number(e)||1))})],p.prototype,"count",2),g([_({type:Number,attribute:"count-gap",converter:e=>Math.max(0,Number(e)||0)})],p.prototype,"countGap",2),g([it()],p.prototype,"_blocks",2),g([it()],p.prototype,"_revealing",2),p=g([$t("phantom-ui")],p);})();
165
+ `})}};p.styles=Tt,g([_({type:Boolean,reflect:!0,converter:{fromAttribute:e=>e!==null&&e!=="false",toAttribute:e=>e?"":null}})],p.prototype,"loading",2),g([_({attribute:"shimmer-color"})],p.prototype,"shimmerColor",2),g([_({attribute:"background-color"})],p.prototype,"backgroundColor",2),g([_({type:Number})],p.prototype,"duration",2),g([_({type:Number,attribute:"fallback-radius"})],p.prototype,"fallbackRadius",2),g([_({reflect:!0})],p.prototype,"animation",2),g([_({type:Number})],p.prototype,"stagger",2),g([_({type:Number})],p.prototype,"reveal",2),g([_({type:Number,converter:e=>Math.max(1,Math.round(Number(e)||1))})],p.prototype,"count",2),g([_({type:Number,attribute:"count-gap",converter:e=>Math.max(0,Number(e)||0)})],p.prototype,"countGap",2),g([it()],p.prototype,"_blocks",2),g([it()],p.prototype,"_revealing",2),p=g([$t("phantom-ui")],p);})();
166
166
  /*! Bundled license information:
167
167
 
168
168
  @lit/reactive-element/css-tag.js:
@@ -1,4 +1,4 @@
1
- var E=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var l=(n,r,e,o)=>{for(var t=o>1?void 0:o?O(r,e):r,i=n.length-1,a;i>=0;i--)(a=n[i])&&(t=(o?a(r,e,t):a(t))||t);return o&&t&&E(r,e,t),t};import{LitElement as N,html as g}from"lit";import{customElement as M,property as u,state as k}from"lit/decorators.js";import{styleMap as H}from"lit/directives/style-map.js";var R=new Set(["IMG","SVG","VIDEO","CANVAS","IFRAME","INPUT","TEXTAREA","BUTTON","HR"]),T=new Set(["BR","WBR","HR"]);function C(n){if(R.has(n.tagName))return!0;for(let r of n.children)if(!T.has(r.tagName))return!1;return!0}function S(n){for(let r of n.childNodes)if(r.nodeType===Node.TEXT_NODE&&r.textContent?.trim())return!0;return!1}function f(n,r){let e=[];function o(t){let i=t.getBoundingClientRect(),a=Number(t.getAttribute("data-shimmer-width"))||0,d=Number(t.getAttribute("data-shimmer-height"))||0,p=a||i.width,m=d||i.height;if(p===0||m===0||t.hasAttribute("data-shimmer-ignore"))return;if(t.hasAttribute("data-shimmer-no-children")||C(t)){let b=getComputedStyle(t).borderRadius;if((t.tagName==="TD"||t.tagName==="TH")&&S(t)&&!a){let h=document.createElement("span");h.style.visibility="hidden",h.style.position="absolute",h.textContent=t.textContent,t.appendChild(h);let x=h.getBoundingClientRect();t.removeChild(h),e.push({x:i.left-r.left,y:i.top-r.top,width:Math.min(x.width,i.width),height:m,tag:t.tagName.toLowerCase(),borderRadius:b==="0px"?"":b});return}e.push({x:i.left-r.left,y:i.top-r.top,width:p,height:m,tag:t.tagName.toLowerCase(),borderRadius:b==="0px"?"":b});return}for(let v of t.children)o(v)}return o(n),e}function y(n,r){let e=null,o=new ResizeObserver(()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{e=null,r()})});return o.observe(n),o}import{css as A}from"lit";var _=A`
1
+ var E=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var l=(n,r,e,o)=>{for(var t=o>1?void 0:o?O(r,e):r,i=n.length-1,a;i>=0;i--)(a=n[i])&&(t=(o?a(r,e,t):a(t))||t);return o&&t&&E(r,e,t),t};import{LitElement as N,html as g}from"lit";import{customElement as M,property as u,state as k}from"lit/decorators.js";import{styleMap as H}from"lit/directives/style-map.js";var R=new Set(["IMG","SVG","VIDEO","CANVAS","IFRAME","INPUT","TEXTAREA","BUTTON","HR"]),T=new Set(["BR","WBR","HR"]);function C(n){if(R.has(n.tagName))return!0;for(let r of n.children)if(!T.has(r.tagName))return!1;return!0}function A(n){for(let r of n.childNodes)if(r.nodeType===Node.TEXT_NODE&&r.textContent?.trim())return!0;return!1}function f(n,r){let e=[];function o(t){let i=t.getBoundingClientRect(),a=Number(t.getAttribute("data-shimmer-width"))||0,d=Number(t.getAttribute("data-shimmer-height"))||0,p=a||i.width,m=d||i.height;if(p===0||m===0||t.hasAttribute("data-shimmer-ignore"))return;if(t.hasAttribute("data-shimmer-no-children")||C(t)){let b=getComputedStyle(t).borderRadius;if((t.tagName==="TD"||t.tagName==="TH")&&A(t)&&!a){let h=document.createElement("span");h.style.visibility="hidden",h.style.position="absolute",h.textContent=t.textContent,t.appendChild(h);let x=h.getBoundingClientRect();t.removeChild(h),e.push({x:i.left-r.left,y:i.top-r.top,width:Math.min(x.width,i.width),height:m,tag:t.tagName.toLowerCase(),borderRadius:b==="0px"?"":b});return}e.push({x:i.left-r.left,y:i.top-r.top,width:p,height:m,tag:t.tagName.toLowerCase(),borderRadius:b==="0px"?"":b});return}for(let v of t.children)o(v)}return o(n),e}function y(n,r){let e=null,o=new ResizeObserver(()=>{e!==null&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{e=null,r()})});return o.observe(n),o}import{css as S}from"lit";var _=S`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -160,4 +160,4 @@ var E=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var l=(n,r,e,o
160
160
  ${a}
161
161
  "
162
162
  ></div>
163
- `})}};s.styles=_,l([u({type:Boolean,reflect:!0})],s.prototype,"loading",2),l([u({attribute:"shimmer-color"})],s.prototype,"shimmerColor",2),l([u({attribute:"background-color"})],s.prototype,"backgroundColor",2),l([u({type:Number})],s.prototype,"duration",2),l([u({type:Number,attribute:"fallback-radius"})],s.prototype,"fallbackRadius",2),l([u({reflect:!0})],s.prototype,"animation",2),l([u({type:Number})],s.prototype,"stagger",2),l([u({type:Number})],s.prototype,"reveal",2),l([u({type:Number,converter:e=>Math.max(1,Math.round(Number(e)||1))})],s.prototype,"count",2),l([u({type:Number,attribute:"count-gap",converter:e=>Math.max(0,Number(e)||0)})],s.prototype,"countGap",2),l([k()],s.prototype,"_blocks",2),l([k()],s.prototype,"_revealing",2),s=l([M("phantom-ui")],s);export{s as PhantomUi};
163
+ `})}};s.styles=_,l([u({type:Boolean,reflect:!0,converter:{fromAttribute:e=>e!==null&&e!=="false",toAttribute:e=>e?"":null}})],s.prototype,"loading",2),l([u({attribute:"shimmer-color"})],s.prototype,"shimmerColor",2),l([u({attribute:"background-color"})],s.prototype,"backgroundColor",2),l([u({type:Number})],s.prototype,"duration",2),l([u({type:Number,attribute:"fallback-radius"})],s.prototype,"fallbackRadius",2),l([u({reflect:!0})],s.prototype,"animation",2),l([u({type:Number})],s.prototype,"stagger",2),l([u({type:Number})],s.prototype,"reveal",2),l([u({type:Number,converter:e=>Math.max(1,Math.round(Number(e)||1))})],s.prototype,"count",2),l([u({type:Number,attribute:"count-gap",converter:e=>Math.max(0,Number(e)||0)})],s.prototype,"countGap",2),l([k()],s.prototype,"_blocks",2),l([k()],s.prototype,"_revealing",2),s=l([M("phantom-ui")],s);export{s as PhantomUi};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aejkatappaja/phantom-ui",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "Structure-aware shimmer skeleton loader as a universal Web Component built with Lit. Works with React, Vue, Svelte, Angular, Solid, or vanilla JS.",
5
5
  "repository": {
6
6
  "type": "git",