kunalja_VariantEditor/styles.css
2025-06-10 02:18:56 -04:00

300 lines
6.7 KiB
CSS

/* Variant Editor Plugin Styles */
/* Dimmed lines */
.markdown-source-view .cm-line.fh-dim,
.cm-line.fh-dim {
opacity: 0.25;
}
/* Active line (contains the selected text) */
.markdown-source-view .cm-line.fh-active {
opacity: 1 !important;
position: relative;
z-index: 1;
background-color: var(--background-primary);
border-radius: 2px;
box-shadow: 0 0 0 1px var(--background-modifier-border);
}
/* When in sentence mode, make the active line more subtle */
.markdown-source-view .cm-line.fh-active:not(.fh-dim) {
background-color: var(--background-primary);
box-shadow: none;
}
/* Highlighted text */
.fh-highlight {
background-color: var(--text-highlight-bg);
color: var(--text-normal) !important;
/* Use the same styling approach as native selection */
padding: 0;
margin: 0;
border-radius: 0;
z-index: 1;
position: relative;
box-shadow: none;
}
/* Make highlighted text stand out even when selected */
.cm-line .cm-selectionBackground ~ .fh-highlight,
.cm-line .cm-selectionBackground + .fh-highlight,
.cm-line .fh-highlight.cm-selectionBackground {
background-color: rgba(255, 207, 64, 0.6) !important; /* Lighter yellow that shows through selection */
mix-blend-mode: normal;
opacity: 1;
}
/* Variant indicator styles */
.variant-indicator {
background-color: rgba(121, 184, 255, 0.2);
border-bottom: 1px dashed #79b8ff;
border-radius: 2px;
position: relative;
}
/* Hide variant syntax parts */
.variant-syntax-start,
.variant-syntax-end,
.variant-inactive-option {
display: inline;
color: transparent;
font-size: 0;
position: relative;
pointer-events: auto;
cursor: text;
}
/* Show a small indicator for hidden parts when hovered */
.variant-syntax-start:hover,
.variant-syntax-end:hover,
.variant-inactive-option:hover {
background-color: rgba(121, 184, 255, 0.3);
}
/* Active variant option */
.variant-active-option {
display: inline;
background-color: rgba(121, 184, 255, 0.2);
border-bottom: 1px dashed #79b8ff;
border-radius: 2px;
position: relative;
pointer-events: auto;
z-index: 5;
}
/* Style for clickable variants */
.clickable-variant {
cursor: pointer;
border-bottom: 1px dotted var(--interactive-accent);
transition: background-color 0.15s ease;
}
.clickable-variant:hover {
background-color: var(--background-modifier-hover);
}
/* Modal styles */
/* Header with title and close button inline */
.variant-editor-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
}
.variant-editor-header h2 {
margin: 0;
padding: 0;
}
.variant-editor-container {
margin-bottom: 15px;
max-height: 300px;
overflow-y: auto;
padding-right: 5px;
}
.variant-editor-row {
display: flex;
align-items: center;
margin-bottom: 8px;
padding: 6px;
border-radius: 4px;
background-color: var(--background-primary-alt);
cursor: pointer;
position: relative;
transition: background-color 0.15s ease;
}
.variant-editor-row:hover {
background-color: var(--background-modifier-hover);
}
/* Rainbow border for active variant */
.variant-editor-row-active {
position: relative;
background-color: var(--background-secondary);
margin-bottom: 8px;
border-radius: 4px;
/* Remove default border */
border: none;
}
/* Create rainbow border with pseudo-element */
.variant-editor-row-active::before {
content: '';
position: absolute;
top: -2px;
left: -2px;
right: -2px;
bottom: -2px;
background: linear-gradient(45deg, #ff5e5e, #ffdb4d, #52fa5a, #4db8ff, #c878ff);
border-radius: 6px;
z-index: -1;
}
/* Create inner background to make border appear as outline */
.variant-editor-row-active::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: var(--background-secondary);
border-radius: 4px;
z-index: -1;
}
/* Make sure the container doesn't clip the border */
.variant-editor-container {
padding: 0;
overflow: visible;
}
/* Drag handle styling */
.variant-editor-drag-handle {
font-size: 18px;
margin-right: 8px;
color: var(--text-muted);
cursor: grab;
}
.variant-editor-label {
width: 80px;
font-weight: 500;
color: var(--text-normal);
flex-shrink: 0;
}
.variant-editor-input {
flex-grow: 1;
padding: 6px 10px;
border-radius: 4px;
border: 1px solid var(--background-modifier-border);
background-color: var(--background-primary);
font-family: var(--font-text);
}
.variant-editor-input:focus {
border-color: var(--interactive-accent);
box-shadow: 0 0 0 2px rgba(var(--interactive-accent-rgb), 0.2);
outline: none;
}
.variant-editor-delete-button {
margin-left: 8px;
width: 24px;
height: 24px;
border-radius: 50%;
background-color: var(--background-modifier-error-rgb);
color: white;
border: none;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
padding: 0;
line-height: 1;
}
.variant-editor-delete-button:hover {
background-color: var(--text-error);
}
.variant-editor-add-container {
margin-bottom: 15px;
}
.variant-editor-add-button {
background-color: var(--interactive-accent) !important;
color: var(--text-on-accent) !important;
padding: 4px 12px !important;
}
.variant-editor-buttons {
display: flex;
justify-content: space-between;
margin-top: 20px;
gap: 10px;
}
.variant-editor-button {
flex: 1;
padding: 8px 12px !important;
}
.variant-editor-commit-button {
background-color: var(--color-green) !important;
color: var(--text-on-accent) !important;
}
.variant-editor-original-text {
margin-bottom: 15px;
font-weight: 500;
color: var(--text-normal);
padding: 8px;
background-color: var(--background-secondary);
border-radius: 4px;
}
.variant-editor-hint {
margin-top: 10px;
margin-bottom: 10px;
color: var(--text-muted);
font-size: 0.9em;
}
/* Style the variant editor modal */
.variant-editor-modal {
width: 400px !important;
max-width: 90vw !important;
max-height: 80vh !important;
overflow-y: auto !important;
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15) !important;
border: 1px solid var(--background-modifier-border) !important;
}
/* When modal is positioned above the highlighted line, make it grow upward */
.variant-editor-modal-above .variant-editor-flex-container {
display: flex !important;
flex-direction: column-reverse !important;
}
.variant-editor-flex-container {
display: flex;
flex-direction: column;
}
/* Remove background dimming for variant editor modal */
.variant-editor-no-dim ~ .modal-bg {
background-color: transparent !important;
backdrop-filter: none !important;
}
.variant-editor-textarea:focus {
outline: none;
border-color: var(--interactive-accent);
box-shadow: 0 0 0 2px rgba(var(--interactive-accent-rgb), 0.2);
}