refactor(frontend): use useTemplateRef for DOM referencing

This commit is contained in:
syuilo 2025-03-19 18:46:03 +09:00
parent 81ac71f7e5
commit 7b323031b7
127 changed files with 353 additions and 359 deletions

View file

@ -30,7 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, shallowRef } from 'vue'; import { ref, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkWindow from '@/components/MkWindow.vue'; import MkWindow from '@/components/MkWindow.vue';
import MkTextarea from '@/components/MkTextarea.vue'; import MkTextarea from '@/components/MkTextarea.vue';
@ -47,7 +47,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const uiWindow = shallowRef<InstanceType<typeof MkWindow>>(); const uiWindow = useTemplateRef('uiWindow');
const comment = ref(props.initialComment ?? ''); const comment = ref(props.initialComment ?? '');
function send() { function send() {

View file

@ -8,10 +8,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, shallowRef } from 'vue'; import { onMounted, onUnmounted, useTemplateRef } from 'vue';
import isChromatic from 'chromatic/isChromatic'; import isChromatic from 'chromatic/isChromatic';
const canvasEl = shallowRef<HTMLCanvasElement>(); const canvasEl = useTemplateRef('canvasEl');
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
scale?: number; scale?: number;

View file

@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef } from 'vue'; import { onMounted, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
@ -37,8 +37,8 @@ const props = withDefaults(defineProps<{
}>(), { }>(), {
}); });
const rootEl = shallowRef<HTMLDivElement>(); const rootEl = useTemplateRef('rootEl');
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
async function ok() { async function ok() {
if (props.announcement.needConfirmationToRead) { if (props.announcement.needConfirmationToRead) {

View file

@ -23,7 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef } from 'vue'; import { useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
import XAntennaEditor from '@/components/MkAntennaEditor.vue'; import XAntennaEditor from '@/components/MkAntennaEditor.vue';
@ -40,7 +40,7 @@ const emit = defineEmits<{
(ev: 'closed'): void, (ev: 'closed'): void,
}>(); }>();
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
function onAntennaCreated(newAntenna: Misskey.entities.Antenna) { function onAntennaCreated(newAntenna: Misskey.entities.Antenna) {
emit('created', newAntenna); emit('created', newAntenna);

View file

@ -44,7 +44,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts"> <script lang="ts">
import { markRaw, ref, shallowRef, computed, onUpdated, onMounted, onBeforeUnmount, nextTick, watch } from 'vue'; import { markRaw, ref, useTemplateRef, computed, onUpdated, onMounted, onBeforeUnmount, nextTick, watch } from 'vue';
import sanitizeHtml from 'sanitize-html'; import sanitizeHtml from 'sanitize-html';
import { emojilist, getEmojiName } from '@@/js/emojilist.js'; import { emojilist, getEmojiName } from '@@/js/emojilist.js';
import { char2twemojiFilePath, char2fluentEmojiFilePath } from '@@/js/emoji-base.js'; import { char2twemojiFilePath, char2fluentEmojiFilePath } from '@@/js/emoji-base.js';
@ -139,7 +139,7 @@ const emit = defineEmits<{
}>(); }>();
const suggests = ref<Element>(); const suggests = ref<Element>();
const rootEl = shallowRef<HTMLDivElement>(); const rootEl = useTemplateRef('rootEl');
const fetching = ref(true); const fetching = ref(true);
const users = ref<any[]>([]); const users = ref<any[]>([]);

View file

@ -35,7 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted, shallowRef } from 'vue'; import { nextTick, onMounted, useTemplateRef } from 'vue';
const props = defineProps<{ const props = defineProps<{
type?: 'button' | 'submit' | 'reset'; type?: 'button' | 'submit' | 'reset';
@ -64,8 +64,8 @@ const emit = defineEmits<{
(ev: 'click', payload: MouseEvent): void; (ev: 'click', payload: MouseEvent): void;
}>(); }>();
const el = shallowRef<HTMLElement | null>(null); const el = useTemplateRef('el');
const ripples = shallowRef<HTMLElement | null>(null); const ripples = useTemplateRef('ripples');
onMounted(() => { onMounted(() => {
if (props.autofocus) { if (props.autofocus) {

View file

@ -26,7 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, computed, onMounted, onBeforeUnmount, watch, onUnmounted } from 'vue'; import { ref, useTemplateRef, computed, onMounted, onBeforeUnmount, watch, onUnmounted } from 'vue';
import { store } from '@/store.js'; import { store } from '@/store.js';
// APIs provided by Captcha services // APIs provided by Captcha services
@ -69,7 +69,7 @@ const emit = defineEmits<{
const available = ref(false); const available = ref(false);
const captchaEl = shallowRef<HTMLDivElement | undefined>(); const captchaEl = useTemplateRef('captchaEl');
const captchaWidgetId = ref<string | undefined>(undefined); const captchaWidgetId = ref<string | undefined>(undefined);
const testcaptchaInput = ref(''); const testcaptchaInput = ref('');
const testcaptchaPassed = ref(false); const testcaptchaPassed = ref(false);

View file

@ -45,12 +45,8 @@ export type ChartSrc =
</script> </script>
<script lang="ts" setup> <script lang="ts" setup>
/* eslint-disable id-denylist --
Chart.js has a `data` attribute in most chart definitions, which triggers the import { onMounted, ref, useTemplateRef, watch } from 'vue';
id-denylist violation when setting it. This is causing about 60+ lint issues.
As this is part of Chart.js's API it makes sense to disable the check here.
*/
import { onMounted, ref, shallowRef, watch } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { misskeyApiGet } from '@/utility/misskey-api.js'; import { misskeyApiGet } from '@/utility/misskey-api.js';
@ -96,7 +92,7 @@ const props = withDefaults(defineProps<{
nowForChromatic: undefined, nowForChromatic: undefined,
}); });
const legendEl = shallowRef<InstanceType<typeof MkChartLegend>>(); const legendEl = useTemplateRef('legendEl');
const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b)); const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b));
const negate = arr => arr.map(x => -x); const negate = arr => arr.map(x => -x);
@ -134,7 +130,7 @@ let chartData: {
bytes?: boolean; bytes?: boolean;
} | null = null; } | null = null;
const chartEl = shallowRef<HTMLCanvasElement | null>(null); const chartEl = useTemplateRef('chartEl');
const fetching = ref(true); const fetching = ref(true);
const getDate = (ago: number) => { const getDate = (ago: number) => {
@ -849,7 +845,7 @@ watch(() => [props.src, props.span], fetchAndRender);
onMounted(() => { onMounted(() => {
fetchAndRender(); fetchAndRender();
}); });
/* eslint-enable id-denylist */
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -32,7 +32,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch, toRefs, shallowRef, nextTick } from 'vue'; import { ref, watch, toRefs, useTemplateRef, nextTick } from 'vue';
import { debounce } from 'throttle-debounce'; import { debounce } from 'throttle-debounce';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -61,7 +61,7 @@ const { modelValue } = toRefs(props);
const v = ref<string>(modelValue.value ?? ''); const v = ref<string>(modelValue.value ?? '');
const focused = ref(false); const focused = ref(false);
const changed = ref(false); const changed = ref(false);
const inputEl = shallowRef<HTMLTextAreaElement>(); const inputEl = useTemplateRef('inputEl');
const focus = () => inputEl.value?.focus(); const focus = () => inputEl.value?.focus();

View file

@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, toRefs } from 'vue'; import { ref, useTemplateRef, toRefs } from 'vue';
const props = defineProps<{ const props = defineProps<{
modelValue: string | null; modelValue: string | null;
@ -39,7 +39,7 @@ const emit = defineEmits<{
const { modelValue } = toRefs(props); const { modelValue } = toRefs(props);
const v = ref(modelValue.value); const v = ref(modelValue.value);
const inputEl = shallowRef<HTMLElement>(); const inputEl = useTemplateRef('inputEl');
const onInput = () => { const onInput = () => {
emit('update:modelValue', v.value ?? ''); emit('update:modelValue', v.value ?? '');

View file

@ -39,7 +39,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'; import { onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -58,9 +58,9 @@ const props = withDefaults(defineProps<{
maxHeight: null, maxHeight: null,
}); });
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
const contentEl = shallowRef<HTMLElement>(); const contentEl = useTemplateRef('contentEl');
const headerEl = shallowRef<HTMLElement>(); const headerEl = useTemplateRef('headerEl');
const showBody = ref(props.expanded); const showBody = ref(props.expanded);
const ignoreOmit = ref(false); const ignoreOmit = ref(false);
const omitted = ref(false); const omitted = ref(false);

View file

@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onBeforeUnmount, shallowRef, ref } from 'vue'; import { onMounted, onBeforeUnmount, useTemplateRef, ref } from 'vue';
import MkMenu from './MkMenu.vue'; import MkMenu from './MkMenu.vue';
import type { MenuItem } from '@/types/menu.js'; import type { MenuItem } from '@/types/menu.js';
import contains from '@/utility/contains.js'; import contains from '@/utility/contains.js';
@ -34,7 +34,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const rootEl = shallowRef<HTMLDivElement>(); const rootEl = useTemplateRef('rootEl');
const zIndex = ref<number>(os.claimZIndex('high')); const zIndex = ref<number>(os.claimZIndex('high'));

View file

@ -31,7 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef, ref } from 'vue'; import { onMounted, useTemplateRef, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import Cropper from 'cropperjs'; import Cropper from 'cropperjs';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
@ -56,8 +56,8 @@ const props = defineProps<{
}>(); }>();
const imgUrl = getProxiedImageUrl(props.file.url, undefined, true); const imgUrl = getProxiedImageUrl(props.file.url, undefined, true);
const dialogEl = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialogEl = useTemplateRef('dialogEl');
const imgEl = shallowRef<HTMLImageElement>(); const imgEl = useTemplateRef('imgEl');
let cropper: Cropper | null = null; let cropper: Cropper | null = null;
const loading = ref(true); const loading = ref(true);

View file

@ -57,7 +57,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { shallowRef } from 'vue'; import { useTemplateRef } from 'vue';
import MkLink from '@/components/MkLink.vue'; import MkLink from '@/components/MkLink.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
@ -73,7 +73,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const dialogEl = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialogEl = useTemplateRef('dialogEl');
function cancel() { function cancel() {
emit('cancel'); emit('cancel');

View file

@ -56,7 +56,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, computed } from 'vue'; import { ref, useTemplateRef, computed } from 'vue';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
@ -117,7 +117,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
const inputValue = ref<string | number | null>(props.input?.default ?? null); const inputValue = ref<string | number | null>(props.input?.default ?? null);
const selectedValue = ref(props.select?.default ?? null); const selectedValue = ref(props.select?.default ?? null);

View file

@ -96,7 +96,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onActivated, onBeforeUnmount, onMounted, ref, shallowRef, watch } from 'vue'; import { nextTick, onActivated, onBeforeUnmount, onMounted, ref, useTemplateRef, watch } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkButton from './MkButton.vue'; import MkButton from './MkButton.vue';
import type { MenuItem } from '@/types/menu.js'; import type { MenuItem } from '@/types/menu.js';
@ -129,8 +129,8 @@ const emit = defineEmits<{
(ev: 'open-folder', v: Misskey.entities.DriveFolder): void; (ev: 'open-folder', v: Misskey.entities.DriveFolder): void;
}>(); }>();
const loadMoreFiles = shallowRef<InstanceType<typeof MkButton>>(); const loadMoreFiles = useTemplateRef('loadMoreFiles');
const fileInput = shallowRef<HTMLInputElement>(); const fileInput = useTemplateRef('fileInput');
const folder = ref<Misskey.entities.DriveFolder | null>(null); const folder = ref<Misskey.entities.DriveFolder | null>(null);
const files = ref<Misskey.entities.DriveFile[]>([]); const files = ref<Misskey.entities.DriveFile[]>([]);

View file

@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef } from 'vue'; import { ref, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import XDrive from '@/components/MkDrive.vue'; import XDrive from '@/components/MkDrive.vue';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
@ -43,7 +43,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
const selected = ref<Misskey.entities.DriveFile[] | Misskey.entities.DriveFolder[]>([]); const selected = ref<Misskey.entities.DriveFile[] | Misskey.entities.DriveFolder[]>([]);

View file

@ -89,7 +89,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { shallowRef, ref, computed, nextTick, onMounted, onDeactivated, onUnmounted } from 'vue'; import { useTemplateRef, ref, computed, nextTick, onMounted, onDeactivated, onUnmounted } from 'vue';
import { url } from '@@/js/config.js'; import { url } from '@@/js/config.js';
import { embedRouteWithScrollbar } from '@@/js/embed-page.js'; import { embedRouteWithScrollbar } from '@@/js/embed-page.js';
import type { EmbeddableEntity, EmbedParams } from '@@/js/embed-page.js'; import type { EmbeddableEntity, EmbedParams } from '@@/js/embed-page.js';
@ -121,7 +121,7 @@ const props = defineProps<{
}>(); }>();
//#region Modal //#region Modal
const dialogEl = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialogEl = useTemplateRef('dialogEl');
function cancel() { function cancel() {
emit('cancel'); emit('cancel');
@ -198,9 +198,9 @@ function doCopy() {
//#endregion //#endregion
//#region //#region
const resizerRootEl = shallowRef<HTMLDivElement>(); const resizerRootEl = useTemplateRef('resizerRootEl');
const iframeLoading = ref(true); const iframeLoading = ref(true);
const iframeEl = shallowRef<HTMLIFrameElement>(); const iframeEl = useTemplateRef('iframeEl');
const iframeHeight = ref(0); const iframeHeight = ref(0);
const iframeScale = ref(1); const iframeScale = ref(1);
const iframeStyle = computed(() => { const iframeStyle = computed(() => {

View file

@ -115,7 +115,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, computed, watch, onMounted } from 'vue'; import { ref, useTemplateRef, computed, watch, onMounted } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { import {
emojilist, emojilist,
@ -157,8 +157,8 @@ const emit = defineEmits<{
(ev: 'esc'): void; (ev: 'esc'): void;
}>(); }>();
const searchEl = shallowRef<HTMLInputElement>(); const searchEl = useTemplateRef('searchEl');
const emojisEl = shallowRef<HTMLDivElement>(); const emojisEl = useTemplateRef('emojisEl');
const { const {
emojiPickerScale, emojiPickerScale,

View file

@ -37,7 +37,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { shallowRef } from 'vue'; import { useTemplateRef } from 'vue';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import MkEmojiPicker from '@/components/MkEmojiPicker.vue'; import MkEmojiPicker from '@/components/MkEmojiPicker.vue';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
@ -64,8 +64,8 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
const picker = shallowRef<InstanceType<typeof MkEmojiPicker>>(); const picker = useTemplateRef('picker');
function chosen(emoji: string) { function chosen(emoji: string) {
emit('done', emoji); emit('done', emoji);

View file

@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef, ref } from 'vue'; import { useTemplateRef, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
import MkTextarea from '@/components/MkTextarea.vue'; import MkTextarea from '@/components/MkTextarea.vue';
@ -42,7 +42,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
const caption = ref(props.default); const caption = ref(props.default);

View file

@ -31,7 +31,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, shallowRef, watch } from 'vue'; import { onMounted, ref, useTemplateRef, watch } from 'vue';
import { miLocalStorage } from '@/local-storage.js'; import { miLocalStorage } from '@/local-storage.js';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
import { getBgColor } from '@/utility/get-bg-color.js'; import { getBgColor } from '@/utility/get-bg-color.js';
@ -46,7 +46,7 @@ const props = withDefaults(defineProps<{
persistKey: null, persistKey: null,
}); });
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
const parentBg = ref<string | null>(null); const parentBg = ref<string | null>(null);
// eslint-disable-next-line vue/no-setup-props-reactivity-loss // eslint-disable-next-line vue/no-setup-props-reactivity-loss
const showBody = ref((props.persistKey && miLocalStorage.getItem(`${miLocalStoragePrefix}${props.persistKey}`)) ? (miLocalStorage.getItem(`${miLocalStoragePrefix}${props.persistKey}`) === 't') : props.expanded); const showBody = ref((props.persistKey && miLocalStorage.getItem(`${miLocalStoragePrefix}${props.persistKey}`)) ? (miLocalStorage.getItem(`${miLocalStoragePrefix}${props.persistKey}`) === 't') : props.expanded);

View file

@ -56,7 +56,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted, ref, shallowRef } from 'vue'; import { nextTick, onMounted, ref, useTemplateRef } from 'vue';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
import { getBgColor } from '@/utility/get-bg-color.js'; import { getBgColor } from '@/utility/get-bg-color.js';
@ -74,7 +74,7 @@ const props = withDefaults(defineProps<{
spacerMax: 22, spacerMax: 22,
}); });
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
const bgSame = ref(false); const bgSame = ref(false);
const opened = ref(props.defaultOpen); const opened = ref(props.defaultOpen);
const openedAtLeastOnce = ref(props.defaultOpen); const openedAtLeastOnce = ref(props.defaultOpen);

View file

@ -71,7 +71,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, shallowRef } from 'vue'; import { reactive, useTemplateRef } from 'vue';
import MkInput from './MkInput.vue'; import MkInput from './MkInput.vue';
import MkTextarea from './MkTextarea.vue'; import MkTextarea from './MkTextarea.vue';
import MkSwitch from './MkSwitch.vue'; import MkSwitch from './MkSwitch.vue';
@ -99,7 +99,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
const values = reactive({}); const values = reactive({});
for (const item in props.form) { for (const item in props.form) {

View file

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, nextTick, watch, shallowRef, ref } from 'vue'; import { onMounted, nextTick, watch, useTemplateRef, ref } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
@ -35,8 +35,8 @@ const props = withDefaults(defineProps<{
label: '', label: '',
}); });
const rootEl = shallowRef<HTMLDivElement | null>(null); const rootEl = useTemplateRef('rootEl');
const chartEl = shallowRef<HTMLCanvasElement | null>(null); const chartEl = useTemplateRef('chartEl');
const now = new Date(); const now = new Date();
let chartInstance: Chart | null = null; let chartInstance: Chart | null = null;
const fetching = ref(true); const fetching = ref(true);

View file

@ -26,12 +26,12 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, computed, nextTick, watch } from 'vue'; import { ref, useTemplateRef, computed, nextTick, watch } from 'vue';
import type { Tab } from '@/components/global/MkPageHeader.tabs.vue'; import type { Tab } from '@/components/global/MkPageHeader.tabs.vue';
import { isHorizontalSwipeSwiping as isSwiping } from '@/utility/touch.js'; import { isHorizontalSwipeSwiping as isSwiping } from '@/utility/touch.js';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
const rootEl = shallowRef<HTMLDivElement>(); const rootEl = useTemplateRef('rootEl');
const tabModel = defineModel<string>('tab'); const tabModel = defineModel<string>('tab');

View file

@ -83,7 +83,7 @@ const canvasPromise = new Promise<WorkerMultiDispatch | HTMLCanvasElement>(resol
</script> </script>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, nextTick, onMounted, onUnmounted, shallowRef, watch, ref } from 'vue'; import { computed, nextTick, onMounted, onUnmounted, useTemplateRef, watch, ref } from 'vue';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import { render } from 'buraha'; import { render } from 'buraha';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
@ -120,9 +120,9 @@ const props = withDefaults(defineProps<{
}); });
const viewId = uuid(); const viewId = uuid();
const canvas = shallowRef<HTMLCanvasElement>(); const canvas = useTemplateRef('canvas');
const root = shallowRef<HTMLDivElement>(); const root = useTemplateRef('root');
const img = shallowRef<HTMLImageElement>(); const img = useTemplateRef('img');
const loaded = ref(false); const loaded = ref(false);
const canvasWidth = ref(64); const canvasWidth = ref(64);
const canvasHeight = ref(64); const canvasHeight = ref(64);

