diff options
| author | zyoshoka <107108195+zyoshoka@users.noreply.github.com> | 2023-12-07 14:42:09 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-07 14:42:09 +0900 |
| commit | 406b4bdbe79b5b0b68fcdcb3c4b6e419460a0258 (patch) | |
| tree | a1af1cc6102d2db40a687bc848c07cce35bd414f /packages/frontend/src/ui/deck | |
| parent | feat: Roleに関するSchemaを追加 (#12572) (diff) | |
| download | misskey-406b4bdbe79b5b0b68fcdcb3c4b6e419460a0258.tar.gz misskey-406b4bdbe79b5b0b68fcdcb3c4b6e419460a0258.tar.bz2 misskey-406b4bdbe79b5b0b68fcdcb3c4b6e419460a0258.zip | |
refactor(frontend): 非推奨となったReactivity Transformを使わないように (#12539)
* refactor(frontend): 非推奨となったReactivity Transformを使わないように
* refactor: 不要な括弧を除去
* fix: 不要なアノテーションを除去
* fix: Refの配列をrefしている部分の対応
* refactor: 不要な括弧を除去
* fix: lint
* refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換
* fix: type error
* chore: drop reactivity transform from eslint configuration
* refactor: remove unnecessary import
* fix: 対応漏れ
Diffstat (limited to 'packages/frontend/src/ui/deck')
| -rw-r--r-- | packages/frontend/src/ui/deck/antenna-column.vue | 4 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/channel-column.vue | 11 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/column.vue | 36 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/direct-column.vue | 6 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/list-column.vue | 10 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/main-column.vue | 6 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/mentions-column.vue | 6 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/notifications-column.vue | 4 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/role-timeline-column.vue | 4 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/tl-column.vue | 30 | ||||
| -rw-r--r-- | packages/frontend/src/ui/deck/widgets-column.vue | 6 |
11 files changed, 62 insertions, 61 deletions
diff --git a/packages/frontend/src/ui/deck/antenna-column.vue b/packages/frontend/src/ui/deck/antenna-column.vue index 1f4600d949..fe4d2a809c 100644 --- a/packages/frontend/src/ui/deck/antenna-column.vue +++ b/packages/frontend/src/ui/deck/antenna-column.vue @@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { onMounted } from 'vue'; +import { onMounted, shallowRef } from 'vue'; import XColumn from './column.vue'; import { updateColumn, Column } from './deck-store.js'; import MkTimeline from '@/components/MkTimeline.vue'; @@ -26,7 +26,7 @@ const props = defineProps<{ isStacked: boolean; }>(); -let timeline = $shallowRef<InstanceType<typeof MkTimeline>>(); +const timeline = shallowRef<InstanceType<typeof MkTimeline>>(); onMounted(() => { if (props.column.antennaId == null) { diff --git a/packages/frontend/src/ui/deck/channel-column.vue b/packages/frontend/src/ui/deck/channel-column.vue index d2d279e5d7..de5d94b4f7 100644 --- a/packages/frontend/src/ui/deck/channel-column.vue +++ b/packages/frontend/src/ui/deck/channel-column.vue @@ -19,6 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> +import { shallowRef } from 'vue'; import * as Misskey from 'misskey-js'; import XColumn from './column.vue'; import { updateColumn, Column } from './deck-store.js'; @@ -32,8 +33,8 @@ const props = defineProps<{ isStacked: boolean; }>(); -let timeline = $shallowRef<InstanceType<typeof MkTimeline>>(); -let channel = $shallowRef<Misskey.entities.Channel>(); +const timeline = shallowRef<InstanceType<typeof MkTimeline>>(); +const channel = shallowRef<Misskey.entities.Channel>(); if (props.column.channelId == null) { setChannel(); @@ -58,14 +59,14 @@ async function setChannel() { } async function post() { - if (!channel || channel.id !== props.column.channelId) { - channel = await os.api('channels/show', { + if (!channel.value || channel.value.id !== props.column.channelId) { + channel.value = await os.api('channels/show', { channelId: props.column.channelId, }); } os.post({ - channel, + channel: channel.value, }); } diff --git a/packages/frontend/src/ui/deck/column.vue b/packages/frontend/src/ui/deck/column.vue index 1a6b833b45..39a0279dea 100644 --- a/packages/frontend/src/ui/deck/column.vue +++ b/packages/frontend/src/ui/deck/column.vue @@ -42,7 +42,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { onBeforeUnmount, onMounted, provide, watch } from 'vue'; +import { onBeforeUnmount, onMounted, provide, watch, shallowRef, ref, computed } from 'vue'; import { updateColumn, swapLeftColumn, swapRightColumn, swapUpColumn, swapDownColumn, stackLeftColumn, popRightColumn, removeColumn, swapColumn, Column } from './deck-store'; import * as os from '@/os.js'; import { i18n } from '@/i18n.js'; @@ -67,16 +67,16 @@ const emit = defineEmits<{ (ev: 'headerWheel', ctx: WheelEvent): void; }>(); -let body = $shallowRef<HTMLDivElement | null>(); +const body = shallowRef<HTMLDivElement | null>(); -let dragging = $ref(false); -watch($$(dragging), v => os.deckGlobalEvents.emit(v ? 'column.dragStart' : 'column.dragEnd')); +const dragging = ref(false); +watch(dragging, v => os.deckGlobalEvents.emit(v ? 'column.dragStart' : 'column.dragEnd')); -let draghover = $ref(false); -let dropready = $ref(false); +const draghover = ref(false); +const dropready = ref(false); -const isMainColumn = $computed(() => props.column.type === 'main'); -const active = $computed(() => props.column.active !== false); +const isMainColumn = computed(() => props.column.type === 'main'); +const active = computed(() => props.column.active !== false); onMounted(() => { os.deckGlobalEvents.on('column.dragStart', onOtherDragStart); @@ -89,11 +89,11 @@ onBeforeUnmount(() => { }); function onOtherDragStart() { - dropready = true; + dropready.value = true; } function onOtherDragEnd() { - dropready = false; + dropready.value = false; } function toggleActive() { @@ -208,8 +208,8 @@ function onContextmenu(ev: MouseEvent) { } function goTop() { - if (body) { - body.scrollTo({ + if (body.value) { + body.value.scrollTo({ top: 0, behavior: 'smooth', }); @@ -223,17 +223,17 @@ function onDragstart(ev) { // Chromeのバグで、Dragstartハンドラ内ですぐにDOMを変更する(=リアクティブなプロパティを変更する)とDragが終了してしまう // SEE: https://stackoverflow.com/questions/19639969/html5-dragend-event-firing-immediately window.setTimeout(() => { - dragging = true; + dragging.value = true; }, 10); } function onDragend(ev) { - dragging = false; + dragging.value = false; } function onDragover(ev) { // 自分自身がドラッグされている場合 - if (dragging) { + if (dragging.value) { // 自分自身にはドロップさせない ev.dataTransfer.dropEffect = 'none'; } else { @@ -241,16 +241,16 @@ function onDragover(ev) { ev.dataTransfer.dropEffect = isDeckColumn ? 'move' : 'none'; - if (isDeckColumn) draghover = true; + if (isDeckColumn) draghover.value = true; } } function onDragleave() { - draghover = false; + draghover.value = false; } function onDrop(ev) { - draghover = false; + draghover.value = false; os.deckGlobalEvents.emit('column.dragEnd'); const id = ev.dataTransfer.getData(_DATA_TRANSFER_DECK_COLUMN_); diff --git a/packages/frontend/src/ui/deck/direct-column.vue b/packages/frontend/src/ui/deck/direct-column.vue index 40c33ebdfc..fd08623462 100644 --- a/packages/frontend/src/ui/deck/direct-column.vue +++ b/packages/frontend/src/ui/deck/direct-column.vue @@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { } from 'vue'; +import { ref } from 'vue'; import XColumn from './column.vue'; import { Column } from './deck-store.js'; import MkNotes from '@/components/MkNotes.vue'; @@ -30,11 +30,11 @@ const pagination = { }, }; -const tlComponent: InstanceType<typeof MkNotes> = $ref(); +const tlComponent = ref<InstanceType<typeof MkNotes>>(); function reloadTimeline() { return new Promise<void>((res) => { - tlComponent.pagingComponent?.reload().then(() => { + tlComponent.value.pagingComponent?.reload().then(() => { res(); }); }); diff --git a/packages/frontend/src/ui/deck/list-column.vue b/packages/frontend/src/ui/deck/list-column.vue index 40e4dcee7e..854c8d453b 100644 --- a/packages/frontend/src/ui/deck/list-column.vue +++ b/packages/frontend/src/ui/deck/list-column.vue @@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { watch } from 'vue'; +import { watch, shallowRef, ref } from 'vue'; import XColumn from './column.vue'; import { updateColumn, Column } from './deck-store'; import MkTimeline from '@/components/MkTimeline.vue'; @@ -26,14 +26,14 @@ const props = defineProps<{ isStacked: boolean; }>(); -let timeline = $shallowRef<InstanceType<typeof MkTimeline>>(); -const withRenotes = $ref(props.column.withRenotes ?? true); +const timeline = shallowRef<InstanceType<typeof MkTimeline>>(); +const withRenotes = ref(props.column.withRenotes ?? true); if (props.column.listId == null) { setList(); } -watch($$(withRenotes), v => { +watch(withRenotes, v => { updateColumn(props.column.id, { withRenotes: v, }); @@ -72,7 +72,7 @@ const menu = [ { type: 'switch', text: i18n.ts.showRenotes, - ref: $$(withRenotes), + ref: withRenotes, }, ]; </script> diff --git a/packages/frontend/src/ui/deck/main-column.vue b/packages/frontend/src/ui/deck/main-column.vue index d54368c932..0c52957ec4 100644 --- a/packages/frontend/src/ui/deck/main-column.vue +++ b/packages/frontend/src/ui/deck/main-column.vue @@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { ComputedRef, provide, shallowRef } from 'vue'; +import { ComputedRef, provide, shallowRef, ref } from 'vue'; import XColumn from './column.vue'; import { deckStore, Column } from '@/ui/deck/deck-store.js'; import * as os from '@/os.js'; @@ -35,11 +35,11 @@ defineProps<{ }>(); const contents = shallowRef<HTMLElement>(); -let pageMetadata = $ref<null | ComputedRef<PageMetadata>>(); +const pageMetadata = ref<null | ComputedRef<PageMetadata>>(); provide('router', mainRouter); provideMetadataReceiver((info) => { - pageMetadata = info; + pageMetadata.value = info; }); /* diff --git a/packages/frontend/src/ui/deck/mentions-column.vue b/packages/frontend/src/ui/deck/mentions-column.vue index fc67fa144d..b011ba3ca2 100644 --- a/packages/frontend/src/ui/deck/mentions-column.vue +++ b/packages/frontend/src/ui/deck/mentions-column.vue @@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { } from 'vue'; +import { ref } from 'vue'; import XColumn from './column.vue'; import { Column } from './deck-store.js'; import MkNotes from '@/components/MkNotes.vue'; @@ -22,11 +22,11 @@ defineProps<{ isStacked: boolean; }>(); -const tlComponent: InstanceType<typeof MkNotes> = $ref(); +const tlComponent = ref<InstanceType<typeof MkNotes>>(); function reloadTimeline() { return new Promise<void>((res) => { - tlComponent.pagingComponent?.reload().then(() => { + tlComponent.value.pagingComponent?.reload().then(() => { res(); }); }); diff --git a/packages/frontend/src/ui/deck/notifications-column.vue b/packages/frontend/src/ui/deck/notifications-column.vue index 770e8ea820..e6729b4d58 100644 --- a/packages/frontend/src/ui/deck/notifications-column.vue +++ b/packages/frontend/src/ui/deck/notifications-column.vue @@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { defineAsyncComponent } from 'vue'; +import { defineAsyncComponent, shallowRef } from 'vue'; import XColumn from './column.vue'; import { updateColumn, Column } from './deck-store.js'; import XNotifications from '@/components/MkNotifications.vue'; @@ -24,7 +24,7 @@ const props = defineProps<{ isStacked: boolean; }>(); -let notificationsComponent = $shallowRef<InstanceType<typeof XNotifications>>(); +const notificationsComponent = shallowRef<InstanceType<typeof XNotifications>>(); function func() { os.popup(defineAsyncComponent(() => import('@/components/MkNotificationSelectWindow.vue')), { diff --git a/packages/frontend/src/ui/deck/role-timeline-column.vue b/packages/frontend/src/ui/deck/role-timeline-column.vue index 86d8878820..d9bcf8d95e 100644 --- a/packages/frontend/src/ui/deck/role-timeline-column.vue +++ b/packages/frontend/src/ui/deck/role-timeline-column.vue @@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { onMounted } from 'vue'; +import { onMounted, shallowRef } from 'vue'; import XColumn from './column.vue'; import { updateColumn, Column } from './deck-store.js'; import MkTimeline from '@/components/MkTimeline.vue'; @@ -26,7 +26,7 @@ const props = defineProps<{ isStacked: boolean; }>(); -let timeline = $shallowRef<InstanceType<typeof MkTimeline>>(); +const timeline = shallowRef<InstanceType<typeof MkTimeline>>(); onMounted(() => { if (props.column.roleId == null) { diff --git a/packages/frontend/src/ui/deck/tl-column.vue b/packages/frontend/src/ui/deck/tl-column.vue index 41582bbfe3..7ed0f56d02 100644 --- a/packages/frontend/src/ui/deck/tl-column.vue +++ b/packages/frontend/src/ui/deck/tl-column.vue @@ -33,7 +33,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { onMounted, watch } from 'vue'; +import { onMounted, watch, ref, shallowRef } from 'vue'; import XColumn from './column.vue'; import { removeColumn, updateColumn, Column } from './deck-store.js'; import MkTimeline from '@/components/MkTimeline.vue'; @@ -47,28 +47,28 @@ const props = defineProps<{ isStacked: boolean; }>(); -let disabled = $ref(false); -let timeline = $shallowRef<InstanceType<typeof MkTimeline>>(); +const disabled = ref(false); +const timeline = shallowRef<InstanceType<typeof MkTimeline>>(); const isLocalTimelineAvailable = (($i == null && instance.policies.ltlAvailable) || ($i != null && $i.policies.ltlAvailable)); const isGlobalTimelineAvailable = (($i == null && instance.policies.gtlAvailable) || ($i != null && $i.policies.gtlAvailable)); -const withRenotes = $ref(props.column.withRenotes ?? true); -const withReplies = $ref(props.column.withReplies ?? false); -const onlyFiles = $ref(props.column.onlyFiles ?? false); +const withRenotes = ref(props.column.withRenotes ?? true); +const withReplies = ref(props.column.withReplies ?? false); +const onlyFiles = ref(props.column.onlyFiles ?? false); -watch($$(withRenotes), v => { +watch(withRenotes, v => { updateColumn(props.column.id, { withRenotes: v, }); }); -watch($$(withReplies), v => { +watch(withReplies, v => { updateColumn(props.column.id, { withReplies: v, }); }); -watch($$(onlyFiles), v => { +watch(onlyFiles, v => { updateColumn(props.column.id, { onlyFiles: v, }); @@ -78,7 +78,7 @@ onMounted(() => { if (props.column.tl == null) { setType(); } else if ($i) { - disabled = ( + disabled.value = ( (!((instance.policies.ltlAvailable) || ($i.policies.ltlAvailable)) && ['local', 'social'].includes(props.column.tl)) || (!((instance.policies.gtlAvailable) || ($i.policies.gtlAvailable)) && ['global'].includes(props.column.tl))); } @@ -115,17 +115,17 @@ const menu = [{ }, { type: 'switch', text: i18n.ts.showRenotes, - ref: $$(withRenotes), + ref: withRenotes, }, props.column.tl === 'local' || props.column.tl === 'social' ? { type: 'switch', text: i18n.ts.showRepliesToOthersInTimeline, - ref: $$(withReplies), - disabled: $$(onlyFiles), + ref: withReplies, + disabled: onlyFiles, } : undefined, { type: 'switch', text: i18n.ts.fileAttachedOnly, - ref: $$(onlyFiles), - disabled: props.column.tl === 'local' || props.column.tl === 'social' ? $$(withReplies) : false, + ref: onlyFiles, + disabled: props.column.tl === 'local' || props.column.tl === 'social' ? withReplies : false, }]; </script> diff --git a/packages/frontend/src/ui/deck/widgets-column.vue b/packages/frontend/src/ui/deck/widgets-column.vue index 5bd6d73976..ef35d885f3 100644 --- a/packages/frontend/src/ui/deck/widgets-column.vue +++ b/packages/frontend/src/ui/deck/widgets-column.vue @@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only </template> <script lang="ts" setup> -import { } from 'vue'; +import { ref } from 'vue'; import XColumn from './column.vue'; import { addColumnWidget, Column, removeColumnWidget, setColumnWidgets, updateColumnWidget } from './deck-store.js'; import XWidgets from '@/components/MkWidgets.vue'; @@ -26,7 +26,7 @@ const props = defineProps<{ isStacked: boolean; }>(); -let edit = $ref(false); +const edit = ref(false); function addWidget(widget) { addColumnWidget(props.column.id, widget); @@ -45,7 +45,7 @@ function updateWidgets(widgets) { } function func() { - edit = !edit; + edit.value = !edit.value; } const menu = [{ |