loading-dev 0.3.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/LICENSE.md +21 -0
- package/README.md +31 -0
- package/dist/index.d.ts +135 -0
- package/dist/index.js +910 -0
- package/package.json +59 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jakub Krehel
|
|
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,31 @@
|
|
|
1
|
+
# loading-dev
|
|
2
|
+
|
|
3
|
+
Loading, made beautiful. A small library of loading indicators for React.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install loading-dev
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { Arc } from "loading-dev";
|
|
11
|
+
|
|
12
|
+
<Arc size={16} />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
You can set `size`, `color`, `duration` and `easing`. The library exposes `playState` and also allows you to add custom styling. They work in Server Components and respect reduced motion out of the box. Requires React 19 or later.
|
|
16
|
+
|
|
17
|
+
Available: `Arc`, `BouncingDots`, `CircularDots`, `Classic`, `ClassicV2`, `Clock`, `Comet`, `Compass`, `LinearDots`, `Orbit`, `Pulse`, `Radar`, `Ring`, `Swirl`.
|
|
18
|
+
|
|
19
|
+
You can find docs and live previews at [loading.dev](https://loading.dev).
|
|
20
|
+
|
|
21
|
+
## Development
|
|
22
|
+
|
|
23
|
+
The library itself is at the root and the website is in `apps/web`. `pnpm dev` runs both.
|
|
24
|
+
|
|
25
|
+
## Credits
|
|
26
|
+
|
|
27
|
+
Made with care by [Jakub](https://x.com/jakubkrehel) and [Paul](https://x.com/paulfaivret).
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
|
|
3
|
+
declare const DURATION_VAR = "--ld-duration";
|
|
4
|
+
declare const PLAY_STATE_VAR = "--ld-play-state";
|
|
5
|
+
declare const SPINNER_MOTION: {
|
|
6
|
+
readonly arc: {
|
|
7
|
+
readonly duration: 800;
|
|
8
|
+
};
|
|
9
|
+
readonly "bouncing-dots": {
|
|
10
|
+
readonly duration: 500;
|
|
11
|
+
};
|
|
12
|
+
readonly "circular-dots": {
|
|
13
|
+
readonly duration: 800;
|
|
14
|
+
};
|
|
15
|
+
readonly classic: {
|
|
16
|
+
readonly duration: 1200;
|
|
17
|
+
};
|
|
18
|
+
readonly "classic-v2": {
|
|
19
|
+
readonly duration: 800;
|
|
20
|
+
};
|
|
21
|
+
readonly clock: {
|
|
22
|
+
readonly duration: 1200;
|
|
23
|
+
};
|
|
24
|
+
readonly comet: {
|
|
25
|
+
readonly duration: 700;
|
|
26
|
+
};
|
|
27
|
+
readonly compass: {
|
|
28
|
+
readonly duration: 500;
|
|
29
|
+
};
|
|
30
|
+
readonly "linear-dots": {
|
|
31
|
+
readonly duration: 900;
|
|
32
|
+
};
|
|
33
|
+
readonly orbit: {
|
|
34
|
+
readonly duration: 750;
|
|
35
|
+
};
|
|
36
|
+
readonly pulse: {
|
|
37
|
+
readonly duration: 1200;
|
|
38
|
+
};
|
|
39
|
+
readonly radar: {
|
|
40
|
+
readonly duration: 1500;
|
|
41
|
+
};
|
|
42
|
+
readonly ring: {
|
|
43
|
+
readonly duration: 800;
|
|
44
|
+
};
|
|
45
|
+
readonly swirl: {
|
|
46
|
+
readonly duration: 1200;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
type SpinnerName = keyof typeof SPINNER_MOTION;
|
|
50
|
+
|
|
51
|
+
type Easing = "linear" | "ease-in-out" | "stacked";
|
|
52
|
+
interface EasingProps {
|
|
53
|
+
easing?: Easing;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface SpinnerProps {
|
|
57
|
+
/** Extra class names merged onto the root element. */
|
|
58
|
+
className?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Any CSS color — `#f97316`, `oklch(70% 0.19 45)`, `rgb(249 115 22 / 60%)`,
|
|
61
|
+
* `var(--brand)`. Omit to keep inheriting the surrounding text color.
|
|
62
|
+
*/
|
|
63
|
+
color?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Length of one animation cycle in milliseconds. Omit to inherit
|
|
66
|
+
* `--ld-duration` from an ancestor, then the spinner's own default.
|
|
67
|
+
*/
|
|
68
|
+
duration?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the animation runs. Omit to inherit `--ld-play-state` from an
|
|
71
|
+
* ancestor, which defaults to running.
|
|
72
|
+
*/
|
|
73
|
+
playState?: "paused" | "running";
|
|
74
|
+
/** Width and height of the spinner in pixels. Defaults to 20. */
|
|
75
|
+
size?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface ArcProps extends SpinnerProps, EasingProps {
|
|
79
|
+
}
|
|
80
|
+
declare function Arc({ easing, ...rest }: ArcProps): react.JSX.Element;
|
|
81
|
+
|
|
82
|
+
declare function BouncingDots(props: SpinnerProps): react.JSX.Element;
|
|
83
|
+
|
|
84
|
+
declare function CircularDots(props: SpinnerProps): react.JSX.Element;
|
|
85
|
+
|
|
86
|
+
declare function Classic(props: SpinnerProps): react.JSX.Element;
|
|
87
|
+
|
|
88
|
+
declare function ClassicV2(props: SpinnerProps): react.JSX.Element;
|
|
89
|
+
|
|
90
|
+
interface ClockProps extends SpinnerProps, EasingProps {
|
|
91
|
+
}
|
|
92
|
+
declare function Clock({ easing, ...rest }: ClockProps): react.JSX.Element;
|
|
93
|
+
|
|
94
|
+
interface CometProps extends SpinnerProps, EasingProps {
|
|
95
|
+
}
|
|
96
|
+
declare function Comet({ easing, ...rest }: CometProps): react.JSX.Element;
|
|
97
|
+
|
|
98
|
+
declare function Compass(props: SpinnerProps): react.JSX.Element;
|
|
99
|
+
|
|
100
|
+
declare function LinearDots(props: SpinnerProps): react.JSX.Element;
|
|
101
|
+
|
|
102
|
+
interface OrbitProps extends SpinnerProps, EasingProps {
|
|
103
|
+
}
|
|
104
|
+
declare function Orbit({ easing, ...rest }: OrbitProps): react.JSX.Element;
|
|
105
|
+
|
|
106
|
+
declare function Pulse(props: SpinnerProps): react.JSX.Element;
|
|
107
|
+
|
|
108
|
+
interface RadarProps extends SpinnerProps, EasingProps {
|
|
109
|
+
}
|
|
110
|
+
declare function Radar({ easing, ...rest }: RadarProps): react.JSX.Element;
|
|
111
|
+
|
|
112
|
+
interface RingProps extends SpinnerProps, EasingProps {
|
|
113
|
+
}
|
|
114
|
+
declare function Ring({ easing, ...rest }: RingProps): react.JSX.Element;
|
|
115
|
+
|
|
116
|
+
declare function Swirl(props: SpinnerProps): react.JSX.Element;
|
|
117
|
+
|
|
118
|
+
declare const SPINNERS: {
|
|
119
|
+
arc: typeof Arc;
|
|
120
|
+
"bouncing-dots": typeof BouncingDots;
|
|
121
|
+
"circular-dots": typeof CircularDots;
|
|
122
|
+
classic: typeof Classic;
|
|
123
|
+
"classic-v2": typeof ClassicV2;
|
|
124
|
+
clock: typeof Clock;
|
|
125
|
+
comet: typeof Comet;
|
|
126
|
+
compass: typeof Compass;
|
|
127
|
+
"linear-dots": typeof LinearDots;
|
|
128
|
+
orbit: typeof Orbit;
|
|
129
|
+
pulse: typeof Pulse;
|
|
130
|
+
radar: typeof Radar;
|
|
131
|
+
ring: typeof Ring;
|
|
132
|
+
swirl: typeof Swirl;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export { Arc, type ArcProps, BouncingDots, CircularDots, Classic, ClassicV2, Clock, type ClockProps, Comet, type CometProps, Compass, DURATION_VAR, type Easing, type EasingProps, LinearDots, Orbit, type OrbitProps, PLAY_STATE_VAR, Pulse, Radar, type RadarProps, Ring, type RingProps, SPINNERS, SPINNER_MOTION, type SpinnerName, type SpinnerProps, Swirl };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,910 @@
|
|
|
1
|
+
// src/motion.ts
|
|
2
|
+
var DURATION_VAR = "--ld-duration";
|
|
3
|
+
var PLAY_STATE_VAR = "--ld-play-state";
|
|
4
|
+
var SIZE_VAR = "--ld-size";
|
|
5
|
+
var DEFAULT_SIZE = 20;
|
|
6
|
+
var SIZE = `var(${SIZE_VAR}, ${DEFAULT_SIZE}px)`;
|
|
7
|
+
var SPINNER_MOTION = {
|
|
8
|
+
arc: { duration: 800 },
|
|
9
|
+
"bouncing-dots": { duration: 500 },
|
|
10
|
+
"circular-dots": { duration: 800 },
|
|
11
|
+
classic: { duration: 1200 },
|
|
12
|
+
"classic-v2": { duration: 800 },
|
|
13
|
+
clock: { duration: 1200 },
|
|
14
|
+
comet: { duration: 700 },
|
|
15
|
+
compass: { duration: 500 },
|
|
16
|
+
"linear-dots": { duration: 900 },
|
|
17
|
+
orbit: { duration: 750 },
|
|
18
|
+
pulse: { duration: 1200 },
|
|
19
|
+
radar: { duration: 1500 },
|
|
20
|
+
ring: { duration: 800 },
|
|
21
|
+
swirl: { duration: 1200 }
|
|
22
|
+
};
|
|
23
|
+
function duration(name) {
|
|
24
|
+
return `var(${DURATION_VAR}, ${SPINNER_MOTION[name].duration}ms)`;
|
|
25
|
+
}
|
|
26
|
+
var PLAY_STATE = `var(${PLAY_STATE_VAR}, running)`;
|
|
27
|
+
|
|
28
|
+
// src/easing.ts
|
|
29
|
+
var DEFAULT_EASING = "linear";
|
|
30
|
+
function spinClass(name, easing = DEFAULT_EASING) {
|
|
31
|
+
const base = `ld-${name}-spin`;
|
|
32
|
+
return easing === "linear" ? base : `${base} ${base}-${easing}`;
|
|
33
|
+
}
|
|
34
|
+
function rotationCss(name) {
|
|
35
|
+
return `
|
|
36
|
+
.ld-${name}-spin {
|
|
37
|
+
transform-origin: center;
|
|
38
|
+
animation: ld-${name}-rotate ${duration(name)} linear infinite;
|
|
39
|
+
animation-play-state: ${PLAY_STATE};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.ld-${name}-spin-ease-in-out {
|
|
43
|
+
animation-timing-function: ease-in-out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ld-${name}-spin-stacked {
|
|
47
|
+
animation-name: ld-${name}-rotate, ld-${name}-rotate;
|
|
48
|
+
animation-timing-function: linear, ease-in-out;
|
|
49
|
+
animation-composition: add;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@keyframes ld-${name}-rotate {
|
|
53
|
+
to {
|
|
54
|
+
transform: rotate(360deg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@media (prefers-reduced-motion: reduce) {
|
|
59
|
+
.ld-${name}-spin {
|
|
60
|
+
animation: none;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/frame.tsx
|
|
67
|
+
import { jsx } from "react/jsx-runtime";
|
|
68
|
+
function SpinnerStyle({
|
|
69
|
+
children,
|
|
70
|
+
name
|
|
71
|
+
}) {
|
|
72
|
+
return /* @__PURE__ */ jsx("style", { href: `ld-${name}`, precedence: "loading-dev", children });
|
|
73
|
+
}
|
|
74
|
+
function cssVars(vars) {
|
|
75
|
+
return vars;
|
|
76
|
+
}
|
|
77
|
+
function spinnerRoot(name, { className, color, duration: duration2, playState, size = DEFAULT_SIZE }) {
|
|
78
|
+
return {
|
|
79
|
+
"aria-hidden": true,
|
|
80
|
+
className: [`ld-${name}`, className].filter(Boolean).join(" "),
|
|
81
|
+
style: cssVars({
|
|
82
|
+
[SIZE_VAR]: `${size}px`,
|
|
83
|
+
...color === void 0 ? null : { color },
|
|
84
|
+
...duration2 === void 0 ? null : { [DURATION_VAR]: `${duration2}ms` },
|
|
85
|
+
...playState === void 0 ? null : { [PLAY_STATE_VAR]: playState }
|
|
86
|
+
})
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/arc.tsx
|
|
91
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
92
|
+
var css = `
|
|
93
|
+
.ld-arc {
|
|
94
|
+
width: ${SIZE};
|
|
95
|
+
height: ${SIZE};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
${rotationCss("arc")}
|
|
99
|
+
`;
|
|
100
|
+
function Arc({ easing, ...rest }) {
|
|
101
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
102
|
+
/* @__PURE__ */ jsx2(SpinnerStyle, { name: "arc", children: css }),
|
|
103
|
+
/* @__PURE__ */ jsx2(
|
|
104
|
+
"svg",
|
|
105
|
+
{
|
|
106
|
+
...spinnerRoot("arc", rest),
|
|
107
|
+
fill: "none",
|
|
108
|
+
role: "presentation",
|
|
109
|
+
viewBox: "0 0 24 24",
|
|
110
|
+
children: /* @__PURE__ */ jsx2(
|
|
111
|
+
"circle",
|
|
112
|
+
{
|
|
113
|
+
className: spinClass("arc", easing),
|
|
114
|
+
cx: "12",
|
|
115
|
+
cy: "12",
|
|
116
|
+
r: "10",
|
|
117
|
+
stroke: "currentColor",
|
|
118
|
+
strokeDasharray: "18 44.8",
|
|
119
|
+
strokeLinecap: "round",
|
|
120
|
+
strokeWidth: "2.5"
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// src/bouncing-dots.tsx
|
|
129
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
130
|
+
var DOTS = Array.from({ length: 3 }, (_, index) => index);
|
|
131
|
+
var dur = duration("bouncing-dots");
|
|
132
|
+
var css2 = `
|
|
133
|
+
.ld-bouncing-dots {
|
|
134
|
+
display: flex;
|
|
135
|
+
align-items: center;
|
|
136
|
+
gap: calc(${SIZE} * 0.2);
|
|
137
|
+
height: ${SIZE};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.ld-bouncing-dots-dot {
|
|
141
|
+
width: calc(${SIZE} * 0.22);
|
|
142
|
+
height: calc(${SIZE} * 0.22);
|
|
143
|
+
background: currentColor;
|
|
144
|
+
border-radius: 9999px;
|
|
145
|
+
animation: ld-bouncing-dots-bounce ${dur} ease-in-out infinite alternate;
|
|
146
|
+
animation-play-state: ${PLAY_STATE};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.ld-bouncing-dots-dot:nth-child(1) {
|
|
150
|
+
animation-delay: calc(${dur} * -0.64);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.ld-bouncing-dots-dot:nth-child(2) {
|
|
154
|
+
animation-delay: calc(${dur} * -0.32);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@keyframes ld-bouncing-dots-bounce {
|
|
158
|
+
from {
|
|
159
|
+
transform: translateY(28%);
|
|
160
|
+
}
|
|
161
|
+
to {
|
|
162
|
+
transform: translateY(-72%);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@media (prefers-reduced-motion: reduce) {
|
|
167
|
+
.ld-bouncing-dots-dot {
|
|
168
|
+
animation: none;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
`;
|
|
172
|
+
function BouncingDots(props) {
|
|
173
|
+
return /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
174
|
+
/* @__PURE__ */ jsx3(SpinnerStyle, { name: "bouncing-dots", children: css2 }),
|
|
175
|
+
/* @__PURE__ */ jsx3("div", { ...spinnerRoot("bouncing-dots", props), children: DOTS.map((dot) => /* @__PURE__ */ jsx3("div", { className: "ld-bouncing-dots-dot" }, dot)) })
|
|
176
|
+
] });
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// src/circular-dots.tsx
|
|
180
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
181
|
+
var DOTS2 = [
|
|
182
|
+
[8, 1.5],
|
|
183
|
+
[12.5962, 3.4038],
|
|
184
|
+
[14.5, 8],
|
|
185
|
+
[12.5962, 12.5962],
|
|
186
|
+
[8, 14.5],
|
|
187
|
+
[3.4038, 12.5962],
|
|
188
|
+
[1.5, 8],
|
|
189
|
+
[3.4038, 3.4038]
|
|
190
|
+
];
|
|
191
|
+
var dur2 = duration("circular-dots");
|
|
192
|
+
var css3 = `
|
|
193
|
+
.ld-circular-dots {
|
|
194
|
+
width: ${SIZE};
|
|
195
|
+
height: ${SIZE};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.ld-circular-dots-dot {
|
|
199
|
+
animation: ld-circular-dots-fade ${dur2} linear infinite;
|
|
200
|
+
animation-delay: calc(${dur2} * (var(--ld-circular-dots-step) - ${DOTS2.length}) / ${DOTS2.length});
|
|
201
|
+
animation-play-state: ${PLAY_STATE};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@keyframes ld-circular-dots-fade {
|
|
205
|
+
from {
|
|
206
|
+
opacity: 1;
|
|
207
|
+
}
|
|
208
|
+
to {
|
|
209
|
+
opacity: 0.2;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@media (prefers-reduced-motion: reduce) {
|
|
214
|
+
.ld-circular-dots-dot {
|
|
215
|
+
opacity: 0.6;
|
|
216
|
+
animation: none;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
`;
|
|
220
|
+
function CircularDots(props) {
|
|
221
|
+
return /* @__PURE__ */ jsxs3(Fragment3, { children: [
|
|
222
|
+
/* @__PURE__ */ jsx4(SpinnerStyle, { name: "circular-dots", children: css3 }),
|
|
223
|
+
/* @__PURE__ */ jsx4(
|
|
224
|
+
"svg",
|
|
225
|
+
{
|
|
226
|
+
...spinnerRoot("circular-dots", props),
|
|
227
|
+
fill: "currentColor",
|
|
228
|
+
role: "presentation",
|
|
229
|
+
viewBox: "0 0 16 16",
|
|
230
|
+
children: DOTS2.map(([cx, cy], step) => /* @__PURE__ */ jsx4(
|
|
231
|
+
"circle",
|
|
232
|
+
{
|
|
233
|
+
className: "ld-circular-dots-dot",
|
|
234
|
+
cx,
|
|
235
|
+
cy,
|
|
236
|
+
r: "1.5",
|
|
237
|
+
style: cssVars({ "--ld-circular-dots-step": step })
|
|
238
|
+
},
|
|
239
|
+
`${cx}-${cy}`
|
|
240
|
+
))
|
|
241
|
+
}
|
|
242
|
+
)
|
|
243
|
+
] });
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// src/classic.tsx
|
|
247
|
+
import { Fragment as Fragment4, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
248
|
+
var BARS = Array.from({ length: 12 }, (_, index) => index);
|
|
249
|
+
var dur3 = duration("classic");
|
|
250
|
+
var BAR_RULES = BARS.map(
|
|
251
|
+
(bar) => `
|
|
252
|
+
.ld-classic-bar:nth-child(${bar + 1}) {
|
|
253
|
+
transform: rotate(${bar === 0 ? "0.0001" : bar * 30}deg) translate(146%);
|
|
254
|
+
animation-delay: calc(${dur3} * ${(bar / 12 - 1).toFixed(4)});
|
|
255
|
+
}`
|
|
256
|
+
).join("\n");
|
|
257
|
+
var css4 = `
|
|
258
|
+
.ld-classic {
|
|
259
|
+
width: ${SIZE};
|
|
260
|
+
height: ${SIZE};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.ld-classic-inner {
|
|
264
|
+
position: relative;
|
|
265
|
+
top: 50%;
|
|
266
|
+
left: 50%;
|
|
267
|
+
width: ${SIZE};
|
|
268
|
+
height: ${SIZE};
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.ld-classic-bar {
|
|
272
|
+
position: absolute;
|
|
273
|
+
top: -3.9%;
|
|
274
|
+
left: -10%;
|
|
275
|
+
width: 24%;
|
|
276
|
+
height: 8%;
|
|
277
|
+
background: currentColor;
|
|
278
|
+
border-radius: 6px;
|
|
279
|
+
animation: ld-classic-spin ${dur3} linear infinite;
|
|
280
|
+
animation-play-state: ${PLAY_STATE};
|
|
281
|
+
}
|
|
282
|
+
${BAR_RULES}
|
|
283
|
+
|
|
284
|
+
@keyframes ld-classic-spin {
|
|
285
|
+
0% {
|
|
286
|
+
opacity: 1;
|
|
287
|
+
}
|
|
288
|
+
100% {
|
|
289
|
+
opacity: 0.15;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@media (prefers-reduced-motion: reduce) {
|
|
294
|
+
.ld-classic-bar {
|
|
295
|
+
opacity: 0.5;
|
|
296
|
+
animation: none;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
`;
|
|
300
|
+
function Classic(props) {
|
|
301
|
+
return /* @__PURE__ */ jsxs4(Fragment4, { children: [
|
|
302
|
+
/* @__PURE__ */ jsx5(SpinnerStyle, { name: "classic", children: css4 }),
|
|
303
|
+
/* @__PURE__ */ jsx5("div", { ...spinnerRoot("classic", props), children: /* @__PURE__ */ jsx5("div", { className: "ld-classic-inner", children: BARS.map((bar) => /* @__PURE__ */ jsx5("div", { className: "ld-classic-bar" }, bar)) }) })
|
|
304
|
+
] });
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// src/classic-v2.tsx
|
|
308
|
+
import { Fragment as Fragment5, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
309
|
+
var TICKS = 8;
|
|
310
|
+
var dur4 = duration("classic-v2");
|
|
311
|
+
var TICK_RULES = Array.from(
|
|
312
|
+
{ length: TICKS },
|
|
313
|
+
(_, tick) => `
|
|
314
|
+
.ld-classic-v2-tick:nth-child(${tick + 1}) {
|
|
315
|
+
animation-delay: calc(${dur4} * ${(tick / TICKS - 1).toFixed(4)});
|
|
316
|
+
}`
|
|
317
|
+
).join("\n");
|
|
318
|
+
var css5 = `
|
|
319
|
+
.ld-classic-v2 {
|
|
320
|
+
width: ${SIZE};
|
|
321
|
+
height: ${SIZE};
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.ld-classic-v2-tick {
|
|
325
|
+
animation: ld-classic-v2-fade ${dur4} linear infinite;
|
|
326
|
+
animation-play-state: ${PLAY_STATE};
|
|
327
|
+
}
|
|
328
|
+
${TICK_RULES}
|
|
329
|
+
|
|
330
|
+
@keyframes ld-classic-v2-fade {
|
|
331
|
+
0% {
|
|
332
|
+
opacity: 1;
|
|
333
|
+
}
|
|
334
|
+
100% {
|
|
335
|
+
opacity: 0.4;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
@media (prefers-reduced-motion: reduce) {
|
|
340
|
+
.ld-classic-v2-tick {
|
|
341
|
+
opacity: 0.5;
|
|
342
|
+
animation: none;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
`;
|
|
346
|
+
function ClassicV2(props) {
|
|
347
|
+
return /* @__PURE__ */ jsxs5(Fragment5, { children: [
|
|
348
|
+
/* @__PURE__ */ jsx6(SpinnerStyle, { name: "classic-v2", children: css5 }),
|
|
349
|
+
/* @__PURE__ */ jsx6(
|
|
350
|
+
"svg",
|
|
351
|
+
{
|
|
352
|
+
...spinnerRoot("classic-v2", props),
|
|
353
|
+
fill: "none",
|
|
354
|
+
role: "presentation",
|
|
355
|
+
viewBox: "0 0 16 16",
|
|
356
|
+
children: /* @__PURE__ */ jsxs5("g", { fill: "currentColor", children: [
|
|
357
|
+
/* @__PURE__ */ jsx6(
|
|
358
|
+
"path",
|
|
359
|
+
{
|
|
360
|
+
className: "ld-classic-v2-tick",
|
|
361
|
+
d: "M7.33334 0.666667C7.33334 0.298477 7.63181 0 8 0C8.36819 0 8.66667 0.298477 8.66667 0.666667V3.33333C8.66667 3.70152 8.36819 4 8 4C7.63181 4 7.33334 3.70152 7.33334 3.33333V0.666667Z"
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
/* @__PURE__ */ jsx6(
|
|
365
|
+
"path",
|
|
366
|
+
{
|
|
367
|
+
className: "ld-classic-v2-tick",
|
|
368
|
+
d: "M11.7712 5.17154C11.5109 5.43189 11.0888 5.43189 10.8284 5.17154C10.5681 4.91119 10.5681 4.48908 10.8284 4.22873L12.714 2.34311C12.9744 2.08276 13.3965 2.08276 13.6568 2.34311C13.9172 2.60346 13.9172 3.02557 13.6568 3.28592L11.7712 5.17154Z"
|
|
369
|
+
}
|
|
370
|
+
),
|
|
371
|
+
/* @__PURE__ */ jsx6(
|
|
372
|
+
"path",
|
|
373
|
+
{
|
|
374
|
+
className: "ld-classic-v2-tick",
|
|
375
|
+
d: "M12.6667 8.66667C12.2985 8.66667 12 8.36819 12 8.00001C12 7.63182 12.2985 7.33334 12.6667 7.33334H15.3333C15.7015 7.33334 16 7.63182 16 8.00001C16 8.36819 15.7015 8.66667 15.3333 8.66667H12.6667Z"
|
|
376
|
+
}
|
|
377
|
+
),
|
|
378
|
+
/* @__PURE__ */ jsx6(
|
|
379
|
+
"path",
|
|
380
|
+
{
|
|
381
|
+
className: "ld-classic-v2-tick",
|
|
382
|
+
d: "M10.8284 11.7713C10.5681 11.5109 10.5681 11.0888 10.8284 10.8284C11.0888 10.5681 11.5109 10.5681 11.7712 10.8284L13.6568 12.7141C13.9172 12.9744 13.9172 13.3965 13.6568 13.6569C13.3965 13.9172 12.9744 13.9172 12.714 13.6569L10.8284 11.7713Z"
|
|
383
|
+
}
|
|
384
|
+
),
|
|
385
|
+
/* @__PURE__ */ jsx6(
|
|
386
|
+
"path",
|
|
387
|
+
{
|
|
388
|
+
className: "ld-classic-v2-tick",
|
|
389
|
+
d: "M7.33333 12.6667C7.33333 12.2985 7.63181 12 8 12C8.36819 12 8.66667 12.2985 8.66667 12.6667V15.3333C8.66667 15.7015 8.36819 16 8 16C7.63181 16 7.33333 15.7015 7.33333 15.3333V12.6667Z"
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
/* @__PURE__ */ jsx6(
|
|
393
|
+
"path",
|
|
394
|
+
{
|
|
395
|
+
className: "ld-classic-v2-tick",
|
|
396
|
+
d: "M3.28594 13.6569C3.02559 13.9172 2.60348 13.9172 2.34313 13.6569C2.08278 13.3965 2.08278 12.9744 2.34313 12.714L4.22875 10.8284C4.4891 10.5681 4.91121 10.5681 5.17156 10.8284C5.43191 11.0888 5.43191 11.5109 5.17156 11.7712L3.28594 13.6569Z"
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ jsx6(
|
|
400
|
+
"path",
|
|
401
|
+
{
|
|
402
|
+
className: "ld-classic-v2-tick",
|
|
403
|
+
d: "M0.666667 8.66667C0.298477 8.66667 1.60941e-08 8.36819 0 8.00001C-1.60941e-08 7.63182 0.298477 7.33334 0.666667 7.33334H3.33333C3.70152 7.33334 4 7.63182 4 8.00001C4 8.36819 3.70152 8.66667 3.33333 8.66667H0.666667Z"
|
|
404
|
+
}
|
|
405
|
+
),
|
|
406
|
+
/* @__PURE__ */ jsx6(
|
|
407
|
+
"path",
|
|
408
|
+
{
|
|
409
|
+
className: "ld-classic-v2-tick",
|
|
410
|
+
d: "M2.34315 3.28594C2.0828 3.02559 2.0828 2.60348 2.34315 2.34314C2.6035 2.08279 3.02561 2.08279 3.28596 2.34313L5.17158 4.22875C5.43193 4.4891 5.43193 4.91121 5.17158 5.17156C4.91123 5.43191 4.48912 5.43191 4.22877 5.17156L2.34315 3.28594Z"
|
|
411
|
+
}
|
|
412
|
+
)
|
|
413
|
+
] })
|
|
414
|
+
}
|
|
415
|
+
)
|
|
416
|
+
] });
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// src/clock.tsx
|
|
420
|
+
import { Fragment as Fragment6, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
421
|
+
var css6 = `
|
|
422
|
+
.ld-clock {
|
|
423
|
+
width: ${SIZE};
|
|
424
|
+
height: ${SIZE};
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
${rotationCss("clock")}
|
|
428
|
+
`;
|
|
429
|
+
function Clock({ easing, ...rest }) {
|
|
430
|
+
return /* @__PURE__ */ jsxs6(Fragment6, { children: [
|
|
431
|
+
/* @__PURE__ */ jsx7(SpinnerStyle, { name: "clock", children: css6 }),
|
|
432
|
+
/* @__PURE__ */ jsxs6(
|
|
433
|
+
"svg",
|
|
434
|
+
{
|
|
435
|
+
...spinnerRoot("clock", rest),
|
|
436
|
+
fill: "none",
|
|
437
|
+
role: "presentation",
|
|
438
|
+
viewBox: "0 0 16 16",
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsx7("circle", { cx: "8", cy: "8", fill: "currentColor", opacity: "0.1", r: "8" }),
|
|
441
|
+
/* @__PURE__ */ jsx7(
|
|
442
|
+
"path",
|
|
443
|
+
{
|
|
444
|
+
className: spinClass("clock", easing),
|
|
445
|
+
d: "M11.1937 2.92061C10.5206 2.49739 9.77304 2.21397 8.9954 2.08314C8.45076 1.99151 8 2.44772 8 3V7.20324C8 7.49211 8.12492 7.76686 8.34259 7.95677L11.8999 11.0603C12.3287 11.4344 12.9913 11.378 13.2643 10.8787C13.6356 10.1998 13.8736 9.45248 13.9617 8.67713C14.0892 7.55433 13.8971 6.41834 13.4074 5.39993C12.9177 4.38152 12.1503 3.5221 11.1937 2.92061Z",
|
|
446
|
+
fill: "currentColor"
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
]
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
] });
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// src/comet.tsx
|
|
456
|
+
import { Fragment as Fragment7, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
457
|
+
var css7 = `
|
|
458
|
+
.ld-comet {
|
|
459
|
+
--ld-comet-stroke: calc(${SIZE} * 0.12);
|
|
460
|
+
position: relative;
|
|
461
|
+
width: ${SIZE};
|
|
462
|
+
height: ${SIZE};
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
.ld-comet-spin {
|
|
466
|
+
position: absolute;
|
|
467
|
+
inset: 0;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.ld-comet-tail {
|
|
471
|
+
position: absolute;
|
|
472
|
+
inset: 0;
|
|
473
|
+
border-radius: 9999px;
|
|
474
|
+
background: conic-gradient(from 0deg, transparent, currentColor);
|
|
475
|
+
-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--ld-comet-stroke)), #000 0);
|
|
476
|
+
mask: radial-gradient(farthest-side, transparent calc(100% - var(--ld-comet-stroke)), #000 0);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.ld-comet-head {
|
|
480
|
+
position: absolute;
|
|
481
|
+
top: 0;
|
|
482
|
+
left: 50%;
|
|
483
|
+
width: var(--ld-comet-stroke);
|
|
484
|
+
height: var(--ld-comet-stroke);
|
|
485
|
+
background: currentColor;
|
|
486
|
+
border-radius: 9999px;
|
|
487
|
+
transform: translateX(-50%);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
${rotationCss("comet")}
|
|
491
|
+
`;
|
|
492
|
+
function Comet({ easing, ...rest }) {
|
|
493
|
+
return /* @__PURE__ */ jsxs7(Fragment7, { children: [
|
|
494
|
+
/* @__PURE__ */ jsx8(SpinnerStyle, { name: "comet", children: css7 }),
|
|
495
|
+
/* @__PURE__ */ jsx8("div", { ...spinnerRoot("comet", rest), children: /* @__PURE__ */ jsxs7("div", { className: spinClass("comet", easing), children: [
|
|
496
|
+
/* @__PURE__ */ jsx8("div", { className: "ld-comet-tail" }),
|
|
497
|
+
/* @__PURE__ */ jsx8("div", { className: "ld-comet-head" })
|
|
498
|
+
] }) })
|
|
499
|
+
] });
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// src/compass.tsx
|
|
503
|
+
import { Fragment as Fragment8, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
504
|
+
var css8 = `
|
|
505
|
+
.ld-compass {
|
|
506
|
+
width: ${SIZE};
|
|
507
|
+
height: ${SIZE};
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.ld-compass-ticks {
|
|
511
|
+
transform-origin: center;
|
|
512
|
+
animation: ld-compass-turn ${duration("compass")} ease-in-out infinite;
|
|
513
|
+
animation-play-state: ${PLAY_STATE};
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
@keyframes ld-compass-turn {
|
|
517
|
+
to {
|
|
518
|
+
transform: rotate(90deg);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
@media (prefers-reduced-motion: reduce) {
|
|
523
|
+
.ld-compass-ticks {
|
|
524
|
+
animation: none;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
`;
|
|
528
|
+
function Compass(props) {
|
|
529
|
+
return /* @__PURE__ */ jsxs8(Fragment8, { children: [
|
|
530
|
+
/* @__PURE__ */ jsx9(SpinnerStyle, { name: "compass", children: css8 }),
|
|
531
|
+
/* @__PURE__ */ jsx9(
|
|
532
|
+
"svg",
|
|
533
|
+
{
|
|
534
|
+
...spinnerRoot("compass", props),
|
|
535
|
+
fill: "none",
|
|
536
|
+
role: "presentation",
|
|
537
|
+
viewBox: "0 0 16 16",
|
|
538
|
+
children: /* @__PURE__ */ jsxs8("g", { className: "ld-compass-ticks", fill: "currentColor", children: [
|
|
539
|
+
/* @__PURE__ */ jsx9("path", { d: "M7.33334 0.666667C7.33334 0.298477 7.63181 0 8 0C8.36819 0 8.66667 0.298477 8.66667 0.666667V3.33333C8.66667 3.70152 8.36819 4 8 4C7.63181 4 7.33334 3.70152 7.33334 3.33333V0.666667Z" }),
|
|
540
|
+
/* @__PURE__ */ jsx9("path", { d: "M12.6667 8.66667C12.2985 8.66667 12 8.3682 12 8.00001C12 7.63182 12.2985 7.33334 12.6667 7.33334H15.3333C15.7015 7.33334 16 7.63182 16 8.00001C16 8.3682 15.7015 8.66667 15.3333 8.66667H12.6667Z" }),
|
|
541
|
+
/* @__PURE__ */ jsx9("path", { d: "M7.33333 12.6667C7.33333 12.2985 7.63181 12 8 12C8.36819 12 8.66667 12.2985 8.66667 12.6667V15.3333C8.66667 15.7015 8.36819 16 8 16C7.63181 16 7.33333 15.7015 7.33333 15.3333V12.6667Z" }),
|
|
542
|
+
/* @__PURE__ */ jsx9("path", { d: "M0.666667 8.66667C0.298477 8.66667 1.60941e-08 8.3682 0 8.00001C-1.60941e-08 7.63182 0.298477 7.33334 0.666667 7.33334H3.33333C3.70152 7.33334 4 7.63182 4 8.00001C4 8.3682 3.70152 8.66667 3.33333 8.66667H0.666667Z" })
|
|
543
|
+
] })
|
|
544
|
+
}
|
|
545
|
+
)
|
|
546
|
+
] });
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
// src/linear-dots.tsx
|
|
550
|
+
import { Fragment as Fragment9, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
551
|
+
var COUNT = 3;
|
|
552
|
+
var DOTS3 = Array.from({ length: COUNT }, (_, index) => ({
|
|
553
|
+
step: (COUNT - index) % COUNT
|
|
554
|
+
}));
|
|
555
|
+
var dur5 = duration("linear-dots");
|
|
556
|
+
var css9 = `
|
|
557
|
+
.ld-linear-dots {
|
|
558
|
+
display: flex;
|
|
559
|
+
align-items: center;
|
|
560
|
+
gap: calc(${SIZE} * 0.1875);
|
|
561
|
+
height: ${SIZE};
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
.ld-linear-dots-dot {
|
|
565
|
+
width: calc(${SIZE} * 0.1875);
|
|
566
|
+
height: calc(${SIZE} * 0.1875);
|
|
567
|
+
background: currentColor;
|
|
568
|
+
border-radius: 9999px;
|
|
569
|
+
animation: ld-linear-dots-fade ${dur5} linear infinite;
|
|
570
|
+
animation-delay: calc(${dur5} * var(--ld-linear-dots-step) / -${COUNT});
|
|
571
|
+
animation-play-state: ${PLAY_STATE};
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
@keyframes ld-linear-dots-fade {
|
|
575
|
+
0% {
|
|
576
|
+
opacity: 1;
|
|
577
|
+
}
|
|
578
|
+
66.67% {
|
|
579
|
+
opacity: 0.5;
|
|
580
|
+
}
|
|
581
|
+
100% {
|
|
582
|
+
opacity: 1;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
@media (prefers-reduced-motion: reduce) {
|
|
587
|
+
.ld-linear-dots-dot {
|
|
588
|
+
opacity: 0.75;
|
|
589
|
+
animation: none;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
`;
|
|
593
|
+
function LinearDots(props) {
|
|
594
|
+
return /* @__PURE__ */ jsxs9(Fragment9, { children: [
|
|
595
|
+
/* @__PURE__ */ jsx10(SpinnerStyle, { name: "linear-dots", children: css9 }),
|
|
596
|
+
/* @__PURE__ */ jsx10("div", { ...spinnerRoot("linear-dots", props), children: DOTS3.map((dot, index) => /* @__PURE__ */ jsx10(
|
|
597
|
+
"div",
|
|
598
|
+
{
|
|
599
|
+
className: "ld-linear-dots-dot",
|
|
600
|
+
style: cssVars({ "--ld-linear-dots-step": dot.step })
|
|
601
|
+
},
|
|
602
|
+
index
|
|
603
|
+
)) })
|
|
604
|
+
] });
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// src/orbit.tsx
|
|
608
|
+
import { Fragment as Fragment10, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
609
|
+
var css10 = `
|
|
610
|
+
.ld-orbit {
|
|
611
|
+
--ld-orbit-stroke: calc(${SIZE} * 0.0625);
|
|
612
|
+
position: relative;
|
|
613
|
+
width: ${SIZE};
|
|
614
|
+
height: ${SIZE};
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.ld-orbit-track {
|
|
618
|
+
position: absolute;
|
|
619
|
+
inset: 8%;
|
|
620
|
+
border-radius: 9999px;
|
|
621
|
+
background: conic-gradient(from 180deg, transparent 0deg, currentColor 180deg, transparent 180deg);
|
|
622
|
+
-webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--ld-orbit-stroke)), #000 0);
|
|
623
|
+
mask: radial-gradient(farthest-side, transparent calc(100% - var(--ld-orbit-stroke)), #000 0);
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
.ld-orbit-dot {
|
|
627
|
+
position: absolute;
|
|
628
|
+
top: 50%;
|
|
629
|
+
left: 50%;
|
|
630
|
+
width: 25%;
|
|
631
|
+
height: 25%;
|
|
632
|
+
background: currentColor;
|
|
633
|
+
border-radius: 9999px;
|
|
634
|
+
transform: translate(-50%, -50%);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
${rotationCss("orbit")}
|
|
638
|
+
`;
|
|
639
|
+
function Orbit({ easing, ...rest }) {
|
|
640
|
+
return /* @__PURE__ */ jsxs10(Fragment10, { children: [
|
|
641
|
+
/* @__PURE__ */ jsx11(SpinnerStyle, { name: "orbit", children: css10 }),
|
|
642
|
+
/* @__PURE__ */ jsxs10("div", { ...spinnerRoot("orbit", rest), children: [
|
|
643
|
+
/* @__PURE__ */ jsx11("div", { className: "ld-orbit-dot" }),
|
|
644
|
+
/* @__PURE__ */ jsx11("div", { className: `ld-orbit-track ${spinClass("orbit", easing)}` })
|
|
645
|
+
] })
|
|
646
|
+
] });
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// src/pulse.tsx
|
|
650
|
+
import { Fragment as Fragment11, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
651
|
+
var css11 = `
|
|
652
|
+
.ld-pulse {
|
|
653
|
+
width: ${SIZE};
|
|
654
|
+
height: ${SIZE};
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
.ld-pulse-ring {
|
|
658
|
+
transform-origin: center;
|
|
659
|
+
animation: ld-pulse-ripple ${duration("pulse")} ease-out infinite;
|
|
660
|
+
animation-play-state: ${PLAY_STATE};
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
@keyframes ld-pulse-ripple {
|
|
664
|
+
from {
|
|
665
|
+
opacity: 0.4;
|
|
666
|
+
transform: scale(0.25);
|
|
667
|
+
}
|
|
668
|
+
to {
|
|
669
|
+
opacity: 0;
|
|
670
|
+
transform: scale(1);
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
@media (prefers-reduced-motion: reduce) {
|
|
675
|
+
.ld-pulse-ring {
|
|
676
|
+
opacity: 0.2;
|
|
677
|
+
animation: none;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
`;
|
|
681
|
+
function Pulse(props) {
|
|
682
|
+
return /* @__PURE__ */ jsxs11(Fragment11, { children: [
|
|
683
|
+
/* @__PURE__ */ jsx12(SpinnerStyle, { name: "pulse", children: css11 }),
|
|
684
|
+
/* @__PURE__ */ jsxs11(
|
|
685
|
+
"svg",
|
|
686
|
+
{
|
|
687
|
+
...spinnerRoot("pulse", props),
|
|
688
|
+
fill: "none",
|
|
689
|
+
role: "presentation",
|
|
690
|
+
viewBox: "0 0 16 16",
|
|
691
|
+
children: [
|
|
692
|
+
/* @__PURE__ */ jsx12(
|
|
693
|
+
"circle",
|
|
694
|
+
{
|
|
695
|
+
className: "ld-pulse-ring",
|
|
696
|
+
cx: "8",
|
|
697
|
+
cy: "8",
|
|
698
|
+
fill: "currentColor",
|
|
699
|
+
r: "8"
|
|
700
|
+
}
|
|
701
|
+
),
|
|
702
|
+
/* @__PURE__ */ jsx12("circle", { cx: "8", cy: "8", fill: "currentColor", r: "2" })
|
|
703
|
+
]
|
|
704
|
+
}
|
|
705
|
+
)
|
|
706
|
+
] });
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
// src/radar.tsx
|
|
710
|
+
import { useId } from "react";
|
|
711
|
+
import { Fragment as Fragment12, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
712
|
+
var css12 = `
|
|
713
|
+
.ld-radar {
|
|
714
|
+
width: ${SIZE};
|
|
715
|
+
height: ${SIZE};
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
${rotationCss("radar")}
|
|
719
|
+
`;
|
|
720
|
+
function Radar({ easing, ...rest }) {
|
|
721
|
+
const beamGradient = useId();
|
|
722
|
+
return /* @__PURE__ */ jsxs12(Fragment12, { children: [
|
|
723
|
+
/* @__PURE__ */ jsx13(SpinnerStyle, { name: "radar", children: css12 }),
|
|
724
|
+
/* @__PURE__ */ jsxs12(
|
|
725
|
+
"svg",
|
|
726
|
+
{
|
|
727
|
+
...spinnerRoot("radar", rest),
|
|
728
|
+
fill: "none",
|
|
729
|
+
role: "presentation",
|
|
730
|
+
viewBox: "0 0 16 16",
|
|
731
|
+
children: [
|
|
732
|
+
/* @__PURE__ */ jsx13("defs", { children: /* @__PURE__ */ jsxs12(
|
|
733
|
+
"radialGradient",
|
|
734
|
+
{
|
|
735
|
+
cx: "8",
|
|
736
|
+
cy: "8",
|
|
737
|
+
gradientUnits: "userSpaceOnUse",
|
|
738
|
+
id: beamGradient,
|
|
739
|
+
r: "8",
|
|
740
|
+
children: [
|
|
741
|
+
/* @__PURE__ */ jsx13("stop", { offset: "0.3334", stopColor: "currentColor" }),
|
|
742
|
+
/* @__PURE__ */ jsx13("stop", { offset: "1", stopColor: "currentColor", stopOpacity: "0" })
|
|
743
|
+
]
|
|
744
|
+
}
|
|
745
|
+
) }),
|
|
746
|
+
/* @__PURE__ */ jsx13("circle", { cx: "8", cy: "8", fill: "currentColor", opacity: "0.2", r: "8" }),
|
|
747
|
+
/* @__PURE__ */ jsx13("circle", { cx: "8", cy: "8", opacity: "0.2", r: "5.5", stroke: "currentColor" }),
|
|
748
|
+
/* @__PURE__ */ jsx13(
|
|
749
|
+
"path",
|
|
750
|
+
{
|
|
751
|
+
className: spinClass("radar", easing),
|
|
752
|
+
d: "M8 0C9.50657 0 10.9824 0.425672 12.2578 1.22754C13.5333 2.02953 14.557 3.17533 15.21 4.5332C15.8629 5.89107 16.1193 7.40626 15.9492 8.90332C15.7791 10.4001 15.1896 11.8184 14.249 12.9951L10.4707 9.69922C10.8037 9.21598 11 8.63123 11 8C11 6.34315 9.65685 5 8 5V0Z",
|
|
753
|
+
fill: `url(#${beamGradient})`
|
|
754
|
+
}
|
|
755
|
+
),
|
|
756
|
+
/* @__PURE__ */ jsx13("circle", { cx: "8", cy: "8", fill: "currentColor", r: "2" })
|
|
757
|
+
]
|
|
758
|
+
}
|
|
759
|
+
)
|
|
760
|
+
] });
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// src/ring.tsx
|
|
764
|
+
import { Fragment as Fragment13, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
765
|
+
var css13 = `
|
|
766
|
+
.ld-ring {
|
|
767
|
+
width: ${SIZE};
|
|
768
|
+
height: ${SIZE};
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
${rotationCss("ring")}
|
|
772
|
+
`;
|
|
773
|
+
function Ring({ easing, ...rest }) {
|
|
774
|
+
return /* @__PURE__ */ jsxs13(Fragment13, { children: [
|
|
775
|
+
/* @__PURE__ */ jsx14(SpinnerStyle, { name: "ring", children: css13 }),
|
|
776
|
+
/* @__PURE__ */ jsxs13(
|
|
777
|
+
"svg",
|
|
778
|
+
{
|
|
779
|
+
...spinnerRoot("ring", rest),
|
|
780
|
+
fill: "none",
|
|
781
|
+
role: "presentation",
|
|
782
|
+
viewBox: "0 0 24 24",
|
|
783
|
+
children: [
|
|
784
|
+
/* @__PURE__ */ jsx14(
|
|
785
|
+
"circle",
|
|
786
|
+
{
|
|
787
|
+
cx: "12",
|
|
788
|
+
cy: "12",
|
|
789
|
+
opacity: "0.2",
|
|
790
|
+
r: "10",
|
|
791
|
+
stroke: "currentColor",
|
|
792
|
+
strokeWidth: "2.5"
|
|
793
|
+
}
|
|
794
|
+
),
|
|
795
|
+
/* @__PURE__ */ jsx14(
|
|
796
|
+
"circle",
|
|
797
|
+
{
|
|
798
|
+
className: spinClass("ring", easing),
|
|
799
|
+
cx: "12",
|
|
800
|
+
cy: "12",
|
|
801
|
+
r: "10",
|
|
802
|
+
stroke: "currentColor",
|
|
803
|
+
strokeDasharray: "16 46.8",
|
|
804
|
+
strokeLinecap: "round",
|
|
805
|
+
strokeWidth: "2.5"
|
|
806
|
+
}
|
|
807
|
+
)
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
)
|
|
811
|
+
] });
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// src/swirl.tsx
|
|
815
|
+
import { Fragment as Fragment14, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
816
|
+
var RING = [0, 1, 2, 7, null, 3, 6, 5, 4];
|
|
817
|
+
var CELLS = RING.map((place) => ({
|
|
818
|
+
place,
|
|
819
|
+
step: place === null ? null : (8 - place) % 8
|
|
820
|
+
}));
|
|
821
|
+
var dur6 = duration("swirl");
|
|
822
|
+
var css14 = `
|
|
823
|
+
.ld-swirl {
|
|
824
|
+
display: grid;
|
|
825
|
+
grid-template-columns: repeat(3, 1fr);
|
|
826
|
+
grid-template-rows: repeat(3, 1fr);
|
|
827
|
+
gap: calc(${SIZE} * 0.15625);
|
|
828
|
+
box-sizing: border-box;
|
|
829
|
+
width: ${SIZE};
|
|
830
|
+
height: ${SIZE};
|
|
831
|
+
padding: calc(${SIZE} * 0.0625);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
.ld-swirl-cell {
|
|
835
|
+
background: currentColor;
|
|
836
|
+
border-radius: calc(${SIZE} * 0.0625);
|
|
837
|
+
animation: ld-swirl-fade ${dur6} linear infinite;
|
|
838
|
+
animation-delay: calc(${dur6} * var(--ld-swirl-step) / -8);
|
|
839
|
+
animation-play-state: ${PLAY_STATE};
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
@keyframes ld-swirl-fade {
|
|
843
|
+
from {
|
|
844
|
+
opacity: 1;
|
|
845
|
+
}
|
|
846
|
+
to {
|
|
847
|
+
opacity: 0.2;
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
@media (prefers-reduced-motion: reduce) {
|
|
852
|
+
.ld-swirl-cell {
|
|
853
|
+
opacity: 0.6;
|
|
854
|
+
animation: none;
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
`;
|
|
858
|
+
function Swirl(props) {
|
|
859
|
+
return /* @__PURE__ */ jsxs14(Fragment14, { children: [
|
|
860
|
+
/* @__PURE__ */ jsx15(SpinnerStyle, { name: "swirl", children: css14 }),
|
|
861
|
+
/* @__PURE__ */ jsx15("div", { ...spinnerRoot("swirl", props), children: CELLS.map(
|
|
862
|
+
(cell, index) => cell.step === null ? /* @__PURE__ */ jsx15("div", {}, index) : /* @__PURE__ */ jsx15(
|
|
863
|
+
"div",
|
|
864
|
+
{
|
|
865
|
+
className: "ld-swirl-cell",
|
|
866
|
+
style: cssVars({ "--ld-swirl-step": cell.step })
|
|
867
|
+
},
|
|
868
|
+
index
|
|
869
|
+
)
|
|
870
|
+
) })
|
|
871
|
+
] });
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
// src/spinners.ts
|
|
875
|
+
var SPINNERS = {
|
|
876
|
+
arc: Arc,
|
|
877
|
+
"bouncing-dots": BouncingDots,
|
|
878
|
+
"circular-dots": CircularDots,
|
|
879
|
+
classic: Classic,
|
|
880
|
+
"classic-v2": ClassicV2,
|
|
881
|
+
clock: Clock,
|
|
882
|
+
comet: Comet,
|
|
883
|
+
compass: Compass,
|
|
884
|
+
"linear-dots": LinearDots,
|
|
885
|
+
orbit: Orbit,
|
|
886
|
+
pulse: Pulse,
|
|
887
|
+
radar: Radar,
|
|
888
|
+
ring: Ring,
|
|
889
|
+
swirl: Swirl
|
|
890
|
+
};
|
|
891
|
+
export {
|
|
892
|
+
Arc,
|
|
893
|
+
BouncingDots,
|
|
894
|
+
CircularDots,
|
|
895
|
+
Classic,
|
|
896
|
+
ClassicV2,
|
|
897
|
+
Clock,
|
|
898
|
+
Comet,
|
|
899
|
+
Compass,
|
|
900
|
+
DURATION_VAR,
|
|
901
|
+
LinearDots,
|
|
902
|
+
Orbit,
|
|
903
|
+
PLAY_STATE_VAR,
|
|
904
|
+
Pulse,
|
|
905
|
+
Radar,
|
|
906
|
+
Ring,
|
|
907
|
+
SPINNERS,
|
|
908
|
+
SPINNER_MOTION,
|
|
909
|
+
Swirl
|
|
910
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "loading-dev",
|
|
3
|
+
"version": "0.3.1",
|
|
4
|
+
"description": "A lightweight library full of beautiful loading indicators for React.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"spinner",
|
|
8
|
+
"loading",
|
|
9
|
+
"loader",
|
|
10
|
+
"indicator"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/jakubkrehel/loading.git"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"import": "./dist/index.js"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsup",
|
|
32
|
+
"build:web": "pnpm --filter web build",
|
|
33
|
+
"dev": "pnpm run \"/^dev:/\"",
|
|
34
|
+
"dev:lib": "tsup --watch src",
|
|
35
|
+
"dev:web": "pnpm --filter web dev",
|
|
36
|
+
"fix": "biome check --write .",
|
|
37
|
+
"format": "biome format --write .",
|
|
38
|
+
"lint": "biome check .",
|
|
39
|
+
"prepublishOnly": "tsup",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@biomejs/biome": "^2.5.13",
|
|
45
|
+
"@types/react": "^19",
|
|
46
|
+
"@types/react-dom": "^19.2.4",
|
|
47
|
+
"react": "19.2.6",
|
|
48
|
+
"react-dom": "19.2.6",
|
|
49
|
+
"tsup": "^8.5.0",
|
|
50
|
+
"typescript": "^5",
|
|
51
|
+
"ultracite": "^7.11.1",
|
|
52
|
+
"vitest": "^4.1.11"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": ">=19.0.0",
|
|
56
|
+
"react-dom": ">=19.0.0"
|
|
57
|
+
},
|
|
58
|
+
"packageManager": "pnpm@11.8.0"
|
|
59
|
+
}
|