refactor(frontend): remove $store

This commit is contained in:
syuilo 2023-04-01 13:42:40 +09:00
parent a9f0bea60c
commit c823cbe63b
42 changed files with 150 additions and 113 deletions

View file

@ -8,7 +8,6 @@ import type { i18n } from '@/i18n';
declare module 'vue' {
interface ComponentCustomProperties {
$i: typeof $i;
$store: typeof defaultStore;
$instance: typeof instance;
$t: typeof i18n['t'];
$ts: typeof i18n['ts'];

View file

@ -14,10 +14,10 @@
</div>
</header>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_toggle_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_toggle_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_toggle_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_toggle_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_toggle_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_toggle_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_toggle_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_toggle_leaveTo : ''"
@enter="enter"
@after-enter="afterEnter"
@leave="leave"
@ -35,6 +35,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { defaultStore } from '@/store';
export default defineComponent({
props: {
@ -79,6 +80,7 @@ export default defineComponent({
showBody: this.expanded,
omitted: null,
ignoreOmit: false,
defaultStore,
};
},
mounted() {

View file

@ -1,10 +1,10 @@
<template>
<Transition
appear
:enter-active-class="$store.state.animation ? $style.transition_fade_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_fade_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_fade_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_fade_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_fade_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_fade_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_fade_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_fade_leaveTo : ''"
>
<div ref="rootEl" :class="$style.root" :style="{ zIndex }" @contextmenu.prevent.stop="() => {}">
<MkMenu :items="items" :align="'left'" @close="$emit('closed')"/>
@ -18,6 +18,7 @@ import MkMenu from './MkMenu.vue';
import { MenuItem } from './types/menu.vue';
import contains from '@/scripts/contains';
import * as os from '@/os';
import { defaultStore } from '@/store';
const props = defineProps<{
items: MenuItem[];

View file

@ -9,7 +9,7 @@
</button>
</header>
<Transition
:name="$store.state.animation ? 'folder-toggle' : ''"
:name="defaultStore.state.animation ? 'folder-toggle' : ''"
@enter="enter"
@after-enter="afterEnter"
@leave="leave"
@ -26,6 +26,7 @@
import { defineComponent } from 'vue';
import tinycolor from 'tinycolor2';
import { miLocalStorage } from '@/local-storage';
import { defaultStore } from '@/store';
const miLocalStoragePrefix = 'ui:folder:' as const;
@ -44,6 +45,7 @@ export default defineComponent({
},
data() {
return {
defaultStore,
bg: null,
showBody: (this.persistKey && miLocalStorage.getItem(`${miLocalStoragePrefix}${this.persistKey}`)) ? (miLocalStorage.getItem(`${miLocalStoragePrefix}${this.persistKey}`) === 't') : this.expanded,
};

View file

@ -22,10 +22,10 @@
<div v-if="openedAtLeastOnce" :class="[$style.body, { [$style.bgSame]: bgSame }]" :style="{ maxHeight: maxHeight ? `${maxHeight}px` : null, overflow: maxHeight ? `auto` : null }">
<Transition
:enter-active-class="$store.state.animation ? $style.transition_toggle_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_toggle_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_toggle_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_toggle_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_toggle_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_toggle_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_toggle_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_toggle_leaveTo : ''"
@enter="enter"
@after-enter="afterEnter"
@leave="leave"
@ -46,6 +46,7 @@
<script lang="ts" setup>
import { nextTick, onMounted } from 'vue';
import { defaultStore } from '@/store';
const props = withDefaults(defineProps<{
defaultOpen?: boolean;

View file

@ -3,7 +3,7 @@
<img :class="$style.icon" :src="`/avatar/@${username}@${host}`" alt="">
<span>
<span :class="$style.username">@{{ username }}</span>
<span v-if="(host != localHost) || $store.state.showFullAcct" :class="$style.host">@{{ toUnicode(host) }}</span>
<span v-if="(host != localHost) || defaultStore.state.showFullAcct" :class="$style.host">@{{ toUnicode(host) }}</span>
</span>
</MkA>
</template>
@ -14,6 +14,7 @@ import { } from 'vue';
import tinycolor from 'tinycolor2';
import { host as localHost } from '@/config';
import { $i } from '@/account';
import { defaultStore } from '@/store';
const props = defineProps<{
username: string;

View file

@ -1,9 +1,9 @@
<template>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_fade_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_fade_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_fade_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_fade_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_fade_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_fade_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_fade_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_fade_leaveTo : ''"
mode="out-in"
>
<MkLoading v-if="fetching"/>

View file

@ -1,21 +1,22 @@
<template>
<TransitionGroup
:enter-active-class="$store.state.animation ? $style.transition_x_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_x_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_x_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_x_leaveTo : ''"
:move-class="$store.state.animation ? $style.transition_x_move : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_x_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_x_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_x_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_x_leaveTo : ''"
:move-class="defaultStore.state.animation ? $style.transition_x_move : ''"
tag="div" :class="$style.root"
>
<XReaction v-for="[reaction, count] in reactions" :key="reaction" :reaction="reaction" :count="count" :is-initial="initialReactions.has(reaction)" :note="note"/>
<slot v-if="hasMoreReactions" name="more" />
<slot v-if="hasMoreReactions" name="more"/>
</TransitionGroup>
</template>
<script lang="ts" setup>
import * as misskey from 'misskey-js';
import XReaction from '@/components/MkReactionsViewer.reaction.vue';
import { watch } from 'vue';
import XReaction from '@/components/MkReactionsViewer.reaction.vue';
import { defaultStore } from '@/store';
const props = withDefaults(defineProps<{
note: misskey.entities.Note;

View file

@ -1,5 +1,5 @@
<template>
<MkNotes ref="tlComponent" :no-gap="!$store.state.showGapBetweenNotesInTimeline" :pagination="pagination" @queue="emit('queue', $event)"/>
<MkNotes ref="tlComponent" :no-gap="!defaultStore.state.showGapBetweenNotesInTimeline" :pagination="pagination" @queue="emit('queue', $event)"/>
</template>
<script lang="ts" setup>
@ -8,6 +8,7 @@ import MkNotes from '@/components/MkNotes.vue';
import { stream } from '@/stream';
import * as sound from '@/scripts/sound';
import { $i } from '@/account';
import { defaultStore } from '@/store';
const props = defineProps<{
src: string;

View file

@ -1,10 +1,10 @@
<template>
<div>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_toast_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_toast_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_toast_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_toast_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_toast_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_toast_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_toast_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_toast_leaveTo : ''"
appear @after-leave="emit('closed')"
>
<div v-if="showing" class="_acrylic" :class="$style.root" :style="{ zIndex }">
@ -19,6 +19,7 @@
<script lang="ts" setup>
import { onMounted } from 'vue';
import * as os from '@/os';
import { defaultStore } from '@/store';
defineProps<{
message: string;

View file

@ -1,9 +1,9 @@
<template>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_tooltip_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_tooltip_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_tooltip_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_tooltip_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_tooltip_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_tooltip_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_tooltip_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_tooltip_leaveTo : ''"
appear @after-leave="emit('closed')"
>
<div v-show="showing" ref="el" :class="$style.root" class="_acrylic _shadow" :style="{ zIndex, maxWidth: maxWidth + 'px' }">
@ -19,6 +19,7 @@
import { nextTick, onMounted, onUnmounted, shallowRef } from 'vue';
import * as os from '@/os';
import { calcPopupPosition } from '@/scripts/popup-position';
import { defaultStore } from '@/store';
const props = withDefaults(defineProps<{
showing: boolean;

View file

@ -23,7 +23,7 @@
</template>
<template v-else-if="tweetId && tweetExpanded">
<div ref="twitter" :class="$style.twitter">
<iframe ref="tweet" scrolling="no" frameborder="no" :style="{ position: 'relative', width: '100%', height: `${tweetHeight}px` }" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&amp;hideCard=false&amp;hideThread=false&amp;lang=en&amp;theme=${$store.state.darkMode ? 'dark' : 'light'}&amp;id=${tweetId}`"></iframe>
<iframe ref="tweet" scrolling="no" frameborder="no" :style="{ position: 'relative', width: '100%', height: `${tweetHeight}px` }" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&amp;hideCard=false&amp;hideThread=false&amp;lang=en&amp;theme=${defaultStore.state.darkMode ? 'dark' : 'light'}&amp;id=${tweetId}`"></iframe>
</div>
<div :class="$style.action">
<MkButton :small="true" inline @click="tweetExpanded = false">
@ -77,6 +77,7 @@ import * as os from '@/os';
import { deviceKind } from '@/scripts/device-kind';
import MkButton from '@/components/MkButton.vue';
import { versatileLang } from '@/scripts/intl-const';
import { defaultStore } from '@/store';
type SummalyResult = Awaited<ReturnType<typeof summaly>>;

View file

@ -1,6 +1,6 @@
<template>
<div class="fgmtyycl" :style="{ zIndex, top: top + 'px', left: left + 'px' }">
<Transition :name="$store.state.animation ? '_transition_zoom' : ''" @after-leave="emit('closed')">
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" @after-leave="emit('closed')">
<MkUrlPreview v-if="showing" class="_popup _shadow" :url="url"/>
</Transition>
</div>
@ -10,6 +10,7 @@
import { onMounted } from 'vue';
import MkUrlPreview from '@/components/MkUrlPreview.vue';
import * as os from '@/os';
import { defaultStore } from '@/store';
const props = defineProps<{
showing: boolean;

View file

@ -1,9 +1,9 @@
<template>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_popup_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_popup_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_popup_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_popup_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_popup_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_popup_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_popup_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_popup_leaveTo : ''"
appear @after-leave="emit('closed')"
>
<div v-if="showing" :class="$style.root" class="_popup _shadow" :style="{ zIndex, top: top + 'px', left: left + 'px' }" @mouseover="() => { emit('mouseover'); }" @mouseleave="() => { emit('mouseleave'); }">
@ -59,6 +59,7 @@ import * as os from '@/os';
import { getUserMenu } from '@/scripts/get-user-menu';
import number from '@/filters/number';
import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
const props = defineProps<{
showing: boolean;

View file

@ -1,9 +1,9 @@
<template>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_window_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_window_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_window_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_window_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_window_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_window_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_window_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_window_leaveTo : ''"
appear
@after-leave="$emit('closed')"
>
@ -47,6 +47,7 @@ import contains from '@/scripts/contains';
import * as os from '@/os';
import { MenuItem } from '@/types/menu';
import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
const minHeight = 50;
const minWidth = 250;

View file

@ -6,7 +6,7 @@
</template>
<div class="poamfof">
<Transition :name="$store.state.animation ? 'fade' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
<div v-if="player.url && (player.url.startsWith('http://') || player.url.startsWith('https://'))" class="player">
<iframe v-if="!fetching" :src="player.url + (player.url.match(/\?/) ? '&autoplay=1&auto_play=1' : '?autoplay=1&auto_play=1')" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen/>
</div>
@ -21,6 +21,7 @@
<script lang="ts" setup>
import MkWindow from '@/components/MkWindow.vue';
import { versatileLang } from '@/scripts/intl-const';
import { defaultStore } from '@/store';
const props = defineProps<{
url: string;

View file

@ -1,5 +1,5 @@
<template>
<Transition :name="$store.state.animation ? 'fade' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
<div v-if="pending">
<MkLoading/>
</div>
@ -18,6 +18,7 @@
<script lang="ts">
import { defineComponent, PropType, ref, watch } from 'vue';
import MkButton from '@/components/MkButton.vue';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
@ -72,6 +73,7 @@ export default defineComponent({
rejected,
result,
retry,
defaultStore,
};
},
});

View file

@ -1,7 +1,7 @@
<template>
<span>
<span>@{{ user.username }}</span>
<span v-if="user.host || detail || $store.state.showFullAcct" style="opacity: 0.5;">@{{ user.host || host }}</span>
<span v-if="user.host || detail || defaultStore.state.showFullAcct" style="opacity: 0.5;">@{{ user.host || host }}</span>
</span>
</template>
@ -9,6 +9,7 @@
import * as misskey from 'misskey-js';
import { toUnicode } from 'punycode/';
import { host as hostRaw } from '@/config';
import { defaultStore } from '@/store';
defineProps<{
user: misskey.entities.UserDetailed;

View file

@ -1,5 +1,5 @@
<template>
<Transition :name="$store.state.animation ? '_transition_zoom' : ''" appear>
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" appear>
<div :class="$style.root">
<img :class="$style.img" src="https://xn--931a.moe/assets/error.jpg" class="_ghost"/>
<p :class="$style.text"><i class="ti ti-alert-triangle"></i> {{ i18n.ts.somethingHappened }}</p>
@ -11,6 +11,7 @@
<script lang="ts" setup>
import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
const emit = defineEmits<{
(ev: 'retry'): void;

View file

@ -16,6 +16,7 @@ import { apiUrl } from '@/config';
import * as os from '@/os';
import { PostBlock } from '@/scripts/hpml/block';
import { Hpml } from '@/scripts/hpml/evaluator';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
@ -55,8 +56,8 @@ export default defineComponent({
const formData = new FormData();
formData.append('file', blob);
formData.append('i', this.$i.token);
if (this.$store.state.uploadFolder) {
formData.append('folderId', this.$store.state.uploadFolder);
if (defaultStore.state.uploadFolder) {
formData.append('folderId', defaultStore.state.uploadFolder);
}
window.fetch(apiUrl + '/drive/files/create', {

View file

@ -201,7 +201,6 @@ if (_DEV_) {
// TODO: 廃止
app.config.globalProperties = {
$i,
$store: defaultStore,
$instance: instance,
$t: i18n.t,
$ts: i18n.ts,
@ -356,7 +355,7 @@ const hotkeys = {
},
's': (): void => {
mainRouter.push('/search');
}
},
};
if ($i) {

View file

@ -1,6 +1,6 @@
<template>
<MkLoading v-if="!loaded"/>
<Transition :name="$store.state.animation ? '_transition_zoom' : ''" appear>
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" appear>
<div v-show="loaded" class="mjndxjch">
<img src="https://xn--931a.moe/assets/error.jpg" class="_ghost"/>
<p><b><i class="ti ti-alert-triangle"></i> {{ i18n.ts.pageLoadError }}</b></p>
@ -27,6 +27,7 @@ import { unisonReload } from '@/scripts/unison-reload';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import { miLocalStorage } from '@/local-storage';
import { defaultStore } from '@/store';
const props = withDefaults(defineProps<{
error?: Error;

View file

@ -1,6 +1,6 @@
<template>
<div class="wbrkwale">
<Transition :name="$store.state.animation ? '_transition_zoom' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" mode="out-in">
<MkLoading v-if="fetching"/>
<div v-else class="instances">
<MkA v-for="(instance, i) in instances" :key="instance.id" v-tooltip.mfm.noDelay="`${instance.name}\n${instance.host}\n${instance.softwareName} ${instance.softwareVersion}`" :to="`/instance-info/${instance.host}`" class="instance">
@ -16,6 +16,7 @@ import { ref } from 'vue';
import * as os from '@/os';
import { useInterval } from '@/scripts/use-interval';
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
import { defaultStore } from '@/store';
const instances = ref([]);
const fetching = ref(true);

View file

@ -1,6 +1,6 @@
<template>
<div>
<Transition :name="$store.state.animation ? '_transition_zoom' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" mode="out-in">
<MkLoading v-if="fetching"/>
<div v-else :class="$style.root" class="_panel">
<MkA v-for="user in moderators" :key="user.id" class="user" :to="`/user-info/${user.id}`">
@ -14,6 +14,7 @@
<script lang="ts" setup>
import { onMounted } from 'vue';
import * as os from '@/os';
import { defaultStore } from '@/store';
let moderators: any = $ref(null);
let fetching = $ref(true);

View file

@ -1,6 +1,6 @@
<template>
<div>
<Transition :name="$store.state.animation ? '_transition_zoom' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" mode="out-in">
<MkLoading v-if="fetching"/>
<div v-else :class="$style.root">
<div class="item _panel users">
@ -62,6 +62,7 @@ import MkNumberDiff from '@/components/MkNumberDiff.vue';
import MkNumber from '@/components/MkNumber.vue';
import { i18n } from '@/i18n';
import { customEmojis } from '@/custom-emojis';
import { defaultStore } from '@/store';
let stats: any = $ref(null);
let usersComparedToThePrevDay = $ref<number>();

View file

@ -1,6 +1,6 @@
<template>
<div :class="$style.root">
<Transition :name="$store.state.animation ? '_transition_zoom' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? '_transition_zoom' : ''" mode="out-in">
<MkLoading v-if="fetching"/>
<div v-else class="users">
<MkA v-for="(user, i) in newUsers" :key="user.id" :to="`/user-info/${user.id}`" class="user">
@ -15,6 +15,7 @@
import * as os from '@/os';
import { useInterval } from '@/scripts/use-interval';
import MkUserCardMini from '@/components/MkUserCardMini.vue';
import { defaultStore } from '@/store';
let newUsers = $ref(null);
let fetching = $ref(true);

View file

@ -2,9 +2,9 @@
<MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700">
<Transition :name="$store.state.animation ? 'fade' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
<div v-if="flash" :key="flash.id">
<Transition :name="$store.state.animation ? 'zoom' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? 'zoom' : ''" mode="out-in">
<div v-if="started" :class="$style.started">
<div class="main _panel">
<MkAsUi v-if="root" :component="root" :components="components"/>
@ -63,6 +63,7 @@ import { AsUiComponent, AsUiRoot, registerAsUiLib } from '@/scripts/aiscript/ui'
import { createAiScriptEnv } from '@/scripts/aiscript/api';
import MkFolder from '@/components/MkFolder.vue';
import MkCode from '@/components/MkCode.vue';
import { defaultStore } from '@/store';
const props = defineProps<{
id: string;

View file

@ -3,7 +3,7 @@
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="1000" :margin-min="16" :margin-max="32">
<div class="_root">
<Transition :name="$store.state.animation ? 'fade' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
<div v-if="post" class="rkxwuolj">
<div class="files">
<div v-for="file in post.files" :key="file.id" class="file">
@ -67,6 +67,7 @@ import { url } from '@/config';
import { useRouter } from '@/router';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import { defaultStore } from '@/store';
const router = useRouter();

View file

@ -3,7 +3,7 @@
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="800">
<div class="fcuexfpr">
<Transition :name="$store.state.animation ? 'fade' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
<div v-if="note" class="note">
<div v-if="showNext" class="_margin">
<MkNotes class="" :pagination="nextPagination" :no-gap="true"/>
@ -50,6 +50,7 @@ import { definePageMetadata } from '@/scripts/page-metadata';
import { i18n } from '@/i18n';
import { dateString } from '@/filters/date';
import MkClipPreview from '@/components/MkClipPreview.vue';
import { defaultStore } from '@/store';
const props = defineProps<{
noteId: string;

View file

@ -2,7 +2,7 @@
<MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700">
<Transition :name="$store.state.animation ? 'fade' : ''" mode="out-in">
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
<div v-if="page" :key="page.id" class="xcukqgmh">
<div class="main">
<!--
@ -75,7 +75,7 @@ import MkPagination from '@/components/MkPagination.vue';
import MkPagePreview from '@/components/MkPagePreview.vue';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import { pageViewInterruptors } from '@/store';
import { pageViewInterruptors, defaultStore } from '@/store';
import { deepClone } from '@/scripts/clone';
const props = defineProps<{

View file

@ -3,8 +3,8 @@
<template #header><MkPageHeader v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin" :display-my-avatar="true"/></template>
<MkSpacer :content-max="800">
<div ref="rootEl" v-hotkey.global="keymap">
<XTutorial v-if="$i && $store.reactiveState.tutorial.value != -1" class="_panel" style="margin-bottom: var(--margin);"/>
<MkPostForm v-if="$store.reactiveState.showFixedPostForm.value" :class="$style.postForm" class="post-form _panel" fixed style="margin-bottom: var(--margin);"/>
<XTutorial v-if="$i && defaultStore.reactiveState.tutorial.value != -1" class="_panel" style="margin-bottom: var(--margin);"/>
<MkPostForm v-if="defaultStore.reactiveState.showFixedPostForm.value" :class="$style.postForm" class="post-form _panel" fixed style="margin-bottom: var(--margin);"/>
<div v-if="queue > 0" :class="$style.new"><button class="_buttonPrimary" @click="top()">{{ i18n.ts.newNoteRecived }}</button></div>
<div :class="$style.tl">

View file

@ -11,11 +11,11 @@
<TransitionGroup
tag="div" :class="$style.notifications"
:move-class="$store.state.animation ? $style.transition_notification_move : ''"
:enter-active-class="$store.state.animation ? $style.transition_notification_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_notification_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_notification_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_notification_leaveTo : ''"
:move-class="defaultStore.state.animation ? $style.transition_notification_move : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_notification_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_notification_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_notification_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_notification_leaveTo : ''"
>
<XNotification v-for="notification in notifications" :key="notification.id" :notification="notification" :class="$style.notification"/>
</TransitionGroup>
@ -40,6 +40,7 @@ import * as sound from '@/scripts/sound';
import { $i } from '@/account';
import { stream } from '@/stream';
import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
const XStreamIndicator = defineAsyncComponent(() => import('./stream-indicator.vue'));
const XUpload = defineAsyncComponent(() => import('./upload.vue'));

View file

@ -1,5 +1,5 @@
<template>
<div v-if="hasDisconnected && $store.state.serverDisconnectedBehavior === 'quiet'" :class="$style.root" class="_panel _shadow" @click="resetDisconnected">
<div v-if="hasDisconnected && defaultStore.state.serverDisconnectedBehavior === 'quiet'" :class="$style.root" class="_panel _shadow" @click="resetDisconnected">
<div><i class="ti ti-alert-triangle"></i> {{ i18n.ts.disconnectedFromServer }}</div>
<div :class="$style.command" class="_buttons">
<MkButton :class="$style.commandButton" small primary @click="reload">{{ i18n.ts.reload }}</MkButton>
@ -14,6 +14,7 @@ import { stream } from '@/stream';
import { i18n } from '@/i18n';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os';
import { defaultStore } from '@/store';
const zIndex = os.claimZIndex('high');

View file

@ -50,6 +50,7 @@ import { navbarItemDef } from '@/navbar';
import { openAccountMenu } from '@/account';
import MkButton from '@/components/MkButton.vue';
import { mainRouter } from '@/router';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
@ -63,12 +64,13 @@ export default defineComponent({
connection: null,
navbarItemDef: navbarItemDef,
settingsWindowed: false,
defaultStore,
};
},
computed: {
menu(): string[] {
return this.$store.state.menu;
return defaultStore.state.menu;
},
otherNavItemIndicated(): boolean {
@ -81,7 +83,7 @@ export default defineComponent({
},
watch: {
'$store.reactiveState.menuDisplay.value'() {
'defaultStore.reactiveState.menuDisplay.value'() {
this.calcViewState();
},
},

View file

@ -51,6 +51,7 @@ import MkButton from '@/components/MkButton.vue';
import { StickySidebar } from '@/scripts/sticky-sidebar';
import { mainRouter } from '@/router';
//import MisskeyLogo from '@assets/client/misskey.svg';
import { defaultStore } from '@/store';
export default defineComponent({
components: {
@ -66,12 +67,13 @@ export default defineComponent({
navbarItemDef: navbarItemDef,
iconOnly: false,
settingsWindowed: false,
defaultStore,
};
},
computed: {
menu(): string[] {
return this.$store.state.menu;
return this.defaultStore.state.menu;
},
otherNavItemIndicated(): boolean {
@ -84,7 +86,7 @@ export default defineComponent({
},
watch: {
'$store.reactiveState.menuDisplay.value'() {
'defaultStore.reactiveState.menuDisplay.value'() {
this.calcViewState();
},
@ -111,7 +113,7 @@ export default defineComponent({
openInstanceMenu,
calcViewState() {
this.iconOnly = (window.innerWidth <= 1400) || (this.$store.state.menuDisplay === 'sideIcon');
this.iconOnly = (window.innerWidth <= 1400) || (this.defaultStore.state.menuDisplay === 'sideIcon');
this.settingsWindowed = (window.innerWidth > 1400);
},

View file

@ -21,7 +21,7 @@
</div>
</div>
<Transition :name="$store.state.animation ? 'tray-back' : ''">
<Transition :name="defaultStore.state.animation ? 'tray-back' : ''">
<div
v-if="widgetsShowing"
class="tray-back _modalBg"
@ -30,11 +30,11 @@
></div>
</Transition>
<Transition :name="$store.state.animation ? 'tray' : ''">
<Transition :name="defaultStore.state.animation ? 'tray' : ''">
<XWidgets v-if="widgetsShowing" class="tray"/>
</Transition>
<iframe v-if="$store.state.aiChanMode" ref="live2d" class="ivnzpscs" src="https://misskey-dev.github.io/mascot-web/?scale=2&y=1.4"></iframe>
<iframe v-if="defaultStore.state.aiChanMode" ref="live2d" class="ivnzpscs" src="https://misskey-dev.github.io/mascot-web/?scale=2&y=1.4"></iframe>
<XCommon/>
</div>

View file

@ -53,10 +53,10 @@
</div>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_menuDrawerBg_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_menuDrawerBg_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_menuDrawerBg_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_menuDrawerBg_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_menuDrawerBg_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_menuDrawerBg_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_menuDrawerBg_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_menuDrawerBg_leaveTo : ''"
>
<div
v-if="drawerMenuShowing"
@ -68,10 +68,10 @@
</Transition>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_menuDrawer_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_menuDrawer_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_menuDrawer_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_menuDrawer_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_menuDrawer_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_menuDrawer_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_menuDrawer_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_menuDrawer_leaveTo : ''"
>
<div v-if="drawerMenuShowing" :class="$style.menu">
<XDrawerMenu/>
@ -99,6 +99,7 @@ import { i18n } from '@/i18n';
import { mainRouter } from '@/router';
import { unisonReload } from '@/scripts/unison-reload';
import { deviceKind } from '@/scripts/device-kind';
import { defaultStore } from '@/store';
const XStatusBars = defineAsyncComponent(() => import('@/ui/_common_/statusbars.vue'));
mainRouter.navHook = (path, flag): boolean => {

View file

@ -27,10 +27,10 @@
</div>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_menuDrawerBg_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_menuDrawerBg_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_menuDrawerBg_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_menuDrawerBg_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_menuDrawerBg_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_menuDrawerBg_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_menuDrawerBg_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_menuDrawerBg_leaveTo : ''"
>
<div
v-if="drawerMenuShowing"
@ -42,10 +42,10 @@
</Transition>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_menuDrawer_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_menuDrawer_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_menuDrawer_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_menuDrawer_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_menuDrawer_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_menuDrawer_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_menuDrawer_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_menuDrawer_leaveTo : ''"
>
<div v-if="drawerMenuShowing" :class="$style.menuDrawer">
<XDrawerMenu/>
@ -53,10 +53,10 @@
</Transition>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_widgetsDrawerBg_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_widgetsDrawerBg_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_widgetsDrawerBg_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_widgetsDrawerBg_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_widgetsDrawerBg_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_widgetsDrawerBg_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_widgetsDrawerBg_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_widgetsDrawerBg_leaveTo : ''"
>
<div
v-if="widgetsShowing"
@ -68,10 +68,10 @@
</Transition>
<Transition
:enter-active-class="$store.state.animation ? $style.transition_widgetsDrawer_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_widgetsDrawer_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_widgetsDrawer_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_widgetsDrawer_leaveTo : ''"
:enter-active-class="defaultStore.state.animation ? $style.transition_widgetsDrawer_enterActive : ''"
:leave-active-class="defaultStore.state.animation ? $style.transition_widgetsDrawer_leaveActive : ''"
:enter-from-class="defaultStore.state.animation ? $style.transition_widgetsDrawer_enterFrom : ''"
:leave-to-class="defaultStore.state.animation ? $style.transition_widgetsDrawer_leaveTo : ''"
>
<div v-if="widgetsShowing" :class="$style.widgetsDrawer">
<button class="_button" :class="$style.widgetsCloseButton" @click="widgetsShowing = false"><i class="ti ti-x"></i></button>

View file

@ -42,7 +42,7 @@ import XHeader from './header.vue';
import { host, instanceName } from '@/config';
import * as os from '@/os';
import MkButton from '@/components/MkButton.vue';
import { ColdDeviceStorage } from '@/store';
import { defaultStore, ColdDeviceStorage } from '@/store';
import { mainRouter } from '@/router';
const DESKTOP_THRESHOLD = 1100;
@ -66,6 +66,7 @@ export default defineComponent({
},
mainRouter,
isDesktop: window.innerWidth >= DESKTOP_THRESHOLD,
defaultStore,
};
},
@ -74,7 +75,7 @@ export default defineComponent({
return {
'd': () => {
if (ColdDeviceStorage.get('syncDeviceDarkMode')) return;
this.$store.set('darkMode', !this.$store.state.darkMode);
this.defaultStore.set('darkMode', !this.defaultStore.state.darkMode);
},
's': () => {
mainRouter.push('/search');

View file

@ -24,7 +24,7 @@
</div>
</div>
<Transition :name="$store.state.animation ? 'tray-back' : ''">
<Transition :name="'tray-back'">
<div
v-if="showMenu"
class="menu-back _modalBg"
@ -33,7 +33,7 @@
></div>
</Transition>
<Transition :name="$store.state.animation ? 'tray' : ''">
<Transition :name="'tray'">
<div v-if="showMenu" class="menu">
<MkA to="/" class="link" active-class="active"><i class="ti ti-home icon"></i>{{ $ts.home }}</MkA>
<MkA v-if="isTimelineAvailable" to="/timeline" class="link" active-class="active"><i class="ti ti-message icon"></i>{{ $ts.timeline }}</MkA>

View file

@ -5,7 +5,7 @@
<div class="wbrkwalb">
<MkLoading v-if="fetching"/>
<TransitionGroup v-else tag="div" :name="$store.state.animation ? 'chart' : ''" class="instances">
<TransitionGroup v-else tag="div" :name="defaultStore.state.animation ? 'chart' : ''" class="instances">
<div v-for="(instance, i) in instances" :key="instance.id" class="instance">
<img :src="getInstanceIcon(instance)" alt=""/>
<div class="body">
@ -29,6 +29,7 @@ import * as os from '@/os';
import { useInterval } from '@/scripts/use-interval';
import { i18n } from '@/i18n';
import { getProxiedImageUrlNullable } from '@/scripts/media-proxy';
import { defaultStore } from '@/store';
const name = 'federation';

View file

@ -5,7 +5,7 @@
<div class="wbrkwala">
<MkLoading v-if="fetching"/>
<TransitionGroup v-else tag="div" :name="$store.state.animation ? 'chart' : ''" class="tags">
<TransitionGroup v-else tag="div" :name="defaultStore.state.animation ? 'chart' : ''" class="tags">
<div v-for="stat in stats" :key="stat.tag">
<div class="tag">
<MkA class="a" :to="`/tags/${ encodeURIComponent(stat.tag) }`" :title="stat.tag">#{{ stat.tag }}</MkA>
@ -27,6 +27,7 @@ import MkMiniChart from '@/components/MkMiniChart.vue';
import * as os from '@/os';
import { useInterval } from '@/scripts/use-interval';
import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
const name = 'hashtags';