@gv-tech/ui-web 2.29.1 → 2.29.3
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/accordion.cjs +1 -1
- package/dist/accordion.mjs +53 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.mjs +99 -2
- package/dist/alert.cjs +1 -1
- package/dist/alert.mjs +2 -3
- package/dist/aspect-ratio.cjs +1 -1
- package/dist/aspect-ratio.mjs +10 -2
- package/dist/attachment.cjs +1 -1
- package/dist/attachment.mjs +26 -26
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.mjs +49 -2
- package/dist/badge.cjs +1 -1
- package/dist/badge.mjs +5 -5
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.mjs +13 -13
- package/dist/bubble.cjs +1 -1
- package/dist/bubble.mjs +5 -5
- package/dist/button-group.cjs +1 -1
- package/dist/button-group.mjs +13 -13
- package/dist/button.cjs +1 -1
- package/dist/button.mjs +5 -5
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.mjs +97 -2
- package/dist/card.cjs +1 -1
- package/dist/card.mjs +2 -3
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.mjs +107 -2
- package/dist/chart.cjs +2 -2
- package/dist/chart.mjs +14 -15
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.mjs +19 -2
- package/dist/collapsible.cjs +1 -1
- package/dist/collapsible.mjs +13 -14
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.mjs +161 -2
- package/dist/command.cjs +1 -1
- package/dist/command.mjs +89 -2
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.mjs +123 -2
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.mjs +41 -42
- package/dist/direction.cjs +1 -1
- package/dist/direction.mjs +8 -9
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.mjs +2 -3
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.mjs +126 -2
- package/dist/empty.cjs +1 -1
- package/dist/empty.mjs +2 -3
- package/dist/field.cjs +1 -1
- package/dist/field.mjs +37 -38
- package/dist/form.cjs +1 -1
- package/dist/form.mjs +34 -35
- package/dist/hooks/use-theme.d.ts +52 -52
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.mjs +30 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +66 -66
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.mjs +27 -28
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.mjs +45 -2
- package/dist/input.cjs +1 -1
- package/dist/input.mjs +2 -3
- package/dist/item.cjs +1 -1
- package/dist/item.mjs +29 -29
- package/dist/kbd.cjs +1 -1
- package/dist/kbd.mjs +2 -3
- package/dist/label.cjs +1 -1
- package/dist/label.mjs +13 -2
- package/dist/marker.cjs +1 -1
- package/dist/marker.mjs +5 -5
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.mjs +133 -2
- package/dist/message-scroller.cjs +1 -1
- package/dist/message-scroller.mjs +59 -2
- package/dist/message.cjs +1 -1
- package/dist/message.mjs +2 -3
- package/dist/native-select.cjs +1 -1
- package/dist/native-select.mjs +2 -3
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.mjs +79 -2
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.mjs +15 -16
- package/dist/popover.cjs +1 -1
- package/dist/popover.mjs +54 -2
- package/dist/progress.cjs +1 -1
- package/dist/progress.mjs +19 -2
- package/dist/questionnaire.cjs +1 -1
- package/dist/questionnaire.mjs +168 -2
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.mjs +25 -2
- package/dist/resizable.cjs +1 -1
- package/dist/resizable.mjs +26 -2
- package/dist/rolldown-runtime-BocRIvOZ.js +1 -0
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.mjs +35 -2
- package/dist/scroll-to-top.cjs +1 -1
- package/dist/scroll-to-top.mjs +6 -11
- package/dist/search.cjs +1 -1
- package/dist/search.mjs +12 -13
- package/dist/select.cjs +1 -1
- package/dist/select.mjs +98 -2
- package/dist/separator.cjs +1 -1
- package/dist/separator.mjs +15 -2
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.mjs +39 -40
- package/dist/{sidebar-DM9ee9wf.mjs → sidebar-DrU3nKaL.mjs} +137 -135
- package/dist/sidebar-uOtFHnBs.js +1 -0
- package/dist/sidebar.cjs +1 -1
- package/dist/sidebar.mjs +3 -2
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.mjs +2 -3
- package/dist/slider.cjs +1 -1
- package/dist/slider.mjs +34 -2
- package/dist/sonner.mjs +1 -2
- package/dist/spinner.cjs +1 -1
- package/dist/spinner.mjs +2 -3
- package/dist/support-fab.cjs +1 -1
- package/dist/support-fab.mjs +21 -22
- package/dist/switch.cjs +1 -1
- package/dist/switch.mjs +18 -2
- package/dist/table-of-contents.cjs +1 -1
- package/dist/table-of-contents.mjs +5 -6
- package/dist/table.cjs +1 -1
- package/dist/table.mjs +2 -3
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.mjs +44 -2
- package/dist/text.cjs +1 -1
- package/dist/text.mjs +14 -12
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.mjs +2 -3
- package/dist/theme-provider.mjs +1 -2
- package/dist/{theme-toggle-3RStptYf.mjs → theme-toggle-9KtAIRxy.mjs} +18 -20
- package/dist/theme-toggle-DkNI3bfh.js +1 -0
- package/dist/theme-toggle.cjs +1 -1
- package/dist/theme-toggle.mjs +2 -2
- package/dist/toast.cjs +1 -1
- package/dist/toast.mjs +52 -2
- package/dist/{toaster-gT2b7mfE.mjs → toaster-8RrHPtlc.mjs} +10 -12
- package/dist/toaster-AFud4l6l.js +1 -0
- package/dist/toaster.cjs +1 -1
- package/dist/toaster.mjs +2 -2
- package/dist/toggle-group.cjs +1 -1
- package/dist/toggle-group.mjs +49 -2
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.mjs +35 -2
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.mjs +34 -2
- package/dist/{utils-A_oVsYw5.mjs → utils-DQKc9joa.mjs} +1 -2
- package/package.json +3 -3
- package/dist/accordion-D5QXSsCK.mjs +0 -248
- package/dist/accordion-DjyDOX-h.js +0 -1
- package/dist/alert-dialog-B-a0Wa1M.mjs +0 -182
- package/dist/alert-dialog-DYQAhGBC.js +0 -1
- package/dist/aspect-ratio-C-KOOyGP.js +0 -1
- package/dist/aspect-ratio-s7Ji1MSr.mjs +0 -40
- package/dist/avatar-4K3XjhP8.js +0 -1
- package/dist/avatar-d8Di248f.mjs +0 -138
- package/dist/calendar-DFj14O6r.js +0 -1
- package/dist/calendar-UW8h9dfh.mjs +0 -3182
- package/dist/carousel-CNGpg5df.js +0 -1
- package/dist/carousel-DG9xGJns.mjs +0 -1171
- package/dist/checkbox-BCgbTAdU.js +0 -1
- package/dist/checkbox-Dq8VHKDH.mjs +0 -186
- package/dist/chunk-BmowowmI.mjs +0 -14
- package/dist/chunk-HBS6WEDP-CQNaACTf.js +0 -1
- package/dist/chunk-HBS6WEDP-aK8IuEX9.mjs +0 -63
- package/dist/chunk-mLOUI7ql.js +0 -1
- package/dist/combobox-CpPIGtPJ.js +0 -4
- package/dist/combobox-b4OmCNw1.mjs +0 -5887
- package/dist/command-5hobOyGG.mjs +0 -545
- package/dist/command-Dbqnm9kI.js +0 -1
- package/dist/context-menu-DyTUismw.js +0 -1
- package/dist/context-menu-DzzU-_v8.mjs +0 -317
- package/dist/dist-1zUKVGvf.js +0 -1
- package/dist/dist-B057I8ju.mjs +0 -30
- package/dist/dist-BB78QQyQ.mjs +0 -41
- package/dist/dist-BBvidwzC.js +0 -1
- package/dist/dist-BEbV0Hal.mjs +0 -45
- package/dist/dist-BPL7gUpg.mjs +0 -18
- package/dist/dist-BTUvBzOm.js +0 -1
- package/dist/dist-BU-TFzJf.js +0 -1
- package/dist/dist-Bb5W_J2F.mjs +0 -39
- package/dist/dist-BbI6NHqR.mjs +0 -23
- package/dist/dist-BexAB6yo.mjs +0 -192
- package/dist/dist-BgXIqHHq.js +0 -1
- package/dist/dist-Bvfb4y_L.mjs +0 -100
- package/dist/dist-C8Pm6LRc.js +0 -1
- package/dist/dist-CGgemr2V.js +0 -1
- package/dist/dist-CPAF050o.mjs +0 -90
- package/dist/dist-CS572Be42.mjs +0 -11
- package/dist/dist-CUvxOuXM.mjs +0 -551
- package/dist/dist-C_iFkwIX.js +0 -1
- package/dist/dist-ClYM7l1t.js +0 -1
- package/dist/dist-CpKLY_uZ.mjs +0 -96
- package/dist/dist-D1qkELLT.js +0 -1
- package/dist/dist-D7-Fky36.js +0 -1
- package/dist/dist-DEpkkABT.js +0 -1
- package/dist/dist-DI1vapnL.mjs +0 -20
- package/dist/dist-DJqkhIXb2.js +0 -1
- package/dist/dist-DKXojpVG.js +0 -1
- package/dist/dist-DYUvPCPC.js +0 -1
- package/dist/dist-DZiOPWLp.js +0 -1
- package/dist/dist-DatgTWLz.mjs +0 -202
- package/dist/dist-Dm3IQk5b.mjs +0 -685
- package/dist/dist-DoivLw3t.js +0 -1
- package/dist/dist-Dq-h6VAy.mjs +0 -118
- package/dist/dist-Dt6m-kwU.mjs +0 -221
- package/dist/dist-E8ieJTBC.mjs +0 -190
- package/dist/dist-GazS1kfR.mjs +0 -5
- package/dist/dist-N97cIp0_.js +0 -1
- package/dist/dist-OqDzLHTa.mjs +0 -460
- package/dist/dist-Qm9hFvM1.js +0 -1
- package/dist/dist-UkWa-Arh.mjs +0 -16
- package/dist/dist-UnTrOmPV.js +0 -1
- package/dist/dist-YAADIsyo.js +0 -1
- package/dist/dist-Zs2sjYhL.js +0 -1
- package/dist/dist-hFLuJoMi.js +0 -1
- package/dist/dist-s7ibhASj.mjs +0 -181
- package/dist/dist-vu20fMUK.mjs +0 -93
- package/dist/dropdown-menu-BqAhn64y.mjs +0 -313
- package/dist/dropdown-menu-BtKOr--r.js +0 -1
- package/dist/es2015-DbAsWDbs.js +0 -41
- package/dist/es2015-DbsmTzuc.mjs +0 -571
- package/dist/floating-ui.react-dom-BwFRxNGc.js +0 -1
- package/dist/floating-ui.react-dom-CyupHsR6.mjs +0 -1062
- package/dist/hover-card-DMsxpR9G.mjs +0 -178
- package/dist/hover-card-DWXusgiI.js +0 -1
- package/dist/input-otp-D49Y9VcH.mjs +0 -409
- package/dist/input-otp-u3obpt-Q.js +0 -20
- package/dist/label-Dacwh21G.js +0 -1
- package/dist/label-DsSICLPc.mjs +0 -28
- package/dist/menubar-BYNeRuzx.js +0 -1
- package/dist/menubar-DZqEj6S1.mjs +0 -407
- package/dist/message-scroller-CS4t7Ypn.mjs +0 -824
- package/dist/message-scroller-DqLu0YI6.js +0 -1
- package/dist/navigation-menu-B36G3O83.js +0 -1
- package/dist/navigation-menu-RO6thDOF.mjs +0 -636
- package/dist/popover-DSBkc70V.mjs +0 -243
- package/dist/popover-DUHbvKB8.js +0 -1
- package/dist/progress-B9z08UXf.js +0 -6
- package/dist/progress-CQ4nQ85t.mjs +0 -92
- package/dist/questionnaire-CVED7G7R.mjs +0 -1159
- package/dist/questionnaire-PWClWvST.js +0 -1
- package/dist/radio-group-Bd3WbH5I.js +0 -1
- package/dist/radio-group-TRiAhMZB.mjs +0 -266
- package/dist/resizable-Cq60hEWB.js +0 -1
- package/dist/resizable-Qc8cVUKd.mjs +0 -2857
- package/dist/scroll-area-D6MiNHnJ.mjs +0 -564
- package/dist/scroll-area-DFUdJeSZ.js +0 -1
- package/dist/select-BFJUmjvX.mjs +0 -830
- package/dist/select-iQFoKU1s.js +0 -1
- package/dist/separator-2kr96SyF.mjs +0 -40
- package/dist/separator-Bo49G2aj.js +0 -1
- package/dist/sidebar-C6O8hLkz.js +0 -1
- package/dist/slider-CagVxozY.js +0 -1
- package/dist/slider-CdTCoQu1.mjs +0 -485
- package/dist/switch-CoeAC1Wk.js +0 -1
- package/dist/switch-zUBdj7jK.mjs +0 -174
- package/dist/tabs-DaE9pEbo.mjs +0 -160
- package/dist/tabs-TMhXe20x.js +0 -1
- package/dist/theme-toggle-DKh8WFLT.js +0 -1
- package/dist/toast-B0S3F09s.js +0 -1
- package/dist/toast-D0Yb-K84.mjs +0 -445
- package/dist/toaster-CX9im8R_.js +0 -1
- package/dist/toggle-B0hXPsi7.js +0 -1
- package/dist/toggle-BAeKd2N0.mjs +0 -59
- package/dist/toggle-group-CEKhUozD.mjs +0 -167
- package/dist/toggle-group-htyug3G7.js +0 -1
- package/dist/tooltip-BZazhXDZ.js +0 -1
- package/dist/tooltip-R_nK_Qh5.mjs +0 -390
|
@@ -1,824 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./dist-Dm3IQk5b.mjs";
|
|
2
|
-
import { Button as t } from "./button.mjs";
|
|
3
|
-
import { n, r, t as i } from "./chunk-HBS6WEDP-aK8IuEX9.mjs";
|
|
4
|
-
import { ArrowDownIcon as a } from "lucide-react";
|
|
5
|
-
import * as o from "react";
|
|
6
|
-
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
-
//#region ../../node_modules/.bun/@shadcn+react@0.3.1+c841d34b494ec30a/node_modules/@shadcn/react/dist/message-scroller/index.js
|
|
8
|
-
var u = 8, d = 64, f = 0, p = .5, m = 180, h = new Set([
|
|
9
|
-
"ArrowDown",
|
|
10
|
-
"ArrowUp",
|
|
11
|
-
"End",
|
|
12
|
-
"Home",
|
|
13
|
-
"PageDown",
|
|
14
|
-
"PageUp",
|
|
15
|
-
" "
|
|
16
|
-
]), g = {
|
|
17
|
-
start: !1,
|
|
18
|
-
end: !1
|
|
19
|
-
}, _ = {
|
|
20
|
-
currentAnchorId: null,
|
|
21
|
-
visibleMessageIds: []
|
|
22
|
-
};
|
|
23
|
-
function v({ content: e, scrollEdgeThreshold: t, spacer: n, viewport: r }) {
|
|
24
|
-
if (!r || !e) return g;
|
|
25
|
-
let i = k({
|
|
26
|
-
content: e,
|
|
27
|
-
spacer: n,
|
|
28
|
-
viewport: r
|
|
29
|
-
});
|
|
30
|
-
return {
|
|
31
|
-
start: r.scrollTop > t,
|
|
32
|
-
end: i - r.scrollTop - r.clientHeight > t
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function y({ content: e, scrollMargin: t, scrollPreviousItemPeek: n, spacer: r, viewport: i, visibleMessageIds: a }) {
|
|
36
|
-
if (!e || !i) return _;
|
|
37
|
-
let o = i.getBoundingClientRect(), s = o.top + t + n, c = typeof IntersectionObserver > "u", l = [], u = null;
|
|
38
|
-
for (let t of b(e, r)) {
|
|
39
|
-
let e = t.dataset.messageId;
|
|
40
|
-
if (!e) continue;
|
|
41
|
-
let n = t.dataset.scrollAnchor === "true", r = n || c ? t.getBoundingClientRect() : null;
|
|
42
|
-
(c && r ? r.bottom > s && r.top < o.bottom : a.has(e)) && l.push(e), n && r && r.top <= s + p && (u = e);
|
|
43
|
-
}
|
|
44
|
-
return l.length === 0 && u === null ? _ : {
|
|
45
|
-
currentAnchorId: u,
|
|
46
|
-
visibleMessageIds: l
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function b(e, t) {
|
|
50
|
-
return Array.from(e.children).filter((e) => e instanceof HTMLElement && e !== t);
|
|
51
|
-
}
|
|
52
|
-
function x(e, t) {
|
|
53
|
-
for (let n = t; n < e.length; n++) {
|
|
54
|
-
let t = e[n];
|
|
55
|
-
if (t?.dataset.scrollAnchor === "true") return t;
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
function S(e, t) {
|
|
60
|
-
for (let n of e) if (n.dataset.scrollAnchor === "true" && !t.has(n)) return n;
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
function C(e, t) {
|
|
64
|
-
let n = 0;
|
|
65
|
-
for (let r = t; r < e.length; r++) if (e[r]?.dataset.scrollAnchor === "true" && (n += 1, n > 1)) return !0;
|
|
66
|
-
return !1;
|
|
67
|
-
}
|
|
68
|
-
function w(e) {
|
|
69
|
-
for (let t = e.length - 1; t >= 0; t--) {
|
|
70
|
-
let n = e[t];
|
|
71
|
-
if (n?.dataset.scrollAnchor === "true") return n;
|
|
72
|
-
}
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
function T({ content: e, spacer: t, viewport: n }) {
|
|
76
|
-
let r = n.getBoundingClientRect();
|
|
77
|
-
for (let n of b(e, t)) {
|
|
78
|
-
if (!n.dataset.messageId) continue;
|
|
79
|
-
let e = n.getBoundingClientRect();
|
|
80
|
-
if (e.bottom > r.top && e.top < r.bottom) return n;
|
|
81
|
-
}
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
84
|
-
function E({ align: e, element: t, scrollMargin: n, spacer: r, viewport: i }) {
|
|
85
|
-
let a = ee(t, i), o = t.getBoundingClientRect().height, s = j(r);
|
|
86
|
-
if (e === "center") {
|
|
87
|
-
let e = Math.max(0, i.clientHeight - s.start - s.end);
|
|
88
|
-
return a - s.start - (e - o) / 2 - n;
|
|
89
|
-
}
|
|
90
|
-
if (e === "end") return a - i.clientHeight + o + s.end + n;
|
|
91
|
-
if (e === "nearest") {
|
|
92
|
-
let e = a + o, t = i.scrollTop + s.start, r = i.scrollTop + i.clientHeight - s.end;
|
|
93
|
-
return a >= t && e <= r ? i.scrollTop : a < t ? a - s.start - n : e - i.clientHeight + s.end + n;
|
|
94
|
-
}
|
|
95
|
-
return a - s.start - n;
|
|
96
|
-
}
|
|
97
|
-
function ee(e, t) {
|
|
98
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
99
|
-
return n.top - r.top + t.scrollTop;
|
|
100
|
-
}
|
|
101
|
-
function D(e, t) {
|
|
102
|
-
return e.getBoundingClientRect().top - t.getBoundingClientRect().top;
|
|
103
|
-
}
|
|
104
|
-
function O({ content: e, scrollTop: t, spacer: n, viewport: r }) {
|
|
105
|
-
let i = k({
|
|
106
|
-
content: e,
|
|
107
|
-
spacer: n,
|
|
108
|
-
viewport: r
|
|
109
|
-
});
|
|
110
|
-
return t + r.clientHeight - i;
|
|
111
|
-
}
|
|
112
|
-
function k({ content: e, spacer: t, viewport: n }) {
|
|
113
|
-
let r = b(e, t), i = A(e), a = n.getBoundingClientRect(), o = n.scrollTop, s = i.start + i.end;
|
|
114
|
-
for (let e of r) {
|
|
115
|
-
let t = e.getBoundingClientRect();
|
|
116
|
-
s = Math.max(s, t.bottom - a.top + o + i.end);
|
|
117
|
-
}
|
|
118
|
-
return s;
|
|
119
|
-
}
|
|
120
|
-
function te(e) {
|
|
121
|
-
return Math.max(0, e.scrollHeight - e.clientHeight);
|
|
122
|
-
}
|
|
123
|
-
function A(e) {
|
|
124
|
-
let t = window.getComputedStyle(e);
|
|
125
|
-
return {
|
|
126
|
-
end: M(t.paddingBlockEnd || t.paddingBottom),
|
|
127
|
-
start: M(t.paddingBlockStart || t.paddingTop)
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
function j(e) {
|
|
131
|
-
let t = e?.parentElement;
|
|
132
|
-
return t ? A(t) : {
|
|
133
|
-
end: 0,
|
|
134
|
-
start: 0
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function ne(e) {
|
|
138
|
-
if (!e) return 0;
|
|
139
|
-
let t = window.getComputedStyle(e);
|
|
140
|
-
return M(t.rowGap === "normal" ? t.gap : t.rowGap);
|
|
141
|
-
}
|
|
142
|
-
function M(e) {
|
|
143
|
-
if (!e) return 0;
|
|
144
|
-
let t = Number.parseFloat(e);
|
|
145
|
-
return Number.isFinite(t) ? t : 0;
|
|
146
|
-
}
|
|
147
|
-
function re(e, t) {
|
|
148
|
-
let n = e, r = /* @__PURE__ */ new Set();
|
|
149
|
-
return {
|
|
150
|
-
getSnapshot: () => n,
|
|
151
|
-
hasListeners: () => r.size > 0,
|
|
152
|
-
setSnapshot: (e) => {
|
|
153
|
-
t(n, e) || (n = e, r.forEach((e) => e()));
|
|
154
|
-
},
|
|
155
|
-
subscribe: (e, t, n) => {
|
|
156
|
-
let i = r.size === 0;
|
|
157
|
-
return r.add(e), i && t?.(), () => {
|
|
158
|
-
r.delete(e), r.size === 0 && n?.();
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function N(e, t) {
|
|
164
|
-
return re(e, t);
|
|
165
|
-
}
|
|
166
|
-
function ie() {
|
|
167
|
-
return re(_, oe);
|
|
168
|
-
}
|
|
169
|
-
function ae(e, t) {
|
|
170
|
-
return e.start === t.start && e.end === t.end;
|
|
171
|
-
}
|
|
172
|
-
function oe(e, t) {
|
|
173
|
-
return e.currentAnchorId !== t.currentAnchorId || e.visibleMessageIds.length !== t.visibleMessageIds.length ? !1 : e.visibleMessageIds.every((e, n) => e === t.visibleMessageIds[n]);
|
|
174
|
-
}
|
|
175
|
-
function se({ autoScroll: e, defaultScrollPosition: t, scrollEdgeThreshold: n, scrollMargin: r, scrollPreviousItemPeek: i }) {
|
|
176
|
-
let a = o.useRef(e), s = o.useRef(!1), c = o.useRef(null), l = o.useRef(!1), u = o.useRef(n), d = o.useRef(0), f = o.useRef(null), p = o.useRef(0), m = o.useRef(e ? "following-bottom" : "free-scrolling"), h = o.useRef(/* @__PURE__ */ new Map()), _ = o.useRef(null), v = o.useRef(null), y = o.useRef(null), b = o.useRef(i), x = o.useRef(!0), S = o.useRef(null), C = o.useRef(r), w = o.useRef(null), T = o.useRef(0), E = o.useRef(0), ee = o.useRef(null), D = o.useRef(null), O = o.useRef(null), k = o.useRef(null), te = o.useRef(null), A = o.useRef(null), j = o.useRef(null), ne = o.useRef(null), M = o.useRef(null), re = o.useRef(/* @__PURE__ */ new Set()), oe = o.useRef(/* @__PURE__ */ new WeakSet());
|
|
177
|
-
return O.current === null && (O.current = N(t === "end" || t === "last-anchor", (e, t) => e === t)), k.current === null && (k.current = N(g, ae)), M.current === null && (M.current = ie()), a.current = e, u.current = n, C.current = r, b.current = i, {
|
|
178
|
-
autoScrollRef: a,
|
|
179
|
-
autoscrollingRef: s,
|
|
180
|
-
autoscrollingTimeoutRef: te,
|
|
181
|
-
streamingTurnRef: y,
|
|
182
|
-
contentRef: c,
|
|
183
|
-
defaultScrollPositionAppliedRef: l,
|
|
184
|
-
firstItemRef: f,
|
|
185
|
-
itemCountRef: d,
|
|
186
|
-
lastScrollTopRef: p,
|
|
187
|
-
messageElementsRef: h,
|
|
188
|
-
modeRef: m,
|
|
189
|
-
pendingScrollFrameRef: w,
|
|
190
|
-
pendingScrollToMessageRef: _,
|
|
191
|
-
prependRestoreRef: v,
|
|
192
|
-
preserveScrollOnPrependRef: x,
|
|
193
|
-
pendingDefaultScrollStore: O.current,
|
|
194
|
-
rootRef: S,
|
|
195
|
-
scrollEdgeThresholdRef: u,
|
|
196
|
-
scrollMarginRef: C,
|
|
197
|
-
scrollPreviousItemPeekRef: b,
|
|
198
|
-
spacerGapRef: T,
|
|
199
|
-
spacerHeightRef: E,
|
|
200
|
-
spacerRef: ee,
|
|
201
|
-
stateFrameRef: D,
|
|
202
|
-
stateStore: k.current,
|
|
203
|
-
viewportRef: A,
|
|
204
|
-
visibilityFrameRef: j,
|
|
205
|
-
visibilityObserverRef: ne,
|
|
206
|
-
visibilityStore: M.current,
|
|
207
|
-
visibleMessageIdsRef: re,
|
|
208
|
-
handledScrollAnchorsRef: oe
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function ce(e) {
|
|
212
|
-
e.pendingDefaultScrollStore.setSnapshot(!1);
|
|
213
|
-
}
|
|
214
|
-
function le(e) {
|
|
215
|
-
e.defaultScrollPositionAppliedRef.current = !0, ce(e);
|
|
216
|
-
}
|
|
217
|
-
function ue({ refs: e, commitScrollState: t, scheduleStateCommit: n, scheduleVisibilitySync: r }) {
|
|
218
|
-
let { streamingTurnRef: i, autoScrollRef: a, autoscrollingRef: s, autoscrollingTimeoutRef: c, contentRef: l, itemCountRef: u, messageElementsRef: d, modeRef: f, pendingScrollToMessageRef: h, prependRestoreRef: g, scrollMarginRef: _, scrollPreviousItemPeekRef: v, spacerGapRef: y, spacerHeightRef: b, spacerRef: x, viewportRef: S } = e, C = o.useCallback((e) => {
|
|
219
|
-
c.current !== null && (window.clearTimeout(c.current), c.current = null), s.current !== e && (s.current = e, t()), e && (c.current = window.setTimeout(() => {
|
|
220
|
-
c.current = null, s.current = !1, t();
|
|
221
|
-
}, m));
|
|
222
|
-
}, [t]), w = o.useCallback((e) => {
|
|
223
|
-
let t = x.current;
|
|
224
|
-
if (!t) return;
|
|
225
|
-
let n = Math.max(0, Math.ceil(e));
|
|
226
|
-
b.current !== n && (b.current = n, t.hidden = n === 0, t.style.height = `${n}px`, t.style.marginTop = n > 0 ? `${-y.current}px` : "");
|
|
227
|
-
}, []), T = o.useCallback((e, { behavior: r = "auto", autoscrolling: i = !1 } = {}) => {
|
|
228
|
-
let a = S.current;
|
|
229
|
-
if (!a) return;
|
|
230
|
-
let o = Math.max(0, e);
|
|
231
|
-
if (Math.abs(a.scrollTop - o) <= p) {
|
|
232
|
-
a.scrollTop = o, t();
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
i && C(!0), a.scrollTo({
|
|
236
|
-
top: o,
|
|
237
|
-
behavior: r
|
|
238
|
-
}), n();
|
|
239
|
-
}, [
|
|
240
|
-
t,
|
|
241
|
-
n,
|
|
242
|
-
C
|
|
243
|
-
]), ee = o.useCallback(({ behavior: e = "auto" } = {}) => S.current ? (w(0), i.current = null, f.current = "free-scrolling", T(0, { behavior: e }), r(), !0) : !1, [
|
|
244
|
-
r,
|
|
245
|
-
T,
|
|
246
|
-
w
|
|
247
|
-
]), k = o.useCallback(({ behavior: e = "auto" } = {}) => {
|
|
248
|
-
let t = S.current;
|
|
249
|
-
return t ? (w(0), i.current = null, f.current = a.current ? "following-bottom" : "free-scrolling", T(te(t), {
|
|
250
|
-
autoscrolling: !0,
|
|
251
|
-
behavior: e
|
|
252
|
-
}), r(), !0) : !1;
|
|
253
|
-
}, [
|
|
254
|
-
r,
|
|
255
|
-
T,
|
|
256
|
-
w
|
|
257
|
-
]), A = o.useCallback((e, { align: t = "start", behavior: n = "auto", scrollMargin: a = _.current } = {}, { keepPreviousPeek: o = !1 } = {}) => {
|
|
258
|
-
let s = l.current, c = S.current;
|
|
259
|
-
if (!s || !c || !s.contains(e)) return !1;
|
|
260
|
-
let u = E({
|
|
261
|
-
align: t,
|
|
262
|
-
element: e,
|
|
263
|
-
scrollMargin: o ? a + v.current : a,
|
|
264
|
-
spacer: x.current,
|
|
265
|
-
viewport: c
|
|
266
|
-
});
|
|
267
|
-
return w(O({
|
|
268
|
-
content: s,
|
|
269
|
-
scrollTop: u,
|
|
270
|
-
spacer: x.current,
|
|
271
|
-
viewport: c
|
|
272
|
-
})), g.current = {
|
|
273
|
-
element: e,
|
|
274
|
-
viewportTop: D(e, c)
|
|
275
|
-
}, f.current = o ? "anchored-to-message" : "settling-jump", i.current = o ? e : null, T(u, { behavior: n }), r(), !0;
|
|
276
|
-
}, [
|
|
277
|
-
r,
|
|
278
|
-
T,
|
|
279
|
-
w
|
|
280
|
-
]), j = o.useCallback(() => {
|
|
281
|
-
let e = i.current;
|
|
282
|
-
return !e || !e.isConnected || f.current !== "anchored-to-message" ? !1 : A(e, { align: "start" }, { keepPreviousPeek: !0 });
|
|
283
|
-
}, [A]), ne = o.useCallback((t, n) => {
|
|
284
|
-
let r = d.current.get(t);
|
|
285
|
-
return r ? (le(e), A(r, n) ? (h.current = null, !0) : (h.current = {
|
|
286
|
-
messageId: t,
|
|
287
|
-
options: n
|
|
288
|
-
}, !0)) : u.current === 0 ? (h.current = {
|
|
289
|
-
messageId: t,
|
|
290
|
-
options: n
|
|
291
|
-
}, le(e), !0) : !1;
|
|
292
|
-
}, [A]);
|
|
293
|
-
return {
|
|
294
|
-
flushPendingScrollToMessage: o.useCallback(() => {
|
|
295
|
-
let t = h.current;
|
|
296
|
-
if (!t) return !1;
|
|
297
|
-
let n = d.current.get(t.messageId);
|
|
298
|
-
return !n || !A(n, t.options) ? !1 : (h.current = null, le(e), !0);
|
|
299
|
-
}, [A]),
|
|
300
|
-
reanchorToAnchoredMessage: j,
|
|
301
|
-
scrollToElement: A,
|
|
302
|
-
scrollToEnd: k,
|
|
303
|
-
scrollToMessage: ne,
|
|
304
|
-
scrollToStart: ee
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
function de(e, t) {
|
|
308
|
-
return o.useCallback((n) => {
|
|
309
|
-
e.current = n, n && t();
|
|
310
|
-
}, [e, t]);
|
|
311
|
-
}
|
|
312
|
-
function fe({ autoScroll: e = !1, defaultScrollPosition: t = "end", scrollEdgeThreshold: n = u, scrollPreviousItemPeek: r = d, scrollMargin: i = f }) {
|
|
313
|
-
let a = se({
|
|
314
|
-
autoScroll: e,
|
|
315
|
-
defaultScrollPosition: t,
|
|
316
|
-
scrollEdgeThreshold: n,
|
|
317
|
-
scrollMargin: i,
|
|
318
|
-
scrollPreviousItemPeek: r
|
|
319
|
-
}), { streamingTurnRef: s, autoScrollRef: c, autoscrollingRef: l, autoscrollingTimeoutRef: m, contentRef: h, defaultScrollPositionAppliedRef: g, firstItemRef: E, itemCountRef: O, lastScrollTopRef: te, messageElementsRef: A, modeRef: j, pendingScrollFrameRef: M, pendingScrollToMessageRef: re, prependRestoreRef: N, preserveScrollOnPrependRef: ie, pendingDefaultScrollStore: ae, rootRef: oe, scrollEdgeThresholdRef: fe, scrollMarginRef: pe, scrollPreviousItemPeekRef: P, spacerGapRef: me, spacerHeightRef: F, spacerRef: I, stateFrameRef: L, stateStore: R, viewportRef: z, visibilityFrameRef: B, visibilityObserverRef: V, visibilityStore: H, visibleMessageIdsRef: U, handledScrollAnchorsRef: he } = a, ge = o.useRef(t);
|
|
320
|
-
ge.current !== t && (ge.current = t, g.current = !1);
|
|
321
|
-
let W = o.useCallback((e) => {
|
|
322
|
-
let t = oe.current, n = z.current, r = [e.start && "start", e.end && "end"].filter(Boolean).join(" "), i = l.current;
|
|
323
|
-
for (let e of [t, n]) e && (r ? e.setAttribute("data-scrollable", r) : e.removeAttribute("data-scrollable"), e.toggleAttribute("data-autoscrolling", i));
|
|
324
|
-
}, []), G = o.useCallback((e) => {
|
|
325
|
-
let t = z.current?.scrollTop ?? 0, n = t < te.current - p;
|
|
326
|
-
te.current = t, c.current && !e.end && j.current !== "settling-jump" && j.current !== "anchored-to-message" ? j.current = "following-bottom" : j.current === "following-bottom" && e.end && n && !l.current && (j.current = "free-scrolling");
|
|
327
|
-
}, []), K = o.useCallback(() => {
|
|
328
|
-
let e = v({
|
|
329
|
-
content: h.current,
|
|
330
|
-
scrollEdgeThreshold: fe.current,
|
|
331
|
-
spacer: I.current,
|
|
332
|
-
viewport: z.current
|
|
333
|
-
});
|
|
334
|
-
G(e);
|
|
335
|
-
let t = j.current === "following-bottom" ? {
|
|
336
|
-
...e,
|
|
337
|
-
end: !1
|
|
338
|
-
} : e;
|
|
339
|
-
W(t), R.setSnapshot(t);
|
|
340
|
-
}, [
|
|
341
|
-
G,
|
|
342
|
-
R,
|
|
343
|
-
W
|
|
344
|
-
]), q = o.useCallback(() => {
|
|
345
|
-
L.current === null && (L.current = window.requestAnimationFrame(() => {
|
|
346
|
-
L.current = null, K();
|
|
347
|
-
}));
|
|
348
|
-
}, [K]), J = o.useCallback(() => {
|
|
349
|
-
H.hasListeners() && B.current === null && (B.current = window.requestAnimationFrame(() => {
|
|
350
|
-
B.current = null, H.hasListeners() && H.setSnapshot(y({
|
|
351
|
-
content: h.current,
|
|
352
|
-
scrollMargin: pe.current,
|
|
353
|
-
scrollPreviousItemPeek: P.current,
|
|
354
|
-
spacer: I.current,
|
|
355
|
-
viewport: z.current,
|
|
356
|
-
visibleMessageIds: U.current
|
|
357
|
-
}));
|
|
358
|
-
}));
|
|
359
|
-
}, [H]), { flushPendingScrollToMessage: Y, reanchorToAnchoredMessage: _e, scrollToElement: X, scrollToEnd: Z, scrollToMessage: ve, scrollToStart: ye } = ue({
|
|
360
|
-
refs: a,
|
|
361
|
-
commitScrollState: K,
|
|
362
|
-
scheduleStateCommit: q,
|
|
363
|
-
scheduleVisibilitySync: J
|
|
364
|
-
}), be = o.useCallback(() => {
|
|
365
|
-
let e = N.current, t = z.current;
|
|
366
|
-
if (!e || !t || !e.element.isConnected) return !1;
|
|
367
|
-
let n = D(e.element, t) - e.viewportTop;
|
|
368
|
-
return Math.abs(n) <= p ? !1 : (t.scrollTop += n, e.viewportTop = D(e.element, t), q(), J(), !0);
|
|
369
|
-
}, [q, J]), Q = o.useCallback(() => {
|
|
370
|
-
let e = h.current, t = z.current;
|
|
371
|
-
if (!e || !t) {
|
|
372
|
-
N.current = null;
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
let n = T({
|
|
376
|
-
content: e,
|
|
377
|
-
spacer: I.current,
|
|
378
|
-
viewport: t
|
|
379
|
-
});
|
|
380
|
-
N.current = n ? {
|
|
381
|
-
element: n,
|
|
382
|
-
viewportTop: D(n, t)
|
|
383
|
-
} : null;
|
|
384
|
-
}, []), xe = o.useCallback(() => {
|
|
385
|
-
M.current === null && (M.current = window.requestAnimationFrame(() => {
|
|
386
|
-
M.current = null, Y() && Q();
|
|
387
|
-
}));
|
|
388
|
-
}, [Q, Y]), $ = o.useCallback(() => {
|
|
389
|
-
if (!t || g.current || O.current === 0) return !1;
|
|
390
|
-
let e = !1;
|
|
391
|
-
if (t === "last-anchor") {
|
|
392
|
-
let t = h.current, n = z.current, r = t && n ? w(b(t, I.current)) : null;
|
|
393
|
-
if (!t || !n || !r) e = Z({ behavior: "auto" });
|
|
394
|
-
else {
|
|
395
|
-
let i = ee(r, n);
|
|
396
|
-
e = k({
|
|
397
|
-
content: t,
|
|
398
|
-
spacer: I.current,
|
|
399
|
-
viewport: n
|
|
400
|
-
}) - i <= n.clientHeight ? Z({ behavior: "auto" }) : X(r, { align: "start" }, { keepPreviousPeek: !0 });
|
|
401
|
-
}
|
|
402
|
-
} else e = t === "end" ? Z({ behavior: "auto" }) : ye({ behavior: "auto" });
|
|
403
|
-
return e ? (le(a), !0) : !1;
|
|
404
|
-
}, [
|
|
405
|
-
t,
|
|
406
|
-
X,
|
|
407
|
-
Z,
|
|
408
|
-
ye
|
|
409
|
-
]), Se = o.useCallback(() => {
|
|
410
|
-
let e = h.current;
|
|
411
|
-
if (!e) return;
|
|
412
|
-
let t = b(e, I.current), n = O.current, r = E.current;
|
|
413
|
-
O.current = t.length, E.current = t[0] ?? null, (() => {
|
|
414
|
-
if (Y()) return;
|
|
415
|
-
if (n === 0) {
|
|
416
|
-
if ($() || t.length > 0 && c.current && Z({ behavior: "auto" })) return;
|
|
417
|
-
K(), J();
|
|
418
|
-
return;
|
|
419
|
-
}
|
|
420
|
-
let e = r ? t.indexOf(r) : -1;
|
|
421
|
-
if (ie.current && e > 0) {
|
|
422
|
-
be();
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
if (t.length > n) {
|
|
426
|
-
let e = x(t, n);
|
|
427
|
-
if (e) {
|
|
428
|
-
if (c.current && j.current === "following-bottom" && C(t, n)) {
|
|
429
|
-
Z({ behavior: "auto" });
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
X(e, { align: "start" }, { keepPreviousPeek: !0 }), he.current.add(e);
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
if (t.length === n) {
|
|
437
|
-
let e = S(t, he.current);
|
|
438
|
-
if (e) {
|
|
439
|
-
X(e, { align: "start" }, { keepPreviousPeek: !0 }), he.current.add(e);
|
|
440
|
-
return;
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
j.current === "following-bottom" && c.current ? Z({ behavior: "auto" }) : (K(), J());
|
|
444
|
-
})(), Q();
|
|
445
|
-
}, [
|
|
446
|
-
$,
|
|
447
|
-
Q,
|
|
448
|
-
K,
|
|
449
|
-
Y,
|
|
450
|
-
be,
|
|
451
|
-
J,
|
|
452
|
-
X,
|
|
453
|
-
Z
|
|
454
|
-
]), Ce = o.useCallback(() => {
|
|
455
|
-
if (j.current === "following-bottom" && c.current) {
|
|
456
|
-
Z({ behavior: "auto" });
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
let e = F.current;
|
|
460
|
-
if (_e()) {
|
|
461
|
-
c.current && e > 0 && F.current === 0 && Z({ behavior: "auto" });
|
|
462
|
-
return;
|
|
463
|
-
}
|
|
464
|
-
q(), J();
|
|
465
|
-
}, [
|
|
466
|
-
_e,
|
|
467
|
-
q,
|
|
468
|
-
J,
|
|
469
|
-
Z
|
|
470
|
-
]), we = o.useCallback(() => {
|
|
471
|
-
let e = z.current;
|
|
472
|
-
if (!(!e || !H.hasListeners())) {
|
|
473
|
-
if (typeof IntersectionObserver > "u") {
|
|
474
|
-
J();
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
V.current ||= new IntersectionObserver((e) => {
|
|
478
|
-
for (let t of e) {
|
|
479
|
-
let e = t.target.dataset.messageId;
|
|
480
|
-
e && (t.isIntersecting ? U.current.add(e) : U.current.delete(e));
|
|
481
|
-
}
|
|
482
|
-
J();
|
|
483
|
-
}, {
|
|
484
|
-
root: e,
|
|
485
|
-
rootMargin: `${-(pe.current + P.current)}px 0px 0px 0px`,
|
|
486
|
-
threshold: [
|
|
487
|
-
0,
|
|
488
|
-
.01,
|
|
489
|
-
.5,
|
|
490
|
-
1
|
|
491
|
-
]
|
|
492
|
-
}), A.current.forEach((e) => {
|
|
493
|
-
V.current?.observe(e);
|
|
494
|
-
}), J();
|
|
495
|
-
}
|
|
496
|
-
}, [J, H]), Te = o.useCallback(() => {
|
|
497
|
-
B.current !== null && (window.cancelAnimationFrame(B.current), B.current = null), V.current?.disconnect(), V.current = null, U.current.clear(), H.setSnapshot(_);
|
|
498
|
-
}, [H]), Ee = o.useCallback((e, t, n) => {
|
|
499
|
-
if (t) {
|
|
500
|
-
A.current.set(e, t), V.current?.observe(t), J(), re.current?.messageId === e && xe();
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
n && A.current.get(e) === n && (A.current.delete(e), U.current.delete(e), V.current?.unobserve(n), J());
|
|
504
|
-
}, [xe, J]), De = o.useCallback(() => {
|
|
505
|
-
(j.current === "following-bottom" || j.current === "anchored-to-message" || j.current === "settling-jump") && (s.current = null, j.current = "free-scrolling");
|
|
506
|
-
}, []), Oe = o.useCallback(() => W(R.getSnapshot()), [R, W]), ke = de(oe, Oe), Ae = de(z, Oe), je = o.useCallback((e) => {
|
|
507
|
-
h.current = e;
|
|
508
|
-
}, []), Me = o.useCallback((e) => {
|
|
509
|
-
I.current = e, me.current = ne(e?.parentElement ?? null);
|
|
510
|
-
}, []), Ne = o.useCallback(() => {
|
|
511
|
-
K(), J(), Q();
|
|
512
|
-
}, [
|
|
513
|
-
Q,
|
|
514
|
-
K,
|
|
515
|
-
J
|
|
516
|
-
]), Pe = o.useMemo(() => ({
|
|
517
|
-
handleContentChange: Se,
|
|
518
|
-
handleResize: Ce,
|
|
519
|
-
observeVisibility: we,
|
|
520
|
-
pendingDefaultScrollStore: ae,
|
|
521
|
-
preserveScrollOnPrependRef: ie,
|
|
522
|
-
scrollToEnd: Z,
|
|
523
|
-
scrollToMessage: ve,
|
|
524
|
-
scrollToStart: ye,
|
|
525
|
-
setContentElement: je,
|
|
526
|
-
setRootElement: ke,
|
|
527
|
-
setSpacerElement: Me,
|
|
528
|
-
setViewportElement: Ae,
|
|
529
|
-
stateStore: R,
|
|
530
|
-
syncAfterScroll: Ne,
|
|
531
|
-
unobserveVisibility: Te,
|
|
532
|
-
userScrollIntent: De,
|
|
533
|
-
viewportRef: z,
|
|
534
|
-
visibilityStore: H
|
|
535
|
-
}), [
|
|
536
|
-
Se,
|
|
537
|
-
Ce,
|
|
538
|
-
we,
|
|
539
|
-
ae,
|
|
540
|
-
Z,
|
|
541
|
-
ve,
|
|
542
|
-
ye,
|
|
543
|
-
je,
|
|
544
|
-
ke,
|
|
545
|
-
Me,
|
|
546
|
-
Ae,
|
|
547
|
-
R,
|
|
548
|
-
Ne,
|
|
549
|
-
Te,
|
|
550
|
-
De,
|
|
551
|
-
H
|
|
552
|
-
]);
|
|
553
|
-
return o.useLayoutEffect(() => {
|
|
554
|
-
$() || O.current === 0 && ce(a);
|
|
555
|
-
}, [$]), o.useEffect(() => () => {
|
|
556
|
-
L.current !== null && (window.cancelAnimationFrame(L.current), L.current = null), B.current !== null && (window.cancelAnimationFrame(B.current), B.current = null), m.current !== null && (window.clearTimeout(m.current), m.current = null), M.current !== null && (window.cancelAnimationFrame(M.current), M.current = null), V.current?.disconnect(), V.current = null;
|
|
557
|
-
}, []), o.useLayoutEffect(() => {
|
|
558
|
-
if (e && j.current === "following-bottom" && O.current > 0) {
|
|
559
|
-
Z({ behavior: "auto" });
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
562
|
-
K();
|
|
563
|
-
}, [
|
|
564
|
-
e,
|
|
565
|
-
K,
|
|
566
|
-
Z
|
|
567
|
-
]), {
|
|
568
|
-
context: Pe,
|
|
569
|
-
registerMessage: Ee
|
|
570
|
-
};
|
|
571
|
-
}
|
|
572
|
-
function pe(e) {
|
|
573
|
-
let t = o.useRef(e);
|
|
574
|
-
return t.current = e, t;
|
|
575
|
-
}
|
|
576
|
-
var P = o.createContext(null), me = o.createContext(null);
|
|
577
|
-
function F() {
|
|
578
|
-
let e = o.useContext(P);
|
|
579
|
-
if (!e) throw Error("useMessageScroller must be used within a MessageScroller.");
|
|
580
|
-
return e;
|
|
581
|
-
}
|
|
582
|
-
function I() {
|
|
583
|
-
let e = o.useContext(me);
|
|
584
|
-
if (!e) throw Error("MessageScrollerItem must be used within a MessageScroller.");
|
|
585
|
-
return e;
|
|
586
|
-
}
|
|
587
|
-
function L() {
|
|
588
|
-
let { scrollToEnd: e, scrollToMessage: t, scrollToStart: n } = F();
|
|
589
|
-
return o.useMemo(() => ({
|
|
590
|
-
scrollToEnd: e,
|
|
591
|
-
scrollToMessage: t,
|
|
592
|
-
scrollToStart: n
|
|
593
|
-
}), [
|
|
594
|
-
e,
|
|
595
|
-
t,
|
|
596
|
-
n
|
|
597
|
-
]);
|
|
598
|
-
}
|
|
599
|
-
function R() {
|
|
600
|
-
let { stateStore: e } = F();
|
|
601
|
-
return o.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getSnapshot);
|
|
602
|
-
}
|
|
603
|
-
function z() {
|
|
604
|
-
let { observeVisibility: e, unobserveVisibility: t, visibilityStore: n } = F(), r = o.useCallback((r) => n.subscribe(r, e, t), [
|
|
605
|
-
e,
|
|
606
|
-
t,
|
|
607
|
-
n
|
|
608
|
-
]);
|
|
609
|
-
return o.useSyncExternalStore(r, n.getSnapshot, n.getSnapshot);
|
|
610
|
-
}
|
|
611
|
-
function B({ autoScroll: e = !1, children: t, defaultScrollPosition: n = "end", scrollEdgeThreshold: r, scrollPreviousItemPeek: i, scrollMargin: a }) {
|
|
612
|
-
let { context: o, registerMessage: s } = fe({
|
|
613
|
-
autoScroll: e,
|
|
614
|
-
defaultScrollPosition: n,
|
|
615
|
-
scrollEdgeThreshold: r,
|
|
616
|
-
scrollPreviousItemPeek: i,
|
|
617
|
-
scrollMargin: a
|
|
618
|
-
});
|
|
619
|
-
return c(P.Provider, {
|
|
620
|
-
value: o,
|
|
621
|
-
children: c(me.Provider, {
|
|
622
|
-
value: s,
|
|
623
|
-
children: t
|
|
624
|
-
})
|
|
625
|
-
});
|
|
626
|
-
}
|
|
627
|
-
function V() {
|
|
628
|
-
let { pendingDefaultScrollStore: e } = F();
|
|
629
|
-
return o.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getSnapshot);
|
|
630
|
-
}
|
|
631
|
-
function H({ children: e, ...t }) {
|
|
632
|
-
let { setRootElement: n } = F(), r = V();
|
|
633
|
-
return c("div", {
|
|
634
|
-
ref: n,
|
|
635
|
-
...t,
|
|
636
|
-
...r ? { "data-pending-scroll": "" } : null,
|
|
637
|
-
children: e
|
|
638
|
-
});
|
|
639
|
-
}
|
|
640
|
-
function U({ "aria-label": e, children: t, onKeyDown: n, onScroll: i, onTouchMove: a, onWheel: s, preserveScrollOnPrepend: l = !0, ref: u, role: d, tabIndex: f, ...p }) {
|
|
641
|
-
let { handleResize: m, preserveScrollOnPrependRef: g, setViewportElement: _, syncAfterScroll: v, userScrollIntent: y, viewportRef: b } = F(), x = V();
|
|
642
|
-
g.current = l;
|
|
643
|
-
let S = o.useCallback((e) => {
|
|
644
|
-
_(e), r(u)?.(e);
|
|
645
|
-
}, [u, _]);
|
|
646
|
-
function C(e) {
|
|
647
|
-
v(), i?.(e);
|
|
648
|
-
}
|
|
649
|
-
function w(e) {
|
|
650
|
-
y(), s?.(e);
|
|
651
|
-
}
|
|
652
|
-
function T(e) {
|
|
653
|
-
y(), a?.(e);
|
|
654
|
-
}
|
|
655
|
-
function E(e) {
|
|
656
|
-
h.has(e.key) && y(), n?.(e);
|
|
657
|
-
}
|
|
658
|
-
return o.useEffect(() => {
|
|
659
|
-
let e = b.current;
|
|
660
|
-
if (!e || typeof ResizeObserver > "u") return;
|
|
661
|
-
let t = 0, n = new ResizeObserver(() => {
|
|
662
|
-
window.cancelAnimationFrame(t), t = window.requestAnimationFrame(m);
|
|
663
|
-
});
|
|
664
|
-
return n.observe(e), () => {
|
|
665
|
-
window.cancelAnimationFrame(t), n.disconnect();
|
|
666
|
-
};
|
|
667
|
-
}, [m, b]), c("div", {
|
|
668
|
-
ref: S,
|
|
669
|
-
role: d ?? "region",
|
|
670
|
-
"aria-label": e ?? "Messages",
|
|
671
|
-
tabIndex: f ?? 0,
|
|
672
|
-
onKeyDown: E,
|
|
673
|
-
onScroll: C,
|
|
674
|
-
onTouchMove: T,
|
|
675
|
-
onWheel: w,
|
|
676
|
-
...p,
|
|
677
|
-
...x ? { "data-pending-scroll": "" } : null,
|
|
678
|
-
children: t
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
function he({ "aria-relevant": e, children: t, ref: n, role: i, spacerClassName: a, ...s }) {
|
|
682
|
-
let { handleContentChange: u, handleResize: d, setContentElement: f, setSpacerElement: p } = F(), m = o.useRef(null), h = o.useCallback((e) => {
|
|
683
|
-
m.current = e, f(e), r(n)?.(e);
|
|
684
|
-
}, [n, f]);
|
|
685
|
-
return o.useLayoutEffect(() => {
|
|
686
|
-
let e = m.current;
|
|
687
|
-
if (!e || (u(), typeof MutationObserver > "u")) return;
|
|
688
|
-
let t = new MutationObserver(() => {
|
|
689
|
-
u();
|
|
690
|
-
});
|
|
691
|
-
return t.observe(e, { childList: !0 }), () => t.disconnect();
|
|
692
|
-
}, [u]), o.useEffect(() => {
|
|
693
|
-
let e = m.current;
|
|
694
|
-
if (!e || typeof ResizeObserver > "u") return;
|
|
695
|
-
let t = 0, n = new ResizeObserver(() => {
|
|
696
|
-
window.cancelAnimationFrame(t), t = window.requestAnimationFrame(d);
|
|
697
|
-
});
|
|
698
|
-
return n.observe(e), () => {
|
|
699
|
-
window.cancelAnimationFrame(t), n.disconnect();
|
|
700
|
-
};
|
|
701
|
-
}, [d]), l("div", {
|
|
702
|
-
ref: h,
|
|
703
|
-
role: i ?? "log",
|
|
704
|
-
"aria-relevant": e ?? "additions",
|
|
705
|
-
...s,
|
|
706
|
-
children: [t, c("div", {
|
|
707
|
-
ref: p,
|
|
708
|
-
"aria-hidden": "true",
|
|
709
|
-
"data-message-scroller-spacer": "",
|
|
710
|
-
hidden: !0,
|
|
711
|
-
className: a
|
|
712
|
-
})]
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
function ge({ messageId: e, ref: t, scrollAnchor: n = !1, ...i }) {
|
|
716
|
-
let a = I(), s = o.useRef(null);
|
|
717
|
-
return c("div", {
|
|
718
|
-
ref: o.useCallback((n) => {
|
|
719
|
-
let i = s.current;
|
|
720
|
-
s.current = n, e && a(e, n, i), r(t)?.(n);
|
|
721
|
-
}, [
|
|
722
|
-
e,
|
|
723
|
-
t,
|
|
724
|
-
a
|
|
725
|
-
]),
|
|
726
|
-
"data-message-id": e,
|
|
727
|
-
"data-scroll-anchor": n ? "true" : "false",
|
|
728
|
-
...i
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
function W({ behavior: e = "smooth", children: t, direction: r = "end", onClick: a, render: s, tabIndex: c, type: u = "button", ...d }) {
|
|
732
|
-
let { scrollToEnd: f, scrollToStart: p, stateStore: m } = F(), h = pe(a), g = o.useCallback((e) => m.subscribe(e), [m]), _ = o.useCallback(() => {
|
|
733
|
-
let e = m.getSnapshot();
|
|
734
|
-
return r === "start" ? e.start : e.end;
|
|
735
|
-
}, [r, m]), v = o.useSyncExternalStore(g, _, _), y = o.useCallback((t) => {
|
|
736
|
-
v && (h.current?.(t), t.defaultPrevented || (t.currentTarget.blur(), r === "start" ? p({ behavior: e }) : f({ behavior: e })));
|
|
737
|
-
}, [
|
|
738
|
-
e,
|
|
739
|
-
r,
|
|
740
|
-
v,
|
|
741
|
-
h,
|
|
742
|
-
f,
|
|
743
|
-
p
|
|
744
|
-
]);
|
|
745
|
-
return i({
|
|
746
|
-
defaultTagName: "button",
|
|
747
|
-
props: n({
|
|
748
|
-
type: u,
|
|
749
|
-
inert: !v,
|
|
750
|
-
tabIndex: v ? c : -1,
|
|
751
|
-
children: t ?? l("span", { children: ["Scroll to ", r] }),
|
|
752
|
-
onClick: y
|
|
753
|
-
}, d),
|
|
754
|
-
render: s,
|
|
755
|
-
state: {
|
|
756
|
-
active: v,
|
|
757
|
-
direction: r
|
|
758
|
-
},
|
|
759
|
-
stateAttributesMapping: { active: (e) => ({ "data-active": e ? "true" : "false" }) }
|
|
760
|
-
});
|
|
761
|
-
}
|
|
762
|
-
var G = {
|
|
763
|
-
Provider: B,
|
|
764
|
-
Root: H,
|
|
765
|
-
Viewport: U,
|
|
766
|
-
Content: he,
|
|
767
|
-
Item: ge,
|
|
768
|
-
Button: W
|
|
769
|
-
};
|
|
770
|
-
//#endregion
|
|
771
|
-
//#region src/message-scroller.tsx
|
|
772
|
-
function K(e) {
|
|
773
|
-
return /* @__PURE__ */ c(G.Provider, { ...e });
|
|
774
|
-
}
|
|
775
|
-
function q({ className: t, ...n }) {
|
|
776
|
-
return /* @__PURE__ */ c(G.Root, {
|
|
777
|
-
"data-slot": "message-scroller",
|
|
778
|
-
className: e("group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden", t),
|
|
779
|
-
...n
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
function J({ className: t, ...n }) {
|
|
783
|
-
return /* @__PURE__ */ c(G.Viewport, {
|
|
784
|
-
"data-slot": "message-scroller-viewport",
|
|
785
|
-
className: e("scroll-fade-b size-full min-h-0 min-w-0 scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent data-pending-scroll:invisible", t),
|
|
786
|
-
...n
|
|
787
|
-
});
|
|
788
|
-
}
|
|
789
|
-
function Y({ className: t, ...n }) {
|
|
790
|
-
return /* @__PURE__ */ c(G.Content, {
|
|
791
|
-
"data-slot": "message-scroller-content",
|
|
792
|
-
className: e("flex h-max min-h-full flex-col gap-6", t),
|
|
793
|
-
...n
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
function _e({ className: t, scrollAnchor: n = !1, ...r }) {
|
|
797
|
-
return /* @__PURE__ */ c(G.Item, {
|
|
798
|
-
"data-slot": "message-scroller-item",
|
|
799
|
-
scrollAnchor: n,
|
|
800
|
-
className: e("min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]", t),
|
|
801
|
-
...r
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
function X({ direction: n = "end", className: r, children: i, render: o, variant: u = "secondary", size: d = "icon-sm", ...f }) {
|
|
805
|
-
return /* @__PURE__ */ c(G.Button, {
|
|
806
|
-
"data-slot": "message-scroller-button",
|
|
807
|
-
"data-direction": n,
|
|
808
|
-
"data-variant": u,
|
|
809
|
-
"data-size": d,
|
|
810
|
-
direction: n,
|
|
811
|
-
className: e("border-border bg-background text-foreground hover:bg-muted hover:text-foreground absolute inset-s-1/2 -translate-x-1/2 transition-[translate,scale,opacity] duration-200 data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180", r),
|
|
812
|
-
render: o ?? /* @__PURE__ */ c(t, {
|
|
813
|
-
variant: u,
|
|
814
|
-
size: d
|
|
815
|
-
}),
|
|
816
|
-
...f,
|
|
817
|
-
children: i ?? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(a, {}), /* @__PURE__ */ c("span", {
|
|
818
|
-
className: "sr-only",
|
|
819
|
-
children: n === "end" ? "Scroll to end" : "Scroll to start"
|
|
820
|
-
})] })
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
//#endregion
|
|
824
|
-
export { K as a, L as c, _e as i, R as l, X as n, J as o, Y as r, z as s, q as t };
|