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 {
|
|
|
|
cursor: pointer;
|
|
|
|
width: 130px;
|
|
|
|
height: 100%;
|
|
|
|
position: absolute;
|
|
|
|
box-sizing: border-box;
|
|
|
|
cursor: pointer;
|
|
|
|
font-weight: bold;
|
|
|
|
color: var(--secondary-text-color);
|
|
|
|
white-space: nowrap;
|
|
|
|
border-top: 2px solid transparent;
|
|
|
|
background-color: rgba(0, 8, 3, 0);
|
|
|
|
|
|
|
|
&.animate {
|
|
|
|
transition:
|
|
|
|
transform 0.3s ease,
|
|
|
|
background-color 0.3s ease-in-out;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
border-top: 2px solid var(--tab-green);
|
|
|
|
background-color: var(--tab-green);
|
|
|
|
}
|
|
|
|
|
|
|
|
.name {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 50%;
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
-webkit-user-select: none;
|
|
|
|
z-index: 3;
|
2024-06-21 19:23:04 +02:00
|
|
|
|
|
|
|
&.focused {
|
|
|
|
outline: none;
|
|
|
|
border: 1px solid var(--border-color);
|
|
|
|
padding: 2px 6px;
|
|
|
|
border-radius: 2px;
|
|
|
|
}
|
2024-06-18 06:50:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.vertical-line {
|
|
|
|
display: inline;
|
|
|
|
width: 1px;
|
|
|
|
height: 50%;
|
|
|
|
position: absolute;
|
|
|
|
right: -1px;
|
|
|
|
top: 50%;
|
|
|
|
z-index: 1;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
background-color: var(--border-color);
|
|
|
|
}
|
|
|
|
|
|
|
|
.close {
|
|
|
|
visibility: hidden;
|
|
|
|
position: absolute;
|
|
|
|
width: 20px;
|
|
|
|
height: 20px;
|
|
|
|
padding: 0;
|
2024-05-14 00:10:31 +02:00
|
|
|
display: flex;
|
2024-06-18 06:50:33 +02:00
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
cursor: pointer;
|
|
|
|
top: 50%;
|
|
|
|
z-index: 3;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
right: 5px;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
border: 1px solid var(--border-color);
|
|
|
|
border-radius: 2px;
|
|
|
|
}
|
|
|
|
|
|
|
|
i {
|
|
|
|
color: var(--secondary-text-color);
|
|
|
|
}
|
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-06-18 06:50:33 +02:00
|
|
|
&:hover .close {
|
|
|
|
visibility: visible;
|
|
|
|
}
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
.vertical-line {
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
.mask {
|
|
|
|
position: absolute;
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
z-index: 2;
|
|
|
|
background-image: linear-gradient(
|
|
|
|
to top,
|
|
|
|
rgba(0, 0, 0, 0.9) 20%,
|
|
|
|
rgba(0, 0, 0, 0.8) 60%,
|
|
|
|
rgba(0, 0, 0, 0.7) 100%
|
|
|
|
);
|
2024-06-21 19:23:04 +02:00
|
|
|
pointer-events: none;
|
2024-06-18 06:50:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
&.isDragging:not(.active) {
|
|
|
|
background-color: rgba(0, 8, 3, 1);
|
|
|
|
}
|
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
|
|
|
}
|