waveterm/frontend/layout/lib/tilelayout.less

135 lines
3.1 KiB
Plaintext
Raw Normal View History

// Copyright 2024, Command Line Inc.
// SPDX-License-Identifier: Apache-2.0
.tile-layout {
position: relative;
height: 100%;
width: 100%;
overflow: hidden;
--gap-size-px: 5px;
.overlay-container,
.display-container,
.placeholder-container {
position: absolute;
display: flex;
top: 0;
left: 0;
height: 100%;
width: 100%;
min-height: 4rem;
min-width: 4rem;
}
.display-container {
z-index: var(--zindex-layout-display-container);
}
.placeholder-container {
z-index: var(--zindex-layout-placeholder-container);
}
.overlay-container {
z-index: var(--zindex-layout-overlay-container);
}
.overlay-node {
display: flex;
flex: 0 1 auto;
}
.resize-handle {
z-index: var(--zindex-layout-resize-handle);
.line {
visibility: hidden;
}
&.flex-row {
cursor: ew-resize;
.line {
height: 100%;
margin-left: calc(var(--gap-size-px) - 1px);
border-left: 2px solid var(--accent-color);
}
}
&.flex-column {
cursor: ns-resize;
.line {
margin-top: calc(var(--gap-size-px) - 1px);
border-bottom: 2px solid var(--accent-color);
}
}
&:hover .line {
visibility: visible;
2024-08-30 21:45:12 +02:00
transition: visibility 0s var(--animation-time-s);
}
}
.tile-node {
border-radius: calc(var(--block-border-radius) + 2px);
overflow: hidden;
width: 100%;
height: 100%;
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
&.dragging {
filter: blur(8px);
}
&.magnified {
background-color: var(--block-bg-solid-color);
z-index: var(--zindex-layout-magnified-node);
}
&.last-magnified {
z-index: var(--zindex-layout-last-magnified-node);
}
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
.tile-preview-container {
position: absolute;
top: 10000px;
2024-06-11 23:51:35 +02:00
white-space: nowrap !important;
user-select: none;
-webkit-user-select: none;
.tile-preview {
width: 100%;
height: 100%;
}
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
}
&.resizing {
border: 1px solid var(--accent-color);
backdrop-filter: blur(8px);
}
.tile-leaf {
overflow: hidden;
}
&:not(:only-child) .tile-leaf {
padding: calc(var(--gap-size-px) / 2);
}
}
&.animate {
.tile-node,
.placeholder {
transition-duration: var(--animation-time-s);
transition-timing-function: linear;
transition-property: transform, width, height, background-color;
}
}
.tile-leaf,
.overlay-leaf {
height: 100%;
width: 100%;
}
.placeholder {
background-color: var(--accent-color);
opacity: 0.5;
border-radius: calc(var(--block-border-radius) + 2px);
}
}