@opencode-ai/ui 0.0.0-dev-202607170855 → 0.0.0-dev-202607170943
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.
|
@@ -7,6 +7,8 @@ export interface ResizeHandleProps extends Omit<JSX.HTMLAttributes<HTMLDivElemen
|
|
|
7
7
|
max: number;
|
|
8
8
|
onResize: (size: number) => void;
|
|
9
9
|
onCollapse?: () => void;
|
|
10
|
+
/** Called while dragging when size crosses `collapseThreshold`. */
|
|
11
|
+
onCollapseChange?: (collapsed: boolean) => void;
|
|
10
12
|
collapseThreshold?: number;
|
|
11
13
|
}
|
|
12
14
|
export declare function ResizeHandle(props: ResizeHandleProps): JSX.Element;
|
package/package.json
CHANGED
|
@@ -8,6 +8,8 @@ export interface ResizeHandleProps extends Omit<JSX.HTMLAttributes<HTMLDivElemen
|
|
|
8
8
|
max: number
|
|
9
9
|
onResize: (size: number) => void
|
|
10
10
|
onCollapse?: () => void
|
|
11
|
+
/** Called while dragging when size crosses `collapseThreshold`. */
|
|
12
|
+
onCollapseChange?: (collapsed: boolean) => void
|
|
11
13
|
collapseThreshold?: number
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -20,17 +22,26 @@ export function ResizeHandle(props: ResizeHandleProps) {
|
|
|
20
22
|
"max",
|
|
21
23
|
"onResize",
|
|
22
24
|
"onCollapse",
|
|
25
|
+
"onCollapseChange",
|
|
23
26
|
"collapseThreshold",
|
|
24
27
|
"class",
|
|
25
28
|
"classList",
|
|
26
29
|
])
|
|
27
30
|
|
|
28
31
|
const handleMouseDown = (e: MouseEvent) => {
|
|
32
|
+
if (e.detail > 1) return
|
|
29
33
|
e.preventDefault()
|
|
30
34
|
const edge = local.edge ?? (local.direction === "vertical" ? "start" : "end")
|
|
31
35
|
const start = local.direction === "horizontal" ? e.clientX : e.clientY
|
|
32
36
|
const startSize = local.size
|
|
37
|
+
const min = local.min
|
|
38
|
+
const max = local.max
|
|
39
|
+
const threshold = local.collapseThreshold ?? 0
|
|
40
|
+
const onResize = local.onResize
|
|
41
|
+
const onCollapse = local.onCollapse
|
|
42
|
+
const onCollapseChange = local.onCollapseChange
|
|
33
43
|
let current = startSize
|
|
44
|
+
let collapsed = false
|
|
34
45
|
|
|
35
46
|
document.body.style.userSelect = "none"
|
|
36
47
|
document.body.style.overflow = "hidden"
|
|
@@ -46,8 +57,12 @@ export function ResizeHandle(props: ResizeHandleProps) {
|
|
|
46
57
|
? start - pos
|
|
47
58
|
: pos - start
|
|
48
59
|
current = startSize + delta
|
|
49
|
-
const
|
|
50
|
-
|
|
60
|
+
const nextCollapsed = threshold > 0 && current < threshold
|
|
61
|
+
if (nextCollapsed !== collapsed) {
|
|
62
|
+
collapsed = nextCollapsed
|
|
63
|
+
onCollapseChange?.(collapsed)
|
|
64
|
+
}
|
|
65
|
+
onResize(Math.min(max, Math.max(min, current)))
|
|
51
66
|
}
|
|
52
67
|
|
|
53
68
|
const onMouseUp = () => {
|
|
@@ -56,10 +71,11 @@ export function ResizeHandle(props: ResizeHandleProps) {
|
|
|
56
71
|
document.removeEventListener("mousemove", onMouseMove)
|
|
57
72
|
document.removeEventListener("mouseup", onMouseUp)
|
|
58
73
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
if (collapsed) {
|
|
75
|
+
onCollapse?.()
|
|
76
|
+
return
|
|
62
77
|
}
|
|
78
|
+
onCollapseChange?.(false)
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
document.addEventListener("mousemove", onMouseMove)
|
package/src/components/tabs.css
CHANGED
|
@@ -723,7 +723,11 @@ body[data-new-layout] #review-panel [data-component="tabs"][data-variant="normal
|
|
|
723
723
|
}
|
|
724
724
|
|
|
725
725
|
&:has([data-slot="tabs-trigger-close-button"]) {
|
|
726
|
-
padding-right:
|
|
726
|
+
padding-right: 8px;
|
|
727
|
+
|
|
728
|
+
[data-slot="tabs-trigger-close-button"] {
|
|
729
|
+
margin-left: 2px;
|
|
730
|
+
}
|
|
727
731
|
}
|
|
728
732
|
|
|
729
733
|
&:has([data-selected]) {
|
|
@@ -789,6 +793,62 @@ body[data-new-layout]
|
|
|
789
793
|
[data-slot="tabs-list"]
|
|
790
794
|
> .sticky {
|
|
791
795
|
padding-right: 0;
|
|
796
|
+
|
|
797
|
+
[data-component="icon-button-v2"] {
|
|
798
|
+
position: relative;
|
|
799
|
+
|
|
800
|
+
&::after {
|
|
801
|
+
content: "";
|
|
802
|
+
position: absolute;
|
|
803
|
+
left: 100%;
|
|
804
|
+
top: 50%;
|
|
805
|
+
transform: translateY(-50%);
|
|
806
|
+
width: 20px;
|
|
807
|
+
height: 28px;
|
|
808
|
+
background-color: var(--v2-background-bg-base);
|
|
809
|
+
pointer-events: none;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
body[data-new-layout]
|
|
815
|
+
#review-panel
|
|
816
|
+
[data-component="tabs"]
|
|
817
|
+
.session-review-v2-tabs-bar
|
|
818
|
+
[data-slot="tabs-list"]
|
|
819
|
+
> .session-review-v2-sidebar-toggle-slot.sticky {
|
|
820
|
+
padding-right: 0;
|
|
821
|
+
|
|
822
|
+
&::before {
|
|
823
|
+
content: "";
|
|
824
|
+
position: absolute;
|
|
825
|
+
top: 50%;
|
|
826
|
+
bottom: auto;
|
|
827
|
+
left: auto;
|
|
828
|
+
right: 100%;
|
|
829
|
+
transform: translateY(-50%);
|
|
830
|
+
width: 12px;
|
|
831
|
+
height: 28px;
|
|
832
|
+
background-color: var(--v2-background-bg-base);
|
|
833
|
+
background-image: none;
|
|
834
|
+
pointer-events: none;
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
&::after {
|
|
838
|
+
content: "";
|
|
839
|
+
position: absolute;
|
|
840
|
+
top: 50%;
|
|
841
|
+
left: 100%;
|
|
842
|
+
transform: translateY(-50%);
|
|
843
|
+
width: 8px;
|
|
844
|
+
height: 28px;
|
|
845
|
+
pointer-events: none;
|
|
846
|
+
background: linear-gradient(90deg, var(--v2-background-bg-base), transparent);
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
[data-component="icon-button-v2"]::after {
|
|
850
|
+
display: none;
|
|
851
|
+
}
|
|
792
852
|
}
|
|
793
853
|
|
|
794
854
|
body[data-new-layout] #review-panel [data-component="tabs"] .session-review-v2-open-in-app-slot {
|