summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts
diff options
context:
space:
mode:
authormisskey-release-bot[bot] <157398866+misskey-release-bot[bot]@users.noreply.github.com>2025-02-27 08:58:43 +0000
committerGitHub <noreply@github.com>2025-02-27 08:58:43 +0000
commita5f28c21e47030a9202de9ccf87556c5bebd7129 (patch)
treebd161b9620622d5bdc0d0a6a48dad7eda95c931d /packages/frontend/src/scripts
parentMerge pull request #15378 from misskey-dev/develop (diff)
parentRelease: 2025.2.1 (diff)
downloadmisskey-a5f28c21e47030a9202de9ccf87556c5bebd7129.tar.gz
misskey-a5f28c21e47030a9202de9ccf87556c5bebd7129.tar.bz2
misskey-a5f28c21e47030a9202de9ccf87556c5bebd7129.zip
Merge pull request #15507 from misskey-dev/develop
Release: 2025.2.1
Diffstat (limited to 'packages/frontend/src/scripts')
-rw-r--r--packages/frontend/src/scripts/aiscript/api.ts2
-rw-r--r--packages/frontend/src/scripts/aiscript/common.ts3
-rw-r--r--packages/frontend/src/scripts/aiscript/ui.ts3
-rw-r--r--packages/frontend/src/scripts/autocomplete.ts15
-rw-r--r--packages/frontend/src/scripts/chart-legend.ts2
-rw-r--r--packages/frontend/src/scripts/chart-vline.ts2
-rw-r--r--packages/frontend/src/scripts/check-reaction-permissions.ts2
-rw-r--r--packages/frontend/src/scripts/emoji-picker.ts3
-rw-r--r--packages/frontend/src/scripts/file-drop.ts2
-rw-r--r--packages/frontend/src/scripts/format-time-string.ts2
-rw-r--r--packages/frontend/src/scripts/gen-search-query.ts35
-rw-r--r--packages/frontend/src/scripts/get-note-menu.ts3
-rw-r--r--packages/frontend/src/scripts/get-user-menu.ts2
-rw-r--r--packages/frontend/src/scripts/install-theme.ts3
-rw-r--r--packages/frontend/src/scripts/key-event.ts14
-rw-r--r--packages/frontend/src/scripts/lookup.ts4
-rw-r--r--packages/frontend/src/scripts/mfm-function-picker.ts3
-rw-r--r--packages/frontend/src/scripts/page-metadata.ts3
-rw-r--r--packages/frontend/src/scripts/reaction-picker.ts3
-rw-r--r--packages/frontend/src/scripts/stream-mock.ts6
-rw-r--r--packages/frontend/src/scripts/theme-editor.ts3
-rw-r--r--packages/frontend/src/scripts/use-form.ts3
-rw-r--r--packages/frontend/src/scripts/use-leave-guard.ts2
-rw-r--r--packages/frontend/src/scripts/use-note-capture.ts3
-rw-r--r--packages/frontend/src/scripts/use-tooltip.ts3
25 files changed, 53 insertions, 73 deletions
diff --git a/packages/frontend/src/scripts/aiscript/api.ts b/packages/frontend/src/scripts/aiscript/api.ts
index e203c51bba..2c0c8c816e 100644
--- a/packages/frontend/src/scripts/aiscript/api.ts
+++ b/packages/frontend/src/scripts/aiscript/api.ts
@@ -76,7 +76,7 @@ export function createAiScriptEnv(opts: { storageKey: string, token?: string })
// バグがあればundefinedもあり得るため念のため
if (typeof token.value !== 'string') throw new Error('invalid token');
}
- const actualToken: string|null = token?.value ?? opts.token ?? null;
+ const actualToken: string | null = token?.value ?? opts.token ?? null;
if (param == null) {
throw new errors.AiScriptRuntimeError('expected param');
}
diff --git a/packages/frontend/src/scripts/aiscript/common.ts b/packages/frontend/src/scripts/aiscript/common.ts
index de6fa1d633..ba5dfb8368 100644
--- a/packages/frontend/src/scripts/aiscript/common.ts
+++ b/packages/frontend/src/scripts/aiscript/common.ts
@@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { errors, utils, type values } from '@syuilo/aiscript';
+import { errors, utils } from '@syuilo/aiscript';
+import type { values } from '@syuilo/aiscript';
export function assertStringAndIsIn<A extends readonly string[]>(value: values.Value | undefined, expects: A): asserts value is values.VStr & { value: A[number] } {
utils.assertString(value);
diff --git a/packages/frontend/src/scripts/aiscript/ui.ts b/packages/frontend/src/scripts/aiscript/ui.ts
index ca92b27ff5..46e193f7c1 100644
--- a/packages/frontend/src/scripts/aiscript/ui.ts
+++ b/packages/frontend/src/scripts/aiscript/ui.ts
@@ -5,7 +5,8 @@
import { utils, values } from '@syuilo/aiscript';
import { v4 as uuid } from 'uuid';
-import { ref, Ref } from 'vue';
+import { ref } from 'vue';
+import type { Ref } from 'vue';
import * as Misskey from 'misskey-js';
import { assertStringAndIsIn } from './common.js';
diff --git a/packages/frontend/src/scripts/autocomplete.ts b/packages/frontend/src/scripts/autocomplete.ts
index 7766c44c04..9a603b848c 100644
--- a/packages/frontend/src/scripts/autocomplete.ts
+++ b/packages/frontend/src/scripts/autocomplete.ts
@@ -3,9 +3,10 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { nextTick, Ref, ref, defineAsyncComponent } from 'vue';
+import { nextTick, ref, defineAsyncComponent } from 'vue';
import getCaretCoordinates from 'textarea-caret';
import { toASCII } from 'punycode.js';
+import type { Ref } from 'vue';
import { popup } from '@/os.js';
export type SuggestionType = 'user' | 'hashtag' | 'emoji' | 'mfmTag' | 'mfmParam';
@@ -97,15 +98,21 @@ export class Autocomplete {
const isMention = mentionIndex !== -1;
const isHashtag = hashtagIndex !== -1;
- const isMfmParam = mfmParamIndex !== -1 && afterLastMfmParam?.includes('.') && !afterLastMfmParam?.includes(' ');
+ const isMfmParam = mfmParamIndex !== -1 && afterLastMfmParam?.includes('.') && !afterLastMfmParam.includes(' ');
const isMfmTag = mfmTagIndex !== -1 && !isMfmParam;
const isEmoji = emojiIndex !== -1 && text.split(/:[a-z0-9_+\-]+:/).pop()!.includes(':');
let opened = false;
if (isMention && this.onlyType.includes('user')) {
- const username = text.substring(mentionIndex + 1);
- if (username !== '' && username.match(/^[a-zA-Z0-9_]+$/)) {
+ // ユーザのサジェスト中に@を入力すると、その位置から新たにユーザ名を取りなおそうとしてしまう
+ // この動きはリモートユーザのサジェストを阻害するので、@を検知したらその位置よりも前の@を探し、
+ // ホスト名を含むリモートのユーザ名を全て拾えるようにする
+ const mentionIndexAlt = text.lastIndexOf('@', mentionIndex - 1);
+ const username = mentionIndexAlt === -1
+ ? text.substring(mentionIndex + 1)
+ : text.substring(mentionIndexAlt + 1);
+ if (username !== '' && username.match(/^[a-zA-Z0-9_@.]+$/)) {
this.open('user', username);
opened = true;
} else if (username === '') {
diff --git a/packages/frontend/src/scripts/chart-legend.ts b/packages/frontend/src/scripts/chart-legend.ts
index 2d534f60c1..e701d18dd2 100644
--- a/packages/frontend/src/scripts/chart-legend.ts
+++ b/packages/frontend/src/scripts/chart-legend.ts
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { Plugin } from 'chart.js';
+import type { Plugin } from 'chart.js';
import MkChartLegend from '@/components/MkChartLegend.vue';
export const chartLegend = (legend: InstanceType<typeof MkChartLegend>) => ({
diff --git a/packages/frontend/src/scripts/chart-vline.ts b/packages/frontend/src/scripts/chart-vline.ts
index 24e41245e7..465ca591c6 100644
--- a/packages/frontend/src/scripts/chart-vline.ts
+++ b/packages/frontend/src/scripts/chart-vline.ts
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { Plugin } from 'chart.js';
+import type { Plugin } from 'chart.js';
export const chartVLine = (vLineColor: string) => ({
id: 'vLine',
diff --git a/packages/frontend/src/scripts/check-reaction-permissions.ts b/packages/frontend/src/scripts/check-reaction-permissions.ts
index c3c3f419a9..281ea2520e 100644
--- a/packages/frontend/src/scripts/check-reaction-permissions.ts
+++ b/packages/frontend/src/scripts/check-reaction-permissions.ts
@@ -4,7 +4,7 @@
*/
import * as Misskey from 'misskey-js';
-import { UnicodeEmojiDef } from '@@/js/emojilist.js';
+import type { UnicodeEmojiDef } from '@@/js/emojilist.js';
export function checkReactionPermissions(me: Misskey.entities.MeDetailed, note: Misskey.entities.Note, emoji: Misskey.entities.EmojiSimple | UnicodeEmojiDef | string): boolean {
if (typeof emoji === 'string') return true; // UnicodeEmojiDefにも無い絵文字であれば文字列で来る。Unicode絵文字であることには変わりないので常にリアクション可能とする;
diff --git a/packages/frontend/src/scripts/emoji-picker.ts b/packages/frontend/src/scripts/emoji-picker.ts
index 14b5cbf35e..e704b5fd6f 100644
--- a/packages/frontend/src/scripts/emoji-picker.ts
+++ b/packages/frontend/src/scripts/emoji-picker.ts
@@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { defineAsyncComponent, Ref, ref } from 'vue';
+import { defineAsyncComponent, ref } from 'vue';
+import type { Ref } from 'vue';
import { popup } from '@/os.js';
import { defaultStore } from '@/store.js';
diff --git a/packages/frontend/src/scripts/file-drop.ts b/packages/frontend/src/scripts/file-drop.ts
index c2e863c0dc..4259fe25e9 100644
--- a/packages/frontend/src/scripts/file-drop.ts
+++ b/packages/frontend/src/scripts/file-drop.ts
@@ -15,7 +15,7 @@ export type DroppedDirectory = {
isFile: false;
path: string;
children: DroppedItem[];
-}
+};
export async function extractDroppedItems(ev: DragEvent): Promise<DroppedItem[]> {
const dropItems = ev.dataTransfer?.items;
diff --git a/packages/frontend/src/scripts/format-time-string.ts b/packages/frontend/src/scripts/format-time-string.ts
index 35ad77d982..d383f143e1 100644
--- a/packages/frontend/src/scripts/format-time-string.ts
+++ b/packages/frontend/src/scripts/format-time-string.ts
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-const defaultLocaleStringFormats: {[index: string]: string} = {
+const defaultLocaleStringFormats: { [index: string]: string } = {
'weekday': 'narrow',
'era': 'narrow',
'year': 'numeric',
diff --git a/packages/frontend/src/scripts/gen-search-query.ts b/packages/frontend/src/scripts/gen-search-query.ts
deleted file mode 100644
index a85ee01e26..0000000000
--- a/packages/frontend/src/scripts/gen-search-query.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * SPDX-FileCopyrightText: syuilo and misskey-project
- * SPDX-License-Identifier: AGPL-3.0-only
- */
-
-import * as Misskey from 'misskey-js';
-import { host as localHost } from '@@/js/config.js';
-
-export async function genSearchQuery(v: any, q: string) {
- let host: string;
- let userId: string;
- if (q.split(' ').some(x => x.startsWith('@'))) {
- for (const at of q.split(' ').filter(x => x.startsWith('@')).map(x => x.substring(1))) {
- if (at.includes('.')) {
- if (at === localHost || at === '.') {
- host = null;
- } else {
- host = at;
- }
- } else {
- const user = await v.api('users/show', Misskey.acct.parse(at)).catch(x => null);
- if (user) {
- userId = user.id;
- } else {
- // todo: show error
- }
- }
- }
- }
- return {
- query: q.split(' ').filter(x => !x.startsWith('/') && !x.startsWith('@')).join(' '),
- host: host,
- userId: userId,
- };
-}
diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts
index bc504077b0..23fe811525 100644
--- a/packages/frontend/src/scripts/get-note-menu.ts
+++ b/packages/frontend/src/scripts/get-note-menu.ts
@@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { defineAsyncComponent, Ref, ShallowRef } from 'vue';
+import { defineAsyncComponent } from 'vue';
+import type { Ref, ShallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import { url } from '@@/js/config.js';
import { claimAchievement } from './achievements.js';
diff --git a/packages/frontend/src/scripts/get-user-menu.ts b/packages/frontend/src/scripts/get-user-menu.ts
index 94a1d4c855..8f7c3ba3be 100644
--- a/packages/frontend/src/scripts/get-user-menu.ts
+++ b/packages/frontend/src/scripts/get-user-menu.ts
@@ -14,7 +14,7 @@ import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore, userActions } from '@/store.js';
import { $i, iAmModerator } from '@/account.js';
import { notesSearchAvailable, canSearchNonLocalNotes } from '@/scripts/check-permissions.js';
-import { IRouter } from '@/nirax.js';
+import type { IRouter } from '@/nirax.js';
import { antennasCache, rolesCache, userListsCache } from '@/cache.js';
import { mainRouter } from '@/router/main.js';
import { genEmbedCode } from '@/scripts/get-embed-code.js';
diff --git a/packages/frontend/src/scripts/install-theme.ts b/packages/frontend/src/scripts/install-theme.ts
index 866f1225bf..cc32adcc6a 100644
--- a/packages/frontend/src/scripts/install-theme.ts
+++ b/packages/frontend/src/scripts/install-theme.ts
@@ -5,7 +5,8 @@
import JSON5 from 'json5';
import { addTheme, getThemes } from '@/theme-store.js';
-import { Theme, applyTheme, validateTheme } from '@/scripts/theme.js';
+import { applyTheme, validateTheme } from '@/scripts/theme.js';
+import type { Theme } from '@/scripts/theme.js';
export function parseThemeCode(code: string): Theme {
let theme;
diff --git a/packages/frontend/src/scripts/key-event.ts b/packages/frontend/src/scripts/key-event.ts
index a72776d48c..020a6c2174 100644
--- a/packages/frontend/src/scripts/key-event.ts
+++ b/packages/frontend/src/scripts/key-event.ts
@@ -7,7 +7,7 @@
* {@link KeyboardEvent.code} の値を表す文字列。不足分は適宜追加する
* @see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_code_values
*/
-export type KeyCode =
+export type KeyCode = (
| 'Backspace'
| 'Tab'
| 'Enter'
@@ -94,32 +94,32 @@ export type KeyCode =
| 'Quote'
| 'Meta'
| 'AltGraph'
- ;
+);
/**
* 修飾キーを表す文字列。不足分は適宜追加する。
*/
-export type KeyModifier =
+export type KeyModifier = (
| 'Shift'
| 'Control'
| 'Alt'
| 'Meta'
- ;
+);
/**
* 押下されたキー以外の状態を表す文字列。不足分は適宜追加する。
*/
-export type KeyState =
+export type KeyState = (
| 'composing'
| 'repeat'
- ;
+);
export type KeyEventHandler = {
modifiers?: KeyModifier[];
states?: KeyState[];
code: KeyCode | 'any';
handler: (event: KeyboardEvent) => void;
-}
+};
export function handleKeyEvent(event: KeyboardEvent, handlers: KeyEventHandler[]) {
function checkModifier(ev: KeyboardEvent, modifiers? : KeyModifier[]) {
diff --git a/packages/frontend/src/scripts/lookup.ts b/packages/frontend/src/scripts/lookup.ts
index ddcbfe1a8d..8ee2a4b99c 100644
--- a/packages/frontend/src/scripts/lookup.ts
+++ b/packages/frontend/src/scripts/lookup.ts
@@ -54,10 +54,6 @@ export async function lookup(router?: Router) {
title = i18n.ts._remoteLookupErrors._responseInvalid.title;
text = i18n.ts._remoteLookupErrors._responseInvalid.description;
break;
- case 'a2c9c61a-cb72-43ab-a964-3ca5fddb410a':
- title = i18n.ts._remoteLookupErrors._responseInvalid.title;
- text = i18n.ts._remoteLookupErrors._responseInvalidIdHostNotMatch.description;
- break;
case 'dc94d745-1262-4e63-a17d-fecaa57efc82':
title = i18n.ts._remoteLookupErrors._noSuchObject.title;
text = i18n.ts._remoteLookupErrors._noSuchObject.description;
diff --git a/packages/frontend/src/scripts/mfm-function-picker.ts b/packages/frontend/src/scripts/mfm-function-picker.ts
index bf59fe98a0..a2f777f623 100644
--- a/packages/frontend/src/scripts/mfm-function-picker.ts
+++ b/packages/frontend/src/scripts/mfm-function-picker.ts
@@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { Ref, nextTick } from 'vue';
+import { nextTick } from 'vue';
+import type { Ref } from 'vue';
import * as os from '@/os.js';
import { i18n } from '@/i18n.js';
import { MFM_TAGS } from '@@/js/const.js';
diff --git a/packages/frontend/src/scripts/page-metadata.ts b/packages/frontend/src/scripts/page-metadata.ts
index 0e3b093ecf..671751147c 100644
--- a/packages/frontend/src/scripts/page-metadata.ts
+++ b/packages/frontend/src/scripts/page-metadata.ts
@@ -4,7 +4,8 @@
*/
import * as Misskey from 'misskey-js';
-import { MaybeRefOrGetter, Ref, inject, isRef, onActivated, onBeforeUnmount, provide, ref, toValue, watch } from 'vue';
+import { inject, isRef, onActivated, onBeforeUnmount, provide, ref, toValue, watch } from 'vue';
+import type { MaybeRefOrGetter, Ref } from 'vue';
export type PageMetadata = {
title: string;
diff --git a/packages/frontend/src/scripts/reaction-picker.ts b/packages/frontend/src/scripts/reaction-picker.ts
index 7aec05c0cf..c142b3ed2a 100644
--- a/packages/frontend/src/scripts/reaction-picker.ts
+++ b/packages/frontend/src/scripts/reaction-picker.ts
@@ -4,7 +4,8 @@
*/
import * as Misskey from 'misskey-js';
-import { defineAsyncComponent, Ref, ref } from 'vue';
+import { defineAsyncComponent, ref } from 'vue';
+import type { Ref } from 'vue';
import { popup } from '@/os.js';
import { defaultStore } from '@/store.js';
diff --git a/packages/frontend/src/scripts/stream-mock.ts b/packages/frontend/src/scripts/stream-mock.ts
index cb0e607fcb..9b1b368de4 100644
--- a/packages/frontend/src/scripts/stream-mock.ts
+++ b/packages/frontend/src/scripts/stream-mock.ts
@@ -37,9 +37,9 @@ export class StreamMock extends EventEmitter<StreamEvents> implements IStream {
// do nothing
}
- public send(typeOrPayload: string): void
- public send(typeOrPayload: string, payload: any): void
- public send(typeOrPayload: Record<string, any> | any[]): void
+ public send(typeOrPayload: string): void;
+ public send(typeOrPayload: string, payload: any): void;
+ public send(typeOrPayload: Record<string, any> | any[]): void;
public send(typeOrPayload: string | Record<string, any> | any[], payload?: any): void {
// do nothing
}
diff --git a/packages/frontend/src/scripts/theme-editor.ts b/packages/frontend/src/scripts/theme-editor.ts
index 0092af1640..0206e378bf 100644
--- a/packages/frontend/src/scripts/theme-editor.ts
+++ b/packages/frontend/src/scripts/theme-editor.ts
@@ -5,7 +5,8 @@
import { v4 as uuid } from 'uuid';
-import { themeProps, Theme } from './theme.js';
+import { themeProps } from './theme.js';
+import type { Theme } from './theme.js';
export type Default = null;
export type Color = string;
diff --git a/packages/frontend/src/scripts/use-form.ts b/packages/frontend/src/scripts/use-form.ts
index 0d505fe466..26cca839c3 100644
--- a/packages/frontend/src/scripts/use-form.ts
+++ b/packages/frontend/src/scripts/use-form.ts
@@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { computed, Reactive, reactive, watch } from 'vue';
+import { computed, reactive, watch } from 'vue';
+import type { Reactive } from 'vue';
function copy<T>(v: T): T {
return JSON.parse(JSON.stringify(v));
diff --git a/packages/frontend/src/scripts/use-leave-guard.ts b/packages/frontend/src/scripts/use-leave-guard.ts
index 5f7e56e8a9..395c12a756 100644
--- a/packages/frontend/src/scripts/use-leave-guard.ts
+++ b/packages/frontend/src/scripts/use-leave-guard.ts
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { Ref } from 'vue';
+import type { Ref } from 'vue';
export function useLeaveGuard(enabled: Ref<boolean>) {
/* TODO
diff --git a/packages/frontend/src/scripts/use-note-capture.ts b/packages/frontend/src/scripts/use-note-capture.ts
index 542d8ab52b..0bc10e90e4 100644
--- a/packages/frontend/src/scripts/use-note-capture.ts
+++ b/packages/frontend/src/scripts/use-note-capture.ts
@@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { onUnmounted, Ref, ShallowRef } from 'vue';
+import { onUnmounted } from 'vue';
+import type { Ref, ShallowRef } from 'vue';
import * as Misskey from 'misskey-js';
import { useStream } from '@/stream.js';
import { $i } from '@/account.js';
diff --git a/packages/frontend/src/scripts/use-tooltip.ts b/packages/frontend/src/scripts/use-tooltip.ts
index a26d08cce7..d9ddfc8b5d 100644
--- a/packages/frontend/src/scripts/use-tooltip.ts
+++ b/packages/frontend/src/scripts/use-tooltip.ts
@@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { Ref, ref, watch, onUnmounted } from 'vue';
+import { ref, watch, onUnmounted } from 'vue';
+import type { Ref } from 'vue';
export function useTooltip(
elRef: Ref<HTMLElement | { $el: HTMLElement } | null | undefined>,