Compare commits

..

No commits in common. "6c45aeec325a2f3d9a58cb4a338f0e56919885bc" and "7e06a6a2b799f4192a0786cb8141168c2af2f6f2" have entirely different histories.

11 changed files with 24 additions and 142 deletions

View File

@ -9,7 +9,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<slot name="label"></slot>
</div>
<div v-adaptive-border class="body">
<slot name="prefix"></slot>
<div ref="containerEl" class="container">
<div class="track">
<div class="highlight" :style="{ width: (steppedRawValue * 100) + '%' }"></div>
@ -26,7 +25,6 @@ SPDX-License-Identifier: AGPL-3.0-only
@touchstart="onMousedown"
></div>
</div>
<slot name="suffix"></slot>
</div>
<div class="caption">
<slot name="caption"></slot>
@ -226,17 +224,12 @@ function onMousedown(ev: MouseEvent | TouchEvent) {
$thumbWidth: 20px;
> .body {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 7px 12px;
background: var(--MI_THEME-panel);
border: solid 1px var(--MI_THEME-panel);
border-radius: 6px;
> .container {
flex: 1;
position: relative;
height: $thumbHeight;

View File

@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</component>
<button v-show="paginator.canFetchMore.value" key="_more_" v-appear="prefer.s.enableInfiniteScroll ? paginator.fetchOlder : null" :disabled="paginator.moreFetching.value" class="_button" :class="$style.more" @click="paginator.fetchOlder">
<div v-if="!paginator.moreFetching.value">{{ i18n.ts.loadMore }}</div>
<MkLoading v-else :inline="true"/>
<MkLoading v-else/>
</button>
</div>
</MkPullToRefresh>
@ -56,7 +56,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, watch, onUnmounted, provide, useTemplateRef, TransitionGroup, onMounted, shallowRef, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { useInterval } from '@@/js/use-interval.js';
import { getScrollContainer, scrollToTop } from '@@/js/scroll.js';
import { isHeadVisible, scrollToTop } from '@@/js/scroll.js';
import type { BasicTimelineType } from '@/timelines.js';
import type { PagingCtx } from '@/use/use-pagination.js';
import { usePagination } from '@/use/use-pagination.js';
@ -91,39 +91,14 @@ const props = withDefaults(defineProps<{
onlyFiles: false,
});
const emit = defineEmits<{
}>();
provide('inTimeline', true);
provide('tl_withSensitive', computed(() => props.withSensitive));
provide('inChannel', computed(() => props.src === 'channel'));
function isTop() {
if (scrollContainer == null) return false;
if (rootEl.value == null) return false;
const scrollTop = scrollContainer.scrollTop;
const tlTop = rootEl.value.offsetTop - scrollContainer.offsetTop;
return scrollTop <= tlTop;
}
let scrollContainer: HTMLElement | null = null;
function onScrollContainerScroll() {
if (isTop()) {
paginator.releaseQueue();
}
}
const rootEl = useTemplateRef('rootEl');
watch(rootEl, (el) => {
if (el && scrollContainer == null) {
scrollContainer = getScrollContainer(el)!;
scrollContainer.addEventListener('scroll', onScrollContainerScroll, { passive: true }); // scrollendios
}
}, { immediate: true });
onUnmounted(() => {
if (scrollContainer) {
scrollContainer.removeEventListener('scroll', onScrollContainerScroll);
}
});
type TimelineQueryType = {
antennaId?: string,
@ -146,10 +121,10 @@ const POLLING_INTERVAL =
MIN_POLLING_INTERVAL;
if (!store.s.realtimeMode) {
// TODO: 1TL
useInterval(async () => {
const isTop = rootEl.value == null ? false : isHeadVisible(rootEl.value, 16);
paginator.fetchNewer({
toQueue: !isTop(),
toQueue: !isTop,
});
}, POLLING_INTERVAL, {
immediate: false,
@ -158,8 +133,9 @@ if (!store.s.realtimeMode) {
}
globalEvents.on('notePosted', (note: Misskey.entities.Note) => {
const isTop = rootEl.value == null ? false : isHeadVisible(rootEl.value, 16);
paginator.fetchNewer({
toQueue: !isTop(),
toQueue: !isTop,
});
});
@ -175,7 +151,8 @@ function prepend(note: Misskey.entities.Note) {
note._shouldInsertAd_ = true;
}
if (isTop()) {
const isTop = isHeadVisible(rootEl.value, 16);
if (isTop) {
paginator.prepend(note);
} else {
paginator.enqueue(note);
@ -479,7 +456,7 @@ defineExpose({
margin: auto;
background: var(--MI_THEME-accent);
color: var(--MI_THEME-fgOnAccent);
font-size: 90%;
font-size: 85%;
&:hover {
background: hsl(from var(--MI_THEME-accent) h s calc(l + 5));

View File

@ -43,7 +43,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<SearchMarker :keywords="['realtimemode']">
<MkSwitch v-model="realtimeMode">
<template #label><i class="ti ti-bolt"></i> <SearchLabel>{{ i18n.ts.realtimeMode }}</SearchLabel></template>
<template #label><SearchLabel>{{ i18n.ts.realtimeMode }}</SearchLabel></template>
<template #caption><SearchKeyword>{{ i18n.ts._settings.realtimeMode_description }}</SearchKeyword></template>
</MkSwitch>
</SearchMarker>
@ -51,11 +51,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkDisableSection :disabled="realtimeMode">
<SearchMarker :keywords="['polling', 'interval']">
<MkPreferenceContainer k="pollingInterval">
<MkRange v-model="pollingInterval" :min="1" :max="3" :step="1" easing :showTicks="true" :textConverter="(v) => v === 1 ? i18n.ts.low : v === 2 ? i18n.ts.middle : v === 3 ? i18n.ts.high : ''">
<MkRange v-model="pollingInterval" :min="1" :max="3" :step="1" easing :textConverter="(v) => v === 1 ? i18n.ts.low : v === 2 ? i18n.ts.middle : v === 3 ? i18n.ts.high : ''">
<template #label><SearchLabel>{{ i18n.ts._settings.contentsUpdateFrequency }}</SearchLabel></template>
<template #caption><SearchKeyword>{{ i18n.ts._settings.contentsUpdateFrequency_description }}</SearchKeyword><br><SearchKeyword>{{ i18n.ts._settings.contentsUpdateFrequency_description2 }}</SearchKeyword></template>
<template #prefix><i class="ti ti-player-play"></i></template>
<template #suffix><i class="ti ti-player-track-next"></i></template>
</MkRange>
</MkPreferenceContainer>
</SearchMarker>

View File

@ -9,7 +9,6 @@ import type { RouteDef } from '@/lib/nirax.js';
import { $i, iAmModerator } from '@/i.js';
import MkLoading from '@/pages/_loading_.vue';
import MkError from '@/pages/_error_.vue';
import PageTimeline from '@/pages/timeline.vue';
export const page = (loader: AsyncComponentLoader) => defineAsyncComponent({
loader: loader,
@ -22,13 +21,6 @@ function chatPage(...args: Parameters<typeof page>) {
}
export const ROUTE_DEF = [{
name: 'index',
path: '/',
component: $i ? PageTimeline : page(() => import('@/pages/welcome.vue')),
}, {
path: '/timeline',
component: PageTimeline,
}, {
path: '/@:username/pages/:pageName(*)',
component: page(() => import('@/pages/page.vue')),
}, {
@ -587,6 +579,13 @@ export const ROUTE_DEF = [{
path: '/reversi/g/:gameId',
component: page(() => import('@/pages/reversi/game.vue')),
loginRequired: false,
}, {
path: '/timeline',
component: page(() => import('@/pages/timeline.vue')),
}, {
name: 'index',
path: '/',
component: $i ? page(() => import('@/pages/timeline.vue')) : page(() => import('@/pages/welcome.vue')),
}, {
// テスト用リダイレクト設定。ログイン中ユーザのプロフィールにリダイレクトする
path: '/redirect-test',

View File

@ -309,6 +309,7 @@ rt {
max-width: 100%;
&:disabled {
opacity: 0.5;
cursor: default;
}
}

View File

@ -54,7 +54,7 @@ export function usePagination<T extends MisskeyEntity>(props: {
// パラメータに何らかの変更があった際、再読込したいチャンネル等のIDが変わったなど
watch(() => [props.ctx.endpoint, props.ctx.params], init, { deep: true });
function getNewestId(): string | null | undefined {
function getNewestId() {
// 様々な要因により並び順は保証されないのでソートが必要
if (aheadQueue.length > 0) {
return aheadQueue.map(x => x.id).sort().at(-1);
@ -62,7 +62,7 @@ export function usePagination<T extends MisskeyEntity>(props: {
return items.value.map(x => x.id).sort().at(-1);
}
function getOldestId(): string | null | undefined {
function getOldestId() {
// 様々な要因により並び順は保証されないのでソートが必要
return items.value.map(x => x.id).sort().at(0);
}

View File

@ -1956,8 +1956,6 @@ declare namespace entities {
NotesSearchByTagResponse,
NotesShowRequest,
NotesShowResponse,
NotesShowPartialBulkRequest,
NotesShowPartialBulkResponse,
NotesStateRequest,
NotesStateResponse,
NotesThreadMutingCreateRequest,
@ -3052,12 +3050,6 @@ type NotesSearchRequest = operations['notes___search']['requestBody']['content']
// @public (undocumented)
type NotesSearchResponse = operations['notes___search']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesShowPartialBulkRequest = operations['notes___show-partial-bulk']['requestBody']['content']['application/json'];
// @public (undocumented)
type NotesShowPartialBulkResponse = operations['notes___show-partial-bulk']['responses']['200']['content']['application/json'];
// @public (undocumented)
type NotesShowRequest = operations['notes___show']['requestBody']['content']['application/json'];

View File

@ -3758,17 +3758,6 @@ declare module '../api.js' {
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*
* **Credential required**: *No*
*/
request<E extends 'notes/show-partial-bulk', P extends Endpoints[E]['req']>(
endpoint: E,
params: P,
credential?: string | null,
): Promise<SwitchCaseResponseType<E, P>>;
/**
* No description provided.
*

View File

@ -512,8 +512,6 @@ import type {
NotesSearchByTagResponse,
NotesShowRequest,
NotesShowResponse,
NotesShowPartialBulkRequest,
NotesShowPartialBulkResponse,
NotesStateRequest,
NotesStateResponse,
NotesThreadMutingCreateRequest,
@ -973,7 +971,6 @@ export type Endpoints = {
'notes/search': { req: NotesSearchRequest; res: NotesSearchResponse };
'notes/search-by-tag': { req: NotesSearchByTagRequest; res: NotesSearchByTagResponse };
'notes/show': { req: NotesShowRequest; res: NotesShowResponse };
'notes/show-partial-bulk': { req: NotesShowPartialBulkRequest; res: NotesShowPartialBulkResponse };
'notes/state': { req: NotesStateRequest; res: NotesStateResponse };
'notes/thread-muting/create': { req: NotesThreadMutingCreateRequest; res: EmptyResponse };
'notes/thread-muting/delete': { req: NotesThreadMutingDeleteRequest; res: EmptyResponse };

View File

@ -515,8 +515,6 @@ export type NotesSearchByTagRequest = operations['notes___search-by-tag']['reque
export type NotesSearchByTagResponse = operations['notes___search-by-tag']['responses']['200']['content']['application/json'];
export type NotesShowRequest = operations['notes___show']['requestBody']['content']['application/json'];
export type NotesShowResponse = operations['notes___show']['responses']['200']['content']['application/json'];
export type NotesShowPartialBulkRequest = operations['notes___show-partial-bulk']['requestBody']['content']['application/json'];
export type NotesShowPartialBulkResponse = operations['notes___show-partial-bulk']['responses']['200']['content']['application/json'];
export type NotesStateRequest = operations['notes___state']['requestBody']['content']['application/json'];
export type NotesStateResponse = operations['notes___state']['responses']['200']['content']['application/json'];
export type NotesThreadMutingCreateRequest = operations['notes___thread-muting___create']['requestBody']['content']['application/json'];

View File

@ -3247,15 +3247,6 @@ export type paths = {
*/
post: operations['notes___show'];
};
'/notes/show-partial-bulk': {
/**
* notes/show-partial-bulk
* @description No description provided.
*
* **Credential required**: *No*
*/
post: operations['notes___show-partial-bulk'];
};
'/notes/state': {
/**
* notes/state
@ -25745,59 +25736,6 @@ export type operations = {
};
};
};
/**
* notes/show-partial-bulk
* @description No description provided.
*
* **Credential required**: *No*
*/
'notes___show-partial-bulk': {
requestBody: {
content: {
'application/json': {
noteIds: string[];
};
};
};
responses: {
/** @description OK (with results) */
200: {
content: {
'application/json': Record<string, never>[];
};
};
/** @description Client error */
400: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Authentication error */
401: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Forbidden error */
403: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description I'm Ai */
418: {
content: {
'application/json': components['schemas']['Error'];
};
};
/** @description Internal server error */
500: {
content: {
'application/json': components['schemas']['Error'];
};
};
};
};
/**
* notes/state
* @description No description provided.