View file

@ -44,7 +44,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, nextTick, ref, shallowRef, watch, computed, toRefs } from 'vue'; import { onMounted, onUnmounted, nextTick, ref, useTemplateRef, watch, computed, toRefs } from 'vue';
import { debounce } from 'throttle-debounce'; import { debounce } from 'throttle-debounce';
import { useInterval } from '@@/js/use-interval.js'; import { useInterval } from '@@/js/use-interval.js';
import type { InputHTMLAttributes } from 'vue'; import type { InputHTMLAttributes } from 'vue';
@ -92,9 +92,9 @@ const focused = ref(false);
const changed = ref(false); const changed = ref(false);
const invalid = ref(false); const invalid = ref(false);
const filled = computed(() => v.value !== '' && v.value != null); const filled = computed(() => v.value !== '' && v.value != null);
const inputEl = shallowRef<HTMLInputElement>(); const inputEl = useTemplateRef('inputEl');
const prefixEl = shallowRef<HTMLElement>(); const prefixEl = useTemplateRef('prefixEl');
const suffixEl = shallowRef<HTMLElement>(); const suffixEl = useTemplateRef('suffixEl');
const height = const height =
props.small ? 33 : props.small ? 33 :
props.large ? 39 : props.large ? 39 :

View file

@ -84,8 +84,9 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, computed, shallowRef } from 'vue'; import { onMounted, ref, computed, useTemplateRef } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import type { HeatmapSource } from '@/components/MkHeatmap.vue';
import MkSelect from '@/components/MkSelect.vue'; import MkSelect from '@/components/MkSelect.vue';
import MkChart from '@/components/MkChart.vue'; import MkChart from '@/components/MkChart.vue';
import { useChartTooltip } from '@/use/use-chart-tooltip.js'; import { useChartTooltip } from '@/use/use-chart-tooltip.js';
@ -95,7 +96,6 @@ import { misskeyApiGet } from '@/utility/misskey-api.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkHeatmap from '@/components/MkHeatmap.vue'; import MkHeatmap from '@/components/MkHeatmap.vue';
import type { HeatmapSource } from '@/components/MkHeatmap.vue';
import MkFoldableSection from '@/components/MkFoldableSection.vue'; import MkFoldableSection from '@/components/MkFoldableSection.vue';
import MkRetentionHeatmap from '@/components/MkRetentionHeatmap.vue'; import MkRetentionHeatmap from '@/components/MkRetentionHeatmap.vue';
import MkRetentionLineChart from '@/components/MkRetentionLineChart.vue'; import MkRetentionLineChart from '@/components/MkRetentionLineChart.vue';
@ -109,8 +109,8 @@ const chartLimit = 500;
const chartSpan = ref<'hour' | 'day'>('hour'); const chartSpan = ref<'hour' | 'day'>('hour');
const chartSrc = ref('active-users'); const chartSrc = ref('active-users');
const heatmapSrc = ref<HeatmapSource>('active-users'); const heatmapSrc = ref<HeatmapSource>('active-users');
const subDoughnutEl = shallowRef<HTMLCanvasElement>(); const subDoughnutEl = useTemplateRef('subDoughnutEl');
const pubDoughnutEl = shallowRef<HTMLCanvasElement>(); const pubDoughnutEl = useTemplateRef('pubDoughnutEl');
const { handler: externalTooltipHandler1 } = useChartTooltip({ const { handler: externalTooltipHandler1 } = useChartTooltip({
position: 'middle', position: 'middle',

View file

@ -27,7 +27,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef } from 'vue'; import { useTemplateRef } from 'vue';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import { navbarItemDef } from '@/navbar.js'; import { navbarItemDef } from '@/navbar.js';
import { deviceKind } from '@/utility/device-kind.js'; import { deviceKind } from '@/utility/device-kind.js';
@ -48,7 +48,7 @@ const preferedModalType = (deviceKind === 'desktop' && props.src != null) ? 'pop
deviceKind === 'smartphone' ? 'drawer' : deviceKind === 'smartphone' ? 'drawer' :
'dialog'; 'dialog';
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
const menu = prefer.s.menu; const menu = prefer.s.menu;

View file

@ -88,7 +88,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef, watch, computed, ref, onDeactivated, onActivated, onMounted } from 'vue'; import { useTemplateRef, watch, computed, ref, onDeactivated, onActivated, onMounted } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import type { MenuItem } from '@/types/menu.js'; import type { MenuItem } from '@/types/menu.js';
import type { Keymap } from '@/utility/hotkey.js'; import type { Keymap } from '@/utility/hotkey.js';
@ -151,8 +151,8 @@ function hasFocus() {
return playerEl.value === document.activeElement || playerEl.value.contains(document.activeElement); return playerEl.value === document.activeElement || playerEl.value.contains(document.activeElement);
} }
const playerEl = shallowRef<HTMLDivElement>(); const playerEl = useTemplateRef('playerEl');
const audioEl = shallowRef<HTMLAudioElement>(); const audioEl = useTemplateRef('audioEl');
// eslint-disable-next-line vue/no-setup-props-reactivity-loss // eslint-disable-next-line vue/no-setup-props-reactivity-loss
const hide = ref((prefer.s.nsfw === 'force' || prefer.s.dataSaver.media) ? true : (props.audio.isSensitive && prefer.s.nsfw !== 'ignore')); const hide = ref((prefer.s.nsfw === 'force' || prefer.s.dataSaver.media) ? true : (props.audio.isSensitive && prefer.s.nsfw !== 'ignore'));

View file

@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onMounted, onUnmounted, shallowRef } from 'vue'; import { computed, onMounted, onUnmounted, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import PhotoSwipeLightbox from 'photoswipe/lightbox'; import PhotoSwipeLightbox from 'photoswipe/lightbox';
import PhotoSwipe from 'photoswipe'; import PhotoSwipe from 'photoswipe';
@ -46,7 +46,7 @@ const props = defineProps<{
raw?: boolean; raw?: boolean;
}>(); }>();
const gallery = shallowRef<HTMLDivElement>(); const gallery = useTemplateRef('gallery');
const pswpZIndex = os.claimZIndex('middle'); const pswpZIndex = os.claimZIndex('middle');
document.documentElement.style.setProperty('--mk-pswp-root-z-index', pswpZIndex.toString()); document.documentElement.style.setProperty('--mk-pswp-root-z-index', pswpZIndex.toString());
const count = computed(() => props.mediaList.filter(media => previewable(media)).length); const count = computed(() => props.mediaList.filter(media => previewable(media)).length);

