_common.scss
754 lines
| 1 | // main: chatgpt.scss, messages.scss |
| 2 | |
| 3 | @mixin file-upload-icon-sprites { |
| 4 | $icon-size: 32px; |
| 5 | |
| 6 | &.mwai-idle-add { |
| 7 | background-position: -1 * $icon-size -3 * $icon-size; |
| 8 | } |
| 9 | |
| 10 | &.mwai-image-add { |
| 11 | background-position: -1 * $icon-size -0 * $icon-size; |
| 12 | } |
| 13 | |
| 14 | &.mwai-image-up { |
| 15 | background-position: -2 * $icon-size -0 * $icon-size; |
| 16 | } |
| 17 | |
| 18 | &.mwai-image-del { |
| 19 | background-position: -3 * $icon-size -0 * $icon-size; |
| 20 | } |
| 21 | |
| 22 | &.mwai-image-ok { |
| 23 | background-position: -4 * $icon-size -0 * $icon-size; |
| 24 | } |
| 25 | |
| 26 | &.mwai-document-add { |
| 27 | background-position: -1 * $icon-size -2 * $icon-size; |
| 28 | } |
| 29 | |
| 30 | &.mwai-document-up { |
| 31 | background-position: -2 * $icon-size -2 * $icon-size; |
| 32 | } |
| 33 | |
| 34 | &.mwai-document-del { |
| 35 | background-position: -3 * $icon-size -2 * $icon-size; |
| 36 | } |
| 37 | |
| 38 | &.mwai-document-ok { |
| 39 | background-position: -4 * $icon-size -2 * $icon-size; |
| 40 | } |
| 41 | |
| 42 | .mwai-file-upload-progress { |
| 43 | position: absolute; |
| 44 | font-size: 8px; |
| 45 | width: 21px; |
| 46 | top: 24px; |
| 47 | left: 23px; |
| 48 | overflow: hidden; |
| 49 | text-align: center; |
| 50 | font-weight: bold; |
| 51 | color: white; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | @mixin microphone { |
| 56 | |
| 57 | width: 32px; |
| 58 | height: 32px; |
| 59 | |
| 60 | svg { |
| 61 | width: 32px; |
| 62 | height: 32px; |
| 63 | fill: var(--mwai-fontColor); |
| 64 | opacity: 0.5; |
| 65 | filter: grayscale(100%); |
| 66 | transition: opacity 0.3s ease-out; |
| 67 | padding: 5px 10px; |
| 68 | cursor: pointer; |
| 69 | } |
| 70 | |
| 71 | &[active=true]=true] svg { |
| 72 | opacity: 1; |
| 73 | } |
| 74 | |
| 75 | &[disabled]] svg { |
| 76 | opacity: 0; |
| 77 | cursor: not-allowed; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | @mixin fullscreen-window { |
| 82 | position: fixed; |
| 83 | left: 0 !important; |
| 84 | right: 0 !important; |
| 85 | bottom: 0 !important; |
| 86 | top: 0 !important; |
| 87 | width: inherit; |
| 88 | height: inherit; |
| 89 | max-height: inherit; |
| 90 | max-width: inherit; |
| 91 | display: flex; |
| 92 | flex-direction: column; |
| 93 | margin: 0; |
| 94 | z-index: 999999; |
| 95 | background-color: var(--mwai-backgroundSecondaryColor); |
| 96 | |
| 97 | .mwai-header { |
| 98 | border-radius: 0; |
| 99 | } |
| 100 | |
| 101 | .mwai-content { |
| 102 | height: 100%; |
| 103 | max-height: inherit; |
| 104 | border-radius: 0; |
| 105 | |
| 106 | .mwai-conversation { |
| 107 | flex: auto; |
| 108 | max-height: none; |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | @mixin common-styles { |
| 114 | |
| 115 | // Transitions |
| 116 | |
| 117 | &.mwai-transition, .mwai-transition { |
| 118 | opacity: 0; |
| 119 | transition: opacity 350ms ease-in-out; |
| 120 | } |
| 121 | |
| 122 | &.mwai-transition-visible, .mwai-transition-visible { |
| 123 | opacity: 1; |
| 124 | } |
| 125 | |
| 126 | .mwai-text { |
| 127 | overflow-wrap: anywhere; |
| 128 | |
| 129 | img { |
| 130 | max-width: 100%; |
| 131 | } |
| 132 | |
| 133 | div { |
| 134 | p:first-child { |
| 135 | margin-top: 0; |
| 136 | } |
| 137 | p:last-child { |
| 138 | margin-bottom: 0; |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | // The icon when the chat window is closed. |
| 144 | |
| 145 | .mwai-trigger { |
| 146 | position: absolute; |
| 147 | right: 0; |
| 148 | bottom: 0; |
| 149 | transition: all 0.2s ease-out; |
| 150 | z-index: 9999; |
| 151 | display: flex; |
| 152 | flex-direction: column; |
| 153 | align-items: end; |
| 154 | |
| 155 | .mwai-icon-text-container { |
| 156 | display: flex; |
| 157 | flex-direction: column; |
| 158 | align-items: flex-end; |
| 159 | |
| 160 | .mwai-icon-text { |
| 161 | background: var(--mwai-iconTextBackgroundColor); |
| 162 | color: var(--mwai-iconTextColor); |
| 163 | box-shadow: 0px 0px 15px rgba(0, 0, 0, 0.15); |
| 164 | max-width: 200px; |
| 165 | font-size: 13px; |
| 166 | margin-bottom: 15px; |
| 167 | padding: 10px 15px; |
| 168 | border-radius: 8px; |
| 169 | } |
| 170 | |
| 171 | .mwai-icon-text-close { |
| 172 | color: var(--mwai-iconTextColor); |
| 173 | background: var(--mwai-iconTextBackgroundColor); |
| 174 | padding: 5px; |
| 175 | width: 20px; |
| 176 | height: 20px; |
| 177 | border-radius: 100%; |
| 178 | display: none; |
| 179 | justify-content: center; |
| 180 | align-items: center; |
| 181 | margin-bottom: 3px; |
| 182 | } |
| 183 | |
| 184 | &:hover { |
| 185 | cursor: pointer; |
| 186 | |
| 187 | .mwai-icon-text-close { |
| 188 | display: flex; |
| 189 | font-size: 12px; |
| 190 | |
| 191 | &:hover { |
| 192 | filter: brightness(1.2); |
| 193 | } |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | @media (max-width: 760px) { |
| 198 | .mwai-icon-text-close { |
| 199 | display: flex; |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | } |
| 204 | |
| 205 | .mwai-icon-container { |
| 206 | |
| 207 | .mwai-icon { |
| 208 | filter: drop-shadow(0px 0px 15px rgba(0, 0, 0, 0.15)); |
| 209 | transition: all 0.2s ease-out; |
| 210 | |
| 211 | &:hover { |
| 212 | cursor: pointer; |
| 213 | transform: scale(1.05); |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | // Handle the chat window and fullscreen. |
| 220 | // Let's keep this common for all themes. |
| 221 | |
| 222 | &.mwai-window { |
| 223 | position: fixed; |
| 224 | right: 30px; |
| 225 | bottom: 30px; |
| 226 | width: var(--mwai-width); |
| 227 | z-index: 9999; |
| 228 | |
| 229 | .mwai-header { |
| 230 | display: none; |
| 231 | justify-content: flex-end; |
| 232 | align-items: center; |
| 233 | border-radius: var(--mwai-borderRadius) var(--mwai-borderRadius) 0 0; |
| 234 | background: var(--mwai-backgroundHeaderColor); |
| 235 | |
| 236 | .mwai-buttons { |
| 237 | display: flex; |
| 238 | align-items: center; |
| 239 | |
| 240 | .mwai-resize-button { |
| 241 | justify-content: center; |
| 242 | height: 32px; |
| 243 | width: 22px; |
| 244 | cursor: pointer; |
| 245 | display: flex; |
| 246 | justify-content: center; |
| 247 | align-items: center; |
| 248 | |
| 249 | &:before { |
| 250 | transition: all 0.2s ease-out; |
| 251 | content: ' '; |
| 252 | cursor: pointer; |
| 253 | position: absolute; |
| 254 | height: 13px; |
| 255 | width: 13px; |
| 256 | border: 1px solid var(--mwai-headerButtonsColor); |
| 257 | } |
| 258 | |
| 259 | &:hover:before { |
| 260 | width: 16px; |
| 261 | height: 16px; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | .mwai-close-button { |
| 266 | justify-content: center; |
| 267 | height: 32px; |
| 268 | width: 33px; |
| 269 | cursor: pointer; |
| 270 | border-radius: var(--mwai-borderRadius); |
| 271 | |
| 272 | &:before { |
| 273 | transition: all 0.2s ease-out; |
| 274 | transform: translate(16px, 5px) rotate(45deg); |
| 275 | } |
| 276 | &:after { |
| 277 | transition: all 0.2s ease-out; |
| 278 | transform: translate(16px, 5px) rotate(-45deg); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | .mwai-close-button:before, .mwai-close-button:after { |
| 283 | content: ' '; |
| 284 | cursor: pointer; |
| 285 | position: absolute; |
| 286 | height: 22px; |
| 287 | width: 1px; |
| 288 | background-color: var(--mwai-headerButtonsColor); |
| 289 | } |
| 290 | |
| 291 | .mwai-close-button:hover { |
| 292 | &:before { |
| 293 | opacity: 1; |
| 294 | transform: translate(16px, 5px) rotate(135deg); |
| 295 | } |
| 296 | &:after { |
| 297 | opacity: 1; |
| 298 | transform: translate(16px, 5px) rotate(45deg); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | .mwai-content { |
| 306 | display: none; |
| 307 | opacity: 0; |
| 308 | max-height: var(--mwai-maxHeight); |
| 309 | border-radius: 0 0 var(--mwai-borderRadius) var(--mwai-borderRadius); |
| 310 | } |
| 311 | |
| 312 | &.mwai-bottom-left { |
| 313 | bottom: 30px; |
| 314 | right: inherit; |
| 315 | left: 30px; |
| 316 | |
| 317 | .mwai-trigger { |
| 318 | right: inherit; |
| 319 | left: 0; |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | &.mwai-top-right { |
| 324 | top: 30px; |
| 325 | bottom: inherit; |
| 326 | right: 30px; |
| 327 | |
| 328 | .mwai-trigger { |
| 329 | top: 0; |
| 330 | bottom: inherit; |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | &.mwai-top-left { |
| 335 | top: 30px; |
| 336 | bottom: inherit; |
| 337 | right: inherit; |
| 338 | left: 30px; |
| 339 | |
| 340 | .mwai-trigger { |
| 341 | top: 0; |
| 342 | bottom: inherit; |
| 343 | right: inherit; |
| 344 | left: 0; |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | &.mwai-top-left, &.mwai-bottom-left { |
| 349 | |
| 350 | .mwai-trigger { |
| 351 | align-items: flex-start; |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | &.mwai-top-right, &.mwai-top-left { |
| 356 | |
| 357 | .mwai-trigger { |
| 358 | flex-direction: column-reverse; |
| 359 | |
| 360 | .mwai-icon-text { |
| 361 | margin-bottom: 0; |
| 362 | margin-top: 15px; |
| 363 | } |
| 364 | } |
| 365 | } |
| 366 | } |
| 367 | |
| 368 | // Popup chat is fullscreen |
| 369 | |
| 370 | &.mwai-window.mwai-fullscreen { |
| 371 | |
| 372 | .mwai-header { |
| 373 | |
| 374 | .mwai-buttons { |
| 375 | margin-bottom: 0px; |
| 376 | |
| 377 | .mwai-resize-button { |
| 378 | &:before { |
| 379 | width: 16px; |
| 380 | height: 16px; |
| 381 | } |
| 382 | |
| 383 | &:hover:before { |
| 384 | width: 13px; |
| 385 | height: 13px; |
| 386 | } |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | // Standard chat is fullscreen |
| 393 | |
| 394 | &.mwai-fullscreen:not(.mwai-window), &.mwai-fullscreen.mwai-window.mwai-open { |
| 395 | @include fullscreen-window; |
| 396 | } |
| 397 | |
| 398 | // Popup chat is open |
| 399 | |
| 400 | &.mwai-window.mwai-open { |
| 401 | |
| 402 | .mwai-header { |
| 403 | display: flex; |
| 404 | } |
| 405 | |
| 406 | .mwai-content { |
| 407 | display: flex; |
| 408 | transition: opacity 200ms ease-in-out 0s; |
| 409 | opacity: 1; |
| 410 | } |
| 411 | |
| 412 | .mwai-trigger { |
| 413 | display: none; |
| 414 | } |
| 415 | } |
| 416 | |
| 417 | .mwai-error { |
| 418 | margin: var(--mwai-spacing); |
| 419 | color: white; |
| 420 | background: rgba(180, 55, 55, 0.55); |
| 421 | padding: var(--mwai-spacing); |
| 422 | border-radius: var(--mwai-borderRadius); |
| 423 | |
| 424 | &:hover { |
| 425 | cursor: pointer; |
| 426 | background: rgba(180, 44, 44, 0.85); |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | &.mwai-bubble .mwai-icon-container { |
| 431 | background: var(--mwai-bubbleColor); |
| 432 | width: 60px; |
| 433 | height: 60px; |
| 434 | border-radius: 100%; |
| 435 | transition: all 0.2s ease-out; |
| 436 | display: flex; |
| 437 | justify-content: center; |
| 438 | align-items: center; |
| 439 | |
| 440 | .mwai-icon { |
| 441 | max-width: 50%; |
| 442 | max-height: 50%; |
| 443 | filter: none; |
| 444 | |
| 445 | &:hover { |
| 446 | transform: none; |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | .mwai-emoji { |
| 451 | font-size: 30px !important; |
| 452 | } |
| 453 | |
| 454 | &:hover { |
| 455 | cursor: pointer; |
| 456 | filter: brightness(1.1); |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | @media (max-width: 760px) { |
| 461 | &.mwai-window.mwai-open { |
| 462 | @include fullscreen-window; |
| 463 | |
| 464 | .mwai-input { |
| 465 | flex-direction: column; |
| 466 | |
| 467 | button { |
| 468 | font-size: 16px; |
| 469 | margin-left: 0; |
| 470 | width: 100%; |
| 471 | } |
| 472 | |
| 473 | .mwai-input-text { |
| 474 | //margin-bottom: var(--mwai-spacing); |
| 475 | width: 100%; |
| 476 | |
| 477 | // This is to avoid iOS from zooming in when focusing on an input field. |
| 478 | input, textarea { |
| 479 | font-size: 16px; |
| 480 | } |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | .mwai-content { |
| 485 | display: flex; |
| 486 | transition: opacity 200ms ease-in-out 0s; |
| 487 | opacity: 1; |
| 488 | height: 100%; |
| 489 | max-height: inherit; |
| 490 | |
| 491 | .mwai-conversation { |
| 492 | flex: auto; |
| 493 | max-height: none; |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | .mwai-resize-button { |
| 498 | display: none !important; |
| 499 | } |
| 500 | |
| 501 | .mwai-trigger { |
| 502 | display: none; |
| 503 | } |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | // Keyframes for buttons |
| 508 | |
| 509 | @keyframes mwai-button-spinner { |
| 510 | |
| 511 | from { |
| 512 | transform: rotate(0turn); |
| 513 | } |
| 514 | to { |
| 515 | transform: rotate(1turn); |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | // WordPress Admin Bar |
| 520 | |
| 521 | .admin-bar .mwai-fullscreen:not(.mwai-window), |
| 522 | .admin-bar .mwai-fullscreen.mwai-window.mwai-open { |
| 523 | top: 32px; |
| 524 | } |
| 525 | } |
| 526 | |
| 527 | @mixin code-dark { |
| 528 | |
| 529 | pre code.hljs { |
| 530 | display: block; |
| 531 | overflow-x: auto; |
| 532 | padding: 1em; |
| 533 | } |
| 534 | |
| 535 | code.hljs { |
| 536 | padding: 3px 5px; |
| 537 | } |
| 538 | |
| 539 | .hljs { |
| 540 | color: #fff; |
| 541 | |
| 542 | &-subst { |
| 543 | color: #fff; |
| 544 | } |
| 545 | |
| 546 | &-comment { |
| 547 | color: #999; |
| 548 | } |
| 549 | |
| 550 | &-attr, |
| 551 | &-doctag, |
| 552 | &-keyword, |
| 553 | &-meta .hljs-keyword, |
| 554 | &-section, |
| 555 | &-selector-tag { |
| 556 | color: #88aece; |
| 557 | } |
| 558 | |
| 559 | &-attribute { |
| 560 | color: #c59bc1; |
| 561 | } |
| 562 | |
| 563 | &-name, |
| 564 | &-number, |
| 565 | &-quote, |
| 566 | &-selector-id, |
| 567 | &-template-tag, |
| 568 | &-type { |
| 569 | color: #f08d49; |
| 570 | } |
| 571 | |
| 572 | &-selector-class { |
| 573 | color: #88aece; |
| 574 | } |
| 575 | |
| 576 | &-link, |
| 577 | &-regexp, |
| 578 | &-selector-attr, |
| 579 | &-string, |
| 580 | &-symbol, |
| 581 | &-template-variable, |
| 582 | &-variable { |
| 583 | color: #b5bd68; |
| 584 | } |
| 585 | |
| 586 | &-meta, |
| 587 | &-selector-pseudo { |
| 588 | color: #88aece; |
| 589 | } |
| 590 | |
| 591 | &-built_in, |
| 592 | &-literal, |
| 593 | &-title { |
| 594 | color: #f08d49; |
| 595 | } |
| 596 | |
| 597 | &-bullet, |
| 598 | &-code { |
| 599 | color: #ccc; |
| 600 | } |
| 601 | |
| 602 | &-meta .hljs-string { |
| 603 | color: #b5bd68; |
| 604 | } |
| 605 | |
| 606 | &-deletion { |
| 607 | color: #de7176; |
| 608 | } |
| 609 | |
| 610 | &-addition { |
| 611 | color: #76c490; |
| 612 | } |
| 613 | |
| 614 | &-emphasis { |
| 615 | font-style: italic; |
| 616 | } |
| 617 | |
| 618 | &-strong { |
| 619 | font-weight: 700; |
| 620 | } |
| 621 | } |
| 622 | } |
| 623 | |
| 624 | @mixin code-light { |
| 625 | |
| 626 | pre code.hljs { |
| 627 | display: block; |
| 628 | overflow-x: auto; |
| 629 | padding: 1em; |
| 630 | } |
| 631 | |
| 632 | code.hljs { |
| 633 | padding: 3px 5px; |
| 634 | } |
| 635 | |
| 636 | .hljs { |
| 637 | color: #333; |
| 638 | background: #f0f0f0; |
| 639 | |
| 640 | &-subst { |
| 641 | color: #333; |
| 642 | } |
| 643 | |
| 644 | &-comment { |
| 645 | color: #888; |
| 646 | } |
| 647 | |
| 648 | &-attr, |
| 649 | &-doctag, |
| 650 | &-keyword, |
| 651 | &-meta .hljs-keyword, |
| 652 | &-section, |
| 653 | &-selector-tag { |
| 654 | color: #0077cc; |
| 655 | } |
| 656 | |
| 657 | &-attribute { |
| 658 | color: #aa3377; |
| 659 | } |
| 660 | |
| 661 | &-name, |
| 662 | &-number, |
| 663 | &-quote, |
| 664 | &-selector-id, |
| 665 | &-template-tag, |
| 666 | &-type { |
| 667 | color: #c18401; |
| 668 | } |
| 669 | |
| 670 | &-selector-class { |
| 671 | color: #0077cc; |
| 672 | } |
| 673 | |
| 674 | &-link, |
| 675 | &-regexp, |
| 676 | &-selector-attr, |
| 677 | &-string, |
| 678 | &-symbol, |
| 679 | &-template-variable, |
| 680 | &-variable { |
| 681 | color: #689700; |
| 682 | } |
| 683 | |
| 684 | &-meta, |
| 685 | &-selector-pseudo { |
| 686 | color: #0077cc; |
| 687 | } |
| 688 | |
| 689 | &-built_in, |
| 690 | &-literal, |
| 691 | &-title { |
| 692 | color: #c18401; |
| 693 | } |
| 694 | |
| 695 | &-bullet, |
| 696 | &-code { |
| 697 | color: #555; |
| 698 | } |
| 699 | |
| 700 | &-meta .hljs-string { |
| 701 | color: #689700; |
| 702 | } |
| 703 | |
| 704 | &-deletion { |
| 705 | color: #b71c1c; |
| 706 | } |
| 707 | |
| 708 | &-addition { |
| 709 | color: #1b5e20; |
| 710 | } |
| 711 | |
| 712 | &-emphasis { |
| 713 | font-style: italic; |
| 714 | } |
| 715 | |
| 716 | &-strong { |
| 717 | font-weight: 700; |
| 718 | } |
| 719 | } |
| 720 | } |
| 721 | |
| 722 | @mixin reply-actions { |
| 723 | .mwai-reply-actions { |
| 724 | position: absolute; |
| 725 | border-radius: 5px; |
| 726 | top: 10px; |
| 727 | right: 10px; |
| 728 | display: flex; |
| 729 | align-items: center; |
| 730 | padding: 2px 2px; |
| 731 | z-index: 100; |
| 732 | background: var(--mwai-backgroundPrimaryColor); |
| 733 | box-shadow: 0 0 8px rgba(0, 0, 0, 0.25); |
| 734 | z-index: 100; |
| 735 | |
| 736 | .mwai-copy-button { |
| 737 | fill: var(--mwai-fontColor); |
| 738 | padding: 3px 5px; |
| 739 | width: 24px; |
| 740 | height: 24px; |
| 741 | background: var(--mwai-backgroundPrimaryColor); |
| 742 | cursor: pointer; |
| 743 | border-radius: 5px; |
| 744 | |
| 745 | &:hover { |
| 746 | filter: brightness(1.2); |
| 747 | } |
| 748 | } |
| 749 | |
| 750 | &.mwai-hidden { |
| 751 | opacity: 0; |
| 752 | } |
| 753 | } |
| 754 | } |