All files / web-component image-comparison.element.css

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 1781x                                                                                                                                                                                                                                                                                                                                                                  
:host {
    --bg-color: #e5e5e5;
    --bg-code-color: #f3f3f3;
    --bg-sidebar-color: #ddd;
    --sidebar-border-color: #0002;
    --bg-color-active: #edecef;
    --fg-color: #303540;
    --fg-color-disabled: #404550;
    --resizable-border-color: #303540;
    --tab-active-color: #007299;
    --antialias-diff-color: yellow;
    --diff-color: red;
    transition: --antialias-diff-color 1ms step-start allow-discrete, --diff-color 1ms step-start allow-discrete;
}
 
@media (prefers-color-scheme: dark) {
    :host {
        --bg-color: #202530;
        --bg-code-color: #303540;
        --bg-sidebar-color: #303540;
        --sidebar-border-color: #fff2;
        --bg-color-active: #292d30;
        --fg-color: #dddcdf;
        --fg-color-disabled: #ccc;
        --resizable-border-color: #dddcdf;
        --tab-active-color: #fa5;
        --even-tr-bg: #ffffff08;
    }
}
 
.tab{
    display: none;
}
 
.tab-list {
    padding: 1em;
    list-style-type: none;
 
    display: flex;
    justify-content: center;
    label {
        padding: 1em;
        width: 30%;
        text-align: center;
        &:has(input:checked), &:hover {
            background: var(--bg-color-active);
            cursor: pointer;
        }        
    }
 
    input {
        appearance: none;
        display: none;
    }
}
 
.container:has(.tab-list input[value="side-by-side"]:checked) > .tab.side-by-side {
    display: flex;
    gap: 10px;
    justify-content: space-around;
}
 
.container:has(.tab-list input[value="slider"]:checked) > .tab.slider ,
.container:has(.tab-list input[value="diff"]:checked)  > .tab.diff {
    display: flex;
    justify-content: center;
}
 
.tab.side-by-side > figure {
    margin: 0;
}
 
.tab.side-by-side figcaption {
    text-align: center;
}
 
.comparison-slider {
    position: relative;
    max-width: 100%;
    margin: 0;
    border: 5px white solid;
    box-sizing: border-box;
    > img {
        width: 100%;
        height: auto;
        display: block;
    }
 
    &:hover .overlay{
        display: block;
    }
 
    .overlay:empty {
        display: none;
    }
 
    .overlay {
        position: absolute;
        max-width: 250px;
        bottom: 20px;
        right: 0;
        background-color: rgba(0, 0, 0, 0.4);
        padding: 10px;
        box-sizing: border-box;
        color: #DDD;
        text-align: right;
    }
 
    .resize {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        width: 50%;
        overflow: hidden;
        > img {
            display: block;
 
        }
        .overlay {
            right: auto;
            text-align: left;
            text-wrap: nowrap;
        }
    }
 
    .divider {
        position: absolute;
        touch-action: none;
        width: 2px;
        height: 100%;
        background-color: rgba(256, 256, 256, 0.2);
        left: 50%;
        top: 0;
        bottom: 0;
        margin-left: -1px;
        cursor: ew-resize;
        &:before {
            content: "";
            position: absolute;
            width: 20px;
            height: 20px;
            left: -9px;
            top: 50%;
            margin-top: -10px;
            background-color: white;
            transform: rotate(45deg);
            transition: all 0.1s ease-in-out;
        }
        &:after {
            content: "";
            position: absolute;
            width: 12px;
            height: 12px;
            left: -5px;
            top: 50%;
            margin-top: -6px;
            background-color: white;
            transform: rotate(45deg);
            transition: all 0.1s ease-in-out;
        }
        &.dragging{
            &:before {
                width: 30px;
                height: 30px;
                left: -14px;
                margin-top: -15px;
            }
            &:after {
                width: 20px;
                height: 20px;
                left: -9px;
                margin-top: -10px;
                background-color: #555;
            }
        }
    }
}