View file

@ -109,7 +109,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, computed, watch, onDeactivated, onActivated, onMounted } from 'vue'; import { ref, useTemplateRef, computed, watch, onDeactivated, onActivated, onMounted } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import type { MenuItem } from '@/types/menu.js'; import type { MenuItem } from '@/types/menu.js';
import type { Keymap } from '@/utility/hotkey.js'; import type { Keymap } from '@/utility/hotkey.js';
@ -299,8 +299,8 @@ async function toggleSensitive(file: Misskey.entities.DriveFile) {
} }
// MediaControl: Video State // MediaControl: Video State
const videoEl = shallowRef<HTMLVideoElement>(); const videoEl = useTemplateRef('videoEl');
const playerEl = shallowRef<HTMLDivElement>(); const playerEl = useTemplateRef('playerEl');
const isHoverring = ref(false); const isHoverring = ref(false);
const controlsShowing = computed(() => { const controlsShowing = computed(() => {
if (!oncePlayed.value) return true; if (!oncePlayed.value) return true;

View file

@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted, onUnmounted, provide, shallowRef, watch } from 'vue'; import { nextTick, onMounted, onUnmounted, provide, useTemplateRef, watch } from 'vue';
import MkMenu from './MkMenu.vue'; import MkMenu from './MkMenu.vue';
import type { MenuItem } from '@/types/menu.js'; import type { MenuItem } from '@/types/menu.js';
@ -28,7 +28,7 @@ const emit = defineEmits<{
provide('isNestingMenu', true); provide('isNestingMenu', true);
const el = shallowRef<HTMLElement>(); const el = useTemplateRef('el');
const align = 'left'; const align = 'left';
const SCROLLBAR_THICKNESS = 16; const SCROLLBAR_THICKNESS = 16;

View file

@ -179,7 +179,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts"> <script lang="ts">
import { computed, defineAsyncComponent, inject, nextTick, onBeforeUnmount, onMounted, ref, shallowRef, unref, watch } from 'vue'; import { computed, defineAsyncComponent, inject, nextTick, onBeforeUnmount, onMounted, ref, useTemplateRef, unref, watch } from 'vue';
import type { MenuItem, InnerMenuItem, MenuPending, MenuAction, MenuSwitch, MenuRadio, MenuRadioOption, MenuParent } from '@/types/menu.js'; import type { MenuItem, InnerMenuItem, MenuPending, MenuAction, MenuSwitch, MenuRadio, MenuRadioOption, MenuParent } from '@/types/menu.js';
import type { Keymap } from '@/utility/hotkey.js'; import type { Keymap } from '@/utility/hotkey.js';
import MkSwitchButton from '@/components/MkSwitch.button.vue'; import MkSwitchButton from '@/components/MkSwitch.button.vue';
@ -212,11 +212,11 @@ const big = isTouchUsing;
const isNestingMenu = inject<boolean>('isNestingMenu', false); const isNestingMenu = inject<boolean>('isNestingMenu', false);
const itemsEl = shallowRef<HTMLElement>(); const itemsEl = useTemplateRef('itemsEl');
const items2 = ref<InnerMenuItem[]>(); const items2 = ref<InnerMenuItem[]>();
const child = shallowRef<InstanceType<typeof XChild>>(); const child = useTemplateRef('child');
const keymap = { const keymap = {
'up|k|shift+tab': { 'up|k|shift+tab': {
@ -257,7 +257,7 @@ watch(() => props.items, () => {
}); });
const childMenu = ref<MenuItem[] | null>(); const childMenu = ref<MenuItem[] | null>();
const childTarget = shallowRef<HTMLElement | null>(); const childTarget = useTemplateRef('childTarget');
function closeChild() { function closeChild() {
childMenu.value = null; childMenu.value = null;

View file

@ -42,7 +42,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, normalizeClass, onMounted, onUnmounted, provide, watch, ref, shallowRef, computed } from 'vue'; import { nextTick, normalizeClass, onMounted, onUnmounted, provide, watch, ref, useTemplateRef, computed } from 'vue';
import type { Keymap } from '@/utility/hotkey.js'; import type { Keymap } from '@/utility/hotkey.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { isTouchUsing } from '@/utility/touch.js'; import { isTouchUsing } from '@/utility/touch.js';
@ -100,8 +100,8 @@ const maxHeight = ref<number>();
const fixed = ref(false); const fixed = ref(false);
const transformOrigin = ref('center'); const transformOrigin = ref('center');
const showing = ref(true); const showing = ref(true);
const modalRootEl = shallowRef<HTMLElement>(); const modalRootEl = useTemplateRef('modalRootEl');
const content = shallowRef<HTMLElement>(); const content = useTemplateRef('content');
const zIndex = os.claimZIndex(props.zPriority); const zIndex = os.claimZIndex(props.zPriority);
const useSendAnime = ref(false); const useSendAnime = ref(false);
const type = computed<ModalTypes>(() => { const type = computed<ModalTypes>(() => {

View file

@ -22,7 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, shallowRef, ref } from 'vue'; import { onMounted, onUnmounted, useTemplateRef, ref } from 'vue';
import MkModal from './MkModal.vue'; import MkModal from './MkModal.vue';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@ -47,9 +47,9 @@ const emit = defineEmits<{
(event: 'esc'): void; (event: 'esc'): void;
}>(); }>();
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
const headerEl = shallowRef<HTMLElement>(); const headerEl = useTemplateRef('headerEl');
const bodyWidth = ref(0); const bodyWidth = ref(0);
const bodyHeight = ref(0); const bodyHeight = ref(0);

View file

@ -178,7 +178,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, onMounted, ref, shallowRef, watch, provide } from 'vue'; import { computed, inject, onMounted, ref, useTemplateRef, watch, provide } from 'vue';
import * as mfm from 'mfm-js'; import * as mfm from 'mfm-js';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { isLink } from '@@/js/is-link.js'; import { isLink } from '@@/js/is-link.js';
@ -271,14 +271,14 @@ if (noteViewInterruptors.length > 0) {
const isRenote = Misskey.note.isPureRenote(note.value); const isRenote = Misskey.note.isPureRenote(note.value);
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
const menuButton = shallowRef<HTMLElement>(); const menuButton = useTemplateRef('menuButton');
const renoteButton = shallowRef<HTMLElement>(); const renoteButton = useTemplateRef('renoteButton');
const renoteTime = shallowRef<HTMLElement>(); const renoteTime = useTemplateRef('renoteTime');
const reactButton = shallowRef<HTMLElement>(); const reactButton = useTemplateRef('reactButton');
const clipButton = shallowRef<HTMLElement>(); const clipButton = useTemplateRef('clipButton');
const appearNote = computed(() => getAppearNote(note.value)); const appearNote = computed(() => getAppearNote(note.value));
const galleryEl = shallowRef<InstanceType<typeof MkMediaList>>(); const galleryEl = useTemplateRef('galleryEl');
const isMyRenote = $i && ($i.id === note.value.userId); const isMyRenote = $i && ($i.id === note.value.userId);
const showContent = ref(false); const showContent = ref(false);
const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null); const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null);

View file

@ -211,7 +211,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, onMounted, provide, ref, shallowRef } from 'vue'; import { computed, inject, onMounted, provide, ref, useTemplateRef } from 'vue';
import * as mfm from 'mfm-js'; import * as mfm from 'mfm-js';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { isLink } from '@@/js/is-link.js'; import { isLink } from '@@/js/is-link.js';
@ -290,14 +290,14 @@ if (noteViewInterruptors.length > 0) {
const isRenote = Misskey.note.isPureRenote(note.value); const isRenote = Misskey.note.isPureRenote(note.value);
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
const menuButton = shallowRef<HTMLElement>(); const menuButton = useTemplateRef('menuButton');
const renoteButton = shallowRef<HTMLElement>(); const renoteButton = useTemplateRef('renoteButton');
const renoteTime = shallowRef<HTMLElement>(); const renoteTime = useTemplateRef('renoteTime');
const reactButton = shallowRef<HTMLElement>(); const reactButton = useTemplateRef('reactButton');
const clipButton = shallowRef<HTMLElement>(); const clipButton = useTemplateRef('clipButton');
const appearNote = computed(() => getAppearNote(note.value)); const appearNote = computed(() => getAppearNote(note.value));
const galleryEl = shallowRef<InstanceType<typeof MkMediaList>>(); const galleryEl = useTemplateRef('galleryEl');
const isMyRenote = $i && ($i.id === note.value.userId); const isMyRenote = $i && ($i.id === note.value.userId);
const showContent = ref(false); const showContent = ref(false);
const isDeleted = ref(false); const isDeleted = ref(false);

View file

@ -32,7 +32,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef } from 'vue'; import { useTemplateRef } from 'vue';
import type { Paging } from '@/components/MkPagination.vue'; import type { Paging } from '@/components/MkPagination.vue';
import MkNote from '@/components/MkNote.vue'; import MkNote from '@/components/MkNote.vue';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue'; import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
@ -46,7 +46,7 @@ const props = defineProps<{
disableAutoLoad?: boolean; disableAutoLoad?: boolean;
}>(); }>();
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>(); const pagingComponent = useTemplateRef('pagingComponent');
defineExpose({ defineExpose({
pagingComponent, pagingComponent,

View file

@ -30,13 +30,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef } from 'vue'; import { ref, useTemplateRef } from 'vue';
import type { Ref } from 'vue'; import { notificationTypes } from '@@/js/const.js';
import MkSwitch from './MkSwitch.vue'; import MkSwitch from './MkSwitch.vue';
import MkInfo from './MkInfo.vue'; import MkInfo from './MkInfo.vue';
import MkButton from './MkButton.vue'; import MkButton from './MkButton.vue';
import type { Ref } from 'vue';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
import { notificationTypes } from '@@/js/const.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
type TypesMap = Record<typeof notificationTypes[number], Ref<boolean>>; type TypesMap = Record<typeof notificationTypes[number], Ref<boolean>>;
@ -52,7 +52,7 @@ const props = withDefaults(defineProps<{
excludeTypes: () => [], excludeTypes: () => [],
}); });
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
const typesMap = notificationTypes.reduce((p, t) => ({ ...p, [t]: ref<boolean>(!props.excludeTypes.includes(t)) }), {} as TypesMap); const typesMap = notificationTypes.reduce((p, t) => ({ ...p, [t]: ref<boolean>(!props.excludeTypes.includes(t)) }), {} as TypesMap);

View file

@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onUnmounted, onDeactivated, onMounted, computed, shallowRef, onActivated } from 'vue'; import { onUnmounted, onDeactivated, onMounted, computed, useTemplateRef, onActivated } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import type { notificationTypes } from '@@/js/const.js'; import type { notificationTypes } from '@@/js/const.js';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
@ -41,7 +41,7 @@ const props = defineProps<{
excludeTypes?: typeof notificationTypes[number][]; excludeTypes?: typeof notificationTypes[number][];
}>(); }>();
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>(); const pagingComponent = useTemplateRef('pagingComponent');
const pagination = computed(() => prefer.r.useGroupedNotifications.value ? { const pagination = computed(() => prefer.r.useGroupedNotifications.value ? {
endpoint: 'i/notifications-grouped' as const, endpoint: 'i/notifications-grouped' as const,

View file

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, shallowRef, ref } from 'vue'; import { onMounted, onUnmounted, useTemplateRef, ref } from 'vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@ -22,7 +22,7 @@ const props = withDefaults(defineProps<{
maxHeight: 200, maxHeight: 200,
}); });
const content = shallowRef<HTMLElement>(); const content = useTemplateRef('content');
const omitted = ref(false); const omitted = ref(false);
const ignoreOmit = ref(false); const ignoreOmit = ref(false);

View file

@ -30,7 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onMounted, onUnmounted, provide, ref, shallowRef } from 'vue'; import { computed, onMounted, onUnmounted, provide, ref, useTemplateRef } from 'vue';
import { url } from '@@/js/config.js'; import { url } from '@@/js/config.js';
import type { PageMetadata } from '@/page.js'; import type { PageMetadata } from '@/page.js';
import RouterView from '@/components/global/RouterView.vue'; import RouterView from '@/components/global/RouterView.vue';
@ -57,7 +57,7 @@ const emit = defineEmits<{
const windowRouter = createRouter(props.initialPath); const windowRouter = createRouter(props.initialPath);
const pageMetadata = ref<null | PageMetadata>(null); const pageMetadata = ref<null | PageMetadata>(null);
const windowEl = shallowRef<InstanceType<typeof MkWindow>>(); const windowEl = useTemplateRef('windowEl');
const history = ref<{ path: string; }[]>([{ const history = ref<{ path: string; }[]>([{
path: windowRouter.getCurrentFullPath(), path: windowRouter.getCurrentFullPath(),
}]); }]);

View file

@ -43,7 +43,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts"> <script lang="ts">
import { computed, isRef, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onDeactivated, ref, shallowRef, watch } from 'vue'; import { computed, isRef, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onDeactivated, ref, useTemplateRef, watch } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { useDocumentVisibility } from '@@/js/use-document-visibility.js'; import { useDocumentVisibility } from '@@/js/use-document-visibility.js';
import { onScrollTop, isTopVisible, getBodyScrollHeight, getScrollContainer, onScrollBottom, scrollToBottom, scroll, isBottomVisible } from '@@/js/scroll.js'; import { onScrollTop, isTopVisible, getBodyScrollHeight, getScrollContainer, onScrollBottom, scrollToBottom, scroll, isBottomVisible } from '@@/js/scroll.js';
@ -106,7 +106,7 @@ const emit = defineEmits<{
(ev: 'status', error: boolean): void; (ev: 'status', error: boolean): void;
}>(); }>();
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
// //
const backed = ref(false); const backed = ref(false);

View file

@ -39,7 +39,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef, ref } from 'vue'; import { onMounted, useTemplateRef, ref } from 'vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
@ -54,8 +54,8 @@ const emit = defineEmits<{
(ev: 'cancelled'): void; (ev: 'cancelled'): void;
}>(); }>();
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
const passwordInput = shallowRef<InstanceType<typeof MkInput>>(); const passwordInput = useTemplateRef('passwordInput');
const password = ref(''); const password = ref('');
const isBackupCode = ref(false); const isBackupCode = ref(false);
const token = ref<string | null>(null); const token = ref<string | null>(null);

