useblysh 1.0.1 → 1.0.5
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 -21
- package/README.md +8 -9
- package/dist/useblysh.js +1 -1
- package/dist/useblysh.mjs +51 -49
- package/dist/useblysh.test.d.ts +1 -0
- package/package.json +4 -3
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 RISHABH MISHRA
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RISHABH MISHRA
|
|
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
CHANGED
|
@@ -61,15 +61,14 @@ const handleUpload = (event) => {
|
|
|
61
61
|
The `ImageHash` component handles everything: it shows the blur immediately and fades in the real image once it's ready.
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
|
-
import { ImageHash } from 'useblysh';
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
);
|
|
64
|
+
import { ImageHash } from 'useblysh';
|
|
65
|
+
|
|
66
|
+
<ImageHash
|
|
67
|
+
key={id} // Passing the key is a good thing
|
|
68
|
+
hash={storedHash} // The short string from your DB
|
|
69
|
+
src={imageUrl} // The real high-quality image URL
|
|
70
|
+
className="w-full h-64 rounded-xl"
|
|
71
|
+
/>
|
|
73
72
|
```
|
|
74
73
|
|
|
75
74
|
|
package/dist/useblysh.js
CHANGED
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,f,d,j,d),ae[d+f]=!0)}if(d=null,u!==void 0&&(s(u),d=""+u),b(n)&&(s(n.key),d=""+n.key),"key"in n){u={};for(var q in n)q!=="key"&&(u[q]=n[q])}else u=n;return d&&v(u,typeof e=="function"?e.displayName||e.name||"Unknown":e),_(e,d,u,o(),U,J)}function p(e){a(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===V&&(e._payload.status==="fulfilled"?a(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function a(e){return typeof e=="object"&&e!==null&&e.$$typeof===R}var l=T,R=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),x=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),ue=Symbol.for("react.suspense_list"),fe=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),me=Symbol.for("react.client.reference"),z=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,be=Array.isArray,B=console.createTask?console.createTask:function(){return null};l={react_stack_bottom_frame:function(e){return e()}};var ee,te={},re=l.react_stack_bottom_frame.bind(l,i)(),ne=B(c(i)),ae={};D.Fragment=y,D.jsx=function(e,n,u){var f=1e4>z.recentlyCreatedOwnerStacks++;return g(e,n,u,!1,f?Error("react-stack-top-frame"):re,f?B(c(e)):ne)},D.jsxs=function(e,n,u){var f=1e4>z.recentlyCreatedOwnerStacks++;return g(e,n,u,!0,f?Error("react-stack-top-frame"):re,f?B(c(e)):ne)}})()),D}var $;function le(){return $||($=1,process.env.NODE_ENV==="production"?F.exports=se():F.exports=ce()),F.exports}var L=le();const W=T.forwardRef(({hash:r,width:t=32,height:s=32,punch:c=1,...o},i)=>{const b=T.useRef(null),[v,E]=T.useState(!1);return T.useImperativeHandle(i,()=>b.current),T.useEffect(()=>{const _=b.current;if(!_)return;const g=new IntersectionObserver(p=>{p[0].isIntersecting&&(E(!0),g.disconnect())},{rootMargin:"100px"});return g.observe(_),()=>g.disconnect()},[]),T.useEffect(()=>{const _=b.current;if(!_||!r||!v)return;const g=_.getContext("2d");if(!g)return;const p=setTimeout(()=>{try{const a=X(r,t,s,c),l=new ImageData(a,t,s);g.putImageData(l,0,0)}catch(a){console.error("Failed to render ImageHash:",a)}},0);return()=>clearTimeout(p)},[r,t,s,c,v]),L.jsx("canvas",{ref:b,width:t,height:s,style:{imageRendering:"pixelated",...o.style},...o})});W.displayName="ImageHashCanvas";const ie=({hash:r,src:t,className:s,style:c,...o})=>{const[i,b]=T.useState(!1),{style:v,...E}=o;return L.jsxs("div",{className:s,style:{position:"relative",overflow:"hidden",display:"inline-block",...c},children:[L.jsx(W,{hash:r,style:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:i?0:1,transition:"opacity 0.5s ease-in-out",pointerEvents:"none"}}),L.jsx("img",{...E,src:t,loading:"lazy",onLoad:()=>b(!0),style:{display:"block",width:"100%",height:"100%",opacity:i?1:0,transition:"opacity 0.5s ease-in-out",...v}})]})};m.CHARACTERS=H,m.ImageHash=ie,m.ImageHashCanvas=W,m.decode=X,m.decodeBase83=I,m.encode=G,m.encodeBase83=O,m.encodeImage=oe,m.linearToSrgb=P,m.signPow=C,m.srgbToLinear=S,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,f,d,j,d),ae[d+f]=!0)}if(d=null,u!==void 0&&(s(u),d=""+u),b(n)&&(s(n.key),d=""+n.key),"key"in n){u={};for(var q in n)q!=="key"&&(u[q]=n[q])}else u=n;return d&&v(u,typeof e=="function"?e.displayName||e.name||"Unknown":e),_(e,d,u,o(),U,J)}function p(e){a(e)?e._store&&(e._store.validated=1):typeof e=="object"&&e!==null&&e.$$typeof===V&&(e._payload.status==="fulfilled"?a(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function a(e){return typeof e=="object"&&e!==null&&e.$$typeof===R}var l=T,R=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),x=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),Y=Symbol.for("react.suspense"),ue=Symbol.for("react.suspense_list"),fe=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),me=Symbol.for("react.client.reference"),z=l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=Object.prototype.hasOwnProperty,be=Array.isArray,B=console.createTask?console.createTask:function(){return null};l={react_stack_bottom_frame:function(e){return e()}};var ee,te={},re=l.react_stack_bottom_frame.bind(l,i)(),ne=B(c(i)),ae={};D.Fragment=y,D.jsx=function(e,n,u){var f=1e4>z.recentlyCreatedOwnerStacks++;return g(e,n,u,!1,f?Error("react-stack-top-frame"):re,f?B(c(e)):ne)},D.jsxs=function(e,n,u){var f=1e4>z.recentlyCreatedOwnerStacks++;return g(e,n,u,!0,f?Error("react-stack-top-frame"):re,f?B(c(e)):ne)}})()),D}var $;function le(){return $||($=1,process.env.NODE_ENV==="production"?F.exports=se():F.exports=ce()),F.exports}var L=le();const W=T.forwardRef(({hash:r,width:t=32,height:s=32,punch:c=1,...o},i)=>{const b=T.useRef(null),[v,E]=T.useState(!1);return T.useImperativeHandle(i,()=>b.current),T.useEffect(()=>{const _=b.current;if(!_)return;const g=new IntersectionObserver(p=>{p[0].isIntersecting&&(E(!0),g.disconnect())},{rootMargin:"100px"});return g.observe(_),()=>g.disconnect()},[]),T.useEffect(()=>{const _=b.current;if(!_||!r||!v)return;const g=_.getContext("2d");if(!g)return;const p=setTimeout(()=>{try{const a=X(r,t,s,c),l=new ImageData(a,t,s);g.putImageData(l,0,0)}catch(a){console.error("Failed to render ImageHash:",a)}},0);return()=>clearTimeout(p)},[r,t,s,c,v]),L.jsx("canvas",{ref:b,width:t,height:s,style:{imageRendering:"pixelated",...o.style},...o})});W.displayName="ImageHashCanvas";const ie=({hash:r,src:t,className:s,style:c,...o})=>{const[i,b]=T.useState(!1),{style:v,...E}=o;return L.jsxs("div",{className:s,style:{position:"relative",overflow:"hidden",display:"inline-block",...c},children:[L.jsx(W,{hash:r,className:s,style:{position:"absolute",inset:0,width:"100%",height:"100%",opacity:i?0:1,transition:"opacity 0.5s ease-in-out",pointerEvents:"none"}}),L.jsx("img",{...E,className:s,src:t,loading:"lazy",onLoad:()=>b(!0),style:{display:"block",width:"100%",height:"100%",opacity:i?1:0,transition:"opacity 0.5s ease-in-out",...v}})]})};m.CHARACTERS=H,m.ImageHash=ie,m.ImageHashCanvas=W,m.decode=X,m.decodeBase83=I,m.encode=G,m.encodeBase83=O,m.encodeImage=oe,m.linearToSrgb=P,m.signPow=C,m.srgbToLinear=S,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/useblysh.mjs
CHANGED
|
@@ -2,15 +2,15 @@ import ee, { forwardRef as ie, useRef as ue, useState as fe, useImperativeHandle
|
|
|
2
2
|
const te = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~", C = (r, t) => {
|
|
3
3
|
let s = "";
|
|
4
4
|
for (let c = 1; c <= t; c++) {
|
|
5
|
-
const
|
|
6
|
-
s += te[
|
|
5
|
+
const a = Math.floor(r / Math.pow(83, t - c)) % 83;
|
|
6
|
+
s += te[a];
|
|
7
7
|
}
|
|
8
8
|
return s;
|
|
9
9
|
}, D = (r) => {
|
|
10
10
|
let t = 0;
|
|
11
11
|
for (let s = 0; s < r.length; s++) {
|
|
12
|
-
const c = r[s],
|
|
13
|
-
t = t * 83 +
|
|
12
|
+
const c = r[s], a = te.indexOf(c);
|
|
13
|
+
t = t * 83 + a;
|
|
14
14
|
}
|
|
15
15
|
return t;
|
|
16
16
|
}, w = (r) => {
|
|
@@ -19,17 +19,17 @@ const te = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,
|
|
|
19
19
|
}, O = (r) => {
|
|
20
20
|
const t = Math.max(0, Math.min(1, r));
|
|
21
21
|
return t <= 31308e-7 ? Math.round(t * 12.92 * 255) : Math.round((1.055 * Math.pow(t, 1 / 2.4) - 0.055) * 255);
|
|
22
|
-
}, P = (r, t) => Math.sign(r) * Math.pow(Math.abs(r), t), me = (r, t, s, c = 4,
|
|
23
|
-
if (c < 1 || c > 9 ||
|
|
22
|
+
}, P = (r, t) => Math.sign(r) * Math.pow(Math.abs(r), t), me = (r, t, s, c = 4, a = 3) => {
|
|
23
|
+
if (c < 1 || c > 9 || a < 1 || a > 9)
|
|
24
24
|
throw new Error("Components must be between 1 and 9");
|
|
25
25
|
const i = [];
|
|
26
|
-
for (let
|
|
26
|
+
for (let o = 0; o < a; o++)
|
|
27
27
|
for (let l = 0; l < c; l++) {
|
|
28
|
-
const v = (l === 0 ? 1 : 2) * (
|
|
28
|
+
const v = (l === 0 ? 1 : 2) * (o === 0 ? 1 : 2);
|
|
29
29
|
let g = 0, T = 0, M = 0;
|
|
30
30
|
for (let x = 0; x < s; x++)
|
|
31
31
|
for (let y = 0; y < t; y++) {
|
|
32
|
-
const A = Math.cos(Math.PI * l * y / t) * Math.cos(Math.PI *
|
|
32
|
+
const A = Math.cos(Math.PI * l * y / t) * Math.cos(Math.PI * o * x / s), S = (x * t + y) * 4;
|
|
33
33
|
g += A * w(r[S]), T += A * w(r[S + 1]), M += A * w(r[S + 2]);
|
|
34
34
|
}
|
|
35
35
|
const h = v / (t * s);
|
|
@@ -37,43 +37,43 @@ const te = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,
|
|
|
37
37
|
}
|
|
38
38
|
const m = i[0], E = i.slice(1);
|
|
39
39
|
let b = "";
|
|
40
|
-
b += C(c - 1 + (
|
|
40
|
+
b += C(c - 1 + (a - 1) * 9, 1);
|
|
41
41
|
let p = 1;
|
|
42
42
|
if (E.length > 0) {
|
|
43
|
-
const
|
|
43
|
+
const o = Math.max(...E.map((v) => Math.max(Math.abs(v[0]), Math.abs(v[1]), Math.abs(v[2])))), l = Math.max(0, Math.min(82, Math.floor(o * 166 - 0.5)));
|
|
44
44
|
b += C(l, 1), p = (l + 1) / 166;
|
|
45
45
|
} else
|
|
46
46
|
b += C(0, 1);
|
|
47
|
-
b += C(((
|
|
48
|
-
const l = O(
|
|
47
|
+
b += C(((o) => {
|
|
48
|
+
const l = O(o[0]), v = O(o[1]), g = O(o[2]);
|
|
49
49
|
return (l << 16) + (v << 8) + g;
|
|
50
50
|
})(m), 4);
|
|
51
|
-
const R = (
|
|
52
|
-
const v = Math.max(0, Math.min(18, Math.floor(P(
|
|
51
|
+
const R = (o, l) => {
|
|
52
|
+
const v = Math.max(0, Math.min(18, Math.floor(P(o[0] / l, 0.5) * 9 + 9.5))), g = Math.max(0, Math.min(18, Math.floor(P(o[1] / l, 0.5) * 9 + 9.5))), T = Math.max(0, Math.min(18, Math.floor(P(o[2] / l, 0.5) * 9 + 9.5)));
|
|
53
53
|
return v * 19 * 19 + g * 19 + T;
|
|
54
54
|
};
|
|
55
|
-
for (const
|
|
56
|
-
b += C(R(
|
|
55
|
+
for (const o of E)
|
|
56
|
+
b += C(R(o, p), 2);
|
|
57
57
|
return b;
|
|
58
58
|
}, Re = (r, t = 4, s = 3) => {
|
|
59
59
|
const c = document.createElement("canvas");
|
|
60
60
|
c.width = 32, c.height = 32;
|
|
61
|
-
const
|
|
62
|
-
if (!
|
|
63
|
-
|
|
64
|
-
const i =
|
|
61
|
+
const a = c.getContext("2d");
|
|
62
|
+
if (!a) throw new Error("Could not create canvas context");
|
|
63
|
+
a.drawImage(r, 0, 0, 32, 32);
|
|
64
|
+
const i = a.getImageData(0, 0, 32, 32);
|
|
65
65
|
return me(i.data, 32, 32, t, s);
|
|
66
66
|
}, be = (r, t, s, c = 1) => {
|
|
67
67
|
if (!r || r.length < 6)
|
|
68
68
|
throw new Error("The hash is invalid.");
|
|
69
|
-
const
|
|
69
|
+
const a = D(r[0]), i = a % 9 + 1, m = Math.floor(a / 9) + 1, b = (D(r[1]) + 1) / 166, p = [], _ = D(r.substring(2, 6));
|
|
70
70
|
p.push([
|
|
71
71
|
w(_ >> 16 & 255),
|
|
72
72
|
w(_ >> 8 & 255),
|
|
73
73
|
w(_ & 255)
|
|
74
74
|
]);
|
|
75
|
-
for (let
|
|
76
|
-
const l = D(r.substring(6 + (
|
|
75
|
+
for (let o = 1; o < i * m; o++) {
|
|
76
|
+
const l = D(r.substring(6 + (o - 1) * 2, 6 + o * 2));
|
|
77
77
|
p.push([
|
|
78
78
|
P((Math.floor(l / 361) - 9) / 9, 2) * b * c,
|
|
79
79
|
P((Math.floor(l / 19 % 19) - 9) / 9, 2) * b * c,
|
|
@@ -81,15 +81,15 @@ const te = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,
|
|
|
81
81
|
]);
|
|
82
82
|
}
|
|
83
83
|
const R = new Uint8ClampedArray(t * s * 4);
|
|
84
|
-
for (let
|
|
84
|
+
for (let o = 0; o < s; o++)
|
|
85
85
|
for (let l = 0; l < t; l++) {
|
|
86
86
|
let v = 0, g = 0, T = 0;
|
|
87
87
|
for (let h = 0; h < m; h++)
|
|
88
88
|
for (let x = 0; x < i; x++) {
|
|
89
|
-
const y = Math.cos(Math.PI * x * l / t) * Math.cos(Math.PI * h *
|
|
89
|
+
const y = Math.cos(Math.PI * x * l / t) * Math.cos(Math.PI * h * o / s), A = p[h * i + x];
|
|
90
90
|
v += A[0] * y, g += A[1] * y, T += A[2] * y;
|
|
91
91
|
}
|
|
92
|
-
const M = (
|
|
92
|
+
const M = (o * t + l) * 4;
|
|
93
93
|
R[M] = O(v), R[M + 1] = O(g), R[M + 2] = O(T), R[M + 3] = 255;
|
|
94
94
|
}
|
|
95
95
|
return R;
|
|
@@ -109,18 +109,18 @@ function Ee() {
|
|
|
109
109
|
if (Z) return j;
|
|
110
110
|
Z = 1;
|
|
111
111
|
var r = Symbol.for("react.transitional.element"), t = Symbol.for("react.fragment");
|
|
112
|
-
function s(c,
|
|
112
|
+
function s(c, a, i) {
|
|
113
113
|
var m = null;
|
|
114
|
-
if (i !== void 0 && (m = "" + i),
|
|
114
|
+
if (i !== void 0 && (m = "" + i), a.key !== void 0 && (m = "" + a.key), "key" in a) {
|
|
115
115
|
i = {};
|
|
116
|
-
for (var E in
|
|
117
|
-
E !== "key" && (i[E] =
|
|
118
|
-
} else i =
|
|
119
|
-
return
|
|
116
|
+
for (var E in a)
|
|
117
|
+
E !== "key" && (i[E] = a[E]);
|
|
118
|
+
} else i = a;
|
|
119
|
+
return a = i.ref, {
|
|
120
120
|
$$typeof: r,
|
|
121
121
|
type: c,
|
|
122
122
|
key: m,
|
|
123
|
-
ref:
|
|
123
|
+
ref: a !== void 0 ? a : null,
|
|
124
124
|
props: i
|
|
125
125
|
};
|
|
126
126
|
}
|
|
@@ -155,7 +155,7 @@ function ve() {
|
|
|
155
155
|
return "Suspense";
|
|
156
156
|
case ne:
|
|
157
157
|
return "SuspenseList";
|
|
158
|
-
case
|
|
158
|
+
case ae:
|
|
159
159
|
return "Activity";
|
|
160
160
|
}
|
|
161
161
|
if (typeof e == "object")
|
|
@@ -171,7 +171,7 @@ function ve() {
|
|
|
171
171
|
case A:
|
|
172
172
|
var n = e.render;
|
|
173
173
|
return e = e.displayName, e || (e = n.displayName || n.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
174
|
-
case
|
|
174
|
+
case oe:
|
|
175
175
|
return n = e.displayName || null, n !== null ? n : r(e.type) || "Memo";
|
|
176
176
|
case F:
|
|
177
177
|
n = e._payload, e = e._init;
|
|
@@ -213,7 +213,7 @@ function ve() {
|
|
|
213
213
|
return "<...>";
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
function
|
|
216
|
+
function a() {
|
|
217
217
|
var e = q.A;
|
|
218
218
|
return e === null ? null : e.getOwner();
|
|
219
219
|
}
|
|
@@ -321,18 +321,18 @@ React keys must be passed directly to JSX without using spread:
|
|
|
321
321
|
e,
|
|
322
322
|
d,
|
|
323
323
|
u,
|
|
324
|
-
|
|
324
|
+
a(),
|
|
325
325
|
N,
|
|
326
326
|
U
|
|
327
327
|
);
|
|
328
328
|
}
|
|
329
329
|
function R(e) {
|
|
330
|
-
|
|
330
|
+
o(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e !== null && e.$$typeof === F && (e._payload.status === "fulfilled" ? o(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function o(e) {
|
|
333
333
|
return typeof e == "object" && e !== null && e.$$typeof === v;
|
|
334
334
|
}
|
|
335
|
-
var l = ee, v = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), T = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), y = Symbol.for("react.context"), A = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), ne = Symbol.for("react.suspense_list"),
|
|
335
|
+
var l = ee, v = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), T = Symbol.for("react.fragment"), M = Symbol.for("react.strict_mode"), h = Symbol.for("react.profiler"), x = Symbol.for("react.consumer"), y = Symbol.for("react.context"), A = Symbol.for("react.forward_ref"), S = Symbol.for("react.suspense"), ne = Symbol.for("react.suspense_list"), oe = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), ae = Symbol.for("react.activity"), se = Symbol.for("react.client.reference"), q = l.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, ce = Array.isArray, L = console.createTask ? console.createTask : function() {
|
|
336
336
|
return null;
|
|
337
337
|
};
|
|
338
338
|
l = {
|
|
@@ -373,7 +373,7 @@ function pe() {
|
|
|
373
373
|
}
|
|
374
374
|
var $ = pe();
|
|
375
375
|
const re = ie(
|
|
376
|
-
({ hash: r, width: t = 32, height: s = 32, punch: c = 1, ...
|
|
376
|
+
({ hash: r, width: t = 32, height: s = 32, punch: c = 1, ...a }, i) => {
|
|
377
377
|
const m = ue(null), [E, b] = fe(!1);
|
|
378
378
|
return de(i, () => m.current), X(() => {
|
|
379
379
|
const p = m.current;
|
|
@@ -393,10 +393,10 @@ const re = ie(
|
|
|
393
393
|
if (!_) return;
|
|
394
394
|
const R = setTimeout(() => {
|
|
395
395
|
try {
|
|
396
|
-
const
|
|
396
|
+
const o = be(r, t, s, c), l = new ImageData(o, t, s);
|
|
397
397
|
_.putImageData(l, 0, 0);
|
|
398
|
-
} catch (
|
|
399
|
-
console.error("Failed to render ImageHash:",
|
|
398
|
+
} catch (o) {
|
|
399
|
+
console.error("Failed to render ImageHash:", o);
|
|
400
400
|
}
|
|
401
401
|
}, 0);
|
|
402
402
|
return () => clearTimeout(R);
|
|
@@ -406,15 +406,15 @@ const re = ie(
|
|
|
406
406
|
ref: m,
|
|
407
407
|
width: t,
|
|
408
408
|
height: s,
|
|
409
|
-
style: { imageRendering: "pixelated", ...
|
|
410
|
-
...
|
|
409
|
+
style: { imageRendering: "pixelated", ...a.style },
|
|
410
|
+
...a
|
|
411
411
|
}
|
|
412
412
|
);
|
|
413
413
|
}
|
|
414
414
|
);
|
|
415
415
|
re.displayName = "ImageHashCanvas";
|
|
416
|
-
const ge = ({ hash: r, src: t, className: s, style: c, ...
|
|
417
|
-
const [i, m] = ee.useState(!1), { style: E, ...b } =
|
|
416
|
+
const ge = ({ hash: r, src: t, className: s, style: c, ...a }) => {
|
|
417
|
+
const [i, m] = ee.useState(!1), { style: E, ...b } = a;
|
|
418
418
|
return /* @__PURE__ */ $.jsxs(
|
|
419
419
|
"div",
|
|
420
420
|
{
|
|
@@ -430,6 +430,7 @@ const ge = ({ hash: r, src: t, className: s, style: c, ...o }) => {
|
|
|
430
430
|
re,
|
|
431
431
|
{
|
|
432
432
|
hash: r,
|
|
433
|
+
className: s,
|
|
433
434
|
style: {
|
|
434
435
|
position: "absolute",
|
|
435
436
|
inset: 0,
|
|
@@ -446,6 +447,7 @@ const ge = ({ hash: r, src: t, className: s, style: c, ...o }) => {
|
|
|
446
447
|
"img",
|
|
447
448
|
{
|
|
448
449
|
...b,
|
|
450
|
+
className: s,
|
|
449
451
|
src: t,
|
|
450
452
|
loading: "lazy",
|
|
451
453
|
onLoad: () => m(!0),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "useblysh",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"description": "High-performance visual hashing for seamless image loading. Encode images into tiny strings and decode into beautiful, fast-loading blurs.",
|
|
5
6
|
"main": "./dist/useblysh.js",
|
|
6
7
|
"module": "./dist/useblysh.mjs",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
},
|
|
26
27
|
"repository": {
|
|
27
28
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/R1SH4BH81/Blysh.git"
|
|
29
|
+
"url": "git+https://github.com/R1SH4BH81/Blysh.git"
|
|
29
30
|
},
|
|
30
31
|
"homepage": "https://useblysh.vercel.app",
|
|
31
32
|
"bugs": {
|
|
@@ -57,4 +58,4 @@
|
|
|
57
58
|
],
|
|
58
59
|
"author": "Rishabh Mishra <rishabhmishra.81@gmail.com>",
|
|
59
60
|
"license": "MIT"
|
|
60
|
-
}
|
|
61
|
+
}
|