cloudaxe-opencode/packages/web/src/components/diffview.module.css

123 lines
2.2 KiB
CSS
Raw Normal View History

2025-05-30 17:58:32 +00:00
.diff {
display: flex;
flex-direction: column;
2025-05-30 17:58:32 +00:00
border: 1px solid var(--sl-color-divider);
background-color: var(--sl-color-bg-surface);
border-radius: 0.25rem;
2025-05-30 20:42:56 +00:00
}
2025-05-30 17:58:32 +00:00
.row {
display: grid;
grid-template-columns: 1fr 1fr;
align-items: stretch;
}
.beforeColumn,
.afterColumn {
2025-05-31 18:41:00 +00:00
display: flex;
2025-05-30 20:42:56 +00:00
flex-direction: column;
2025-06-03 19:55:31 +00:00
overflow-x: visible;
2025-05-30 20:42:56 +00:00
min-width: 0;
2025-06-03 19:55:31 +00:00
align-items: stretch;
}
2025-05-30 17:58:32 +00:00
.beforeColumn {
border-right: 1px solid var(--sl-color-divider);
}
2025-05-30 17:58:32 +00:00
.diff > .row:first-child [data-section="cell"]:first-child {
padding-top: 0.5rem;
}
.diff > .row:last-child [data-section="cell"]:last-child {
padding-bottom: 0.5rem;
2025-05-30 20:42:56 +00:00
}
2025-05-30 17:58:32 +00:00
2025-05-30 20:42:56 +00:00
[data-section="cell"] {
position: relative;
flex: 1;
display: flex;
flex-direction: column;
2025-06-03 19:55:31 +00:00
width: 100%;
2025-06-04 16:32:23 +00:00
padding: 0.1875rem 0.5rem 0.1875rem 2.2ch;
2025-05-30 20:42:56 +00:00
margin: 0;
2025-05-30 17:58:32 +00:00
&[data-display-mobile="true"] {
display: none;
}
2025-05-30 20:42:56 +00:00
pre {
2025-06-03 19:55:31 +00:00
--shiki-dark-bg: var(--sl-color-bg-surface) !important;
2025-05-30 20:42:56 +00:00
background-color: var(--sl-color-bg-surface) !important;
2025-06-03 19:55:31 +00:00
white-space: pre-wrap;
word-break: break-word;
2025-05-30 20:42:56 +00:00
code > span:empty::before {
content: "\00a0";
white-space: pre;
display: inline-block;
width: 0;
2025-05-30 17:58:32 +00:00
}
}
2025-05-30 20:42:56 +00:00
}
2025-05-30 17:58:32 +00:00
2025-05-30 20:42:56 +00:00
[data-diff-type="removed"] {
background-color: var(--sl-color-red-low);
2025-05-30 17:58:32 +00:00
2025-05-30 20:42:56 +00:00
pre {
2025-06-03 19:55:31 +00:00
--shiki-dark-bg: var(--sl-color-red-low) !important;
2025-05-30 20:42:56 +00:00
background-color: var(--sl-color-red-low) !important;
}
2025-05-30 17:58:32 +00:00
2025-05-30 20:42:56 +00:00
&::before {
content: "-";
position: absolute;
left: 0.5ch;
user-select: none;
color: var(--sl-color-red-high);
2025-05-30 17:58:32 +00:00
}
2025-05-30 20:42:56 +00:00
}
2025-05-30 17:58:32 +00:00
2025-05-30 20:42:56 +00:00
[data-diff-type="added"] {
background-color: var(--sl-color-green-low);
2025-05-30 17:58:32 +00:00
2025-05-30 20:42:56 +00:00
pre {
2025-06-03 19:55:31 +00:00
--shiki-dark-bg: var(--sl-color-green-low) !important;
2025-05-30 20:42:56 +00:00
background-color: var(--sl-color-green-low) !important;
}
2025-05-30 17:58:32 +00:00
2025-05-30 20:42:56 +00:00
&::before {
content: "+";
position: absolute;
left: 0.6ch;
user-select: none;
color: var(--sl-color-green-high);
2025-05-30 17:58:32 +00:00
}
}
@media (max-width: 40rem) {
.row {
grid-template-columns: 1fr;
}
.afterColumn {
display: none;
}
.beforeColumn {
border-right: none;
}
[data-section="cell"] {
&[data-display-mobile="true"] {
display: flex;
}
&[data-display-mobile="false"] {
display: none;
}
}
}