View file

@ -10,7 +10,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef } from 'vue'; import { ref, useTemplateRef } from 'vue';
import MkModal from './MkModal.vue'; import MkModal from './MkModal.vue';
import MkMenu from './MkMenu.vue'; import MkMenu from './MkMenu.vue';
import type { MenuItem } from '@/types/menu.js'; import type { MenuItem } from '@/types/menu.js';
@ -28,7 +28,7 @@ const emit = defineEmits<{
(ev: 'closing'): void; (ev: 'closing'): void;
}>(); }>();
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
const manualShowing = ref(true); const manualShowing = ref(true);
const hiding = ref(false); const hiding = ref(false);

View file

@ -99,7 +99,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { inject, watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed } from 'vue'; import { inject, watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed, useTemplateRef } from 'vue';
import * as mfm from 'mfm-js'; import * as mfm from 'mfm-js';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import insertTextAtCursor from 'insert-text-at-cursor'; import insertTextAtCursor from 'insert-text-at-cursor';
@ -165,11 +165,11 @@ const emit = defineEmits<{
(ev: 'fileChangeSensitive', fileId: string, to: boolean): void; (ev: 'fileChangeSensitive', fileId: string, to: boolean): void;
}>(); }>();
const textareaEl = shallowRef<HTMLTextAreaElement | null>(null); const textareaEl = useTemplateRef('textareaEl');
const cwInputEl = shallowRef<HTMLInputElement | null>(null); const cwInputEl = useTemplateRef('cwInputEl');
const hashtagsInputEl = shallowRef<HTMLInputElement | null>(null); const hashtagsInputEl = useTemplateRef('hashtagsInputEl');
const visibilityButton = shallowRef<HTMLElement>(); const visibilityButton = useTemplateRef('visibilityButton');
const otherSettingsButton = shallowRef<HTMLElement>(); const otherSettingsButton = useTemplateRef('otherSettingsButton');
const posting = ref(false); const posting = ref(false);
const posted = ref(false); const posted = ref(false);

View file

