2024-05-14 00:10:31 +02:00
// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
2024-06-18 06:50:33 +02:00
. tab {
2024-07-09 00:02:52 +02:00
position : absolute ;
2024-12-04 22:49:14 +01:00
width : 130 px ;
height : calc ( 100 % - 1 px ) ;
2024-12-10 21:50:58 +01:00
padding : 0 0 0 0 ;
2024-12-04 22:49:14 +01:00
box-sizing : border-box ;
font-weight : bold ;
color : var ( -- secondary-text-color ) ;
opacity : 0 ;
display : flex ;
align-items : center ;
justify-content : center ;
& : : after {
content : " " ;
position : absolute ;
left : 0 ;
width : 1 px ;
height : 14 px ;
border-right : 1 px solid rgb ( from var ( -- main-text-color ) r g b / 0 .2 ) ;
}
2024-07-06 04:54:28 +02:00
. tab-inner {
2024-12-04 22:49:14 +01:00
position : relative ;
width : calc ( 100 % - 6 px ) ;
height : 100 % ;
white-space : nowrap ;
border-radius : 6 px ;
2024-07-06 04:54:28 +02:00
}
2024-06-18 06:50:33 +02:00
2024-12-04 22:49:14 +01:00
& . animate {
transition :
transform 0 . 3s ease ,
background-color 0 . 3s ease-in-out ;
2024-06-18 06:50:33 +02:00
}
2024-12-04 22:49:14 +01:00
& . active {
. tab-inner {
border-color : transparent ;
border-radius : 6 px ;
2024-12-10 01:24:32 +01:00
background : rgb ( from var ( -- main-text-color ) r g b / 0 .1 ) ;
2024-12-04 22:49:14 +01:00
}
. name {
color : var ( -- main-text-color ) ;
}
& + . tab : : after ,
& : : after {
content : none ;
}
2024-06-18 06:50:33 +02:00
}
2024-12-04 22:49:14 +01:00
& : first-child : : after {
content : none ;
}
2024-06-18 06:50:33 +02:00
2024-12-04 22:49:14 +01:00
. name {
position : absolute ;
top : 50 % ;
left : 50 % ;
transform : translate3d ( - 50 % , - 50 % , 0 ) ;
user-select : none ;
z-index : var ( -- zindex-tab-name ) ;
font-size : 11 px ;
font-weight : 500 ;
text-shadow : 0 px 0 px 4 px rgb ( from var ( -- main-bg-color ) r g b / 0 .25 ) ;
overflow : hidden ;
width : calc ( 100 % - 10 px ) ;
text-overflow : ellipsis ;
text-align : center ;
& . focused {
outline : none ;
border : 1 px solid rgb ( from var ( -- main-text-color ) r g b / 0 .179 ) ;
padding : 2 px 6 px ;
border-radius : 2 px ;
}
2024-05-14 00:10:31 +02:00
}
Implement outer drop direction, add rudimentary drag preview image rendering (#29)
This PR adds support for Outer variants of each DropDirection.
When calculating the drop direction, the cursor position is calculated
relevant to the box over which it is hovering. The following diagram
shows how drop directions are calculated. The colored in center is
currently not supported, it is assigned to the top, bottom, left, right
direction for now, though it will ultimately be its own distinct
direction.
![IMG_3505](https://github.com/wavetermdev/thenextwave/assets/16651283/a7ea7387-b95d-4831-9e29-d3225b824c97)
When an outer drop direction is provided for a move operation, if the
reference node flexes in the same axis as the drop direction, the new
node will be inserted at the same level as the parent of the reference
node. If the reference node flexes in a different direction or the
reference node does not have a grandparent, the operation will fall back
to its non-Outer variant.
This also removes some chatty debug statements, adds a blur to the
currently-dragging node to indicate that it cannot be dropped onto, and
simplifies the deriving of the layout state atom from the tab atom so
there's no longer another intermediate derived atom for the layout node.
This also adds rudimentary support for rendering custom preview images
for any tile being dragged. Right now, this is a simple block containing
the block ID, but this can be anything. This resolves an issue where
letting React-DnD generate its own previews could take up to a half
second, and would block dragging until complete. For Monaco, this was
outright failing.
It also fixes an issue where the tile layout could animate on first
paint. Now, I use React Suspense to prevent the layout from displaying
until all the children have loaded.
2024-06-11 22:03:41 +02:00
2024-12-04 22:49:14 +01:00
. button {
position : absolute ;
top : 50 % ;
right : 4 px ;
transform : translate3d ( 0 , - 50 % , 0 ) ;
width : 20 px ;
height : 20 px ;
display : flex ;
align-items : center ;
justify-content : center ;
cursor : pointer ;
z-index : var ( -- zindex-tab-name ) ;
padding : 1 px 2 px ;
transition : none !important ;
}
. close {
visibility : hidden ;
}
2024-12-04 05:08:06 +01:00
}
2024-10-28 07:01:47 +01:00
2024-12-05 02:20:06 +01:00
// Only apply hover effects when not in nohover mode. This prevents the previously-hovered tab from remaining hovered while a tab view is not mounted.
2024-12-10 20:41:37 +01:00
body : not ( . nohover ) . tab : hover ,
body : not ( . nohover ) . tab . dragging {
2024-12-04 22:49:14 +01:00
& + . tab : : after ,
& : : after {
content : none ;
}
. tab-inner {
border-color : transparent ;
2024-12-10 01:24:32 +01:00
background : rgb ( from var ( -- main-text-color ) r g b / 0 .1 ) ;
2024-12-04 22:49:14 +01:00
}
. close {
visibility : visible ;
& : hover {
color : var ( -- main-text-color ) ;
}
2024-06-18 06:50:33 +02:00
}
Implement outer drop direction, add rudimentary drag preview image rendering (#29)
This PR adds support for Outer variants of each DropDirection.
When calculating the drop direction, the cursor position is calculated
relevant to the box over which it is hovering. The following diagram
shows how drop directions are calculated. The colored in center is
currently not supported, it is assigned to the top, bottom, left, right
direction for now, though it will ultimately be its own distinct
direction.
![IMG_3505](https://github.com/wavetermdev/thenextwave/assets/16651283/a7ea7387-b95d-4831-9e29-d3225b824c97)
When an outer drop direction is provided for a move operation, if the
reference node flexes in the same axis as the drop direction, the new
node will be inserted at the same level as the parent of the reference
node. If the reference node flexes in a different direction or the
reference node does not have a grandparent, the operation will fall back
to its non-Outer variant.
This also removes some chatty debug statements, adds a blur to the
currently-dragging node to indicate that it cannot be dropped onto, and
simplifies the deriving of the layout state atom from the tab atom so
there's no longer another intermediate derived atom for the layout node.
This also adds rudimentary support for rendering custom preview images
for any tile being dragged. Right now, this is a simple block containing
the block ID, but this can be anything. This resolves an issue where
letting React-DnD generate its own previews could take up to a half
second, and would block dragging until complete. For Monaco, this was
outright failing.
It also fixes an issue where the tile layout could animate on first
paint. Now, I use React Suspense to prevent the layout from displaying
until all the children have loaded.
2024-06-11 22:03:41 +02:00
}
2024-07-31 21:54:43 +02:00
2024-12-05 02:20:06 +01:00
// When in nohover mode, always show the close button on the active tab. This prevents the close button of the active tab from flickering when nohover is toggled.
body . nohover . tab . active . close {
visibility : visible ;
}
2024-07-31 21:54:43 +02:00
@keyframes expandWidthAndFadeIn {
2024-12-04 22:49:14 +01:00
from {
width : var ( -- initial - tab-width ) ;
opacity : 0 ;
}
to {
width : var ( -- final-tab-width ) ;
opacity : 1 ;
}
2024-07-31 21:54:43 +02:00
}
. tab . new-tab {
2024-12-04 22:49:14 +01:00
animation : expandWidthAndFadeIn 0 .1 s forwards ;
2024-07-31 21:54:43 +02:00
}