@solostylist/ui-kit 1.0.166 → 1.0.167
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/dist/main.d.ts +2 -0
- package/dist/main.js +73 -71
- package/dist/s-ai-tool-bar/s-ai-tool-bar.d.ts +12 -2
- package/dist/s-ai-tool-bar/s-ai-tool-bar.js +233 -200
- package/dist/s-pixel-reveal/index.d.ts +2 -0
- package/dist/s-pixel-reveal/index.js +4 -0
- package/dist/s-pixel-reveal/package.json +5 -0
- package/dist/s-pixel-reveal/s-pixel-reveal.d.ts +13 -0
- package/dist/s-pixel-reveal/s-pixel-reveal.js +151 -0
- package/dist/theme/components/alert.d.ts +52 -52
- package/dist/theme/components/button.d.ts +80 -80
- package/dist/theme/components/chip.d.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface SPixelRevealProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
3
|
+
gap?: number;
|
|
4
|
+
speed?: number;
|
|
5
|
+
colors?: string[];
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
src?: string;
|
|
8
|
+
alt?: string;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
instant?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare const SPixelReveal: React.ForwardRefExoticComponent<SPixelRevealProps & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export default SPixelReveal;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
var Q = Object.defineProperty;
|
|
2
|
+
var U = (i, t, n) => t in i ? Q(i, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : i[t] = n;
|
|
3
|
+
var s = (i, t, n) => U(i, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { j as F } from "../jsx-runtime-OVHDjVDe.js";
|
|
5
|
+
import { forwardRef as Z, useRef as u, useCallback as A, useEffect as _ } from "react";
|
|
6
|
+
import { brand as q } from "../theme/theme-primitives.js";
|
|
7
|
+
class ee {
|
|
8
|
+
constructor(t, n, a, S, M, b, g) {
|
|
9
|
+
s(this, "x");
|
|
10
|
+
s(this, "y");
|
|
11
|
+
s(this, "color");
|
|
12
|
+
s(this, "speed");
|
|
13
|
+
s(this, "size");
|
|
14
|
+
s(this, "sizeStep");
|
|
15
|
+
s(this, "minSize");
|
|
16
|
+
s(this, "maxSize");
|
|
17
|
+
s(this, "delay");
|
|
18
|
+
s(this, "counter");
|
|
19
|
+
s(this, "counterStep");
|
|
20
|
+
s(this, "isReverse");
|
|
21
|
+
s(this, "isShimmer");
|
|
22
|
+
this.x = t, this.y = n, this.color = a, this.speed = (Math.random() * 0.8 + 0.1) * S, this.size = 0, this.sizeStep = Math.random() * 0.4, this.minSize = 0.5, this.maxSize = g, this.delay = M, this.counter = 0, this.counterStep = b, this.isReverse = !1, this.isShimmer = !1;
|
|
23
|
+
}
|
|
24
|
+
update(t) {
|
|
25
|
+
return t ? this.counter < this.delay ? (this.counter += this.counterStep, !0) : (this.isShimmer ? this.isReverse ? (this.size -= this.speed, this.size <= this.minSize && (this.size = this.minSize, this.isReverse = !1)) : (this.size += this.speed, this.size >= this.maxSize && (this.size = this.maxSize, this.isReverse = !0)) : this.size < this.maxSize ? this.size += this.sizeStep : this.isShimmer = !0, !0) : (this.isShimmer = !1, this.counter = 0, this.size > 0 ? (this.size -= 0.1, !0) : !1);
|
|
26
|
+
}
|
|
27
|
+
draw(t, n) {
|
|
28
|
+
const a = (n - this.size) * 0.5;
|
|
29
|
+
t.fillRect(this.x + a, this.y + a, this.size, this.size);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const te = Z(
|
|
33
|
+
({
|
|
34
|
+
gap: i = 5,
|
|
35
|
+
speed: t = 100,
|
|
36
|
+
colors: n = [q[400], q[500], q[600]],
|
|
37
|
+
loading: a = !0,
|
|
38
|
+
src: S,
|
|
39
|
+
alt: M = "",
|
|
40
|
+
style: b,
|
|
41
|
+
children: g,
|
|
42
|
+
instant: E = !0,
|
|
43
|
+
...$
|
|
44
|
+
}, w) => {
|
|
45
|
+
const C = u(null), R = u(null), D = u(null), z = u(/* @__PURE__ */ new Map()), l = u(null), k = u(1e3 / 60), I = u(performance.now()), O = u(
|
|
46
|
+
typeof window < "u" ? window.matchMedia("(prefers-reduced-motion: reduce)").matches : !1
|
|
47
|
+
), V = A((e, c, f, h) => {
|
|
48
|
+
const r = e - f, o = c - h;
|
|
49
|
+
return r * r + o * o;
|
|
50
|
+
}, []), X = A(() => {
|
|
51
|
+
const e = C.current, c = e == null ? void 0 : e.getContext("2d");
|
|
52
|
+
if (!e || !c) return;
|
|
53
|
+
z.current = /* @__PURE__ */ new Map();
|
|
54
|
+
const f = O.current ? 0 : Math.max(0, Math.min(100, t)) * 1e-3, h = window.devicePixelRatio || 1, r = e.width / h, o = e.height / h, p = 2, Y = 0.5, H = (r + o) * 0.01, T = r % i / 2, W = o % i / 2;
|
|
55
|
+
for (let m = T; m < r; m += i)
|
|
56
|
+
for (let d = W; d < o; d += i) {
|
|
57
|
+
const x = n[Math.floor(Math.random() * n.length)];
|
|
58
|
+
let v = 0;
|
|
59
|
+
if (!E && !O.current) {
|
|
60
|
+
const G = m + i / 2, J = d + i / 2, K = r / 2, L = o / 2;
|
|
61
|
+
v = Math.sqrt(V(G, J, K, L));
|
|
62
|
+
}
|
|
63
|
+
const j = Math.random() * 4 + H, y = Math.random() * (p - Y) + Y, N = new ee(m, d, x, f, v, j, y);
|
|
64
|
+
z.current.has(x) || z.current.set(x, []), z.current.get(x).push(N);
|
|
65
|
+
}
|
|
66
|
+
l.current && cancelAnimationFrame(l.current);
|
|
67
|
+
const B = () => {
|
|
68
|
+
l.current = requestAnimationFrame(B);
|
|
69
|
+
const m = performance.now(), d = m - I.current;
|
|
70
|
+
if (d < k.current) return;
|
|
71
|
+
I.current = m - d % k.current, c.clearRect(0, 0, r, o);
|
|
72
|
+
let x = !1;
|
|
73
|
+
z.current.forEach((v, j) => {
|
|
74
|
+
c.fillStyle = j;
|
|
75
|
+
for (const y of v)
|
|
76
|
+
y.update(a) && (y.draw(c, i), x = !0);
|
|
77
|
+
}), !a && !x && l.current && (cancelAnimationFrame(l.current), l.current = null);
|
|
78
|
+
};
|
|
79
|
+
B();
|
|
80
|
+
}, [i, t, n, E, a, V]), P = A(() => {
|
|
81
|
+
const e = C.current, c = R.current, f = e == null ? void 0 : e.getContext("2d");
|
|
82
|
+
if (!e || !c || !f) return;
|
|
83
|
+
const h = c.getBoundingClientRect();
|
|
84
|
+
if (h.width === 0 || h.height === 0) return;
|
|
85
|
+
const r = Math.floor(h.width), o = Math.floor(h.height), p = window.devicePixelRatio || 1;
|
|
86
|
+
e.width = r * p, e.height = o * p, e.style.width = `${r}px`, e.style.height = `${o}px`, f.setTransform(1, 0, 0, 1, 0, 0), f.scale(p, p), X();
|
|
87
|
+
}, [X]);
|
|
88
|
+
return _(() => {
|
|
89
|
+
P();
|
|
90
|
+
const e = new ResizeObserver(() => {
|
|
91
|
+
requestAnimationFrame(() => P());
|
|
92
|
+
});
|
|
93
|
+
return R.current && e.observe(R.current), () => {
|
|
94
|
+
e.disconnect(), l.current && cancelAnimationFrame(l.current);
|
|
95
|
+
};
|
|
96
|
+
}, [P]), /* @__PURE__ */ F.jsxs(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
ref: (e) => {
|
|
100
|
+
R.current = e, typeof w == "function" ? w(e) : w && (w.current = e);
|
|
101
|
+
},
|
|
102
|
+
style: {
|
|
103
|
+
position: "relative",
|
|
104
|
+
width: "100%",
|
|
105
|
+
height: "100%",
|
|
106
|
+
overflow: "hidden",
|
|
107
|
+
...b
|
|
108
|
+
},
|
|
109
|
+
...$,
|
|
110
|
+
children: [
|
|
111
|
+
S && /* @__PURE__ */ F.jsx(
|
|
112
|
+
"img",
|
|
113
|
+
{
|
|
114
|
+
ref: D,
|
|
115
|
+
src: S,
|
|
116
|
+
alt: M,
|
|
117
|
+
style: {
|
|
118
|
+
position: "absolute",
|
|
119
|
+
inset: 0,
|
|
120
|
+
width: "100%",
|
|
121
|
+
height: "100%",
|
|
122
|
+
objectFit: "cover",
|
|
123
|
+
display: "block"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
g,
|
|
128
|
+
/* @__PURE__ */ F.jsx(
|
|
129
|
+
"canvas",
|
|
130
|
+
{
|
|
131
|
+
ref: C,
|
|
132
|
+
style: {
|
|
133
|
+
position: "absolute",
|
|
134
|
+
inset: 0,
|
|
135
|
+
display: "block",
|
|
136
|
+
width: "100%",
|
|
137
|
+
height: "100%",
|
|
138
|
+
pointerEvents: "none",
|
|
139
|
+
zIndex: 1
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
te.displayName = "SPixelReveal";
|
|
149
|
+
export {
|
|
150
|
+
te as default
|
|
151
|
+
};
|