kunalja_VariantEditor/styles.css
2025-06-11 01:43:07 -04:00

312 lines
6.9 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: 0;
overflow: visible;
}
.variant-editor-row {
display: flex;
align-items: center;
padding: 12px 16px;
margin-bottom: 12px;
border-radius: 12px;
background-color: #2a2a2a;
cursor: pointer;
position: relative;
transition: all 0.2s;
border: 1px solid #333;
}
.variant-editor-row:hover {
background-color: #333;
}
/* Rainbow border for active variant */
.variant-editor-row-active {
background-color: #2a2a2a;
border: 2px solid transparent;
background-clip: padding-box;
}
.variant-editor-row-active::before {
content: '';
position: absolute;
inset: -2px;
padding: 2px;
background: linear-gradient(135deg, #8b5cf6, #ec4899, #f97316);
border-radius: 14px;
mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
mask-composite: exclude;
-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: xor;
pointer-events: none;
}
/* Drag handle styling */
.variant-editor-drag-handle {
font-size: 24px;
margin-right: 12px;
color: #666;
cursor: pointer;
background: none !important;
border: none !important;
box-shadow: none !important;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
line-height: 1;
margin-top: -6px;
}
.variant-editor-drag-handle:hover {
color: #ffffff;
background-color: transparent !important;
}
/* Remove the label element completely */
.variant-editor-label {
display: none;
}
/* Style the contenteditable div for floating text */
.variant-editor-input {
flex: 1;
background-color: transparent;
border: none;
padding: 4px;
color: #fff;
font-size: 18px;
min-height: 24px;
width: 100%;
cursor: text;
white-space: pre-wrap;
word-break: break-word;
display: flex;
align-items: center;
}
.variant-editor-input:focus {
outline: none;
}
/* Empty placeholder styling using data-placeholder attribute */
.variant-editor-input:empty::before {
content: attr(data-placeholder);
color: rgba(255, 255, 255, 0.5);
font-style: italic;
}
/* Delete button styling */
.variant-editor-delete-button {
background: none !important;
border: none !important;
color: #666;
font-size: 24px;
cursor: pointer;
padding: 0;
margin-left: 8px;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
opacity: 0.7;
width: 28px;
height: 28px;
line-height: 1;
box-shadow: none !important;
margin-top: -6px;
}
.variant-editor-delete-button:hover {
color: #ff5555;
}
.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);
}