@dotss/tictoccroc 0.0.33 → 0.0.35
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/shared/components/Image/Image.mjs +124 -123
- package/dist/shared/components/Masonry/Masonry.mjs +192 -185
- package/dist/shared/components/Masonry/Masonry.utils.d.ts +2 -0
- package/dist/shared/components/Masonry/Masonry.utils.mjs +57 -52
- package/dist/shared/components/Masonry/MasonryBlock/MasonryBlock.d.ts +7 -2
- package/dist/shared/components/Masonry/MasonryBlock/MasonryBlock.mjs +99 -94
- package/dist/shared/components/MediaDialog/MediaDialog.mjs +96 -95
- package/dist/shared/hooks/useInView/useInView.mjs +35 -17
- package/dist/shared/hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,120 +1,121 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Flexbox as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import { jsxs as H, jsx as l, Fragment as nt } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ot, useRef as U, useImperativeHandle as it, useState as S, useEffect as V } from "react";
|
|
3
|
+
import { Flexbox as _, Skeleton as z } from "@dotss/ui";
|
|
4
|
+
import st from "../../hooks/useInView/useInView.mjs";
|
|
5
|
+
import lt from "../../hooks/useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.mjs";
|
|
6
|
+
import O from "../../utils/getImageUrl/getImageUrl.mjs";
|
|
7
|
+
import B from "./Image.error.mjs";
|
|
8
|
+
const rt = ot(
|
|
8
9
|
({
|
|
9
|
-
src:
|
|
10
|
+
src: s,
|
|
10
11
|
width: e,
|
|
11
12
|
height: o,
|
|
12
|
-
fit:
|
|
13
|
-
position:
|
|
14
|
-
alt:
|
|
15
|
-
scale:
|
|
16
|
-
onLoad:
|
|
17
|
-
onLazyLoad:
|
|
18
|
-
lazy:
|
|
19
|
-
borderRadius:
|
|
13
|
+
fit: y = "cover",
|
|
14
|
+
position: m = "center",
|
|
15
|
+
alt: q,
|
|
16
|
+
scale: T = 2,
|
|
17
|
+
onLoad: A,
|
|
18
|
+
onLazyLoad: $,
|
|
19
|
+
lazy: D = !1,
|
|
20
|
+
borderRadius: c,
|
|
20
21
|
disabledResizing: L = !1,
|
|
21
|
-
withIntrinsicRatio:
|
|
22
|
-
enableBlurPlaceholder:
|
|
23
|
-
enableFallback:
|
|
24
|
-
enableErrorFallback:
|
|
25
|
-
renderErrorFallback:
|
|
22
|
+
withIntrinsicRatio: G = !1,
|
|
23
|
+
enableBlurPlaceholder: r = !1,
|
|
24
|
+
enableFallback: J = !1,
|
|
25
|
+
enableErrorFallback: K = !0,
|
|
26
|
+
renderErrorFallback: u,
|
|
26
27
|
wrapperProps: n = {},
|
|
27
|
-
onError:
|
|
28
|
-
...
|
|
29
|
-
},
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
28
|
+
onError: M,
|
|
29
|
+
...g
|
|
30
|
+
}, w) => {
|
|
31
|
+
const C = U(null), N = U(!1), I = U(null);
|
|
32
|
+
it(w, () => I.current);
|
|
33
|
+
const { isInView: p } = st(C, {
|
|
34
|
+
threshold: 0.4
|
|
35
|
+
}), [v, F] = S(!1), [h, d] = S(!1), [x, a] = S(!1), [W, k] = S(!1), [Q, R] = S(
|
|
36
|
+
O({
|
|
34
37
|
mode: "original",
|
|
35
|
-
src:
|
|
38
|
+
src: s,
|
|
36
39
|
width: e,
|
|
37
40
|
height: o,
|
|
38
|
-
fit:
|
|
39
|
-
position:
|
|
40
|
-
scale:
|
|
41
|
+
fit: y,
|
|
42
|
+
position: m,
|
|
43
|
+
scale: T,
|
|
41
44
|
disabledResizing: L
|
|
42
45
|
})
|
|
43
|
-
),
|
|
46
|
+
), b = s == null ? void 0 : s.endsWith(".heic"), E = r ? O({
|
|
44
47
|
mode: "blur",
|
|
45
|
-
src:
|
|
48
|
+
src: s,
|
|
46
49
|
width: e,
|
|
47
|
-
fit:
|
|
48
|
-
position:
|
|
50
|
+
fit: y,
|
|
51
|
+
position: m,
|
|
49
52
|
scale: 1 / 3,
|
|
50
53
|
disabledResizing: L
|
|
51
54
|
}) : null, X = (t) => {
|
|
52
|
-
|
|
55
|
+
d(!0), a(!1), typeof A == "function" && A(t);
|
|
53
56
|
}, Y = (t) => {
|
|
54
|
-
typeof
|
|
55
|
-
}, Z = () =>
|
|
56
|
-
return
|
|
57
|
-
if (
|
|
58
|
-
const t =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
(a = window.appScreenContent) == null || a.addEventListener("scroll", s), window.addEventListener("resize", s), window.addEventListener("orientationchange", s);
|
|
67
|
-
}, $ = () => {
|
|
68
|
-
var a;
|
|
69
|
-
(a = window.appScreenContent) == null || a.removeEventListener("scroll", s), window.removeEventListener("resize", s), window.removeEventListener("orientationchange", s);
|
|
57
|
+
typeof M == "function" && M(t.nativeEvent), a(!0), d(!1);
|
|
58
|
+
}, Z = () => k(!0);
|
|
59
|
+
return V(() => {
|
|
60
|
+
if (D && C.current) {
|
|
61
|
+
const t = () => {
|
|
62
|
+
p && F(!0);
|
|
63
|
+
}, j = () => {
|
|
64
|
+
var f;
|
|
65
|
+
(f = window.appScreenContent) == null || f.addEventListener("scroll", t), window.addEventListener("resize", t), window.addEventListener("orientationchange", t);
|
|
66
|
+
}, i = () => {
|
|
67
|
+
var f;
|
|
68
|
+
(f = window.appScreenContent) == null || f.removeEventListener("scroll", t), window.removeEventListener("resize", t), window.removeEventListener("orientationchange", t);
|
|
70
69
|
};
|
|
71
|
-
return
|
|
70
|
+
return t(), j(), i;
|
|
72
71
|
}
|
|
73
|
-
}),
|
|
74
|
-
typeof
|
|
75
|
-
}, [
|
|
76
|
-
const t =
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
}), V(() => {
|
|
73
|
+
typeof $ == "function" && v && !N.current && (N.current = !0, $());
|
|
74
|
+
}, [$, v]), lt(() => {
|
|
75
|
+
const t = I.current, j = (i) => {
|
|
76
|
+
window.fetch(s).then(async (f) => {
|
|
77
|
+
const P = await f.blob(), tt = (await import("heic2any")).default, et = await tt({ blob: P, toType: "image/png" });
|
|
78
|
+
R(URL.createObjectURL(et)), i.onload = () => {
|
|
79
|
+
i.style.opacity = "1", d(!0), a(!1), i.onload = null, i.onerror = null;
|
|
80
|
+
}, i.onerror = () => {
|
|
81
|
+
a(!0), d(!1), i.onload = null, i.onerror = null;
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
return t != null && t.complete ? b ? t.src.startsWith("blob:") || (t.style.transition = "opacity 0.3s", t.style.opacity = "0", j(t)) : t.naturalWidth > 0 ? (t.style.transition = "none", t.style.opacity = "1", d(!0)) : (t.style.opacity = "0", a(!0)) : t && (t.style.transition = "opacity 0.3s", t.style.opacity = "0", t.onload = () => {
|
|
86
|
+
t.style.opacity = "1", d(!0), t.onload = null;
|
|
79
87
|
}, t.onerror = () => {
|
|
80
|
-
if (!
|
|
81
|
-
|
|
88
|
+
if (!b) {
|
|
89
|
+
a(!0), t.onerror = null;
|
|
82
90
|
return;
|
|
83
91
|
}
|
|
84
|
-
|
|
85
|
-
const s = await H.blob(), O = (await import("heic2any")).default, $ = await O({ blob: s, toType: "image/png" });
|
|
86
|
-
N(URL.createObjectURL($)), i.current.onload = () => {
|
|
87
|
-
t.style.opacity = "1", m(!0), f(!1), i.current.onload = null, i.current.onerror = null;
|
|
88
|
-
}, i.current.onerror = () => {
|
|
89
|
-
f(!0), m(!1), i.current.onload = null, i.current.onerror = null;
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
+
a(!1), t.style.transition = "opacity 0.3s", t.style.opacity = "0", j(t);
|
|
92
93
|
}), () => {
|
|
93
94
|
t && (t.onload = null, t.onerror = null);
|
|
94
95
|
};
|
|
95
|
-
}, [v,
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
}, [v, s, b]), V(() => {
|
|
97
|
+
R(
|
|
98
|
+
O({
|
|
98
99
|
mode: "original",
|
|
99
|
-
src:
|
|
100
|
+
src: s,
|
|
100
101
|
width: e,
|
|
101
102
|
height: o,
|
|
102
|
-
fit:
|
|
103
|
-
position:
|
|
104
|
-
scale:
|
|
103
|
+
fit: y,
|
|
104
|
+
position: m,
|
|
105
|
+
scale: T,
|
|
105
106
|
disabledResizing: L
|
|
106
107
|
})
|
|
107
108
|
);
|
|
108
|
-
}, [
|
|
109
|
-
|
|
109
|
+
}, [s, e, o, y, m, T, L]), D ? /* @__PURE__ */ H(
|
|
110
|
+
_,
|
|
110
111
|
{
|
|
111
112
|
...n,
|
|
112
|
-
ref:
|
|
113
|
-
inlineCSS:
|
|
113
|
+
ref: C,
|
|
114
|
+
inlineCSS: G ? {
|
|
114
115
|
position: "relative",
|
|
115
116
|
paddingTop: `calc(100% / ${e} * ${o})`,
|
|
116
117
|
minWidth: "100%",
|
|
117
|
-
borderRadius:
|
|
118
|
+
borderRadius: c,
|
|
118
119
|
overflow: "hidden",
|
|
119
120
|
...n == null ? void 0 : n.inlineCSS
|
|
120
121
|
} : {
|
|
@@ -122,30 +123,30 @@ const it = 100, dt = et(
|
|
|
122
123
|
width: e,
|
|
123
124
|
minWidth: e,
|
|
124
125
|
height: o,
|
|
125
|
-
borderRadius:
|
|
126
|
+
borderRadius: c,
|
|
126
127
|
overflow: "hidden",
|
|
127
128
|
...n == null ? void 0 : n.inlineCSS
|
|
128
129
|
},
|
|
129
130
|
children: [
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
J && /* @__PURE__ */ l(
|
|
132
|
+
z,
|
|
132
133
|
{
|
|
133
134
|
width: "100%",
|
|
134
135
|
height: "100%",
|
|
135
|
-
borderRadius:
|
|
136
|
+
borderRadius: c || 0,
|
|
136
137
|
inlineCSS: {
|
|
137
138
|
position: "absolute",
|
|
138
139
|
top: 0,
|
|
139
140
|
left: 0,
|
|
140
|
-
opacity:
|
|
141
|
+
opacity: h || r && W ? 0 : 1,
|
|
141
142
|
transition: "opacity 0.3s"
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
145
|
),
|
|
145
|
-
|
|
146
|
+
r && E && v && /* @__PURE__ */ l(
|
|
146
147
|
"img",
|
|
147
148
|
{
|
|
148
|
-
src:
|
|
149
|
+
src: E,
|
|
149
150
|
alt: "",
|
|
150
151
|
width: e,
|
|
151
152
|
height: o,
|
|
@@ -158,27 +159,27 @@ const it = 100, dt = et(
|
|
|
158
159
|
width: "100%",
|
|
159
160
|
height: "100%",
|
|
160
161
|
filter: "blur(5px)",
|
|
161
|
-
opacity:
|
|
162
|
+
opacity: W && !h ? 1 : 0,
|
|
162
163
|
transition: "opacity 0.3s",
|
|
163
|
-
objectFit:
|
|
164
|
-
objectPosition:
|
|
164
|
+
objectFit: y,
|
|
165
|
+
objectPosition: m
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
),
|
|
168
|
-
v && /* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
169
|
+
v && /* @__PURE__ */ H(nt, { children: [
|
|
170
|
+
/* @__PURE__ */ l(
|
|
170
171
|
"img",
|
|
171
172
|
{
|
|
172
|
-
ref:
|
|
173
|
-
src:
|
|
174
|
-
alt:
|
|
173
|
+
ref: I,
|
|
174
|
+
src: Q,
|
|
175
|
+
alt: q,
|
|
175
176
|
width: e,
|
|
176
177
|
height: o,
|
|
177
178
|
onLoad: X,
|
|
178
179
|
onError: Y,
|
|
179
|
-
"aria-hidden":
|
|
180
|
+
"aria-hidden": x,
|
|
180
181
|
draggable: !1,
|
|
181
|
-
...
|
|
182
|
+
...g,
|
|
182
183
|
style: {
|
|
183
184
|
position: "absolute",
|
|
184
185
|
top: 0,
|
|
@@ -186,25 +187,25 @@ const it = 100, dt = et(
|
|
|
186
187
|
width: "100%",
|
|
187
188
|
height: "100%",
|
|
188
189
|
transition: "opacity 0.3s",
|
|
189
|
-
...
|
|
190
|
+
...g.style
|
|
190
191
|
}
|
|
191
192
|
}
|
|
192
193
|
),
|
|
193
|
-
|
|
194
|
+
K && x && ((u == null ? void 0 : u()) || /* @__PURE__ */ l(B, {}))
|
|
194
195
|
] })
|
|
195
196
|
]
|
|
196
197
|
}
|
|
197
|
-
) : /* @__PURE__ */
|
|
198
|
-
|
|
198
|
+
) : /* @__PURE__ */ H(
|
|
199
|
+
_,
|
|
199
200
|
{
|
|
200
201
|
...n,
|
|
201
|
-
ref:
|
|
202
|
-
inlineCSS:
|
|
202
|
+
ref: C,
|
|
203
|
+
inlineCSS: G ? {
|
|
203
204
|
position: "relative",
|
|
204
205
|
paddingTop: `calc(100% / ${e} * ${o})`,
|
|
205
206
|
minWidth: "100%",
|
|
206
207
|
transition: "padding-top 0.2s",
|
|
207
|
-
borderRadius:
|
|
208
|
+
borderRadius: c,
|
|
208
209
|
overflow: "hidden",
|
|
209
210
|
...n == null ? void 0 : n.inlineCSS
|
|
210
211
|
} : {
|
|
@@ -212,30 +213,30 @@ const it = 100, dt = et(
|
|
|
212
213
|
width: e,
|
|
213
214
|
minWidth: e,
|
|
214
215
|
height: o,
|
|
215
|
-
borderRadius:
|
|
216
|
+
borderRadius: c,
|
|
216
217
|
overflow: "hidden",
|
|
217
218
|
...n == null ? void 0 : n.inlineCSS
|
|
218
219
|
},
|
|
219
220
|
children: [
|
|
220
|
-
|
|
221
|
-
|
|
221
|
+
J && /* @__PURE__ */ l(
|
|
222
|
+
z,
|
|
222
223
|
{
|
|
223
224
|
width: "100%",
|
|
224
225
|
height: "100%",
|
|
225
|
-
borderRadius:
|
|
226
|
+
borderRadius: c || 0,
|
|
226
227
|
inlineCSS: {
|
|
227
228
|
position: "absolute",
|
|
228
229
|
top: 0,
|
|
229
230
|
left: 0,
|
|
230
|
-
opacity:
|
|
231
|
+
opacity: h || r && W ? 0 : 1,
|
|
231
232
|
transition: "opacity 0.3s"
|
|
232
233
|
}
|
|
233
234
|
}
|
|
234
235
|
),
|
|
235
|
-
|
|
236
|
+
r && E && /* @__PURE__ */ l(
|
|
236
237
|
"img",
|
|
237
238
|
{
|
|
238
|
-
src:
|
|
239
|
+
src: E,
|
|
239
240
|
alt: "",
|
|
240
241
|
width: e,
|
|
241
242
|
height: o,
|
|
@@ -248,24 +249,24 @@ const it = 100, dt = et(
|
|
|
248
249
|
width: "100%",
|
|
249
250
|
height: "100%",
|
|
250
251
|
filter: "blur(5px)",
|
|
251
|
-
opacity:
|
|
252
|
+
opacity: W && !h ? 1 : 0,
|
|
252
253
|
transition: "opacity 0.3s"
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
),
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ l(
|
|
257
258
|
"img",
|
|
258
259
|
{
|
|
259
|
-
ref:
|
|
260
|
-
src:
|
|
261
|
-
alt:
|
|
260
|
+
ref: I,
|
|
261
|
+
src: Q,
|
|
262
|
+
alt: q,
|
|
262
263
|
width: e,
|
|
263
264
|
height: o,
|
|
264
265
|
onLoad: X,
|
|
265
266
|
onError: Y,
|
|
266
|
-
"aria-hidden":
|
|
267
|
+
"aria-hidden": x,
|
|
267
268
|
draggable: !1,
|
|
268
|
-
...
|
|
269
|
+
...g,
|
|
269
270
|
style: {
|
|
270
271
|
position: "absolute",
|
|
271
272
|
top: 0,
|
|
@@ -273,16 +274,16 @@ const it = 100, dt = et(
|
|
|
273
274
|
width: "100%",
|
|
274
275
|
height: "100%",
|
|
275
276
|
transition: "opacity 0.3s",
|
|
276
|
-
...
|
|
277
|
+
...g.style
|
|
277
278
|
}
|
|
278
279
|
}
|
|
279
280
|
),
|
|
280
|
-
|
|
281
|
+
K && x && ((u == null ? void 0 : u()) || /* @__PURE__ */ l(B, {}))
|
|
281
282
|
]
|
|
282
283
|
}
|
|
283
284
|
);
|
|
284
285
|
}
|
|
285
286
|
);
|
|
286
287
|
export {
|
|
287
|
-
|
|
288
|
+
rt as default
|
|
288
289
|
};
|