Merge branch 'fix-chrome69' into 'develop'

Fix chrome 69 + some theme data related to chats

Closes #890

See merge request pleroma/pleroma-fe!1183
This commit is contained in:
Shpuld Shpludson 2020-07-14 13:13:23 +00:00
commit 297a0c1f7f
2 changed files with 23 additions and 16 deletions

View file

@ -675,23 +675,22 @@ export const SLOT_INHERITANCE = {
depends: ['bg'] depends: ['bg']
}, },
chatMessage: {
depends: ['chatBg']
},
chatMessageIncomingBg: { chatMessageIncomingBg: {
depends: ['chatMessage'], depends: ['chatBg']
layer: 'chatMessage'
}, },
chatMessageIncomingText: { chatMessageIncomingText: {
depends: ['text'], depends: ['text'],
layer: 'text' layer: 'chatMessage',
variant: 'chatMessageIncomingBg',
textColor: true
}, },
chatMessageIncomingLink: { chatMessageIncomingLink: {
depends: ['link'], depends: ['link'],
layer: 'link' layer: 'chatMessage',
variant: 'chatMessageIncomingBg',
textColor: 'preserve'
}, },
chatMessageIncomingBorder: { chatMessageIncomingBorder: {
@ -701,22 +700,27 @@ export const SLOT_INHERITANCE = {
}, },
chatMessageOutgoingBg: { chatMessageOutgoingBg: {
depends: ['chatMessage'], depends: ['chatMessageIncomingBg'],
color: (mod, chatMessage) => brightness(5 * mod, chatMessage).rgb color: (mod, chatMessage) => brightness(5 * mod, chatMessage).rgb
}, },
chatMessageOutgoingText: { chatMessageOutgoingText: {
depends: ['text'], depends: ['text'],
layer: 'text' layer: 'chatMessage',
variant: 'chatMessageOutgoingBg',
textColor: true
}, },
chatMessageOutgoingLink: { chatMessageOutgoingLink: {
depends: ['link'], depends: ['link'],
layer: 'link' layer: 'chatMessage',
variant: 'chatMessageOutgoingBg',
textColor: 'preserve'
}, },
chatMessageOutgoingBorder: { chatMessageOutgoingBorder: {
depends: ['chatMessage'], depends: ['chatMessageOutgoingBg'],
opacity: 'chatMessage' opacity: 'border',
color: (mod, border) => brightness(2 * mod, border).rgb
} }
} }

View file

@ -128,14 +128,17 @@ export const topoSort = (
while (unprocessed.length > 0) { while (unprocessed.length > 0) {
step(unprocessed.pop()) step(unprocessed.pop())
} }
return output.sort((a, b) => {
// The index thing is to make sorting stable on browsers
// where Array.sort() isn't stable
return output.map((data, index) => ({ data, index })).sort(({ data: a, index: ai }, { data: b, index: bi }) => {
const depsA = getDeps(a, inheritance).length const depsA = getDeps(a, inheritance).length
const depsB = getDeps(b, inheritance).length const depsB = getDeps(b, inheritance).length
if (depsA === depsB || (depsB !== 0 && depsA !== 0)) return 0 if (depsA === depsB || (depsB !== 0 && depsA !== 0)) return ai - bi
if (depsA === 0 && depsB !== 0) return -1 if (depsA === 0 && depsB !== 0) return -1
if (depsB === 0 && depsA !== 0) return 1 if (depsB === 0 && depsA !== 0) return 1
}) }).map(({ data }) => data)
} }
const expandSlotValue = (value) => { const expandSlotValue = (value) => {