refactor: paginationの型を明示する (#12809)

* refactor: paginationの型を明示する

* asではなくsatisfiesを使うように
This commit is contained in:
GrapeApple0 2023-12-26 21:40:27 +09:00 committed by Marie
parent 790f509ebe
commit 6415a789ae
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
37 changed files with 93 additions and 93 deletions

View file

@ -38,14 +38,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue'; import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import bytes from '@/filters/bytes.js'; import bytes from '@/filters/bytes.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { dateString } from '@/filters/date.js'; import { dateString } from '@/filters/date.js';
const props = defineProps<{ const props = defineProps<{
pagination: any; pagination: Paging;
viewMode: 'grid' | 'list'; viewMode: 'grid' | 'list';
}>(); }>();
</script> </script>

View file

@ -253,7 +253,7 @@ import { checkAnimationFromMfm } from '@/scripts/check-animated-mfm.js';
import MkRippleEffect from '@/components/MkRippleEffect.vue'; import MkRippleEffect from '@/components/MkRippleEffect.vue';
import { showMovedDialog } from '@/scripts/show-moved-dialog.js'; import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue'; import MkUserCardMini from '@/components/MkUserCardMini.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkReactionIcon from '@/components/MkReactionIcon.vue'; import MkReactionIcon from '@/components/MkReactionIcon.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
@ -361,7 +361,7 @@ const renotesPagination = computed(() => ({
params: { params: {
noteId: appearNote.value.id, noteId: appearNote.value.id,
}, },
})); } satisfies Paging));
const reactionsPagination = computed(() => ({ const reactionsPagination = computed(() => ({
endpoint: 'notes/reactions', endpoint: 'notes/reactions',
@ -370,7 +370,7 @@ const reactionsPagination = computed(() => ({
noteId: appearNote.value.id, noteId: appearNote.value.id,
type: reactionTabType.value, type: reactionTabType.value,
}, },
})); } satisfies Paging));
async function addReplyTo(replyNote: Misskey.entities.Note) { async function addReplyTo(replyNote: Misskey.entities.Note) {
replies.value.unshift(replyNote); replies.value.unshift(replyNote);

View file

@ -37,15 +37,15 @@ SPDX-License-Identifier: AGPL-3.0-only
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkFolder from '@/components/MkFolder.vue'; import MkFolder from '@/components/MkFolder.vue';
import XUser from '@/components/MkUserSetupDialog.User.vue'; import XUser from '@/components/MkUserSetupDialog.User.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
const pinnedUsers = { endpoint: 'pinned-users', noPaging: true }; const pinnedUsers = { endpoint: 'pinned-users', noPaging: true } satisfies Paging;
const popularUsers = { endpoint: 'users', limit: 10, noPaging: true, params: { const popularUsers = { endpoint: 'users', limit: 10, noPaging: true, params: {
state: 'alive', state: 'alive',
origin: 'local', origin: 'local',
sort: '+follower', sort: '+follower',
} }; } } satisfies Paging;
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -82,7 +82,7 @@ const pagination = {
state.value === 'nsfw' ? { nsfw: true } : state.value === 'nsfw' ? { nsfw: true } :
{}), {}),
})), })),
} as Paging; } satisfies Paging;
function getStatus(instance) { function getStatus(instance) {
if (instance.isSuspended) return 'Suspended'; if (instance.isSuspended) return 'Suspended';

View file

@ -212,7 +212,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { iAmAdmin, $i } from '@/account.js'; import { iAmAdmin, $i } from '@/account.js';
import MkRolePreview from '@/components/MkRolePreview.vue'; import MkRolePreview from '@/components/MkRolePreview.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
userId: string; userId: string;
@ -247,7 +247,7 @@ const announcementsPagination = {
params: computed(() => ({ params: computed(() => ({
userId: props.userId, userId: props.userId,
})), })),
}; } satisfies Paging;
const expandedRoles = ref([]); const expandedRoles = ref([]);
function createFetcher() { function createFetcher() {

View file

@ -56,7 +56,7 @@ import { computed, shallowRef, ref } from 'vue';
import XHeader from './_header_.vue'; import XHeader from './_header_.vue';
import MkSelect from '@/components/MkSelect.vue'; import MkSelect from '@/components/MkSelect.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import XAbuseReport from '@/components/MkAbuseReport.vue'; import XAbuseReport from '@/components/MkAbuseReport.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -77,7 +77,7 @@ const pagination = {
reporterOrigin: reporterOrigin.value, reporterOrigin: reporterOrigin.value,
targetUserOrigin: targetUserOrigin.value, targetUserOrigin: targetUserOrigin.value,
})), })),
}; } satisfies Paging;
function resolved(reportId) { function resolved(reportId) {
reports.value.removeItem(reportId); reports.value.removeItem(reportId);

View file

@ -63,7 +63,7 @@ import { computed, ref } from 'vue';
import XHeader from './_header_.vue'; import XHeader from './_header_.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkSelect from '@/components/MkSelect.vue'; import MkSelect from '@/components/MkSelect.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue'; import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
import FormSplit from '@/components/form/split.vue'; import FormSplit from '@/components/form/split.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -90,7 +90,7 @@ const pagination = {
state.value === 'nsfw' ? { nsfw: true } : state.value === 'nsfw' ? { nsfw: true } :
{}), {}),
})), })),
}; } satisfies Paging;
function getStatus(instance) { function getStatus(instance) {
if (instance.isSuspended) return 'Suspended'; if (instance.isSuspended) return 'Suspended';

View file

@ -73,7 +73,7 @@ const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>();
const type = ref('all'); const type = ref('all');
const sort = ref('+createdAt'); const sort = ref('+createdAt');
const pagination: Paging = { const pagination = {
endpoint: 'admin/invite/list' as const, endpoint: 'admin/invite/list' as const,
limit: 10, limit: 10,
params: computed(() => ({ params: computed(() => ({
@ -81,7 +81,7 @@ const pagination: Paging = {
sort: sort.value, sort: sort.value,
})), })),
offsetMode: true, offsetMode: true,
}; } satisfies Paging;
const expiresAt = ref(''); const expiresAt = ref('');
const noExpirationDate = ref(true); const noExpirationDate = ref(true);
@ -97,10 +97,10 @@ async function createWithOptions() {
os.alert({ os.alert({
type: 'success', type: 'success',
title: i18n.ts.inviteCodeCreated, title: i18n.ts.inviteCodeCreated,
text: tickets?.map(x => x.code).join('\n'), text: tickets.map(x => x.code).join('\n'),
}); });
tickets?.forEach(ticket => pagingComponent.value?.prepend(ticket)); tickets.forEach(ticket => pagingComponent.value?.prepend(ticket));
} }
function deleted(id: string) { function deleted(id: string) {

View file

@ -36,7 +36,7 @@ import XHeader from './_header_.vue';
import XModLog from './modlog.ModLog.vue'; import XModLog from './modlog.ModLog.vue';
import MkSelect from '@/components/MkSelect.vue'; import MkSelect from '@/components/MkSelect.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -52,7 +52,7 @@ const pagination = {
type: type.value, type: type.value,
userId: moderatorId.value === '' ? null : moderatorId.value, userId: moderatorId.value === '' ? null : moderatorId.value,
})), })),
}; } satisfies Paging;
console.log(Misskey); console.log(Misskey);

