|
| 1 | +/* Rust Playground Interactive Examples */ |
| 2 | + |
| 3 | +/* Container */ |
| 4 | +.rust-example-container { |
| 5 | + position: relative; |
| 6 | + margin: 1em 0; |
| 7 | +} |
| 8 | + |
| 9 | +/* Badges row */ |
| 10 | +.rust-example-badges { |
| 11 | + display: flex; |
| 12 | + flex-wrap: wrap; |
| 13 | + gap: 0.5em; |
| 14 | + margin-bottom: 0.5em; |
| 15 | +} |
| 16 | + |
| 17 | +.rust-example-badge { |
| 18 | + display: inline-block; |
| 19 | + padding: 0.2em 0.6em; |
| 20 | + font-family: monospace; |
| 21 | + font-size: 0.8em; |
| 22 | + font-weight: bold; |
| 23 | + border-radius: 3px; |
| 24 | + text-transform: lowercase; |
| 25 | +} |
| 26 | + |
| 27 | +.rust-example-badge-ignore { |
| 28 | + background-color: #6c757d; |
| 29 | + color: white; |
| 30 | +} |
| 31 | +.rust-example-badge-ignore::before { content: "⏭ "; } |
| 32 | + |
| 33 | +.rust-example-badge-compile-fail { |
| 34 | + background-color: #dc3545; |
| 35 | + color: white; |
| 36 | +} |
| 37 | +.rust-example-badge-compile-fail::before { content: "✗ "; } |
| 38 | + |
| 39 | +.rust-example-badge-should-panic { |
| 40 | + background-color: #fd7e14; |
| 41 | + color: white; |
| 42 | +} |
| 43 | +.rust-example-badge-should-panic::before { content: "💥 "; } |
| 44 | + |
| 45 | +.rust-example-badge-no-run { |
| 46 | + background-color: #17a2b8; |
| 47 | + color: white; |
| 48 | +} |
| 49 | +.rust-example-badge-no-run::before { content: "⚙ "; } |
| 50 | + |
| 51 | +.rust-example-badge-nightly { |
| 52 | + background-color: #6f42c1; |
| 53 | + color: white; |
| 54 | +} |
| 55 | +.rust-example-badge-nightly::before { content: "🌙 "; } |
| 56 | + |
| 57 | +.rust-example-badge-version { |
| 58 | + background-color: #ffc107; |
| 59 | + color: #212529; |
| 60 | + cursor: help; |
| 61 | +} |
| 62 | + |
| 63 | +/* Miri badges */ |
| 64 | +.rust-example-badge-miri { |
| 65 | + background-color: #6f42c1; |
| 66 | + color: white; |
| 67 | +} |
| 68 | +.rust-example-badge-miri::before { content: "🔬 "; } |
| 69 | + |
| 70 | +.rust-example-badge-miri-expect-ub { |
| 71 | + background-color: #b02a37; |
| 72 | + color: white; |
| 73 | +} |
| 74 | +.rust-example-badge-miri-expect-ub::before { content: "☣️ "; } |
| 75 | + |
| 76 | +/* Button toolbar - injected by JavaScript */ |
| 77 | +.rust-example-buttons { |
| 78 | + position: absolute; |
| 79 | + top: 0.5em; |
| 80 | + right: 0.5em; |
| 81 | + display: flex; |
| 82 | + gap: 0.3em; |
| 83 | + opacity: 0; |
| 84 | + transition: opacity 0.2s ease; |
| 85 | + z-index: 10; |
| 86 | +} |
| 87 | + |
| 88 | +.rust-example-container:hover .rust-example-buttons { |
| 89 | + opacity: 1; |
| 90 | +} |
| 91 | + |
| 92 | +/* Adjust button position when badges are present */ |
| 93 | +.rust-example-container:has(.rust-example-badges) .rust-example-buttons { |
| 94 | + top: calc(0.5em + 1.8em + 0.5em); |
| 95 | +} |
| 96 | + |
| 97 | +/* Individual buttons */ |
| 98 | +.rust-btn { |
| 99 | + display: flex; |
| 100 | + align-items: center; |
| 101 | + justify-content: center; |
| 102 | + width: 28px; |
| 103 | + height: 28px; |
| 104 | + padding: 0; |
| 105 | + border: none; |
| 106 | + border-radius: 4px; |
| 107 | + background-color: rgba(0, 0, 0, 0.3); |
| 108 | + color: #fff; |
| 109 | + cursor: pointer; |
| 110 | + transition: background-color 0.15s; |
| 111 | +} |
| 112 | + |
| 113 | +.rust-btn:hover { |
| 114 | + background-color: rgba(0, 0, 0, 0.5); |
| 115 | +} |
| 116 | + |
| 117 | +.rust-btn:disabled { |
| 118 | + opacity: 0.3; |
| 119 | + cursor: not-allowed; |
| 120 | +} |
| 121 | + |
| 122 | +.rust-btn-icon { |
| 123 | + display: flex; |
| 124 | + align-items: center; |
| 125 | + justify-content: center; |
| 126 | + width: 14px; |
| 127 | + height: 14px; |
| 128 | +} |
| 129 | + |
| 130 | +.rust-btn-icon svg { |
| 131 | + width: 100%; |
| 132 | + height: 100%; |
| 133 | + fill: currentColor; |
| 134 | +} |
| 135 | + |
| 136 | +/* Copy button tooltip */ |
| 137 | +.rust-btn-tooltip { |
| 138 | + position: absolute; |
| 139 | + bottom: 100%; |
| 140 | + left: 50%; |
| 141 | + transform: translateX(-50%); |
| 142 | + padding: 0.3em 0.6em; |
| 143 | + margin-bottom: 0.3em; |
| 144 | + font-size: 0.75em; |
| 145 | + white-space: nowrap; |
| 146 | + background-color: #333; |
| 147 | + color: #fff; |
| 148 | + border-radius: 3px; |
| 149 | + opacity: 0; |
| 150 | + pointer-events: none; |
| 151 | + transition: opacity 0.2s; |
| 152 | +} |
| 153 | + |
| 154 | +.rust-btn-tooltip.show { |
| 155 | + opacity: 1; |
| 156 | +} |
| 157 | + |
| 158 | +/* Running state */ |
| 159 | +.rust-btn-run.running { |
| 160 | + opacity: 0.6; |
| 161 | + cursor: wait; |
| 162 | +} |
| 163 | + |
| 164 | +/* Hidden lines toggle active state */ |
| 165 | +.rust-btn-toggle-hidden.active { |
| 166 | + background-color: rgba(0, 0, 0, 0.6); |
| 167 | +} |
| 168 | + |
| 169 | +/* Hidden lines styling when revealed */ |
| 170 | +.rust-hidden-line { |
| 171 | + opacity: 0.5; |
| 172 | + background-color: rgba(128, 128, 128, 0.15); |
| 173 | +} |
| 174 | + |
| 175 | +/* Output area - injected by JavaScript */ |
| 176 | +.rust-example-output { |
| 177 | + margin-top: 0.5em; |
| 178 | + border: 1px solid #ddd; |
| 179 | + border-radius: 4px; |
| 180 | + background-color: #1e1e1e; |
| 181 | + overflow: hidden; |
| 182 | +} |
| 183 | + |
| 184 | +.rust-example-output-header { |
| 185 | + display: flex; |
| 186 | + justify-content: space-between; |
| 187 | + align-items: center; |
| 188 | + padding: 0.5em 1em; |
| 189 | + background-color: #2d2d2d; |
| 190 | + border-bottom: 1px solid #444; |
| 191 | +} |
| 192 | + |
| 193 | +.rust-example-output-status { |
| 194 | + font-size: 0.85em; |
| 195 | + font-weight: bold; |
| 196 | +} |
| 197 | + |
| 198 | +.rust-example-output-status.success { color: #4caf50; } |
| 199 | +.rust-example-output-status.success::before { content: "✓ "; } |
| 200 | + |
| 201 | +.rust-example-output-status.error { color: #f44336; } |
| 202 | +.rust-example-output-status.error::before { content: "✗ "; } |
| 203 | + |
| 204 | +.rust-example-output-status.expected { color: #ff9800; } |
| 205 | +.rust-example-output-status.expected::before { content: "✓ "; } |
| 206 | + |
| 207 | +.rust-example-output-status.warning { color: #ffc107; } |
| 208 | +.rust-example-output-status.warning::before { content: "⚠ "; } |
| 209 | + |
| 210 | +.rust-example-output-close { |
| 211 | + background: none; |
| 212 | + border: none; |
| 213 | + color: #aaa; |
| 214 | + font-size: 1.2em; |
| 215 | + cursor: pointer; |
| 216 | + padding: 0 0.3em; |
| 217 | +} |
| 218 | + |
| 219 | +.rust-example-output-close:hover { |
| 220 | + color: #fff; |
| 221 | +} |
| 222 | + |
| 223 | +.rust-example-output-content { |
| 224 | + margin: 0; |
| 225 | + padding: 1em; |
| 226 | + max-height: 300px; |
| 227 | + overflow: auto; |
| 228 | + font-family: monospace; |
| 229 | + font-size: 0.85em; |
| 230 | + color: #d4d4d4; |
| 231 | + white-space: pre-wrap; |
| 232 | + word-wrap: break-word; |
| 233 | +} |
| 234 | + |
| 235 | +/* Hide the JSON data script */ |
| 236 | +.rust-example-data { |
| 237 | + display: none !important; |
| 238 | +} |
| 239 | + |
| 240 | +/* Error notification */ |
| 241 | +.rust-example-error { |
| 242 | + background-color: #fff3cd; |
| 243 | + border: 1px solid #ffc107; |
| 244 | + border-radius: 4px; |
| 245 | + padding: 0.5em 1em; |
| 246 | + margin-top: 0.5em; |
| 247 | + display: flex; |
| 248 | + align-items: center; |
| 249 | + gap: 0.5em; |
| 250 | + font-size: 0.9em; |
| 251 | +} |
| 252 | + |
| 253 | +.rust-example-error-icon { |
| 254 | + font-size: 1.2em; |
| 255 | + flex-shrink: 0; |
| 256 | +} |
| 257 | + |
| 258 | +.rust-example-error-message { |
| 259 | + flex: 1; |
| 260 | + color: #856404; |
| 261 | +} |
| 262 | + |
| 263 | +.rust-example-error-retry { |
| 264 | + background-color: #0d6efd; |
| 265 | + color: white; |
| 266 | + border: none; |
| 267 | + border-radius: 3px; |
| 268 | + padding: 0.25em 0.75em; |
| 269 | + cursor: pointer; |
| 270 | + font-size: 0.85em; |
| 271 | +} |
| 272 | + |
| 273 | +.rust-example-error-retry:hover { |
| 274 | + background-color: #0b5ed7; |
| 275 | +} |
| 276 | + |
| 277 | +.rust-example-error-dismiss { |
| 278 | + background: transparent; |
| 279 | + border: none; |
| 280 | + font-size: 1.2em; |
| 281 | + cursor: pointer; |
| 282 | + color: #856404; |
| 283 | + padding: 0 0.25em; |
| 284 | +} |
| 285 | + |
| 286 | +.rust-example-error-dismiss:hover { |
| 287 | + color: #533f03; |
| 288 | +} |
| 289 | + |
| 290 | +/* Miri button styling */ |
| 291 | +.rust-btn-miri:hover { |
| 292 | + background-color: #6f42c1; |
| 293 | +} |
| 294 | + |
| 295 | +/* Miri-specific output status */ |
| 296 | +.rust-example-output-status.miri-success { color: #4caf50; } |
| 297 | +.rust-example-output-status.miri-success::before { content: "🔬 "; } |
| 298 | + |
| 299 | +.rust-example-output-status.miri-ub { color: #b02a37; } |
| 300 | +.rust-example-output-status.miri-ub::before { content: "☣️ "; } |
0 commit comments