1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-18 14:15:34 +02:00

refactor(frontend): anyを除去2 (#17092)

* wip

* fix types

* fix
This commit is contained in:
かっこかり
2026-01-14 14:45:45 +09:00
committed by GitHub
parent d8318c02a1
commit bd81a6c8ad
32 changed files with 164 additions and 93 deletions

View File

@@ -23,13 +23,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
<div :class="$style.body">
<div :class="$style.header">
<span :class="$style.title">{{ (i18n.ts._achievements._types as any)['_' + achievement.name].title }}</span>
<span :class="$style.title">{{ i18n.ts._achievements._types[`_${achievement.name}`].title }}</span>
<span :class="$style.time">
<time v-tooltip="new Date(achievement.unlockedAt).toLocaleString()">{{ new Date(achievement.unlockedAt).getFullYear() }}/{{ new Date(achievement.unlockedAt).getMonth() + 1 }}/{{ new Date(achievement.unlockedAt).getDate() }}</time>
</span>
</div>
<div :class="$style.description">{{ withDescription ? (i18n.ts._achievements._types as any)['_' + achievement.name].description : '???' }}</div>
<div v-if="(i18n.ts._achievements._types as any)['_' + achievement.name].flavor && withDescription" :class="$style.flavor">{{ (i18n.ts._achievements._types as any)['_' + achievement.name].flavor }}</div>
<div :class="$style.description">{{ withDescription ? i18n.ts._achievements._types[`_${achievement.name}`].description : '???' }}</div>
<div v-if="'flavor' in i18n.ts._achievements._types[`_${achievement.name}`] && withDescription" :class="$style.flavor">{{ (i18n.ts._achievements._types[`_${achievement.name}`] as { flavor: string; }).flavor }}</div>
</div>
</div>
<template v-if="withLocked">

View File

@@ -45,6 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts">
import { markRaw, ref, useTemplateRef, computed, onUpdated, onMounted, onBeforeUnmount, nextTick, watch } from 'vue';
import * as Misskey from 'misskey-js';
import sanitizeHtml from 'sanitize-html';
import { emojilist, getEmojiName } from '@@/js/emojilist.js';
import { char2twemojiFilePath, char2fluentEmojiFilePath } from '@@/js/emoji-base.js';
@@ -63,7 +64,7 @@ import { prefer } from '@/preferences.js';
export type CompleteInfo = {
user: {
payload: any;
payload: Misskey.entities.User;
query: string | null;
},
hashtag: {
@@ -185,9 +186,9 @@ const suggests = ref<Element>();
const rootEl = useTemplateRef('rootEl');
const fetching = ref(true);
const users = ref<any[]>([]);
const hashtags = ref<any[]>([]);
const emojis = ref<(EmojiDef)[]>([]);
const users = ref<Misskey.entities.User[]>([]);
const hashtags = ref<string[]>([]);
const emojis = ref<EmojiDef[]>([]);
const items = ref<Element[] | HTMLCollection>([]);
const mfmTags = ref<string[]>([]);
const mfmParams = ref<string[]>([]);
@@ -204,8 +205,8 @@ function complete<T extends keyof CompleteInfo>(type: T, value: CompleteInfo[T][
emit('closed');
if (type === 'emoji' || type === 'emojiComplete') {
let recents = store.s.recentlyUsedEmojis;
recents = recents.filter((emoji: any) => emoji !== value);
recents.unshift(value);
recents = recents.filter((emoji) => emoji !== value);
recents.unshift(value as string);
store.set('recentlyUsedEmojis', recents.splice(0, 32));
}
}
@@ -254,7 +255,7 @@ function exec() {
limit: 10,
detail: false,
}).then(searchedUsers => {
users.value = searchedUsers as any[];
users.value = searchedUsers;
fetching.value = false;
// キャッシュ
sessionStorage.setItem(cacheKey, JSON.stringify(searchedUsers));
@@ -276,7 +277,7 @@ function exec() {
query: props.q,
limit: 30,
}).then(searchedHashtags => {
hashtags.value = searchedHashtags as any[];
hashtags.value = searchedHashtags;
fetching.value = false;
// キャッシュ
sessionStorage.setItem(cacheKey, JSON.stringify(searchedHashtags));

View File

@@ -45,7 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #key>{{ i18n.ts.permission }}</template>
<template #value>
<ul v-if="extension.meta.permissions && extension.meta.permissions.length > 0" :class="$style.extInstallerKVList">
<li v-for="permission in extension.meta.permissions" :key="permission">{{ (i18n.ts._permissions as any)[permission] ?? permission }}</li>
<li v-for="permission in extension.meta.permissions" :key="permission">{{ i18n.ts._permissions[permission] ?? permission }}</li>
</ul>
<template v-else>{{ i18n.ts.none }}</template>
</template>
@@ -91,7 +91,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkFolder>
</div>
<slot name="additionalInfo"/>
<slot name="additionalInfo"></slot>
<div class="_buttonsCenter">
<MkButton danger rounded large @click="emits('cancel')"><i class="ti ti-x"></i> {{ i18n.ts.cancel }}</MkButton>
@@ -101,6 +101,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts">
import * as Misskey from 'misskey-js';
export type Extension = {
type: 'plugin';
raw: string;
@@ -109,7 +111,7 @@ export type Extension = {
version: string;
author: string;
description?: string;
permissions?: string[];
permissions?: (typeof Misskey.permissions)[number][];
config?: Record<string, unknown>;
};
} | {
@@ -125,7 +127,6 @@ export type Extension = {
<script lang="ts" setup>
import { computed } from 'vue';
import MkButton from '@/components/MkButton.vue';
import FormSection from '@/components/form/section.vue';
import FormSplit from '@/components/form/split.vue';
import MkCode from '@/components/MkCode.vue';
import MkInfo from '@/components/MkInfo.vue';

View File

@@ -121,7 +121,7 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ notification.invitation.room.name }}
</div>
<MkA v-else-if="notification.type === 'achievementEarned'" :class="$style.text" to="/my/achievements">
{{ (i18n.ts._achievements._types as any)['_' + notification.achievement].title }}
{{ i18n.ts._achievements._types[`_${notification.achievement}`].title }}
</MkA>
<MkA v-else-if="notification.type === 'exportCompleted'" :class="$style.text" :to="`/my/drive/file/${notification.fileId}`">
{{ i18n.ts.showFile }}

View File

@@ -144,7 +144,7 @@ async function unsubscribe() {
}
function encode(buffer: ArrayBuffer | null) {
return btoa(String.fromCharCode.apply(null, buffer ? new Uint8Array(buffer) as any : []));
return btoa(String.fromCharCode(...(buffer != null ? new Uint8Array(buffer) : [])));
}
/**

View File

@@ -10,6 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { onMounted, useTemplateRef } from 'vue';
import { Chart } from 'chart.js';
import type { ScatterDataPoint } from 'chart.js';
import tinycolor from 'tinycolor2';
import { store } from '@/store.js';
import { useChartTooltip } from '@/composables/use-chart-tooltip.js';
@@ -18,6 +19,12 @@ import { alpha } from '@/utility/color.js';
import { initChart } from '@/utility/init-chart.js';
import { misskeyApi } from '@/utility/misskey-api.js';
interface RetentionPoint extends ScatterDataPoint {
x: number;
y: number;
d: string;
}
initChart();
const chartEl = useTemplateRef('chartEl');
@@ -62,14 +69,14 @@ onMounted(async () => {
fill: false,
tension: 0.4,
data: [{
x: '0',
x: 0,
y: 100,
d: getYYYYMMDD(new Date(record.createdAt)),
}, ...Object.entries(record.data).sort((a, b) => getDate(a[0]) > getDate(b[0]) ? 1 : -1).map(([k, v], i) => ({
x: (i + 1).toString(),
x: i + 1,
y: (v / record.users) * 100,
d: getYYYYMMDD(new Date(record.createdAt)),
}))] as any,
}))],
})),
},
options: {
@@ -111,11 +118,11 @@ onMounted(async () => {
enabled: false,
callbacks: {
title(context) {
const v = context[0].dataset.data[context[0].dataIndex] as unknown as { x: string, y: number, d: string };
const v = context[0].dataset.data[context[0].dataIndex] as RetentionPoint;
return `${v.x} days later`;
},
label(context) {
const v = context.dataset.data[context.dataIndex] as unknown as { x: string, y: number, d: string };
const v = context.dataset.data[context.dataIndex] as RetentionPoint;
const p = Math.round(v.y) + '%';
return `${v.d} ${p}`;
},

View File

@@ -245,7 +245,7 @@ const serverSettings = computed<Misskey.entities.AdminUpdateMetaRequest>(() => {
enableReactionsBuffering,
clientOptions: {
entrancePageStyle: q_use.value === 'open' ? 'classic' : 'simple',
} as any,
},
};
});

View File

@@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
@ok="save()"
@closed="emit('closed')"
>
<template #header><i class="ti ti-icons"></i> {{ (i18n.ts._widgets as any)[widgetName] ?? widgetName }}</template>
<template #header><i class="ti ti-icons"></i> {{ i18n.ts._widgets[widgetName] ?? widgetName }}</template>
<MkPreviewWithControls>
<template #preview>
@@ -50,13 +50,14 @@ SPDX-License-Identifier: AGPL-3.0-only
import { useTemplateRef, ref, computed, onBeforeUnmount, onMounted } from 'vue';
import MkPreviewWithControls from './MkPreviewWithControls.vue';
import type { Form } from '@/utility/form.js';
import type { WidgetName } from '@/widgets/index.js';
import { deepClone } from '@/utility/clone.js';
import { i18n } from '@/i18n.js';
import MkModalWindow from '@/components/MkModalWindow.vue';
import MkForm from '@/components/MkForm.vue';
const props = defineProps<{
widgetName: string;
widgetName: WidgetName;
form: Form;
currentSettings: Record<string, any>;
}>();

View File

@@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template>
<span :class="$style.container">
<span ref="content" :class="$style.content" :style="{ maxWidth: `${100 / minScale}%` }">
<slot/>
<slot></slot>
</span>
</span>
</template>