@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,264 +1,337 @@
|
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
1
|
+
function e(e, t) {
|
|
2
|
+
let n = e.slice().sort((e, t) => e.start - t.start), r = n.length, i = t.now, a = t.orientation === "horizontal", o = t.spacing, s = t.containerWidth, c = s < 640, l = !a && c ? Math.max(190, s - 110) : 230, u = a ? 150 : 80, d = a ? 150 : 140, f = r ? n[0].start : i, p = r ? Math.max(f + 1, ...n.map((e) => e.end == null ? i : Math.max(e.end, e.start))) : i + 1, m = Math.max(1, p - f), h;
|
|
3
|
+
h = a ? o === "equal" ? 300 + Math.max(0, r - 1) * 264 : Math.max(s, r * (o === "proportional" ? 200 : 170)) : o === "equal" ? 200 + Math.max(0, r - 1) * 190 : Math.max(460, r * (o === "proportional" ? 150 : 130) + 180);
|
|
4
|
+
let g = (a ? s : Math.max(420, Math.round(t.viewportHeight * .66))) / h, _ = (e) => {
|
|
5
|
+
let t = Math.max(320, Math.round(h * e)), p = t - u - d, g = [], _ = null;
|
|
6
|
+
if (o === "proportional") _ = (e) => u + (e - f) / m * p, g = n.map((e) => _(e.start));
|
|
7
|
+
else if (o === "log") {
|
|
8
|
+
let e = m / Math.max(8, r * 2), t = [], i = 0;
|
|
9
|
+
n.forEach((r, a) => {
|
|
10
|
+
a > 0 && (i += Math.log1p((r.start - n[a - 1].start) / e)), t.push(i);
|
|
11
|
+
});
|
|
12
|
+
let a = i || 1;
|
|
13
|
+
g = t.map((e) => u + e / a * p);
|
|
14
|
+
} else g = n.map((e, t) => u + (r > 1 ? t * p / (r - 1) : 0));
|
|
15
|
+
let v = a ? Math.max(s, t) : 900, y = a ? 600 : t, b = a ? 120 : 110, x = [], S = r ? [0] : [];
|
|
16
|
+
for (let e = 1; e < r; e++) g[e] - g[e - 1] < b ? S.push(e) : (x.push(S), S = [e]);
|
|
17
|
+
S.length && x.push(S);
|
|
18
|
+
let C = !a && c, w = n.map(() => ({
|
|
19
|
+
side: 0,
|
|
20
|
+
row: 0,
|
|
21
|
+
mode: "s",
|
|
22
|
+
dlv: 0,
|
|
23
|
+
rx: 0,
|
|
24
|
+
lx: 0
|
|
25
|
+
})), T = 0;
|
|
26
|
+
for (let e = x.length - 1; e >= 0; e--) {
|
|
27
|
+
let t = x[e];
|
|
28
|
+
for (let e = t.length - 1; e >= 0; e--) {
|
|
29
|
+
let n = t.length - 1 - e;
|
|
30
|
+
w[t[e]].side = C ? 0 : t.length === 1 ? T++ % 2 : n % 2;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
let E = g.map((e, t) => g.some((n, r) => r !== t && w[r].side !== w[t].side && Math.abs(n - e) < 18)), D = a ? l * .55 : 110, O = Array(r).fill(-1), k = [];
|
|
34
|
+
[0, 1].forEach((e) => {
|
|
35
|
+
let t = [];
|
|
36
|
+
for (let n = 0; n < r; n++) w[n].side === e && t.push(n);
|
|
37
|
+
let n = null;
|
|
38
|
+
for (let e = 1; e < t.length; e++) g[t[e]] - g[t[e - 1]] < D ? (n || (n = [t[e - 1]], k.push(n), O[t[e - 1]] = k.length - 1), n.push(t[e]), O[t[e]] = k.length - 1) : n = null;
|
|
39
|
+
});
|
|
40
|
+
let A = {}, j = [], M = [];
|
|
41
|
+
for (let e = 0; e < r; e++) {
|
|
42
|
+
let t = n[e], r = O[e] >= 0, o = String(t.title || ""), s = String(t.detail || ""), u = t.end == null, d = (u ? i : t.end) - t.start, f = u || d > 0, p = Math.min(2, Math.max(1, Math.ceil(o.length / 26))), m = r || !s ? 0 : Math.min(2, Math.ceil(s.length / 34));
|
|
43
|
+
j.push(Math.round(7 + p * 17 + 3 + 15 + (m ? 3 + m * 16 : 0) + (f ? 24 : 0) + 8)), M.push(!a && c ? l : r ? Math.max(160, Math.min(230, o.length * 7 + 64)) : 230);
|
|
44
|
+
}
|
|
45
|
+
let N = [{
|
|
46
|
+
chips: [],
|
|
47
|
+
stems: []
|
|
48
|
+
}, {
|
|
49
|
+
chips: [],
|
|
50
|
+
stems: []
|
|
51
|
+
}], P = a ? 46 : 80, F = [[], []];
|
|
52
|
+
for (let e = r - 1; e >= 0; e--) {
|
|
53
|
+
let t = F[w[e].side], n = g[e], r = +!!E[e];
|
|
54
|
+
for (; t.some((e) => e.lv === r && Math.abs(e.p - n) < P);) r++;
|
|
55
|
+
w[e].dlv = r, t.push({
|
|
56
|
+
p: n,
|
|
57
|
+
lv: r,
|
|
58
|
+
i: e
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
let I = (e, t) => F[w[e].side].some((n) => n.i !== e && n.lv > w[e].dlv && Math.abs(n.p - t) < 10), L = (e, t, n) => F[w[e].side].some((r) => r.i !== e && (r.lv === w[e].dlv && r.p > t && r.p < n + 10 || r.lv > w[e].dlv && Math.abs(r.p - n) < 10));
|
|
62
|
+
for (let e = r - 1; e >= 0; e--) {
|
|
63
|
+
let t = w[e], n = N[t.side], r = g[e], i = M[e], o = j[e], s = a ? r - i / 2 : r - 44, c = (e, t, r) => !n.chips.some((n) => n.row === e && t < n.x2 + 10 && r > n.x1 - 10), l = (e, t, r) => n.stems.some((n) => n.row > e && n.x > t - 6 && n.x < r + 6), u = (e, t) => n.chips.some((n) => n.row < e && t > n.x1 - 6 && t < n.x2 + 6), d = a ? i : o, f = Math.round(d / 2) - 20, p = (e, t) => {
|
|
64
|
+
let r = t, i = 0, a = !0;
|
|
65
|
+
for (; a && i++ < 60;) {
|
|
66
|
+
a = !1;
|
|
67
|
+
for (let t of n.chips) t.row === e && r < t.x2 + 10 && r + d > t.x1 - 10 && (r = t.x2 + 10, a = !0);
|
|
68
|
+
for (let t of n.stems) t.row > e && t.x > r - 6 && t.x < r + d + 6 && (r = t.x + 7, a = !0);
|
|
69
|
+
}
|
|
70
|
+
return r;
|
|
71
|
+
}, m = (e, t) => {
|
|
72
|
+
let r = g[e], i = F[w[e].side], a = 1e400;
|
|
73
|
+
for (let t of i) t.i !== e && t.lv === w[e].dlv && t.p > r && (a = Math.min(a, t.p - 8));
|
|
74
|
+
let o = (t) => !i.some((n) => n.i !== e && n.lv > w[e].dlv && Math.abs(n.p - t) < 8) && !n.stems.some((e) => Math.abs(e.x - t) < 4), s = Math.min(Math.max(t, r + 8), a);
|
|
75
|
+
for (let e = s; e <= a && e <= s + 80; e++) if (o(e)) return e;
|
|
76
|
+
for (let e = s - 1; e >= r + 8; e--) if (o(e)) return e;
|
|
77
|
+
return s;
|
|
78
|
+
}, h = (e, t) => {
|
|
79
|
+
let n = g[e];
|
|
80
|
+
return F[w[e].side].some((r) => r.i !== e && (r.lv > w[e].dlv && Math.abs(r.p - t) < 8 || r.lv === w[e].dlv && r.p > n && r.p < t + 8));
|
|
81
|
+
}, _ = (e, t, n) => {
|
|
82
|
+
let r = g[e], i = F[w[e].side], a = 1e400;
|
|
83
|
+
for (let t of i) t.i !== e && t.lv === w[e].dlv && t.p > r && (a = Math.min(a, t.p - 28));
|
|
84
|
+
let o = (t) => !i.some((n) => n.i !== e && n.lv > w[e].dlv && Math.abs(n.p - (t + 20)) < 8), s = p(t, n), c = 0;
|
|
85
|
+
for (; !o(s) && s < a && c++ < 40;) s = p(t, s + 4);
|
|
86
|
+
if (s > a || !o(s)) {
|
|
87
|
+
for (let e = Math.min(s, a); e >= n; e -= 2) if (o(e) && p(t, e) === e) return e;
|
|
88
|
+
}
|
|
89
|
+
return s;
|
|
90
|
+
}, v = O[e];
|
|
91
|
+
if (v >= 0) {
|
|
92
|
+
if (!A[v]) {
|
|
93
|
+
A[v] = !0;
|
|
94
|
+
let e = k[v].slice().reverse(), t = e.length, r = e.map((e, n) => {
|
|
95
|
+
let r = t - 1 - n, i = g[e], o = Math.round(a ? i + 8 + (r + 1) * 10 : i + 10), s = Math.round(a ? Math.max(o + 12, i + 24 + r * 16) : i + 20);
|
|
96
|
+
return {
|
|
97
|
+
j: e,
|
|
98
|
+
jj: n,
|
|
99
|
+
rx: o,
|
|
100
|
+
lx: s,
|
|
101
|
+
x1: s,
|
|
102
|
+
x2: s + (a ? M[e] : j[e])
|
|
103
|
+
};
|
|
104
|
+
}), i = 0;
|
|
105
|
+
for (; i <= 5; i++) {
|
|
106
|
+
let e = !0;
|
|
107
|
+
for (let t of r) {
|
|
108
|
+
let n = i + t.jj;
|
|
109
|
+
if (!c(n, t.x1, t.x2) || l(n, t.x1, t.x2)) {
|
|
110
|
+
e = !1;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (e) break;
|
|
115
|
+
}
|
|
116
|
+
for (let e = r.length - 1; e >= 0; e--) {
|
|
117
|
+
let t = r[e], o = w[t.j], s = i + t.jj, c = g[t.j], l = a ? M[t.j] : j[t.j], d = a ? c - M[t.j] / 2 : c - 44, f = p(s, d), h = n.stems.some((e) => e.row > s && Math.abs(e.x - c) < 8);
|
|
118
|
+
if (f - d <= Math.round(l / 2) - 20 && !h && !u(s, c) && !I(t.j, c)) o.row = s, o.mode = "s", o.sx1 = Math.round(f), n.chips.push({
|
|
119
|
+
row: s,
|
|
120
|
+
x1: f,
|
|
121
|
+
x2: f + l,
|
|
122
|
+
h: j[t.j],
|
|
123
|
+
w: M[t.j]
|
|
124
|
+
}), n.stems.push({
|
|
125
|
+
x: c,
|
|
126
|
+
row: s
|
|
127
|
+
});
|
|
128
|
+
else {
|
|
129
|
+
let e, r;
|
|
130
|
+
a ? (e = Math.round(m(t.j, t.rx)), r = Math.round(p(s, Math.max(t.lx, e + 12)))) : (e = t.rx, r = Math.round(_(t.j, s, t.lx))), o.row = s, o.mode = "z", o.rx = e, o.lx = r, n.chips.push({
|
|
131
|
+
row: s,
|
|
132
|
+
x1: r,
|
|
133
|
+
x2: r + l,
|
|
134
|
+
h: j[t.j],
|
|
135
|
+
w: M[t.j]
|
|
136
|
+
}), n.stems.push({
|
|
137
|
+
x: e,
|
|
138
|
+
row: s
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
let y = !1;
|
|
146
|
+
for (let a = 0; a <= 5 && !y; a++) {
|
|
147
|
+
let c = p(a, s);
|
|
148
|
+
c - s <= f && !u(a, r) && !I(e, r) && (t.row = a, t.mode = "s", t.sx1 = Math.round(c), n.chips.push({
|
|
149
|
+
row: a,
|
|
150
|
+
x1: c,
|
|
151
|
+
x2: c + d,
|
|
152
|
+
h: o,
|
|
153
|
+
w: i
|
|
154
|
+
}), n.stems.push({
|
|
155
|
+
x: r,
|
|
156
|
+
row: a
|
|
157
|
+
}), y = !0);
|
|
158
|
+
}
|
|
159
|
+
if (!y) for (let s of [64, 340]) {
|
|
160
|
+
for (let c = 0; c <= 5 && !y; c++) {
|
|
161
|
+
let l = r + 10 + c * 7, f = a ? l + 14 : r + 20, m = a ? p(c, f) : _(e, c, f), g = a ? !L(e, r, l) : !h(e, m + 20);
|
|
162
|
+
m - f <= s && !u(c, a ? l : m + 20) && g && (t.row = c, t.mode = "z", t.rx = Math.round(l), t.lx = Math.round(m), n.chips.push({
|
|
163
|
+
row: c,
|
|
164
|
+
x1: m,
|
|
165
|
+
x2: m + d,
|
|
166
|
+
h: o,
|
|
167
|
+
w: i
|
|
168
|
+
}), n.stems.push({
|
|
169
|
+
x: l,
|
|
170
|
+
row: c
|
|
171
|
+
}), y = !0);
|
|
172
|
+
}
|
|
173
|
+
if (y) break;
|
|
174
|
+
}
|
|
175
|
+
if (!y) {
|
|
176
|
+
let s, c;
|
|
177
|
+
a ? (s = Math.round(m(e, r + 10)), c = p(6, Math.max(r + 24, s + 12))) : (s = r + 10, c = _(e, 6, r + 20)), t.row = 6, t.mode = "z", t.rx = Math.round(s), t.lx = Math.round(c), n.chips.push({
|
|
178
|
+
row: 6,
|
|
179
|
+
x1: c,
|
|
180
|
+
x2: c + d,
|
|
181
|
+
h: o,
|
|
182
|
+
w: i
|
|
183
|
+
}), n.stems.push({
|
|
184
|
+
x: s,
|
|
185
|
+
row: 6
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
let R = N.map((e) => {
|
|
190
|
+
let t = [];
|
|
191
|
+
e.chips.forEach((e) => {
|
|
192
|
+
t[e.row] = Math.max(t[e.row] || 0, (a ? e.h : e.w) || (a ? 144 : l));
|
|
193
|
+
});
|
|
194
|
+
let n = [], r = 44;
|
|
195
|
+
for (let e = 0; e < t.length; e++) n[e] = r, r += (t[e] || 90) + 12;
|
|
196
|
+
return n.total = r, n;
|
|
197
|
+
}), z = R[0], B = R[1], V = 0, H = 0, U = 0;
|
|
198
|
+
if (a) V = 46 + Math.max(z.total, 190), U = V + Math.max(B.total, 130) + 24;
|
|
199
|
+
else {
|
|
200
|
+
H = c ? 26 : Math.round(s / 2), U = y;
|
|
201
|
+
let e = Math.max(0, 78 - (H - B.total - 16));
|
|
202
|
+
v = Math.max(s - 2, H + z.total + 16 + e + 24);
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
posArr: g,
|
|
206
|
+
mapT: _,
|
|
207
|
+
innerW: v,
|
|
208
|
+
innerLen: y,
|
|
209
|
+
innerSpan: p,
|
|
210
|
+
meta: w,
|
|
211
|
+
groupOf: O,
|
|
212
|
+
chArr: j,
|
|
213
|
+
cwArr: M,
|
|
214
|
+
offA: z,
|
|
215
|
+
offB: B,
|
|
216
|
+
axisY: V,
|
|
217
|
+
axisX: H,
|
|
218
|
+
innerH: U
|
|
219
|
+
};
|
|
220
|
+
}, v = t.k === "fit" ? g : t.k, y = _(v);
|
|
221
|
+
if (t.k === "fit") {
|
|
222
|
+
let e = a ? Math.max(380, Math.round(t.viewportHeight * .8)) : s + 4, n = 0;
|
|
223
|
+
for (; n++ < 6 && (a ? y.innerH > e : y.innerW > e);) v *= 1.3, y = _(v);
|
|
224
|
+
}
|
|
225
|
+
let { posArr: b, mapT: x, innerSpan: S, meta: C, groupOf: w, chArr: T, cwArr: E, offA: D, offB: O, axisY: k } = y, A = y.axisX, j = y.innerW, M = y.innerH, N = 0, P = 0, F = 1e9, I = 1.5, L = n.map((e, t) => {
|
|
226
|
+
let n = C[t], r = Math.round(b[t]), i = E[t], o = T[t], s = {
|
|
227
|
+
id: e.id,
|
|
228
|
+
pos: r,
|
|
229
|
+
dotX: 0,
|
|
230
|
+
dotY: 0,
|
|
231
|
+
cardLeft: 0,
|
|
232
|
+
cardTop: 0,
|
|
233
|
+
cardW: i,
|
|
234
|
+
cardH: o,
|
|
235
|
+
condensed: w[t] >= 0,
|
|
236
|
+
segs: [],
|
|
237
|
+
side: n.side,
|
|
238
|
+
row: n.row,
|
|
239
|
+
mode: n.mode
|
|
240
|
+
};
|
|
241
|
+
if (a) {
|
|
242
|
+
let e = r;
|
|
243
|
+
s.dotX = e;
|
|
244
|
+
let t = n.side === 0;
|
|
245
|
+
s.dotY = t ? k - n.dlv * 20 : k + n.dlv * 20;
|
|
246
|
+
let a = t ? D : O, c = a[n.row] == null ? 44 + n.row * 156 : a[n.row];
|
|
247
|
+
if (s.cardTop = t ? k - c - o : k + c, n.mode === "s") {
|
|
248
|
+
s.cardLeft = n.sx1 == null ? e - Math.round(i / 2) : n.sx1;
|
|
249
|
+
let r = t ? s.cardTop + o : s.dotY + 8, a = t ? s.dotY - 8 : s.cardTop;
|
|
250
|
+
s.segs.push({
|
|
251
|
+
l: e - 1,
|
|
252
|
+
t: r,
|
|
253
|
+
w: I,
|
|
254
|
+
h: Math.max(2, a - r)
|
|
255
|
+
});
|
|
256
|
+
} else {
|
|
257
|
+
let t = n.rx;
|
|
258
|
+
s.cardLeft = n.lx;
|
|
259
|
+
let r = s.cardTop + Math.round(o / 2);
|
|
260
|
+
s.segs.push({
|
|
261
|
+
l: e + 7,
|
|
262
|
+
t: s.dotY - 1,
|
|
263
|
+
w: Math.max(2, t - e - 7 + I),
|
|
264
|
+
h: I
|
|
265
|
+
}), s.segs.push({
|
|
266
|
+
l: t - 1,
|
|
267
|
+
t: Math.min(s.dotY, r),
|
|
268
|
+
w: I,
|
|
269
|
+
h: Math.abs(r - s.dotY) + I
|
|
270
|
+
}), s.segs.push({
|
|
271
|
+
l: t - 1,
|
|
272
|
+
t: r - 1,
|
|
273
|
+
w: Math.max(2, s.cardLeft - t + 1),
|
|
274
|
+
h: I
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
N = Math.max(N, s.cardLeft + i);
|
|
278
|
+
} else {
|
|
279
|
+
let e = r;
|
|
280
|
+
s.dotY = e;
|
|
281
|
+
let t = n.side === 0;
|
|
282
|
+
s.dotX = t || c ? A + n.dlv * 20 : A - n.dlv * 20;
|
|
283
|
+
let a = t ? D : O, u = a[n.row] == null ? 44 + n.row * (l + 14) : a[n.row];
|
|
284
|
+
if (n.mode === "s") {
|
|
285
|
+
s.cardTop = n.sx1 == null ? e - 44 : n.sx1, s.cardLeft = c ? A + 34 : t ? A + u : A - u - i;
|
|
286
|
+
let r = t || c ? s.dotX + 8 : s.cardLeft + i, a = t || c ? s.cardLeft : s.dotX - 8;
|
|
287
|
+
s.segs.push({
|
|
288
|
+
l: r,
|
|
289
|
+
t: e - 1,
|
|
290
|
+
w: Math.max(2, a - r),
|
|
291
|
+
h: I
|
|
292
|
+
});
|
|
293
|
+
} else {
|
|
294
|
+
s.cardTop = n.lx, s.cardLeft = c ? A + 34 : t ? A + u + 16 : A - u - 16 - i;
|
|
295
|
+
let r = s.cardTop + 20;
|
|
296
|
+
s.segs.push({
|
|
297
|
+
l: s.dotX - 1,
|
|
298
|
+
t: e + 7,
|
|
299
|
+
w: I,
|
|
300
|
+
h: Math.max(2, r - e - 7 + I)
|
|
301
|
+
});
|
|
302
|
+
let a = t || c ? s.cardLeft : s.cardLeft + i;
|
|
303
|
+
s.segs.push({
|
|
304
|
+
l: Math.min(s.dotX, a),
|
|
305
|
+
t: r - 1,
|
|
306
|
+
w: Math.max(2, Math.abs(a - s.dotX)),
|
|
307
|
+
h: I
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
P = Math.max(P, s.cardTop + o), N = Math.max(N, s.cardLeft + i), F = Math.min(F, s.cardLeft);
|
|
311
|
+
}
|
|
312
|
+
return s;
|
|
313
|
+
});
|
|
314
|
+
if (a) j = Math.max(j, N + 40);
|
|
315
|
+
else {
|
|
316
|
+
M = Math.max(M, P + 40);
|
|
317
|
+
let e = Math.max(0, 78 - F);
|
|
318
|
+
e && (A += e, L.forEach((t) => {
|
|
319
|
+
t.dotX += e, t.cardLeft += e, t.segs.forEach((t) => {
|
|
320
|
+
t.l += e;
|
|
321
|
+
});
|
|
322
|
+
})), j = Math.max(s - 2, N + e + 24);
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
items: L,
|
|
326
|
+
axisY: k,
|
|
327
|
+
axisX: A,
|
|
328
|
+
innerW: Math.ceil(j),
|
|
329
|
+
innerH: Math.ceil(M),
|
|
330
|
+
kEff: v,
|
|
331
|
+
kFit: g,
|
|
332
|
+
posArr: b,
|
|
333
|
+
mapT: x,
|
|
334
|
+
innerSpan: S
|
|
335
|
+
};
|
|
261
336
|
}
|
|
262
|
-
export {
|
|
263
|
-
Ut as computeHistoryLayout
|
|
264
|
-
};
|
|
337
|
+
export { e as computeHistoryLayout };
|