@adecore/ui 0.31.11 → 0.32.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/dist/AccentSwatches.js +290 -13
- package/dist/Banner.js +90 -9
- package/dist/Button.js +114 -22
- package/dist/ButtonGroup.js +62 -8
- package/dist/Checkbox.js +73 -4
- package/dist/ChoiceCards.js +205 -11
- package/dist/CloseButton.js +87 -7
- package/dist/ColorSwatch.js +132 -15
- package/dist/ColorWheelPicker.js +305 -71
- package/dist/ColumnResizeHandle.js +43 -8
- package/dist/DisabledReason.js +27 -8
- package/dist/DockShell.js +144 -37
- package/dist/EmptyState.js +95 -6
- package/dist/ErrorBoundary.js +254 -31
- package/dist/Field.js +349 -31
- package/dist/FileIcon.js +67 -6
- package/dist/Icon.js +38 -6
- package/dist/IconButton.js +176 -20
- package/dist/IconPicker.js +344 -73
- package/dist/Input.js +233 -14
- package/dist/Kbd.js +150 -10
- package/dist/LazyBoundary.js +14 -5
- package/dist/ListRow.js +75 -15
- package/dist/Meter.js +108 -5
- package/dist/MiddleTruncate.js +126 -45
- package/dist/PanelEmpty.js +64 -5
- package/dist/PanelHeader.js +95 -13
- package/dist/Pill.js +114 -19
- package/dist/ProjectSwitcher.js +225 -12
- package/dist/PromptDialog.js +352 -37
- package/dist/SectionLabel.js +62 -8
- package/dist/SegmentBar.js +197 -36
- package/dist/Segmented.js +130 -23
- package/dist/Select.js +310 -19
- package/dist/SelectSearch.js +344 -29
- package/dist/Separator.js +35 -4
- package/dist/ShortcutHints.js +146 -76
- package/dist/Skeleton.js +31 -4
- package/dist/Slider.js +172 -10
- package/dist/SlidingColumn.js +194 -34
- package/dist/Spinner.js +100 -3
- package/dist/Stepper.js +232 -11
- package/dist/Surface.js +62 -8
- package/dist/Switch.js +60 -6
- package/dist/TextMenu.js +212 -17
- package/dist/Tile.js +149 -5
- package/dist/Toasts.js +391 -33
- package/dist/Tooltip.js +153 -16
- package/dist/UIProvider.js +62 -15
- package/dist/Waveform.js +362 -93
- package/dist/Wipe.js +259 -34
- package/dist/ZoomControls.js +356 -14
- package/dist/class-name.js +1 -1
- package/dist/clipboard.js +15 -17
- package/dist/context-menu/index.parts.js +1 -1
- package/dist/dialog/index.parts.js +1 -1
- package/dist/dialog/parts.js +378 -29
- package/dist/dialog-layer.js +51 -18
- package/dist/error-boundary.js +19 -19
- package/dist/error-message.js +1 -1
- package/dist/field-context.js +7 -5
- package/dist/file-icon.js +23 -21
- package/dist/file-tree/helpers.js +133 -119
- package/dist/file-tree/index.parts.js +3 -3
- package/dist/file-tree/parts.js +418 -127
- package/dist/file-tree/style.js +1 -1
- package/dist/file-tree/use-file-tree-shift.js +43 -30
- package/dist/file-tree/use-file-tree.js +60 -18
- package/dist/file-tree/use-slots.js +220 -192
- package/dist/floating.js +2 -2
- package/dist/format/datetime.js +88 -38
- package/dist/format/duration.js +59 -53
- package/dist/format/index.js +1 -1
- package/dist/format/locale.js +76 -56
- package/dist/format/number.js +77 -61
- package/dist/format/regions.js +4 -2
- package/dist/format/time-zone.js +1 -1
- package/dist/icon-button-size.js +12 -2
- package/dist/icon-picker.js +70 -61
- package/dist/index.js +57 -57
- package/dist/key-value-list/index.parts.js +1 -1
- package/dist/key-value-list/parts.js +256 -22
- package/dist/lazy-landings.js +10 -10
- package/dist/lazy.js +84 -71
- package/dist/locales/en.js +80 -80
- package/dist/locales/nl.js +80 -80
- package/dist/locales.js +10 -7
- package/dist/menu/index.parts.js +1 -1
- package/dist/menu/parts.js +882 -44
- package/dist/merge-refs.js +8 -9
- package/dist/middle-truncate.js +24 -25
- package/dist/modality.js +27 -19
- package/dist/placement.js +11 -20
- package/dist/platform.js +6 -6
- package/dist/popover/index.parts.js +1 -1
- package/dist/popover/parts.js +173 -11
- package/dist/popup-layer.js +38 -17
- package/dist/prefetch.js +78 -79
- package/dist/preview-card/index.parts.js +1 -1
- package/dist/project-switcher-row.js +153 -12
- package/dist/select-row.js +69 -5
- package/dist/select-shared.js +6 -6
- package/dist/selection.js +16 -16
- package/dist/seti-icons.js +413 -413
- package/dist/settings/ConfirmDialog.js +55 -8
- package/dist/settings/DetailHeader.js +72 -4
- package/dist/settings/MasterDetail.js +119 -7
- package/dist/settings/SettingsDialog.js +820 -80
- package/dist/settings/SettingsRow.js +205 -18
- package/dist/settings/SettingsSection.js +96 -6
- package/dist/settings/index.js +7 -7
- package/dist/settings/target.js +7 -2
- package/dist/shortcut-hints.js +73 -55
- package/dist/shortcut.js +140 -104
- package/dist/step-places.js +1 -1
- package/dist/tabs/index.parts.js +1 -1
- package/dist/tabs/overflow.js +18 -18
- package/dist/tabs/parts.js +780 -166
- package/dist/testing/dedupe.js +82 -75
- package/dist/testing/fake-source.js +12 -12
- package/dist/testing/index.js +1 -1
- package/dist/toast-store.js +65 -46
- package/dist/tree/index.parts.js +1 -1
- package/dist/tree/parts.js +721 -94
- package/dist/tree/shift.js +28 -22
- package/dist/tree/style.js +2 -2
- package/dist/tree/use-tree-shift.js +178 -117
- package/dist/useAsyncAction.js +23 -19
- package/dist/useColumnResize.js +36 -34
- package/dist/useContentSize.js +62 -18
- package/dist/useMeasuredWidth.js +14 -3
- package/dist/useNow.js +73 -30
- package/dist/wipe-split.js +14 -14
- package/dist/workspace/DropPreview.js +60 -7
- package/dist/workspace/SplitView.js +1025 -441
- package/dist/workspace/TabStrip.js +810 -191
- package/dist/workspace/Workspace.js +276 -26
- package/dist/workspace/context.js +8 -3
- package/dist/workspace/geometry.js +173 -150
- package/dist/workspace/model.js +313 -250
- package/dist/workspace/preview.js +61 -61
- package/dist/zoom.js +2 -2
- package/package.json +1 -1
- package/src/ErrorBoundary.tsx +1 -1
- package/src/Field.tsx +4 -3
- package/src/IconPicker.tsx +3 -3
- package/src/LazyBoundary.tsx +2 -0
- package/src/MiddleTruncate.tsx +2 -2
- package/src/SegmentBar.tsx +2 -2
- package/src/Toasts.tsx +3 -1
- package/src/Tooltip.tsx +7 -10
- package/src/Waveform.tsx +3 -3
- package/src/file-tree/parts.tsx +6 -9
- package/src/file-tree/use-file-tree-shift.tsx +6 -9
- package/src/lazy.tsx +4 -0
- package/src/locales/en.ts +4 -4
- package/src/locales/nl.ts +5 -5
- package/src/settings/SettingsDialog.tsx +1 -1
- package/src/tree/parts.tsx +5 -8
- package/src/useContentSize.ts +3 -3
- package/src/workspace/SplitView.tsx +2 -2
- package/src/workspace/TabStrip.tsx +2 -3
- package/src/workspace/Workspace.tsx +2 -5
package/dist/DockShell.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { Surface } from
|
|
4
|
+
import { Surface } from "./Surface.js";
|
|
5
5
|
/* How close to the bottom of the window the pointer has to come before a hidden dock slides back. */
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
const REVEAL_ZONE = 120;
|
|
7
8
|
/*
|
|
8
9
|
* The floating bar at the bottom of a canvas-like view, and the one place that knows how to get out
|
|
@@ -11,39 +12,145 @@ const REVEAL_ZONE = 120;
|
|
|
11
12
|
* buttons stay in the tab order while it is out of sight, so focus brings it back. Something that
|
|
12
13
|
* moves with the dock marks itself `data-holds-dock`, so reaching for it does not hide the dock.
|
|
13
14
|
*/
|
|
14
|
-
export function DockShell(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export function DockShell(t0) {
|
|
16
|
+
const $ = _c(28);
|
|
17
|
+
let barClassName;
|
|
18
|
+
let children;
|
|
19
|
+
let className;
|
|
20
|
+
let onHiddenChange;
|
|
21
|
+
let ref;
|
|
22
|
+
let rest;
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[0] !== t0) {
|
|
25
|
+
({
|
|
26
|
+
children,
|
|
27
|
+
autoHide: t1,
|
|
28
|
+
className,
|
|
29
|
+
barClassName,
|
|
30
|
+
onHiddenChange,
|
|
31
|
+
ref,
|
|
32
|
+
...rest
|
|
33
|
+
} = t0);
|
|
34
|
+
$[0] = t0;
|
|
35
|
+
$[1] = barClassName;
|
|
36
|
+
$[2] = children;
|
|
37
|
+
$[3] = className;
|
|
38
|
+
$[4] = onHiddenChange;
|
|
39
|
+
$[5] = ref;
|
|
40
|
+
$[6] = rest;
|
|
41
|
+
$[7] = t1;
|
|
42
|
+
} else {
|
|
43
|
+
barClassName = $[1];
|
|
44
|
+
children = $[2];
|
|
45
|
+
className = $[3];
|
|
46
|
+
onHiddenChange = $[4];
|
|
47
|
+
ref = $[5];
|
|
48
|
+
rest = $[6];
|
|
49
|
+
t1 = $[7];
|
|
50
|
+
}
|
|
51
|
+
const autoHide = t1 === undefined ? false : t1;
|
|
52
|
+
const barRef = useRef(null);
|
|
53
|
+
const [revealed, setRevealed] = useState(false);
|
|
54
|
+
let t2;
|
|
55
|
+
let t3;
|
|
56
|
+
if ($[8] !== autoHide) {
|
|
57
|
+
t2 = () => {
|
|
58
|
+
if (!autoHide) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
let pointerNear = false;
|
|
62
|
+
const evaluate = () => {
|
|
63
|
+
const bar = barRef.current;
|
|
64
|
+
const holds = bar !== null && (bar.querySelector("[data-popup-open]") !== null || bar.querySelector(":focus-visible") !== null);
|
|
65
|
+
setRevealed(pointerNear || holds);
|
|
66
|
+
};
|
|
67
|
+
const onMove = event => {
|
|
68
|
+
if (event.target instanceof Element && event.target.closest("[data-holds-dock]") !== null) {
|
|
69
|
+
return;
|
|
20
70
|
}
|
|
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
|
-
|
|
71
|
+
pointerNear = window.innerHeight - event.clientY <= REVEAL_ZONE;
|
|
72
|
+
evaluate();
|
|
73
|
+
};
|
|
74
|
+
window.addEventListener("pointermove", onMove);
|
|
75
|
+
window.addEventListener("focusin", evaluate);
|
|
76
|
+
return () => {
|
|
77
|
+
window.removeEventListener("pointermove", onMove);
|
|
78
|
+
window.removeEventListener("focusin", evaluate);
|
|
79
|
+
setRevealed(false);
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
t3 = [autoHide];
|
|
83
|
+
$[8] = autoHide;
|
|
84
|
+
$[9] = t2;
|
|
85
|
+
$[10] = t3;
|
|
86
|
+
} else {
|
|
87
|
+
t2 = $[9];
|
|
88
|
+
t3 = $[10];
|
|
89
|
+
}
|
|
90
|
+
useEffect(t2, t3);
|
|
91
|
+
const hidden = autoHide && !revealed;
|
|
92
|
+
let t4;
|
|
93
|
+
let t5;
|
|
94
|
+
if ($[11] !== hidden || $[12] !== onHiddenChange) {
|
|
95
|
+
t4 = () => {
|
|
96
|
+
onHiddenChange?.(hidden);
|
|
97
|
+
};
|
|
98
|
+
t5 = [hidden, onHiddenChange];
|
|
99
|
+
$[11] = hidden;
|
|
100
|
+
$[12] = onHiddenChange;
|
|
101
|
+
$[13] = t4;
|
|
102
|
+
$[14] = t5;
|
|
103
|
+
} else {
|
|
104
|
+
t4 = $[13];
|
|
105
|
+
t5 = $[14];
|
|
106
|
+
}
|
|
107
|
+
useEffect(t4, t5);
|
|
108
|
+
let t6;
|
|
109
|
+
if ($[15] !== className) {
|
|
110
|
+
t6 = clsx("pointer-events-none absolute inset-x-0 bottom-4 flex justify-center", className);
|
|
111
|
+
$[15] = className;
|
|
112
|
+
$[16] = t6;
|
|
113
|
+
} else {
|
|
114
|
+
t6 = $[16];
|
|
115
|
+
}
|
|
116
|
+
const t7 = hidden ? "pointer-events-none translate-y-6 opacity-0" : "pointer-events-auto";
|
|
117
|
+
let t8;
|
|
118
|
+
if ($[17] !== barClassName || $[18] !== t7) {
|
|
119
|
+
t8 = clsx("flex items-center gap-2 rounded-xl p-1 transition-[opacity,translate] duration-200", barClassName, t7);
|
|
120
|
+
$[17] = barClassName;
|
|
121
|
+
$[18] = t7;
|
|
122
|
+
$[19] = t8;
|
|
123
|
+
} else {
|
|
124
|
+
t8 = $[19];
|
|
125
|
+
}
|
|
126
|
+
let t9;
|
|
127
|
+
if ($[20] !== children || $[21] !== t8) {
|
|
128
|
+
t9 = /*#__PURE__*/_jsx(Surface, {
|
|
129
|
+
ref: barRef,
|
|
130
|
+
className: t8,
|
|
131
|
+
children: children
|
|
132
|
+
});
|
|
133
|
+
$[20] = children;
|
|
134
|
+
$[21] = t8;
|
|
135
|
+
$[22] = t9;
|
|
136
|
+
} else {
|
|
137
|
+
t9 = $[22];
|
|
138
|
+
}
|
|
139
|
+
let t10;
|
|
140
|
+
if ($[23] !== ref || $[24] !== rest || $[25] !== t6 || $[26] !== t9) {
|
|
141
|
+
t10 = /*#__PURE__*/_jsx("div", {
|
|
142
|
+
ref: ref,
|
|
143
|
+
...rest,
|
|
144
|
+
className: t6,
|
|
145
|
+
children: t9
|
|
146
|
+
});
|
|
147
|
+
$[23] = ref;
|
|
148
|
+
$[24] = rest;
|
|
149
|
+
$[25] = t6;
|
|
150
|
+
$[26] = t9;
|
|
151
|
+
$[27] = t10;
|
|
152
|
+
} else {
|
|
153
|
+
t10 = $[27];
|
|
154
|
+
}
|
|
155
|
+
return t10;
|
|
156
|
+
}
|
package/dist/EmptyState.js
CHANGED
|
@@ -1,11 +1,100 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { cloneElement, isValidElement } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import { Icon } from
|
|
5
|
-
import { Spinner } from
|
|
4
|
+
import { Icon } from "./Icon.js";
|
|
5
|
+
import { Spinner } from "./Spinner.js";
|
|
6
6
|
// One size in a panel, a card and a dialog alike, so no caller picks its own.
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
8
|
const ICON_SIZE = 20;
|
|
8
9
|
/* What a list, a canvas or a thread shows before it holds anything. */
|
|
9
|
-
export function EmptyState(
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
export function EmptyState(t0) {
|
|
11
|
+
const $ = _c(18);
|
|
12
|
+
const {
|
|
13
|
+
icon,
|
|
14
|
+
busy: t1,
|
|
15
|
+
title,
|
|
16
|
+
children,
|
|
17
|
+
action,
|
|
18
|
+
className,
|
|
19
|
+
ref
|
|
20
|
+
} = t0;
|
|
21
|
+
const busy = t1 === undefined ? false : t1;
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[0] !== className) {
|
|
24
|
+
t2 = clsx("flex flex-col items-center justify-center gap-2 px-6 py-8 text-center", className);
|
|
25
|
+
$[0] = className;
|
|
26
|
+
$[1] = t2;
|
|
27
|
+
} else {
|
|
28
|
+
t2 = $[1];
|
|
29
|
+
}
|
|
30
|
+
let t3;
|
|
31
|
+
if ($[2] !== busy || $[3] !== icon) {
|
|
32
|
+
t3 = (busy || icon) && /*#__PURE__*/_jsx("span", {
|
|
33
|
+
className: "text-text-faint",
|
|
34
|
+
children: busy ? /*#__PURE__*/_jsx(Spinner, {
|
|
35
|
+
size: ICON_SIZE
|
|
36
|
+
}) : isValidElement(icon) ? cloneElement(icon, {
|
|
37
|
+
size: ICON_SIZE
|
|
38
|
+
}) : icon && /*#__PURE__*/_jsx(Icon, {
|
|
39
|
+
icon: icon,
|
|
40
|
+
size: ICON_SIZE
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
$[2] = busy;
|
|
44
|
+
$[3] = icon;
|
|
45
|
+
$[4] = t3;
|
|
46
|
+
} else {
|
|
47
|
+
t3 = $[4];
|
|
48
|
+
}
|
|
49
|
+
let t4;
|
|
50
|
+
if ($[5] !== title) {
|
|
51
|
+
t4 = title && /*#__PURE__*/_jsx("p", {
|
|
52
|
+
className: "text-sm font-medium text-text",
|
|
53
|
+
children: title
|
|
54
|
+
});
|
|
55
|
+
$[5] = title;
|
|
56
|
+
$[6] = t4;
|
|
57
|
+
} else {
|
|
58
|
+
t4 = $[6];
|
|
59
|
+
}
|
|
60
|
+
let t5;
|
|
61
|
+
if ($[7] !== children) {
|
|
62
|
+
t5 = /*#__PURE__*/_jsx("p", {
|
|
63
|
+
className: "max-w-[280px] text-xs leading-snug text-text-muted",
|
|
64
|
+
children: children
|
|
65
|
+
});
|
|
66
|
+
$[7] = children;
|
|
67
|
+
$[8] = t5;
|
|
68
|
+
} else {
|
|
69
|
+
t5 = $[8];
|
|
70
|
+
}
|
|
71
|
+
let t6;
|
|
72
|
+
if ($[9] !== action) {
|
|
73
|
+
t6 = action && /*#__PURE__*/_jsx("div", {
|
|
74
|
+
className: "mt-2",
|
|
75
|
+
children: action
|
|
76
|
+
});
|
|
77
|
+
$[9] = action;
|
|
78
|
+
$[10] = t6;
|
|
79
|
+
} else {
|
|
80
|
+
t6 = $[10];
|
|
81
|
+
}
|
|
82
|
+
let t7;
|
|
83
|
+
if ($[11] !== ref || $[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== t5 || $[16] !== t6) {
|
|
84
|
+
t7 = /*#__PURE__*/_jsxs("div", {
|
|
85
|
+
ref: ref,
|
|
86
|
+
className: t2,
|
|
87
|
+
children: [t3, t4, t5, t6]
|
|
88
|
+
});
|
|
89
|
+
$[11] = ref;
|
|
90
|
+
$[12] = t2;
|
|
91
|
+
$[13] = t3;
|
|
92
|
+
$[14] = t4;
|
|
93
|
+
$[15] = t5;
|
|
94
|
+
$[16] = t6;
|
|
95
|
+
$[17] = t7;
|
|
96
|
+
} else {
|
|
97
|
+
t7 = $[17];
|
|
98
|
+
}
|
|
99
|
+
return t7;
|
|
100
|
+
}
|
package/dist/ErrorBoundary.js
CHANGED
|
@@ -1,47 +1,270 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { Component } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { Copy, RotateCw, TriangleAlert } from 'lucide-react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { Button } from
|
|
7
|
-
import { ButtonGroup } from
|
|
6
|
+
import { Button } from "./Button.js";
|
|
7
|
+
import { ButtonGroup } from "./ButtonGroup.js";
|
|
8
8
|
import { copyText } from './clipboard.js';
|
|
9
9
|
import { errorMessageOf, errorReport, shouldReset } from './error-boundary.js';
|
|
10
|
-
import { Icon } from
|
|
11
|
-
import { IconButton } from
|
|
12
|
-
|
|
10
|
+
import { Icon } from "./Icon.js";
|
|
11
|
+
import { IconButton } from "./IconButton.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const CLEAR = {
|
|
14
|
+
error: null,
|
|
15
|
+
failed: false,
|
|
16
|
+
componentStack: null
|
|
17
|
+
};
|
|
13
18
|
/* A function component, so the words come from the i18next instance the app renders with. */
|
|
14
|
-
function ErrorFallback(
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
function ErrorFallback(t0) {
|
|
20
|
+
const $ = _c(46);
|
|
21
|
+
const {
|
|
22
|
+
label,
|
|
23
|
+
error,
|
|
24
|
+
componentStack,
|
|
25
|
+
compact,
|
|
26
|
+
reload,
|
|
27
|
+
className,
|
|
28
|
+
onRetry
|
|
29
|
+
} = t0;
|
|
30
|
+
const {
|
|
31
|
+
t
|
|
32
|
+
} = useTranslation("ui");
|
|
33
|
+
const t1 = compact ? "p-3" : "p-6";
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[0] !== className || $[1] !== t1) {
|
|
36
|
+
t2 = clsx("grid place-items-center overflow-auto bg-surface", t1, className);
|
|
37
|
+
$[0] = className;
|
|
38
|
+
$[1] = t1;
|
|
39
|
+
$[2] = t2;
|
|
40
|
+
} else {
|
|
41
|
+
t2 = $[2];
|
|
42
|
+
}
|
|
43
|
+
const t3 = compact ? "gap-1" : "gap-2";
|
|
44
|
+
let t4;
|
|
45
|
+
if ($[3] !== t3) {
|
|
46
|
+
t4 = clsx("flex max-w-[360px] flex-col items-center text-center", t3);
|
|
47
|
+
$[3] = t3;
|
|
48
|
+
$[4] = t4;
|
|
49
|
+
} else {
|
|
50
|
+
t4 = $[4];
|
|
51
|
+
}
|
|
52
|
+
let t5;
|
|
53
|
+
if ($[5] !== compact) {
|
|
54
|
+
t5 = !compact && /*#__PURE__*/_jsx(Icon, {
|
|
55
|
+
icon: TriangleAlert,
|
|
56
|
+
size: 20,
|
|
57
|
+
className: "text-status-error"
|
|
58
|
+
});
|
|
59
|
+
$[5] = compact;
|
|
60
|
+
$[6] = t5;
|
|
61
|
+
} else {
|
|
62
|
+
t5 = $[6];
|
|
63
|
+
}
|
|
64
|
+
let t6;
|
|
65
|
+
if ($[7] !== label) {
|
|
66
|
+
t6 = /*#__PURE__*/_jsx("p", {
|
|
67
|
+
className: "text-sm font-medium text-text",
|
|
68
|
+
children: label
|
|
69
|
+
});
|
|
70
|
+
$[7] = label;
|
|
71
|
+
$[8] = t6;
|
|
72
|
+
} else {
|
|
73
|
+
t6 = $[8];
|
|
74
|
+
}
|
|
75
|
+
let t7;
|
|
76
|
+
if ($[9] !== error) {
|
|
77
|
+
t7 = errorMessageOf(error);
|
|
78
|
+
$[9] = error;
|
|
79
|
+
$[10] = t7;
|
|
80
|
+
} else {
|
|
81
|
+
t7 = $[10];
|
|
82
|
+
}
|
|
83
|
+
let t8;
|
|
84
|
+
if ($[11] !== t7) {
|
|
85
|
+
t8 = /*#__PURE__*/_jsx("p", {
|
|
86
|
+
className: "line-clamp-4 text-xs break-words text-text-muted",
|
|
87
|
+
children: t7
|
|
88
|
+
});
|
|
89
|
+
$[11] = t7;
|
|
90
|
+
$[12] = t8;
|
|
91
|
+
} else {
|
|
92
|
+
t8 = $[12];
|
|
93
|
+
}
|
|
94
|
+
const t9 = compact ? "mt-1" : "mt-2";
|
|
95
|
+
let t10;
|
|
96
|
+
if ($[13] !== t9) {
|
|
97
|
+
t10 = clsx("flex items-center gap-2", t9);
|
|
98
|
+
$[13] = t9;
|
|
99
|
+
$[14] = t10;
|
|
100
|
+
} else {
|
|
101
|
+
t10 = $[14];
|
|
102
|
+
}
|
|
103
|
+
let t11;
|
|
104
|
+
if ($[15] !== t) {
|
|
105
|
+
t11 = t("action.retry");
|
|
106
|
+
$[15] = t;
|
|
107
|
+
$[16] = t11;
|
|
108
|
+
} else {
|
|
109
|
+
t11 = $[16];
|
|
110
|
+
}
|
|
111
|
+
let t12;
|
|
112
|
+
if ($[17] !== onRetry || $[18] !== t11) {
|
|
113
|
+
t12 = /*#__PURE__*/_jsx(Button, {
|
|
114
|
+
variant: "secondary",
|
|
115
|
+
size: "sm",
|
|
116
|
+
onClick: onRetry,
|
|
117
|
+
children: t11
|
|
118
|
+
});
|
|
119
|
+
$[17] = onRetry;
|
|
120
|
+
$[18] = t11;
|
|
121
|
+
$[19] = t12;
|
|
122
|
+
} else {
|
|
123
|
+
t12 = $[19];
|
|
124
|
+
}
|
|
125
|
+
let t13;
|
|
126
|
+
if ($[20] !== reload || $[21] !== t) {
|
|
127
|
+
t13 = reload && /*#__PURE__*/_jsxs(Button, {
|
|
128
|
+
variant: "secondary",
|
|
129
|
+
size: "sm",
|
|
130
|
+
onClick: _temp,
|
|
131
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
132
|
+
icon: RotateCw,
|
|
133
|
+
size: 14
|
|
134
|
+
}), t("action.reload")]
|
|
135
|
+
});
|
|
136
|
+
$[20] = reload;
|
|
137
|
+
$[21] = t;
|
|
138
|
+
$[22] = t13;
|
|
139
|
+
} else {
|
|
140
|
+
t13 = $[22];
|
|
141
|
+
}
|
|
142
|
+
let t14;
|
|
143
|
+
if ($[23] !== t) {
|
|
144
|
+
t14 = t("action.copyError");
|
|
145
|
+
$[23] = t;
|
|
146
|
+
$[24] = t14;
|
|
147
|
+
} else {
|
|
148
|
+
t14 = $[24];
|
|
149
|
+
}
|
|
150
|
+
let t15;
|
|
151
|
+
if ($[25] !== componentStack || $[26] !== error || $[27] !== label) {
|
|
152
|
+
t15 = () => copyText(errorReport(label, error, componentStack));
|
|
153
|
+
$[25] = componentStack;
|
|
154
|
+
$[26] = error;
|
|
155
|
+
$[27] = label;
|
|
156
|
+
$[28] = t15;
|
|
157
|
+
} else {
|
|
158
|
+
t15 = $[28];
|
|
159
|
+
}
|
|
160
|
+
let t16;
|
|
161
|
+
if ($[29] !== t14 || $[30] !== t15) {
|
|
162
|
+
t16 = /*#__PURE__*/_jsx(ButtonGroup, {
|
|
163
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
164
|
+
icon: Copy,
|
|
165
|
+
size: "sm",
|
|
166
|
+
label: t14,
|
|
167
|
+
onClick: t15
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
$[29] = t14;
|
|
171
|
+
$[30] = t15;
|
|
172
|
+
$[31] = t16;
|
|
173
|
+
} else {
|
|
174
|
+
t16 = $[31];
|
|
175
|
+
}
|
|
176
|
+
let t17;
|
|
177
|
+
if ($[32] !== t10 || $[33] !== t12 || $[34] !== t13 || $[35] !== t16) {
|
|
178
|
+
t17 = /*#__PURE__*/_jsxs("div", {
|
|
179
|
+
className: t10,
|
|
180
|
+
children: [t12, t13, t16]
|
|
181
|
+
});
|
|
182
|
+
$[32] = t10;
|
|
183
|
+
$[33] = t12;
|
|
184
|
+
$[34] = t13;
|
|
185
|
+
$[35] = t16;
|
|
186
|
+
$[36] = t17;
|
|
187
|
+
} else {
|
|
188
|
+
t17 = $[36];
|
|
189
|
+
}
|
|
190
|
+
let t18;
|
|
191
|
+
if ($[37] !== t17 || $[38] !== t4 || $[39] !== t5 || $[40] !== t6 || $[41] !== t8) {
|
|
192
|
+
t18 = /*#__PURE__*/_jsxs("div", {
|
|
193
|
+
className: t4,
|
|
194
|
+
children: [t5, t6, t8, t17]
|
|
195
|
+
});
|
|
196
|
+
$[37] = t17;
|
|
197
|
+
$[38] = t4;
|
|
198
|
+
$[39] = t5;
|
|
199
|
+
$[40] = t6;
|
|
200
|
+
$[41] = t8;
|
|
201
|
+
$[42] = t18;
|
|
202
|
+
} else {
|
|
203
|
+
t18 = $[42];
|
|
204
|
+
}
|
|
205
|
+
let t19;
|
|
206
|
+
if ($[43] !== t18 || $[44] !== t2) {
|
|
207
|
+
t19 = /*#__PURE__*/_jsx("div", {
|
|
208
|
+
role: "alert",
|
|
209
|
+
className: t2,
|
|
210
|
+
children: t18
|
|
211
|
+
});
|
|
212
|
+
$[43] = t18;
|
|
213
|
+
$[44] = t2;
|
|
214
|
+
$[45] = t19;
|
|
215
|
+
} else {
|
|
216
|
+
t19 = $[45];
|
|
217
|
+
}
|
|
218
|
+
return t19;
|
|
17
219
|
}
|
|
18
220
|
/*
|
|
19
221
|
* Keeps a render failure to the subtree it happened in. Without one React unmounts the whole tree,
|
|
20
222
|
* and whatever lives in it (an embedded page, a running terminal) goes down with it. Key it so it
|
|
21
223
|
* resets only while it holds an error: `resetKeys` for what the children draw from.
|
|
22
224
|
*/
|
|
225
|
+
function _temp() {
|
|
226
|
+
return window.location.reload();
|
|
227
|
+
}
|
|
23
228
|
export class ErrorBoundary extends Component {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
229
|
+
state = CLEAR;
|
|
230
|
+
static getDerivedStateFromError(error) {
|
|
231
|
+
return {
|
|
232
|
+
error,
|
|
233
|
+
failed: true
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
componentDidCatch(error, info) {
|
|
237
|
+
console.error(`${this.props.label}:`, error, info.componentStack);
|
|
238
|
+
this.setState({
|
|
239
|
+
componentStack: info.componentStack ?? null
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
componentDidUpdate(previous) {
|
|
243
|
+
if (shouldReset(this.state.failed, previous.resetKeys ?? [], this.props.resetKeys ?? [])) {
|
|
244
|
+
this.reset();
|
|
31
245
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
246
|
+
}
|
|
247
|
+
reset() {
|
|
248
|
+
this.setState(CLEAR);
|
|
249
|
+
}
|
|
250
|
+
render() {
|
|
251
|
+
if (!this.state.failed) {
|
|
252
|
+
return this.props.children;
|
|
36
253
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
254
|
+
const {
|
|
255
|
+
label,
|
|
256
|
+
compact = false,
|
|
257
|
+
reload = false,
|
|
258
|
+
className = 'absolute inset-0'
|
|
259
|
+
} = this.props;
|
|
260
|
+
return /*#__PURE__*/_jsx(ErrorFallback, {
|
|
261
|
+
label: label,
|
|
262
|
+
error: this.state.error,
|
|
263
|
+
componentStack: this.state.componentStack,
|
|
264
|
+
compact: compact,
|
|
265
|
+
reload: reload,
|
|
266
|
+
className: className,
|
|
267
|
+
onRetry: () => this.reset()
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|