Spaces:
Paused
Paused
Download console/src/pages/Coding/TabbedEditor.module.less from mysticaldragon/HF: direct link, hf CLI and curl.
- Browser
- Download file 19.6 kB
-
https://huggingface.co/spaces/mysticaldragon/HF/resolve/main/console/src/pages/Coding/TabbedEditor.module.less
- Command line
-
hf download hf://spaces/mysticaldragon/HF/console/src/pages/Coding/TabbedEditor.module.less
-
curl -L -o TabbedEditor.module.less https://huggingface.co/spaces/mysticaldragon/HF/resolve/main/console/src/pages/Coding/TabbedEditor.module.less
19.6 kB
.wrap {
height: 100%;
display: flex;
flex-direction: column;
container-type: inline-size;
background: var(--body-background, #fff);
overflow: hidden;
}
// ---- Tab bar ---------------------------------------------------------------
.tabBar {
position: relative;
display: flex;
align-items: stretch;
flex-shrink: 0;
min-width: 0;
height: 42px;
background: var(--header-background, #fafafa);
border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}
.tabViewport {
position: relative;
min-width: 0;
flex: 1;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
.tabRail {
width: max-content;
min-width: 100%;
height: 100%;
display: flex;
align-items: stretch;
}
.tab {
position: relative;
display: flex;
align-items: center;
gap: 6px;
min-width: 112px;
max-width: 176px;
flex: 0 1 176px;
padding: 0 9px 0 12px;
font-size: 11px;
font-family: "SFMono-Regular", Consolas, monospace;
color: var(--text-secondary, rgba(0, 0, 0, 0.45));
white-space: nowrap;
cursor: pointer;
border-right: 1px solid var(--border-color, rgba(0, 0, 0, 0.06));
background: transparent;
outline: none;
transition:
background 0.12s,
color 0.12s;
&:hover {
background: var(--item-hover-bg, rgba(0, 0, 0, 0.04));
color: var(--text-primary, rgba(0, 0, 0, 0.88));
}
&:focus-visible {
box-shadow: inset 0 0 0 2px
var(--files-accent-soft, rgba(243, 107, 33, 0.2));
}
}
.tabActive {
background: var(--body-background, #fff);
color: var(--text-primary, rgba(0, 0, 0, 0.88));
&::after {
content: "";
position: absolute;
right: 11px;
bottom: 0;
left: 11px;
height: 2px;
border-radius: 2px 2px 0 0;
background: var(--files-accent, #f36b21);
}
}
.tabName {
overflow: hidden;
text-overflow: ellipsis;
flex: 1;
min-width: 0;
}
.dirtyDot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--warning-color, #faad14);
flex-shrink: 0;
}
.diffDot {
color: var(--info-color, #13c2c2);
flex-shrink: 0;
}
.closeBtn {
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
border: none;
background: transparent;
cursor: pointer;
border-radius: 5px;
color: var(--text-tertiary, rgba(0, 0, 0, 0.25));
padding: 0;
flex-shrink: 0;
opacity: 0;
transition:
opacity 0.1s,
background 0.1s;
.tab:hover & {
opacity: 1;
}
.tabActive & {
opacity: 0.6;
}
&:hover {
background: var(--item-hover-bg, rgba(0, 0, 0, 0.08));
color: var(--text-primary, rgba(0, 0, 0, 0.88));
opacity: 1 !important;
}
}
.tabControls {
position: relative;
z-index: 4;
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 2px;
padding: 0 7px;
border-left: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
background: var(--header-background, #fafafa);
&::before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left: -32px;
width: 32px;
pointer-events: none;
background: linear-gradient(
90deg,
transparent,
var(--header-background, #fafafa)
);
}
}
.tabControlBtn,
.openFilesBtn {
height: 28px;
display: inline-flex;
align-items: center;
justify-content: center;
border: 0;
border-radius: 7px;
color: var(--text-secondary, rgba(0, 0, 0, 0.45));
background: transparent;
cursor: pointer;
transition:
color 0.12s,
background 0.12s,
border-color 0.12s;
&:hover {
color: var(--text-primary, rgba(0, 0, 0, 0.88));
background: var(--item-hover-bg, rgba(0, 0, 0, 0.05));
}
&:focus-visible {
outline: 2px solid var(--files-accent-soft, rgba(243, 107, 33, 0.25));
outline-offset: 1px;
}
}
.tabControlBtn {
width: 26px;
padding: 0;
}
.openFilesBtn {
position: relative;
gap: 6px;
padding: 0 7px;
border: 1px solid var(--border-color, rgba(0, 0, 0, 0.09));
background: var(--body-background, rgba(255, 255, 255, 0.72));
font-size: 11px;
}
.openFilesBtnActive {
color: var(--text-primary, rgba(0, 0, 0, 0.88));
border-color: var(--border-color, rgba(0, 0, 0, 0.16));
background: var(--body-background, #fff);
}
.openFilesLabel {
white-space: nowrap;
}
.tabCount {
min-width: 18px;
height: 18px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0 5px;
border-radius: 5px;
color: var(--text-secondary, rgba(0, 0, 0, 0.55));
background: var(--item-hover-bg, rgba(0, 0, 0, 0.06));
font-size: 10px;
font-weight: 600;
}
.openFilesPanel {
position: absolute;
z-index: 20;
top: calc(100% + 8px);
right: 8px;
width: min(390px, calc(100% - 16px));
max-height: min(520px, calc(100vh - 180px));
display: flex;
flex-direction: column;
overflow: hidden;
border: 1px solid var(--border-color, rgba(0, 0, 0, 0.14));
border-radius: 12px;
background: var(--body-background, #fff);
box-shadow: 0 20px 58px rgba(18, 24, 21, 0.18);
animation: openFilesIn 0.14s ease-out;
}
@media (hover: none) {
.closeBtn,
.openFileClose {
opacity: 0.6;
}
}
@keyframes openFilesIn {
from {
opacity: 0;
transform: translateY(-4px);
}
}
.openFilesHeader {
padding: 14px 14px 11px;
border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.07));
}
.openFilesTitleRow {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
strong {
color: var(--text-primary, rgba(0, 0, 0, 0.88));
font-size: 13px;
font-weight: 600;
}
span {
color: var(--text-tertiary, rgba(0, 0, 0, 0.35));
font-size: 10px;
}
}
.openFilesSearch {
position: relative;
display: block;
> svg {
position: absolute;
z-index: 1;
top: 10px;
left: 10px;
color: var(--text-tertiary, rgba(0, 0, 0, 0.35));
pointer-events: none;
}
input {
width: 100%;
height: 34px;
padding: 0 10px 0 32px;
border: 1px solid var(--border-color, rgba(0, 0, 0, 0.09));
border-radius: 8px;
outline: none;
color: var(--text-primary, rgba(0, 0, 0, 0.88));
background: var(--header-background, #fafafa);
font-size: 12px;
&::placeholder {
color: var(--text-tertiary, rgba(0, 0, 0, 0.35));
}
&:focus {
border-color: var(--files-accent, #f36b21);
box-shadow: 0 0 0 3px var(--files-accent-soft, rgba(243, 107, 33, 0.12));
background: var(--body-background, #fff);
}
}
}
.openFilesList {
min-height: 72px;
padding: 6px;
overflow-y: auto;
}
.openFileItem {
display: flex;
align-items: center;
min-height: 48px;
border-radius: 8px;
color: var(--text-secondary, rgba(0, 0, 0, 0.5));
&:hover {
color: var(--text-primary, rgba(0, 0, 0, 0.88));
background: var(--item-hover-bg, rgba(0, 0, 0, 0.04));
.openFileClose {
opacity: 1;
}
}
}
.openFileItemActive {
color: var(--text-primary, rgba(0, 0, 0, 0.88));
background: var(--files-accent-soft, rgba(243, 107, 33, 0.1));
}
.openFileMain {
min-width: 0;
flex: 1;
align-self: stretch;
display: flex;
align-items: center;
gap: 8px;
padding: 6px 8px;
border: 0;
color: inherit;
background: transparent;
text-align: left;
cursor: pointer;
> svg {
flex: 0 0 auto;
}
}
.openFileCopy {
min-width: 0;
display: flex;
flex: 1;
flex-direction: column;
gap: 3px;
}
.openFileName {
display: flex;
align-items: center;
gap: 6px;
font-family: "SFMono-Regular", Consolas, monospace;
font-size: 11px;
}
.openFilePath {
overflow: hidden;
color: var(--text-tertiary, rgba(0, 0, 0, 0.35));
font-size: 10px;
text-overflow: ellipsis;
white-space: nowrap;
}
.openFileClose {
width: 26px;
height: 26px;
flex: 0 0 auto;
display: inline-flex;
align-items: center;
justify-content: center;
margin-right: 6px;
padding: 0;
border: 0;
border-radius: 6px;
color: var(--text-tertiary, rgba(0, 0, 0, 0.35));
background: transparent;
opacity: 0;
cursor: pointer;
&:hover,
&:focus-visible {
color: var(--text-primary, rgba(0, 0, 0, 0.88));
background: var(--item-hover-bg, rgba(0, 0, 0, 0.07));
opacity: 1;
}
}
.openFilesEmpty {
padding: 30px 12px;
color: var(--text-tertiary, rgba(0, 0, 0, 0.35));
font-size: 12px;
text-align: center;
}
.openFilesFooter {
display: flex;
align-items: center;
gap: 4px;
padding: 9px 10px;
border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.07));
background: var(--header-background, #fafafa);
button {
padding: 6px 8px;
border: 0;
border-radius: 6px;
color: var(--text-secondary, rgba(0, 0, 0, 0.5));
background: transparent;
font-size: 11px;
cursor: pointer;
&:hover:not(:disabled) {
color: var(--text-primary, rgba(0, 0, 0, 0.88));
background: var(--body-background, #fff);
}
&:disabled {
opacity: 0.35;
cursor: default;
}
}
}
// ---- Toolbar ---------------------------------------------------------------
.toolbar {
display: flex;
align-items: center;
gap: 6px;
padding: 4px 10px;
border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.06));
flex-shrink: 0;
min-height: 30px;
}
.fileName {
font-size: 11px;
color: var(--text-tertiary, rgba(0, 0, 0, 0.35));
font-family: "SFMono-Regular", Consolas, monospace;
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.toolbarRight {
min-width: 0;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 7px;
}
.documentActions {
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 2px;
}
.modeSwitch {
padding: 2px;
display: inline-flex;
gap: 2px;
border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
border-radius: 6px;
background: var(--header-background, #fafafa);
button {
height: 24px;
padding: 0 8px;
display: inline-flex;
align-items: center;
gap: 5px;
color: var(--text-secondary, rgba(0, 0, 0, 0.45));
border: 0;
border-radius: 4px;
background: transparent;
font-size: 11px;
cursor: pointer;
}
}
.modeActive {
color: var(--files-accent, #f36b21) !important;
background: var(--files-accent-soft, rgba(243, 107, 33, 0.12)) !important;
}
.diffActions {
min-width: 0;
display: flex;
align-items: center;
gap: 4px;
padding-right: 7px;
border-right: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}
.diffLabel {
min-width: 0;
display: flex;
align-items: center;
gap: 4px;
font-size: 11px;
color: var(--info-color, #13c2c2);
font-weight: 500;
span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.keepBtn {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 10px !important;
height: 22px !important;
font-size: 12px !important;
background: rgba(82, 196, 26, 0.1) !important;
color: #52c41a !important;
border-radius: 4px;
border: 1px solid rgba(82, 196, 26, 0.3);
width: auto !important;
&:hover:not(:disabled) {
background: rgba(82, 196, 26, 0.18) !important;
color: #52c41a !important;
}
}
.undoBtn {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 10px !important;
height: 22px !important;
font-size: 12px !important;
background: rgba(255, 77, 79, 0.08) !important;
color: #ff4d4f !important;
border-radius: 4px;
border: 1px solid rgba(255, 77, 79, 0.25);
width: auto !important;
&:hover:not(:disabled) {
background: rgba(255, 77, 79, 0.15) !important;
color: #ff4d4f !important;
}
}
@container (max-width: 760px) {
.tab {
min-width: 104px;
max-width: 142px;
flex-basis: 142px;
}
.openFilesLabel {
display: none;
}
.fileName {
max-width: 120px;
}
.diffLabel span {
display: none;
}
.keepBtn,
.undoBtn {
width: 24px !important;
padding: 0 !important;
justify-content: center;
}
.actionLabel {
display: none;
}
}
@container (max-width: 520px) {
.scrollControl {
display: none;
}
.tabControls {
padding: 0 5px;
}
.openFilesBtn {
width: 34px;
padding: 0;
}
.tabCount {
position: absolute;
top: 2px;
right: 2px;
min-width: 14px;
height: 14px;
padding: 0 3px;
font-size: 8px;
}
.openFilesPanel {
right: 6px;
width: calc(100% - 12px);
}
.fileName {
display: none;
}
.toolbar {
justify-content: flex-end;
}
}
.iconBtn {
display: flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
border: none;
background: transparent;
cursor: pointer;
border-radius: 4px;
color: var(--text-secondary, rgba(0, 0, 0, 0.45));
padding: 0;
transition:
background 0.12s,
color 0.12s;
&:hover:not(:disabled) {
background: var(--item-hover-bg, rgba(0, 0, 0, 0.06));
color: var(--text-primary, rgba(0, 0, 0, 0.88));
}
&:disabled {
opacity: 0.35;
cursor: not-allowed;
}
}
// Preview toggle — highlight when preview is active
.previewActiveBtn {
color: var(--files-accent, #f36b21) !important;
background: var(--files-accent-soft, rgba(243, 107, 33, 0.12)) !important;
}
// ---- Editor ----------------------------------------------------------------
.editor {
flex: 1;
overflow: hidden;
}
.textPreview {
height: 100%;
margin: 0;
padding: clamp(20px, 3vw, 42px);
overflow: auto;
color: var(--text-primary, rgba(0, 0, 0, 0.88));
background: var(--body-background, #fff);
font:
13px/1.72 "SFMono-Regular",
Consolas,
monospace;
white-space: pre-wrap;
overflow-wrap: anywhere;
}
// ---- Diff editor wrap + per-hunk action overlays --------------------------
// The wrap is a positioning context for the per-hunk Keep / Undo
// overlays that float on top of the DiffEditor. Monaco renders inside
// the wrap; the overlays are React siblings positioned by absolute
// `top` (in px) driven by Monaco's view-zone onDomNodeTop callback.
//
// Why an overlay (not a Monaco widget): clicks on DOM that lives inside
// Monaco's view-zones or content-widgets get hijacked by Monaco's mouse
// handler (focus + preventDefault). Rendering buttons OUTSIDE Monaco
// sidesteps the whole event-handler chain.
.diffWrap {
position: relative;
height: 100%;
width: 100%;
}
.hunkWidget {
position: absolute;
right: 24px;
height: 22px;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 6px;
padding: 0;
background: transparent;
pointer-events: auto;
z-index: 5;
}
.hunkBtn {
display: inline-flex;
align-items: center;
gap: 4px;
height: 18px;
padding: 0 8px;
font-size: 11px;
line-height: 1;
border: 1px solid;
border-radius: 3px;
background: var(--body-background, #fff);
cursor: pointer;
transition:
background 0.12s,
color 0.12s;
}
.hunkKeepBtn {
color: #52c41a;
border-color: rgba(82, 196, 26, 0.4);
&:hover {
background: rgba(82, 196, 26, 0.12);
}
}
.hunkUndoBtn {
color: #ff4d4f;
border-color: rgba(255, 77, 79, 0.35);
&:hover {
background: rgba(255, 77, 79, 0.1);
}
}
// ---- Empty state -----------------------------------------------------------
.empty {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
background: var(--body-background, #fff);
}
.emptyIcon {
color: var(--text-tertiary, rgba(0, 0, 0, 0.15));
}
.emptyText {
font-size: 13px;
color: var(--text-tertiary, rgba(0, 0, 0, 0.25));
margin: 0;
}
// ---- Dark mode -----------------------------------------------------------
:global(.dark-mode) {
.wrap,
.empty,
.tabActive {
background: #1e1e1e;
}
.tabBar {
background: #1a1a1a;
border-bottom-color: rgba(255, 255, 255, 0.08);
}
.tabControls::before {
background: linear-gradient(90deg, transparent, #1a1a1a);
}
.tabControls {
border-left-color: rgba(255, 255, 255, 0.08);
background: #1a1a1a;
}
.tabControlBtn,
.openFilesBtn {
color: rgba(255, 255, 255, 0.55);
&:hover {
color: rgba(255, 255, 255, 0.88);
background: rgba(255, 255, 255, 0.07);
}
}
.openFilesBtn {
border-color: rgba(255, 255, 255, 0.1);
background: rgba(255, 255, 255, 0.04);
}
.tabCount {
color: rgba(255, 255, 255, 0.68);
background: rgba(255, 255, 255, 0.08);
}
.openFilesPanel {
border-color: rgba(255, 255, 255, 0.12);
background: #232323;
box-shadow: 0 20px 58px rgba(0, 0, 0, 0.45);
}
.openFilesHeader {
border-bottom-color: rgba(255, 255, 255, 0.08);
}
.openFilesTitleRow {
strong {
color: rgba(255, 255, 255, 0.88);
}
span {
color: rgba(255, 255, 255, 0.6);
}
}
.openFilesSearch > svg {
color: rgba(255, 255, 255, 0.58);
}
.openFilesSearch input {
color: rgba(255, 255, 255, 0.88);
border-color: rgba(255, 255, 255, 0.16);
background: rgba(255, 255, 255, 0.06);
&::placeholder {
color: rgba(255, 255, 255, 0.5);
}
&:focus {
border-color: #ff914d;
background: rgba(255, 255, 255, 0.07);
}
}
.openFileItem {
color: rgba(255, 255, 255, 0.58);
&:hover {
color: rgba(255, 255, 255, 0.88);
background: rgba(255, 255, 255, 0.06);
}
}
.openFileItemActive {
color: rgba(255, 255, 255, 0.9);
background: rgba(243, 107, 33, 0.16);
}
.openFilePath,
.openFilesEmpty {
color: rgba(255, 255, 255, 0.4);
}
.openFilesFooter {
border-top-color: rgba(255, 255, 255, 0.08);
background: #1d1d1d;
button {
color: rgba(255, 255, 255, 0.58);
&:hover:not(:disabled) {
color: rgba(255, 255, 255, 0.88);
background: rgba(255, 255, 255, 0.07);
}
}
}
.tab {
color: rgba(255, 255, 255, 0.55);
border-right-color: rgba(255, 255, 255, 0.06);
&:hover {
background: rgba(255, 255, 255, 0.06);
color: rgba(255, 255, 255, 0.88);
}
}
.tabActive {
color: rgba(255, 255, 255, 0.88);
border-bottom-color: #ff914d;
}
.closeBtn {
color: rgba(255, 255, 255, 0.4);
&:hover {
background: rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.88);
}
}
.toolbar {
border-bottom-color: rgba(255, 255, 255, 0.08);
}
.fileName {
color: rgba(255, 255, 255, 0.45);
}
.modeSwitch {
background: #24211f;
border-color: rgba(255, 255, 255, 0.12);
button {
color: rgba(255, 255, 255, 0.58);
&:hover {
color: rgba(255, 255, 255, 0.88);
background: rgba(255, 255, 255, 0.06);
}
}
}
.modeActive {
color: #ff9b5c !important;
background: rgba(243, 107, 33, 0.2) !important;
}
.textPreview {
color: rgba(255, 255, 255, 0.86);
background: #141816;
}
.iconBtn {
color: rgba(255, 255, 255, 0.55);
&:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.08);
color: rgba(255, 255, 255, 0.88);
}
}
.previewActiveBtn {
color: #ff914d !important;
background: rgba(243, 107, 33, 0.18) !important;
}
.emptyIcon {
color: rgba(255, 255, 255, 0.15);
}
.emptyText {
color: rgba(255, 255, 255, 0.35);
}
.hunkBtn {
background: #2a2a2a;
}
.hunkKeepBtn {
border-color: rgba(82, 196, 26, 0.45);
&:hover {
background: rgba(82, 196, 26, 0.18);
}
}
.hunkUndoBtn {
border-color: rgba(255, 77, 79, 0.4);
&:hover {
background: rgba(255, 77, 79, 0.16);
}
}
}
.wrap {
height: 100%;
display: flex;
flex-direction: column;
container-type: inline-size;
background: var(--body-background, #fff);
overflow: hidden;
}
// ---- Tab bar ---------------------------------------------------------------
.tabBar {
position: relative;
display: flex;
align-items: stretch;
flex-shrink: 0;
min-width: 0;
height: 42px;
background: var(--header-background, #fafafa);
border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}
.tabViewport {
position: relative;
min-width: 0;
flex: 1;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none;
&::-webkit-scrollbar {
display: none;
}
}
.tabRail {
width: max-content;
min-width: 100%;
height: 100%;
display: flex;
align-items: stretch;
}
.tab {
position: relative;
display: flex;
align-items: center;
gap: 6px;
min-width: 112px;
max-width: 176px;
flex: 0 1 176px;
padding: 0 9px 0 12px;
font-size: 11px;
font-family: "SFMono-Regular", Consolas, monospace;
color: var(--text-secondary, rgba(0, 0, 0, 0.45));
white-space: nowrap;
cursor: pointer;
border-right: 1px solid var(--border-color, rgba(0, 0, 0, 0.06));
background: transparent;
outline: none;
transition:
background 0.12s,
color 0.12s;
&:hover {
background: var(--item-hover-bg, rgba(0, 0, 0, 0.04));
color: var(--text-primary, rgba(0, 0, 0, 0.88));
}
&:focus-visible {
box-shadow: inset 0 0 0 2px
var(--files-accent-soft, rgba(243, 107, 33, 0.2));
}
}
.tabActive {
background: var(--body-background, #fff);
color: var(--text-primary, rgba(0, 0, 0, 0.88));
&::after {
content: "";
position: absolute;
right: 11px;
bottom: 0;
left: 11px;
height: 2px;
border-radius: 2px 2px 0 0;
background: var(--files-accent, #f36b21);
}
}
.tabName {
overflow: hidden;
text-overflow: ellipsis;
flex: 1;
min-width: 0;
}
.dirtyDot {
width: 7px;
height: 7px;