refactor(frontend): Reactivityで型を明示するように (#12791)

* refactor(frontend): Reactivityで型を明示するように

* fix: プロパティの参照が誤っているのを修正

* fix: 初期化の値を空配列に書き換えていた部分をnullに置き換え
This commit is contained in:
zyoshoka 2023-12-26 14:19:35 +09:00 committed by Marie
parent f9c7b44ef8
commit 8daff4a998
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
109 changed files with 363 additions and 342 deletions

View file

@ -400,6 +400,10 @@ export const meta = {
type: 'string',
optional: false, nullable: true,
},
shortName: {
type: 'string',
optional: false, nullable: true,
},
objectStorageS3ForcePathStyle: {
type: 'boolean',
optional: false, nullable: false,

View file

@ -29,37 +29,10 @@ export const meta = {
optional: false,
nullable: false,
items: {
properties: {
id: { type: 'string' },
firstRetrievedAt: { type: 'string' },
host: { type: 'string' },
usersCount: { type: 'number' },
notesCount: { type: 'number' },
followingCount: { type: 'number' },
followersCount: { type: 'number' },
isNotResponding: { type: 'boolean' },
isSuspended: { type: 'boolean' },
isBlocked: { type: 'boolean' },
softwareName: { type: 'string' },
softwareVersion: { type: 'string' },
openRegistrations: { type: 'boolean' },
name: { type: 'string' },
description: { type: 'string' },
maintainerName: { type: 'string' },
maintainerEmail: { type: 'string' },
isSilenced: { type: 'boolean' },
iconUrl: { type: 'string' },
faviconUrl: { type: 'string' },
themeColor: { type: 'string' },
infoUpdatedAt: {
type: 'string',
nullable: true,
},
latestRequestReceivedAt: {
type: 'string',
nullable: true,
},
}
type: 'object',
optional: false,
nullable: false,
ref: 'FederationInstance',
},
},
otherFollowersCount: { type: 'number' },
@ -68,42 +41,15 @@ export const meta = {
optional: false,
nullable: false,
items: {
properties: {
id: { type: 'string' },
firstRetrievedAt: { type: 'string' },
host: { type: 'string' },
usersCount: { type: 'number' },
notesCount: { type: 'number' },
followingCount: { type: 'number' },
followersCount: { type: 'number' },
isNotResponding: { type: 'boolean' },
isSuspended: { type: 'boolean' },
isBlocked: { type: 'boolean' },
softwareName: { type: 'string' },
softwareVersion: { type: 'string' },
openRegistrations: { type: 'boolean' },
name: { type: 'string' },
description: { type: 'string' },
maintainerName: { type: 'string' },
maintainerEmail: { type: 'string' },
isSilenced: { type: 'boolean' },
iconUrl: { type: 'string' },
faviconUrl: { type: 'string' },
themeColor: { type: 'string' },
infoUpdatedAt: {
type: 'string',
nullable: true,
},
latestRequestReceivedAt: {
type: 'string',
nullable: true,
},
}
type: 'object',
optional: false,
nullable: false,
ref: 'FederationInstance',
},
},
otherFollowingCount: { type: 'number' },
},
}
},
} as const;
export const paramDef = {

View file

@ -172,20 +172,34 @@ export const meta = {
type: 'object',
optional: false, nullable: false,
properties: {
place: {
id: {
type: 'string',
optional: false, nullable: false,
format: 'id',
example: 'xxxxxxxxxx',
},
url: {
type: 'string',
optional: false, nullable: false,
format: 'url',
},
place: {
type: 'string',
optional: false, nullable: false,
},
ratio: {
type: 'number',
optional: false, nullable: false,
},
imageUrl: {
type: 'string',
optional: false, nullable: false,
format: 'url',
},
dayOfWeek: {
type: 'integer',
optional: false, nullable: false,
},
},
},
},

View file

@ -21,6 +21,10 @@ export const meta = {
res: {
type: 'object',
optional: false, nullable: false,
properties: {
sourceLang: { type: 'string' },
text: { type: 'string' },
},
},
errors: {

View file

@ -67,7 +67,7 @@ const props = withDefaults(defineProps<{
withDescription: true,
});
const achievements = ref();
const achievements = ref<Misskey.entities.UsersAchievementsResponse | null>(null);
const lockedAchievements = computed(() => ACHIEVEMENT_TYPES.filter(x => !(achievements.value ?? []).some(a => a.name === x)));
function fetch() {

View file

@ -26,7 +26,7 @@ export type Captcha = {
getResponse(id: string): string;
};
type CaptchaProvider = 'hcaptcha' | 'recaptcha' | 'turnstile';
export type CaptchaProvider = 'hcaptcha' | 'recaptcha' | 'turnstile';
type CaptchaContainer = {
readonly [_ in CaptchaProvider]?: Captcha;

View file

@ -29,7 +29,7 @@ const self = props.url.startsWith(local);
const attr = self ? 'to' : 'href';
const target = self ? null : '_blank';
const el = ref();
const el = ref<HTMLElement>();
useTooltip(el, (showing) => {
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {

View file

@ -27,7 +27,7 @@ export default {
},
},
setup(props) {
const contentEl = ref();
const contentEl = ref<HTMLElement>();
function calc() {
const eachLength = contentEl.value.offsetWidth / props.repeat;

View file

@ -289,7 +289,7 @@ const isDeleted = ref(false);
const renoted = ref(false);
const muted = ref(checkMute(appearNote.value, $i?.mutedWords));
const hardMuted = ref(props.withHardMute && checkMute(appearNote.value, $i?.hardMutedWords));
const translation = ref<any>(null);
const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
const translating = ref(false);
const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.value.user.instance);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.value.visibility) || (appearNote.value.visibility === 'followers' && appearNote.value.userId === $i.id));

View file

@ -309,7 +309,7 @@ const showContent = ref(defaultStore.state.uncollapseCW);
const isDeleted = ref(false);
const renoted = ref(false);
const muted = ref($i ? checkWordMute(appearNote.value, $i, $i.mutedWords) : false);
const translation = ref(null);
const translation = ref<Misskey.entities.NotesTranslateResponse | null>(null);
const translating = ref(false);
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
const urls = parsed ? extractUrlFromMfm(parsed).filter(u => u !== renoteUrl && u !== renoteUri) : null;
@ -353,7 +353,7 @@ provide('react', (reaction: string) => {
});
const tab = ref('replies');
const reactionTabType = ref(null);
const reactionTabType = ref<string | null>(null);
const renotesPagination = computed(() => ({
endpoint: 'notes/renotes',

View file

@ -52,7 +52,7 @@ const emit = defineEmits<{
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
const passwordInput = shallowRef<InstanceType<typeof MkInput>>();
const password = ref('');
const token = ref(null);
const token = ref<string | null>(null);
function onClose() {
emit('cancelled');

View file

@ -187,14 +187,14 @@ watch(showPreview, () => defaultStore.set('showPreview', showPreview.value));
const cw = ref<string | null>(props.initialCw ?? null);
const localOnly = ref<boolean>(props.initialLocalOnly ?? defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly);
const visibility = ref(props.initialVisibility ?? (defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility) as typeof Misskey.noteVisibilities[number]);
const visibleUsers = ref([]);
const visibleUsers = ref<Misskey.entities.UserDetailed[]>([]);
if (props.initialVisibleUsers) {
props.initialVisibleUsers.forEach(pushVisibleUser);
}
const reactionAcceptance = ref(defaultStore.state.reactionAcceptance);
const autocomplete = ref(null);
const draghover = ref(false);
const quoteId = ref(null);
const quoteId = ref<string | null>(null);
const hasNotSpecifiedMentions = ref(false);
const recentHashtags = ref(JSON.parse(miLocalStorage.getItem('hashtags') ?? '[]'));
const imeText = ref('');

View file

@ -28,10 +28,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { } from 'vue';
import * as Misskey from 'misskey-js';
import { i18n } from '@/i18n.js';
const props = withDefaults(defineProps<{
role: any;
role: Misskey.entities.Role;
forModeration: boolean;
detailed: boolean;
}>(), {

View file

@ -65,10 +65,10 @@ const opening = ref(false);
const changed = ref(false);
const invalid = ref(false);
const filled = computed(() => v.value !== '' && v.value != null);
const inputEl = ref(null);
const prefixEl = ref(null);
const suffixEl = ref(null);
const container = ref(null);
const inputEl = ref<HTMLObjectElement | null>(null);
const prefixEl = ref<HTMLElement | null>(null);
const suffixEl = ref<HTMLElement | null>(null);
const container = ref<HTMLElement | null>(null);
const height =
props.small ? 33 :
props.large ? 39 :

View file

@ -71,8 +71,6 @@ const host = ref(toUnicode(configHost));
const totpLogin = ref(false);
const queryingKey = ref(false);
const credentialRequest = ref<CredentialRequestOptions | null>(null);
const hCaptchaResponse = ref(null);
const reCaptchaResponse = ref(null);
const emit = defineEmits<{
(ev: 'login', v: any): void;
@ -126,8 +124,6 @@ async function queryKey(): Promise<void> {
username: username.value,
password: password.value,
credential: credential.toJSON(),
'hcaptcha-response': hCaptchaResponse.value,
'g-recaptcha-response': reCaptchaResponse.value,
});
}).then(res => {
emit('login', res);
@ -149,8 +145,6 @@ function onSubmit(): void {
os.api('signin', {
username: username.value,
password: password.value,
'hcaptcha-response': hCaptchaResponse.value,
'g-recaptcha-response': reCaptchaResponse.value,
}).then(res => {
totpLogin.value = true;
signing.value = false;
@ -168,8 +162,6 @@ function onSubmit(): void {
os.api('signin', {
username: username.value,
password: password.value,
'hcaptcha-response': hCaptchaResponse.value,
'g-recaptcha-response': reCaptchaResponse.value,
token: user.value?.twoFactorEnabled ? token.value : undefined,
}).then(res => {
emit('login', res);

View file

@ -121,9 +121,9 @@ const emailState = ref<null | 'wait' | 'ok' | 'unavailable:used' | 'unavailable:
const passwordStrength = ref<'' | 'low' | 'medium' | 'high'>('');
const passwordRetypeState = ref<null | 'match' | 'not-match'>(null);
const submitting = ref<boolean>(false);
const hCaptchaResponse = ref(null);
const reCaptchaResponse = ref(null);
const turnstileResponse = ref(null);
const hCaptchaResponse = ref<string | null>(null);
const reCaptchaResponse = ref<string | null>(null);
const turnstileResponse = ref<string | null>(null);
const usernameAbortController = ref<null | AbortController>(null);
const emailAbortController = ref<null | AbortController>(null);

View file

@ -72,7 +72,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, onUnmounted, ref, shallowRef } from 'vue';
const particles = ref([]);
const particles = ref<{
id: string,
x: number,
y: number,
size: number,
dur: number,
color: string
}[]>([]);
const el = shallowRef<HTMLElement>();
const width = ref(0);
const height = ref(0);

View file

@ -66,7 +66,7 @@ const props = defineProps<{
announcement?: any,
}>();
const dialog = ref(null);
const dialog = ref<InstanceType<typeof MkModalWindow> | null>(null);
const title = ref<string>(props.announcement ? props.announcement.title : '');
const text = ref<string>(props.announcement ? props.announcement.text : '');
const icon = ref<string>(props.announcement ? props.announcement.icon : 'info');

View file

@ -84,7 +84,7 @@ const widgetRefs = {};
const configWidget = (id: string) => {
widgetRefs[id].configure();
};
const widgetAdderSelected = ref(null);
const widgetAdderSelected = ref<string | null>(null);
const addWidget = () => {
if (widgetAdderSelected.value == null) return;

View file

@ -30,7 +30,7 @@ const props = defineProps<{
const pending = ref(true);
const resolved = ref(false);
const rejected = ref(false);
const result = ref(null);
const result = ref<any>(null);
const process = () => {
if (props.p == null) {

View file

@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { onMounted, Ref, ref } from 'vue';
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { NoteBlock } from './block.type.js';
import MkNote from '@/components/MkNote.vue';
@ -23,7 +23,7 @@ const props = defineProps<{
page: Misskey.entities.Page,
}>();
const note: Ref<Misskey.entities.Note | null> = ref(null);
const note = ref<Misskey.entities.Note | null>(null);
onMounted(() => {
os.api('notes/show', { noteId: props.block.note })

View file

@ -103,6 +103,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XEmojis from './about.emojis.vue';
import XFederation from './about.federation.vue';
import { version, host } from '@/config.js';
@ -126,7 +127,7 @@ const props = withDefaults(defineProps<{
initialTab: 'overview',
});
const stats = ref(null);
const stats = ref<Misskey.entities.StatsResponse | null>(null);
const tab = ref(props.initialTab);
watch(tab, () => {

View file

@ -68,6 +68,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import MkObjectView from '@/components/MkObjectView.vue';
@ -83,8 +84,8 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { iAmAdmin, iAmModerator } from '@/account.js';
const tab = ref('overview');
const file = ref<any>(null);
const info = ref<any>(null);
const file = ref<Misskey.entities.DriveFile | null>(null);
const info = ref<Misskey.entities.AdminDriveShowFileResponse | null>(null);
const isSensitive = ref<boolean>(false);
const props = defineProps<{

View file

@ -225,9 +225,9 @@ const tab = ref(props.initialTab);
const chartSrc = ref('per-user-notes');
const user = ref<null | Misskey.entities.UserDetailed>();
const init = ref<ReturnType<typeof createFetcher>>();
const info = ref();
const ips = ref(null);
const ap = ref(null);
const info = ref<any>();
const ips = ref<Misskey.entities.AdminGetUserIpsResponse | null>(null);
const ap = ref<any>(null);
const moderator = ref(false);
const silenced = ref(false);
const approved = ref(false);

View file

@ -70,7 +70,7 @@ const metadata = injectPageMetadata();
const el = shallowRef<HTMLElement>(null);
const tabRefs = {};
const tabHighlightEl = shallowRef<HTMLElement | null>(null);
const bg = ref(null);
const bg = ref<string | null>(null);
const height = ref(0);
const hasTabs = computed(() => {
return props.tabs && props.tabs.length > 0;

View file

@ -86,6 +86,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import XHeader from './_header_.vue';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
@ -98,7 +99,7 @@ import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const ads = ref<any[]>([]);
const ads = ref<Misskey.entities.Ad[]>([]);
// ISOTZUTCTZ
const localTime = new Date();

View file

@ -65,6 +65,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { defineAsyncComponent, ref } from 'vue';
import type { CaptchaProvider } from '@/components/MkCaptcha.vue';
import MkRadios from '@/components/MkRadios.vue';
import MkInput from '@/components/MkInput.vue';
import MkButton from '@/components/MkButton.vue';
@ -76,7 +77,7 @@ import { i18n } from '@/i18n.js';
const MkCaptcha = defineAsyncComponent(() => import('@/components/MkCaptcha.vue'));
const provider = ref(null);
const provider = ref<CaptchaProvider | null>(null);
const hcaptchaSiteKey = ref<string | null>(null);
const hcaptchaSecretKey = ref<string | null>(null);
const recaptchaSiteKey = ref<string | null>(null);

View file

@ -121,9 +121,9 @@ const app192IconUrl = ref<string | null>(null);
const app512IconUrl = ref<string | null>(null);
const bannerUrl = ref<string | null>(null);
const backgroundImageUrl = ref<string | null>(null);
const themeColor = ref<any>(null);
const defaultLightTheme = ref<any>(null);
const defaultDarkTheme = ref<any>(null);
const themeColor = ref<string | null>(null);
const defaultLightTheme = ref<string | null>(null);
const defaultDarkTheme = ref<string | null>(null);
const defaultLike = ref<string>('');
const serverErrorImageUrl = ref<string | null>(null);
const infoImageUrl = ref<string | null>(null);

View file

@ -79,7 +79,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkButton from '@/components/MkButton.vue';
const enableEmail = ref<boolean>(false);
const email = ref<any>(null);
const email = ref<string | null>(null);
const smtpSecure = ref<boolean>(false);
const smtpHost = ref<string>('');
const smtpPort = ref<number>(0);

View file

@ -46,7 +46,7 @@ import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const origin = ref('local');
const type = ref(null);
const type = ref<string | null>(null);
const searchHost = ref('');
const userId = ref('');
const viewMode = ref('grid');

View file

@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { onActivated, onMounted, onUnmounted, provide, watch, ref, computed } from 'vue';
import { ComputedRef, Ref, onActivated, onMounted, onUnmounted, provide, watch, ref, computed } from 'vue';
import { i18n } from '@/i18n.js';
import MkSuperMenu from '@/components/MkSuperMenu.vue';
import MkInfo from '@/components/MkInfo.vue';
@ -37,7 +37,7 @@ import { instance } from '@/instance.js';
import * as os from '@/os.js';
import { lookupUser, lookupUserByEmail } from '@/scripts/lookup-user.js';
import { useRouter } from '@/router.js';
import { definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
import { PageMetadata, definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
const isEmpty = (x: string | null) => x == null || x === '';
@ -52,10 +52,10 @@ const indexInfo = {
provide('shouldOmitHeaderTitle', false);
const INFO = ref(indexInfo);
const childInfo = ref(null);
const childInfo: Ref<ComputedRef<PageMetadata> | null> = ref(null);
const narrow = ref(false);
const view = ref(null);
const el = ref(null);
const el = ref<HTMLDivElement | null>(null);
const pageProps = ref({});
let noMaintainerInformation = isEmpty(instance.maintainerName) || isEmpty(instance.maintainerEmail);
let noBotProtection = !instance.disableRegistration && !instance.enableHcaptcha && !instance.enableRecaptcha && !instance.enableTurnstile;

View file

@ -42,7 +42,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
const logs = shallowRef<InstanceType<typeof MkPagination>>();
const type = ref(null);
const type = ref<string | null>(null);
const moderatorId = ref('');
const pagination = {

View file

@ -47,15 +47,15 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import XPie from './overview.pie.vue';
import XPie, { type InstanceForPie } from './overview.pie.vue';
import * as os from '@/os.js';
import number from '@/filters/number.js';
import MkNumberDiff from '@/components/MkNumberDiff.vue';
import { i18n } from '@/i18n.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
const topSubInstancesForPie = ref<any>(null);
const topPubInstancesForPie = ref<any>(null);
const topSubInstancesForPie = ref<InstanceForPie[] | null>(null);
const topPubInstancesForPie = ref<InstanceForPie[] | null>(null);
const federationPubActive = ref<number | null>(null);
const federationPubActiveDiff = ref<number | null>(null);
const federationSubActive = ref<number | null>(null);
@ -72,22 +72,28 @@ onMounted(async () => {
federationSubActiveDiff.value = chart.subActive[0] - chart.subActive[1];
os.apiGet('federation/stats', { limit: 10 }).then(res => {
topSubInstancesForPie.value = res.topSubInstances.map(x => ({
topSubInstancesForPie.value = [
...res.topSubInstances.map(x => ({
name: x.host,
color: x.themeColor,
value: x.followersCount,
onClick: () => {
os.pageWindow(`/instance-info/${x.host}`);
},
})).concat([{ name: '(other)', color: '#80808080', value: res.otherFollowersCount }]);
topPubInstancesForPie.value = res.topPubInstances.map(x => ({
})),
{ name: '(other)', color: '#80808080', value: res.otherFollowersCount },
];
topPubInstancesForPie.value = [
...res.topPubInstances.map(x => ({
name: x.host,
color: x.themeColor,
value: x.followingCount,
onClick: () => {
os.pageWindow(`/instance-info/${x.host}`);
},
})).concat([{ name: '(other)', color: '#80808080', value: res.otherFollowingCount }]);
})),
{ name: '(other)', color: '#80808080', value: res.otherFollowingCount },
];
});
fetching.value = false;

View file

@ -18,12 +18,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { useInterval } from '@/scripts/use-interval.js';
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
import { defaultStore } from '@/store.js';
const instances = ref([]);
const instances = ref<Misskey.entities.FederationInstance[]>([]);
const fetching = ref(true);
const fetch = async () => {

View file

@ -18,10 +18,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { defaultStore } from '@/store.js';
const moderators = ref<any>(null);
const moderators = ref<Misskey.entities.UserDetailed[] | null>(null);
const fetching = ref(true);
onMounted(async () => {

View file

@ -13,10 +13,17 @@ import { Chart } from 'chart.js';
import { useChartTooltip } from '@/scripts/use-chart-tooltip.js';
import { initChart } from '@/scripts/init-chart.js';
export type InstanceForPie = {
name: string,
color: string | null,
value: number,
onClick?: () => void
};
initChart();
const props = defineProps<{
data: { name: string; value: number; color: string; onClick?: () => void }[];
data: InstanceForPie[];
}>();
const chartEl = shallowRef<HTMLCanvasElement>(null);

View file

@ -62,6 +62,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import MkNumberDiff from '@/components/MkNumberDiff.vue';
import MkNumber from '@/components/MkNumber.vue';
@ -69,7 +70,7 @@ import { i18n } from '@/i18n.js';
import { customEmojis } from '@/custom-emojis.js';
import { defaultStore } from '@/store.js';
const stats = ref<any>(null);
const stats = ref<Misskey.entities.StatsResponse | null>(null);
const usersComparedToThePrevDay = ref<number>();
const notesComparedToThePrevDay = ref<number>();
const onlineUsersCount = ref(0);

View file

@ -18,12 +18,13 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { useInterval } from '@/scripts/use-interval.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
import { defaultStore } from '@/store.js';
const newUsers = ref(null);
const newUsers = ref<Misskey.entities.UserDetailed[] | null>(null);
const fetching = ref(true);
const fetch = async () => {

View file

@ -66,6 +66,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { markRaw, onMounted, onBeforeUnmount, nextTick, shallowRef, ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import XFederation from './overview.federation.vue';
import XInstances from './overview.instances.vue';
import XQueue from './overview.queue.vue';
@ -76,6 +77,7 @@ import XStats from './overview.stats.vue';
import XRetention from './overview.retention.vue';
import XModerators from './overview.moderators.vue';
import XHeatmap from './overview.heatmap.vue';
import type { InstanceForPie } from './overview.pie.vue';
import * as os from '@/os.js';
import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js';
@ -83,15 +85,15 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkFoldableSection from '@/components/MkFoldableSection.vue';
const rootEl = shallowRef<HTMLElement>();
const serverInfo = ref<any>(null);
const topSubInstancesForPie = ref<any>(null);
const topPubInstancesForPie = ref<any>(null);
const serverInfo = ref<Misskey.entities.ServerInfoResponse | null>(null);
const topSubInstancesForPie = ref<InstanceForPie[] | null>(null);
const topPubInstancesForPie = ref<InstanceForPie[] | null>(null);
const federationPubActive = ref<number | null>(null);
const federationPubActiveDiff = ref<number | null>(null);
const federationSubActive = ref<number | null>(null);
const federationSubActiveDiff = ref<number | null>(null);
const newUsers = ref(null);
const activeInstances = shallowRef(null);
const newUsers = ref<Misskey.entities.UserDetailed[] | null>(null);
const activeInstances = shallowRef<Misskey.entities.FederationInstance | null>(null);
const queueStatsConnection = markRaw(useStream().useChannel('queueStats'));
const now = new Date();
const filesPagination = {
@ -123,22 +125,28 @@ onMounted(async () => {
});
os.apiGet('federation/stats', { limit: 10 }).then(res => {
topSubInstancesForPie.value = res.topSubInstances.map(x => ({
topSubInstancesForPie.value = [
...res.topSubInstances.map(x => ({
name: x.host,
color: x.themeColor,
value: x.followersCount,
onClick: () => {
os.pageWindow(`/instance-info/${x.host}`);
},
})).concat([{ name: '(other)', color: '#80808080', value: res.otherFollowersCount }]);
topPubInstancesForPie.value = res.topPubInstances.map(x => ({
})),
{ name: '(other)', color: '#80808080', value: res.otherFollowersCount },
];
topPubInstancesForPie.value = [
...res.topPubInstances.map(x => ({
name: x.host,
color: x.themeColor,
value: x.followingCount,
onClick: () => {
os.pageWindow(`/instance-info/${x.host}`);
},
})).concat([{ name: '(other)', color: '#80808080', value: res.otherFollowingCount }]);
})),
{ name: '(other)', color: '#80808080', value: res.otherFollowingCount },
];
});
os.api('admin/server-info').then(serverInfoResponse => {

View file

@ -22,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import MkKeyValue from '@/components/MkKeyValue.vue';
import MkButton from '@/components/MkButton.vue';
import MkInfo from '@/components/MkInfo.vue';
@ -31,8 +32,8 @@ import { fetchInstance } from '@/instance.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const proxyAccount = ref<any>(null);
const proxyAccountId = ref<any>(null);
const proxyAccount = ref<Misskey.entities.UserDetailed | null>(null);
const proxyAccountId = ref<string | null>(null);
async function init() {
const meta = await os.api('admin/meta');

View file

@ -62,7 +62,7 @@ const activeSincePrevTick = ref(0);
const active = ref(0);
const delayed = ref(0);
const waiting = ref(0);
const jobs = ref([]);
const jobs = ref<(string | number)[][]>([]);
const chartProcess = shallowRef<InstanceType<typeof XChart>>();
const chartActive = shallowRef<InstanceType<typeof XChart>>();
const chartDelayed = shallowRef<InstanceType<typeof XChart>>();
@ -104,9 +104,11 @@ const onStatsLog = (statsLog) => {
};
onMounted(() => {
os.api(props.domain === 'inbox' ? 'admin/queue/inbox-delayed' : props.domain === 'deliver' ? 'admin/queue/deliver-delayed' : null, {}).then(result => {
if (props.domain === 'inbox' || props.domain === 'deliver') {
os.api(`admin/queue/${props.domain}-delayed`).then(result => {
jobs.value = result;
});
}
connection.on('stats', onStats);
connection.on('statsLog', onStatsLog);

View file

@ -25,13 +25,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import XHeader from './_header_.vue';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const relays = ref<any[]>([]);
const relays = ref<Misskey.entities.AdminRelaysListResponse>([]);
async function addRelay() {
const { canceled, result: inbox } = await os.inputText({
@ -66,7 +67,7 @@ function remove(inbox: string) {
}
function refresh() {
os.api('admin/relays/list').then((relayList: any) => {
os.api('admin/relays/list').then(relayList => {
relays.value = relayList;
});
}

View file

@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { v4 as uuid } from 'uuid';
import XHeader from './_header_.vue';
import XEditor from './roles.editor.vue';
@ -39,8 +40,8 @@ const props = defineProps<{
id?: string;
}>();
const role = ref(null);
const data = ref(null);
const role = ref<Misskey.entities.Role | null>(null);
const data = ref<any>(null);
if (props.id) {
role.value = await os.api('admin/roles/show', {

View file

@ -173,8 +173,8 @@ const pinnedUsers = ref<string>('');
const cacheRemoteFiles = ref<boolean>(false);
const cacheRemoteSensitiveFiles = ref<boolean>(false);
const enableServiceWorker = ref<boolean>(false);
const swPublicKey = ref<any>(null);
const swPrivateKey = ref<any>(null);
const swPublicKey = ref<string | null>(null);
const swPrivateKey = ref<string | null>(null);
const enableFanoutTimeline = ref<boolean>(false);
const enableFanoutTimelineDbFallback = ref<boolean>(false);
const perLocalUserUserTimelineCacheMax = ref<number>(0);

View file

@ -25,6 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref, shallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import MkTimeline from '@/components/MkTimeline.vue';
import { scroll } from '@/scripts/scroll.js';
import * as os from '@/os.js';
@ -38,7 +39,7 @@ const props = defineProps<{
antennaId: string;
}>();
const antenna = ref(null);
const antenna = ref<Misskey.entities.Antenna | null>(null);
const queue = ref(0);
const rootEl = shallowRef<HTMLElement>();
const tlEl = shallowRef<InstanceType<typeof MkTimeline>>();

View file

@ -46,7 +46,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
const body = ref('{}');
const endpoint = ref('');
const endpoints = ref<any[]>([]);
const endpoints = ref<string[]>([]);
const sending = ref(false);
const res = ref('');
const withCredential = ref(true);

View file

@ -35,6 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
@ -43,7 +44,7 @@ import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkFolder from '@/components/MkFolder.vue';
const avatarDecorations = ref<any[]>([]);
const avatarDecorations = ref<Misskey.entities.AdminAvatarDecorationsListResponse>([]);
function add() {
avatarDecorations.value.unshift({

View file

@ -70,6 +70,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, ref, watch, defineAsyncComponent } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkColorInput from '@/components/MkColorInput.vue';
@ -90,15 +91,15 @@ const props = defineProps<{
channelId?: string;
}>();
const channel = ref(null);
const name = ref(null);
const description = ref(null);
const channel = ref<Misskey.entities.Channel | null>(null);
const name = ref<string | null>(null);
const description = ref<string | null>(null);
const bannerUrl = ref<string | null>(null);
const bannerId = ref<string | null>(null);
const color = ref('#000');
const isSensitive = ref(false);
const allowRenoteToExternal = ref(true);
const pinnedNotes = ref([]);
const pinnedNotes = ref<Partial<Misskey.entities.Note>[]>([]);
watch(() => bannerId.value, async () => {
if (bannerId.value == null) {

View file

@ -88,9 +88,9 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
const emojisPaginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
const tab = ref('local');
const query = ref(null);
const queryRemote = ref(null);
const host = ref(null);
const query = ref<string | null>(null);
const queryRemote = ref<string | null>(null);
const host = ref<string | null>(null);
const selectMode = ref(false);
const selectedEmojis = ref<string[]>([]);

View file

@ -11,11 +11,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XDrive from '@/components/MkDrive.vue';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const folder = ref(null);
const folder = ref<Misskey.entities.DriveFolder | null>(null);
const headerActions = computed(() => []);

View file

@ -92,7 +92,7 @@ const props = defineProps<{
emoji?: any,
}>();
const dialog = ref(null);
const dialog = ref<InstanceType<typeof MkModalWindow> | null>(null);
const name = ref<string>(props.emoji ? props.emoji.name : '');
const category = ref<string>(props.emoji ? props.emoji.category : '');
const aliases = ref<string>(props.emoji ? props.emoji.aliases.join(' ') : '');
@ -100,7 +100,7 @@ const license = ref<string>(props.emoji ? (props.emoji.license ?? '') : '');
const isSensitive = ref(props.emoji ? props.emoji.isSensitive : false);
const localOnly = ref(props.emoji ? props.emoji.localOnly : false);
const roleIdsThatCanBeUsedThisEmojiAsReaction = ref(props.emoji ? props.emoji.roleIdsThatCanBeUsedThisEmojiAsReaction : []);
const rolesThatCanBeUsedThisEmojiAsReaction = ref([]);
const rolesThatCanBeUsedThisEmojiAsReaction = ref<Misskey.entities.Role[]>([]);
const file = ref<Misskey.entities.DriveFile>();
watch(roleIdsThatCanBeUsedThisEmojiAsReaction, async () => {

View file

@ -13,10 +13,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkRolePreview from '@/components/MkRolePreview.vue';
import * as os from '@/os.js';
const roles = ref();
const roles = ref<Misskey.entities.Role[] | null>(null);
os.api('roles/list').then(res => {
roles.value = res.filter(x => x.target === 'manual').sort((a, b) => b.displayOrder - a.displayOrder);

View file

@ -64,6 +64,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { watch, ref, shallowRef, computed } from 'vue';
import * as Misskey from 'misskey-js';
import MkUserList from '@/components/MkUserList.vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue';
import MkTab from '@/components/MkTab.vue';
@ -76,8 +77,8 @@ const props = defineProps<{
const origin = ref('local');
const tagsEl = shallowRef<InstanceType<typeof MkFoldableSection>>();
const tagsLocal = ref([]);
const tagsRemote = ref([]);
const tagsLocal = ref<Misskey.entities.Hashtag[]>([]);
const tagsRemote = ref<Misskey.entities.Hashtag[]>([]);
watch(() => props.tag, () => {
if (tagsEl.value) tagsEl.value.toggleContent(props.tag == null);

View file

@ -35,6 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
@ -364,8 +365,8 @@ const props = defineProps<{
id?: string;
}>();
const flash = ref(null);
const visibility = ref('public');
const flash = ref<Misskey.entities.Flash | null>(null);
const visibility = ref<Misskey.entities.FlashUpdateRequest['visibility']>('public');
if (props.id) {
flash.value = await os.api('flash/show', {

View file

@ -58,6 +58,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, onDeactivated, onUnmounted, Ref, ref, watch, shallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import { Interpreter, Parser, values } from '@syuilo/aiscript';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
@ -78,8 +79,8 @@ const props = defineProps<{
id: string;
}>();
const flash = ref(null);
const error = ref(null);
const flash = ref<Misskey.entities.Flash | null>(null);
const error = ref<any>(null);
function fetchFlash() {
flash.value = null;

View file

@ -39,6 +39,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue';
import MkTextarea from '@/components/MkTextarea.vue';
@ -56,10 +57,10 @@ const props = defineProps<{
postId?: string;
}>();
const init = ref(null);
const files = ref([]);
const description = ref(null);
const title = ref(null);
const init = ref<(() => Promise<any>) | null>(null);
const files = ref<Misskey.entities.DriveFile[]>([]);
const description = ref<string | null>(null);
const title = ref<string | null>(null);
const isSensitive = ref(false);
function selectFile(evt) {
@ -109,7 +110,7 @@ watch(() => props.postId, () => {
init.value = () => props.postId ? os.api('gallery/posts/show', {
postId: props.postId,
}).then(post => {
files.value = post.files;
files.value = post.files ?? [];
title.value = post.title;
description.value = post.description;
isSensitive.value = post.isSensitive;

View file

@ -63,6 +63,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
import MkContainer from '@/components/MkContainer.vue';
@ -84,8 +85,8 @@ const props = defineProps<{
postId: string;
}>();
const post = ref(null);
const error = ref(null);
const post = ref<Misskey.entities.GalleryPost | null>(null);
const error = ref<any>(null);
const otherPostsPagination = {
endpoint: 'users/gallery/posts' as const,
limit: 6,

View file

@ -35,6 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { watch, computed, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import { userPage } from '@/filters/user.js';
import { i18n } from '@/i18n.js';
@ -47,9 +48,9 @@ const props = defineProps<{
listId: string;
}>();
const list = ref(null);
const list = ref<Misskey.entities.UserList | null>(null);
const error = ref();
const users = ref([]);
const users = ref<Misskey.entities.UserDetailed[]>([]);
function fetchList(): void {
os.api('users/lists/show', {

View file

@ -11,6 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import XAntenna from './editor.vue';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
@ -20,7 +21,7 @@ import { antennasCache } from '@/cache.js';
const router = useRouter();
const antenna = ref<any>(null);
const antenna = ref<Misskey.entities.Antenna | null>(null);
const props = defineProps<{
antennaId: string

View file

@ -60,7 +60,7 @@ import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
const props = defineProps<{
antenna: any
antenna: Misskey.entities.Antenna
}>();
const emit = defineEmits<{
@ -70,8 +70,8 @@ const emit = defineEmits<{
}>();
const name = ref<string>(props.antenna.name);
const src = ref<string>(props.antenna.src);
const userListId = ref<any>(props.antenna.userListId);
const src = ref<Misskey.entities.AntennasCreateRequest['src']>(props.antenna.src);
const userListId = ref<string | null>(props.antenna.userListId);
const users = ref<string>(props.antenna.users.join('\n'));
const keywords = ref<string>(props.antenna.keywords.map(x => x.join(' ')).join('\n'));
const excludeKeywords = ref<string>(props.antenna.excludeKeywords.map(x => x.join(' ')).join('\n'));
@ -80,7 +80,7 @@ const localOnly = ref<boolean>(props.antenna.localOnly);
const withReplies = ref<boolean>(props.antenna.withReplies);
const withFile = ref<boolean>(props.antenna.withFile);
const notify = ref<boolean>(props.antenna.notify);
const userLists = ref<any>(null);
const userLists = ref<Misskey.entities.UserList[] | null>(null);
watch(() => src.value, async () => {
if (src.value === 'list' && userLists.value === null) {
@ -107,8 +107,7 @@ async function saveAntenna() {
await os.apiWithDialog('antennas/create', antennaData);
emit('created');
} else {
antennaData['antennaId'] = props.antenna.id;
await os.apiWithDialog('antennas/update', antennaData);
await os.apiWithDialog('antennas/update', { ...antennaData, antennaId: props.antenna.id });
emit('updated');
}
}

View file

@ -27,6 +27,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { watch, ref, shallowRef, computed } from 'vue';
import * as Misskey from 'misskey-js';
import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue';
import MkClipPreview from '@/components/MkClipPreview.vue';
@ -42,7 +43,7 @@ const pagination = {
};
const tab = ref('my');
const favorites = ref();
const favorites = ref<Misskey.entities.Clip[] | null>(null);
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>();

View file

@ -67,7 +67,7 @@ const props = defineProps<{
}>();
const note = ref<null | Misskey.entities.Note>();
const clips = ref();
const clips = ref<Misskey.entities.Clip[]>();
const showPrev = ref(false);
const showNext = ref(false);
const expandAllCws = ref(false);

View file

@ -22,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
/* eslint-disable vue/no-mutating-props */
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XContainer from '../page-editor.container.vue';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import * as os from '@/os.js';
@ -35,7 +36,7 @@ const emit = defineEmits<{
(ev: 'update:modelValue', value: any): void;
}>();
const file = ref<any>(null);
const file = ref<Misskey.entities.DriveFile | null>(null);
async function choose() {
os.selectDriveFile(false).then((fileResponse) => {

View file

@ -24,6 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
/* eslint-disable vue/no-mutating-props */
import { watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XContainer from '../page-editor.container.vue';
import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue';
@ -41,7 +42,7 @@ const emit = defineEmits<{
}>();
const id = ref<any>(props.modelValue.note);
const note = ref<any>(null);
const note = ref<Misskey.entities.Note | null>(null);
watch(id, async () => {
if (id.value && (id.value.startsWith('http://') || id.value.startsWith('https://'))) {

View file

@ -16,6 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { defineAsyncComponent } from 'vue';
import * as Misskey from 'misskey-js';
import XSection from './els/page-editor.el.section.vue';
import XText from './els/page-editor.el.text.vue';
import XImage from './els/page-editor.el.image.vue';
@ -34,11 +35,11 @@ function getComponent(type: string) {
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
const props = defineProps<{
modelValue: any[];
modelValue: Misskey.entities.Page['content'];
}>();
const emit = defineEmits<{
(ev: 'update:modelValue', value: any[]): void;
(ev: 'update:modelValue', value: Misskey.entities.Page['content']): void;
}>();
function updateItem(v) {

View file

@ -62,6 +62,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, provide, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { v4 as uuid } from 'uuid';
import XBlocks from './page-editor.blocks.vue';
import MkButton from '@/components/MkButton.vue';
@ -84,16 +85,16 @@ const props = defineProps<{
const tab = ref('settings');
const author = ref($i);
const readonly = ref(false);
const page = ref(null);
const pageId = ref(null);
const currentName = ref(null);
const page = ref<Misskey.entities.Page | null>(null);
const pageId = ref<string | null>(null);
const currentName = ref<string | null>(null);
const title = ref('');
const summary = ref(null);
const summary = ref<string | null>(null);
const name = ref(Date.now().toString());
const eyeCatchingImage = ref(null);
const eyeCatchingImageId = ref(null);
const eyeCatchingImage = ref<Misskey.entities.DriveFile | null>(null);
const eyeCatchingImageId = ref<string | null>(null);
const font = ref('sans-serif');
const content = ref([]);
const content = ref<Misskey.entities.Page['content']>([]);
const alignCenter = ref(false);
const hideTitleWhenPinned = ref(false);

View file

@ -77,6 +77,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XPage from '@/components/page/page.vue';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os.js';
@ -99,8 +100,8 @@ const props = defineProps<{
username: string;
}>();
const page = ref(null);
const error = ref(null);
const page = ref<Misskey.entities.Page | null>(null);
const error = ref<any>(null);
const otherPostsPagination = {
endpoint: 'users/pages' as const,
limit: 6,

View file

@ -51,7 +51,7 @@ const props = defineProps<{
const scope = computed(() => props.path ? props.path.split('/') : []);
const keys = ref(null);
const keys = ref<any>(null);
function fetchKeys() {
os.api('i/registry/keys-with-type', {

View file

@ -64,8 +64,8 @@ const props = defineProps<{
const scope = computed(() => props.path.split('/').slice(0, -1));
const key = computed(() => props.path.split('/').at(-1));
const value = ref(null);
const valueForEditor = ref(null);
const value = ref<any>(null);
const valueForEditor = ref<string | null>(null);
function fetchValue() {
os.api('i/registry/get-detail', {

View file

@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import JSON5 from 'json5';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
@ -31,7 +32,7 @@ import FormLink from '@/components/form/link.vue';
import FormSection from '@/components/form/section.vue';
import MkButton from '@/components/MkButton.vue';
const scopesWithDomain = ref(null);
const scopesWithDomain = ref<Misskey.entities.IRegistryScopesWithDomainResponse | null>(null);
function fetchScopes() {
os.api('i/registry/scopes-with-domain').then(res => {

View file

@ -37,6 +37,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import * as os from '@/os.js';
import MkUserList from '@/components/MkUserList.vue';
import { definePageMetadata } from '@/scripts/page-metadata.js';
@ -53,7 +54,7 @@ const props = withDefaults(defineProps<{
});
const tab = ref(props.initialTab);
const role = ref();
const role = ref<Misskey.entities.Role>();
const error = ref();
const visible = ref(false);
@ -62,7 +63,7 @@ watch(() => props.role, () => {
roleId: props.role,
}).then(res => {
role.value = res;
document.title = `${role.value?.name} | ${instanceName}`;
document.title = `${role.value.name} | ${instanceName}`;
visible.value = res.isExplorable && res.isPublic;
}).catch((err) => {
if (err.code === 'NO_SUCH_ROLE') {

View file

@ -68,7 +68,7 @@ const key = ref(0);
const searchQuery = ref('');
const searchOrigin = ref('combined');
const notePagination = ref();
const user = ref(null);
const user = ref<any>(null);
const isLocalOnly = ref(false);
const order = ref(false);
const filetype = ref(null);

View file

@ -29,7 +29,7 @@ import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
const storedAccounts = ref<any>(null);
const storedAccounts = ref<{ id: string, token: string }[] | null>(null);
const accounts = ref<Misskey.entities.UserDetailed[]>([]);
const init = async () => {

View file

@ -54,7 +54,7 @@ import MkKeyValue from '@/components/MkKeyValue.vue';
import MkButton from '@/components/MkButton.vue';
import { infoImageUrl } from '@/instance.js';
const list = ref<any>(null);
const list = ref<InstanceType<typeof FormPagination>>();
const pagination = {
endpoint: 'i/apps' as const,

View file

@ -54,6 +54,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, ref } from 'vue';
import * as Misskey from 'misskey-js';
import tinycolor from 'tinycolor2';
import FormLink from '@/components/form/link.vue';
import MkSwitch from '@/components/MkSwitch.vue';
@ -69,9 +70,9 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import { $i } from '@/account.js';
const fetching = ref(true);
const usage = ref<any>(null);
const capacity = ref<any>(null);
const uploadFolder = ref<any>(null);
const usage = ref<number | null>(null);
const capacity = ref<number | null>(null);
const uploadFolder = ref<Misskey.entities.DriveFolder | null>(null);
const alwaysMarkNsfw = ref($i.alwaysMarkNsfw);
const meterStyle = computed(() => {

View file

@ -27,7 +27,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script setup lang="ts">
import { computed, onActivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
import { ComputedRef, Ref, computed, onActivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
import { i18n } from '@/i18n.js';
import MkInfo from '@/components/MkInfo.vue';
import MkSuperMenu from '@/components/MkSuperMenu.vue';
@ -35,7 +35,7 @@ import { signout, $i } from '@/account.js';
import { clearCache } from '@/scripts/clear-cache.js';
import { instance } from '@/instance.js';
import { useRouter } from '@/router.js';
import { definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
import { PageMetadata, definePageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
import * as os from '@/os.js';
const indexInfo = {
@ -45,7 +45,7 @@ const indexInfo = {
};
const INFO = ref(indexInfo);
const el = shallowRef<HTMLElement | null>(null);
const childInfo = ref(null);
const childInfo: Ref<ComputedRef<PageMetadata> | null> = ref(null);
const router = useRouter();

View file

@ -87,6 +87,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { reactive, watch } from 'vue';
import * as Misskey from 'misskey-js';
import MkSelect from '@/components/MkSelect.vue';
import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue';
@ -99,7 +100,7 @@ import { deepClone } from '@/scripts/clone.js';
const props = defineProps<{
_id: string;
userLists: any[] | null;
userLists: Misskey.entities.UserList[] | null;
}>();
const statusbar = reactive(deepClone(defaultStore.state.statusbars.find(x => x.id === props._id)));

View file

@ -16,6 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import { v4 as uuid } from 'uuid';
import XStatusbar from './statusbar.statusbar.vue';
import MkFolder from '@/components/MkFolder.vue';
@ -27,7 +28,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
const statusbars = defaultStore.reactiveState.statusbars;
const userLists = ref();
const userLists = ref<Misskey.entities.UserList[] | null>(null);
onMounted(() => {
os.api('users/lists/list').then(res => {

View file

@ -25,7 +25,7 @@ import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const installThemeCode = ref(null);
const installThemeCode = ref<string | null>(null);
async function install(code: string): Promise<void> {
try {

View file

@ -46,7 +46,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
const installedThemes = ref(getThemes());
const builtinThemes = getBuiltinThemesRef();
const selectedThemeId = ref(null);
const selectedThemeId = ref<string | null>(null);
const themes = computed(() => [...installedThemes.value, ...builtinThemes.value]);

View file

@ -25,6 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, watch, ref, shallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import MkTimeline from '@/components/MkTimeline.vue';
import { scroll } from '@/scripts/scroll.js';
import * as os from '@/os.js';
@ -38,7 +39,7 @@ const props = defineProps<{
listId: string;
}>();
const list = ref(null);
const list = ref<Misskey.entities.UserList | null>(null);
const queue = ref(0);
const tlEl = shallowRef<InstanceType<typeof MkTimeline>>();
const rootEl = shallowRef<HTMLElement>();

View file

@ -32,7 +32,7 @@ const props = withDefaults(defineProps<{
});
const user = ref<null | Misskey.entities.UserDetailed>(null);
const error = ref(null);
const error = ref<any>(null);
function fetchUser(): void {
if (props.acct == null) return;

View file

@ -32,7 +32,7 @@ const props = withDefaults(defineProps<{
});
const user = ref<null | Misskey.entities.UserDetailed>(null);
const error = ref(null);
const error = ref<any>(null);
function fetchUser(): void {
if (props.acct == null) return;

View file

@ -58,7 +58,7 @@ const props = withDefaults(defineProps<{
const tab = ref(props.page);
const user = ref<null | Misskey.entities.UserDetailed>(null);
const error = ref(null);
const error = ref<any>(null);
function fetchUser(): void {
if (props.acct == null) return;

View file

@ -12,13 +12,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XSetup from './welcome.setup.vue';
import XEntrance from './welcome.entrance.a.vue';
import { instanceName } from '@/config.js';
import * as os from '@/os.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const meta = ref(null);
const meta = ref<Misskey.entities.MetaResponse | null>(null);
os.api('meta', { detail: true }).then(res => {
meta.value = res;

View file

@ -133,7 +133,7 @@ export function getCopyNoteOriginLinkMenu(note: misskey.entities.Note, text: str
export function getNoteMenu(props: {
note: Misskey.entities.Note;
menuButton: Ref<HTMLElement>;
translation: Ref<any>;
translation: Ref<Misskey.entities.NotesTranslateResponse | null>;
translating: Ref<boolean>;
isDeleted: Ref<boolean>;
currentClip?: Misskey.entities.Clip;

View file

@ -11,8 +11,12 @@ export function useChartTooltip(opts: { position: 'top' | 'middle' } = { positio
const tooltipShowing = ref(false);
const tooltipX = ref(0);
const tooltipY = ref(0);
const tooltipTitle = ref(null);
const tooltipSeries = ref(null);
const tooltipTitle = ref<string | null>(null);
const tooltipSeries = ref<{
backgroundColor: string;
borderColor: string;
text: string;
}[] | null>(null);
let disposeTooltipComponent;
os.popup(MkChartTooltip, {

View file

@ -71,8 +71,8 @@ const globalHeaderHeight = ref(0);
const wallpaper = miLocalStorage.getItem('wallpaper') != null;
const showMenuOnTop = computed(() => defaultStore.state.menuDisplay === 'top');
const live2d = shallowRef<HTMLIFrameElement>();
const widgetsLeft = ref();
const widgetsRight = ref();
const widgetsLeft = ref<HTMLElement>();
const widgetsRight = ref<HTMLElement>();
provide('router', mainRouter);
provideMetadataReceiver((info) => {
@ -84,7 +84,7 @@ provideMetadataReceiver((info) => {
provide('shouldHeaderThin', showMenuOnTop.value);
provide('forceSpacerMin', true);
function attachSticky(el) {
function attachSticky(el: HTMLElement) {
const sticky = new StickySidebar(el, 0, defaultStore.state.menuDisplay === 'top' ? 60 : 0); // TODO: 60px
window.addEventListener('scroll', () => {
sticky.calc(window.scrollY);

View file

@ -68,6 +68,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ComputedRef, onMounted, provide, ref, computed } from 'vue';
import * as Misskey from 'misskey-js';
import XCommon from './_common_/common.vue';
import { instanceName } from '@/config.js';
import * as os from '@/os.js';
@ -102,7 +103,7 @@ const isTimelineAvailable = ref(instance.policies?.ltlAvailable || instance.poli
const showMenu = ref(false);
const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD);
const narrow = ref(window.innerWidth < 1280);
const meta = ref();
const meta = ref<Misskey.entities.MetaResponse>();
const keymap = computed(() => {
return {

View file

@ -36,7 +36,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
const props = defineProps<{
activity: any[]
activity: {
total: number;
notes: number;
replies: number;
renotes: number;
}[]
}>();
for (const d of props.activity) {

View file

@ -36,17 +36,22 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
const props = defineProps<{
activity: any[]
activity: {
total: number;
notes: number;
replies: number;
renotes: number;
}[]
}>();
const viewBoxX = ref(147);
const viewBoxY = ref(60);
const zoom = ref(1);
const pos = ref(0);
const pointsNote = ref<any>(null);
const pointsReply = ref<any>(null);
const pointsRenote = ref<any>(null);
const pointsTotal = ref<any>(null);
const pointsNote = ref<string>();
const pointsReply = ref<string>();
const pointsRenote = ref<string>();
const pointsTotal = ref<string>();
function dragListen(fn) {
window.addEventListener('mousemove', fn);

View file

@ -12,8 +12,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<div>
<MkLoading v-if="fetching"/>
<template v-else>
<XCalendar v-show="widgetProps.view === 0" :activity="[].concat(activity)"/>
<XChart v-show="widgetProps.view === 1" :activity="[].concat(activity)"/>
<XCalendar v-show="widgetProps.view === 0" :activity="activity ?? []"/>
<XChart v-show="widgetProps.view === 1" :activity="activity ?? []"/>
</template>
</div>
</MkContainer>
@ -59,7 +59,12 @@ const { widgetProps, configure, save } = useWidgetPropsManager(name,
emit,
);
const activity = ref(null);
const activity = ref<{
total: number;
notes: number;
replies: number;
renotes: number;
}[] | null>(null);
const fetching = ref(true);
const toggleView = () => {

View file

@ -26,6 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import { GetFormResultType } from '@/scripts/form.js';
import MkContainer from '@/components/MkContainer.vue';
@ -56,8 +57,8 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
emit,
);
const instances = ref([]);
const charts = ref([]);
const instances = ref<Misskey.entities.FederationInstance[]>([]);
const charts = ref<Misskey.entities.ChartsInstanceResponse[]>([]);
const fetching = ref(true);
const fetch = async () => {

View file

@ -19,6 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { shallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import { GetFormResultType } from '@/scripts/form.js';
import MkContainer from '@/components/MkContainer.vue';
@ -48,7 +49,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
);
const cloud = shallowRef<InstanceType<typeof MkTagCloud> | null>();
const activeInstances = shallowRef(null);
const activeInstances = shallowRef<Misskey.entities.FederationInstance[] | null>(null);
function onInstanceClick(i) {
os.pageWindow(`/instance-info/${i.host}`);

View file

@ -23,6 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onUnmounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import { GetFormResultType } from '@/scripts/form.js';
import { useStream } from '@/stream.js';
@ -57,7 +58,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
);
const connection = useStream().useChannel('main');
const images = ref([]);
const images = ref<Misskey.entities.DriveFile[]>([]);
const fetching = ref(true);
const onDriveFileCreated = (file) => {

View file

@ -18,6 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, ref, shallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import { GetFormResultType } from '@/scripts/form.js';
import * as os from '@/os.js';
@ -49,7 +50,7 @@ const { widgetProps, configure, save } = useWidgetPropsManager(name,
emit,
);
const images = ref([]);
const images = ref<Misskey.entities.DriveFile[]>([]);
const fetching = ref(true);
const slideA = shallowRef<HTMLElement>();
const slideB = shallowRef<HTMLElement>();

View file

@ -25,6 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import { GetFormResultType } from '@/scripts/form.js';
import MkContainer from '@/components/MkContainer.vue';
@ -54,7 +55,7 @@ const { widgetProps, configure } = useWidgetPropsManager(name,
emit,
);
const stats = ref([]);
const stats = ref<Misskey.entities.HashtagsTrendResponse>([]);
const fetching = ref(true);
const fetch = () => {

View file

@ -25,6 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
import { GetFormResultType } from '@/scripts/form.js';
import MkContainer from '@/components/MkContainer.vue';
@ -58,8 +59,8 @@ const { widgetProps, configure, save } = useWidgetPropsManager(name,
emit,
);
const list = ref();
const users = ref([]);
const list = ref<Misskey.entities.UserList>();
const users = ref<Misskey.entities.UserDetailed[]>([]);
const fetching = ref(true);
async function chooseList() {

View file

@ -76,11 +76,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, onBeforeUnmount, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { v4 as uuid } from 'uuid';
const props = defineProps<{
connection: any,
meta: any
meta: Misskey.entities.ServerInfoResponse
}>();
const viewBoxX = ref<number>(50);
@ -94,10 +95,10 @@ const cpuPolylinePoints = ref<string>('');
const memPolylinePoints = ref<string>('');
const cpuPolygonPoints = ref<string>('');
const memPolygonPoints = ref<string>('');
const cpuHeadX = ref<any>(null);
const cpuHeadY = ref<any>(null);
const memHeadX = ref<any>(null);
const memHeadY = ref<any>(null);
const cpuHeadX = ref<number>();
const cpuHeadY = ref<number>();
const memHeadX = ref<number>();
const memHeadY = ref<number>();
const cpuP = ref<string>('');
const memP = ref<string>('');

View file

@ -16,11 +16,12 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, onBeforeUnmount, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XPie from './pie.vue';
const props = defineProps<{
connection: any,
meta: any
meta: Misskey.entities.ServerInfoResponse
}>();
const usage = ref<number>(0);

Some files were not shown because too many files have changed in this diff Show more