summaryrefslogtreecommitdiff
path: root/packages/frontend/src/ui
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2023-12-07 14:42:09 +0900
committerGitHub <noreply@github.com>2023-12-07 14:42:09 +0900
commit406b4bdbe79b5b0b68fcdcb3c4b6e419460a0258 (patch)
treea1af1cc6102d2db40a687bc848c07cce35bd414f /packages/frontend/src/ui
parentfeat: Roleに関するSchemaを追加 (#12572) (diff)
downloadmisskey-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')
-rw-r--r--packages/frontend/src/ui/_common_/common.vue8
-rw-r--r--packages/frontend/src/ui/_common_/statusbar-federation.vue4
-rw-r--r--packages/frontend/src/ui/_common_/statusbar-rss.vue4
-rw-r--r--packages/frontend/src/ui/_common_/statusbar-user-list.vue4
-rw-r--r--packages/frontend/src/ui/_common_/stream-indicator.vue8
-rw-r--r--packages/frontend/src/ui/classic.header.vue12
-rw-r--r--packages/frontend/src/ui/classic.sidebar.vue16
-rw-r--r--packages/frontend/src/ui/classic.vue42
-rw-r--r--packages/frontend/src/ui/deck.vue6
-rw-r--r--packages/frontend/src/ui/deck/antenna-column.vue4
-rw-r--r--packages/frontend/src/ui/deck/channel-column.vue11
-rw-r--r--packages/frontend/src/ui/deck/column.vue36
-rw-r--r--packages/frontend/src/ui/deck/direct-column.vue6
-rw-r--r--packages/frontend/src/ui/deck/list-column.vue10
-rw-r--r--packages/frontend/src/ui/deck/main-column.vue6
-rw-r--r--packages/frontend/src/ui/deck/mentions-column.vue6
-rw-r--r--packages/frontend/src/ui/deck/notifications-column.vue4
-rw-r--r--packages/frontend/src/ui/deck/role-timeline-column.vue4
-rw-r--r--packages/frontend/src/ui/deck/tl-column.vue30
-rw-r--r--packages/frontend/src/ui/deck/widgets-column.vue6
-rw-r--r--packages/frontend/src/ui/minimum.vue10
-rw-r--r--packages/frontend/src/ui/universal.vue26
-rw-r--r--packages/frontend/src/ui/universal.widgets.vue6
-rw-r--r--packages/frontend/src/ui/visitor.vue32
-rw-r--r--packages/frontend/src/ui/zen.vue10
25 files changed, 156 insertions, 155 deletions
diff --git a/packages/frontend/src/ui/_common_/common.vue b/packages/frontend/src/ui/_common_/common.vue
index 7f8556d8d2..6b69e1accf 100644
--- a/packages/frontend/src/ui/_common_/common.vue
+++ b/packages/frontend/src/ui/_common_/common.vue
@@ -63,7 +63,7 @@ const XUpload = defineAsyncComponent(() => import('./upload.vue'));
const dev = _DEV_;
-let notifications = $ref<Misskey.entities.Notification[]>([]);
+const notifications = ref<Misskey.entities.Notification[]>([]);
function onNotification(notification: Misskey.entities.Notification, isClient = false) {
if (document.visibilityState === 'visible') {
@@ -72,13 +72,13 @@ function onNotification(notification: Misskey.entities.Notification, isClient =
useStream().send('readNotification');
}
- notifications.unshift(notification);
+ notifications.value.unshift(notification);
window.setTimeout(() => {
- if (notifications.length > 3) notifications.pop();
+ if (notifications.value.length > 3) notifications.value.pop();
}, 500);
window.setTimeout(() => {
- notifications = notifications.filter(x => x.id !== notification.id);
+ notifications.value = notifications.value.filter(x => x.id !== notification.id);
}, 6000);
}
diff --git a/packages/frontend/src/ui/_common_/statusbar-federation.vue b/packages/frontend/src/ui/_common_/statusbar-federation.vue
index a4ea916d23..c92695afed 100644
--- a/packages/frontend/src/ui/_common_/statusbar-federation.vue
+++ b/packages/frontend/src/ui/_common_/statusbar-federation.vue
@@ -49,7 +49,7 @@ const props = defineProps<{
const instances = ref<Misskey.entities.FederationInstance[]>([]);
const fetching = ref(true);
-let key = $ref(0);
+const key = ref(0);
const tick = () => {
os.api('federation/instances', {
@@ -58,7 +58,7 @@ const tick = () => {
}).then(res => {
instances.value = res;
fetching.value = false;
- key++;
+ key.value++;
});
};
diff --git a/packages/frontend/src/ui/_common_/statusbar-rss.vue b/packages/frontend/src/ui/_common_/statusbar-rss.vue
index c8e5b3a8af..58e109ad7f 100644
--- a/packages/frontend/src/ui/_common_/statusbar-rss.vue
+++ b/packages/frontend/src/ui/_common_/statusbar-rss.vue
@@ -44,7 +44,7 @@ const props = defineProps<{
const items = ref([]);
const fetching = ref(true);
-let key = $ref(0);
+const key = ref(0);
const tick = () => {
window.fetch(`/api/fetch-rss?url=${props.url}`, {}).then(res => {
@@ -54,7 +54,7 @@ const tick = () => {
}
items.value = feed.items;
fetching.value = false;
- key++;
+ key.value++;
});
});
};
diff --git a/packages/frontend/src/ui/_common_/statusbar-user-list.vue b/packages/frontend/src/ui/_common_/statusbar-user-list.vue
index f1fcd315d0..6057174ba8 100644
--- a/packages/frontend/src/ui/_common_/statusbar-user-list.vue
+++ b/packages/frontend/src/ui/_common_/statusbar-user-list.vue
@@ -50,7 +50,7 @@ const props = defineProps<{
const notes = ref<Misskey.entities.Note[]>([]);
const fetching = ref(true);
-let key = $ref(0);
+const key = ref(0);
const tick = () => {
if (props.userListId == null) return;
@@ -59,7 +59,7 @@ const tick = () => {
}).then(res => {
notes.value = res;
fetching.value = false;
- key++;
+ key.value++;
});
};
diff --git a/packages/frontend/src/ui/_common_/stream-indicator.vue b/packages/frontend/src/ui/_common_/stream-indicator.vue
index b09221f5d2..be6a4959ec 100644
--- a/packages/frontend/src/ui/_common_/stream-indicator.vue
+++ b/packages/frontend/src/ui/_common_/stream-indicator.vue
@@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { onUnmounted } from 'vue';
+import { onUnmounted, ref } from 'vue';
import { useStream } from '@/stream.js';
import { i18n } from '@/i18n.js';
import MkButton from '@/components/MkButton.vue';
@@ -23,14 +23,14 @@ import { defaultStore } from '@/store.js';
const zIndex = os.claimZIndex('high');
-let hasDisconnected = $ref(false);
+const hasDisconnected = ref(false);
function onDisconnected() {
- hasDisconnected = true;
+ hasDisconnected.value = true;
}
function resetDisconnected() {
- hasDisconnected = false;
+ hasDisconnected.value = false;
}
function reload() {
diff --git a/packages/frontend/src/ui/classic.header.vue b/packages/frontend/src/ui/classic.header.vue
index 3b78aa93cd..aa9f908cec 100644
--- a/packages/frontend/src/ui/classic.header.vue
+++ b/packages/frontend/src/ui/classic.header.vue
@@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { computed, defineAsyncComponent, onMounted } from 'vue';
+import { computed, defineAsyncComponent, onMounted, ref } from 'vue';
import { openInstanceMenu } from './_common_/common';
import * as os from '@/os.js';
import { navbarItemDef } from '@/navbar';
@@ -59,12 +59,12 @@ import { i18n } from '@/i18n.js';
const WINDOW_THRESHOLD = 1400;
-let settingsWindowed = $ref(window.innerWidth > WINDOW_THRESHOLD);
-let menu = $ref(defaultStore.state.menu);
+const settingsWindowed = ref(window.innerWidth > WINDOW_THRESHOLD);
+const menu = ref(defaultStore.state.menu);
// const menuDisplay = computed(defaultStore.makeGetterSetter('menuDisplay'));
-let otherNavItemIndicated = computed<boolean>(() => {
+const otherNavItemIndicated = computed<boolean>(() => {
for (const def in navbarItemDef) {
- if (menu.includes(def)) continue;
+ if (menu.value.includes(def)) continue;
if (navbarItemDef[def].indicated) return true;
}
return false;
@@ -86,7 +86,7 @@ function openAccountMenu(ev: MouseEvent) {
onMounted(() => {
window.addEventListener('resize', () => {
- settingsWindowed = (window.innerWidth >= WINDOW_THRESHOLD);
+ settingsWindowed.value = (window.innerWidth >= WINDOW_THRESHOLD);
}, { passive: true });
});
diff --git a/packages/frontend/src/ui/classic.sidebar.vue b/packages/frontend/src/ui/classic.sidebar.vue
index 01dbf1c9c0..402ab1efee 100644
--- a/packages/frontend/src/ui/classic.sidebar.vue
+++ b/packages/frontend/src/ui/classic.sidebar.vue
@@ -49,7 +49,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { defineAsyncComponent, onMounted, computed, watch, nextTick } from 'vue';
+import { defineAsyncComponent, onMounted, computed, watch, nextTick, ref, shallowRef } from 'vue';
import { openInstanceMenu } from './_common_/common.js';
// import { host } from '@/config.js';
import * as os from '@/os.js';
@@ -65,24 +65,24 @@ import { i18n } from '@/i18n.js';
const WINDOW_THRESHOLD = 1400;
-const menu = $ref(defaultStore.state.menu);
+const menu = ref(defaultStore.state.menu);
const menuDisplay = computed(defaultStore.makeGetterSetter('menuDisplay'));
const otherNavItemIndicated = computed<boolean>(() => {
for (const def in navbarItemDef) {
- if (menu.includes(def)) continue;
+ if (menu.value.includes(def)) continue;
if (navbarItemDef[def].indicated) return true;
}
return false;
});
-let el = $shallowRef<HTMLElement>();
+const el = shallowRef<HTMLElement>();
// let accounts = $ref([]);
// let connection = $ref(null);
-let iconOnly = $ref(false);
-let settingsWindowed = $ref(false);
+const iconOnly = ref(false);
+const settingsWindowed = ref(false);
function calcViewState() {
- iconOnly = (window.innerWidth <= WINDOW_THRESHOLD) || (menuDisplay.value === 'sideIcon');
- settingsWindowed = (window.innerWidth > WINDOW_THRESHOLD);
+ iconOnly.value = (window.innerWidth <= WINDOW_THRESHOLD) || (menuDisplay.value === 'sideIcon');
+ settingsWindowed.value = (window.innerWidth > WINDOW_THRESHOLD);
}
function more(ev: MouseEvent) {
diff --git a/packages/frontend/src/ui/classic.vue b/packages/frontend/src/ui/classic.vue
index 3323e813bb..1a9f939c83 100644
--- a/packages/frontend/src/ui/classic.vue
+++ b/packages/frontend/src/ui/classic.vue
@@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { defineAsyncComponent, ComputedRef, onMounted, provide } from 'vue';
+import { defineAsyncComponent, ComputedRef, onMounted, provide, ref, computed, shallowRef } from 'vue';
import XSidebar from './classic.sidebar.vue';
import XCommon from './_common_/common.vue';
import { instanceName } from '@/config.js';
@@ -62,26 +62,26 @@ const XWidgets = defineAsyncComponent(() => import('./universal.widgets.vue'));
const DESKTOP_THRESHOLD = 1100;
-let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD);
+const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD);
-let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
-let widgetsShowing = $ref(false);
-let fullView = $ref(false);
-let globalHeaderHeight = $ref(0);
+const pageMetadata = ref<null | ComputedRef<PageMetadata>>();
+const widgetsShowing = ref(false);
+const fullView = ref(false);
+const globalHeaderHeight = ref(0);
const wallpaper = miLocalStorage.getItem('wallpaper') != null;
-const showMenuOnTop = $computed(() => defaultStore.state.menuDisplay === 'top');
-let live2d = $shallowRef<HTMLIFrameElement>();
-let widgetsLeft = $ref();
-let widgetsRight = $ref();
+const showMenuOnTop = computed(() => defaultStore.state.menuDisplay === 'top');
+const live2d = shallowRef<HTMLIFrameElement>();
+const widgetsLeft = ref();
+const widgetsRight = ref();
provide('router', mainRouter);
provideMetadataReceiver((info) => {
- pageMetadata = info;
- if (pageMetadata.value) {
- document.title = `${pageMetadata.value.title} | ${instanceName}`;
+ pageMetadata.value = info;
+ if (pageMetadata.value.value) {
+ document.title = `${pageMetadata.value.value.title} | ${instanceName}`;
}
});
-provide('shouldHeaderThin', showMenuOnTop);
+provide('shouldHeaderThin', showMenuOnTop.value);
provide('forceSpacerMin', true);
function attachSticky(el) {
@@ -110,10 +110,10 @@ function onContextmenu(ev: MouseEvent) {
type: 'label',
text: path,
}, {
- icon: fullView ? 'ti ti-minimize' : 'ti ti-maximize',
- text: fullView ? i18n.ts.quitFullView : i18n.ts.fullView,
+ icon: fullView.value ? 'ti ti-minimize' : 'ti ti-maximize',
+ text: fullView.value ? i18n.ts.quitFullView : i18n.ts.fullView,
action: () => {
- fullView = !fullView;
+ fullView.value = !fullView.value;
},
}, {
icon: 'ti ti-window-maximize',
@@ -154,13 +154,13 @@ defaultStore.loaded.then(() => {
onMounted(() => {
window.addEventListener('resize', () => {
- isDesktop = (window.innerWidth >= DESKTOP_THRESHOLD);
+ isDesktop.value = (window.innerWidth >= DESKTOP_THRESHOLD);
}, { passive: true });
if (defaultStore.state.aiChanMode) {
- const iframeRect = live2d.getBoundingClientRect();
+ const iframeRect = live2d.value.getBoundingClientRect();
window.addEventListener('mousemove', ev => {
- live2d.contentWindow.postMessage({
+ live2d.value.contentWindow.postMessage({
type: 'moveCursor',
body: {
x: ev.clientX - iframeRect.left,
@@ -169,7 +169,7 @@ onMounted(() => {
}, '*');
}, { passive: true });
window.addEventListener('touchmove', ev => {
- live2d.contentWindow.postMessage({
+ live2d.value.contentWindow.postMessage({
type: 'moveCursor',
body: {
x: ev.touches[0].clientX - iframeRect.left,
diff --git a/packages/frontend/src/ui/deck.vue b/packages/frontend/src/ui/deck.vue
index 1d51e08f78..10a073243b 100644
--- a/packages/frontend/src/ui/deck.vue
+++ b/packages/frontend/src/ui/deck.vue
@@ -92,7 +92,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { computed, defineAsyncComponent, ref, watch } from 'vue';
+import { computed, defineAsyncComponent, ref, watch, shallowRef } from 'vue';
import { v4 as uuid } from 'uuid';
import XCommon from './_common_/common.vue';
import { deckStore, addColumn as addColumnToStore, loadDeck, getProfiles, deleteProfile as deleteProfile_ } from './deck/deck-store.js';
@@ -171,7 +171,7 @@ function showSettings() {
os.pageWindow('/settings/deck');
}
-let columnsEl = $shallowRef<HTMLElement>();
+const columnsEl = shallowRef<HTMLElement>();
const addColumn = async (ev) => {
const columns = [
@@ -212,7 +212,7 @@ const onContextmenu = (ev) => {
function onWheel(ev: WheelEvent) {
if (ev.deltaX === 0) {
- columnsEl.scrollLeft += ev.deltaY;
+ columnsEl.value.scrollLeft += ev.deltaY;
}
}
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 = [{
diff --git a/packages/frontend/src/ui/minimum.vue b/packages/frontend/src/ui/minimum.vue
index cc5433f81c..f32f2de3df 100644
--- a/packages/frontend/src/ui/minimum.vue
+++ b/packages/frontend/src/ui/minimum.vue
@@ -14,19 +14,19 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { provide, ComputedRef } from 'vue';
+import { provide, ComputedRef, ref } from 'vue';
import XCommon from './_common_/common.vue';
import { mainRouter } from '@/router.js';
import { PageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
import { instanceName } from '@/config.js';
-let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
+const pageMetadata = ref<null | ComputedRef<PageMetadata>>();
provide('router', mainRouter);
provideMetadataReceiver((info) => {
- pageMetadata = info;
- if (pageMetadata.value) {
- document.title = `${pageMetadata.value.title} | ${instanceName}`;
+ pageMetadata.value = info;
+ if (pageMetadata.value.value) {
+ document.title = `${pageMetadata.value.value.title} | ${instanceName}`;
}
});
diff --git a/packages/frontend/src/ui/universal.vue b/packages/frontend/src/ui/universal.vue
index 5ed1e76828..4721507f7e 100644
--- a/packages/frontend/src/ui/universal.vue
+++ b/packages/frontend/src/ui/universal.vue
@@ -127,16 +127,16 @@ window.addEventListener('resize', () => {
isMobile.value = deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD;
});
-let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
-const widgetsShowing = $ref(false);
-const navFooter = $shallowRef<HTMLElement>();
+const pageMetadata = ref<null | ComputedRef<PageMetadata>>();
+const widgetsShowing = ref(false);
+const navFooter = shallowRef<HTMLElement>();
const contents = shallowRef<InstanceType<typeof MkStickyContainer>>();
provide('router', mainRouter);
provideMetadataReceiver((info) => {
- pageMetadata = info;
- if (pageMetadata.value) {
- document.title = `${pageMetadata.value.title} | ${instanceName}`;
+ pageMetadata.value = info;
+ if (pageMetadata.value.value) {
+ document.title = `${pageMetadata.value.value.title} | ${instanceName}`;
}
});
@@ -216,16 +216,16 @@ function top() {
});
}
-let navFooterHeight = $ref(0);
-provide<Ref<number>>(CURRENT_STICKY_BOTTOM, $$(navFooterHeight));
+const navFooterHeight = ref(0);
+provide<Ref<number>>(CURRENT_STICKY_BOTTOM, navFooterHeight);
-watch($$(navFooter), () => {
- if (navFooter) {
- navFooterHeight = navFooter.offsetHeight;
- document.body.style.setProperty('--stickyBottom', `${navFooterHeight}px`);
+watch(navFooter, () => {
+ if (navFooter.value) {
+ navFooterHeight.value = navFooter.value.offsetHeight;
+ document.body.style.setProperty('--stickyBottom', `${navFooterHeight.value}px`);
document.body.style.setProperty('--minBottomSpacing', 'var(--minBottomSpacingMobile)');
} else {
- navFooterHeight = 0;
+ navFooterHeight.value = 0;
document.body.style.setProperty('--stickyBottom', '0px');
document.body.style.setProperty('--minBottomSpacing', '0px');
}
diff --git a/packages/frontend/src/ui/universal.widgets.vue b/packages/frontend/src/ui/universal.widgets.vue
index 44988e6df3..376563bd56 100644
--- a/packages/frontend/src/ui/universal.widgets.vue
+++ b/packages/frontend/src/ui/universal.widgets.vue
@@ -13,10 +13,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts">
-let editMode = $ref(false);
+import { computed, ref } from 'vue';
+const editMode = ref(false);
</script>
<script lang="ts" setup>
-import { } from 'vue';
import XWidgets from '@/components/MkWidgets.vue';
import { i18n } from '@/i18n.js';
import { defaultStore } from '@/store.js';
@@ -30,7 +30,7 @@ const props = withDefaults(defineProps<{
place: null,
});
-const widgets = $computed(() => {
+const widgets = computed(() => {
if (props.place === null) return defaultStore.reactiveState.widgets.value;
if (props.place === 'left') return defaultStore.reactiveState.widgets.value.filter(w => w.place === 'left');
return defaultStore.reactiveState.widgets.value.filter(w => w.place !== 'left');
diff --git a/packages/frontend/src/ui/visitor.vue b/packages/frontend/src/ui/visitor.vue
index b7ad184da1..8bf3a28d55 100644
--- a/packages/frontend/src/ui/visitor.vue
+++ b/packages/frontend/src/ui/visitor.vue
@@ -69,7 +69,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { ComputedRef, onMounted, provide } from 'vue';
+import { ComputedRef, onMounted, provide, ref, computed } from 'vue';
import XCommon from './_common_/common.vue';
import { host, instanceName } from '@/config.js';
import * as os from '@/os.js';
@@ -84,13 +84,13 @@ import MkVisitorDashboard from '@/components/MkVisitorDashboard.vue';
const DESKTOP_THRESHOLD = 1100;
-let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
+const pageMetadata = ref<null | ComputedRef<PageMetadata>>();
provide('router', mainRouter);
provideMetadataReceiver((info) => {
- pageMetadata = info;
- if (pageMetadata.value) {
- document.title = `${pageMetadata.value.title} | ${instanceName}`;
+ pageMetadata.value = info;
+ if (pageMetadata.value.value) {
+ document.title = `${pageMetadata.value.value.title} | ${instanceName}`;
}
});
@@ -99,14 +99,14 @@ const announcements = {
limit: 10,
};
-const isTimelineAvailable = $ref(instance.policies?.ltlAvailable || instance.policies?.gtlAvailable);
+const isTimelineAvailable = ref(instance.policies?.ltlAvailable || instance.policies?.gtlAvailable);
-let showMenu = $ref(false);
-let isDesktop = $ref(window.innerWidth >= DESKTOP_THRESHOLD);
-let narrow = $ref(window.innerWidth < 1280);
-let meta = $ref();
+const showMenu = ref(false);
+const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD);
+const narrow = ref(window.innerWidth < 1280);
+const meta = ref();
-const keymap = $computed(() => {
+const keymap = computed(() => {
return {
'd': () => {
if (ColdDeviceStorage.get('syncDeviceDarkMode')) return;
@@ -118,10 +118,10 @@ const keymap = $computed(() => {
};
});
-const root = $computed(() => mainRouter.currentRoute.value.name === 'index');
+const root = computed(() => mainRouter.currentRoute.value.name === 'index');
os.api('meta', { detail: true }).then(res => {
- meta = res;
+ meta.value = res;
});
function signin() {
@@ -137,15 +137,15 @@ function signup() {
}
onMounted(() => {
- if (!isDesktop) {
+ if (!isDesktop.value) {
window.addEventListener('resize', () => {
- if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop = true;
+ if (window.innerWidth >= DESKTOP_THRESHOLD) isDesktop.value = true;
}, { passive: true });
}
});
defineExpose({
- showMenu: $$(showMenu),
+ showMenu: showMenu,
});
</script>
diff --git a/packages/frontend/src/ui/zen.vue b/packages/frontend/src/ui/zen.vue
index 4f0945eb48..b819b6ca0a 100644
--- a/packages/frontend/src/ui/zen.vue
+++ b/packages/frontend/src/ui/zen.vue
@@ -22,22 +22,22 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
-import { provide, ComputedRef } from 'vue';
+import { provide, ComputedRef, ref } from 'vue';
import XCommon from './_common_/common.vue';
import { mainRouter } from '@/router.js';
import { PageMetadata, provideMetadataReceiver } from '@/scripts/page-metadata.js';
import { instanceName, ui } from '@/config.js';
import { i18n } from '@/i18n.js';
-let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();
+const pageMetadata = ref<null | ComputedRef<PageMetadata>>();
const showBottom = !(new URLSearchParams(location.search)).has('zen') && ui === 'deck';
provide('router', mainRouter);
provideMetadataReceiver((info) => {
- pageMetadata = info;
- if (pageMetadata.value) {
- document.title = `${pageMetadata.value.title} | ${instanceName}`;
+ pageMetadata.value = info;
+ if (pageMetadata.value.value) {
+ document.title = `${pageMetadata.value.value.title} | ${instanceName}`;
}
});