visionary-image 1.0.1 → 1.0.2
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/visionary-image.es.js +280 -268
- package/dist/visionary-image.umd.js +2 -2
- package/package.json +5 -5
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.id="v7y-styles",e.appendChild(document.createTextNode('.v7y_7587:before{content:"";display:block;padding-top:var(--v-ar)}.v7y_b8c0{-webkit-user-drag:none;pointer-events:none}.v7y_e0dd{-webkit-user-select:none;user-select:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
2
|
import { jsx as G, jsxs as vt } from "react/jsx-runtime";
|
|
3
|
-
import { useRef as Y, useCallback as q, useState as
|
|
4
|
-
function
|
|
3
|
+
import { useRef as Y, useCallback as q, useState as wt, useEffect as It, useLayoutEffect as Et, useMemo as At } from "react";
|
|
4
|
+
function xt(t) {
|
|
5
5
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
6
6
|
}
|
|
7
|
-
var
|
|
7
|
+
var nt = { exports: {} };
|
|
8
8
|
/*!
|
|
9
9
|
Copyright (c) 2018 Jed Watson.
|
|
10
10
|
Licensed under the MIT License (MIT), see
|
|
@@ -12,11 +12,11 @@ var et = { exports: {} };
|
|
|
12
12
|
*/
|
|
13
13
|
(function(t) {
|
|
14
14
|
(function() {
|
|
15
|
-
var
|
|
16
|
-
function
|
|
15
|
+
var n = {}.hasOwnProperty;
|
|
16
|
+
function e() {
|
|
17
17
|
for (var r = "", s = 0; s < arguments.length; s++) {
|
|
18
|
-
var
|
|
19
|
-
|
|
18
|
+
var u = arguments[s];
|
|
19
|
+
u && (r = i(r, o(u)));
|
|
20
20
|
}
|
|
21
21
|
return r;
|
|
22
22
|
}
|
|
@@ -26,212 +26,212 @@ var et = { exports: {} };
|
|
|
26
26
|
if (typeof r != "object")
|
|
27
27
|
return "";
|
|
28
28
|
if (Array.isArray(r))
|
|
29
|
-
return
|
|
29
|
+
return e.apply(null, r);
|
|
30
30
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
31
31
|
return r.toString();
|
|
32
32
|
var s = "";
|
|
33
|
-
for (var
|
|
34
|
-
|
|
33
|
+
for (var u in r)
|
|
34
|
+
n.call(r, u) && r[u] && (s = i(s, u));
|
|
35
35
|
return s;
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function i(r, s) {
|
|
38
38
|
return s ? r ? r + " " + s : r + s : r;
|
|
39
39
|
}
|
|
40
|
-
t.exports ? (
|
|
40
|
+
t.exports ? (e.default = e, t.exports = e) : window.classNames = e;
|
|
41
41
|
})();
|
|
42
|
-
})(
|
|
43
|
-
var Rt =
|
|
44
|
-
const
|
|
42
|
+
})(nt);
|
|
43
|
+
var Rt = nt.exports;
|
|
44
|
+
const St = /* @__PURE__ */ xt(Rt), Ut = (t, { root: n, rootMargin: e, threshold: o } = {}, i = []) => {
|
|
45
45
|
const r = Y(null), s = Y(null);
|
|
46
|
-
return q((
|
|
47
|
-
r.current && s.current && (s.current.unobserve(r.current), s.current.disconnect(), s.current = null),
|
|
48
|
-
}, [r,
|
|
49
|
-
}, Nt = ({ root: t, rootMargin:
|
|
50
|
-
const [
|
|
51
|
-
inView:
|
|
46
|
+
return q((c) => {
|
|
47
|
+
r.current && s.current && (s.current.unobserve(r.current), s.current.disconnect(), s.current = null), c && (s.current = new IntersectionObserver(t, { root: n, rootMargin: e, threshold: o }), s.current.observe(c), r.current = c);
|
|
48
|
+
}, [r, n, e, JSON.stringify(o), ...i]);
|
|
49
|
+
}, Nt = ({ root: t, rootMargin: n, threshold: e, unobserveOnEnter: o, target: i, onEnter: r, onLeave: s, defaultInView: u } = {}, c = []) => {
|
|
50
|
+
const [a, p] = wt({
|
|
51
|
+
inView: u || !1,
|
|
52
52
|
entry: null,
|
|
53
53
|
observer: null
|
|
54
|
-
}),
|
|
55
|
-
const b =
|
|
56
|
-
|
|
54
|
+
}), l = q(([h], f) => {
|
|
55
|
+
const b = f.thresholds.some((g) => h.intersectionRatio >= g) && h.isIntersecting;
|
|
56
|
+
p({
|
|
57
57
|
inView: b,
|
|
58
|
-
entry:
|
|
59
|
-
observer:
|
|
60
|
-
}), b && o && (
|
|
61
|
-
}, [r, s, o]), m =
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
}, [
|
|
58
|
+
entry: h,
|
|
59
|
+
observer: f
|
|
60
|
+
}), b && o && (f.unobserve(h.target), f.disconnect()), b ? r == null || r(h, f) : s == null || s(h, f);
|
|
61
|
+
}, [r, s, o]), m = Ut(l, { root: t, rootMargin: n, threshold: e }, [o, ...c]);
|
|
62
|
+
return It(() => {
|
|
63
|
+
i != null && i.current && m(i.current);
|
|
64
|
+
}, [i, m]), [m, a.inView, a.entry, a.observer];
|
|
65
65
|
};
|
|
66
|
-
var
|
|
66
|
+
var V = /* @__PURE__ */ ((t) => (t.AUTO = "auto", t.AVIF = "avif", t.JPEG = "jpeg", t.WEBP = "webp", t))(V || {}), v = /* @__PURE__ */ ((t) => (t.xs = "xs", t.sm = "sm", t.md = "md", t.lg = "lg", t.xl = "xl", t.xxl = "xxl", t["4k"] = "4k", t["5k"] = "5k", t.full = "full", t))(v || {}), T = /* @__PURE__ */ ((t) => (t.DEBUG = "debug", t.DOWNLOAD = "download", t))(T || {});
|
|
67
67
|
const Ot = "https://link.visionary.cloud";
|
|
68
|
-
|
|
68
|
+
V.AUTO, v.lg;
|
|
69
69
|
const Z = {
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
70
|
+
[v.xs]: 160,
|
|
71
|
+
[v.sm]: 320,
|
|
72
|
+
[v.md]: 640,
|
|
73
|
+
[v.lg]: 1280,
|
|
74
|
+
[v.xl]: 1920,
|
|
75
|
+
[v.xxl]: 2560,
|
|
76
|
+
[v["4k"]]: 3840,
|
|
77
|
+
[v["5k"]]: 5120,
|
|
78
|
+
[v.full]: 0
|
|
79
79
|
};
|
|
80
80
|
Object.keys(Z).reduce(
|
|
81
|
-
(t,
|
|
82
|
-
const
|
|
83
|
-
return o && (t[o] =
|
|
81
|
+
(t, n) => {
|
|
82
|
+
const e = n, o = Z[e];
|
|
83
|
+
return o && (t[o] = e), t;
|
|
84
84
|
},
|
|
85
85
|
{}
|
|
86
86
|
);
|
|
87
|
-
const
|
|
88
|
-
var
|
|
89
|
-
Object.defineProperty(
|
|
87
|
+
const et = "!";
|
|
88
|
+
var Tt = Object.defineProperty, Ct = (t, n, e) => n in t ? Tt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e, Dt = (t, n, e) => Ct(t, typeof n != "symbol" ? n + "" : n, e), J = {}, $ = {};
|
|
89
|
+
Object.defineProperty($, "__esModule", { value: !0 });
|
|
90
90
|
function Pt(t) {
|
|
91
91
|
return String.fromCharCode(parseInt(t.slice(1), 16));
|
|
92
92
|
}
|
|
93
93
|
function _t(t) {
|
|
94
94
|
return btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g, Pt));
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
function
|
|
96
|
+
$.encode = _t;
|
|
97
|
+
function Lt(t) {
|
|
98
98
|
return `%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`;
|
|
99
99
|
}
|
|
100
100
|
function Vt(t) {
|
|
101
|
-
return decodeURIComponent(Array.from(atob(t),
|
|
101
|
+
return decodeURIComponent(Array.from(atob(t), Lt).join(""));
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
$.decode = Vt;
|
|
104
104
|
Object.defineProperty(J, "__esModule", { value: !0 });
|
|
105
|
-
const rt =
|
|
105
|
+
const rt = $;
|
|
106
106
|
function $t(t) {
|
|
107
107
|
return rt.decode(t.replace(/\-/g, "+").replace(/_/g, "/"));
|
|
108
108
|
}
|
|
109
|
-
var
|
|
110
|
-
function
|
|
109
|
+
var jt = J.decode = $t;
|
|
110
|
+
function kt(t) {
|
|
111
111
|
return rt.encode(t).replace(/\//g, "_").replace(/\+/g, "-").replace(/=+$/, "");
|
|
112
112
|
}
|
|
113
|
-
var
|
|
114
|
-
const
|
|
113
|
+
var zt = J.encode = kt;
|
|
114
|
+
const Bt = (t) => t.filter(Boolean), K = (t) => {
|
|
115
115
|
try {
|
|
116
116
|
return new URL(t);
|
|
117
117
|
} catch {
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
|
-
}, j = (t = "") => /^[A-Za-z0-9_-]*$/.test(t),
|
|
121
|
-
const { altText:
|
|
122
|
-
if (!
|
|
120
|
+
}, j = (t = "") => /^[A-Za-z0-9_-]*$/.test(t), Mt = (t) => {
|
|
121
|
+
const { altText: n, bcc: e, blurhash: o, blurhashX: i, blurhashY: r, sourceHeight: s, sourceWidth: u, url: c } = t;
|
|
122
|
+
if (!c || !u || !s)
|
|
123
123
|
return new Error("Cannot construct visionary code: missing required url/width/height");
|
|
124
|
-
const
|
|
125
|
-
return !
|
|
126
|
-
},
|
|
124
|
+
const a = [c, u, s];
|
|
125
|
+
return !e || (a.push(e), !o || !i || !r) || (a.push(o, i, r), n && n.length && a.push(n)), Gt(a);
|
|
126
|
+
}, Gt = (t) => zt(t.join(et)), ot = (t) => {
|
|
127
127
|
if (typeof t != "string")
|
|
128
128
|
return null;
|
|
129
|
-
const
|
|
130
|
-
if (!
|
|
129
|
+
const n = t.trim();
|
|
130
|
+
if (!n.length || !j(n))
|
|
131
131
|
return null;
|
|
132
|
-
const
|
|
133
|
-
if (!
|
|
132
|
+
const e = jt(n);
|
|
133
|
+
if (!e)
|
|
134
134
|
return null;
|
|
135
|
-
const o =
|
|
135
|
+
const o = e.split(et);
|
|
136
136
|
if (o.length < 3)
|
|
137
137
|
return null;
|
|
138
|
-
const [
|
|
138
|
+
const [i, r, s, u, c, a, p, l] = o, m = i.trim();
|
|
139
139
|
if (!m.length)
|
|
140
140
|
return console.error("Cannot parse code, empty file id"), null;
|
|
141
|
-
const
|
|
142
|
-
if (isNaN(
|
|
141
|
+
const h = Number(r.trim()), f = Number(s.trim());
|
|
142
|
+
if (isNaN(h) || isNaN(f) || !h || !f)
|
|
143
143
|
return console.error("Cannot parse Visionary Code: invalid image dimensions", r, s), null;
|
|
144
|
-
const
|
|
145
|
-
return
|
|
144
|
+
const y = Number(a) ?? 0, b = Number(p) ?? 0;
|
|
145
|
+
return y < 1 || b < 1 ? (console.error(
|
|
146
146
|
"Cannot parse Visionary Code: invalid blurhash x, y component dimensions",
|
|
147
|
-
|
|
147
|
+
y,
|
|
148
148
|
b
|
|
149
149
|
), null) : {
|
|
150
|
-
altText:
|
|
151
|
-
bcc:
|
|
152
|
-
blurhash:
|
|
153
|
-
blurhashX:
|
|
150
|
+
altText: l,
|
|
151
|
+
bcc: u,
|
|
152
|
+
blurhash: c,
|
|
153
|
+
blurhashX: y,
|
|
154
154
|
blurhashY: b,
|
|
155
|
-
sourceHeight:
|
|
156
|
-
sourceWidth:
|
|
155
|
+
sourceHeight: f,
|
|
156
|
+
sourceWidth: h,
|
|
157
157
|
url: m
|
|
158
158
|
};
|
|
159
159
|
};
|
|
160
|
-
class
|
|
160
|
+
class Wt extends Error {
|
|
161
161
|
constructor() {
|
|
162
162
|
super(...arguments), Dt(this, "message", "invalid endpoint URL (does it contain http/https?)");
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
-
const
|
|
166
|
-
const
|
|
167
|
-
for (const
|
|
168
|
-
st(
|
|
169
|
-
return
|
|
170
|
-
},
|
|
165
|
+
const Ft = (t) => t === T.DEBUG, Ht = (t) => t === T.DOWNLOAD, Xt = (t) => Object.values(V).includes(t), st = (t) => Object.values(v).includes(t), Yt = (t = []) => {
|
|
166
|
+
const n = {};
|
|
167
|
+
for (const e of t)
|
|
168
|
+
st(e) ? n.size = v[e] : Ft(e) ? n.debug = !0 : Ht(e) ? n.download = !0 : Xt(e) && (n.format = e);
|
|
169
|
+
return n;
|
|
170
|
+
}, Zt = (t) => {
|
|
171
171
|
if (!t || typeof t != "object")
|
|
172
172
|
return null;
|
|
173
|
-
const
|
|
174
|
-
return t.debug &&
|
|
175
|
-
},
|
|
173
|
+
const n = [];
|
|
174
|
+
return t.debug && n.push(T.DEBUG), t.download && n.push(T.DOWNLOAD), t.format && t.format !== V.AUTO && n.push(t.format), t.size && st(t.size) && n.push(t.size), n.length ? n.sort().join(",") : null;
|
|
175
|
+
}, qt = (t) => {
|
|
176
176
|
if (j(t)) {
|
|
177
|
-
const
|
|
178
|
-
if (
|
|
177
|
+
const n = ot(t);
|
|
178
|
+
if (n)
|
|
179
179
|
return {
|
|
180
|
-
fields:
|
|
180
|
+
fields: n,
|
|
181
181
|
options: {}
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
return
|
|
185
|
-
},
|
|
184
|
+
return Jt(t);
|
|
185
|
+
}, Jt = (t) => {
|
|
186
186
|
if (!t)
|
|
187
187
|
return null;
|
|
188
|
-
const
|
|
189
|
-
if (!
|
|
188
|
+
const n = t.trim();
|
|
189
|
+
if (!n)
|
|
190
190
|
return null;
|
|
191
191
|
try {
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
192
|
+
const e = Qt(n);
|
|
193
|
+
if (!e)
|
|
194
194
|
return null;
|
|
195
|
-
const { code: o, optionTokens:
|
|
195
|
+
const { code: o, optionTokens: i } = e, r = ot(o);
|
|
196
196
|
if (!r)
|
|
197
197
|
return null;
|
|
198
|
-
const s =
|
|
198
|
+
const s = Yt(i);
|
|
199
199
|
return {
|
|
200
200
|
fields: r,
|
|
201
201
|
options: s
|
|
202
202
|
};
|
|
203
|
-
} catch (
|
|
204
|
-
|
|
203
|
+
} catch (e) {
|
|
204
|
+
e instanceof Error ? console.error(`Error parsing URL: ${e.message}`, e) : console.error("uncaught error", e);
|
|
205
205
|
}
|
|
206
206
|
return null;
|
|
207
|
-
},
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
207
|
+
}, Kt = (t, n) => {
|
|
208
|
+
const e = Mt(t);
|
|
209
|
+
if (e instanceof Error)
|
|
210
210
|
return null;
|
|
211
211
|
let o = null;
|
|
212
|
-
if (
|
|
213
|
-
throw new
|
|
212
|
+
if (n != null && n.endpoint && (o = K(n == null ? void 0 : n.endpoint), !o))
|
|
213
|
+
throw new Wt(
|
|
214
214
|
"Cannot construct URL: bad endpoint. Ensure endpoint starts with http:// or https://"
|
|
215
215
|
);
|
|
216
216
|
o || (o = K(Ot));
|
|
217
|
-
const
|
|
218
|
-
return r &&
|
|
219
|
-
},
|
|
217
|
+
const i = [o.origin, "image", e], r = n ? Zt(n) : null;
|
|
218
|
+
return r && i.push(r), n != null && n.filename ? i.push(n.filename) : i.push("image.jpg"), i.join("/");
|
|
219
|
+
}, Qt = (t) => {
|
|
220
220
|
try {
|
|
221
|
-
const
|
|
222
|
-
if (
|
|
221
|
+
const n = new URL(t), e = Bt(n.pathname.split("/"));
|
|
222
|
+
if (e[0] !== "image" || ![3, 4].includes(e.length))
|
|
223
223
|
throw new Error("Unrecognized URL");
|
|
224
|
-
const o =
|
|
224
|
+
const o = e[1].trim();
|
|
225
225
|
if (!o.length || !j(o))
|
|
226
226
|
throw new Error("URL is not formatted as base64url");
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
227
|
+
if (e.length === 4) {
|
|
228
|
+
const i = e[2].split(",");
|
|
229
229
|
return {
|
|
230
230
|
code: o,
|
|
231
|
-
optionTokens:
|
|
231
|
+
optionTokens: i
|
|
232
232
|
};
|
|
233
233
|
}
|
|
234
|
-
if (
|
|
234
|
+
if (e.length === 3)
|
|
235
235
|
return {
|
|
236
236
|
code: o,
|
|
237
237
|
optionTokens: []
|
|
@@ -240,249 +240,261 @@ const Wt = (t) => t === P.DEBUG, Ft = (t) => t === P.DOWNLOAD, Ht = (t) => Objec
|
|
|
240
240
|
return null;
|
|
241
241
|
}
|
|
242
242
|
return null;
|
|
243
|
-
}, ct = 0.7, it = 1,
|
|
244
|
-
} :
|
|
245
|
-
!console || typeof console.log != "function" || console.log(`${
|
|
246
|
-
},
|
|
243
|
+
}, ct = 0.7, it = 1, S = 24, tn = v.lg, at = process.env.NODE_ENV, nn = at === "development", lt = typeof document > "u", en = at === "test", rn = lt ? () => {
|
|
244
|
+
} : Et, on = "<visionary>", R = (t, ...n) => {
|
|
245
|
+
!console || typeof console.log != "function" || console.log(`${on} ${t}`, ...n);
|
|
246
|
+
}, ut = new Uint8Array(128);
|
|
247
|
+
for (let t = 0; t < 83; t++)
|
|
248
|
+
ut["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~".charCodeAt(
|
|
249
|
+
t
|
|
250
|
+
)] = t;
|
|
251
|
+
const _ = (t, n, e) => {
|
|
247
252
|
let o = 0;
|
|
248
|
-
for (;
|
|
249
|
-
o *= 83, o +=
|
|
253
|
+
for (; n < e; )
|
|
254
|
+
o *= 83, o += ut[t.charCodeAt(n++)];
|
|
250
255
|
return o;
|
|
251
|
-
},
|
|
252
|
-
for (t +=
|
|
253
|
-
t -=
|
|
254
|
-
const
|
|
255
|
-
return 0.225 * (
|
|
256
|
+
}, ft = Math.pow, C = Math.PI, sn = C * 2, dt = 3294.6, pt = 269.025, cn = (t) => t > 10.31475 ? ft(t / pt + 0.052132, 2.4) : t / dt, W = (t) => ~~(t > 1227e-8 ? pt * ft(t, 0.416666) - 13.025 : t * dt + 1), O = (t) => (t < 0 ? -1 : 1) * t * t, Q = (t) => {
|
|
257
|
+
for (t += C / 2; t > C; )
|
|
258
|
+
t -= sn;
|
|
259
|
+
const n = 1.27323954 * t - 0.405284735 * O(t);
|
|
260
|
+
return 0.225 * (O(n) - n) + n;
|
|
256
261
|
};
|
|
257
|
-
function
|
|
258
|
-
const
|
|
259
|
-
return [
|
|
262
|
+
function an(t) {
|
|
263
|
+
const n = _(t, 2, 6);
|
|
264
|
+
return [n >> 16, n >> 8 & 255, n & 255];
|
|
260
265
|
}
|
|
261
|
-
function
|
|
262
|
-
const
|
|
263
|
-
let
|
|
264
|
-
const
|
|
265
|
-
for (
|
|
266
|
-
I[
|
|
267
|
-
for (
|
|
268
|
-
E =
|
|
269
|
-
const
|
|
270
|
-
for (
|
|
271
|
-
for (
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
266
|
+
function ln(t, n, e, o) {
|
|
267
|
+
const i = _(t, 0, 1), r = i % 9 + 1, s = ~~(i / 9) + 1, u = r * s;
|
|
268
|
+
let c = 0, a = 0, p = 0, l = 0, m = 0, h = 0, f = 0, y = 0, b = 0, g = 0, w = 0, E = 0;
|
|
269
|
+
const d = (_(t, 1, 2) + 1) / 13446 * (o | 1), I = new Float64Array(u * 3), k = an(t);
|
|
270
|
+
for (c = 0; c < 3; c++)
|
|
271
|
+
I[c] = cn(k[c]);
|
|
272
|
+
for (c = 1; c < u; c++)
|
|
273
|
+
E = _(t, 4 + c * 2, 6 + c * 2), I[c * 3] = O(~~(E / 361) - 9) * d, I[c * 3 + 1] = O(~~(E / 19) % 19 - 9) * d, I[c * 3 + 2] = O(E % 19 - 9) * d;
|
|
274
|
+
const D = new Float64Array(s * e), P = new Float64Array(r * n);
|
|
275
|
+
for (a = 0; a < s; a++)
|
|
276
|
+
for (l = 0; l < e; l++)
|
|
277
|
+
D[a * e + l] = Q(C * l * a / e);
|
|
278
|
+
for (c = 0; c < r; c++)
|
|
279
|
+
for (p = 0; p < n; p++)
|
|
280
|
+
P[c * n + p] = Q(C * p * c / n);
|
|
281
|
+
const U = n * 4, A = new Uint8ClampedArray(U * e);
|
|
282
|
+
for (l = 0; l < e; l++)
|
|
283
|
+
for (p = 0; p < n; p++) {
|
|
284
|
+
for (m = h = f = 0, a = 0; a < s; a++)
|
|
285
|
+
for (b = D[a * e + l], c = 0; c < r; c++)
|
|
286
|
+
y = P[c * n + p] * b, g = (c + a * r) * 3, m += I[g] * y, h += I[g + 1] * y, f += I[g + 2] * y;
|
|
287
|
+
w = 4 * p + l * U, A[w] = W(m), A[w + 1] = W(h), A[w + 2] = W(f), A[w + 3] = 255;
|
|
276
288
|
}
|
|
277
|
-
return
|
|
289
|
+
return A;
|
|
278
290
|
}
|
|
279
|
-
const
|
|
291
|
+
const L = (t) => {
|
|
280
292
|
try {
|
|
281
293
|
return new URL(t);
|
|
282
294
|
} catch {
|
|
283
295
|
return null;
|
|
284
296
|
}
|
|
285
|
-
},
|
|
297
|
+
}, un = (t, n) => `rgba(${t.r},${t.g},${t.b},${n})`, F = (t) => nn || en ? {
|
|
286
298
|
"data-testid": t
|
|
287
|
-
} : {},
|
|
299
|
+
} : {}, fn = (t, n) => n ? {
|
|
288
300
|
"data-fileid": t
|
|
289
|
-
} : {}, tt = (t,
|
|
290
|
-
let
|
|
291
|
-
if (
|
|
301
|
+
} : {}, tt = (t, n) => Math.min(t, n), dn = (t) => {
|
|
302
|
+
let n = t.replace(/^#/, "");
|
|
303
|
+
if (n.length !== 3 && n.length !== 6)
|
|
292
304
|
return null;
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
return { b: parseInt(
|
|
296
|
-
},
|
|
297
|
-
const
|
|
298
|
-
return Math.round(t *
|
|
299
|
-
},
|
|
300
|
-
const
|
|
301
|
-
return !
|
|
302
|
-
},
|
|
305
|
+
n.length === 3 && (n = `${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`);
|
|
306
|
+
const e = parseInt(n.slice(0, 2), 16), o = parseInt(n.slice(2, 4), 16);
|
|
307
|
+
return { b: parseInt(n.slice(4, 6), 16), g: o, r: e };
|
|
308
|
+
}, x = (t, n = 0) => {
|
|
309
|
+
const e = Math.pow(10, n);
|
|
310
|
+
return Math.round(t * e) / e;
|
|
311
|
+
}, pn = (t, n) => {
|
|
312
|
+
const e = L(t), o = L(n);
|
|
313
|
+
return !e || !o ? t : (o.pathname = e.pathname, o.search = e.search, o.toString());
|
|
314
|
+
}, hn = (t, n = {}, e = ct, o = it) => {
|
|
303
315
|
if (!t)
|
|
304
316
|
return null;
|
|
305
317
|
try {
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
if (
|
|
318
|
+
n.debug && R("input imageSrc:", t);
|
|
319
|
+
const i = qt(t);
|
|
320
|
+
if (n.debug && R("Visionary URL data: ", i), !i)
|
|
309
321
|
throw new Error("Could not parse Visionary URL");
|
|
310
|
-
const { fields: r, options: s } =
|
|
322
|
+
const { fields: r, options: s } = i;
|
|
311
323
|
if (r.sourceWidth < 1 || r.sourceHeight < 1)
|
|
312
324
|
throw new Error("Invalid image dimensions");
|
|
313
|
-
const
|
|
314
|
-
let
|
|
315
|
-
if (
|
|
316
|
-
|
|
317
|
-
const g =
|
|
318
|
-
m =
|
|
325
|
+
const u = r.sourceWidth / r.sourceHeight, c = (n == null ? void 0 : n.size) ?? s.size ?? tn, a = Z[c];
|
|
326
|
+
let p = 0, l = 0, m = 0;
|
|
327
|
+
if (u >= 1) {
|
|
328
|
+
l = p = tt(a, r.sourceWidth);
|
|
329
|
+
const g = x(l / u);
|
|
330
|
+
m = x(l / g, 6);
|
|
319
331
|
} else
|
|
320
|
-
|
|
321
|
-
const
|
|
332
|
+
p = tt(a, r.sourceHeight), l = x(p * u), m = x(l / p, 6);
|
|
333
|
+
const h = x(100 / m, 6), f = {
|
|
322
334
|
...r,
|
|
323
|
-
arPaddingTop: `${
|
|
335
|
+
arPaddingTop: `${h}%`,
|
|
324
336
|
aspectRatio: m,
|
|
325
|
-
maxWidth:
|
|
337
|
+
maxWidth: l,
|
|
326
338
|
src: t
|
|
327
|
-
},
|
|
328
|
-
if (
|
|
329
|
-
|
|
330
|
-
else if (!
|
|
331
|
-
const g =
|
|
332
|
-
endpoint:
|
|
333
|
-
size:
|
|
339
|
+
}, y = L(r.url);
|
|
340
|
+
if (y)
|
|
341
|
+
f.src = y.toString();
|
|
342
|
+
else if (!L(t) && j(r.url)) {
|
|
343
|
+
const g = Kt(r, {
|
|
344
|
+
endpoint: n.endpoint,
|
|
345
|
+
size: c
|
|
334
346
|
});
|
|
335
|
-
g && (
|
|
347
|
+
g && (f.src = g);
|
|
336
348
|
}
|
|
337
|
-
|
|
338
|
-
const b = r.bcc ?
|
|
339
|
-
if (b && (
|
|
340
|
-
const g = performance.now(), w =
|
|
341
|
-
|
|
349
|
+
n.endpoint && (f.src = pn(f.src, n.endpoint));
|
|
350
|
+
const b = r.bcc ? dn(r.bcc) : null;
|
|
351
|
+
if (b && (f.backgroundColor = un(b, e)), !lt && r.blurhash && !n.disableBlurLayer) {
|
|
352
|
+
const g = performance.now(), w = ln(r.blurhash, S, S, o), E = performance.now() - g;
|
|
353
|
+
n.debug && R(`Blurhash decode time: ${x(E, 1)} ms`), w && (f.pixels = w);
|
|
342
354
|
}
|
|
343
|
-
return
|
|
355
|
+
return n.debug && R("Visionary Image state: ", f), f;
|
|
344
356
|
} catch {
|
|
345
357
|
return null;
|
|
346
358
|
}
|
|
347
|
-
},
|
|
359
|
+
}, ht = {
|
|
348
360
|
bottom: 0,
|
|
349
361
|
left: 0,
|
|
350
362
|
position: "absolute",
|
|
351
363
|
right: 0,
|
|
352
364
|
top: 0
|
|
353
|
-
},
|
|
354
|
-
...
|
|
365
|
+
}, mn = {
|
|
366
|
+
...ht,
|
|
355
367
|
maxHeight: "100%",
|
|
356
368
|
maxWidth: "100%"
|
|
357
|
-
},
|
|
358
|
-
...
|
|
369
|
+
}, gn = {
|
|
370
|
+
...ht,
|
|
359
371
|
height: "100%",
|
|
360
372
|
width: "100%"
|
|
361
|
-
},
|
|
362
|
-
const
|
|
363
|
-
...
|
|
373
|
+
}, bn = (t) => {
|
|
374
|
+
const n = {
|
|
375
|
+
...mn
|
|
364
376
|
};
|
|
365
|
-
return t && (
|
|
377
|
+
return t && (n.display = "none"), n;
|
|
366
378
|
}, H = {
|
|
367
379
|
CANVAS: "canvas",
|
|
368
380
|
CONTAINER: "container",
|
|
369
381
|
IMAGE: "image"
|
|
370
|
-
},
|
|
371
|
-
container:
|
|
372
|
-
preventDrag:
|
|
373
|
-
preventSelection:
|
|
374
|
-
},
|
|
382
|
+
}, yn = "v7y_7587", vn = "v7y_b8c0", wn = "v7y_e0dd", X = {
|
|
383
|
+
container: yn,
|
|
384
|
+
preventDrag: vn,
|
|
385
|
+
preventSelection: wn
|
|
386
|
+
}, Rn = ({
|
|
375
387
|
alt: t,
|
|
376
|
-
bgColorAlpha:
|
|
377
|
-
className:
|
|
388
|
+
bgColorAlpha: n = ct,
|
|
389
|
+
className: e,
|
|
378
390
|
debug: o = !1,
|
|
379
|
-
disableBlurLayer:
|
|
391
|
+
disableBlurLayer: i = !1,
|
|
380
392
|
disableImageLayer: r = !1,
|
|
381
393
|
endpoint: s,
|
|
382
|
-
height:
|
|
383
|
-
hideImageLayer:
|
|
384
|
-
lazy:
|
|
385
|
-
onClick:
|
|
386
|
-
onError:
|
|
394
|
+
height: u,
|
|
395
|
+
hideImageLayer: c = !1,
|
|
396
|
+
lazy: a = !0,
|
|
397
|
+
onClick: p,
|
|
398
|
+
onError: l,
|
|
387
399
|
onLoad: m,
|
|
388
|
-
preventDrag:
|
|
389
|
-
preventSelection:
|
|
390
|
-
punch:
|
|
400
|
+
preventDrag: h = !1,
|
|
401
|
+
preventSelection: f = !1,
|
|
402
|
+
punch: y = it,
|
|
391
403
|
size: b,
|
|
392
404
|
src: g,
|
|
393
405
|
style: w,
|
|
394
|
-
width:
|
|
406
|
+
width: E
|
|
395
407
|
}) => {
|
|
396
|
-
const
|
|
408
|
+
const d = At(() => hn(g, {
|
|
397
409
|
debug: o,
|
|
398
|
-
disableBlurLayer:
|
|
410
|
+
disableBlurLayer: i,
|
|
399
411
|
endpoint: s,
|
|
400
412
|
size: b
|
|
401
|
-
},
|
|
402
|
-
|
|
413
|
+
}, n, y), [n, o, i, s, y, b, g]), I = Y(null), [k, D] = Nt();
|
|
414
|
+
rn(
|
|
403
415
|
function() {
|
|
404
|
-
if (!
|
|
416
|
+
if (!I.current || !(d != null && d.blurhash))
|
|
405
417
|
return;
|
|
406
|
-
if (!
|
|
418
|
+
if (!d.pixels) {
|
|
407
419
|
console.warn("No pixel data passed in, skipping");
|
|
408
420
|
return;
|
|
409
421
|
}
|
|
410
|
-
const
|
|
422
|
+
const bt = performance.now(), B = I.current.getContext("2d");
|
|
411
423
|
if (!B) {
|
|
412
424
|
console.warn("Cannot access canvasRenderingContext, skipping");
|
|
413
425
|
return;
|
|
414
426
|
}
|
|
415
|
-
const M = B.createImageData(
|
|
427
|
+
const M = B.createImageData(S, S);
|
|
416
428
|
if (!M) {
|
|
417
429
|
console.warn("Could not create ImageData on CanvasRenderingContext");
|
|
418
430
|
return;
|
|
419
431
|
}
|
|
420
|
-
if (M.data.set(
|
|
421
|
-
const
|
|
422
|
-
|
|
432
|
+
if (M.data.set(d.pixels), B.putImageData(M, 0, 0), o) {
|
|
433
|
+
const yt = performance.now() - bt;
|
|
434
|
+
R(`Canvas render time: ${x(yt, 1)} ms`);
|
|
423
435
|
}
|
|
424
436
|
},
|
|
425
|
-
[
|
|
437
|
+
[d == null ? void 0 : d.blurhash, d == null ? void 0 : d.pixels, o]
|
|
426
438
|
);
|
|
427
|
-
const
|
|
428
|
-
(
|
|
429
|
-
o &&
|
|
439
|
+
const P = q(
|
|
440
|
+
(N) => {
|
|
441
|
+
o && R("Image load error ", N), l && l();
|
|
430
442
|
},
|
|
431
|
-
[o,
|
|
443
|
+
[o, l]
|
|
432
444
|
), U = {
|
|
433
445
|
alt: t,
|
|
434
|
-
loading: !
|
|
446
|
+
loading: !a || D ? "eager" : "lazy",
|
|
435
447
|
onLoad: m
|
|
436
448
|
};
|
|
437
|
-
if (!
|
|
438
|
-
o &&
|
|
439
|
-
const
|
|
449
|
+
if (!d) {
|
|
450
|
+
o && R("Not a Visionary URL, rendering fallback <img />");
|
|
451
|
+
const N = {
|
|
440
452
|
...U,
|
|
441
|
-
className:
|
|
442
|
-
height:
|
|
443
|
-
onClick:
|
|
444
|
-
onError:
|
|
453
|
+
className: e,
|
|
454
|
+
height: u,
|
|
455
|
+
onClick: p,
|
|
456
|
+
onError: l,
|
|
445
457
|
src: g,
|
|
446
458
|
style: w,
|
|
447
|
-
width:
|
|
459
|
+
width: E
|
|
448
460
|
};
|
|
449
|
-
return /* @__PURE__ */ G("img", { ...
|
|
461
|
+
return /* @__PURE__ */ G("img", { ...N });
|
|
450
462
|
}
|
|
451
|
-
const
|
|
452
|
-
[X.preventDrag]: !!
|
|
453
|
-
[X.preventSelection]: !!
|
|
463
|
+
const A = St(X.container, e, {
|
|
464
|
+
[X.preventDrag]: !!h,
|
|
465
|
+
[X.preventSelection]: !!f
|
|
454
466
|
}), z = {
|
|
455
467
|
...{
|
|
456
|
-
"--v-ar":
|
|
468
|
+
"--v-ar": d.arPaddingTop
|
|
457
469
|
},
|
|
458
|
-
aspectRatio:
|
|
459
|
-
backgroundColor: (
|
|
460
|
-
maxWidth:
|
|
470
|
+
aspectRatio: d.aspectRatio,
|
|
471
|
+
backgroundColor: (d == null ? void 0 : d.backgroundColor) ?? void 0,
|
|
472
|
+
maxWidth: d.maxWidth,
|
|
461
473
|
position: "relative",
|
|
462
474
|
width: "100%",
|
|
463
475
|
...w
|
|
464
476
|
};
|
|
465
|
-
|
|
466
|
-
const
|
|
467
|
-
onClick:
|
|
468
|
-
},
|
|
477
|
+
E && (z.width = E), u && (z.height = u);
|
|
478
|
+
const mt = {
|
|
479
|
+
onClick: p
|
|
480
|
+
}, gt = bn(c);
|
|
469
481
|
return /* @__PURE__ */ vt(
|
|
470
482
|
"div",
|
|
471
483
|
{
|
|
472
|
-
className:
|
|
473
|
-
ref:
|
|
484
|
+
className: A,
|
|
485
|
+
ref: k,
|
|
474
486
|
style: z,
|
|
475
|
-
...
|
|
487
|
+
...fn(d.url, o),
|
|
476
488
|
...F(H.CONTAINER),
|
|
477
|
-
...
|
|
489
|
+
...mt,
|
|
478
490
|
children: [
|
|
479
|
-
!
|
|
491
|
+
!i && /* @__PURE__ */ G(
|
|
480
492
|
"canvas",
|
|
481
493
|
{
|
|
482
|
-
height:
|
|
483
|
-
ref:
|
|
484
|
-
style:
|
|
485
|
-
width:
|
|
494
|
+
height: S,
|
|
495
|
+
ref: I,
|
|
496
|
+
style: gn,
|
|
497
|
+
width: S,
|
|
486
498
|
...F(H.CANVAS)
|
|
487
499
|
}
|
|
488
500
|
),
|
|
@@ -492,9 +504,9 @@ const V = (t) => {
|
|
|
492
504
|
{
|
|
493
505
|
...U,
|
|
494
506
|
...F(H.IMAGE),
|
|
495
|
-
onError:
|
|
496
|
-
src:
|
|
497
|
-
style:
|
|
507
|
+
onError: P,
|
|
508
|
+
src: d.src,
|
|
509
|
+
style: gt
|
|
498
510
|
}
|
|
499
511
|
)
|
|
500
512
|
]
|
|
@@ -502,5 +514,5 @@ const V = (t) => {
|
|
|
502
514
|
);
|
|
503
515
|
};
|
|
504
516
|
export {
|
|
505
|
-
|
|
517
|
+
Rn as Image
|
|
506
518
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.id="v7y-styles",e.appendChild(document.createTextNode('.v7y_7587:before{content:"";display:block;padding-top:var(--v-ar)}.v7y_b8c0{-webkit-user-drag:none;pointer-events:none}.v7y_e0dd{-webkit-user-select:none;user-select:none}')),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
-
(function(
|
|
2
|
+
(function(A,R){typeof exports=="object"&&typeof module<"u"?R(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],R):(A=typeof globalThis<"u"?globalThis:A||self,R(A.VisionaryImage={},A.jsxRuntime,A.React))})(this,function(A,R,x){"use strict";function me(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var K={exports:{}};/*!
|
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
|
4
4
|
Licensed under the MIT License (MIT), see
|
|
5
5
|
http://jedwatson.github.io/classnames
|
|
6
|
-
*/(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var r="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(r=i(r,o(a)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var s="";for(var a in r)e.call(r,a)&&r[a]&&(s=i(s,a));return s}function i(r,s){return s?r?r+" "+s:r+s:r}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(K);var gt=K.exports;const mt=ht(gt),bt=(t,{root:e,rootMargin:n,threshold:o}={},i=[])=>{const r=I.useRef(null),s=I.useRef(null);return I.useCallback(c=>{r.current&&s.current&&(s.current.unobserve(r.current),s.current.disconnect(),s.current=null),c&&(s.current=new IntersectionObserver(t,{root:e,rootMargin:n,threshold:o}),s.current.observe(c),r.current=c)},[r,e,n,JSON.stringify(o),...i])},yt=({root:t,rootMargin:e,threshold:n,unobserveOnEnter:o,target:i,onEnter:r,onLeave:s,defaultInView:a}={},c=[])=>{const[d,h]=I.useState({inView:a||!1,entry:null,observer:null}),f=I.useCallback(([p],l)=>{const b=l.thresholds.some(m=>p.intersectionRatio>=m)&&p.isIntersecting;h({inView:b,entry:p,observer:l}),b&&o&&(l.unobserve(p.target),l.disconnect()),b?r==null||r(p,l):s==null||s(p,l)},[r,s,o]),g=bt(f,{root:t,rootMargin:e,threshold:n},[o,...c]);return I.useEffect(()=>{i!=null&&i.current&&g(i.current)},[i,g]),[g,d.inView,d.entry,d.observer]};var $=(t=>(t.AUTO="auto",t.AVIF="avif",t.JPEG="jpeg",t.WEBP="webp",t))($||{}),v=(t=>(t.xs="xs",t.sm="sm",t.md="md",t.lg="lg",t.xl="xl",t.xxl="xxl",t["4k"]="4k",t["5k"]="5k",t.full="full",t))(v||{}),C=(t=>(t.DEBUG="debug",t.DOWNLOAD="download",t))(C||{});const vt="https://link.visionary.cloud";$.AUTO,v.lg;const M={[v.xs]:160,[v.sm]:320,[v.md]:640,[v.lg]:1280,[v.xl]:1920,[v.xxl]:2560,[v["4k"]]:3840,[v["5k"]]:5120,[v.full]:0};Object.keys(M).reduce((t,e)=>{const n=e,o=M[n];return o&&(t[o]=n),t},{});const Q="!";var wt=Object.defineProperty,It=(t,e,n)=>e in t?wt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xt=(t,e,n)=>It(t,typeof e!="symbol"?e+"":e,n),G={},L={};Object.defineProperty(L,"__esModule",{value:!0});function Et(t){return String.fromCharCode(parseInt(t.slice(1),16))}function Rt(t){return btoa(encodeURIComponent(t).replace(/%[0-9A-F]{2}/g,Et))}L.encode=Rt;function At(t){return`%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`}function St(t){return decodeURIComponent(Array.from(atob(t),At).join(""))}L.decode=St,Object.defineProperty(G,"__esModule",{value:!0});const tt=L;function Tt(t){return tt.decode(t.replace(/\-/g,"+").replace(/_/g,"/"))}var Ot=G.decode=Tt;function Nt(t){return tt.encode(t).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,"")}var Ut=G.encode=Nt;const Ct=t=>t.filter(Boolean),et=t=>{try{return new URL(t)}catch{return null}},k=(t="")=>/^[A-Za-z0-9_-]*$/.test(t),Dt=t=>{const{altText:e,bcc:n,blurhash:o,blurhashX:i,blurhashY:r,sourceHeight:s,sourceWidth:a,url:c}=t;if(!c||!a||!s)return new Error("Cannot construct visionary code: missing required url/width/height");const d=[c,a,s];return!n||(d.push(n),!o||!i||!r)||(d.push(o,i,r),e&&e.length&&d.push(e)),Pt(d)},Pt=t=>Ut(t.join(Q)),nt=t=>{if(typeof t!="string")return null;const e=t.trim();if(!e.length||!k(e))return null;const n=Ot(e);if(!n)return null;const o=n.split(Q);if(o.length<3)return null;const[i,r,s,a,c,d,h,f]=o,g=i.trim();if(!g.length)return console.error("Cannot parse code, empty file id"),null;const p=Number(r.trim()),l=Number(s.trim());if(isNaN(p)||isNaN(l)||!p||!l)return console.error("Cannot parse Visionary Code: invalid image dimensions",r,s),null;const y=Number(d)??0,b=Number(h)??0;return y<1||b<1?(console.error("Cannot parse Visionary Code: invalid blurhash x, y component dimensions",y,b),null):{altText:f,bcc:a,blurhash:c,blurhashX:y,blurhashY:b,sourceHeight:l,sourceWidth:p,url:g}};class _t extends Error{constructor(){super(...arguments),xt(this,"message","invalid endpoint URL (does it contain http/https?)")}}const jt=t=>t===C.DEBUG,Vt=t=>t===C.DOWNLOAD,$t=t=>Object.values($).includes(t),rt=t=>Object.values(v).includes(t),Lt=(t=[])=>{const e={};for(const n of t)rt(n)?e.size=v[n]:jt(n)?e.debug=!0:Vt(n)?e.download=!0:$t(n)&&(e.format=n);return e},kt=t=>{if(!t||typeof t!="object")return null;const e=[];return t.debug&&e.push(C.DEBUG),t.download&&e.push(C.DOWNLOAD),t.format&&t.format!==$.AUTO&&e.push(t.format),t.size&&rt(t.size)&&e.push(t.size),e.length?e.sort().join(","):null},zt=t=>{if(k(t)){const e=nt(t);if(e)return{fields:e,options:{}}}return Bt(t)},Bt=t=>{if(!t)return null;const e=t.trim();if(!e)return null;try{const n=Gt(e);if(!n)return null;const{code:o,optionTokens:i}=n,r=nt(o);if(!r)return null;const s=Lt(i);return{fields:r,options:s}}catch(n){n instanceof Error?console.error(`Error parsing URL: ${n.message}`,n):console.error("uncaught error",n)}return null},Mt=(t,e)=>{const n=Dt(t);if(n instanceof Error)return null;let o=null;if(e!=null&&e.endpoint&&(o=et(e==null?void 0:e.endpoint),!o))throw new _t("Cannot construct URL: bad endpoint. Ensure endpoint starts with http:// or https://");o||(o=et(vt));const i=[o.origin,"image",n],r=e?kt(e):null;return r&&i.push(r),e!=null&&e.filename?i.push(e.filename):i.push("image.jpg"),i.join("/")},Gt=t=>{try{const e=new URL(t),n=Ct(e.pathname.split("/"));if(n[0]!=="image"||![3,4].includes(n.length))throw new Error("Unrecognized URL");const o=n[1].trim();if(!o.length||!k(o))throw new Error("URL is not formatted as base64url");if(n.length===4){const i=n[2].split(",");return{code:o,optionTokens:i}}if(n.length===3)return{code:o,optionTokens:[]}}catch{return null}return null},ot=.7,st=1,U=24,Wt=v.lg,it=process.env.NODE_ENV,Ft=it==="development",ct=typeof document>"u",Ht=it==="test",qt=ct?()=>{}:I.useLayoutEffect,Xt="<visionary>",T=(t,...e)=>{!console||typeof console.log!="function"||console.log(`${Xt} ${t}`,...e)},Yt="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~",z=(t,e,n)=>{let o=0;for(;e<n;)o*=83,o+=Yt.indexOf(t[e++]);return o},at=Math.pow,D=Math.PI,Zt=D*2,lt=3294.6,ut=269.025,Jt=t=>t>10.31475?at(t/ut+.052132,2.4):t/lt,W=t=>~~(t>1227e-8?ut*at(t,.416666)-13.025:t*lt+1),P=t=>(t<0?-1:1)*t*t,dt=t=>{for(t+=D/2;t>D;)t-=Zt;const e=1.27323954*t-.405284735*P(t);return .225*(P(e)-e)+e};function Kt(t){const e=z(t,2,6);return[e>>16,e>>8&255,e&255]}function Qt(t,e,n,o){const i=z(t,0,1),r=i%9+1,s=~~(i/9)+1,a=r*s;let c=0,d=0,h=0,f=0,g=0,p=0,l=0,y=0,b=0,m=0,w=0,A=0,u=0,S=0;const _=(z(t,1,2)+1)/13446*(o|1),x=new Float64Array(a*3),X=Kt(t);for(c=0;c<3;c++)x[c]=Jt(X[c]);for(c=1;c<a;c++)S=z(t,4+c*2,6+c*2),x[c*3]=P(~~(S/(19*19))-9)*_,x[c*3+1]=P(~~(S/19)%19-9)*_,x[c*3+2]=P(S%19-9)*_;const j=e*4,N=new Uint8ClampedArray(j*n);for(f=0;f<n;f++)for(A=D*f/n,h=0;h<e;h++){for(g=0,p=0,l=0,u=D*h/e,d=0;d<s;d++)for(b=dt(A*d),c=0;c<r;c++)y=dt(u*c)*b,m=(c+d*r)*3,g+=x[m]*y,p+=x[m+1]*y,l+=x[m+2]*y;w=4*h+f*j,N[w]=W(g),N[w+1]=W(p),N[w+2]=W(l),N[w+3]=255}return N}const B=t=>{try{return new URL(t)}catch{return null}},te=(t,e)=>`rgba(${t.r},${t.g},${t.b},${e})`,F=t=>Ft||Ht?{"data-testid":t}:{},ee=(t,e)=>e?{"data-fileid":t}:{},ft=(t,e)=>Math.min(t,e),ne=t=>{let e=t.replace(/^#/,"");if(e.length!==3&&e.length!==6)return null;e.length===3&&(e=`${e[0]}${e[0]}${e[1]}${e[1]}${e[2]}${e[2]}`);const n=parseInt(e.slice(0,2),16),o=parseInt(e.slice(2,4),16);return{b:parseInt(e.slice(4,6),16),g:o,r:n}},O=(t,e=0)=>{const n=Math.pow(10,e);return Math.round(t*n)/n},re=(t,e)=>{const n=B(t),o=B(e);return!n||!o?t:(o.pathname=n.pathname,o.search=n.search,o.toString())},oe=(t,e={},n=ot,o=st)=>{if(!t)return null;try{e.debug&&T("input imageSrc:",t);const i=zt(t);if(e.debug&&T("Visionary URL data: ",i),!i)throw new Error("Could not parse Visionary URL");const{fields:r,options:s}=i;if(r.sourceWidth<1||r.sourceHeight<1)throw new Error("Invalid image dimensions");const a=r.sourceWidth/r.sourceHeight,c=(e==null?void 0:e.size)??s.size??Wt,d=M[c];let h=0,f=0,g=0;if(a>=1){f=h=ft(d,r.sourceWidth);const m=O(f/a);g=O(f/m,6)}else h=ft(d,r.sourceHeight),f=O(h*a),g=O(f/h,6);const p=O(100/g,6),l={...r,arPaddingTop:`${p}%`,aspectRatio:g,maxWidth:f,src:t},y=B(r.url);if(y)l.src=y.toString();else if(!B(t)&&k(r.url)){const m=Mt(r,{endpoint:e.endpoint,size:c});m&&(l.src=m)}e.endpoint&&(l.src=re(l.src,e.endpoint));const b=r.bcc?ne(r.bcc):null;if(b&&(l.backgroundColor=te(b,n)),!ct&&r.blurhash&&!e.disableBlurLayer){const m=performance.now(),w=Qt(r.blurhash,U,U,o),A=performance.now()-m;e.debug&&T(`Blurhash decode time: ${O(A,1)} ms`),w&&(l.pixels=w)}return e.debug&&T("Visionary Image state: ",l),l}catch{return null}},pt={bottom:0,left:0,position:"absolute",right:0,top:0},se={...pt,maxHeight:"100%",maxWidth:"100%"},ie={...pt,height:"100%",width:"100%"},ce=t=>{const e={...se};return t&&(e.display="none"),e},H={CANVAS:"canvas",CONTAINER:"container",IMAGE:"image"},q={container:"v7y_7587",preventDrag:"v7y_b8c0",preventSelection:"v7y_e0dd"},ae=({alt:t,bgColorAlpha:e=ot,className:n,debug:o=!1,disableBlurLayer:i=!1,disableImageLayer:r=!1,endpoint:s,height:a,hideImageLayer:c=!1,lazy:d=!0,onClick:h,onError:f,onLoad:g,preventDrag:p=!1,preventSelection:l=!1,punch:y=st,size:b,src:m,style:w,width:A})=>{const u=I.useMemo(()=>oe(m,{debug:o,disableBlurLayer:i,endpoint:s,size:b},e,y),[e,o,i,s,y,b,m]),S=I.useRef(null),[_,x]=yt();qt(function(){if(!S.current||!(u!=null&&u.blurhash))return;if(!u.pixels){console.warn("No pixel data passed in, skipping");return}const de=performance.now(),Z=S.current.getContext("2d");if(!Z){console.warn("Cannot access canvasRenderingContext, skipping");return}const J=Z.createImageData(U,U);if(!J){console.warn("Could not create ImageData on CanvasRenderingContext");return}if(J.data.set(u.pixels),Z.putImageData(J,0,0),o){const fe=performance.now()-de;T(`Canvas render time: ${O(fe,1)} ms`)}},[u==null?void 0:u.blurhash,u==null?void 0:u.pixels,o]);const X=I.useCallback(V=>{o&&T("Image load error ",V),f&&f()},[o,f]),j={alt:t,loading:!d||x?"eager":"lazy",onLoad:g};if(!u){o&&T("Not a Visionary URL, rendering fallback <img />");const V={...j,className:n,height:a,onClick:h,onError:f,src:m,style:w,width:A};return R.jsx("img",{...V})}const N=mt(q.container,n,{[q.preventDrag]:!!p,[q.preventSelection]:!!l}),Y={...{"--v-ar":u.arPaddingTop},aspectRatio:u.aspectRatio,backgroundColor:(u==null?void 0:u.backgroundColor)??void 0,maxWidth:u.maxWidth,position:"relative",width:"100%",...w};A&&(Y.width=A),a&&(Y.height=a);const le={onClick:h},ue=ce(c);return R.jsxs("div",{className:N,ref:_,style:Y,...ee(u.url,o),...F(H.CONTAINER),...le,children:[!i&&R.jsx("canvas",{height:U,ref:S,style:ie,width:U,...F(H.CANVAS)}),!r&&R.jsx("img",{...j,...F(H.IMAGE),onError:X,src:u.src,style:ue})]})};E.Image=ae,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
|
6
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",s=0;s<arguments.length;s++){var u=arguments[s];u&&(r=i(r,o(u)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var s="";for(var u in r)t.call(r,u)&&r[u]&&(s=i(s,u));return s}function i(r,s){return s?r?r+" "+s:r+s:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(K);var ge=K.exports;const be=me(ge),ye=(e,{root:t,rootMargin:n,threshold:o}={},i=[])=>{const r=x.useRef(null),s=x.useRef(null);return x.useCallback(c=>{r.current&&s.current&&(s.current.unobserve(r.current),s.current.disconnect(),s.current=null),c&&(s.current=new IntersectionObserver(e,{root:t,rootMargin:n,threshold:o}),s.current.observe(c),r.current=c)},[r,t,n,JSON.stringify(o),...i])},ve=({root:e,rootMargin:t,threshold:n,unobserveOnEnter:o,target:i,onEnter:r,onLeave:s,defaultInView:u}={},c=[])=>{const[a,p]=x.useState({inView:u||!1,entry:null,observer:null}),l=x.useCallback(([h],f)=>{const b=f.thresholds.some(g=>h.intersectionRatio>=g)&&h.isIntersecting;p({inView:b,entry:h,observer:f}),b&&o&&(f.unobserve(h.target),f.disconnect()),b?r==null||r(h,f):s==null||s(h,f)},[r,s,o]),m=ye(l,{root:e,rootMargin:t,threshold:n},[o,...c]);return x.useEffect(()=>{i!=null&&i.current&&m(i.current)},[i,m]),[m,a.inView,a.entry,a.observer]};var j=(e=>(e.AUTO="auto",e.AVIF="avif",e.JPEG="jpeg",e.WEBP="webp",e))(j||{}),v=(e=>(e.xs="xs",e.sm="sm",e.md="md",e.lg="lg",e.xl="xl",e.xxl="xxl",e["4k"]="4k",e["5k"]="5k",e.full="full",e))(v||{}),O=(e=>(e.DEBUG="debug",e.DOWNLOAD="download",e))(O||{});const we="https://link.visionary.cloud";j.AUTO,v.lg;const M={[v.xs]:160,[v.sm]:320,[v.md]:640,[v.lg]:1280,[v.xl]:1920,[v.xxl]:2560,[v["4k"]]:3840,[v["5k"]]:5120,[v.full]:0};Object.keys(M).reduce((e,t)=>{const n=t,o=M[n];return o&&(e[o]=n),e},{});const Q="!";var Ie=Object.defineProperty,xe=(e,t,n)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ee=(e,t,n)=>xe(e,typeof t!="symbol"?t+"":t,n),G={},V={};Object.defineProperty(V,"__esModule",{value:!0});function Ae(e){return String.fromCharCode(parseInt(e.slice(1),16))}function Re(e){return btoa(encodeURIComponent(e).replace(/%[0-9A-F]{2}/g,Ae))}V.encode=Re;function Se(e){return`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`}function Te(e){return decodeURIComponent(Array.from(atob(e),Se).join(""))}V.decode=Te,Object.defineProperty(G,"__esModule",{value:!0});const ee=V;function Ue(e){return ee.decode(e.replace(/\-/g,"+").replace(/_/g,"/"))}var Ne=G.decode=Ue;function Oe(e){return ee.encode(e).replace(/\//g,"_").replace(/\+/g,"-").replace(/=+$/,"")}var Ce=G.encode=Oe;const De=e=>e.filter(Boolean),te=e=>{try{return new URL(e)}catch{return null}},L=(e="")=>/^[A-Za-z0-9_-]*$/.test(e),Pe=e=>{const{altText:t,bcc:n,blurhash:o,blurhashX:i,blurhashY:r,sourceHeight:s,sourceWidth:u,url:c}=e;if(!c||!u||!s)return new Error("Cannot construct visionary code: missing required url/width/height");const a=[c,u,s];return!n||(a.push(n),!o||!i||!r)||(a.push(o,i,r),t&&t.length&&a.push(t)),_e(a)},_e=e=>Ce(e.join(Q)),ne=e=>{if(typeof e!="string")return null;const t=e.trim();if(!t.length||!L(t))return null;const n=Ne(t);if(!n)return null;const o=n.split(Q);if(o.length<3)return null;const[i,r,s,u,c,a,p,l]=o,m=i.trim();if(!m.length)return console.error("Cannot parse code, empty file id"),null;const h=Number(r.trim()),f=Number(s.trim());if(isNaN(h)||isNaN(f)||!h||!f)return console.error("Cannot parse Visionary Code: invalid image dimensions",r,s),null;const y=Number(a)??0,b=Number(p)??0;return y<1||b<1?(console.error("Cannot parse Visionary Code: invalid blurhash x, y component dimensions",y,b),null):{altText:l,bcc:u,blurhash:c,blurhashX:y,blurhashY:b,sourceHeight:f,sourceWidth:h,url:m}};class je extends Error{constructor(){super(...arguments),Ee(this,"message","invalid endpoint URL (does it contain http/https?)")}}const Ve=e=>e===O.DEBUG,Le=e=>e===O.DOWNLOAD,$e=e=>Object.values(j).includes(e),re=e=>Object.values(v).includes(e),ke=(e=[])=>{const t={};for(const n of e)re(n)?t.size=v[n]:Ve(n)?t.debug=!0:Le(n)?t.download=!0:$e(n)&&(t.format=n);return t},ze=e=>{if(!e||typeof e!="object")return null;const t=[];return e.debug&&t.push(O.DEBUG),e.download&&t.push(O.DOWNLOAD),e.format&&e.format!==j.AUTO&&t.push(e.format),e.size&&re(e.size)&&t.push(e.size),t.length?t.sort().join(","):null},Be=e=>{if(L(e)){const t=ne(e);if(t)return{fields:t,options:{}}}return Me(e)},Me=e=>{if(!e)return null;const t=e.trim();if(!t)return null;try{const n=We(t);if(!n)return null;const{code:o,optionTokens:i}=n,r=ne(o);if(!r)return null;const s=ke(i);return{fields:r,options:s}}catch(n){n instanceof Error?console.error(`Error parsing URL: ${n.message}`,n):console.error("uncaught error",n)}return null},Ge=(e,t)=>{const n=Pe(e);if(n instanceof Error)return null;let o=null;if(t!=null&&t.endpoint&&(o=te(t==null?void 0:t.endpoint),!o))throw new je("Cannot construct URL: bad endpoint. Ensure endpoint starts with http:// or https://");o||(o=te(we));const i=[o.origin,"image",n],r=t?ze(t):null;return r&&i.push(r),t!=null&&t.filename?i.push(t.filename):i.push("image.jpg"),i.join("/")},We=e=>{try{const t=new URL(e),n=De(t.pathname.split("/"));if(n[0]!=="image"||![3,4].includes(n.length))throw new Error("Unrecognized URL");const o=n[1].trim();if(!o.length||!L(o))throw new Error("URL is not formatted as base64url");if(n.length===4){const i=n[2].split(",");return{code:o,optionTokens:i}}if(n.length===3)return{code:o,optionTokens:[]}}catch{return null}return null},oe=.7,se=1,N=24,Fe=v.lg,ce=process.env.NODE_ENV,He=ce==="development",ie=typeof document>"u",Xe=ce==="test",Ye=ie?()=>{}:x.useLayoutEffect,qe="<visionary>",S=(e,...t)=>{!console||typeof console.log!="function"||console.log(`${qe} ${e}`,...t)},ae=new Uint8Array(128);for(let e=0;e<83;e++)ae["0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~".charCodeAt(e)]=e;const $=(e,t,n)=>{let o=0;for(;t<n;)o*=83,o+=ae[e.charCodeAt(t++)];return o},le=Math.pow,C=Math.PI,Ze=C*2,ue=3294.6,fe=269.025,Je=e=>e>10.31475?le(e/fe+.052132,2.4):e/ue,W=e=>~~(e>1227e-8?fe*le(e,.416666)-13.025:e*ue+1),D=e=>(e<0?-1:1)*e*e,de=e=>{for(e+=C/2;e>C;)e-=Ze;const t=1.27323954*e-.405284735*D(e);return .225*(D(t)-t)+t};function Ke(e){const t=$(e,2,6);return[t>>16,t>>8&255,t&255]}function Qe(e,t,n,o){const i=$(e,0,1),r=i%9+1,s=~~(i/9)+1,u=r*s;let c=0,a=0,p=0,l=0,m=0,h=0,f=0,y=0,b=0,g=0,w=0,E=0;const d=($(e,1,2)+1)/13446*(o|1),I=new Float64Array(u*3),Y=Ke(e);for(c=0;c<3;c++)I[c]=Je(Y[c]);for(c=1;c<u;c++)E=$(e,4+c*2,6+c*2),I[c*3]=D(~~(E/361)-9)*d,I[c*3+1]=D(~~(E/19)%19-9)*d,I[c*3+2]=D(E%19-9)*d;const z=new Float64Array(s*n),B=new Float64Array(r*t);for(a=0;a<s;a++)for(l=0;l<n;l++)z[a*n+l]=de(C*l*a/n);for(c=0;c<r;c++)for(p=0;p<t;p++)B[c*t+p]=de(C*p*c/t);const P=t*4,U=new Uint8ClampedArray(P*n);for(l=0;l<n;l++)for(p=0;p<t;p++){for(m=h=f=0,a=0;a<s;a++)for(b=z[a*n+l],c=0;c<r;c++)y=B[c*t+p]*b,g=(c+a*r)*3,m+=I[g]*y,h+=I[g+1]*y,f+=I[g+2]*y;w=4*p+l*P,U[w]=W(m),U[w+1]=W(h),U[w+2]=W(f),U[w+3]=255}return U}const k=e=>{try{return new URL(e)}catch{return null}},et=(e,t)=>`rgba(${e.r},${e.g},${e.b},${t})`,F=e=>He||Xe?{"data-testid":e}:{},tt=(e,t)=>t?{"data-fileid":e}:{},pe=(e,t)=>Math.min(e,t),nt=e=>{let t=e.replace(/^#/,"");if(t.length!==3&&t.length!==6)return null;t.length===3&&(t=`${t[0]}${t[0]}${t[1]}${t[1]}${t[2]}${t[2]}`);const n=parseInt(t.slice(0,2),16),o=parseInt(t.slice(2,4),16);return{b:parseInt(t.slice(4,6),16),g:o,r:n}},T=(e,t=0)=>{const n=Math.pow(10,t);return Math.round(e*n)/n},rt=(e,t)=>{const n=k(e),o=k(t);return!n||!o?e:(o.pathname=n.pathname,o.search=n.search,o.toString())},ot=(e,t={},n=oe,o=se)=>{if(!e)return null;try{t.debug&&S("input imageSrc:",e);const i=Be(e);if(t.debug&&S("Visionary URL data: ",i),!i)throw new Error("Could not parse Visionary URL");const{fields:r,options:s}=i;if(r.sourceWidth<1||r.sourceHeight<1)throw new Error("Invalid image dimensions");const u=r.sourceWidth/r.sourceHeight,c=(t==null?void 0:t.size)??s.size??Fe,a=M[c];let p=0,l=0,m=0;if(u>=1){l=p=pe(a,r.sourceWidth);const g=T(l/u);m=T(l/g,6)}else p=pe(a,r.sourceHeight),l=T(p*u),m=T(l/p,6);const h=T(100/m,6),f={...r,arPaddingTop:`${h}%`,aspectRatio:m,maxWidth:l,src:e},y=k(r.url);if(y)f.src=y.toString();else if(!k(e)&&L(r.url)){const g=Ge(r,{endpoint:t.endpoint,size:c});g&&(f.src=g)}t.endpoint&&(f.src=rt(f.src,t.endpoint));const b=r.bcc?nt(r.bcc):null;if(b&&(f.backgroundColor=et(b,n)),!ie&&r.blurhash&&!t.disableBlurLayer){const g=performance.now(),w=Qe(r.blurhash,N,N,o),E=performance.now()-g;t.debug&&S(`Blurhash decode time: ${T(E,1)} ms`),w&&(f.pixels=w)}return t.debug&&S("Visionary Image state: ",f),f}catch{return null}},he={bottom:0,left:0,position:"absolute",right:0,top:0},st={...he,maxHeight:"100%",maxWidth:"100%"},ct={...he,height:"100%",width:"100%"},it=e=>{const t={...st};return e&&(t.display="none"),t},H={CANVAS:"canvas",CONTAINER:"container",IMAGE:"image"},X={container:"v7y_7587",preventDrag:"v7y_b8c0",preventSelection:"v7y_e0dd"},at=({alt:e,bgColorAlpha:t=oe,className:n,debug:o=!1,disableBlurLayer:i=!1,disableImageLayer:r=!1,endpoint:s,height:u,hideImageLayer:c=!1,lazy:a=!0,onClick:p,onError:l,onLoad:m,preventDrag:h=!1,preventSelection:f=!1,punch:y=se,size:b,src:g,style:w,width:E})=>{const d=x.useMemo(()=>ot(g,{debug:o,disableBlurLayer:i,endpoint:s,size:b},t,y),[t,o,i,s,y,b,g]),I=x.useRef(null),[Y,z]=ve();Ye(function(){if(!I.current||!(d!=null&&d.blurhash))return;if(!d.pixels){console.warn("No pixel data passed in, skipping");return}const ft=performance.now(),Z=I.current.getContext("2d");if(!Z){console.warn("Cannot access canvasRenderingContext, skipping");return}const J=Z.createImageData(N,N);if(!J){console.warn("Could not create ImageData on CanvasRenderingContext");return}if(J.data.set(d.pixels),Z.putImageData(J,0,0),o){const dt=performance.now()-ft;S(`Canvas render time: ${T(dt,1)} ms`)}},[d==null?void 0:d.blurhash,d==null?void 0:d.pixels,o]);const B=x.useCallback(_=>{o&&S("Image load error ",_),l&&l()},[o,l]),P={alt:e,loading:!a||z?"eager":"lazy",onLoad:m};if(!d){o&&S("Not a Visionary URL, rendering fallback <img />");const _={...P,className:n,height:u,onClick:p,onError:l,src:g,style:w,width:E};return R.jsx("img",{..._})}const U=be(X.container,n,{[X.preventDrag]:!!h,[X.preventSelection]:!!f}),q={...{"--v-ar":d.arPaddingTop},aspectRatio:d.aspectRatio,backgroundColor:(d==null?void 0:d.backgroundColor)??void 0,maxWidth:d.maxWidth,position:"relative",width:"100%",...w};E&&(q.width=E),u&&(q.height=u);const lt={onClick:p},ut=it(c);return R.jsxs("div",{className:U,ref:Y,style:q,...tt(d.url,o),...F(H.CONTAINER),...lt,children:[!i&&R.jsx("canvas",{height:N,ref:I,style:ct,width:N,...F(H.CANVAS)}),!r&&R.jsx("img",{...P,...F(H.IMAGE),onError:B,src:d.src,style:ut})]})};A.Image=at,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visionary-image",
|
|
3
3
|
"description": "React image component with built-in Blurhash placeholders for better UX and Core Web Vitals.",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/visionary-image.umd.js",
|
|
7
7
|
"module": "./dist/visionary-image.es.js",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "tsc && npm run clean && vite build",
|
|
20
|
+
"build-storybook": "storybook build -o storybook-static",
|
|
20
21
|
"clean": "rimraf dist/",
|
|
21
22
|
"dev": "vite",
|
|
22
23
|
"lint": "tsc --noEmit; eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
23
24
|
"preview": "vite preview",
|
|
24
|
-
"test": "vitest",
|
|
25
|
-
"test:coverage": "vitest run --coverage",
|
|
26
25
|
"storybook": "storybook dev -p 6006 --no-open",
|
|
27
|
-
"
|
|
26
|
+
"test": "vitest",
|
|
27
|
+
"test:coverage": "vitest run --coverage"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist/",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"classnames": "2.5.1",
|
|
40
|
-
"fast-blurhash": "1.1.
|
|
40
|
+
"fast-blurhash": "1.1.4",
|
|
41
41
|
"react-hook-inview": "4.5.1",
|
|
42
42
|
"visionary-url": "1.3.1"
|
|
43
43
|
},
|