Merge branch 'more-fixes' into shigusegubu-themes3

This commit is contained in:
Henry Jameson 2026-07-06 19:47:25 +03:00
commit 58c8bab9e2
10 changed files with 54 additions and 73 deletions

View file

@ -145,8 +145,8 @@ h4 {
} }
code { code {
background: var(--bg); background: var(--background);
border: 1px solid var(--fg); border: 1px solid var(--border);
border-radius: var(--roundness); border-radius: var(--roundness);
padding: 0 0.2em; padding: 0 0.2em;

View file

@ -97,7 +97,7 @@ const conversation = {
}, },
data() { data() {
return { return {
highlight: null, focused: null,
expanded: false, expanded: false,
threadDisplayStatusObject: {}, // id => 'showing' | 'hidden' threadDisplayStatusObject: {}, // id => 'showing' | 'hidden'
inlineDivePosition: null, inlineDivePosition: null,
@ -389,6 +389,9 @@ const conversation = {
canDive() { canDive() {
return this.isTreeView && this.isExpanded return this.isTreeView && this.isExpanded
}, },
maybeFocused() {
return this.isExpanded ? this.focused : null
},
...mapPiniaState(useMergedConfigStore, ['mergedConfig']), ...mapPiniaState(useMergedConfigStore, ['mergedConfig']),
...mapState({ ...mapState({
mastoUserSocketStatus: (state) => state.api.mastoUserSocketStatus, mastoUserSocketStatus: (state) => state.api.mastoUserSocketStatus,
@ -411,7 +414,7 @@ const conversation = {
oldConversationId && oldConversationId &&
newConversationId === oldConversationId newConversationId === oldConversationId
) { ) {
this.setHighlight(this.originalStatusId) this.setFocused(this.originalStatusId)
} else { } else {
this.fetchConversation() this.fetchConversation()
} }
@ -439,7 +442,7 @@ const conversation = {
}).then(({ data: { ancestors, descendants } }) => { }).then(({ data: { ancestors, descendants } }) => {
this.$store.dispatch('addNewStatuses', { statuses: ancestors }) this.$store.dispatch('addNewStatuses', { statuses: ancestors })
this.$store.dispatch('addNewStatuses', { statuses: descendants }) this.$store.dispatch('addNewStatuses', { statuses: descendants })
this.setHighlight(this.originalStatusId) this.setFocused(this.originalStatusId)
}) })
} else { } else {
this.loadStatusError = null this.loadStatusError = null
@ -457,18 +460,12 @@ const conversation = {
}) })
} }
}, },
isFocused(id) {
return this.isExpanded && id === this.highlight
},
getReplies(id) { getReplies(id) {
return this.replies[id] || [] return this.replies[id] || []
}, },
maybeHighlight() { setFocused(id) {
return this.isExpanded ? this.highlight : null
},
setHighlight(id) {
if (!id) return if (!id) return
this.highlight = id this.focused = id
if (!this.streamingEnabled) { if (!this.streamingEnabled) {
this.$store.dispatch('fetchStatus', id) this.$store.dispatch('fetchStatus', id)
@ -533,7 +530,7 @@ const conversation = {
// only used when we are not on a page // only used when we are not on a page
undive() { undive() {
this.inlineDivePosition = null this.inlineDivePosition = null
this.setHighlight(this.statusId) this.setFocused(this.statusId)
}, },
tryScrollTo(id) { tryScrollTo(id) {
if (!id) { if (!id) {
@ -551,7 +548,7 @@ const conversation = {
// contain scrolling calls, as we do not want the page to jump // contain scrolling calls, as we do not want the page to jump
// when we scroll with an expanded conversation. // when we scroll with an expanded conversation.
// //
// Now the method is to rely solely on the `highlight` watcher // Now the method is to rely solely on the `focused` watcher
// in `status` components. // in `status` components.
// In linear views, all statuses are rendered at all times, but // In linear views, all statuses are rendered at all times, but
// in tree views, it is possible that a change in active status // in tree views, it is possible that a change in active status
@ -559,9 +556,9 @@ const conversation = {
// status becomes an ancestor status, and thus they will be // status becomes an ancestor status, and thus they will be
// different). // different).
// Here, let the components be rendered first, in order to trigger // Here, let the components be rendered first, in order to trigger
// the `highlight` watcher. // the `focused` watcher.
this.$nextTick(() => { this.$nextTick(() => {
this.setHighlight(id) this.setFocused(id)
}) })
}, },
goToCurrent() { goToCurrent() {

View file

@ -96,8 +96,7 @@
:replies="getReplies(status.id)" :replies="getReplies(status.id)"
:expandable="!isExpanded" :expandable="!isExpanded"
:focused="isFocused(status.id)" :focused="maybeFocused === status.id"
:highlight="maybeHighlight"
:inline-expanded="collapsable && isExpanded" :inline-expanded="collapsable && isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]" :show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:in-profile="inProfile" :in-profile="inProfile"
@ -107,7 +106,7 @@
:show-other-replies-as-button="showOtherRepliesButtonInsideStatus" :show-other-replies-as-button="showOtherRepliesButtonInsideStatus"
can-dive can-dive
@goto="setHighlight" @goto="setFocused"
@dive="() => diveIntoStatus(status.id)" @dive="() => diveIntoStatus(status.id)"
@suspendable-state-change="onStatusSuspendStateChange" @suspendable-state-change="onStatusSuspendStateChange"
/> />
@ -154,9 +153,8 @@
:pinned-status-ids-object="pinnedStatusIdsObject" :pinned-status-ids-object="pinnedStatusIdsObject"
:profile-user-id="profileUserId" :profile-user-id="profileUserId"
:is-focused-function="isFocused"
:get-replies="getReplies" :get-replies="getReplies"
:highlight="maybeHighlight" :focused="maybeFocused"
:toggle-expanded="toggleExpanded" :toggle-expanded="toggleExpanded"
:simple="treeViewIsSimple" :simple="treeViewIsSimple"
@ -166,7 +164,7 @@
:total-reply-depth="totalReplyDepth" :total-reply-depth="totalReplyDepth"
:can-dive="canDive" :can-dive="canDive"
@goto="setHighlight" @goto="setFocused"
@dive="diveIntoStatus" @dive="diveIntoStatus"
@suspendable-state-change="onStatusSuspendStateChange" @suspendable-state-change="onStatusSuspendStateChange"
/> />
@ -185,15 +183,14 @@
:replies="getReplies(status.id)" :replies="getReplies(status.id)"
:expandable="!isExpanded" :expandable="!isExpanded"
:focused="isFocused(status.id)" :focused="maybeFocused === status.id || maybeFocused === status.retweeted_status?.id"
:highlight="maybeHighlight === status.id"
:inline-expanded="collapsable && isExpanded" :inline-expanded="collapsable && isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]" :show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:in-profile="inProfile" :in-profile="inProfile"
:in-conversation="isExpanded" :in-conversation="isExpanded"
:profile-user-id="profileUserId" :profile-user-id="profileUserId"
@goto="setHighlight" @goto="setFocused"
@toggle-expanded="toggleExpanded" @toggle-expanded="toggleExpanded"
@suspendable-state-change="onStatusSuspendStateChange" @suspendable-state-change="onStatusSuspendStateChange"
/> />

View file

@ -25,7 +25,10 @@
<details open> <details open>
<summary>{{ $t('general.generic_error_details') }}</summary> <summary>{{ $t('general.generic_error_details') }}</summary>
<code class="stack pre" v-text="error.stack" /> <code
class="stack pre"
v-text="error.stack"
/>
</details> </details>
</slot> </slot>
</div> </div>

View file

@ -13,7 +13,10 @@
<details v-if="details"> <details v-if="details">
<summary>{{ $t('general.generic_error_details') }}</summary> <summary>{{ $t('general.generic_error_details') }}</summary>
<code class="stack pre" v-text="details" /> <code
class="stack pre"
v-text="details"
/>
</details> </details>
</template> </template>
</ErrorModal> </ErrorModal>

View file

@ -4,9 +4,11 @@
:class="{ '-compact': compact, '-apply': apply, '-mobile': mobile }" :class="{ '-compact': compact, '-apply': apply, '-mobile': mobile }"
> >
<div class="palette"> <div class="palette">
<div v-for="key in paletteKeys"> <div
<ColorInput v-for="key in paletteKeys"
:key="key" :key="key"
>
<ColorInput
:name="key" :name="key"
:model-value="props.modelValue[key]" :model-value="props.modelValue[key]"
:fallback="fallback(key)" :fallback="fallback(key)"
@ -14,10 +16,11 @@
@update:model-value="value => updatePalette(key, value)" @update:model-value="value => updatePalette(key, value)"
/> />
<ContrastRatio <ContrastRatio
v-if="contrast[key]" v-if="contrast?.[key]"
:show-ratio="true" :show-ratio="true"
:contrast="contrast[key]" :contrast="contrast[key]"
/> />
<div v-else>{{ '&nbsp;' }}</div>
</div> </div>
</div> </div>
<div class="buttons"> <div class="buttons">
@ -134,11 +137,15 @@ const mobile = computed(() => {
}) })
const contrast = computed(() => { const contrast = computed(() => {
if (props.modelValue == null) return null
const bg = hex2rgb(props.modelValue.bg) const bg = hex2rgb(props.modelValue.bg)
const text = hex2rgb(props.modelValue.text)
const link = hex2rgb(props.modelValue.link)
if (text == null || link == null) return null
return { return {
text: hints(getContrastRatio(bg, hex2rgb(props.modelValue.text))), text: hints(getContrastRatio(bg, text)),
link: hints(getContrastRatio(bg, hex2rgb(props.modelValue.link))), link: hints(getContrastRatio(bg, link)),
} }
}) })
@ -232,15 +239,6 @@ const updatePalette = (paletteKey, value) => {
grid-column: 1 / span 2; grid-column: 1 / span 2;
} }
} }
.color-input {
display: grid;
gap: 0.5em;
label {
flex: 1;
}
}
} }
} }
</style> </style>

View file

@ -97,7 +97,6 @@ const Status = {
expandable: Boolean, expandable: Boolean,
focused: Boolean, focused: Boolean,
highlight: Boolean,
compact: Boolean, compact: Boolean,
isPreview: Boolean, isPreview: Boolean,
noHeading: Boolean, noHeading: Boolean,
@ -320,7 +319,7 @@ const Status = {
}, },
shouldNotMute() { shouldNotMute() {
if (this.ignoreMute) return true if (this.ignoreMute) return true
if (this.isFocused) return true if (this.focused) return true
const { status } = this const { status } = this
const { reblog } = status const { reblog } = status
return ( return (
@ -357,16 +356,6 @@ const Status = {
this.muteFilterHits.some((x) => x.hide)) this.muteFilterHits.some((x) => x.hide))
) )
}, },
isFocused() {
// retweet or root of an expanded conversation
if (this.focused) {
return true
} else if (!this.inConversation) {
return false
}
// use conversation highlight only when in conversation
return this.status.id === this.highlight
},
isReply() { isReply() {
return !!( return !!(
this.status.in_reply_to_status_id && this.status.in_reply_to_user_id this.status.in_reply_to_status_id && this.status.in_reply_to_user_id
@ -415,7 +404,7 @@ const Status = {
shouldDisplayFavsAndRepeats() { shouldDisplayFavsAndRepeats() {
return ( return (
!this.hidePostStats && !this.hidePostStats &&
this.isFocused && this.focused &&
(this.combinedFavsAndRepeatsUsers.length > 0 || (this.combinedFavsAndRepeatsUsers.length > 0 ||
this.statusFromGlobalRepository.quotes_count) this.statusFromGlobalRepository.quotes_count)
) )
@ -558,9 +547,9 @@ const Status = {
toggleThreadDisplay() { toggleThreadDisplay() {
this.controlledToggleThreadDisplay() this.controlledToggleThreadDisplay()
}, },
scrollIfHighlighted(highlightId) { scrollIfFocused(focusedId) {
if (this.$el.getBoundingClientRect == null) return if (this.$el.getBoundingClientRect == null) return
const id = highlightId const id = focusedId
if (this.status.id === id) { if (this.status.id === id) {
const rect = this.$el.getBoundingClientRect() const rect = this.$el.getBoundingClientRect()
if (rect.top < 100) { if (rect.top < 100) {
@ -577,13 +566,13 @@ const Status = {
}, },
}, },
watch: { watch: {
highlight: function (id) { focused: function (id) {
this.scrollIfHighlighted(id) this.scrollIfFocused(id)
}, },
'status.repeat_num': function (num) { 'status.repeat_num': function (num) {
// refetch repeats when repeat_num is changed in any way // refetch repeats when repeat_num is changed in any way
if ( if (
this.isFocused && this.focused &&
this.statusFromGlobalRepository.rebloggedBy && this.statusFromGlobalRepository.rebloggedBy &&
this.statusFromGlobalRepository.rebloggedBy.length !== num this.statusFromGlobalRepository.rebloggedBy.length !== num
) { ) {
@ -593,7 +582,7 @@ const Status = {
'status.fave_num': function (num) { 'status.fave_num': function (num) {
// refetch favs when fave_num is changed in any way // refetch favs when fave_num is changed in any way
if ( if (
this.isFocused && this.focused &&
this.statusFromGlobalRepository.favoritedBy && this.statusFromGlobalRepository.favoritedBy &&
this.statusFromGlobalRepository.favoritedBy.length !== num this.statusFromGlobalRepository.favoritedBy.length !== num
) { ) {

View file

@ -3,7 +3,7 @@
v-if="!hideStatus" v-if="!hideStatus"
ref="root" ref="root"
class="Status" class="Status"
:class="[{ '-focused': isFocused }, { '-conversation': inlineExpanded }]" :class="[{ '-focused': focused }, { '-conversation': inlineExpanded }]"
> >
<div <div
v-if="error" v-if="error"
@ -409,8 +409,7 @@
<StatusContent <StatusContent
ref="content" ref="content"
:status="status" :status="status"
:highlight="highlight" :focused="focused"
:focused="isFocused"
:in-conversation="inConversation" :in-conversation="inConversation"
@mediaplay="addMediaPlaying($event)" @mediaplay="addMediaPlaying($event)"
@mediapause="removeMediaPlaying($event)" @mediapause="removeMediaPlaying($event)"
@ -507,7 +506,7 @@
</transition> </transition>
<EmojiReactions <EmojiReactions
v-if="(mergedConfig.emojiReactionsOnTimeline || isFocused) && (!noHeading && !isPreview)" v-if="(mergedConfig.emojiReactionsOnTimeline || focused) && (!noHeading && !isPreview)"
:status="status" :status="status"
/> />

View file

@ -19,10 +19,8 @@ const ThreadTree = {
pinnedStatusIdsObject: Object, pinnedStatusIdsObject: Object,
profileUserId: String, profileUserId: String,
isFocusedFunction: Function, focused: String,
highlight: String,
getReplies: Function, getReplies: Function,
setHighlight: Function,
toggleExpanded: Function, toggleExpanded: Function,
simple: Boolean, simple: Boolean,

View file

@ -8,9 +8,8 @@
:inline-expanded="collapsable && isExpanded" :inline-expanded="collapsable && isExpanded"
:expandable="!isExpanded" :expandable="!isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]" :show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:focused="isFocusedFunction(status.id)"
:in-conversation="isExpanded" :in-conversation="isExpanded"
:highlight="highlight === status.id" :focused="focused === status.id || focused === status.retweeted_status?.id"
:in-profile="inProfile" :in-profile="inProfile"
:profile-user-id="profileUserId" :profile-user-id="profileUserId"
class="conversation-status conversation-status-treeview status-fadein panel-body" class="conversation-status conversation-status-treeview status-fadein panel-body"
@ -42,10 +41,8 @@
:pinned-status-ids-object="pinnedStatusIdsObject" :pinned-status-ids-object="pinnedStatusIdsObject"
:profile-user-id="profileUserId" :profile-user-id="profileUserId"
:is-focused-function="isFocusedFunction"
:get-replies="getReplies" :get-replies="getReplies"
:highlight="highlight" :focused="focused"
:set-highlight="setHighlight"
:toggle-expanded="toggleExpanded" :toggle-expanded="toggleExpanded"
:simple="simple" :simple="simple"