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