@overdoser/react-toolkit 0.20.0 → 0.22.0
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/AGENTS.md +2 -1
- package/CHANGELOG.md +41 -0
- package/components/Accordion/Accordion.js +160 -177
- package/components/Accordion/Accordion.module.scss.js +19 -35
- package/components/ActionButton/ActionButton.js +155 -209
- package/components/ActionButton/ActionButton.module.scss.js +24 -46
- package/components/ActionButton/CopyButton.js +52 -64
- package/components/Alert/Alert.js +93 -96
- package/components/Alert/Alert.module.scss.js +17 -32
- package/components/Avatar/Avatar.js +44 -55
- package/components/Avatar/Avatar.module.scss.js +22 -42
- package/components/Badge/Badge.js +15 -37
- package/components/Badge/Badge.module.scss.js +16 -30
- package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/components/Breadcrumbs/Breadcrumbs.js +52 -48
- package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
- package/components/Button/Button.js +35 -57
- package/components/Button/Button.module.scss.js +24 -46
- package/components/Card/Card.js +94 -131
- package/components/Card/Card.module.scss.js +34 -59
- package/components/Chart/AreaChart.d.ts +1 -1
- package/components/Chart/AreaChart.js +248 -249
- package/components/Chart/Axis.d.ts +2 -2
- package/components/Chart/Axis.js +34 -43
- package/components/Chart/BarChart.d.ts +1 -1
- package/components/Chart/BarChart.js +307 -348
- package/components/Chart/Chart.module.scss.js +31 -60
- package/components/Chart/ChartContainer.js +33 -41
- package/components/Chart/ChartLegend.d.ts +1 -1
- package/components/Chart/ChartLegend.js +31 -30
- package/components/Chart/ChartTooltip.d.ts +1 -1
- package/components/Chart/ChartTooltip.js +45 -40
- package/components/Chart/LineChart.d.ts +1 -1
- package/components/Chart/LineChart.js +220 -232
- package/components/Chart/PieChart.d.ts +1 -1
- package/components/Chart/PieChart.js +224 -240
- package/components/Chart/RadarChart.d.ts +1 -1
- package/components/Chart/RadarChart.js +166 -215
- package/components/Chart/Sparkline.js +73 -68
- package/components/Chart/TradingChart.d.ts +1 -1
- package/components/Chart/TradingChart.js +804 -701
- package/components/Chart/scales.js +28 -35
- package/components/Chart/trading/indicators.js +61 -62
- package/components/Chart/trading/period.js +46 -68
- package/components/Chart/useChartDimensions.js +30 -22
- package/components/Chip/Chip.js +98 -141
- package/components/Chip/Chip.module.scss.js +31 -58
- package/components/CodeBlock/CodeBlock.js +111 -119
- package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
- package/components/CommandPalette/CommandPalette.js +387 -392
- package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
- package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
- package/components/ConfirmDialog/ConfirmDialog.js +184 -199
- package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
- package/components/Divider/Divider.js +25 -36
- package/components/Divider/Divider.module.scss.js +16 -30
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +157 -164
- package/components/Draggable/Draggable.module.scss.js +9 -16
- package/components/Drawer/Drawer.js +104 -126
- package/components/Drawer/Drawer.module.scss.js +65 -118
- package/components/Dropdown/Dropdown.js +175 -234
- package/components/Dropdown/Dropdown.module.scss.js +28 -52
- package/components/Dropdown/DropdownItem.js +55 -58
- package/components/Dropdown/DropdownLabel.js +14 -11
- package/components/Dropdown/DropdownSeparator.js +13 -11
- package/components/Dropdown/dropdownContext.js +4 -5
- package/components/Dropdown/useContextMenu.js +27 -17
- package/components/Dropzone/Dropzone.js +99 -105
- package/components/Dropzone/Dropzone.module.scss.js +11 -20
- package/components/EmptyState/EmptyState.js +57 -54
- package/components/EmptyState/EmptyState.module.scss.js +13 -24
- package/components/Form/Form.d.ts +1 -1
- package/components/Form/Form.js +31 -34
- package/components/Form/Form.module.scss.js +15 -28
- package/components/Form/FormField.d.ts +1 -1
- package/components/Form/FormField.js +71 -75
- package/components/Form/FormRow.d.ts +1 -1
- package/components/Form/FormRow.js +11 -8
- package/components/Form/formFieldDefaults.js +4 -5
- package/components/ImageViewer/ImageViewer.js +312 -201
- package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
- package/components/ImageViewer/useZoomPan.js +206 -137
- package/components/Kbd/Kbd.js +24 -21
- package/components/Kbd/Kbd.module.scss.js +9 -16
- package/components/KeyValueList/KeyValueList.js +119 -123
- package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
- package/components/Link/Link.js +45 -59
- package/components/Link/Link.module.scss.js +9 -15
- package/components/List/List.js +22 -46
- package/components/List/List.module.scss.js +11 -20
- package/components/Loader/Loader.js +152 -182
- package/components/Loader/Loader.module.scss.js +39 -69
- package/components/Modal/Modal.js +93 -105
- package/components/Modal/Modal.module.scss.js +17 -32
- package/components/PageHeader/PageHeader.js +79 -73
- package/components/PageHeader/PageHeader.module.scss.js +22 -42
- package/components/Pagination/Pagination.js +62 -83
- package/components/Pagination/Pagination.module.scss.js +12 -22
- package/components/Pagination/paginationRange.js +15 -22
- package/components/Popover/Popover.js +110 -134
- package/components/Popover/Popover.module.scss.js +11 -20
- package/components/ProgressBar/ProgressBar.d.ts +15 -1
- package/components/ProgressBar/ProgressBar.js +56 -89
- package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
- package/components/RelativeTime/RelativeTime.js +36 -43
- package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
- package/components/SegmentedControl/SegmentedControl.js +93 -129
- package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
- package/components/Skeleton/Skeleton.js +36 -50
- package/components/Skeleton/Skeleton.module.scss.js +14 -24
- package/components/Spinner/Spinner.js +25 -25
- package/components/Spinner/Spinner.module.scss.js +11 -19
- package/components/SplitButton/SplitButton.js +149 -196
- package/components/SplitButton/SplitButton.module.scss.js +30 -56
- package/components/SplitPane/SplitPane.js +134 -170
- package/components/SplitPane/SplitPane.module.scss.js +13 -24
- package/components/StatCard/StatCard.js +132 -125
- package/components/StatCard/StatCard.module.scss.js +41 -71
- package/components/StatusDot/StatusDot.js +28 -39
- package/components/StatusDot/StatusDot.module.scss.js +17 -31
- package/components/Table/Table.d.ts +1 -1
- package/components/Table/Table.js +381 -451
- package/components/Table/Table.module.scss.js +41 -80
- package/components/Table/useTableSort.js +51 -42
- package/components/Tabs/Tabs.js +109 -161
- package/components/Tabs/Tabs.module.scss.js +27 -52
- package/components/ThemeToggle/ThemeToggle.js +122 -98
- package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
- package/components/Timeline/GanttTimeline.js +357 -318
- package/components/Timeline/GanttTimeline.module.scss.js +28 -54
- package/components/Timeline/HistoryTimeline.js +486 -450
- package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
- package/components/Timeline/Timeline.module.scss.js +75 -140
- package/components/Timeline/TimelineShared.d.ts +7 -7
- package/components/Timeline/TimelineShared.js +288 -279
- package/components/Timeline/TraceEventDetails.d.ts +3 -3
- package/components/Timeline/TraceEventDetails.js +244 -177
- package/components/Timeline/TraceTimeline.js +823 -783
- package/components/Timeline/TraceTimeline.module.scss.js +97 -188
- package/components/Timeline/historyLayout.js +336 -263
- package/components/Timeline/timelineCore.js +208 -183
- package/components/Timeline/traceEvent.js +59 -61
- package/components/Timeline/traceLayout.js +101 -90
- package/components/Timeline/useTimeline.js +76 -79
- package/components/Timer/Timer.js +190 -156
- package/components/Timer/Timer.module.scss.js +28 -54
- package/components/Toast/Toast.d.ts +1 -1
- package/components/Toast/Toast.js +128 -128
- package/components/Toast/Toast.module.scss.js +36 -61
- package/components/Toast/toastStore.js +58 -62
- package/components/ToggleIconButton/ToggleIconButton.js +36 -58
- package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
- package/components/Tooltip/Tooltip.d.ts +1 -1
- package/components/Tooltip/Tooltip.js +76 -85
- package/components/Tooltip/Tooltip.module.scss.js +16 -29
- package/components/Typography/Typography.js +10 -35
- package/components/Typography/Typography.module.scss.js +29 -52
- package/components/inputs/Checkbox/Checkbox.js +27 -51
- package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
- package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
- package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
- package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
- package/components/inputs/DatePicker/CalendarPanel.js +263 -286
- package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
- package/components/inputs/DatePicker/DatePicker.js +115 -142
- package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
- package/components/inputs/DatePicker/dateUtils.js +32 -41
- package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
- package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
- package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
- package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
- package/components/inputs/DateTimePicker/TimeField.js +131 -132
- package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
- package/components/inputs/Input/Input.js +98 -109
- package/components/inputs/Input/Input.module.scss.js +14 -26
- package/components/inputs/NumberInput/NumberInput.js +112 -132
- package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
- package/components/inputs/Radio/Radio.js +50 -73
- package/components/inputs/Radio/Radio.module.scss.js +8 -14
- package/components/inputs/SearchInput/SearchInput.js +98 -115
- package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
- package/components/inputs/Select/Select.d.ts +55 -3
- package/components/inputs/Select/Select.js +696 -682
- package/components/inputs/Select/Select.module.scss.js +49 -72
- package/components/inputs/Slider/Slider.js +97 -128
- package/components/inputs/Slider/Slider.module.scss.js +8 -14
- package/components/inputs/Switch/Switch.js +11 -8
- package/components/inputs/Textarea/Textarea.js +42 -58
- package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
- package/hooks/useClickOutside.js +17 -14
- package/hooks/useDebouncedValue.js +13 -14
- package/hooks/useElementSize.js +27 -22
- package/hooks/useEscapeLayer.js +28 -29
- package/hooks/useFocusTrap.js +27 -38
- package/hooks/useKeyboard.js +76 -64
- package/hooks/useMediaQuery.js +10 -15
- package/hooks/useNow.js +28 -33
- package/hooks/usePersistedState.js +98 -94
- package/hooks/usePortalPosition.d.ts +2 -1
- package/hooks/usePortalPosition.js +28 -19
- package/hooks/useResizable.js +106 -104
- package/hooks/useTheme.js +28 -23
- package/index.css +2 -1
- package/index.js +96 -214
- package/index.layered.css +2 -3
- package/llms.txt +28 -4
- package/manifest.json +41 -4
- package/package.json +1 -1
- package/utils/formatBytes.js +29 -13
- package/utils/themeScript.js +6 -8
- package/utils/timeAgo.js +59 -32
|
@@ -1,92 +1,103 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
1
|
+
function e(e, t = {}) {
|
|
2
|
+
let n = t.barH ?? 26, r = t.rowH ?? 66, i = t.chipH ?? 51, a = t.minH ?? 420, o = e.map((e) => ({
|
|
3
|
+
...e,
|
|
4
|
+
sub: 0,
|
|
5
|
+
row: -1,
|
|
6
|
+
labelX: e.left,
|
|
7
|
+
showLabel: !1,
|
|
8
|
+
barTop: 0,
|
|
9
|
+
labelTop: 0,
|
|
10
|
+
conn: !1,
|
|
11
|
+
connTop: 0,
|
|
12
|
+
connH: 0,
|
|
13
|
+
hconn: !1,
|
|
14
|
+
hconnLeft: 0,
|
|
15
|
+
hconnTop: 0,
|
|
16
|
+
hconnW: 0
|
|
17
|
+
})), s = o.slice().sort((e, t) => e.left - t.left || t.width - e.width), c = [];
|
|
18
|
+
s.forEach((e) => {
|
|
19
|
+
let t = 0;
|
|
20
|
+
for (; t < c.length && e.left < c[t] + 3;) t++;
|
|
21
|
+
e.sub = t, c[t] = e.left + e.width;
|
|
22
|
+
});
|
|
23
|
+
let l = Math.max(1, c.length), u = [
|
|
24
|
+
0,
|
|
25
|
+
4,
|
|
26
|
+
1,
|
|
27
|
+
5,
|
|
28
|
+
2,
|
|
29
|
+
6,
|
|
30
|
+
3,
|
|
31
|
+
7
|
|
32
|
+
], d = [], f = [], p = (e, t, n, r) => {
|
|
33
|
+
let i = e < 4, a = i ? e + 1 : e - 3;
|
|
34
|
+
for (let e of d) {
|
|
35
|
+
let t = e.row < 4;
|
|
36
|
+
if (t === i && (t ? e.row + 1 : e.row - 3) <= a && r >= e.x1 - 3 && r <= e.x2 + 3) return !0;
|
|
37
|
+
}
|
|
38
|
+
for (let e of f) {
|
|
39
|
+
let r = e.row < 4;
|
|
40
|
+
if (r === i && (r ? e.row + 1 : e.row - 3) >= a && e.x >= t - 3 && e.x <= n + 3) return !0;
|
|
41
|
+
}
|
|
42
|
+
return !1;
|
|
43
|
+
}, m = [
|
|
44
|
+
1e9,
|
|
45
|
+
1e9,
|
|
46
|
+
1e9,
|
|
47
|
+
1e9,
|
|
48
|
+
1e9,
|
|
49
|
+
1e9,
|
|
50
|
+
1e9,
|
|
51
|
+
1e9
|
|
52
|
+
];
|
|
53
|
+
s.slice().reverse().forEach((e) => {
|
|
54
|
+
let t = e.labelW;
|
|
55
|
+
e.row = -1, e.labelX = e.left;
|
|
56
|
+
for (let n of u) if (e.left + t <= m[n] - 14 && !p(n, e.left, e.left + t, e.left)) {
|
|
57
|
+
e.row = n, e.labelX = e.left;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
if (e.row < 0) for (let n of u) {
|
|
61
|
+
let r = Math.min(e.left, m[n] - 14 - t);
|
|
62
|
+
if (r >= e.left - 140 && !p(n, r, r + t, e.left)) {
|
|
63
|
+
e.row = n, e.labelX = r;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (e.row < 0) for (let n of u) {
|
|
68
|
+
let r = Math.min(e.left, m[n] - 14 - t);
|
|
69
|
+
if (r >= e.left - 140) {
|
|
70
|
+
e.row = n, e.labelX = r;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
e.row >= 0 && (m[e.row] = Math.min(m[e.row], e.labelX), d.push({
|
|
75
|
+
row: e.row,
|
|
76
|
+
x1: e.labelX,
|
|
77
|
+
x2: e.labelX + t
|
|
78
|
+
}), f.push({
|
|
79
|
+
row: e.row,
|
|
80
|
+
x: e.left
|
|
81
|
+
})), e.showLabel = e.row >= 0;
|
|
82
|
+
});
|
|
83
|
+
let h = s.reduce((e, t) => t.row >= 0 && t.row < 4 ? Math.max(e, t.row + 1) : e, 1), g = s.reduce((e, t) => t.row >= 4 ? Math.max(e, t.row - 3) : e, 0), _ = l * (n + 4) - 4, v = 10 + h * r + _ + g * r + 14, y = Math.max(a, v), b = Math.max(10 + h * r, Math.min(Math.round((y - _) / 2), y - _ - g * r - 14));
|
|
84
|
+
o.forEach((e) => {
|
|
85
|
+
if (e.barTop = b + e.sub * (n + 4), e.row < 0) return;
|
|
86
|
+
let t = e.row < 4;
|
|
87
|
+
e.labelTop = t ? b - (e.row + 1) * r : b + _ + 10 + (e.row - 4) * r, t ? (e.connTop = e.labelTop + i, e.connH = e.barTop - e.connTop - 1) : (e.connTop = e.barTop + n + 1, e.connH = e.labelTop - e.connTop + 2), e.conn = e.connH > 2, e.labelX > e.left + 2 ? (e.hconn = !0, e.hconnTop = e.labelTop + Math.round(i / 2), e.hconnLeft = e.left + 1, e.hconnW = Math.max(2, e.labelX - e.left - 3), e.conn = !0) : e.labelX + e.labelW < e.left - 2 && (e.hconn = !0, e.hconnTop = e.labelTop + Math.round(i / 2), e.hconnLeft = e.labelX + e.labelW - 1, e.hconnW = Math.max(2, e.left - (e.labelX + e.labelW) + 2), e.conn = !0);
|
|
88
|
+
});
|
|
89
|
+
let x = 0;
|
|
90
|
+
return o.forEach((e) => {
|
|
91
|
+
x = Math.max(x, e.left + e.width, e.showLabel ? e.labelX + e.labelW : 0);
|
|
92
|
+
}), {
|
|
93
|
+
items: o,
|
|
94
|
+
h: y,
|
|
95
|
+
axisY: b + Math.round(_ / 2),
|
|
96
|
+
subRows: l,
|
|
97
|
+
maxExt: x
|
|
98
|
+
};
|
|
85
99
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
100
|
+
function t(e, t, n) {
|
|
101
|
+
return Math.max(String(e).length + String(t).length + 4, String(n).length, 23) * 6 + 20;
|
|
88
102
|
}
|
|
89
|
-
export {
|
|
90
|
-
G as layoutTraceBand,
|
|
91
|
-
U as traceChipWidth
|
|
92
|
-
};
|
|
103
|
+
export { e as layoutTraceBand, t as traceChipWidth };
|
|
@@ -1,85 +1,82 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
2
|
+
// src/components/Timeline/useTimeline.ts
|
|
3
|
+
function i(t) {
|
|
4
|
+
let r = n(null), i = n(!1);
|
|
5
|
+
return {
|
|
6
|
+
onPointerDown: e((e) => {
|
|
7
|
+
let n = t.current;
|
|
8
|
+
n && (r.current = {
|
|
9
|
+
x: e.clientX,
|
|
10
|
+
y: e.clientY,
|
|
11
|
+
l: n.scrollLeft,
|
|
12
|
+
t: n.scrollTop,
|
|
13
|
+
moved: !1
|
|
14
|
+
});
|
|
15
|
+
}, [t]),
|
|
16
|
+
onPointerMove: e((e) => {
|
|
17
|
+
let n = r.current, i = t.current;
|
|
18
|
+
if (!n || !i) return;
|
|
19
|
+
let a = e.clientX - n.x, o = e.clientY - n.y;
|
|
20
|
+
Math.abs(a) + Math.abs(o) > 5 && (n.moved = !0), i.scrollLeft = n.l - a, i.scrollTop = n.t - o;
|
|
21
|
+
}, [t]),
|
|
22
|
+
onPointerUp: e(() => {
|
|
23
|
+
r.current && r.current.moved && (i.current = !0, setTimeout(() => {
|
|
24
|
+
i.current = !1;
|
|
25
|
+
}, 60)), r.current = null;
|
|
26
|
+
}, []),
|
|
27
|
+
wasDragSuppressed: e(() => i.current, [])
|
|
28
|
+
};
|
|
23
29
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
function a(e, n = 1100) {
|
|
31
|
+
let [i, a] = r(n);
|
|
32
|
+
return t(() => {
|
|
33
|
+
let t = e.current;
|
|
34
|
+
if (!t) return;
|
|
35
|
+
let n = new ResizeObserver(() => {
|
|
36
|
+
t.clientWidth && a(t.clientWidth);
|
|
37
|
+
});
|
|
38
|
+
return n.observe(t), t.clientWidth && a(t.clientWidth), () => n.disconnect();
|
|
39
|
+
}, [e]), i;
|
|
34
40
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
function o(e, n = 450) {
|
|
42
|
+
let [i, a] = r(() => Date.now());
|
|
43
|
+
return t(() => {
|
|
44
|
+
if (!e) return;
|
|
45
|
+
let t = setInterval(() => a(Date.now()), n);
|
|
46
|
+
return () => clearInterval(t);
|
|
47
|
+
}, [e, n]), e ? i : Date.now();
|
|
42
48
|
}
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
w.set(e, requestAnimationFrame(L));
|
|
49
|
+
var s = /* @__PURE__ */ new WeakMap();
|
|
50
|
+
function c(e, t, n = 900) {
|
|
51
|
+
let r = s.get(e);
|
|
52
|
+
r != null && cancelAnimationFrame(r);
|
|
53
|
+
let i = e.scrollLeft, a = e.scrollTop, o = t.left == null ? 0 : t.left - i, c = t.top == null ? 0 : t.top - a;
|
|
54
|
+
if (!o && !c) return;
|
|
55
|
+
if (typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches || n <= 0) {
|
|
56
|
+
t.left != null && (e.scrollLeft = t.left), t.top != null && (e.scrollTop = t.top);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
let l = performance.now(), u = (e) => 1 - (1 - e) ** 3, d = !1, f = () => {
|
|
60
|
+
d = !0, e.removeEventListener("wheel", f), e.removeEventListener("pointerdown", f), s.delete(e);
|
|
61
|
+
};
|
|
62
|
+
e.addEventListener("wheel", f, { once: !0 }), e.addEventListener("pointerdown", f, { once: !0 });
|
|
63
|
+
let p = (r) => {
|
|
64
|
+
if (d) return;
|
|
65
|
+
let m = Math.min(1, (r - l) / n), h = u(m);
|
|
66
|
+
t.left != null && (e.scrollLeft = i + o * h), t.top != null && (e.scrollTop = a + c * h), m < 1 ? s.set(e, requestAnimationFrame(p)) : f();
|
|
67
|
+
};
|
|
68
|
+
s.set(e, requestAnimationFrame(p));
|
|
65
69
|
}
|
|
66
|
-
function
|
|
67
|
-
|
|
70
|
+
function l(e, t) {
|
|
71
|
+
return e === "free" || e === "ctrl" && (t.ctrlKey || t.metaKey);
|
|
68
72
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
function u(e, r, i) {
|
|
74
|
+
let a = n(r);
|
|
75
|
+
a.current = r, t(() => {
|
|
76
|
+
let t = e.current;
|
|
77
|
+
if (!t) return;
|
|
78
|
+
let n = (e) => a.current(e);
|
|
79
|
+
return t.addEventListener("wheel", n, { passive: !1 }), () => t.removeEventListener("wheel", n);
|
|
80
|
+
}, [e, i]);
|
|
77
81
|
}
|
|
78
|
-
export {
|
|
79
|
-
D as animateScrollTo,
|
|
80
|
-
b as useContainerWidth,
|
|
81
|
-
A as useNowTicker,
|
|
82
|
-
W as useTimelinePan,
|
|
83
|
-
P as useWheelZoom,
|
|
84
|
-
x as wheelZoomAllowed
|
|
85
|
-
};
|
|
82
|
+
export { c as animateScrollTo, a as useContainerWidth, o as useNowTicker, i as useTimelinePan, u as useWheelZoom, l as wheelZoomAllowed };
|