tw-shimmer 0.1.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/LICENSE +21 -0
- package/README.md +93 -0
- package/package.json +30 -0
- package/src/index.css +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AgentbaseAI Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# tw-shimmer
|
|
2
|
+
|
|
3
|
+
Tailwind CSS v4 plugin for shimmer effects.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install tw-shimmer
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```css
|
|
12
|
+
/* app/globals.css */
|
|
13
|
+
@import "tailwindcss";
|
|
14
|
+
@import "tw-shimmer";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
The shimmer effect uses `background-clip: text`, so you need to set a text color for the base text:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<div class="shimmer text-foreground/40">Loading...</div>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Use opacity (`/40`, `/50`, etc.) to make the shimmer effect visible.
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
### `shimmer`
|
|
30
|
+
|
|
31
|
+
Base utility. Apply to any element with a text color.
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<div class="shimmer text-foreground/40">Loading...</div>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### `shimmer-speed-{value}`
|
|
38
|
+
|
|
39
|
+
Animation speed in pixels per second. Default: `100px/s`.
|
|
40
|
+
|
|
41
|
+
Values are unitless numbers (units auto-appended): `50`, `100`, `150`, `200`, etc.
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<div class="shimmer shimmer-speed-200 text-foreground/40">Fast (200px/s)</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### `--shimmer-width-x`
|
|
48
|
+
|
|
49
|
+
CSS variable for container width used in speed calculations. Default: `200px`.
|
|
50
|
+
|
|
51
|
+
Set this at runtime to match your actual container width for accurate speed.
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
<div class="shimmer" style={{ ["--shimmer-width-x" as string]: "300px" }}>
|
|
55
|
+
Wide container
|
|
56
|
+
</div>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Duration formula: `(width * 2) / speed`
|
|
60
|
+
|
|
61
|
+
### `shimmer-color-{color}`
|
|
62
|
+
|
|
63
|
+
Shimmer highlight color. Default: `currentColor`.
|
|
64
|
+
|
|
65
|
+
Uses Tailwind color palette.
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<div class="shimmer shimmer-color-blue-500 text-blue-500/40">Colored</div>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `shimmer-spread-{spacing}`
|
|
72
|
+
|
|
73
|
+
Width of the shimmer highlight. Default: `6ch`.
|
|
74
|
+
|
|
75
|
+
Uses Tailwind spacing scale.
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<div class="shimmer shimmer-spread-12 text-foreground/40">Wide highlight</div>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### `shimmer-angle-{degrees}`
|
|
82
|
+
|
|
83
|
+
Shimmer direction. Default: `90deg`.
|
|
84
|
+
|
|
85
|
+
Values are unitless numbers (deg auto-appended): `0`, `45`, `90`, `180`, etc.
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<div class="shimmer shimmer-angle-45 text-foreground/40">Diagonal (45deg)</div>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tw-shimmer",
|
|
3
|
+
"description": "Tailwind CSS v4 plugin for shimmer effects",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"default": "./src/index.css"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"main": "./src/index.css",
|
|
13
|
+
"files": [
|
|
14
|
+
"src",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"provenance": true
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://www.assistant-ui.com/tw-shimmer",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/assistant-ui/assistant-ui/tree/main/packages/tw-shimmer"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/assistant-ui/assistant-ui/issues"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/index.css
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
@theme inline {
|
|
2
|
+
@keyframes shimmer {
|
|
3
|
+
0% {
|
|
4
|
+
background-position: 150% 0;
|
|
5
|
+
}
|
|
6
|
+
100% {
|
|
7
|
+
background-position: -50% 0;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@utility shimmer {
|
|
13
|
+
--shimmer-speed: 100px;
|
|
14
|
+
--shimmer-width-x: 200px;
|
|
15
|
+
--shimmer-color: black;
|
|
16
|
+
--shimmer-spread: 6ch;
|
|
17
|
+
--shimmer-angle: 90deg;
|
|
18
|
+
background:
|
|
19
|
+
linear-gradient(
|
|
20
|
+
var(--shimmer-angle),
|
|
21
|
+
transparent calc(50% - var(--shimmer-spread) * 0.5),
|
|
22
|
+
color-mix(in oklch, currentColor, var(--shimmer-color) 90%) 50%,
|
|
23
|
+
transparent calc(50% + var(--shimmer-spread) * 0.5)
|
|
24
|
+
)
|
|
25
|
+
0 0 / 200% 100% no-repeat,
|
|
26
|
+
linear-gradient(currentColor, currentColor);
|
|
27
|
+
background-clip: text;
|
|
28
|
+
-webkit-background-clip: text;
|
|
29
|
+
-webkit-text-fill-color: transparent;
|
|
30
|
+
animation: shimmer
|
|
31
|
+
calc((var(--shimmer-width-x) * 2) / var(--shimmer-speed) * 1s) infinite
|
|
32
|
+
linear;
|
|
33
|
+
|
|
34
|
+
@variant dark {
|
|
35
|
+
--shimmer-color: white;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@utility shimmer-speed-* {
|
|
40
|
+
--shimmer-speed: calc(--value(number) * 1px);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@utility shimmer-color-* {
|
|
44
|
+
--shimmer-color: --value(--color-*);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@utility shimmer-spread-* {
|
|
48
|
+
--shimmer-spread: --spacing(--value(integer));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@utility shimmer-angle-* {
|
|
52
|
+
--shimmer-angle: calc(--value(number) * 1deg);
|
|
53
|
+
}
|