use-skelly 0.1.0 → 0.1.1
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 +104 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# use-skelly
|
|
2
|
+
|
|
3
|
+
Skeletons that draw themselves. A zero-dependency, layout-driven skeleton state library.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**use-skelly** measures your actual rendered HTML elements (text lines, avatars, images, tables, grid blocks) and compiles them into a pixel-accurate skeleton overlay.
|
|
8
|
+
|
|
9
|
+
Instead of writing custom skeleton loading states for every single component, simply wrap your subtree and let `use-skelly` do the work.
|
|
10
|
+
|
|
11
|
+
- **Zero configuration**: Derive skeletons dynamically from your markup.
|
|
12
|
+
- **Zero layout shift (CLS)**: Placeholders occupy the exact dimensions of your real elements, guaranteeing layout stability.
|
|
13
|
+
- **SSR & Streaming ready**: Pre-compile route layout specs at build time and render skeletons in the first byte of server HTML.
|
|
14
|
+
- **Extremely lightweight**: Core is only `2.1 kB` minified + gzipped; framework adapters are `~0.4 kB` each.
|
|
15
|
+
|
|
16
|
+
For complete documentation and guides, visit [useskelly.dev](https://useskelly.dev).
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 🛠️ Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install use-skelly
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Import global keyframe animations in your root styles file:
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
import "use-skelly/style.css";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🚀 Quick Start (React / Next.js)
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { Skelly } from "use-skelly/react";
|
|
38
|
+
|
|
39
|
+
function UserProfile({ isLoading, userData }) {
|
|
40
|
+
return (
|
|
41
|
+
<Skelly loading={isLoading} visual="shimmer">
|
|
42
|
+
<div className="profile-card">
|
|
43
|
+
<img src={userData.avatar} className="avatar" />
|
|
44
|
+
<h2>{userData.name}</h2>
|
|
45
|
+
<p>{userData.bio}</p>
|
|
46
|
+
</div>
|
|
47
|
+
</Skelly>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 🟢 Framework Adapters
|
|
55
|
+
|
|
56
|
+
`use-skelly` provides native wrappers for all major web frameworks:
|
|
57
|
+
|
|
58
|
+
### React / Next.js
|
|
59
|
+
```tsx
|
|
60
|
+
import { Skelly } from "use-skelly/react";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Vue 3 (Directive & Component)
|
|
64
|
+
```vue
|
|
65
|
+
<script setup>
|
|
66
|
+
import { vSkelly, Skelly } from "use-skelly/vue";
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<div v-skelly="isLoading">
|
|
71
|
+
<ProfileCard />
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Svelte (Action & Component)
|
|
77
|
+
```svelte
|
|
78
|
+
<script>
|
|
79
|
+
import { skelly, Skelly } from "use-skelly/svelte";
|
|
80
|
+
export let isLoading = true;
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<div use:skelly={{ loading: isLoading, visual: 'shimmer' }}>
|
|
84
|
+
<slot />
|
|
85
|
+
</div>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Vanilla JavaScript
|
|
89
|
+
```javascript
|
|
90
|
+
import { skelly } from "use-skelly";
|
|
91
|
+
|
|
92
|
+
const release = skelly(document.querySelector("#card"), {
|
|
93
|
+
visual: "shimmer"
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// When done:
|
|
97
|
+
release();
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 📄 License
|
|
103
|
+
|
|
104
|
+
MIT © [Skelly Team](https://github.com/sidhanshumonga/use-skelly)
|