kunalja_VariantEditor/styles.css

496 lines
12 KiB
CSS
Raw Normal View History

2025-06-07 01:30:17 +00:00
/* Variant Editor Plugin Styles */
2025-06-05 02:50:55 +00:00
2025-06-07 01:30:17 +00:00
/* Dimmed lines */
.markdown-source-view .cm-line.fh-dim,
.cm-line.fh-dim {
2025-06-07 01:30:17 +00:00
opacity: 0.25;
}
2025-06-05 02:50:55 +00:00
2025-06-07 01:30:17 +00:00
/* 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);
}
2025-06-05 02:50:55 +00:00
2025-06-07 01:30:17 +00:00
/* 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;
2025-06-10 04:08:42 +00:00
/* Use the same styling approach as native selection */
padding: 0;
margin: 0;
border-radius: 0;
z-index: 1;
2025-06-07 15:34:32 +00:00
position: relative;
2025-06-10 04:08:42 +00:00
box-shadow: none;
2025-06-07 01:30:17 +00:00
}
2025-06-07 02:03:15 +00:00
2025-06-07 15:34:32 +00:00
/* Make highlighted text stand out even when selected */
2025-06-13 04:12:18 +00:00
.cm-line .cm-selectionBackground~.fh-highlight,
.cm-line .cm-selectionBackground+.fh-highlight,
2025-06-07 15:34:32 +00:00
.cm-line .fh-highlight.cm-selectionBackground {
2025-06-13 04:12:18 +00:00
background-color: rgba(255, 207, 64, 0.6) !important;
/* Lighter yellow that shows through selection */
2025-06-10 04:08:42 +00:00
mix-blend-mode: normal;
opacity: 1;
2025-06-07 15:34:32 +00:00
}
2025-06-07 18:06:17 +00:00
/* Variant indicator styles */
.variant-indicator {
background-color: rgba(121, 184, 255, 0.2);
border-bottom: 1px dashed #79b8ff;
border-radius: 2px;
position: relative;
2025-06-07 23:08:26 +00:00
}
/* 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-syntax-inactive-option:hover {
2025-06-07 23:08:26 +00:00
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;
2025-06-07 18:06:17 +00:00
z-index: 5;
}
2025-06-10 04:28:10 +00:00
/* 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);
}
2025-06-07 02:03:15 +00:00
/* Modal styles */
2025-06-10 06:18:56 +00:00
/* Header with title and close button inline */
2025-06-11 06:36:33 +00:00
/* Using Obsidian's built-in modal header instead of custom header */
2025-06-10 06:18:56 +00:00
2025-06-12 05:08:32 +00:00
/* Style the variant input container */
.variant-editor-variant-container {
margin-bottom: 10px;
margin-top: 10px;
border-radius: 8px;
overflow: hidden;
}
2025-06-07 18:06:17 +00:00
.variant-editor-container {
margin-bottom: 15px;
max-height: 300px;
overflow-y: auto;
2025-06-11 06:36:33 +00:00
padding-right: 5px;
/* Custom scrollbar styling */
scrollbar-width: thin;
scrollbar-color: #666 #2a2a2a;
}
/* Webkit scrollbar styling */
.variant-editor-container::-webkit-scrollbar {
width: 8px;
}
.variant-editor-container::-webkit-scrollbar-track {
2025-06-13 05:24:59 +00:00
background: var(--background-secondary);
2025-06-11 06:36:33 +00:00
border-radius: 4px;
}
.variant-editor-container::-webkit-scrollbar-thumb {
2025-06-13 05:24:59 +00:00
background-color: var(--scrollbar-thumb-bg);
2025-06-11 06:36:33 +00:00
border-radius: 4px;
2025-06-07 18:06:17 +00:00
}
.variant-editor-row {
display: flex;
align-items: center;
2025-06-11 06:36:33 +00:00
padding: 8px 12px;
margin-bottom: 8px;
border-radius: 8px;
2025-06-13 05:24:59 +00:00
background-color: var(--background-secondary);
2025-06-10 06:18:56 +00:00
cursor: pointer;
position: relative;
2025-06-11 05:43:07 +00:00
transition: all 0.2s;
2025-06-13 05:24:59 +00:00
border: 1px solid var(--background-modifier-border);
2025-06-07 18:06:17 +00:00
}
2025-06-10 06:18:56 +00:00
.variant-editor-row:hover {
2025-06-13 05:24:59 +00:00
background-color: var(--background-secondary-alt);
2025-06-07 18:06:17 +00:00
}
2025-06-10 06:18:56 +00:00
/* Rainbow border for active variant */
.variant-editor-row-active {
2025-06-13 05:24:59 +00:00
background-color: var(--background-secondary);
2025-06-11 05:43:07 +00:00
border: 2px solid transparent;
background-clip: padding-box;
2025-06-10 06:18:56 +00:00
}
.variant-editor-row-active::before {
content: '';
position: absolute;
2025-06-11 05:43:07 +00:00
inset: -2px;
padding: 2px;
background: linear-gradient(135deg, #8b5cf6, #ec4899, #f97316);
2025-06-13 04:12:18 +00:00
border-radius: 10px;
/* Match the row border-radius + 2px for the inset */
2025-06-11 05:43:07 +00:00
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;
2025-06-10 06:18:56 +00:00
}
2025-06-11 05:43:07 +00:00
/* Drag handle styling */
.variant-editor-drag-handle {
2025-06-11 06:36:33 +00:00
font-size: 18px;
margin-right: 8px;
2025-06-13 05:24:59 +00:00
color: var(--text-muted);
2025-06-11 05:43:07 +00:00
cursor: pointer;
background: none !important;
border: none !important;
box-shadow: none !important;
2025-06-10 06:18:56 +00:00
padding: 0;
2025-06-11 05:43:07 +00:00
display: flex;
align-items: center;
justify-content: center;
2025-06-11 06:36:33 +00:00
width: 22px;
height: 22px;
2025-06-11 05:43:07 +00:00
line-height: 1;
2025-06-11 06:36:33 +00:00
margin-top: -3px;
2025-06-10 06:18:56 +00:00
}
2025-06-11 05:43:07 +00:00
.variant-editor-drag-handle:hover {
2025-06-13 05:24:59 +00:00
color: var(--text-normal);
2025-06-11 05:43:07 +00:00
background-color: transparent !important;
2025-06-07 18:06:17 +00:00
}
2025-06-11 05:43:07 +00:00
/* Remove the label element completely */
2025-06-07 18:06:17 +00:00
.variant-editor-label {
2025-06-11 05:43:07 +00:00
display: none;
2025-06-07 18:06:17 +00:00
}
2025-06-11 05:43:07 +00:00
/* Style the contenteditable div for floating text */
2025-06-07 18:06:17 +00:00
.variant-editor-input {
2025-06-11 05:43:07 +00:00
flex: 1;
background-color: transparent;
border: none;
2025-06-11 06:36:33 +00:00
padding: 3px;
2025-06-13 05:24:59 +00:00
color: var(--text-normal);
2025-06-11 06:36:33 +00:00
font-size: 16px;
min-height: 20px;
2025-06-11 05:43:07 +00:00
width: 100%;
cursor: text;
white-space: pre-wrap;
word-break: break-word;
display: flex;
align-items: center;
2025-06-07 18:06:17 +00:00
}
.variant-editor-input:focus {
outline: none;
}
2025-06-11 05:43:07 +00:00
/* Empty placeholder styling using data-placeholder attribute */
.variant-editor-input:empty::before {
content: attr(data-placeholder);
2025-06-13 05:24:59 +00:00
color: var(--text-faint);
2025-06-11 05:43:07 +00:00
font-style: italic;
}
2025-06-11 20:49:01 +00:00
/* Special styling for the last row (add variant placeholder) */
.variant-editor-row-add-variant .variant-editor-input:empty::before {
2025-06-13 05:24:59 +00:00
color: var(--text-faint);
2025-06-11 20:49:01 +00:00
font-style: italic;
font-weight: normal;
}
/* Style the last row differently - we'll add a specific class in the JS code */
.variant-editor-row-add-variant {
2025-06-13 05:24:59 +00:00
border: 1px dashed var(--background-modifier-border);
background-color: var(--background-primary);
2025-06-11 20:49:01 +00:00
border-radius: 6px;
margin-top: 8px;
transition: all 0.2s ease;
}
/* Hover effect for the add variant row */
.variant-editor-row-add-variant:hover {
2025-06-13 05:24:59 +00:00
border-color: var(--interactive-hover);
background-color: var(--background-secondary-alt);
2025-06-11 20:49:01 +00:00
}
/* Active state for the add variant row */
.variant-editor-row-add-variant.variant-editor-row-active {
border-color: var(--interactive-accent);
background-color: rgba(var(--interactive-accent-rgb), 0.1);
}
2025-06-12 04:42:08 +00:00
/* Drag and drop styling */
.variant-editor-row.dragging {
opacity: 0.4;
border: 1px dashed var(--interactive-accent);
background-color: rgba(var(--interactive-accent-rgb), 0.1);
}
/* Hide the drag ghost image */
.variant-editor-drag-ghost {
opacity: 0;
position: absolute;
height: 0;
width: 0;
overflow: hidden;
}
2025-06-13 04:08:25 +00:00
/* Drag indicators for drop positions */
.variant-editor-row.drag-over-top {
position: relative;
}
.variant-editor-row.drag-over-top::after {
content: '';
position: absolute;
top: -4px;
left: 0;
right: 0;
height: 4px;
background-color: var(--interactive-accent);
border-radius: 2px;
z-index: 10;
}
.variant-editor-row.drag-over-bottom {
position: relative;
}
.variant-editor-row.drag-over-bottom::after {
content: '';
position: absolute;
bottom: -4px;
left: 0;
right: 0;
height: 4px;
background-color: var(--interactive-accent);
border-radius: 2px;
z-index: 10;
2025-06-12 04:42:08 +00:00
}
2025-06-13 04:08:25 +00:00
/* Special handling for active rows with drag indicators */
.variant-editor-row-active.drag-over-top::after,
.variant-editor-row-active.drag-over-bottom::after {
2025-06-13 04:12:18 +00:00
z-index: 20;
/* Higher z-index to appear above the rainbow border */
2025-06-12 04:42:08 +00:00
}
2025-06-11 05:43:07 +00:00
/* Delete button styling */
2025-06-07 18:06:17 +00:00
.variant-editor-delete-button {
2025-06-11 05:43:07 +00:00
background: none !important;
border: none !important;
2025-06-13 05:24:59 +00:00
color: var(--text-muted);
2025-06-11 06:36:33 +00:00
font-size: 18px;
2025-06-07 18:06:17 +00:00
cursor: pointer;
2025-06-11 05:43:07 +00:00
padding: 0;
2025-06-11 06:36:33 +00:00
margin-left: 6px;
2025-06-11 05:43:07 +00:00
transition: all 0.2s;
2025-06-07 18:06:17 +00:00
display: flex;
align-items: center;
justify-content: center;
2025-06-11 05:43:07 +00:00
opacity: 0.7;
2025-06-11 06:36:33 +00:00
width: 22px;
height: 22px;
2025-06-07 18:06:17 +00:00
line-height: 1;
2025-06-11 05:43:07 +00:00
box-shadow: none !important;
2025-06-11 06:36:33 +00:00
margin-top: -3px;
2025-06-07 18:06:17 +00:00
}
.variant-editor-delete-button:hover {
2025-06-11 05:43:07 +00:00
color: #ff5555;
2025-06-07 18:06:17 +00:00
}
.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;
2025-06-13 04:08:25 +00:00
justify-content: center;
gap: 12px;
2025-06-07 18:06:17 +00:00
}
.variant-editor-button {
2025-06-13 04:08:25 +00:00
min-width: 144px;
max-width: 216px;
2025-06-13 04:12:18 +00:00
padding: 10px 24px !important;
/* Reduced vertical padding to make buttons thinner */
border-radius: 8px !important;
/* Match variant row border-radius */
2025-06-12 05:08:32 +00:00
font-size: 16px !important;
2025-06-13 04:08:25 +00:00
font-weight: 600 !important;
2025-06-13 04:12:18 +00:00
transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
/* Improved animation curve */
2025-06-13 05:24:59 +00:00
border: 1px solid var(--background-modifier-border) !important;
2025-06-13 04:12:18 +00:00
/* Match variant row border */
2025-06-13 04:08:25 +00:00
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
text-align: center !important;
2025-06-13 05:24:59 +00:00
color: var(--text-normal) !important; /* Use normal text color instead of on-accent */
background-color: var(--background-modifier-form-field) !important; /* Less contrasty background */
2025-06-13 04:08:25 +00:00
display: flex !important;
align-items: center !important;
justify-content: center !important;
gap: 10px !important;
2025-06-13 04:12:18 +00:00
height: 42px !important;
/* Reduced height by 10px */
2025-06-12 05:08:32 +00:00
}
2025-06-07 18:06:17 +00:00
.variant-editor-commit-button {
2025-06-13 04:12:18 +00:00
background-color: #7E6BDC !important;
/* Obsidian purple */
2025-06-13 05:24:59 +00:00
color: var(--text-on-accent) !important; /* Keep white text on purple background */
2025-06-13 04:08:25 +00:00
}
/* Hover effects */
.variant-editor-button:hover {
opacity: 0.95 !important;
transform: translateY(-2px) !important;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
2025-06-13 05:24:59 +00:00
border-color: var(--interactive-hover) !important;
2025-06-07 18:06:17 +00:00
}
.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 {
2025-06-07 19:17:12 +00:00
margin-top: 10px;
margin-bottom: 10px;
2025-06-07 18:06:17 +00:00
color: var(--text-muted);
font-size: 0.9em;
2025-06-07 02:03:15 +00:00
}
2025-06-07 19:17:12 +00:00
/* Style the variant editor modal */
.variant-editor-modal {
max-width: 90vw !important;
2025-06-13 04:12:18 +00:00
width: 460px !important;
/* Reduced from 500px to 460px (40px less) */
2025-06-07 19:17:12 +00:00
max-height: 80vh !important;
2025-06-12 05:08:32 +00:00
padding: 0;
2025-06-07 19:17:12 +00:00
overflow-y: auto !important;
2025-06-12 05:08:32 +00:00
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25) !important;
2025-06-07 19:17:12 +00:00
border: 1px solid var(--background-modifier-border) !important;
2025-06-12 05:08:32 +00:00
border-radius: 12px !important;
background-color: var(--background-primary) !important;
position: fixed !important;
left: var(--modal-left, 50%) !important;
top: var(--modal-top, 50%) !important;
bottom: var(--modal-bottom, auto) !important;
transform: var(--modal-transform, translate(-50%, -50%)) !important;
2025-06-12 05:08:32 +00:00
}
/* Style the modal title */
.variant-editor-modal .modal-title {
padding: 20px 20px 0 20px !important;
font-size: 24px !important;
font-weight: 600 !important;
color: var(--text-normal) !important;
}
/* Style the close button */
.variant-editor-modal .modal-close-button {
top: 20px !important;
right: 20px !important;
font-size: 24px !important;
color: var(--text-muted) !important;
opacity: 0.7 !important;
transition: all 0.2s ease !important;
}
.variant-editor-modal .modal-close-button:hover {
opacity: 1 !important;
color: var(--text-normal) !important;
}
/* Make the modal title draggable */
.variant-editor-draggable-title {
cursor: move;
}
/* For draggable modal */
.variant-editor-modal.dragging {
opacity: 0.9;
user-select: none;
2025-06-07 19:17:12 +00:00
}
.variant-editor-modal-hidden {
opacity: 0;
transition: opacity 150ms ease-in-out;
}
.variant-editor-modal-visible {
opacity: 1;
transition: opacity 150ms ease-in-out;
}
.variant-editor-textarea:focus {
outline: none;
border-color: var(--interactive-accent);
box-shadow: 0 0 0 2px rgba(var(--interactive-accent-rgb), 0.2);
}
2025-06-11 07:30:33 +00:00
/* When modal is positioned above the highlighted line, we no longer reorder elements */
2025-06-07 19:27:31 +00:00
.variant-editor-modal-above .variant-editor-flex-container {
2025-06-11 07:30:33 +00:00
/* Keep normal flow, just position the modal differently */
2025-06-07 19:27:31 +00:00
display: flex !important;
}
.variant-editor-flex-container {
2025-06-12 05:08:32 +00:00
padding: 15px 20px 20px 20px;
2025-06-07 19:27:31 +00:00
display: flex;
flex-direction: column;
}
2025-06-10 03:49:52 +00:00
/* Remove background dimming for variant editor modal */
2025-06-15 21:42:46 +00:00
body:has(.variant-editor-modal) .modal-bg {
2025-06-10 03:49:52 +00:00
background-color: transparent !important;
backdrop-filter: none !important;
2025-06-13 08:04:14 +00:00
opacity: 0 !important;
2025-06-13 04:12:18 +00:00
}