TelegramPWA/src/components/middle/message/_message-content.scss
2022-01-25 03:24:26 +01:00

823 lines
15 KiB
SCSS

.message-content {
position: relative;
max-width: var(--max-width);
@media (max-width: 600px) {
max-width: calc(100vw - 6.25rem);
.Message.own &,
.MessageList.no-avatars & {
max-width: calc(100vw - 3.75rem);
}
// Workaround for sass function override - we should use CSS min() here
@supports (max-width: #{"min(29rem, 100vw - 6.25rem)"}) {
max-width: #{"min(29rem, 100vw - 6.25rem)"};
.MessageList.no-avatars & {
max-width: #{"min(29rem, 100vw - 3.75rem)"};
}
.Message.own & {
max-width: #{"min(30rem, 100vw - 3.75rem)"};
}
}
&.has-action-button {
max-width: calc(100vw - 7rem);
.Message.own &,
.MessageList.no-avatars & {
max-width: calc(100vw - 4.5rem);
}
// Workaround for sass function override - we should use CSS min() here
@supports (max-width: #{"min(29rem, 100vw - 5.5rem)"}) {
max-width: #{"min(29rem, 100vw - 7rem)"};
.MessageList.no-avatars & {
max-width: #{"min(29rem, 100vw - 4.5rem)"};
}
.Message.own & {
max-width: #{"min(30rem, 100vw - 4.5rem)"};
}
}
}
}
img {
-webkit-touch-callout: none;
user-select: none;
}
.emoji {
-webkit-user-drag: none;
user-select: text;
}
.text-content {
margin: 0;
word-break: break-word;
line-height: 1.3125;
text-align: initial;
display: flow-root;
unicode-bidi: plaintext;
}
.text-entity-link {
unicode-bidi: plaintext;
}
&:not(.custom-shape) .text-content,
&.document {
& > .MessageMeta {
position: relative;
top: .375rem;
bottom: auto !important;
float: right;
line-height: 1.35;
height: calc(var(--message-meta-height, 1rem));
margin-left: .4375rem;
margin-right: -.5rem;
.MessageOutgoingStatus .Transition {
max-height: calc(var(--message-meta-height, 1rem));
overflow: hidden;
}
html[data-message-text-size="12"] & {
top: .25rem;
}
html[data-message-text-size="17"] & {
top: .4375rem;
}
html[data-message-text-size="18"] &,
html[data-message-text-size="19"] & {
top: .5rem;
}
html[data-message-text-size="20"] & {
top: .5625rem;
}
}
&:dir(rtl) {
& > .MessageMeta {
float: left;
margin-left: -.25rem;
margin-right: .4375rem;
}
}
}
.MessageMeta.reactions-offset {
position: relative;
top: .375rem;
bottom: auto !important;
float: right;
line-height: 1;
height: calc(var(--message-meta-height, 1rem));
margin-left: auto;
margin-right: -.5rem;
align-self: flex-end;
.MessageOutgoingStatus .Transition {
max-height: calc(var(--message-meta-height, 1rem));
overflow: hidden;
}
html[data-message-text-size="12"] & {
top: .25rem;
}
html[data-message-text-size="17"] & {
top: .4375rem;
}
html[data-message-text-size="18"] &,
html[data-message-text-size="19"] & {
top: .5rem;
}
html[data-message-text-size="20"] & {
top: .5625rem;
}
}
&.document:not(.text) {
&::after {
content: "";
display: block;
clear: both;
}
& > .MessageMeta {
top: auto !important;
bottom: -.5rem !important;
margin-top: -.25rem;
&:not([dir=rtl]) {
margin-top: -1.25rem;
}
}
}
.theme-dark .Message.own & {
.text-entity-link {
text-decoration: underline !important;
&:hover {
text-decoration: none !important;
}
}
}
&:not(.custom-shape) {
font-size: var(--message-text-size, 1rem);
body.is-ios & {
font-size: var(--message-text-size, 1.0625rem);
}
& > .content-inner {
min-width: 0;
}
}
.matching-text-highlight {
background: #CAE3F7;
border-radius: 0.25rem;
padding: 0 0.125rem;
}
.message-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: calc(var(--message-text-size, 1rem) - .125rem);
font-weight: 500;
line-height: 1.25rem;
color: var(--accent-color);
unicode-bidi: plaintext;
display: flex;
& > .interactive {
overflow: hidden;
text-overflow: ellipsis;
}
&.interactive, & > .interactive {
cursor: pointer;
&:hover {
opacity: 0.85;
}
}
& > .color-1 {
color: var(--color-user-1);
}
& > .color-2 {
color: var(--color-user-2);
}
& > .color-4 {
color: var(--color-user-4);
}
& > .color-5 {
color: var(--color-user-5);
}
& > .color-6 {
color: var(--color-user-6);
}
& > .color-7 {
color: var(--color-user-7);
}
& > .color-8 {
color: var(--color-user-8);
}
.theme-dark .Message.own & > .color-1 {
color: var(--accent-color);
}
& + .File {
margin-top: .25rem;
}
.via {
padding-right: .25rem;
font-weight: 400;
}
span + .via {
padding-left: .25rem;
}
.admin-title {
flex: 1;
margin-left: 1rem;
text-align: right;
font-weight: 400;
font-size: 0.75rem;
margin-top: -0.1rem;
color: rgba(var(--color-text-meta-rgb), 0.75);
.Message.own & {
color: var(--accent-color);
}
}
}
&.has-shadow {
box-shadow: 0 1px 2px var(--color-default-shadow);
}
&.has-solid-background, &.has-background, .is-album & {
background: var(--background-color);
}
&.has-solid-background {
padding: .3125rem .5rem .375rem;
.forwarded-message > .text-content:not(.with-meta):last-child::after {
content: '';
display: inline-block;
width: var(--meta-safe-area-size);
height: 1rem;
}
}
body.is-ios &.has-solid-background {
padding-bottom: 0.4375rem;
}
body.is-ios .Message.own &.has-solid-background {
padding-left: 0.625rem;
}
&:not(.has-appendix) .svg-appendix {
display: none;
}
.svg-appendix {
overflow: hidden;
position: absolute;
bottom: -.0625rem;
width: .5625rem;
height: 1.125rem;
font-size: 1rem !important;
.corner {
fill: var(--background-color);
}
.Message.own & {
right: -.551rem; // This value is correct. Safari fix
}
.Message:not(.own) & {
left: -.562rem; // This value is correct. Safari fix
}
}
&[data-has-custom-appendix] {
.svg-appendix .corner {
fill: var(--appendix-bg);
}
}
&.has-appendix-thumb {
.Message & {
.svg-appendix {
--background-color: #ccc;
opacity: 1;
transition: opacity 500ms ease;
}
}
}
&.document {
padding: .5rem !important;
.File {
.theme-dark & {
--color-primary: var(--color-selection-highlight);
}
}
.File + .text-content {
margin-top: .3125rem;
}
}
&.voice,
&.audio {
.message-title,
.Embedded {
margin-top: -.1875rem;
margin-bottom: .1875rem;
}
}
&.voice {
padding: .5rem !important;
.Voice + .text-content {
margin-top: .5rem;
}
}
&.audio {
min-width: 20rem;
padding: .5rem .5rem .8125rem !important;
@media (max-width: 600px) {
min-width: 17rem;
}
.Audio + .text-content {
margin-top: .25rem;
}
&:not(.has-replies) {
.Audio + .text-content {
margin-bottom: -0.4375rem;
}
}
}
&:not(.custom-shape) .emoji {
display: inline-block;
width: 1.25rem;
background-size: 1.25rem;
color: transparent;
margin-inline-end: 1px;
vertical-align: text-bottom;
&::selection {
background-color: var(--color-selection-highlight-emoji);
color: transparent;
}
}
&:not(.custom-shape) .text-content .emoji {
width: calc(1.25 * var(--message-text-size, 1rem));
height: calc(1.25 * var(--message-text-size, 1rem));
background-size: calc(1.25 * var(--message-text-size, 1rem));
}
.no-media-corners {
--border-top-left-radius: 0;
--border-top-right-radius: 0;
}
&.custom-shape.is-via-bot {
font-size: inherit !important;
.content-inner > .message-title {
display: inline-flex;
position: relative;
top: .125rem;
max-width: calc(100% - 3rem);
margin-left: calc(100% - 3rem);
padding: 0 .5rem;
background-color: var(--background-color);
border-radius: var(--border-radius-messages);
.Message.own & {
margin-left: -3rem;
}
}
.media-inner {
margin-top: 0.375rem;
}
}
}
.message-content.media, .WebPage {
.media-inner {
display: flex;
justify-content: center;
align-items: center;
&.interactive {
cursor: pointer;
&.dark video {
background-color: #232323;
}
}
}
&.round.is-reply {
width: auto !important;
}
&.force-sender-name .media-inner,
&.force-sender-name .Album,
&.text .media-inner,
&.is-via-bot .media-inner,
&.is-reply .media-inner,
&.is-reply .Album {
margin-left: -0.5rem;
margin-right: -0.5rem;
body.is-ios .Message.own & {
margin-left: -0.625rem;
}
}
&.text .media-inner {
margin-top: -0.3125rem;
}
&.is-reply .media-inner,
&.force-sender-name .Album,
&.is-reply .Album,
.message-title ~ .media-inner {
margin-top: 0.375rem;
margin-bottom: -0.375rem;
body.is-ios .Message.own & {
margin-bottom: -0.4375rem;
}
}
// Moved below .is-reply to overwrite its styles
&.text .media-inner,
&.text .Album {
margin-bottom: 0.375rem;
body.is-ios .Message.own & {
margin-bottom: 0.375rem;
}
}
.media-loading {
display: flex;
align-items: center;
justify-content: center;
&:not(.open) {
opacity: 0.5;
transform: scale(0);
transition: opacity .3s ease, transform .3s ease;
}
}
.icon-large-play, .icon-download {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
opacity: 0.7;
transition: opacity 150ms;
&:hover {
opacity: 1;
}
&:before {
display: flex;
align-items: center;
justify-content: center;
width: 3.375rem;
height: 3.375rem;
border-radius: 50%;
background: rgba(black, 0.25);
}
&.opacity-transition {
transition: opacity .15s ease;
&:not(.open) {
opacity: 0;
}
}
}
.icon-download {
font-size: 1.5rem;
}
.icon-large-play {
font-size: 2.5rem;
}
.message-media-duration,
.message-transfer-progress {
background: rgba(0, 0, 0, .25);
color: #fff;
font-size: 0.75rem;
position: absolute;
left: .1875rem;
top: .1875rem;
z-index: 1;
padding: 0 .375rem;
border-radius: .75rem;
line-height: 1.125rem;
user-select: none;
}
.message-media-duration .icon-muted {
vertical-align: -.1875rem;
margin-left: .375rem;
font-size: 1.0625rem;
}
}
.message-content.custom-shape {
line-height: 1.2;
font-size: 10rem;
display: flex;
flex-wrap: wrap;
align-items: flex-end;
&.has-comments {
min-height: 5.25rem;
margin-top: 0 !important;
&.has-replies {
min-height: 6.5rem;
}
}
&.is-reply {
max-width: 100%;
}
.reply-message {
display: flex;
align-items: flex-start;
flex-direction: row-reverse;
direction: ltr;
> p {
margin-bottom: 0;
}
.EmbeddedMessage {
margin-left: 0.5rem;
border-radius: var(--border-radius-messages);
@media (max-width: 600px) {
max-width: calc(90vw - 13rem);
}
@media (max-width: 340px) {
margin-left: -1rem;
z-index: 1;
max-width: calc(90vw - 12rem);
}
}
}
.text-content {
margin-bottom: 1rem;
}
.media-inner {
line-height: 1;
font-size: 1rem;
flex-shrink: 0;
.full-media {
top: 0;
left: 0;
bottom: 0;
right: 0;
}
}
.emoji {
display: inline-block;
color: transparent;
&::selection {
background-color: var(--color-selection-highlight-emoji);
color: transparent;
}
}
&.emoji-only {
.text-content {
margin-bottom: 0;
text-shadow: 1px 1px 0 white, -1px -1px 0 white, -1px 1px 0 white, 1px -1px 0 white;
img.emoji {
filter: drop-shadow(1px 1px 0 white) drop-shadow(-1px 1px 0 white) drop-shadow(1px -1px 0 white) drop-shadow(-1px -1px 0 white);
}
.MessageMeta {
text-shadow: none;
}
}
}
&.emoji-only-1 {
min-width: 8rem;
font-size: 4.5rem;
.content-inner {
height: 7rem;
}
.text-content {
line-height: 1.5;
text-align: center;
}
.Message.was-edited & {
min-width: 10rem;
}
.emoji {
width: 5rem;
height: 5rem;
}
}
&.emoji-only-2 {
font-size: 4rem;
margin-top: .5rem;
min-width: 10rem;
&.has-comments {
margin-top: 1.25rem;
}
.Message.was-edited & {
min-width: 12rem;
}
.emoji {
width: 4rem;
height: 4rem;
margin-right: 0.375rem;
}
}
&.emoji-only-3 {
font-size: 3rem;
margin-top: 1.75rem;
min-width: 12rem;
&.has-comments {
margin-top: 2.5rem;
}
.Message.was-edited & {
min-width: 14rem;
}
.emoji {
width: 3rem;
height: 3rem;
margin-right: 0.375rem;
}
}
.Message:not(.own) & {
--hover-color: var(--color-reply-hover);
--active-color: var(--color-reply-active);
}
.Message.own & {
--hover-color: var(--color-reply-own-hover);
--active-color: var(--color-reply-own-active);
.reply-message {
flex-direction: row;
.EmbeddedMessage {
margin-right: 0.5rem;
@media (max-width: 340px) {
margin-left: 0;
z-index: 1;
max-width: calc(90vw - 11.5rem);
}
}
}
}
}
.forwarded-message {
.message-content.contact &,
.message-content.voice &,
.message-content.poll & {
// MessageOutgoingStatus's icon needs more space
margin-bottom: 0.5rem;
}
.message-content:not(.custom-shape) & {
position: relative;
margin-top: 0.25rem;
padding-left: 0.625rem;
&::before {
content: '';
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0.05rem;
width: 2px;
background: var(--accent-color);
border-radius: 2px;
}
&:dir(rtl) {
padding-inline-start: 0.625rem;
&::before {
left: auto;
right: 0.05rem;
}
}
}
--border-top-left-radius: var(--border-radius-messages-small);
--border-top-right-radius: var(--border-radius-messages-small);
--border-bottom-left-radius: var(--border-radius-messages-small);
--border-bottom-right-radius: var(--border-radius-messages-small);
> .media-inner {
margin: 0 !important;
margin-bottom: 0.25rem !important;
}
}
.long-word-break-all {
word-break: break-all;
}
.text-entity-link {
color: var(--color-links) !important;
text-decoration: none !important;
word-break: break-word;
cursor: pointer;
unicode-bidi: initial;
&:hover, &:active, &:visited {
text-decoration: underline !important;
}
}
.text-entity-code, .text-entity-pre {
color: var(--color-code);
background: var(--color-code-bg);
white-space: pre-wrap;
margin: 0;
padding: 1px 2px;
border-radius: 4px;
font-size: calc(var(--message-text-size, 1rem) - 0.0625rem);
}