cubic-bezier.css (6168B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 /* Based on Lea Verou www.cubic-bezier.com 6 See https://github.com/LeaVerou/cubic-bezier */ 7 8 .cubic-bezier-container { 9 /* These should be kept in pixels as they're used in CubicBezierWidget.js to set the canvas size */ 10 --bezier-curve-width: 150px; 11 --bezier-curve-height: 330px; 12 --bezier-preview-height: 40px; 13 --bezier-tooltip-container-height: calc(var(--bezier-curve-height) + var(--bezier-preview-height)); 14 display: grid; 15 grid-template-areas: 16 "presets curve" 17 "presets preview"; 18 grid-template-columns: 50% 50%; 19 grid-template-rows: var(--bezier-curve-height) var(--bezier-preview-height); 20 width: 510px; 21 height: var(--bezier-tooltip-container-height); 22 overflow: hidden; 23 padding: 5px; 24 box-sizing: border-box; 25 26 .preset-pane { 27 grid-area: presets; 28 border-inline-end: 1px solid var(--theme-splitter-color); 29 padding-inline-end: 4px; /* Visual balance for the panel-arrowcontent border on inline start */ 30 } 31 32 .display-wrap { 33 grid-area: curve; 34 text-align: center; 35 overflow: hidden; 36 } 37 38 .timing-function-preview { 39 grid-area: preview; 40 align-self: center; 41 justify-self: center; 42 } 43 } 44 45 /* Coordinate Plane */ 46 47 .cubic-bezier-container .coordinate-plane { 48 width: var(--bezier-curve-width); 49 height: var(--bezier-tooltip-container-height); 50 margin: 0 auto; 51 position: relative; 52 } 53 54 .cubic-bezier-container .control-point { 55 position: absolute; 56 z-index: 1; 57 height: 10px; 58 width: 10px; 59 border: 0; 60 background: var(--timing-function-control-point-background); 61 display: block; 62 margin: -5px 0 0 -5px; 63 outline: none; 64 border-radius: 5px; 65 padding: 0; 66 cursor: pointer; 67 /* opt-out of forced colors as --timing-function-control-point-background 68 is a registered property, so the engine will compute it to an rgb color, 69 which means it won't be seen as a system color in High Contrast Mode 70 and a default color would be used. */ 71 forced-color-adjust: none; 72 } 73 74 /* prettier-ignore */ 75 .cubic-bezier-container .display-wrap { 76 background: 77 repeating-linear-gradient(0deg, 78 transparent, 79 var(--timing-function-grid-color) 0, 80 var(--timing-function-grid-color) 1px, 81 transparent 1px, 82 transparent 15px) no-repeat, 83 repeating-linear-gradient(90deg, 84 transparent, 85 var(--timing-function-grid-color) 0, 86 var(--timing-function-grid-color) 1px, 87 transparent 1px, 88 transparent 15px) no-repeat; 89 background-size: 100% 100%, 100% 100%; 90 user-select: none; 91 92 :root[forced-colors-active] & { 93 /* opt-out of forced colors so we can see still the lines in High Contrast Mode. 94 --timing-function-grid-color does have a specific value in HCM so it should be fine */ 95 forced-color-adjust: none; 96 97 /* And set the forced colors on children so High Contrast Mode behaves as expected */ 98 & > * { 99 forced-color-adjust: auto; 100 } 101 } 102 } 103 104 /* Timing Function Preview Widget */ 105 106 .cubic-bezier-container .timing-function-preview { 107 width: var(--bezier-curve-width); 108 109 /* Stack the line and the dot on top of each other */ 110 display: grid; 111 align-items: center; 112 justify-items: center; 113 :is(.scale, .dot) { 114 grid-column: 1 / 1; 115 grid-row: 1 / 1; 116 } 117 } 118 119 .cubic-bezier-container .timing-function-preview .scale { 120 width: 100%; 121 height: 1px; 122 background-color: var(--timing-function-preview-scale); 123 /* opt-out of forced colors so we can see the line in High Contrast Mode */ 124 forced-color-adjust: none; 125 } 126 127 .cubic-bezier-container .timing-function-preview .dot { 128 width: 10px; 129 height: 10px; 130 border-radius: 50%; 131 border: 2px solid var(--timing-function-preview-dot-border); 132 background: var(--timing-function-line-color); 133 /* opt-out of forced colors as --timing-function-line-color is using 134 a non system but high contrast color */ 135 forced-color-adjust: none; 136 } 137 138 /* Preset Widget */ 139 140 #preset-categories { 141 display: flex; 142 width: 95%; 143 border: 1px solid var(--theme-splitter-color); 144 border-radius: 2px; 145 background-color: var(--theme-toolbar-background); 146 margin: 3px auto 0 auto; 147 } 148 149 .cubic-bezier-container .category { 150 padding: 5px 0; 151 width: 33.33%; 152 text-align: center; 153 text-transform: capitalize; 154 border-inline-end: 1px solid var(--theme-splitter-color); 155 cursor: default; 156 color: var(--theme-body-color); 157 text-overflow: ellipsis; 158 overflow: hidden; 159 160 &:last-child { 161 border-inline-end: none; 162 } 163 } 164 165 .cubic-bezier-container .category:hover { 166 background-color: var(--theme-tab-toolbar-background); 167 } 168 169 .cubic-bezier-container .active-category { 170 background-color: var(--theme-selection-background); 171 color: var(--theme-selection-color); 172 } 173 174 .cubic-bezier-container .active-category:hover { 175 background-color: var(--theme-selection-background); 176 } 177 178 #preset-container { 179 padding: 0; 180 width: 100%; 181 height: 331px; 182 overflow-y: auto; 183 } 184 185 .cubic-bezier-container .preset-list { 186 display: none; 187 padding-top: 6px; 188 } 189 190 .cubic-bezier-container .active-preset-list { 191 display: flex; 192 flex-wrap: wrap; 193 justify-content: flex-start; 194 } 195 196 .cubic-bezier-container .preset { 197 cursor: pointer; 198 width: 33.33%; 199 margin: 5px 0; 200 text-align: center; 201 } 202 203 .cubic-bezier-container .preset canvas { 204 display: block; 205 border: 1px solid var(--theme-splitter-color); 206 border-radius: 3px; 207 background-color: var(--theme-body-background); 208 margin: 0 auto; 209 } 210 211 .cubic-bezier-container .preset p { 212 font-size: 80%; 213 margin: 2px auto 0 auto; 214 color: var(--theme-text-color-alt); 215 text-transform: capitalize; 216 text-overflow: ellipsis; 217 overflow: hidden; 218 } 219 220 .cubic-bezier-container .active-preset p, 221 .cubic-bezier-container .active-preset:hover p { 222 color: var(--theme-body-color); 223 } 224 225 .cubic-bezier-container .preset:hover canvas { 226 border-color: var(--theme-selection-background); 227 } 228 229 .cubic-bezier-container .active-preset canvas, 230 .cubic-bezier-container .active-preset:hover canvas { 231 background-color: var(--theme-selection-background-hover); 232 border-color: var(--theme-selection-background); 233 }