diff options
| author | Hsieh Chin Fan <pham@topo.tw> | 2024-09-25 11:40:31 +0800 |
|---|---|---|
| committer | Hsieh Chin Fan <pham@topo.tw> | 2024-09-26 19:40:48 +0800 |
| commit | 3f4f3b63574726ea98861cfea0dd830bedbfb0ac (patch) | |
| tree | 199321454e68a0918c1575f20148487b317e9028 | |
| parent | 22be38a505183a5615b2934571e4c95b55c07583 (diff) | |
chore(CSS): improve looking
| -rw-r--r-- | src/Layout.mjs | 2 | ||||
| -rw-r--r-- | src/css/dumbymap.css | 123 | ||||
| -rw-r--r-- | src/css/style.css | 4 |
3 files changed, 97 insertions, 32 deletions
diff --git a/src/Layout.mjs b/src/Layout.mjs index 53b81fe..abefd4d 100644 --- a/src/Layout.mjs +++ b/src/Layout.mjs | |||
| @@ -65,7 +65,7 @@ export class Overlay extends Layout { | |||
| 65 | element.onmouseover = () => { | 65 | element.onmouseover = () => { |
| 66 | popTimer = setTimeout(() => { | 66 | popTimer = setTimeout(() => { |
| 67 | siblings.forEach(e => e.style.removeProperty('z-index')) | 67 | siblings.forEach(e => e.style.removeProperty('z-index')) |
| 68 | element.style.zIndex = '9000' | 68 | element.style.zIndex = '9001' |
| 69 | }, 200) | 69 | }, 200) |
| 70 | } | 70 | } |
| 71 | element.onmouseout = () => { | 71 | element.onmouseout = () => { |
diff --git a/src/css/dumbymap.css b/src/css/dumbymap.css index 3826ffc..985f5ec 100644 --- a/src/css/dumbymap.css +++ b/src/css/dumbymap.css | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | @keyframes fade-out { | 15 | @keyframes fade-out { |
| 16 | from { opacity: 1; } | 16 | from { opacity: 1; } |
| 17 | to { opacity: 0; visibility: hidden; } | 17 | to { visibility: hidden; opacity: 0; } |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | @keyframes map-fade-in { | 20 | @keyframes map-fade-in { |
| @@ -28,7 +28,32 @@ | |||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | .map-container { | 30 | .map-container { |
| 31 | position: relative; | ||
| 31 | transform-origin: top left; | 32 | transform-origin: top left; |
| 33 | |||
| 34 | &.focus::after { | ||
| 35 | content: "Map-ID: " attr(id); | ||
| 36 | padding: .3rem .5rem; | ||
| 37 | |||
| 38 | position: absolute; | ||
| 39 | left: 50%; | ||
| 40 | top: 50%; | ||
| 41 | z-index: 9999; | ||
| 42 | |||
| 43 | border: solid transparent; | ||
| 44 | border-radius: 5px; | ||
| 45 | |||
| 46 | background: gray; | ||
| 47 | |||
| 48 | color: white; | ||
| 49 | font-size: 1.5rem; | ||
| 50 | font-weight: bold; | ||
| 51 | line-height: 1.2; | ||
| 52 | |||
| 53 | transform: translate(-50%, -50%); | ||
| 54 | opacity: 0; | ||
| 55 | animation: 1.5s forwards fade-out cubic-bezier(.44,.18,.86,-0.21); | ||
| 56 | } | ||
| 32 | } | 57 | } |
| 33 | 58 | ||
| 34 | .with-leader-line:not(:has(> *)) { | 59 | .with-leader-line:not(:has(> *)) { |
| @@ -96,30 +121,32 @@ | |||
| 96 | &::before { | 121 | &::before { |
| 97 | content: ""; | 122 | content: ""; |
| 98 | height: calc(100% - 2rem); | 123 | height: calc(100% - 2rem); |
| 99 | position: absolute; | ||
| 100 | 124 | ||
| 125 | position: absolute; | ||
| 101 | left: 0.8rem; | 126 | left: 0.8rem; |
| 102 | 127 | ||
| 103 | border-left: 0.5em solid #e0e0e0; | 128 | border-left: 0.5em solid #e0e0e0; |
| 129 | |||
| 104 | transition: border-color .5s linear; | 130 | transition: border-color .5s linear; |
| 105 | } | 131 | } |
| 106 | 132 | ||
| 107 | &.focus { | 133 | &.focus { |
| 134 | |||
| 135 | /* Dress up when block is focus */ | ||
| 136 | |||
| 108 | /* background: var(--block-focus-color); */ | 137 | /* background: var(--block-focus-color); */ |
| 109 | &::before { | 138 | &::before { |
| 110 | border-color: chocolate; | 139 | border-color: chocolate; |
| 111 | } | 140 | } |
| 112 | 141 | ||
| 113 | &::after { | 142 | &::after { |
| 114 | z-index: 9999; | ||
| 115 | content: counter(block) "/" attr(data-total); | 143 | content: counter(block) "/" attr(data-total); |
| 116 | padding: .3rem .5rem; | 144 | padding: .3rem .5rem; |
| 117 | 145 | ||
| 118 | position: absolute; | 146 | position: absolute; |
| 119 | left: 0; | ||
| 120 | top: 10px; | ||
| 121 | left: 50%; | 147 | left: 50%; |
| 122 | transform: translateX(-50%); | 148 | top: 50%; |
| 149 | z-index: 9999; | ||
| 123 | 150 | ||
| 124 | border: solid transparent; | 151 | border: solid transparent; |
| 125 | border-radius: 5px; | 152 | border-radius: 5px; |
| @@ -130,6 +157,7 @@ | |||
| 130 | font-size: 1.5em; | 157 | font-size: 1.5em; |
| 131 | font-weight: bold; | 158 | font-weight: bold; |
| 132 | 159 | ||
| 160 | transform: translate(-50%, -50%); | ||
| 133 | opacity: 0; | 161 | opacity: 0; |
| 134 | animation: 1.5s forwards fade-out cubic-bezier(.44,.18,.86,-0.21); | 162 | animation: 1.5s forwards fade-out cubic-bezier(.44,.18,.86,-0.21); |
| 135 | } | 163 | } |
| @@ -152,36 +180,32 @@ | |||
| 152 | overflow-y: auto; | 180 | overflow-y: auto; |
| 153 | gap: 1rem; | 181 | gap: 1rem; |
| 154 | 182 | ||
| 155 | pre { | 183 | justify-content: flex-start; |
| 156 | width: 100%; | ||
| 157 | 184 | ||
| 158 | &:has(.map-container) { | 185 | :has(.map-container, [data-placeholder]) { |
| 159 | display: flex; | 186 | display: flex; |
| 160 | justify-content: flex-start; | 187 | gap: 0.5em; |
| 161 | 188 | ||
| 162 | background-color: inherit; | 189 | background-color: white; |
| 163 | } | ||
| 164 | } | 190 | } |
| 165 | 191 | ||
| 192 | /* if Map not in showcase, add border when focused */ | ||
| 166 | .map-container { | 193 | .map-container { |
| 167 | margin: 2px; | ||
| 168 | |||
| 169 | border: 3px solid transparent; | 194 | border: 3px solid transparent; |
| 170 | 195 | ||
| 171 | background: white; | ||
| 172 | |||
| 173 | &.focus { | 196 | &.focus { |
| 174 | border: 3px solid gray; | 197 | border: 3px solid gray; |
| 175 | } | 198 | } |
| 176 | } | 199 | } |
| 177 | 200 | ||
| 178 | [data-placeholder] { | 201 | [data-placeholder] { |
| 179 | margin: 2px; | ||
| 180 | |||
| 181 | border: 3px solid gray; | 202 | border: 3px solid gray; |
| 203 | flex-grow: 0; | ||
| 182 | 204 | ||
| 183 | opacity: 0.3; | 205 | & > * { |
| 184 | animation: map-fade-out 1s; | 206 | opacity: 0.3; |
| 207 | } | ||
| 208 | /* animation: map-fade-out 1s; */ | ||
| 185 | } | 209 | } |
| 186 | } | 210 | } |
| 187 | 211 | ||
| @@ -206,13 +230,43 @@ | |||
| 206 | } | 230 | } |
| 207 | } | 231 | } |
| 208 | 232 | ||
| 233 | &::after { | ||
| 234 | content: "Layout: " attr(data-layout); | ||
| 235 | padding: .3rem .5rem; | ||
| 236 | |||
| 237 | position: absolute; | ||
| 238 | left: 50%; | ||
| 239 | top: 50%; | ||
| 240 | z-index: 9999; | ||
| 241 | |||
| 242 | border: solid transparent; | ||
| 243 | border-radius: 5px; | ||
| 244 | |||
| 245 | background: gray; | ||
| 246 | |||
| 247 | color: white; | ||
| 248 | font-size: 1.5rem; | ||
| 249 | font-weight: bold; | ||
| 250 | line-height: 1.2; | ||
| 251 | |||
| 252 | transform: translate(-50%, -50%); | ||
| 253 | opacity: 0; | ||
| 254 | } | ||
| 209 | } | 255 | } |
| 210 | 256 | ||
| 211 | .Dumby[data-layout="normal"] { | 257 | .Dumby[data-layout="normal"] { |
| 212 | max-width: 60em; | 258 | max-width: 60em; |
| 259 | |||
| 260 | &::after { | ||
| 261 | animation: 1.5s forwards fade-out cubic-bezier(.44,.18,.86,-0.21); | ||
| 262 | } | ||
| 213 | } | 263 | } |
| 214 | 264 | ||
| 215 | .Dumby[data-layout="side-by-side"] { | 265 | .Dumby[data-layout="side-by-side"] { |
| 266 | &::after { | ||
| 267 | animation: 1.5s forwards fade-out cubic-bezier(.44,.18,.86,-0.21); | ||
| 268 | } | ||
| 269 | |||
| 216 | .SemanticHtml, | 270 | .SemanticHtml, |
| 217 | .Showcase { | 271 | .Showcase { |
| 218 | width: 50%; | 272 | width: 50%; |
| @@ -273,6 +327,10 @@ | |||
| 273 | } | 327 | } |
| 274 | 328 | ||
| 275 | .Dumby[data-layout="overlay"] { | 329 | .Dumby[data-layout="overlay"] { |
| 330 | &::after { | ||
| 331 | animation: 1.5s forwards fade-out cubic-bezier(.44,.18,.86,-0.21); | ||
| 332 | } | ||
| 333 | |||
| 276 | .SemanticHtml, | 334 | .SemanticHtml, |
| 277 | .Showcase { | 335 | .Showcase { |
| 278 | display: block; | 336 | display: block; |
| @@ -357,6 +415,7 @@ | |||
| 357 | pointer-events: auto; | 415 | pointer-events: auto; |
| 358 | 416 | ||
| 359 | &:has(.dumby-block.focus) { | 417 | &:has(.dumby-block.focus) { |
| 418 | z-index: 9001; | ||
| 360 | outline: solid #505050 1px; | 419 | outline: solid #505050 1px; |
| 361 | border-color: #505050 | 420 | border-color: #505050 |
| 362 | } | 421 | } |
| @@ -365,19 +424,20 @@ | |||
| 365 | display: none; | 424 | display: none; |
| 366 | } | 425 | } |
| 367 | 426 | ||
| 427 | /* Fade out top of contents scrolling */ | ||
| 368 | &::before { | 428 | &::before { |
| 369 | content: ''; | 429 | content: ''; |
| 370 | display: block; | 430 | display: block; |
| 371 | height: 1.5rem; | 431 | height: 1.5rem; |
| 372 | 432 | ||
| 373 | position: absolute; | 433 | position: absolute; |
| 374 | top: 0; | ||
| 375 | left: 0; | 434 | left: 0; |
| 435 | top: 0; | ||
| 376 | right: 0; | 436 | right: 0; |
| 437 | z-index: 1; | ||
| 377 | 438 | ||
| 378 | border: none; | 439 | border-radius: 5px; |
| 379 | 440 | ||
| 380 | z-index: 1; | ||
| 381 | background: linear-gradient(0deg, rgb(255 255 255 / 0%), white 60%); | 441 | background: linear-gradient(0deg, rgb(255 255 255 / 0%), white 60%); |
| 382 | } | 442 | } |
| 383 | 443 | ||
| @@ -387,8 +447,10 @@ | |||
| 387 | 447 | ||
| 388 | position: relative; | 448 | position: relative; |
| 389 | 449 | ||
| 390 | border: solid transparent 3px; | 450 | /* Don't make corner overflow! */ |
| 451 | border: solid transparent 2px; | ||
| 391 | border-radius: 0.5rem; | 452 | border-radius: 0.5rem; |
| 453 | |||
| 392 | resize: both; | 454 | resize: both; |
| 393 | min-width: 5rem; | 455 | min-width: 5rem; |
| 394 | max-width: 25vw; | 456 | max-width: 25vw; |
| @@ -397,6 +459,7 @@ | |||
| 397 | padding-inline: 1rem; | 459 | padding-inline: 1rem; |
| 398 | padding-block: 1rem 0; | 460 | padding-block: 1rem 0; |
| 399 | 461 | ||
| 462 | /* Remove indicator when inside draggable-block */ | ||
| 400 | &::before { | 463 | &::before { |
| 401 | display: none; | 464 | display: none; |
| 402 | } | 465 | } |
| @@ -408,12 +471,6 @@ | |||
| 408 | max-height: unset; | 471 | max-height: unset; |
| 409 | } | 472 | } |
| 410 | 473 | ||
| 411 | /* gray out top of content, make draggable part easy to be seen */ | ||
| 412 | |||
| 413 | /* &.focus::before { */ | ||
| 414 | /* background: linear-gradient(0deg, rgb(255 255 255 / 0%), var(--block-focus-color) 60%); */ | ||
| 415 | /* } */ | ||
| 416 | |||
| 417 | .map-container { | 474 | .map-container { |
| 418 | min-width: 200px; | 475 | min-width: 200px; |
| 419 | } | 476 | } |
| @@ -448,6 +505,10 @@ | |||
| 448 | transition: all 0.5s; | 505 | transition: all 0.5s; |
| 449 | visibility: hidden; | 506 | visibility: hidden; |
| 450 | opacity: 0; | 507 | opacity: 0; |
| 508 | |||
| 509 | .utils { | ||
| 510 | visibility: hidden !important; | ||
| 511 | } | ||
| 451 | } | 512 | } |
| 452 | 513 | ||
| 453 | &.drag, &:has(.draggable-part:hover) { | 514 | &.drag, &:has(.draggable-part:hover) { |
diff --git a/src/css/style.css b/src/css/style.css index 122e027..9f15574 100644 --- a/src/css/style.css +++ b/src/css/style.css | |||
| @@ -66,6 +66,10 @@ a:hover { | |||
| 66 | text-decoration: underline; | 66 | text-decoration: underline; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | pre { | ||
| 70 | width: 100%; | ||
| 71 | } | ||
| 72 | |||
| 69 | pre:has(code) { | 73 | pre:has(code) { |
| 70 | display: block; | 74 | display: block; |
| 71 | margin: 0 0 10px; | 75 | margin: 0 0 10px; |