View file

@ -73,7 +73,7 @@ import { useRouter } from '@/router.js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkUserCardMini from '@/components/MkUserCardMini.vue'; import MkUserCardMini from '@/components/MkUserCardMini.vue';
import MkInfo from '@/components/MkInfo.vue'; import MkInfo from '@/components/MkInfo.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { infoImageUrl } from '@/instance.js'; import { infoImageUrl } from '@/instance.js';
const router = useRouter(); const router = useRouter();
@ -88,7 +88,7 @@ const usersPagination = {
params: computed(() => ({ params: computed(() => ({
roleId: props.id, roleId: props.id,
})), })),
}; } satisfies Paging;
const expandedItems = ref([]); const expandedItems = ref([]);

View file

@ -62,7 +62,7 @@ import { computed, shallowRef, ref } from 'vue';
import XHeader from './_header_.vue'; import XHeader from './_header_.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkSelect from '@/components/MkSelect.vue'; import MkSelect from '@/components/MkSelect.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { lookupUser } from '@/scripts/lookup-user.js'; import { lookupUser } from '@/scripts/lookup-user.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -88,7 +88,7 @@ const pagination = {
hostname: searchHost.value, hostname: searchHost.value,
})), })),
offsetMode: true, offsetMode: true,
}; } satisfies Paging;
function searchUser() { function searchUser() {
os.selectUser().then(user => { os.selectUser().then(user => {

View file

@ -41,7 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkInfo from '@/components/MkInfo.vue'; import MkInfo from '@/components/MkInfo.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -55,7 +55,7 @@ const paginationCurrent = {
params: { params: {
isActive: true, isActive: true,
}, },
}; } satisfies Paging;
const paginationPast = { const paginationPast = {
endpoint: 'announcements' as const, endpoint: 'announcements' as const,
@ -63,7 +63,7 @@ const paginationPast = {
params: { params: {
isActive: false, isActive: false,
}, },
}; } satisfies Paging;
const paginationEl = ref<InstanceType<typeof MkPagination>>(); const paginationEl = ref<InstanceType<typeof MkPagination>>();

View file

@ -53,7 +53,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, onMounted, ref } from 'vue'; import { computed, onMounted, ref } from 'vue';
import MkChannelPreview from '@/components/MkChannelPreview.vue'; import MkChannelPreview from '@/components/MkChannelPreview.vue';
import MkChannelList from '@/components/MkChannelList.vue'; import MkChannelList from '@/components/MkChannelList.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkRadios from '@/components/MkRadios.vue'; import MkRadios from '@/components/MkRadios.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
@ -83,20 +83,20 @@ onMounted(() => {
const featuredPagination = { const featuredPagination = {
endpoint: 'channels/featured' as const, endpoint: 'channels/featured' as const,
noPaging: true, noPaging: true,
}; } satisfies Paging;
const favoritesPagination = { const favoritesPagination = {
endpoint: 'channels/my-favorites' as const, endpoint: 'channels/my-favorites' as const,
limit: 100, limit: 100,
noPaging: true, noPaging: true,
}; } satisfies Paging;
const followingPagination = { const followingPagination = {
endpoint: 'channels/followed' as const, endpoint: 'channels/followed' as const,
limit: 10, limit: 10,
}; } satisfies Paging;
const ownedPagination = { const ownedPagination = {
endpoint: 'channels/owned' as const, endpoint: 'channels/owned' as const,
limit: 10, limit: 10,
}; } satisfies Paging;
async function search() { async function search() {
const query = searchQuery.value.toString().trim(); const query = searchQuery.value.toString().trim();

View file

@ -77,7 +77,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, defineAsyncComponent, ref, shallowRef } from 'vue'; import { computed, defineAsyncComponent, ref, shallowRef } from 'vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import FormSplit from '@/components/form/split.vue'; import FormSplit from '@/components/form/split.vue';
import { selectFile } from '@/scripts/select-file.js'; import { selectFile } from '@/scripts/select-file.js';
@ -100,7 +100,7 @@ const pagination = {
params: computed(() => ({ params: computed(() => ({
query: (query.value && query.value !== '') ? query.value : null, query: (query.value && query.value !== '') ? query.value : null,
})), })),
}; } satisfies Paging;
const remotePagination = { const remotePagination = {
endpoint: 'admin/emoji/list-remote' as const, endpoint: 'admin/emoji/list-remote' as const,
@ -109,7 +109,7 @@ const remotePagination = {
query: (queryRemote.value && queryRemote.value !== '') ? queryRemote.value : null, query: (queryRemote.value && queryRemote.value !== '') ? queryRemote.value : null,
host: (host.value && host.value !== '') ? host.value : null, host: (host.value && host.value !== '') ? host.value : null,
})), })),
}; } satisfies Paging;
const selectAll = () => { const selectAll = () => {
if (selectedEmojis.value.length > 0) { if (selectedEmojis.value.length > 0) {

View file

@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkNote from '@/components/MkNote.vue'; import MkNote from '@/components/MkNote.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue'; import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -36,7 +36,7 @@ import { infoImageUrl } from '@/instance.js';
const pagination = { const pagination = {
endpoint: 'i/favorites' as const, endpoint: 'i/favorites' as const,
limit: 10, limit: 10,
}; } satisfies Paging;
definePageMetadata({ definePageMetadata({
title: i18n.ts.favorites, title: i18n.ts.favorites,

View file

@ -40,7 +40,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import MkFlashPreview from '@/components/MkFlashPreview.vue'; import MkFlashPreview from '@/components/MkFlashPreview.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { useRouter } from '@/router.js'; import { useRouter } from '@/router.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -53,15 +53,15 @@ const tab = ref('featured');
const featuredFlashsPagination = { const featuredFlashsPagination = {
endpoint: 'flash/featured' as const, endpoint: 'flash/featured' as const,
noPaging: true, noPaging: true,
}; } satisfies Paging;
const myFlashsPagination = { const myFlashsPagination = {
endpoint: 'flash/my' as const, endpoint: 'flash/my' as const,
limit: 5, limit: 5,
}; } satisfies Paging;
const likedFlashsPagination = { const likedFlashsPagination = {
endpoint: 'flash/my-likes' as const, endpoint: 'flash/my-likes' as const,
limit: 5, limit: 5,
}; } satisfies Paging;
function create() { function create() {
router.push('/play/new'); router.push('/play/new');

View file

@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef, computed } from 'vue'; import { shallowRef, computed } from 'vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { userPage, acct } from '@/filters/user.js'; import { userPage, acct } from '@/filters/user.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -51,7 +51,7 @@ const paginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
const pagination = { const pagination = {
endpoint: 'following/requests/list' as const, endpoint: 'following/requests/list' as const,
limit: 10, limit: 10,
}; } satisfies Paging;
function accept(user) { function accept(user) {
os.api('following/requests/accept', { userId: user.id }).then(() => { os.api('following/requests/accept', { userId: user.id }).then(() => {

View file

@ -49,7 +49,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { watch, ref, computed } from 'vue'; import { watch, ref, computed } from 'vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue'; import MkFoldableSection from '@/components/MkFoldableSection.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue'; import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -68,19 +68,19 @@ const tagsRef = ref();
const recentPostsPagination = { const recentPostsPagination = {
endpoint: 'gallery/posts' as const, endpoint: 'gallery/posts' as const,
limit: 6, limit: 6,
}; } satisfies Paging;
const popularPostsPagination = { const popularPostsPagination = {
endpoint: 'gallery/featured' as const, endpoint: 'gallery/featured' as const,
noPaging: true, noPaging: true,
}; } satisfies Paging;
const myPostsPagination = { const myPostsPagination = {
endpoint: 'i/gallery/posts' as const, endpoint: 'i/gallery/posts' as const,
limit: 5, limit: 5,
}; } satisfies Paging;
const likedPostsPagination = { const likedPostsPagination = {
endpoint: 'i/gallery/likes' as const, endpoint: 'i/gallery/likes' as const,
limit: 5, limit: 5,
}; } satisfies Paging;
const tagUsersPagination = computed(() => ({ const tagUsersPagination = computed(() => ({
endpoint: 'hashtags/users' as const, endpoint: 'hashtags/users' as const,
@ -90,7 +90,7 @@ const tagUsersPagination = computed(() => ({
origin: 'combined', origin: 'combined',
sort: '+follower', sort: '+follower',
}, },
})); } satisfies Paging));
watch(() => props.tag, () => { watch(() => props.tag, () => {
if (tagsRef.value) tagsRef.value.tags.toggleContent(props.tag == null); if (tagsRef.value) tagsRef.value.tags.toggleContent(props.tag == null);

View file

@ -67,7 +67,7 @@ import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import MkContainer from '@/components/MkContainer.vue'; import MkContainer from '@/components/MkContainer.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue'; import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue';
import MkFollowButton from '@/components/MkFollowButton.vue'; import MkFollowButton from '@/components/MkFollowButton.vue';
import { url } from '@/config.js'; import { url } from '@/config.js';
@ -93,7 +93,7 @@ const otherPostsPagination = {
params: computed(() => ({ params: computed(() => ({
userId: post.value.user.id, userId: post.value.user.id,
})), })),
}; } satisfies Paging;
function fetchPost() { function fetchPost() {
post.value = null; post.value = null;

View file

@ -135,7 +135,7 @@ import { iAmModerator, iAmAdmin } from '@/account.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue'; import MkUserCardMini from '@/components/MkUserCardMini.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js'; import { getProxiedImageUrlNullable } from '@/scripts/media-proxy.js';
import { dateString } from '@/filters/date.js'; import { dateString } from '@/filters/date.js';
@ -162,7 +162,7 @@ const usersPagination = {
hostname: props.host, hostname: props.host,
}, },
offsetMode: true, offsetMode: true,
}; } satisfies Paging;
async function fetch(): Promise<void> { async function fetch(): Promise<void> {
if (iAmAdmin) { if (iAmAdmin) {

View file

@ -52,10 +52,10 @@ const currentInviteLimit = ref<null | number>(null);
const inviteLimit = (($i != null && $i.policies.inviteLimit) || (($i == null && instance.policies.inviteLimit))) as number; const inviteLimit = (($i != null && $i.policies.inviteLimit) || (($i == null && instance.policies.inviteLimit))) as number;
const inviteLimitCycle = (($i != null && $i.policies.inviteLimitCycle) || ($i == null && instance.policies.inviteLimitCycle)) as number; const inviteLimitCycle = (($i != null && $i.policies.inviteLimitCycle) || ($i == null && instance.policies.inviteLimitCycle)) as number;
const pagination: Paging = { const pagination = {
endpoint: 'invite/list' as const, endpoint: 'invite/list' as const,
limit: 10, limit: 10,
}; } satisfies Paging;
const resetCycle = computed<null | string>(() => { const resetCycle = computed<null | string>(() => {
if (!inviteLimitCycle) return null; if (!inviteLimitCycle) return null;

View file

@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { watch, ref, shallowRef, computed } from 'vue'; import { watch, ref, shallowRef, computed } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkClipPreview from '@/components/MkClipPreview.vue'; import MkClipPreview from '@/components/MkClipPreview.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -40,7 +40,7 @@ const pagination = {
endpoint: 'clips/list' as const, endpoint: 'clips/list' as const,
noPaging: true, noPaging: true,
limit: 10, limit: 10,
}; } satisfies Paging;
const tab = ref('my'); const tab = ref('my');
const favorites = ref<Misskey.entities.Clip[] | null>(null); const favorites = ref<Misskey.entities.Clip[] | null>(null);

View file

@ -68,7 +68,7 @@ import MkInput from '@/components/MkInput.vue';
import { userListsCache } from '@/cache.js'; import { userListsCache } from '@/cache.js';
import { $i } from '@/account.js'; import { $i } from '@/account.js';
import { defaultStore } from '@/store.js'; import { defaultStore } from '@/store.js';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
const { const {
enableInfiniteScroll, enableInfiniteScroll,
@ -88,7 +88,7 @@ const membershipsPagination = {
params: computed(() => ({ params: computed(() => ({
listId: props.listId, listId: props.listId,
})), })),
}; } satisfies Paging;
function fetchList() { function fetchList() {
os.api('users/lists/show', { os.api('users/lists/show', {

View file

@ -85,7 +85,7 @@ import { url } from '@/config.js';
import MkMediaImage from '@/components/MkMediaImage.vue'; import MkMediaImage from '@/components/MkMediaImage.vue';
import MkFollowButton from '@/components/MkFollowButton.vue'; import MkFollowButton from '@/components/MkFollowButton.vue';
import MkContainer from '@/components/MkContainer.vue'; import MkContainer from '@/components/MkContainer.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkPagePreview from '@/components/MkPagePreview.vue'; import MkPagePreview from '@/components/MkPagePreview.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -108,7 +108,7 @@ const otherPostsPagination = {
params: computed(() => ({ params: computed(() => ({
userId: page.value.user.id, userId: page.value.user.id,
})), })),
}; } satisfies Paging;
const path = computed(() => props.username + '/' + props.pageName); const path = computed(() => props.username + '/' + props.pageName);
function fetchPage() { function fetchPage() {

View file

@ -38,7 +38,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import MkPagePreview from '@/components/MkPagePreview.vue'; import MkPagePreview from '@/components/MkPagePreview.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { useRouter } from '@/router.js'; import { useRouter } from '@/router.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -51,15 +51,15 @@ const tab = ref('featured');
const featuredPagesPagination = { const featuredPagesPagination = {
endpoint: 'pages/featured' as const, endpoint: 'pages/featured' as const,
noPaging: true, noPaging: true,
}; } satisfies Paging;
const myPagesPagination = { const myPagesPagination = {
endpoint: 'i/pages' as const, endpoint: 'i/pages' as const,
limit: 5, limit: 5,
}; } satisfies Paging;
const likedPagesPagination = { const likedPagesPagination = {
endpoint: 'i/page-likes' as const, endpoint: 'i/page-likes' as const,
limit: 5, limit: 5,
}; } satisfies Paging;
function create() { function create() {
router.push('/pages/new'); router.push('/pages/new');

View file

@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import FormPagination from '@/components/MkPagination.vue'; import FormPagination, { Paging } from '@/components/MkPagination.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -63,7 +63,7 @@ const pagination = {
params: { params: {
sort: '+lastUsedAt', sort: '+lastUsedAt',
}, },
}; } satisfies Paging;
function revoke(token) { function revoke(token) {
os.api('i/revoke-token', { tokenId: token.id }).then(() => { os.api('i/revoke-token', { tokenId: token.id }).then(() => {

View file

@ -51,7 +51,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import * as os from '@/os.js'; import * as os from '@/os.js';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue'; import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import bytes from '@/filters/bytes.js'; import bytes from '@/filters/bytes.js';
@ -64,7 +64,7 @@ const pagination = {
endpoint: 'drive/files' as const, endpoint: 'drive/files' as const,
limit: 10, limit: 10,
params: computed(() => ({ sort: sortMode.value })), params: computed(() => ({ sort: sortMode.value })),
}; } satisfies Paging;
const sortOptions = [ const sortOptions = [
{ value: 'sizeDesc', displayName: i18n.ts._drivecleaner.orderBySizeDesc }, { value: 'sizeDesc', displayName: i18n.ts._drivecleaner.orderBySizeDesc },

View file

@ -129,7 +129,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import XInstanceMute from './mute-block.instance-mute.vue'; import XInstanceMute from './mute-block.instance-mute.vue';
import XWordMute from './mute-block.word-mute.vue'; import XWordMute from './mute-block.word-mute.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import { userPage } from '@/filters/user.js'; import { userPage } from '@/filters/user.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -142,17 +142,17 @@ import MkFolder from '@/components/MkFolder.vue';
const renoteMutingPagination = { const renoteMutingPagination = {
endpoint: 'renote-mute/list' as const, endpoint: 'renote-mute/list' as const,
limit: 10, limit: 10,
}; } satisfies Paging;
const mutingPagination = { const mutingPagination = {
endpoint: 'mute/list' as const, endpoint: 'mute/list' as const,
limit: 10, limit: 10,
}; } satisfies Paging;
const blockingPagination = { const blockingPagination = {
endpoint: 'blocking/list' as const, endpoint: 'blocking/list' as const,
limit: 10, limit: 10,
}; } satisfies Paging;
const expandedRenoteMuteItems = ref([]); const expandedRenoteMuteItems = ref([]);
const expandedMuteItems = ref([]); const expandedMuteItems = ref([]);

View file

@ -45,7 +45,7 @@ import X2fa from './2fa.vue';
import FormSection from '@/components/form/section.vue'; import FormSection from '@/components/form/section.vue';
import FormSlot from '@/components/form/slot.vue'; import FormSlot from '@/components/form/slot.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -53,7 +53,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
const pagination = { const pagination = {
endpoint: 'i/signin-history' as const, endpoint: 'i/signin-history' as const,
limit: 5, limit: 5,
}; } satisfies Paging;
async function change() { async function change() {
const { canceled: canceled2, result: newPassword } = await os.inputText({ const { canceled: canceled2, result: newPassword } = await os.inputText({

View file

@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue'; import { computed } from 'vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import FormSection from '@/components/form/section.vue'; import FormSection from '@/components/form/section.vue';
import FormLink from '@/components/form/link.vue'; import FormLink from '@/components/form/link.vue';
import { definePageMetadata } from '@/scripts/page-metadata.js'; import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -44,7 +44,7 @@ const pagination = {
endpoint: 'i/webhooks/list' as const, endpoint: 'i/webhooks/list' as const,
limit: 100, limit: 100,
noPaging: true, noPaging: true,
}; } satisfies Paging;
const headerActions = computed(() => []); const headerActions = computed(() => []);

View file

@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue'; import { computed } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
const props = defineProps<{ const props = defineProps<{
user: Misskey.entities.User; user: Misskey.entities.User;
@ -31,7 +31,7 @@ const pagination = {
params: computed(() => ({ params: computed(() => ({
userId: props.user.id, userId: props.user.id,
})), })),
}; } satisfies Paging;
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed } from 'vue'; import { computed } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkFlashPreview from '@/components/MkFlashPreview.vue'; import MkFlashPreview from '@/components/MkFlashPreview.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
const props = defineProps<{ const props = defineProps<{
user: Misskey.entities.User; user: Misskey.entities.User;
@ -27,5 +27,5 @@ const pagination = {
params: computed(() => ({ params: computed(() => ({
userId: props.user.id, userId: props.user.id,
})), })),
}; } satisfies Paging;
</script> </script>

View file

@ -17,7 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed } from 'vue'; import { computed } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkUserInfo from '@/components/MkUserInfo.vue'; import MkUserInfo from '@/components/MkUserInfo.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
const props = defineProps<{ const props = defineProps<{
user: Misskey.entities.User; user: Misskey.entities.User;
@ -30,7 +30,7 @@ const followingPagination = {
params: computed(() => ({ params: computed(() => ({
userId: props.user.id, userId: props.user.id,
})), })),
}; } satisfies Paging;
const followersPagination = { const followersPagination = {
endpoint: 'users/followers' as const, endpoint: 'users/followers' as const,
@ -38,7 +38,7 @@ const followersPagination = {
params: computed(() => ({ params: computed(() => ({
userId: props.user.id, userId: props.user.id,
})), })),
}; } satisfies Paging;
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -17,7 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed } from 'vue'; import { computed } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue'; import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
user: Misskey.entities.User; user: Misskey.entities.User;
@ -30,7 +30,7 @@ const pagination = {
params: computed(() => ({ params: computed(() => ({
userId: props.user.id, userId: props.user.id,
})), })),
}; } satisfies Paging;
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import {} from 'vue'; import {} from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkStickyContainer from '@/components/global/MkStickyContainer.vue'; import MkStickyContainer from '@/components/global/MkStickyContainer.vue';
import MkSpacer from '@/components/global/MkSpacer.vue'; import MkSpacer from '@/components/global/MkSpacer.vue';
import MkAvatars from '@/components/MkAvatars.vue'; import MkAvatars from '@/components/MkAvatars.vue';
@ -37,7 +37,7 @@ const pagination = {
params: { params: {
userId: props.user.id, userId: props.user.id,
}, },
}; } satisfies Paging;
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
import { computed } from 'vue'; import { computed } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkPagePreview from '@/components/MkPagePreview.vue'; import MkPagePreview from '@/components/MkPagePreview.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
const props = defineProps<{ const props = defineProps<{
user: Misskey.entities.User; user: Misskey.entities.User;
@ -27,5 +27,5 @@ const pagination = {
params: computed(() => ({ params: computed(() => ({
userId: props.user.id, userId: props.user.id,
})), })),
}; } satisfies Paging;
</script> </script>

View file

@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { computed } from 'vue'; import { computed } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination, { Paging } from '@/components/MkPagination.vue';
import MkNote from '@/components/MkNote.vue'; import MkNote from '@/components/MkNote.vue';
import MkReactionIcon from '@/components/MkReactionIcon.vue'; import MkReactionIcon from '@/components/MkReactionIcon.vue';
@ -35,7 +35,7 @@ const pagination = {
params: computed(() => ({ params: computed(() => ({
userId: props.user.id, userId: props.user.id,
})), })),
}; } satisfies Paging;
</script> </script>
<style lang="scss" module> <style lang="scss" module>