@ -25,10 +25,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef } from 'vue'; import { useTemplateRef } from 'vue';
import type { PostFormProps } from '@/types/post-form.js';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import MkPostForm from '@/components/MkPostForm.vue'; import MkPostForm from '@/components/MkPostForm.vue';
import type { PostFormProps } from '@/types/post-form.js';
const props = withDefaults(defineProps<PostFormProps & { const props = withDefaults(defineProps<PostFormProps & {
instant?: boolean; instant?: boolean;
@ -42,8 +42,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
const form = shallowRef<InstanceType<typeof MkPostForm>>();
function onPosted() { function onPosted() {
modal.value?.close({ modal.value?.close({

View file

@ -23,9 +23,9 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, ref, shallowRef } from 'vue'; import { onMounted, onUnmounted, ref, useTemplateRef } from 'vue';
import { i18n } from '@/i18n.js';
import { getScrollContainer } from '@@/js/scroll.js'; import { getScrollContainer } from '@@/js/scroll.js';
import { i18n } from '@/i18n.js';
import { isHorizontalSwipeSwiping } from '@/utility/touch.js'; import { isHorizontalSwipeSwiping } from '@/utility/touch.js';
const SCROLL_STOP = 10; const SCROLL_STOP = 10;
@ -43,7 +43,7 @@ const pullDistance = ref(0);
let supportPointerDesktop = false; let supportPointerDesktop = false;
let startScreenY: number | null = null; let startScreenY: number | null = null;
const rootEl = shallowRef<HTMLDivElement>(); const rootEl = useTemplateRef('rootEl');
let scrollEl: HTMLElement | null = null; let scrollEl: HTMLElement | null = null;
let disabled = false; let disabled = false;

View file

@ -33,7 +33,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, defineAsyncComponent, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'; import { computed, defineAsyncComponent, onMounted, onUnmounted, ref, useTemplateRef, watch } from 'vue';
import { isTouchUsing } from '@/utility/touch.js'; import { isTouchUsing } from '@/utility/touch.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -58,8 +58,8 @@ const emit = defineEmits<{
(ev: 'dragEnded', value: number): void; (ev: 'dragEnded', value: number): void;
}>(); }>();
const containerEl = shallowRef<HTMLElement>(); const containerEl = useTemplateRef('containerEl');
const thumbEl = shallowRef<HTMLElement>(); const thumbEl = useTemplateRef('thumbEl');
const rawValue = ref((props.modelValue - props.min) / (props.max - props.min)); const rawValue = ref((props.modelValue - props.min) / (props.max - props.min));
const steppedRawValue = computed(() => { const steppedRawValue = computed(() => {

View file

@ -9,7 +9,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { defineAsyncComponent, shallowRef } from 'vue'; import { defineAsyncComponent, useTemplateRef } from 'vue';
import { useTooltip } from '@/use/use-tooltip.js'; import { useTooltip } from '@/use/use-tooltip.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -20,7 +20,7 @@ const props = defineProps<{
withTooltip?: boolean; withTooltip?: boolean;
}>(); }>();
const elRef = shallowRef(); const elRef = useTemplateRef('elRef');
if (props.withTooltip) { if (props.withTooltip) {
useTooltip(elRef, (showing) => { useTooltip(elRef, (showing) => {

View file

@ -18,7 +18,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, onMounted, shallowRef, watch } from 'vue'; import { computed, inject, onMounted, useTemplateRef, watch } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { getUnicodeEmoji } from '@@/js/emojilist.js'; import { getUnicodeEmoji } from '@@/js/emojilist.js';
import MkCustomEmojiDetailedDialog from './MkCustomEmojiDetailedDialog.vue'; import MkCustomEmojiDetailedDialog from './MkCustomEmojiDetailedDialog.vue';
@ -50,7 +50,7 @@ const emit = defineEmits<{
(ev: 'reactionToggled', emoji: string, newCount: number): void; (ev: 'reactionToggled', emoji: string, newCount: number): void;
}>(); }>();
const buttonEl = shallowRef<HTMLElement>(); const buttonEl = useTemplateRef('buttonEl');
const emojiName = computed(() => props.reaction.replace(/:/g, '').replace(/@\./, '')); const emojiName = computed(() => props.reaction.replace(/:/g, '').replace(/@\./, ''));
const emoji = computed(() => customEmojisMap.get(emojiName.value) ?? getUnicodeEmoji(props.reaction)); const emoji = computed(() => customEmojisMap.get(emojiName.value) ?? getUnicodeEmoji(props.reaction));

View file

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, nextTick, shallowRef, ref } from 'vue'; import { onMounted, nextTick, useTemplateRef, ref } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
import { store } from '@/store.js'; import { store } from '@/store.js';
@ -23,8 +23,8 @@ import { initChart } from '@/utility/init-chart.js';
initChart(); initChart();
const rootEl = shallowRef<HTMLDivElement | null>(null); const rootEl = useTemplateRef('rootEl');
const chartEl = shallowRef<HTMLCanvasElement | null>(null); const chartEl = useTemplateRef('chartEl');
let chartInstance: Chart | null = null; let chartInstance: Chart | null = null;
const fetching = ref(true); const fetching = ref(true);

View file

@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef } from 'vue'; import { onMounted, useTemplateRef } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import { store } from '@/store.js'; import { store } from '@/store.js';
@ -20,7 +20,7 @@ import { misskeyApi } from '@/utility/misskey-api.js';
initChart(); initChart();
const chartEl = shallowRef<HTMLCanvasElement | null>(null); const chartEl = useTemplateRef('chartEl');
const { handler: externalTooltipHandler } = useChartTooltip(); const { handler: externalTooltipHandler } = useChartTooltip();

View file

@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { shallowRef } from 'vue'; import { useTemplateRef } from 'vue';
import type { OpenOnRemoteOptions } from '@/utility/please-login.js'; import type { OpenOnRemoteOptions } from '@/utility/please-login.js';
import MkSignin from '@/components/MkSignin.vue'; import MkSignin from '@/components/MkSignin.vue';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
@ -46,7 +46,7 @@ const emit = defineEmits<{
(ev: 'cancelled'): void; (ev: 'cancelled'): void;
}>(); }>();
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
function onClose() { function onClose() {
emit('cancelled'); emit('cancelled');

View file

@ -33,7 +33,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef, ref } from 'vue'; import { useTemplateRef, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import XSignup from '@/components/MkSignupDialog.form.vue'; import XSignup from '@/components/MkSignupDialog.form.vue';
import XServerRules from '@/components/MkSignupDialog.rules.vue'; import XServerRules from '@/components/MkSignupDialog.rules.vue';
@ -52,7 +52,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
const isAcceptedServerRule = ref(false); const isAcceptedServerRule = ref(false);

View file

@ -56,7 +56,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, ref, shallowRef } from 'vue'; import { onMounted, onUnmounted, ref, useTemplateRef } from 'vue';
const particles = ref<{ const particles = ref<{
id: string, id: string,
@ -66,7 +66,7 @@ const particles = ref<{
dur: number, dur: number,
color: string color: string
}[]>([]); }[]>([]);
const el = shallowRef<HTMLElement>(); const el = useTemplateRef('el');
const width = ref(0); const width = ref(0);
const height = ref(0); const height = ref(0);
const colors = ['#FF1493', '#00FFFF', '#FFE202', '#FFE202', '#FFE202']; const colors = ['#FF1493', '#00FFFF', '#FFE202', '#FFE202', '#FFE202'];

View file

@ -92,15 +92,15 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, onMounted, ref, shallowRef, toRefs } from 'vue'; import { computed, onMounted, ref, useTemplateRef, toRefs } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import type { import type {
MkSystemWebhookEditorProps, MkSystemWebhookEditorProps,
MkSystemWebhookResult, MkSystemWebhookResult,
SystemWebhookEventType, SystemWebhookEventType,
} from '@/components/MkSystemWebhookEditor.impl.js'; } from '@/components/MkSystemWebhookEditor.impl.js';
import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
@ -122,7 +122,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const dialogEl = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialogEl = useTemplateRef('dialogEl');
const props = defineProps<MkSystemWebhookEditorProps>(); const props = defineProps<MkSystemWebhookEditorProps>();

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, watch, onBeforeUnmount, ref, shallowRef } from 'vue'; import { onMounted, watch, onBeforeUnmount, ref, useTemplateRef } from 'vue';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
const loaded = !!window.TagCanvas; const loaded = !!window.TagCanvas;
@ -24,9 +24,9 @@ const computedStyle = getComputedStyle(document.documentElement);
const idForCanvas = Array.from({ length: 16 }, () => SAFE_FOR_HTML_ID[Math.floor(Math.random() * SAFE_FOR_HTML_ID.length)]).join(''); const idForCanvas = Array.from({ length: 16 }, () => SAFE_FOR_HTML_ID[Math.floor(Math.random() * SAFE_FOR_HTML_ID.length)]).join('');
const idForTags = Array.from({ length: 16 }, () => SAFE_FOR_HTML_ID[Math.floor(Math.random() * SAFE_FOR_HTML_ID.length)]).join(''); const idForTags = Array.from({ length: 16 }, () => SAFE_FOR_HTML_ID[Math.floor(Math.random() * SAFE_FOR_HTML_ID.length)]).join('');
const available = ref(false); const available = ref(false);
const rootEl = shallowRef<HTMLElement | null>(null); const rootEl = useTemplateRef('rootEl');
const canvasEl = shallowRef<HTMLCanvasElement | null>(null); const canvasEl = useTemplateRef('canvasEl');
const tagsEl = shallowRef<HTMLElement | null>(null); const tagsEl = useTemplateRef('tagsEl');
const width = ref(300); const width = ref(300);
watch(available, () => { watch(available, () => {

View file

@ -36,7 +36,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, nextTick, ref, watch, computed, toRefs, shallowRef } from 'vue'; import { onMounted, onUnmounted, nextTick, ref, watch, computed, toRefs, useTemplateRef } from 'vue';
import { debounce } from 'throttle-debounce'; import { debounce } from 'throttle-debounce';
import type { SuggestionType } from '@/utility/autocomplete.js'; import type { SuggestionType } from '@/utility/autocomplete.js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
@ -75,7 +75,7 @@ const focused = ref(false);
const changed = ref(false); const changed = ref(false);
const invalid = ref(false); const invalid = ref(false);
const filled = computed(() => v.value !== '' && v.value != null); const filled = computed(() => v.value !== '' && v.value != null);
const inputEl = shallowRef<HTMLTextAreaElement>(); const inputEl = useTemplateRef('inputEl');
const preview = ref(false); const preview = ref(false);
let autocompleteWorker: Autocomplete | null = null; let autocompleteWorker: Autocomplete | null = null;

View file

@ -17,7 +17,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, watch, onUnmounted, provide, ref, shallowRef } from 'vue'; import { computed, watch, onUnmounted, provide, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import type { BasicTimelineType } from '@/timelines.js'; import type { BasicTimelineType } from '@/timelines.js';
import type { Paging } from '@/components/MkPagination.vue'; import type { Paging } from '@/components/MkPagination.vue';
@ -67,8 +67,8 @@ type TimelineQueryType = {
roleId?: string roleId?: string
}; };
const prComponent = shallowRef<InstanceType<typeof MkPullToRefresh>>(); const prComponent = useTemplateRef('prComponent');
const tlComponent = shallowRef<InstanceType<typeof MkNotes>>(); const tlComponent = useTemplateRef('tlComponent');
let tlNotesCount = 0; let tlNotesCount = 0;

View file

@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { shallowRef, ref } from 'vue'; import { useTemplateRef, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkInput from './MkInput.vue'; import MkInput from './MkInput.vue';
import MkSwitch from './MkSwitch.vue'; import MkSwitch from './MkSwitch.vue';
@ -77,7 +77,7 @@ const emit = defineEmits<{
const defaultPermissions = Misskey.permissions.filter(p => !p.startsWith('read:admin') && !p.startsWith('write:admin')); const defaultPermissions = Misskey.permissions.filter(p => !p.startsWith('read:admin') && !p.startsWith('write:admin'));
const adminPermissions = Misskey.permissions.filter(p => p.startsWith('read:admin') || p.startsWith('write:admin')); const adminPermissions = Misskey.permissions.filter(p => p.startsWith('read:admin') || p.startsWith('write:admin'));
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
const name = ref(props.initialName); const name = ref(props.initialName);
const permissionSwitches = ref({} as Record<(typeof Misskey.permissions)[number], boolean>); const permissionSwitches = ref({} as Record<(typeof Misskey.permissions)[number], boolean>);
const permissionSwitchesForAdmin = ref({} as Record<(typeof Misskey.permissions)[number], boolean>); const permissionSwitchesForAdmin = ref({} as Record<(typeof Misskey.permissions)[number], boolean>);

View file

@ -23,7 +23,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted, onUnmounted, shallowRef } from 'vue'; import { nextTick, onMounted, onUnmounted, useTemplateRef } from 'vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { calcPopupPosition } from '@/utility/popup-position.js'; import { calcPopupPosition } from '@/utility/popup-position.js';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
@ -51,7 +51,7 @@ const emit = defineEmits<{
// showing = false closed DOM // showing = false closed DOM
if (!props.showing) emit('closed'); if (!props.showing) emit('closed');
const el = shallowRef<HTMLElement>(); const el = useTemplateRef('el');
const zIndex = os.claimZIndex('high'); const zIndex = os.claimZIndex('high');
function setPosition() { function setPosition() {

View file

@ -148,7 +148,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, watch } from 'vue'; import { ref, useTemplateRef, watch } from 'vue';
import { host } from '@@/js/config.js';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import XNote from '@/components/MkTutorialDialog.Note.vue'; import XNote from '@/components/MkTutorialDialog.Note.vue';
@ -158,7 +159,6 @@ import XSensitive from '@/components/MkTutorialDialog.Sensitive.vue';
import MkAnimBg from '@/components/MkAnimBg.vue'; import MkAnimBg from '@/components/MkAnimBg.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { host } from '@@/js/config.js';
import { claimAchievement } from '@/utility/achievements.js'; import { claimAchievement } from '@/utility/achievements.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -170,7 +170,7 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
// eslint-disable-next-line vue/no-setup-props-reactivity-loss // eslint-disable-next-line vue/no-setup-props-reactivity-loss
const page = ref(props.initialPage ?? 0); const page = ref(props.initialPage ?? 0);

View file

@ -15,15 +15,15 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef } from 'vue'; import { onMounted, useTemplateRef } from 'vue';
import { version } from '@@/js/config.js';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkSparkle from '@/components/MkSparkle.vue'; import MkSparkle from '@/components/MkSparkle.vue';
import { version } from '@@/js/config.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { confetti } from '@/utility/confetti.js'; import { confetti } from '@/utility/confetti.js';
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
function whatIsNew() { function whatIsNew() {
modal.value?.close(); modal.value?.close();

View file

@ -61,7 +61,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, computed, shallowRef } from 'vue'; import { onMounted, ref, computed, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { host as currentHost, hostname } from '@@/js/config.js'; import { host as currentHost, hostname } from '@@/js/config.js';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
@ -94,7 +94,7 @@ const host = ref('');
const users = ref<Misskey.entities.UserLite[]>([]); const users = ref<Misskey.entities.UserLite[]>([]);
const recentUsers = ref<Misskey.entities.UserDetailed[]>([]); const recentUsers = ref<Misskey.entities.UserDetailed[]>([]);
const selected = ref<Misskey.entities.UserLite | null>(null); const selected = ref<Misskey.entities.UserLite | null>(null);
const dialogEl = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialogEl = useTemplateRef('dialogEl');
function search() { function search() {
if (username.value === '' && host.value === '') { if (username.value === '' && host.value === '') {

View file

@ -128,7 +128,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, shallowRef, watch, nextTick, defineAsyncComponent } from 'vue'; import { ref, useTemplateRef, watch, nextTick, defineAsyncComponent } from 'vue';
import { host } from '@@/js/config.js';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import XProfile from '@/components/MkUserSetupDialog.Profile.vue'; import XProfile from '@/components/MkUserSetupDialog.Profile.vue';
@ -137,7 +138,6 @@ import XPrivacy from '@/components/MkUserSetupDialog.Privacy.vue';
import MkAnimBg from '@/components/MkAnimBg.vue'; import MkAnimBg from '@/components/MkAnimBg.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { instance } from '@/instance.js'; import { instance } from '@/instance.js';
import { host } from '@@/js/config.js';
import MkPushNotificationAllowButton from '@/components/MkPushNotificationAllowButton.vue'; import MkPushNotificationAllowButton from '@/components/MkPushNotificationAllowButton.vue';
import { store } from '@/store.js'; import { store } from '@/store.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -146,9 +146,8 @@ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;
}>(); }>();
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialog = useTemplateRef('dialog');
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
const page = ref(store.s.accountSetupWizard); const page = ref(store.s.accountSetupWizard);
watch(page, () => { watch(page, () => {

View file

@ -42,12 +42,12 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, shallowRef, ref } from 'vue'; import { nextTick, useTemplateRef, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
currentVisibility: typeof Misskey.noteVisibilities[number]; currentVisibility: typeof Misskey.noteVisibilities[number];

View file

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef, ref, nextTick } from 'vue'; import { onMounted, useTemplateRef, ref, nextTick } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import gradient from 'chartjs-plugin-gradient'; import gradient from 'chartjs-plugin-gradient';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
@ -25,7 +25,7 @@ import { initChart } from '@/utility/init-chart.js';
initChart(); initChart();
const chartEl = shallowRef<HTMLCanvasElement | null>(null); const chartEl = useTemplateRef('chartEl');
const now = new Date(); const now = new Date();
let chartInstance: Chart | null = null; let chartInstance: Chart | null = null;
const chartLimit = 30; const chartLimit = 30;

View file

@ -14,10 +14,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { watch, shallowRef } from 'vue'; import { watch, useTemplateRef } from 'vue';
import MkModal from '@/components/MkModal.vue'; import MkModal from '@/components/MkModal.vue';
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = useTemplateRef('modal');
const props = defineProps<{ const props = defineProps<{
success: boolean; success: boolean;

View file

@ -53,7 +53,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onBeforeUnmount, onMounted, provide, shallowRef, ref } from 'vue'; import { onBeforeUnmount, onMounted, provide, useTemplateRef, ref } from 'vue';
import type { MenuItem } from '@/types/menu.js'; import type { MenuItem } from '@/types/menu.js';
import contains from '@/utility/contains.js'; import contains from '@/utility/contains.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -114,7 +114,7 @@ const emit = defineEmits<{
provide('inWindow', true); provide('inWindow', true);
const rootEl = shallowRef<HTMLElement | null>(); const rootEl = useTemplateRef('rootEl');
const showing = ref(true); const showing = ref(true);
let beforeClickedAt = 0; let beforeClickedAt = 0;
const maximized = ref(false); const maximized = ref(false);

View file

@ -14,7 +14,7 @@ export type MkABehavior = 'window' | 'browser' | null;
</script> </script>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, inject, shallowRef } from 'vue'; import { computed, inject, useTemplateRef } from 'vue';
import { url } from '@@/js/config.js'; import { url } from '@@/js/config.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { copyToClipboard } from '@/utility/copy-to-clipboard.js'; import { copyToClipboard } from '@/utility/copy-to-clipboard.js';
@ -32,7 +32,7 @@ const props = withDefaults(defineProps<{
const behavior = props.behavior ?? inject<MkABehavior>('linkNavigationBehavior', null); const behavior = props.behavior ?? inject<MkABehavior>('linkNavigationBehavior', null);
const el = shallowRef<HTMLElement>(); const el = useTemplateRef('el');
defineExpose({ $el: el }); defineExpose({ $el: el });

View file

@ -11,9 +11,9 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted, onActivated, onBeforeUnmount, ref, shallowRef } from 'vue'; import { nextTick, onMounted, onActivated, onBeforeUnmount, ref, useTemplateRef } from 'vue';
const rootEl = shallowRef<HTMLDivElement>(); const rootEl = useTemplateRef('rootEl');
const showing = ref(false); const showing = ref(false);
const observer = new IntersectionObserver( const observer = new IntersectionObserver(

View file

@ -53,7 +53,7 @@ export type Tab = {
</script> </script>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted, onUnmounted, shallowRef, watch } from 'vue'; import { nextTick, onMounted, onUnmounted, useTemplateRef, watch } from 'vue';
import { prefer } from '@/preferences.js'; import { prefer } from '@/preferences.js';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@ -69,9 +69,9 @@ const emit = defineEmits<{
(ev: 'tabClick', key: string); (ev: 'tabClick', key: string);
}>(); }>();
const el = shallowRef<HTMLElement | null>(null); const el = useTemplateRef('el');
const tabHighlightEl = useTemplateRef('tabHighlightEl');
const tabRefs: Record<string, HTMLElement | null> = {}; const tabRefs: Record<string, HTMLElement | null> = {};
const tabHighlightEl = shallowRef<HTMLElement | null>(null);
function onTabMousedown(tab: Tab, ev: MouseEvent): void { function onTabMousedown(tab: Tab, ev: MouseEvent): void {
// mousedownonClick // mousedownonClick

View file

@ -41,7 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, ref, inject, shallowRef, computed } from 'vue'; import { onMounted, onUnmounted, ref, inject, useTemplateRef, computed } from 'vue';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import { scrollToTop } from '@@/js/scroll.js'; import { scrollToTop } from '@@/js/scroll.js';
import XTabs from './MkPageHeader.tabs.vue'; import XTabs from './MkPageHeader.tabs.vue';
@ -75,7 +75,7 @@ const pageMetadata = computed(() => props.overridePageMetadata ?? injectedPageMe
const hideTitle = computed(() => inject('shouldOmitHeaderTitle', false) || props.hideTitle); const hideTitle = computed(() => inject('shouldOmitHeaderTitle', false) || props.hideTitle);
const thin_ = props.thin || inject('shouldHeaderThin', false); const thin_ = props.thin || inject('shouldHeaderThin', false);
const el = shallowRef<HTMLElement | undefined>(undefined); const el = useTemplateRef('el');
const bg = ref<string | undefined>(undefined); const bg = ref<string | undefined>(undefined);
const narrow = ref(false); const narrow = ref(false);
const hasTabs = computed(() => props.tabs.length > 0); const hasTabs = computed(() => props.tabs.length > 0);

View file

@ -23,9 +23,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, onUnmounted, provide, inject, ref, watch, useTemplateRef } from 'vue'; import { onMounted, onUnmounted, provide, inject, ref, watch, useTemplateRef } from 'vue';
import type { Ref } from 'vue';
import { CURRENT_STICKY_BOTTOM, CURRENT_STICKY_TOP } from '@@/js/const.js'; import { CURRENT_STICKY_BOTTOM, CURRENT_STICKY_TOP } from '@@/js/const.js';
import type { Ref } from 'vue';
const rootEl = useTemplateRef('rootEl'); const rootEl = useTemplateRef('rootEl');
const headerEl = useTemplateRef('headerEl'); const headerEl = useTemplateRef('headerEl');

View file

@ -39,10 +39,12 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ cell.value }} {{ cell.value }}
</div> </div>
<div v-else-if="cellType === 'boolean'"> <div v-else-if="cellType === 'boolean'">
<div :class="[$style.bool, { <div
:class="[$style.bool, {
[$style.boolTrue]: cell.value === true, [$style.boolTrue]: cell.value === true,
'ti ti-check': cell.value === true, 'ti ti-check': cell.value === true,
}]"></div> }]"
></div>
</div> </div>
<div v-else-if="cellType === 'image'"> <div v-else-if="cellType === 'image'">
<img <img
@ -88,14 +90,14 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, shallowRef, toRefs, watch } from 'vue'; import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, useTemplateRef, toRefs, watch } from 'vue';
import type { Size } from '@/components/grid/grid.js';
import type { CellValue, GridCell } from '@/components/grid/cell.js';
import type { GridRowSetting } from '@/components/grid/row.js';
import { GridEventEmitter } from '@/components/grid/grid.js'; import { GridEventEmitter } from '@/components/grid/grid.js';
import { useTooltip } from '@/use/use-tooltip.js'; import { useTooltip } from '@/use/use-tooltip.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { equalCellAddress, getCellAddress } from '@/components/grid/grid-utils.js'; import { equalCellAddress, getCellAddress } from '@/components/grid/grid-utils.js';
import type { Size } from '@/components/grid/grid.js';
import type { CellValue, GridCell } from '@/components/grid/cell.js';
import type { GridRowSetting } from '@/components/grid/row.js';
const emit = defineEmits<{ const emit = defineEmits<{
(ev: 'operation:beginEdit', sender: GridCell): void; (ev: 'operation:beginEdit', sender: GridCell): void;
@ -111,9 +113,9 @@ const props = defineProps<{
const { cell, bus } = toRefs(props); const { cell, bus } = toRefs(props);
const rootEl = shallowRef<InstanceType<typeof HTMLTableCellElement>>(); const rootEl = useTemplateRef('rootEl');
const contentAreaEl = shallowRef<InstanceType<typeof HTMLDivElement>>(); const contentAreaEl = useTemplateRef('contentAreaEl');
const inputAreaEl = shallowRef<InstanceType<typeof HTMLDivElement>>(); const inputAreaEl = useTemplateRef('inputAreaEl');
/** 値が編集中かどうか */ /** 値が編集中かどうか */
const editing = ref<boolean>(false); const editing = ref<boolean>(false);

View file

@ -134,7 +134,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onBeforeUnmount, ref, shallowRef, computed } from 'vue'; import { nextTick, onBeforeUnmount, ref, useTemplateRef, computed } from 'vue';
import { version } from '@@/js/config.js'; import { version } from '@@/js/config.js';
import FormLink from '@/components/form/link.vue'; import FormLink from '@/components/form/link.vue';
import FormSection from '@/components/form/section.vue'; import FormSection from '@/components/form/section.vue';
@ -403,7 +403,7 @@ const easterEggEmojis = ref<{
emoji: string emoji: string
}[]>([]); }[]>([]);
const easterEggEngine = ref<{ stop: () => void } | null>(null); const easterEggEngine = ref<{ stop: () => void } | null>(null);
const containerEl = shallowRef<HTMLElement>(); const containerEl = useTemplateRef('containerEl');
function iconLoaded() { function iconLoaded() {
const emojis = prefer.s.emojiPalettes[0].emojis; const emojis = prefer.s.emojiPalettes[0].emojis;

View file

@ -33,7 +33,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onMounted, onUnmounted, ref, shallowRef, watch, nextTick, inject } from 'vue'; import { computed, onMounted, onUnmounted, ref, useTemplateRef, watch, nextTick, inject } from 'vue';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import { scrollToTop } from '@@/js/scroll.js'; import { scrollToTop } from '@@/js/scroll.js';
import { popupMenu } from '@/os.js'; import { popupMenu } from '@/os.js';
@ -68,9 +68,9 @@ const emit = defineEmits<{
const pageMetadata = inject(DI.pageMetadata); const pageMetadata = inject(DI.pageMetadata);
const el = shallowRef<HTMLElement>(null); const el = useTemplateRef('el');
const tabHighlightEl = useTemplateRef('tabHighlightEl');
const tabRefs = {}; const tabRefs = {};
const tabHighlightEl = shallowRef<HTMLElement | null>(null);
const bg = ref<string | null>(null); const bg = ref<string | null>(null);
const height = ref(0); const height = ref(0);
const hasTabs = computed(() => { const hasTabs = computed(() => {

View file

@ -71,8 +71,9 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onMounted, ref, shallowRef, toRefs } from 'vue'; import { computed, onMounted, ref, useTemplateRef, toRefs } from 'vue';
import { entities } from 'misskey-js'; import { entities } from 'misskey-js';
import type { MkSystemWebhookResult } from '@/components/MkSystemWebhookEditor.impl.js';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -80,7 +81,6 @@ import MkInput from '@/components/MkInput.vue';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
import MkSelect from '@/components/MkSelect.vue'; import MkSelect from '@/components/MkSelect.vue';
import { showSystemWebhookEditorDialog } from '@/components/MkSystemWebhookEditor.impl.js'; import { showSystemWebhookEditorDialog } from '@/components/MkSystemWebhookEditor.impl.js';
import type { MkSystemWebhookResult } from '@/components/MkSystemWebhookEditor.impl.js';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import MkDivider from '@/components/MkDivider.vue'; import MkDivider from '@/components/MkDivider.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
@ -100,7 +100,7 @@ const props = defineProps<{
const { mode, id } = toRefs(props); const { mode, id } = toRefs(props);
const dialogEl = shallowRef<InstanceType<typeof MkModalWindow>>(); const dialogEl = useTemplateRef('dialogEl');
const loading = ref<number>(0); const loading = ref<number>(0);

View file

@ -59,7 +59,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, shallowRef, ref } from 'vue'; import { computed, useTemplateRef, ref } from 'vue';
import XHeader from './_header_.vue'; import XHeader from './_header_.vue';
import MkSelect from '@/components/MkSelect.vue'; import MkSelect from '@/components/MkSelect.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
@ -70,7 +70,7 @@ import MkButton from '@/components/MkButton.vue';
import MkInfo from '@/components/MkInfo.vue'; import MkInfo from '@/components/MkInfo.vue';
import { store } from '@/store.js'; import { store } from '@/store.js';
const reports = shallowRef<InstanceType<typeof MkPagination>>(); const reports = useTemplateRef('reports');
const state = ref('unresolved'); const state = ref('unresolved');
const reporterOrigin = ref('combined'); const reporterOrigin = ref('combined');

View file

@ -55,8 +55,9 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, shallowRef } from 'vue'; import { computed, ref, useTemplateRef } from 'vue';
import XHeader from './_header_.vue'; import XHeader from './_header_.vue';
import type { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
@ -66,11 +67,10 @@ import MkSelect from '@/components/MkSelect.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
import type { Paging } from '@/components/MkPagination.vue';
import MkInviteCode from '@/components/MkInviteCode.vue'; import MkInviteCode from '@/components/MkInviteCode.vue';
import { definePage } from '@/page.js'; import { definePage } from '@/page.js';
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>(); const pagingComponent = useTemplateRef('pagingComponent');
const type = ref('all'); const type = ref('all');
const sort = ref('+createdAt'); const sort = ref('+createdAt');

View file

@ -30,7 +30,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, shallowRef, ref } from 'vue'; import { computed, useTemplateRef, ref } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import XHeader from './_header_.vue'; import XHeader from './_header_.vue';
import XModLog from './modlog.ModLog.vue'; import XModLog from './modlog.ModLog.vue';
@ -41,7 +41,7 @@ import { i18n } from '@/i18n.js';
import { definePage } from '@/page.js'; import { definePage } from '@/page.js';
import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue'; import MkDateSeparatedList from '@/components/MkDateSeparatedList.vue';
const logs = shallowRef<InstanceType<typeof MkPagination>>(); const logs = useTemplateRef('logs');
const type = ref<string | null>(null); const type = ref<string | null>(null);
const moderatorId = ref(''); const moderatorId = ref('');

View file

@ -13,7 +13,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef, ref } from 'vue'; import { onMounted, useTemplateRef, ref } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import gradient from 'chartjs-plugin-gradient'; import gradient from 'chartjs-plugin-gradient';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
@ -24,7 +24,7 @@ import { initChart } from '@/utility/init-chart.js';
initChart(); initChart();
const chartEl = shallowRef<HTMLCanvasElement>(null); const chartEl = useTemplateRef('chartEl');
const now = new Date(); const now = new Date();
let chartInstance: Chart = null; let chartInstance: Chart = null;
const chartLimit = 7; const chartLimit = 7;

View file

@ -20,7 +20,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef, ref } from 'vue'; import { onMounted, useTemplateRef, ref } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import gradient from 'chartjs-plugin-gradient'; import gradient from 'chartjs-plugin-gradient';
import isChromatic from 'chromatic'; import isChromatic from 'chromatic';
@ -34,8 +34,8 @@ import { initChart } from '@/utility/init-chart.js';
initChart(); initChart();
const chartLimit = 50; const chartLimit = 50;
const chartEl = shallowRef<HTMLCanvasElement>(); const chartEl = useTemplateRef('chartEl');
const chartEl2 = shallowRef<HTMLCanvasElement>(); const chartEl2 = useTemplateRef('chartEl2');
const fetching = ref(true); const fetching = ref(true);
const { handler: externalTooltipHandler } = useChartTooltip(); const { handler: externalTooltipHandler } = useChartTooltip();

View file

@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef } from 'vue'; import { onMounted, useTemplateRef } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import { useChartTooltip } from '@/use/use-chart-tooltip.js'; import { useChartTooltip } from '@/use/use-chart-tooltip.js';
import { initChart } from '@/utility/init-chart.js'; import { initChart } from '@/utility/init-chart.js';
@ -26,7 +26,7 @@ const props = defineProps<{
data: InstanceForPie[]; data: InstanceForPie[];
}>(); }>();
const chartEl = shallowRef<HTMLCanvasElement>(null); const chartEl = useTemplateRef('chartEl');
const { handler: externalTooltipHandler } = useChartTooltip({ const { handler: externalTooltipHandler } = useChartTooltip({
position: 'middle', position: 'middle',

View file

@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef } from 'vue'; import { onMounted, useTemplateRef } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import { store } from '@/store.js'; import { store } from '@/store.js';
import { useChartTooltip } from '@/use/use-chart-tooltip.js'; import { useChartTooltip } from '@/use/use-chart-tooltip.js';
@ -22,7 +22,7 @@ const props = defineProps<{
type: string; type: string;
}>(); }>();
const chartEl = shallowRef<HTMLCanvasElement>(null); const chartEl = useTemplateRef('chartEl');
const { handler: externalTooltipHandler } = useChartTooltip(); const { handler: externalTooltipHandler } = useChartTooltip();

View file

@ -35,7 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { markRaw, onMounted, onUnmounted, ref, shallowRef } from 'vue'; import { markRaw, onMounted, onUnmounted, ref, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import XChart from './overview.queue.chart.vue'; import XChart from './overview.queue.chart.vue';
import type { ApQueueDomain } from '@/pages/admin/queue.vue'; import type { ApQueueDomain } from '@/pages/admin/queue.vue';
@ -48,10 +48,10 @@ const activeSincePrevTick = ref(0);
const active = ref(0); const active = ref(0);
const delayed = ref(0); const delayed = ref(0);
const waiting = ref(0); const waiting = ref(0);
const chartProcess = shallowRef<InstanceType<typeof XChart>>(); const chartProcess = useTemplateRef('chartProcess');
const chartActive = shallowRef<InstanceType<typeof XChart>>(); const chartActive = useTemplateRef('chartActive');
const chartDelayed = shallowRef<InstanceType<typeof XChart>>(); const chartDelayed = useTemplateRef('chartDelayed');
const chartWaiting = shallowRef<InstanceType<typeof XChart>>(); const chartWaiting = useTemplateRef('chartWaiting');
const props = defineProps<{ const props = defineProps<{
domain: ApQueueDomain; domain: ApQueueDomain;

View file

@ -65,7 +65,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { markRaw, onMounted, onBeforeUnmount, nextTick, shallowRef, ref, computed } from 'vue'; import { markRaw, onMounted, onBeforeUnmount, nextTick, shallowRef, ref, computed, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import XFederation from './overview.federation.vue'; import XFederation from './overview.federation.vue';
import XInstances from './overview.instances.vue'; import XInstances from './overview.instances.vue';
@ -85,7 +85,7 @@ import { i18n } from '@/i18n.js';
import { definePage } from '@/page.js'; import { definePage } from '@/page.js';
import MkFoldableSection from '@/components/MkFoldableSection.vue'; import MkFoldableSection from '@/components/MkFoldableSection.vue';
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
const serverInfo = ref<Misskey.entities.ServerInfoResponse | null>(null); const serverInfo = ref<Misskey.entities.ServerInfoResponse | null>(null);
const topSubInstancesForPie = ref<InstanceForPie[] | null>(null); const topSubInstancesForPie = ref<InstanceForPie[] | null>(null);
const topPubInstancesForPie = ref<InstanceForPie[] | null>(null); const topPubInstancesForPie = ref<InstanceForPie[] | null>(null);

View file

@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, shallowRef } from 'vue'; import { onMounted, useTemplateRef } from 'vue';
import { Chart } from 'chart.js'; import { Chart } from 'chart.js';
import { store } from '@/store.js'; import { store } from '@/store.js';
import { useChartTooltip } from '@/use/use-chart-tooltip.js'; import { useChartTooltip } from '@/use/use-chart-tooltip.js';
@ -22,7 +22,7 @@ const props = defineProps<{
type: string; type: string;
}>(); }>();
const chartEl = shallowRef<HTMLCanvasElement>(null); const chartEl = useTemplateRef('chartEl');
const { handler: externalTooltipHandler } = useChartTooltip(); const { handler: externalTooltipHandler } = useChartTooltip();

View file

@ -48,7 +48,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { markRaw, onMounted, onUnmounted, ref, shallowRef } from 'vue'; import { markRaw, onMounted, onUnmounted, ref, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import XChart from './queue.chart.chart.vue'; import XChart from './queue.chart.chart.vue';
import type { ApQueueDomain } from '@/pages/admin/queue.vue'; import type { ApQueueDomain } from '@/pages/admin/queue.vue';
@ -65,10 +65,10 @@ const active = ref(0);
const delayed = ref(0); const delayed = ref(0);
const waiting = ref(0); const waiting = ref(0);
const jobs = ref<Misskey.Endpoints[`admin/queue/${ApQueueDomain}-delayed`]['res']>([]); const jobs = ref<Misskey.Endpoints[`admin/queue/${ApQueueDomain}-delayed`]['res']>([]);
const chartProcess = shallowRef<InstanceType<typeof XChart>>(); const chartProcess = useTemplateRef('chartProcess');
const chartActive = shallowRef<InstanceType<typeof XChart>>(); const chartActive = useTemplateRef('chartActive');
const chartDelayed = shallowRef<InstanceType<typeof XChart>>(); const chartDelayed = useTemplateRef('chartDelayed');
const chartWaiting = shallowRef<InstanceType<typeof XChart>>(); const chartWaiting = useTemplateRef('chartWaiting');
const props = defineProps<{ const props = defineProps<{
domain: ApQueueDomain; domain: ApQueueDomain;

View file

@ -60,7 +60,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, shallowRef, ref, watchEffect } from 'vue'; import { computed, useTemplateRef, ref, watchEffect } from 'vue';
import XHeader from './_header_.vue'; import XHeader from './_header_.vue';
import { defaultMemoryStorage } from '@/memory-storage'; import { defaultMemoryStorage } from '@/memory-storage';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
@ -82,7 +82,7 @@ type SearchQuery = {
hostname?: string; hostname?: string;
}; };
const paginationComponent = shallowRef<InstanceType<typeof MkPagination>>(); const paginationComponent = useTemplateRef('paginationComponent');
const storedQuery = JSON.parse(defaultMemoryStorage.getItem('admin-users-query') ?? '{}') as SearchQuery; const storedQuery = JSON.parse(defaultMemoryStorage.getItem('admin-users-query') ?? '{}') as SearchQuery;
const sort = ref(storedQuery.sort ?? '+createdAt'); const sort = ref(storedQuery.sort ?? '+createdAt');

View file

@ -24,10 +24,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, watch, ref, shallowRef } from 'vue'; import { computed, watch, ref, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import MkTimeline from '@/components/MkTimeline.vue';
import { scroll } from '@@/js/scroll.js'; import { scroll } from '@@/js/scroll.js';
import MkTimeline from '@/components/MkTimeline.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { misskeyApi } from '@/utility/misskey-api.js'; import { misskeyApi } from '@/utility/misskey-api.js';
import { definePage } from '@/page.js'; import { definePage } from '@/page.js';
@ -42,8 +42,8 @@ const props = defineProps<{
const antenna = ref<Misskey.entities.Antenna | null>(null); const antenna = ref<Misskey.entities.Antenna | null>(null);
const queue = ref(0); const queue = ref(0);
const rootEl = shallowRef<HTMLElement>(); const rootEl = useTemplateRef('rootEl');
const tlEl = shallowRef<InstanceType<typeof MkTimeline>>(); const tlEl = useTemplateRef('tlEl');
function queueUpdated(q) { function queueUpdated(q) {
queue.value = q; queue.value = q;

View file

@ -72,7 +72,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, defineAsyncComponent, ref, shallowRef } from 'vue'; import { computed, defineAsyncComponent, ref, useTemplateRef } from 'vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkInput from '@/components/MkInput.vue'; import MkInput from '@/components/MkInput.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
@ -86,7 +86,7 @@ import { getProxiedImageUrl } from '@/utility/media-proxy.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePage } from '@/page.js'; import { definePage } from '@/page.js';
const emojisPaginationComponent = shallowRef<InstanceType<typeof MkPagination>>(); const emojisPaginationComponent = useTemplateRef('emojisPaginationComponent');
const tab = ref('local'); const tab = ref('local');
const query = ref<string | null>(null); const query = ref<string | null>(null);

View file

@ -191,7 +191,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, onDeactivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue'; import { computed, onDeactivated, onMounted, onUnmounted, ref, shallowRef, watch, useTemplateRef } from 'vue';
import * as Matter from 'matter-js'; import * as Matter from 'matter-js';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { DropAndFusionGame } from 'misskey-bubble-game'; import { DropAndFusionGame } from 'misskey-bubble-game';
@ -567,8 +567,8 @@ let game = new DropAndFusionGame({
}); });
attachGameEvents(); attachGameEvents();
const containerEl = shallowRef<HTMLElement>(); const containerEl = useTemplateRef('containerEl');
const canvasEl = shallowRef<HTMLCanvasElement>(); const canvasEl = useTemplateRef('canvasEl');
const dropperX = ref(0); const dropperX = ref(0);
const currentPick = shallowRef<{ id: string; mono: Mono } | null>(null); const currentPick = shallowRef<{ id: string; mono: Mono } | null>(null);
const stock = shallowRef<{ id: string; mono: Mono }[]>([]); const stock = shallowRef<{ id: string; mono: Mono }[]>([]);

View file

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

View file

@ -21,7 +21,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, watch, ref, shallowRef } from 'vue'; import { computed, watch, ref, useTemplateRef } from 'vue';
import XFeatured from './explore.featured.vue'; import XFeatured from './explore.featured.vue';
import XUsers from './explore.users.vue'; import XUsers from './explore.users.vue';
import XRoles from './explore.roles.vue'; import XRoles from './explore.roles.vue';
@ -38,7 +38,7 @@ const props = withDefaults(defineProps<{
}); });
const tab = ref(props.initialTab); const tab = ref(props.initialTab);
const tagsEl = shallowRef<InstanceType<typeof MkFoldableSection>>(); const tagsEl = useTemplateRef('tagsEl');
watch(() => props.tag, () => { watch(() => props.tag, () => {
if (tagsEl.value) tagsEl.value.toggleContent(props.tag == null); if (tagsEl.value) tagsEl.value.toggleContent(props.tag == null);

View file

@ -45,7 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import { shallowRef, computed, ref } from 'vue'; import { useTemplateRef, computed, ref } from 'vue';
import type { Paging } from '@/components/MkPagination.vue'; import type { Paging } from '@/components/MkPagination.vue';
import MkPagination from '@/components/MkPagination.vue'; import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
@ -57,7 +57,7 @@ import { infoImageUrl } from '@/instance.js';
import { $i } from '@/i.js'; import { $i } from '@/i.js';
import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue'; import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue';
const paginationComponent = shallowRef<InstanceType<typeof MkPagination>>(); const paginationComponent = useTemplateRef('paginationComponent');
const pagination = computed<Paging>(() => tab.value === 'list' ? { const pagination = computed<Paging>(() => tab.value === 'list' ? {
endpoint: 'following/requests/list', endpoint: 'following/requests/list',

View file

@ -34,7 +34,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ref, shallowRef } from 'vue'; import { computed, ref, useTemplateRef } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import type { Paging } from '@/components/MkPagination.vue'; import type { Paging } from '@/components/MkPagination.vue';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -47,7 +47,7 @@ import { definePage } from '@/page.js';
import { serverErrorImageUrl, instance } from '@/instance.js'; import { serverErrorImageUrl, instance } from '@/instance.js';
import { $i } from '@/i.js'; import { $i } from '@/i.js';
const pagingComponent = shallowRef<InstanceType<typeof MkPagination>>(); const pagingComponent = useTemplateRef('pagingComponent');
const currentInviteLimit = ref<null | number>(null); const currentInviteLimit = ref<null | number>(null);
const inviteLimit = (($i != null && $i.policies.inviteLimit) || (($i == null && instance.policies.inviteLimit))) as number; const inviteLimit = (($i != null && $i.policies.inviteLimit) || (($i == null && instance.policies.inviteLimit))) as number;
const inviteLimitCycle = (($i != null && $i.policies.inviteLimitCycle) || ($i == null && instance.policies.inviteLimitCycle)) as number; const inviteLimitCycle = (($i != null && $i.policies.inviteLimitCycle) || ($i == null && instance.policies.inviteLimitCycle)) as number;

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