@mobilon-dev/chotto 0.3.130 → 0.3.133
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/chotto.css +1 -1
- package/dist/components/3_compounds/Feed/Feed.vue.js +2 -2
- package/dist/components/3_compounds/Feed/Feed.vue2.js +174 -162
- package/dist/components/3_compounds/Feed/composables/useFeedLoadMore.js +73 -46
- package/dist/components/3_compounds/Feed/composables/useFeedTopSpacer.js +20 -20
- package/dist/themes/dark.css +1 -1
- package/dist/themes/default.css +1 -1
- package/dist/themes/glass.css +1 -1
- package/dist/themes/green.css +1 -1
- package/dist/themes/mobilon1.css +1 -1
- package/dist/types/src/components/2_elements/ChatInfo/styles/types.d.ts +6 -0
- package/dist/types/src/components/3_compounds/ChatInput/styles/types.d.ts +4 -0
- package/dist/types/src/components/3_compounds/Feed/composables/useFeedLoadMore.d.ts +5 -0
- package/dist/types/src/components/3_compounds/Feed/composables/useFeedTopSpacer.d.ts +7 -4
- package/package.json +1 -1
|
@@ -1,70 +1,97 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
function
|
|
1
|
+
import { ref as r, watch as w, unref as s, nextTick as W } from "vue";
|
|
2
|
+
function x({
|
|
3
3
|
feedRef: n,
|
|
4
|
-
emit:
|
|
5
|
-
isLoadingMoreRef:
|
|
6
|
-
stickToBottomRef:
|
|
4
|
+
emit: h,
|
|
5
|
+
isLoadingMoreRef: S,
|
|
6
|
+
stickToBottomRef: H
|
|
7
7
|
}) {
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
const
|
|
15
|
-
|
|
8
|
+
const t = r(!1), a = r(!1), p = r(!1), i = r(!1), T = r(0), d = r(0), u = r(!1), m = r(!1), F = () => !!(H && s(H)), B = (o = !0) => {
|
|
9
|
+
const e = s(n);
|
|
10
|
+
if (!e) return;
|
|
11
|
+
const l = e.scrollHeight - e.scrollTop - e.clientHeight;
|
|
12
|
+
i.value ? (e.scrollTop < 300 && !F() && (p.value = !1, t.value = !1), l < 300 && (a.value = !1, p.value = !0)) : o && (e.scrollTop < 300 && !F() && (T.value = e.scrollHeight, d.value = e.scrollTop, u.value = !0, t.value = !1), l < 300 && (a.value = !1));
|
|
13
|
+
}, L = (o = 0) => {
|
|
14
|
+
const e = () => {
|
|
15
|
+
W(() => {
|
|
16
16
|
requestAnimationFrame(() => {
|
|
17
17
|
try {
|
|
18
|
-
const
|
|
19
|
-
if (!
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const l = s(n);
|
|
19
|
+
if (!l || !u.value) return;
|
|
20
|
+
const f = l.style.scrollBehavior;
|
|
21
|
+
l.style.scrollBehavior = "auto";
|
|
22
|
+
const v = l.scrollHeight - T.value;
|
|
23
|
+
l.scrollTop = d.value + v, setTimeout(() => {
|
|
24
|
+
l.style.scrollBehavior = f || "auto";
|
|
25
25
|
}, 50);
|
|
26
26
|
} finally {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
u.value = !1, m.value = !0, setTimeout(() => {
|
|
28
|
+
m.value = !1;
|
|
29
29
|
}, 500);
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
o > 0 ? setTimeout(
|
|
34
|
+
o > 0 ? setTimeout(e, o) : e();
|
|
35
35
|
};
|
|
36
|
-
|
|
37
|
-
() => [a.value,
|
|
36
|
+
h && w(
|
|
37
|
+
() => [a.value, t.value],
|
|
38
38
|
() => {
|
|
39
|
-
a.value ||
|
|
39
|
+
a.value || h("loadMoreDown"), t.value || h("loadMore");
|
|
40
40
|
}
|
|
41
|
-
),
|
|
42
|
-
() =>
|
|
43
|
-
(o,
|
|
44
|
-
|
|
41
|
+
), S && w(
|
|
42
|
+
() => S.value,
|
|
43
|
+
(o, e) => {
|
|
44
|
+
e === !0 && o === !1 && L(0);
|
|
45
45
|
}
|
|
46
|
-
)
|
|
47
|
-
|
|
46
|
+
);
|
|
47
|
+
const M = (o) => {
|
|
48
|
+
const e = s(n);
|
|
49
|
+
if (!e) return;
|
|
50
|
+
(o.offsetX > e.clientWidth || o.offsetY > e.clientHeight) && (i.value = !0);
|
|
51
|
+
}, y = () => {
|
|
52
|
+
i.value = !1;
|
|
53
|
+
}, Y = () => {
|
|
54
|
+
t.value = !0, a.value = !0;
|
|
55
|
+
}, g = () => {
|
|
56
|
+
const o = s(n);
|
|
57
|
+
return !o || !t.value ? !1 : (T.value = o.scrollHeight, d.value = o.scrollTop, u.value = !0, t.value = !1, !0);
|
|
58
|
+
}, O = (o) => {
|
|
59
|
+
if (o.deltaY >= 0) return;
|
|
60
|
+
const e = s(n);
|
|
61
|
+
!e || !(e.scrollHeight <= e.clientHeight + 1) || t.value && g();
|
|
62
|
+
};
|
|
63
|
+
let c = null;
|
|
64
|
+
return {
|
|
65
|
+
allowLoadMoreTop: t,
|
|
48
66
|
allowLoadMoreBottom: a,
|
|
49
|
-
movingDown:
|
|
50
|
-
isScrollByMouseButton:
|
|
51
|
-
pendingTopRestore:
|
|
52
|
-
topLoadJustHappened:
|
|
67
|
+
movingDown: p,
|
|
68
|
+
isScrollByMouseButton: i,
|
|
69
|
+
pendingTopRestore: u,
|
|
70
|
+
topLoadJustHappened: m,
|
|
53
71
|
checkScrollPosition: B,
|
|
54
|
-
restoreScrollPosition:
|
|
55
|
-
startScrollWatch:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
72
|
+
restoreScrollPosition: L,
|
|
73
|
+
startScrollWatch: M,
|
|
74
|
+
stopScrollWatch: y,
|
|
75
|
+
resetAllowFlags: Y,
|
|
76
|
+
requestTopLoadFromUserGesture: g,
|
|
77
|
+
handleWheelForTopLoad: O,
|
|
78
|
+
handleTouchStartForTopLoad: (o) => {
|
|
79
|
+
var e;
|
|
80
|
+
c = ((e = o.touches[0]) == null ? void 0 : e.clientY) ?? null;
|
|
59
81
|
},
|
|
60
|
-
|
|
61
|
-
|
|
82
|
+
handleTouchMoveForTopLoad: (o) => {
|
|
83
|
+
var v;
|
|
84
|
+
if (c == null) return;
|
|
85
|
+
const e = s(n);
|
|
86
|
+
if (!e || !(e.scrollHeight <= e.clientHeight + 1)) return;
|
|
87
|
+
const f = (v = o.touches[0]) == null ? void 0 : v.clientY;
|
|
88
|
+
f != null && (f - c < 24 || t.value && (c = null, g()));
|
|
62
89
|
},
|
|
63
|
-
|
|
64
|
-
|
|
90
|
+
handleTouchEndForTopLoad: () => {
|
|
91
|
+
c = null;
|
|
65
92
|
}
|
|
66
93
|
};
|
|
67
94
|
}
|
|
68
95
|
export {
|
|
69
|
-
|
|
96
|
+
x as useFeedLoadMore
|
|
70
97
|
};
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const n =
|
|
1
|
+
import { ref as p, watch as l, onUnmounted as h, nextTick as _ } from "vue";
|
|
2
|
+
const v = 8;
|
|
3
|
+
function g({ feedRef: i, objectsLengthRef: r }) {
|
|
4
|
+
const n = p(0);
|
|
5
5
|
let e = null;
|
|
6
|
-
function
|
|
7
|
-
const t =
|
|
8
|
-
if (!t ||
|
|
6
|
+
function a() {
|
|
7
|
+
const t = i.value;
|
|
8
|
+
if (!t || r.value === 0) {
|
|
9
9
|
n.value = 0;
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
const c = t.querySelector(".message-feed__top-spacer"),
|
|
13
|
-
|
|
12
|
+
const c = t.querySelector(".message-feed__top-spacer"), f = (c == null ? void 0 : c.offsetHeight) ?? 0, d = t.scrollHeight - f, u = t.clientHeight - d, s = u > 0 && u <= v ? u + 1 : 0;
|
|
13
|
+
s !== n.value && (n.value = s);
|
|
14
14
|
}
|
|
15
15
|
function o() {
|
|
16
|
-
|
|
16
|
+
_(() => {
|
|
17
17
|
requestAnimationFrame(() => {
|
|
18
|
-
|
|
18
|
+
a(), requestAnimationFrame(a);
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function m(t) {
|
|
23
23
|
e == null || e.disconnect(), t && (e = new ResizeObserver(() => o()), e.observe(t));
|
|
24
24
|
}
|
|
25
|
-
return
|
|
26
|
-
|
|
25
|
+
return l(
|
|
26
|
+
i,
|
|
27
27
|
(t) => {
|
|
28
|
-
|
|
28
|
+
m(t), o();
|
|
29
29
|
},
|
|
30
30
|
{ immediate: !0 }
|
|
31
|
-
),
|
|
32
|
-
|
|
31
|
+
), l(
|
|
32
|
+
r,
|
|
33
33
|
() => o(),
|
|
34
34
|
{ immediate: !0 }
|
|
35
|
-
),
|
|
35
|
+
), h(() => {
|
|
36
36
|
e == null || e.disconnect(), e = null;
|
|
37
37
|
}), {
|
|
38
38
|
topSpacerPx: n,
|
|
@@ -40,6 +40,6 @@ function F({ feedRef: u, objectsLengthRef: i }) {
|
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
v as FEED_TOP_LOAD_OVERFLOW_PX,
|
|
44
|
+
g as useFeedTopSpacer
|
|
45
45
|
};
|