1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-11-27 22:38:39 +09:00

Merge branch 'develop' of https://github.com/misskey-dev/misskey into storybook

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-04-01 13:46:54 +09:00
commit 2b831da1d1
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99
59 changed files with 222 additions and 205 deletions

View File

@ -1,15 +1,12 @@
/// <reference types="vue/macros-global" /> /// <reference types="vue/macros-global" />
import type { $i } from '@/account'; import type { $i } from '@/account';
import type { defaultStore } from '@/store';
import type { instance } from '@/instance'; import type { instance } from '@/instance';
import type { i18n } from '@/i18n'; import type { i18n } from '@/i18n';
declare module 'vue' { declare module 'vue' {
interface ComponentCustomProperties { interface ComponentCustomProperties {
$i: typeof $i; $i: typeof $i;
$store: typeof defaultStore;
$instance: typeof instance;
$t: typeof i18n['t']; $t: typeof i18n['t'];
$ts: typeof i18n['ts']; $ts: typeof i18n['ts'];
} }

View File

@ -19,7 +19,6 @@
"@tabler/icons-webfont": "2.12.0", "@tabler/icons-webfont": "2.12.0",
"@vitejs/plugin-vue": "4.1.0", "@vitejs/plugin-vue": "4.1.0",
"@vue/compiler-sfc": "3.2.47", "@vue/compiler-sfc": "3.2.47",
"autobind-decorator": "2.4.0",
"autosize": "5.0.2", "autosize": "5.0.2",
"blurhash": "2.0.5", "blurhash": "2.0.5",
"broadcast-channel": "4.20.2", "broadcast-channel": "4.20.2",

View File

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

View File

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

View File

@ -14,7 +14,7 @@
<div :class="$style.text"> <div :class="$style.text">
<I18n :src="i18n.ts.pleaseDonate" tag="span"> <I18n :src="i18n.ts.pleaseDonate" tag="span">
<template #host> <template #host>
{{ $instance.name ?? host }} {{ instance.name ?? host }}
</template> </template>
</I18n> </I18n>
<div style="margin-top: 0.2em;"> <div style="margin-top: 0.2em;">
@ -37,6 +37,7 @@ import { host } from '@/config';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import * as os from '@/os'; import * as os from '@/os';
import { miLocalStorage } from '@/local-storage'; import { miLocalStorage } from '@/local-storage';
import { instance } from '@/instance';
const emit = defineEmits<{ const emit = defineEmits<{
(ev: 'closed'): void; (ev: 'closed'): void;

View File

@ -9,7 +9,7 @@
</button> </button>
</header> </header>
<Transition <Transition
:name="$store.state.animation ? 'folder-toggle' : ''" :name="defaultStore.state.animation ? 'folder-toggle' : ''"
@enter="enter" @enter="enter"
@after-enter="afterEnter" @after-enter="afterEnter"
@leave="leave" @leave="leave"
@ -26,6 +26,7 @@
import { defineComponent } from 'vue'; import { defineComponent } from 'vue';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import { miLocalStorage } from '@/local-storage'; import { miLocalStorage } from '@/local-storage';
import { defaultStore } from '@/store';
const miLocalStoragePrefix = 'ui:folder:' as const; const miLocalStoragePrefix = 'ui:folder:' as const;
@ -44,6 +45,7 @@ export default defineComponent({
}, },
data() { data() {
return { return {
defaultStore,
bg: null, bg: null,
showBody: (this.persistKey && miLocalStorage.getItem(`${miLocalStoragePrefix}${this.persistKey}`)) ? (miLocalStorage.getItem(`${miLocalStoragePrefix}${this.persistKey}`) === 't') : this.expanded, 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 }"> <div v-if="openedAtLeastOnce" :class="[$style.body, { [$style.bgSame]: bgSame }]" :style="{ maxHeight: maxHeight ? `${maxHeight}px` : null, overflow: maxHeight ? `auto` : null }">
<Transition <Transition
:enter-active-class="$store.state.animation ? $style.transition_toggle_enterActive : ''" :enter-active-class="defaultStore.state.animation ? $style.transition_toggle_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_toggle_leaveActive : ''" :leave-active-class="defaultStore.state.animation ? $style.transition_toggle_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_toggle_enterFrom : ''" :enter-from-class="defaultStore.state.animation ? $style.transition_toggle_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_toggle_leaveTo : ''" :leave-to-class="defaultStore.state.animation ? $style.transition_toggle_leaveTo : ''"
@enter="enter" @enter="enter"
@after-enter="afterEnter" @after-enter="afterEnter"
@leave="leave" @leave="leave"
@ -46,6 +46,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { nextTick, onMounted } from 'vue'; import { nextTick, onMounted } from 'vue';
import { defaultStore } from '@/store';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
defaultOpen?: boolean; defaultOpen?: boolean;

View File

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

View File

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

View File

@ -1,27 +1,28 @@
<template> <template>
<TransitionGroup <TransitionGroup
:enter-active-class="$store.state.animation ? $style.transition_x_enterActive : ''" :enter-active-class="defaultStore.state.animation ? $style.transition_x_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_x_leaveActive : ''" :leave-active-class="defaultStore.state.animation ? $style.transition_x_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_x_enterFrom : ''" :enter-from-class="defaultStore.state.animation ? $style.transition_x_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_x_leaveTo : ''" :leave-to-class="defaultStore.state.animation ? $style.transition_x_leaveTo : ''"
:move-class="$store.state.animation ? $style.transition_x_move : ''" :move-class="defaultStore.state.animation ? $style.transition_x_move : ''"
tag="div" :class="$style.root" 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"/> <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> </TransitionGroup>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import * as misskey from 'misskey-js'; import * as misskey from 'misskey-js';
import XReaction from '@/components/MkReactionsViewer.reaction.vue';
import { watch } from 'vue'; import { watch } from 'vue';
import XReaction from '@/components/MkReactionsViewer.reaction.vue';
import { defaultStore } from '@/store';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
note: misskey.entities.Note; note: misskey.entities.Note;
maxNumber?: number; maxNumber?: number;
}>(), { }>(), {
maxNumber: Infinity, maxNumber: Infinity,
}); });
const initialReactions = new Set(Object.keys(props.note.reactions)); const initialReactions = new Set(Object.keys(props.note.reactions));

View File

@ -1,5 +1,5 @@
<template> <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> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -8,6 +8,7 @@ import MkNotes from '@/components/MkNotes.vue';
import { stream } from '@/stream'; import { stream } from '@/stream';
import * as sound from '@/scripts/sound'; import * as sound from '@/scripts/sound';
import { $i } from '@/account'; import { $i } from '@/account';
import { defaultStore } from '@/store';
const props = defineProps<{ const props = defineProps<{
src: string; src: string;

View File

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

View File

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

View File

@ -23,7 +23,7 @@
</template> </template>
<template v-else-if="tweetId && tweetExpanded"> <template v-else-if="tweetId && tweetExpanded">
<div ref="twitter" :class="$style.twitter"> <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>
<div :class="$style.action"> <div :class="$style.action">
<MkButton :small="true" inline @click="tweetExpanded = false"> <MkButton :small="true" inline @click="tweetExpanded = false">
@ -77,6 +77,7 @@ import * as os from '@/os';
import { deviceKind } from '@/scripts/device-kind'; import { deviceKind } from '@/scripts/device-kind';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { versatileLang } from '@/scripts/intl-const'; import { versatileLang } from '@/scripts/intl-const';
import { defaultStore } from '@/store';
type SummalyResult = Awaited<ReturnType<typeof summaly>>; type SummalyResult = Awaited<ReturnType<typeof summaly>>;

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="fgmtyycl" :style="{ zIndex, top: top + 'px', left: left + 'px' }"> <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"/> <MkUrlPreview v-if="showing" class="_popup _shadow" :url="url"/>
</Transition> </Transition>
</div> </div>
@ -10,6 +10,7 @@
import { onMounted } from 'vue'; import { onMounted } from 'vue';
import MkUrlPreview from '@/components/MkUrlPreview.vue'; import MkUrlPreview from '@/components/MkUrlPreview.vue';
import * as os from '@/os'; import * as os from '@/os';
import { defaultStore } from '@/store';
const props = defineProps<{ const props = defineProps<{
showing: boolean; showing: boolean;

View File

@ -1,9 +1,9 @@
<template> <template>
<Transition <Transition
:enter-active-class="$store.state.animation ? $style.transition_popup_enterActive : ''" :enter-active-class="defaultStore.state.animation ? $style.transition_popup_enterActive : ''"
:leave-active-class="$store.state.animation ? $style.transition_popup_leaveActive : ''" :leave-active-class="defaultStore.state.animation ? $style.transition_popup_leaveActive : ''"
:enter-from-class="$store.state.animation ? $style.transition_popup_enterFrom : ''" :enter-from-class="defaultStore.state.animation ? $style.transition_popup_enterFrom : ''"
:leave-to-class="$store.state.animation ? $style.transition_popup_leaveTo : ''" :leave-to-class="defaultStore.state.animation ? $style.transition_popup_leaveTo : ''"
appear @after-leave="emit('closed')" 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'); }"> <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 { getUserMenu } from '@/scripts/get-user-menu';
import number from '@/filters/number'; import number from '@/filters/number';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
const props = defineProps<{ const props = defineProps<{
showing: boolean; showing: boolean;

View File

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

View File

@ -6,7 +6,7 @@
</template> </template>
<div class="poamfof"> <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"> <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/> <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> </div>
@ -21,6 +21,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import MkWindow from '@/components/MkWindow.vue'; import MkWindow from '@/components/MkWindow.vue';
import { versatileLang } from '@/scripts/intl-const'; import { versatileLang } from '@/scripts/intl-const';
import { defaultStore } from '@/store';
const props = defineProps<{ const props = defineProps<{
url: string; url: string;

View File

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

View File

@ -1,7 +1,7 @@
<template> <template>
<span> <span>
<span>@{{ user.username }}</span> <span>@{{ user.username }}</span>
<span v-if="user.host || detail || 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> </span>
</template> </template>
@ -17,5 +17,4 @@ defineProps<{
}>(); }>();
const host = toUnicode(hostRaw); const host = toUnicode(hostRaw);
const showFullAcct = $ref(defaultStore.state.showFullAcct);
</script> </script>

View File

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

View File

@ -241,7 +241,7 @@ onUnmounted(() => {
display: flex; display: flex;
align-items: center; align-items: center;
max-width: min(30vw, 400px); max-width: min(30vw, 400px);
overflow: auto; overflow: clip;
white-space: nowrap; white-space: nowrap;
text-align: left; text-align: left;
font-weight: bold; font-weight: bold;

View File

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

View File

@ -1,5 +1,4 @@
import { defineAsyncComponent, Directive, ref } from 'vue'; import { defineAsyncComponent, Directive, ref } from 'vue';
import autobind from 'autobind-decorator';
import { popup } from '@/os'; import { popup } from '@/os';
export class UserPreview { export class UserPreview {
@ -15,9 +14,16 @@ export class UserPreview {
this.user = user; this.user = user;
this.attach(); this.attach();
this.show = this.show.bind(this);
this.close = this.close.bind(this);
this.onMouseover = this.onMouseover.bind(this);
this.onMouseleave = this.onMouseleave.bind(this);
this.onClick = this.onClick.bind(this);
this.attach = this.attach.bind(this);
this.detach = this.detach.bind(this);
} }
@autobind
private show() { private show() {
if (!document.body.contains(this.el)) return; if (!document.body.contains(this.el)) return;
if (this.promise) return; if (this.promise) return;
@ -53,7 +59,6 @@ export class UserPreview {
}, 1000); }, 1000);
} }
@autobind
private close() { private close() {
if (this.promise) { if (this.promise) {
window.clearInterval(this.checkTimer); window.clearInterval(this.checkTimer);
@ -62,34 +67,29 @@ export class UserPreview {
} }
} }
@autobind
private onMouseover() { private onMouseover() {
window.clearTimeout(this.showTimer); window.clearTimeout(this.showTimer);
window.clearTimeout(this.hideTimer); window.clearTimeout(this.hideTimer);
this.showTimer = window.setTimeout(this.show, 500); this.showTimer = window.setTimeout(this.show, 500);
} }
@autobind
private onMouseleave() { private onMouseleave() {
window.clearTimeout(this.showTimer); window.clearTimeout(this.showTimer);
window.clearTimeout(this.hideTimer); window.clearTimeout(this.hideTimer);
this.hideTimer = window.setTimeout(this.close, 500); this.hideTimer = window.setTimeout(this.close, 500);
} }
@autobind
private onClick() { private onClick() {
window.clearTimeout(this.showTimer); window.clearTimeout(this.showTimer);
this.close(); this.close();
} }
@autobind
public attach() { public attach() {
this.el.addEventListener('mouseover', this.onMouseover); this.el.addEventListener('mouseover', this.onMouseover);
this.el.addEventListener('mouseleave', this.onMouseleave); this.el.addEventListener('mouseleave', this.onMouseleave);
this.el.addEventListener('click', this.onClick); this.el.addEventListener('click', this.onClick);
} }
@autobind
public detach() { public detach() {
this.el.removeEventListener('mouseover', this.onMouseover); this.el.removeEventListener('mouseover', this.onMouseover);
this.el.removeEventListener('mouseleave', this.onMouseleave); this.el.removeEventListener('mouseleave', this.onMouseleave);

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<MkLoading v-if="!loaded"/> <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"> <div v-show="loaded" class="mjndxjch">
<img src="https://xn--931a.moe/assets/error.jpg" class="_ghost"/> <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> <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 { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { miLocalStorage } from '@/local-storage'; import { miLocalStorage } from '@/local-storage';
import { defaultStore } from '@/store';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
error?: Error; error?: Error;

View File

@ -3,18 +3,18 @@
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer v-if="tab === 'overview'" :content-max="600" :margin-min="20"> <MkSpacer v-if="tab === 'overview'" :content-max="600" :margin-min="20">
<div class="_gaps_m"> <div class="_gaps_m">
<div class="fwhjspax" :style="{ backgroundImage: `url(${ $instance.bannerUrl })` }"> <div class="fwhjspax" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }">
<div class="content"> <div class="content">
<img :src="$instance.iconUrl ?? $instance.faviconUrl ?? '/favicon.ico'" alt="" class="icon"/> <img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" alt="" class="icon"/>
<div class="name"> <div class="name">
<b>{{ $instance.name ?? host }}</b> <b>{{ instance.name ?? host }}</b>
</div> </div>
</div> </div>
</div> </div>
<MkKeyValue> <MkKeyValue>
<template #key>{{ i18n.ts.description }}</template> <template #key>{{ i18n.ts.description }}</template>
<template #value><div v-html="$instance.description"></div></template> <template #value><div v-html="instance.description"></div></template>
</MkKeyValue> </MkKeyValue>
<FormSection> <FormSection>
@ -23,7 +23,7 @@
<template #key>Misskey</template> <template #key>Misskey</template>
<template #value>{{ version }}</template> <template #value>{{ version }}</template>
</MkKeyValue> </MkKeyValue>
<div v-html="i18n.t('poweredByMisskeyDescription', { name: $instance.name ?? host })"> <div v-html="i18n.t('poweredByMisskeyDescription', { name: instance.name ?? host })">
</div> </div>
<FormLink to="/about-misskey">{{ i18n.ts.aboutMisskey }}</FormLink> <FormLink to="/about-misskey">{{ i18n.ts.aboutMisskey }}</FormLink>
</div> </div>
@ -34,14 +34,14 @@
<FormSplit> <FormSplit>
<MkKeyValue> <MkKeyValue>
<template #key>{{ i18n.ts.administrator }}</template> <template #key>{{ i18n.ts.administrator }}</template>
<template #value>{{ $instance.maintainerName }}</template> <template #value>{{ instance.maintainerName }}</template>
</MkKeyValue> </MkKeyValue>
<MkKeyValue> <MkKeyValue>
<template #key>{{ i18n.ts.contact }}</template> <template #key>{{ i18n.ts.contact }}</template>
<template #value>{{ $instance.maintainerEmail }}</template> <template #value>{{ instance.maintainerEmail }}</template>
</MkKeyValue> </MkKeyValue>
</FormSplit> </FormSplit>
<FormLink v-if="$instance.tosUrl" :to="$instance.tosUrl" external>{{ i18n.ts.tos }}</FormLink> <FormLink v-if="instance.tosUrl" :to="instance.tosUrl" external>{{ i18n.ts.tos }}</FormLink>
</div> </div>
</FormSection> </FormSection>
@ -101,6 +101,7 @@ import number from '@/filters/number';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { claimAchievement } from '@/scripts/achievements'; import { claimAchievement } from '@/scripts/achievements';
import { instance } from '@/instance';
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
initialTab?: string; initialTab?: string;

View File

@ -4,7 +4,7 @@
<MkSpacer :content-max="700" :margin-min="16"> <MkSpacer :content-max="700" :margin-min="16">
<div class="lxpfedzu"> <div class="lxpfedzu">
<div class="banner"> <div class="banner">
<img :src="$instance.iconUrl || '/favicon.ico'" alt="" class="icon"/> <img :src="instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
</div> </div>
<MkInfo v-if="thereIsUnresolvedAbuseReport" warn class="info">{{ i18n.ts.thereIsUnresolvedAbuseReportWarning }} <MkA to="/admin/abuses" class="_link">{{ i18n.ts.check }}</MkA></MkInfo> <MkInfo v-if="thereIsUnresolvedAbuseReport" warn class="info">{{ i18n.ts.thereIsUnresolvedAbuseReportWarning }} <MkA to="/admin/abuses" class="_link">{{ i18n.ts.check }}</MkA></MkInfo>
@ -221,7 +221,7 @@ onUnmounted(() => {
}); });
watch(router.currentRef, (to) => { watch(router.currentRef, (to) => {
if (to.route.path === "/admin" && to.child?.route.name == null && !narrow) { if (to.route.path === '/admin' && to.child?.route.name == null && !narrow) {
router.replace('/admin/overview'); router.replace('/admin/overview');
} }
}); });

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="wbrkwale"> <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"/> <MkLoading v-if="fetching"/>
<div v-else class="instances"> <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"> <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 * as os from '@/os';
import { useInterval } from '@/scripts/use-interval'; import { useInterval } from '@/scripts/use-interval';
import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue'; import MkInstanceCardMini from '@/components/MkInstanceCardMini.vue';
import { defaultStore } from '@/store';
const instances = ref([]); const instances = ref([]);
const fetching = ref(true); const fetching = ref(true);

View File

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

View File

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

View File

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

View File

@ -2,9 +2,9 @@
<MkStickyContainer> <MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700"> <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"> <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 v-if="started" :class="$style.started">
<div class="main _panel"> <div class="main _panel">
<MkAsUi v-if="root" :component="root" :components="components"/> <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 { createAiScriptEnv } from '@/scripts/aiscript/api';
import MkFolder from '@/components/MkFolder.vue'; import MkFolder from '@/components/MkFolder.vue';
import MkCode from '@/components/MkCode.vue'; import MkCode from '@/components/MkCode.vue';
import { defaultStore } from '@/store';
const props = defineProps<{ const props = defineProps<{
id: string; id: string;

View File

@ -3,7 +3,7 @@
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="1000" :margin-min="16" :margin-max="32"> <MkSpacer :content-max="1000" :margin-min="16" :margin-max="32">
<div class="_root"> <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 v-if="post" class="rkxwuolj">
<div class="files"> <div class="files">
<div v-for="file in post.files" :key="file.id" class="file"> <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 { useRouter } from '@/router';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { defaultStore } from '@/store';
const router = useRouter(); const router = useRouter();

View File

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

View File

@ -2,7 +2,7 @@
<MkStickyContainer> <MkStickyContainer>
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template> <template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer :content-max="700"> <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 v-if="page" :key="page.id" class="xcukqgmh">
<div class="main"> <div class="main">
<!-- <!--
@ -75,7 +75,7 @@ import MkPagination from '@/components/MkPagination.vue';
import MkPagePreview from '@/components/MkPagePreview.vue'; import MkPagePreview from '@/components/MkPagePreview.vue';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { pageViewInterruptors } from '@/store'; import { pageViewInterruptors, defaultStore } from '@/store';
import { deepClone } from '@/scripts/clone'; import { deepClone } from '@/scripts/clone';
const props = defineProps<{ 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> <template #header><MkPageHeader v-model:tab="src" :actions="headerActions" :tabs="$i ? headerTabs : headerTabsWhenNotLogin" :display-my-avatar="true"/></template>
<MkSpacer :content-max="800"> <MkSpacer :content-max="800">
<div ref="rootEl" v-hotkey.global="keymap"> <div ref="rootEl" v-hotkey.global="keymap">
<XTutorial v-if="$i && $store.reactiveState.tutorial.value != -1" class="_panel" style="margin-bottom: var(--margin);"/> <XTutorial v-if="$i && defaultStore.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);"/> <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 v-if="queue > 0" :class="$style.new"><button class="_buttonPrimary" @click="top()">{{ i18n.ts.newNoteRecived }}</button></div>
<div :class="$style.tl"> <div :class="$style.tl">

View File

@ -14,7 +14,7 @@
</div> </div>
<div class="contents"> <div class="contents">
<div class="main"> <div class="main">
<img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/> <img :src="instance.iconUrl || instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
<button class="_button _acrylic menu" @click="showMenu"><i class="ti ti-dots"></i></button> <button class="_button _acrylic menu" @click="showMenu"><i class="ti ti-dots"></i></button>
<div class="fg"> <div class="fg">
<h1> <h1>

View File

@ -1,4 +1,3 @@
import autobind from 'autobind-decorator';
import { ref, Ref, unref } from 'vue'; import { ref, Ref, unref } from 'vue';
import { collectPageVars } from '../collect-page-vars'; import { collectPageVars } from '../collect-page-vars';
import { initHpmlLib } from './lib'; import { initHpmlLib } from './lib';
@ -51,7 +50,6 @@ export class Hpml {
this.eval(); this.eval();
} }
@autobind
public eval() { public eval() {
try { try {
this.vars.value = this.evaluateVars(); this.vars.value = this.evaluateVars();
@ -60,7 +58,6 @@ export class Hpml {
} }
} }
@autobind
public interpolate(str: string) { public interpolate(str: string) {
if (str == null) return null; if (str == null) return null;
return str.replace(/{(.+?)}/g, match => { return str.replace(/{(.+?)}/g, match => {
@ -69,12 +66,10 @@ export class Hpml {
}); });
} }
@autobind
public registerCanvas(id: string, canvas: any) { public registerCanvas(id: string, canvas: any) {
this.canvases[id] = canvas; this.canvases[id] = canvas;
} }
@autobind
public updatePageVar(name: string, value: any) { public updatePageVar(name: string, value: any) {
const pageVar = this.pageVars.find(v => v.name === name); const pageVar = this.pageVars.find(v => v.name === name);
if (pageVar !== undefined) { if (pageVar !== undefined) {
@ -84,13 +79,11 @@ export class Hpml {
} }
} }
@autobind
public updateRandomSeed(seed: string) { public updateRandomSeed(seed: string) {
this.opts.randomSeed = seed; this.opts.randomSeed = seed;
this.envVars.SEED = seed; this.envVars.SEED = seed;
} }
@autobind
private _interpolateScope(str: string, scope: HpmlScope) { private _interpolateScope(str: string, scope: HpmlScope) {
return str.replace(/{(.+?)}/g, match => { return str.replace(/{(.+?)}/g, match => {
const v = scope.getState(match.slice(1, -1).trim()); const v = scope.getState(match.slice(1, -1).trim());
@ -98,7 +91,6 @@ export class Hpml {
}); });
} }
@autobind
public evaluateVars(): Record<string, any> { public evaluateVars(): Record<string, any> {
const values: Record<string, any> = {}; const values: Record<string, any> = {};
@ -117,7 +109,6 @@ export class Hpml {
return values; return values;
} }
@autobind
private evaluate(expr: Expr, scope: HpmlScope): any { private evaluate(expr: Expr, scope: HpmlScope): any {
if (isLiteralValue(expr)) { if (isLiteralValue(expr)) {
if (expr.type === null) { if (expr.type === null) {

View File

@ -2,7 +2,6 @@
* Hpml * Hpml
*/ */
import autobind from 'autobind-decorator';
import { Hpml } from './evaluator'; import { Hpml } from './evaluator';
import { funcDefs } from './lib'; import { funcDefs } from './lib';
@ -61,7 +60,6 @@ export class HpmlScope {
this.name = name ?? 'anonymous'; this.name = name ?? 'anonymous';
} }
@autobind
public createChildScope(states: Record<string, any>, name?: HpmlScope['name']): HpmlScope { public createChildScope(states: Record<string, any>, name?: HpmlScope['name']): HpmlScope {
const layer = [states, ...this.layerdStates]; const layer = [states, ...this.layerdStates];
return new HpmlScope(layer, name); return new HpmlScope(layer, name);
@ -71,7 +69,6 @@ export class HpmlScope {
* *
* @param name * @param name
*/ */
@autobind
public getState(name: string): any { public getState(name: string): any {
for (const later of this.layerdStates) { for (const later of this.layerdStates) {
const state = later[name]; const state = later[name];

View File

@ -1,4 +1,3 @@
import autobind from 'autobind-decorator';
import { isLiteralValue } from './expr'; import { isLiteralValue } from './expr';
import { funcDefs } from './lib'; import { funcDefs } from './lib';
import { envVarsDef } from '.'; import { envVarsDef } from '.';
@ -23,7 +22,6 @@ export class HpmlTypeChecker {
this.pageVars = pageVars; this.pageVars = pageVars;
} }
@autobind
public typeCheck(v: Expr): TypeError | null { public typeCheck(v: Expr): TypeError | null {
if (isLiteralValue(v)) return null; if (isLiteralValue(v)) return null;
@ -61,7 +59,6 @@ export class HpmlTypeChecker {
return null; return null;
} }
@autobind
public getExpectedType(v: Expr, slot: number): Type { public getExpectedType(v: Expr, slot: number): Type {
const def = funcDefs[v.type ?? '']; const def = funcDefs[v.type ?? ''];
if (def == null) { if (def == null) {
@ -89,7 +86,6 @@ export class HpmlTypeChecker {
} }
} }
@autobind
public infer(v: Expr): Type { public infer(v: Expr): Type {
if (v.type === null) return null; if (v.type === null) return null;
if (v.type === 'text') return 'string'; if (v.type === 'text') return 'string';
@ -144,7 +140,6 @@ export class HpmlTypeChecker {
} }
} }
@autobind
public getVarByName(name: string): Variable { public getVarByName(name: string): Variable {
const v = this.variables.find(x => x.name === name); const v = this.variables.find(x => x.name === name);
if (v !== undefined) { if (v !== undefined) {
@ -154,25 +149,21 @@ export class HpmlTypeChecker {
} }
} }
@autobind
public getVarsByType(type: Type): Variable[] { public getVarsByType(type: Type): Variable[] {
if (type == null) return this.variables; if (type == null) return this.variables;
return this.variables.filter(x => (this.infer(x) === null) || (this.infer(x) === type)); return this.variables.filter(x => (this.infer(x) === null) || (this.infer(x) === type));
} }
@autobind
public getEnvVarsByType(type: Type): string[] { public getEnvVarsByType(type: Type): string[] {
if (type == null) return Object.keys(envVarsDef); if (type == null) return Object.keys(envVarsDef);
return Object.entries(envVarsDef).filter(([k, v]) => v === null || type === v).map(([k, v]) => k); return Object.entries(envVarsDef).filter(([k, v]) => v === null || type === v).map(([k, v]) => k);
} }
@autobind
public getPageVarsByType(type: Type): string[] { public getPageVarsByType(type: Type): string[] {
if (type == null) return this.pageVars.map(v => v.name); if (type == null) return this.pageVars.map(v => v.name);
return this.pageVars.filter(v => type === v.type).map(v => v.name); return this.pageVars.filter(v => type === v.type).map(v => v.name);
} }
@autobind
public isUsedName(name: string) { public isUsedName(name: string) {
if (this.variables.some(v => v.name === name)) { if (this.variables.some(v => v.name === name)) {
return true; return true;

View File

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

View File

@ -2,9 +2,9 @@
<div class="kmwsukvl"> <div class="kmwsukvl">
<div class="body"> <div class="body">
<div class="top"> <div class="top">
<div class="banner" :style="{ backgroundImage: `url(${ $instance.bannerUrl })` }"></div> <div class="banner" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }"></div>
<button v-click-anime class="item _button instance" @click="openInstanceMenu"> <button v-click-anime class="item _button instance" @click="openInstanceMenu">
<img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/> <img :src="instance.iconUrl || instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
</button> </button>
</div> </div>
<div class="middle"> <div class="middle">
@ -50,6 +50,7 @@ import { navbarItemDef } from '@/navbar';
import { openAccountMenu as openAccountMenu_ } from '@/account'; import { openAccountMenu as openAccountMenu_ } from '@/account';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { instance } from '@/instance';
const menu = toRef(defaultStore.state, 'menu'); const menu = toRef(defaultStore.state, 'menu');
const otherMenuItemIndicated = computed(() => { const otherMenuItemIndicated = computed(() => {

View File

@ -2,9 +2,9 @@
<div class="mvcprjjd" :class="{ iconOnly }"> <div class="mvcprjjd" :class="{ iconOnly }">
<div class="body"> <div class="body">
<div class="top"> <div class="top">
<div class="banner" :style="{ backgroundImage: `url(${ $instance.bannerUrl })` }"></div> <div class="banner" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }"></div>
<button v-click-anime v-tooltip.noDelay.right="$instance.name ?? i18n.ts.instance" class="item _button instance" @click="openInstanceMenu"> <button v-click-anime v-tooltip.noDelay.right="instance.name ?? i18n.ts.instance" class="item _button instance" @click="openInstanceMenu">
<img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/> <img :src="instance.iconUrl || instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
</button> </button>
</div> </div>
<div class="middle"> <div class="middle">
@ -60,6 +60,7 @@ import { navbarItemDef } from '@/navbar';
import { $i, openAccountMenu as openAccountMenu_ } from '@/account'; import { $i, openAccountMenu as openAccountMenu_ } from '@/account';
import { defaultStore } from '@/store'; import { defaultStore } from '@/store';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { instance } from '@/instance';
const iconOnly = ref(false); const iconOnly = ref(false);

View File

@ -1,5 +1,5 @@
<template> <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><i class="ti ti-alert-triangle"></i> {{ i18n.ts.disconnectedFromServer }}</div>
<div :class="$style.command" class="_buttons"> <div :class="$style.command" class="_buttons">
<MkButton :class="$style.commandButton" small primary @click="reload">{{ i18n.ts.reload }}</MkButton> <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 { i18n } from '@/i18n';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import * as os from '@/os'; import * as os from '@/os';
import { defaultStore } from '@/store';
const zIndex = os.claimZIndex('high'); const zIndex = os.claimZIndex('high');

View File

@ -3,7 +3,7 @@
<div class="body"> <div class="body">
<div class="left"> <div class="left">
<button v-click-anime class="item _button instance" @click="openInstanceMenu"> <button v-click-anime class="item _button instance" @click="openInstanceMenu">
<img :src="$instance.iconUrl ?? $instance.faviconUrl ?? '/favicon.ico'" class="_ghost"/> <img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" class="_ghost"/>
</button> </button>
<MkA v-click-anime v-tooltip="$ts.timeline" class="item index" active-class="active" to="/" exact> <MkA v-click-anime v-tooltip="$ts.timeline" class="item index" active-class="active" to="/" exact>
<i class="ti ti-home ti-fw"></i> <i class="ti ti-home ti-fw"></i>
@ -50,6 +50,8 @@ import { navbarItemDef } from '@/navbar';
import { openAccountMenu } from '@/account'; import { openAccountMenu } from '@/account';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { mainRouter } from '@/router'; import { mainRouter } from '@/router';
import { defaultStore } from '@/store';
import { instance } from '@/instance';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -63,12 +65,14 @@ export default defineComponent({
connection: null, connection: null,
navbarItemDef: navbarItemDef, navbarItemDef: navbarItemDef,
settingsWindowed: false, settingsWindowed: false,
defaultStore,
instance,
}; };
}, },
computed: { computed: {
menu(): string[] { menu(): string[] {
return this.$store.state.menu; return defaultStore.state.menu;
}, },
otherNavItemIndicated(): boolean { otherNavItemIndicated(): boolean {
@ -81,7 +85,7 @@ export default defineComponent({
}, },
watch: { watch: {
'$store.reactiveState.menuDisplay.value'() { 'defaultStore.reactiveState.menuDisplay.value'() {
this.calcViewState(); this.calcViewState();
}, },
}, },

View File

@ -33,7 +33,7 @@
<div class="divider"></div> <div class="divider"></div>
<div class="about"> <div class="about">
<button v-click-anime class="item _button" @click="openInstanceMenu"> <button v-click-anime class="item _button" @click="openInstanceMenu">
<img :src="$instance.iconUrl ?? $instance.faviconUrl ?? '/favicon.ico'" class="_ghost"/> <img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" class="_ghost"/>
</button> </button>
</div> </div>
<!--<MisskeyLogo class="misskey"/>--> <!--<MisskeyLogo class="misskey"/>-->
@ -51,6 +51,8 @@ import MkButton from '@/components/MkButton.vue';
import { StickySidebar } from '@/scripts/sticky-sidebar'; import { StickySidebar } from '@/scripts/sticky-sidebar';
import { mainRouter } from '@/router'; import { mainRouter } from '@/router';
//import MisskeyLogo from '@assets/client/misskey.svg'; //import MisskeyLogo from '@assets/client/misskey.svg';
import { defaultStore } from '@/store';
import { instance } from '@/instance';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -66,12 +68,14 @@ export default defineComponent({
navbarItemDef: navbarItemDef, navbarItemDef: navbarItemDef,
iconOnly: false, iconOnly: false,
settingsWindowed: false, settingsWindowed: false,
defaultStore,
instance,
}; };
}, },
computed: { computed: {
menu(): string[] { menu(): string[] {
return this.$store.state.menu; return this.defaultStore.state.menu;
}, },
otherNavItemIndicated(): boolean { otherNavItemIndicated(): boolean {
@ -84,7 +88,7 @@ export default defineComponent({
}, },
watch: { watch: {
'$store.reactiveState.menuDisplay.value'() { 'defaultStore.reactiveState.menuDisplay.value'() {
this.calcViewState(); this.calcViewState();
}, },
@ -111,7 +115,7 @@ export default defineComponent({
openInstanceMenu, openInstanceMenu,
calcViewState() { 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); this.settingsWindowed = (window.innerWidth > 1400);
}, },

View File

@ -21,7 +21,7 @@
</div> </div>
</div> </div>
<Transition :name="$store.state.animation ? 'tray-back' : ''"> <Transition :name="defaultStore.state.animation ? 'tray-back' : ''">
<div <div
v-if="widgetsShowing" v-if="widgetsShowing"
class="tray-back _modalBg" class="tray-back _modalBg"
@ -30,11 +30,11 @@
></div> ></div>
</Transition> </Transition>
<Transition :name="$store.state.animation ? 'tray' : ''"> <Transition :name="defaultStore.state.animation ? 'tray' : ''">
<XWidgets v-if="widgetsShowing" class="tray"/> <XWidgets v-if="widgetsShowing" class="tray"/>
</Transition> </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/> <XCommon/>
</div> </div>

View File

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

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="mk-app"> <div class="mk-app">
<div v-if="mainRouter.currentRoute?.name === 'index'" class="banner" :style="{ backgroundImage: `url(${ $instance.bannerUrl })` }"> <div v-if="mainRouter.currentRoute?.name === 'index'" class="banner" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }">
<div> <div>
<h1 v-if="meta"><img v-if="meta.logoImageUrl" class="logo" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span></h1> <h1 v-if="meta"><img v-if="meta.logoImageUrl" class="logo" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span></h1>
<div v-if="meta" class="about"> <div v-if="meta" class="about">
@ -13,7 +13,7 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else class="banner-mini" :style="{ backgroundImage: `url(${ $instance.bannerUrl })` }"> <div v-else class="banner-mini" :style="{ backgroundImage: `url(${ instance.bannerUrl })` }">
<div> <div>
<h1 v-if="meta"><img v-if="meta.logoImageUrl" class="logo" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span></h1> <h1 v-if="meta"><img v-if="meta.logoImageUrl" class="logo" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span></h1>
</div> </div>
@ -42,8 +42,9 @@ import XHeader from './header.vue';
import { host, instanceName } from '@/config'; import { host, instanceName } from '@/config';
import * as os from '@/os'; import * as os from '@/os';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { ColdDeviceStorage } from '@/store'; import { defaultStore, ColdDeviceStorage } from '@/store';
import { mainRouter } from '@/router'; import { mainRouter } from '@/router';
import { instance } from '@/instance';
const DESKTOP_THRESHOLD = 1100; const DESKTOP_THRESHOLD = 1100;
@ -66,6 +67,8 @@ export default defineComponent({
}, },
mainRouter, mainRouter,
isDesktop: window.innerWidth >= DESKTOP_THRESHOLD, isDesktop: window.innerWidth >= DESKTOP_THRESHOLD,
defaultStore,
instance,
}; };
}, },
@ -74,7 +77,7 @@ export default defineComponent({
return { return {
'd': () => { 'd': () => {
if (ColdDeviceStorage.get('syncDeviceDarkMode')) return; if (ColdDeviceStorage.get('syncDeviceDarkMode')) return;
this.$store.set('darkMode', !this.$store.state.darkMode); this.defaultStore.set('darkMode', !this.defaultStore.state.darkMode);
}, },
's': () => { 's': () => {
mainRouter.push('/search'); mainRouter.push('/search');

View File

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

View File

@ -1,6 +1,6 @@
<!-- eslint-disable vue/no-v-html --> <!-- eslint-disable vue/no-v-html -->
<template> <template>
<div class="rwqkcmrc" :style="{ backgroundImage: transparent ? 'none' : `url(${ $instance.backgroundImageUrl })` }"> <div class="rwqkcmrc" :style="{ backgroundImage: transparent ? 'none' : `url(${ instance.backgroundImageUrl })` }">
<div class="back" :class="{ transparent }"></div> <div class="back" :class="{ transparent }"></div>
<div class="contents"> <div class="contents">
<div class="wrapper"> <div class="wrapper">
@ -45,6 +45,7 @@ import MkPagination from '@/components/MkPagination.vue';
import XSigninDialog from '@/components/MkSigninDialog.vue'; import XSigninDialog from '@/components/MkSigninDialog.vue';
import XSignupDialog from '@/components/MkSignupDialog.vue'; import XSignupDialog from '@/components/MkSignupDialog.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import { instance } from '@/instance';
export default defineComponent({ export default defineComponent({
components: { components: {
@ -81,6 +82,7 @@ export default defineComponent({
endpoint: 'announcements', endpoint: 'announcements',
limit: 10, limit: 10,
}, },
instance,
}; };
}, },

View File

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

View File

@ -1,12 +1,12 @@
<template> <template>
<div class="_panel"> <div class="_panel">
<div :class="$style.container" :style="{ backgroundImage: $instance.bannerUrl ? `url(${ $instance.bannerUrl })` : null }"> <div :class="$style.container" :style="{ backgroundImage: instance.bannerUrl ? `url(${ instance.bannerUrl })` : null }">
<div :class="$style.iconContainer"> <div :class="$style.iconContainer">
<img :src="$instance.iconUrl ?? $instance.faviconUrl ?? '/favicon.ico'" alt="" :class="$style.icon"/> <img :src="instance.iconUrl ?? instance.faviconUrl ?? '/favicon.ico'" alt="" :class="$style.icon"/>
</div> </div>
<div :class="$style.bodyContainer"> <div :class="$style.bodyContainer">
<div :class="$style.body"> <div :class="$style.body">
<MkA :class="$style.name" to="/about" behavior="window">{{ $instance.name }}</MkA> <MkA :class="$style.name" to="/about" behavior="window">{{ instance.name }}</MkA>
<div :class="$style.host">{{ host }}</div> <div :class="$style.host">{{ host }}</div>
</div> </div>
</div> </div>
@ -18,6 +18,7 @@
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget'; import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
import { GetFormResultType } from '@/scripts/form'; import { GetFormResultType } from '@/scripts/form';
import { host } from '@/config'; import { host } from '@/config';
import { instance } from '@/instance';
const name = 'instanceInfo'; const name = 'instanceInfo';

View File

@ -5,7 +5,7 @@
<div class="wbrkwala"> <div class="wbrkwala">
<MkLoading v-if="fetching"/> <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 v-for="stat in stats" :key="stat.tag">
<div class="tag"> <div class="tag">
<MkA class="a" :to="`/tags/${ encodeURIComponent(stat.tag) }`" :title="stat.tag">#{{ stat.tag }}</MkA> <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 * as os from '@/os';
import { useInterval } from '@/scripts/use-interval'; import { useInterval } from '@/scripts/use-interval';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
const name = 'hashtags'; const name = 'hashtags';

View File

@ -40,7 +40,6 @@
"dependencies": { "dependencies": {
"@swc/cli": "0.1.62", "@swc/cli": "0.1.62",
"@swc/core": "1.3.42", "@swc/core": "1.3.42",
"autobind-decorator": "^2.4.0",
"eventemitter3": "5.0.0", "eventemitter3": "5.0.0",
"reconnecting-websocket": "^4.4.0" "reconnecting-websocket": "^4.4.0"
} }

View File

@ -1,4 +1,3 @@
import autobind from 'autobind-decorator';
import { EventEmitter } from 'eventemitter3'; import { EventEmitter } from 'eventemitter3';
import ReconnectingWebsocket from 'reconnecting-websocket'; import ReconnectingWebsocket from 'reconnecting-websocket';
import type { BroadcastEvents, Channels } from './streaming.types.js'; import type { BroadcastEvents, Channels } from './streaming.types.js';
@ -36,6 +35,20 @@ export default class Stream extends EventEmitter<StreamEvents> {
WebSocket?: any; WebSocket?: any;
}) { }) {
super(); super();
this.genId = this.genId.bind(this);
this.useChannel = this.useChannel.bind(this);
this.useSharedConnection = this.useSharedConnection.bind(this);
this.removeSharedConnection = this.removeSharedConnection.bind(this);
this.removeSharedConnectionPool = this.removeSharedConnectionPool.bind(this);
this.connectToChannel = this.connectToChannel.bind(this);
this.disconnectToChannel = this.disconnectToChannel.bind(this);
this.onOpen = this.onOpen.bind(this);
this.onClose = this.onClose.bind(this);
this.onMessage = this.onMessage.bind(this);
this.send = this.send.bind(this);
this.close = this.close.bind(this);
options = options ?? { }; options = options ?? { };
const query = urlQuery({ const query = urlQuery({
@ -56,12 +69,10 @@ export default class Stream extends EventEmitter<StreamEvents> {
this.stream.addEventListener('message', this.onMessage); this.stream.addEventListener('message', this.onMessage);
} }
@autobind
private genId(): string { private genId(): string {
return (++this.idCounter).toString(); return (++this.idCounter).toString();
} }
@autobind
public useChannel<C extends keyof Channels>(channel: C, params?: Channels[C]['params'], name?: string): Connection<Channels[C]> { public useChannel<C extends keyof Channels>(channel: C, params?: Channels[C]['params'], name?: string): Connection<Channels[C]> {
if (params) { if (params) {
return this.connectToChannel(channel, params); return this.connectToChannel(channel, params);
@ -70,7 +81,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
} }
} }
@autobind
private useSharedConnection<C extends keyof Channels>(channel: C, name?: string): SharedConnection<Channels[C]> { private useSharedConnection<C extends keyof Channels>(channel: C, name?: string): SharedConnection<Channels[C]> {
let pool = this.sharedConnectionPools.find(p => p.channel === channel); let pool = this.sharedConnectionPools.find(p => p.channel === channel);
@ -84,24 +94,20 @@ export default class Stream extends EventEmitter<StreamEvents> {
return connection; return connection;
} }
@autobind
public removeSharedConnection(connection: SharedConnection): void { public removeSharedConnection(connection: SharedConnection): void {
this.sharedConnections = this.sharedConnections.filter(c => c !== connection); this.sharedConnections = this.sharedConnections.filter(c => c !== connection);
} }
@autobind
public removeSharedConnectionPool(pool: Pool): void { public removeSharedConnectionPool(pool: Pool): void {
this.sharedConnectionPools = this.sharedConnectionPools.filter(p => p !== pool); this.sharedConnectionPools = this.sharedConnectionPools.filter(p => p !== pool);
} }
@autobind
private connectToChannel<C extends keyof Channels>(channel: C, params: Channels[C]['params']): NonSharedConnection<Channels[C]> { private connectToChannel<C extends keyof Channels>(channel: C, params: Channels[C]['params']): NonSharedConnection<Channels[C]> {
const connection = new NonSharedConnection(this, channel, this.genId(), params); const connection = new NonSharedConnection(this, channel, this.genId(), params);
this.nonSharedConnections.push(connection); this.nonSharedConnections.push(connection);
return connection; return connection;
} }
@autobind
public disconnectToChannel(connection: NonSharedConnection): void { public disconnectToChannel(connection: NonSharedConnection): void {
this.nonSharedConnections = this.nonSharedConnections.filter(c => c !== connection); this.nonSharedConnections = this.nonSharedConnections.filter(c => c !== connection);
} }
@ -109,7 +115,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Callback of when open connection * Callback of when open connection
*/ */
@autobind
private onOpen(): void { private onOpen(): void {
const isReconnect = this.state === 'reconnecting'; const isReconnect = this.state === 'reconnecting';
@ -126,7 +131,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Callback of when close connection * Callback of when close connection
*/ */
@autobind
private onClose(): void { private onClose(): void {
if (this.state === 'connected') { if (this.state === 'connected') {
this.state = 'reconnecting'; this.state = 'reconnecting';
@ -137,7 +141,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Callback of when received a message from connection * Callback of when received a message from connection
*/ */
@autobind
private onMessage(message: { data: string; }): void { private onMessage(message: { data: string; }): void {
const { type, body } = JSON.parse(message.data); const { type, body } = JSON.parse(message.data);
@ -167,7 +170,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Send a message to connection * Send a message to connection
*/ */
@autobind
public send(typeOrPayload: any, payload?: any): void { public send(typeOrPayload: any, payload?: any): void {
const data = payload === undefined ? typeOrPayload : { const data = payload === undefined ? typeOrPayload : {
type: typeOrPayload, type: typeOrPayload,
@ -180,7 +182,6 @@ export default class Stream extends EventEmitter<StreamEvents> {
/** /**
* Close this connection * Close this connection
*/ */
@autobind
public close(): void { public close(): void {
this.stream.close(); this.stream.close();
} }
@ -197,6 +198,12 @@ class Pool {
private isConnected = false; private isConnected = false;
constructor(stream: Stream, channel: string, id: string) { constructor(stream: Stream, channel: string, id: string) {
this.onStreamDisconnected = this.onStreamDisconnected.bind(this);
this.inc = this.inc.bind(this);
this.dec = this.dec.bind(this);
this.connect = this.connect.bind(this);
this.disconnect = this.disconnect.bind(this);
this.channel = channel; this.channel = channel;
this.stream = stream; this.stream = stream;
this.id = id; this.id = id;
@ -204,12 +211,10 @@ class Pool {
this.stream.on('_disconnected_', this.onStreamDisconnected); this.stream.on('_disconnected_', this.onStreamDisconnected);
} }
@autobind
private onStreamDisconnected(): void { private onStreamDisconnected(): void {
this.isConnected = false; this.isConnected = false;
} }
@autobind
public inc(): void { public inc(): void {
if (this.users === 0 && !this.isConnected) { if (this.users === 0 && !this.isConnected) {
this.connect(); this.connect();
@ -224,7 +229,6 @@ class Pool {
} }
} }
@autobind
public dec(): void { public dec(): void {
this.users--; this.users--;
@ -238,7 +242,6 @@ class Pool {
} }
} }
@autobind
public connect(): void { public connect(): void {
if (this.isConnected) return; if (this.isConnected) return;
this.isConnected = true; this.isConnected = true;
@ -248,7 +251,6 @@ class Pool {
}); });
} }
@autobind
private disconnect(): void { private disconnect(): void {
this.stream.off('_disconnected_', this.onStreamDisconnected); this.stream.off('_disconnected_', this.onStreamDisconnected);
this.stream.send('disconnect', { id: this.id }); this.stream.send('disconnect', { id: this.id });
@ -268,12 +270,13 @@ export abstract class Connection<Channel extends AnyOf<Channels> = any> extends
constructor(stream: Stream, channel: string, name?: string) { constructor(stream: Stream, channel: string, name?: string) {
super(); super();
this.send = this.send.bind(this);
this.stream = stream; this.stream = stream;
this.channel = channel; this.channel = channel;
this.name = name; this.name = name;
} }
@autobind
public send<T extends keyof Channel['receives']>(type: T, body: Channel['receives'][T]): void { public send<T extends keyof Channel['receives']>(type: T, body: Channel['receives'][T]): void {
this.stream.send('ch', { this.stream.send('ch', {
id: this.id, id: this.id,
@ -297,11 +300,12 @@ class SharedConnection<Channel extends AnyOf<Channels> = any> extends Connection
constructor(stream: Stream, channel: string, pool: Pool, name?: string) { constructor(stream: Stream, channel: string, pool: Pool, name?: string) {
super(stream, channel, name); super(stream, channel, name);
this.dispose = this.dispose.bind(this);
this.pool = pool; this.pool = pool;
this.pool.inc(); this.pool.inc();
} }
@autobind
public dispose(): void { public dispose(): void {
this.pool.dec(); this.pool.dec();
this.removeAllListeners(); this.removeAllListeners();
@ -316,13 +320,15 @@ class NonSharedConnection<Channel extends AnyOf<Channels> = any> extends Connect
constructor(stream: Stream, channel: string, id: string, params: Channel['params']) { constructor(stream: Stream, channel: string, id: string, params: Channel['params']) {
super(stream, channel); super(stream, channel);
this.connect = this.connect.bind(this);
this.dispose = this.dispose.bind(this);
this.params = params; this.params = params;
this.id = id; this.id = id;
this.connect(); this.connect();
} }
@autobind
public connect(): void { public connect(): void {
this.stream.send('connect', { this.stream.send('connect', {
channel: this.channel, channel: this.channel,
@ -331,7 +337,6 @@ class NonSharedConnection<Channel extends AnyOf<Channels> = any> extends Connect
}); });
} }
@autobind
public dispose(): void { public dispose(): void {
this.removeAllListeners(); this.removeAllListeners();
this.stream.send('disconnect', { id: this.id }); this.stream.send('disconnect', { id: this.id });

View File

@ -612,9 +612,6 @@ importers:
'@vue/compiler-sfc': '@vue/compiler-sfc':
specifier: 3.2.47 specifier: 3.2.47
version: 3.2.47 version: 3.2.47
autobind-decorator:
specifier: 2.4.0
version: 2.4.0
autosize: autosize:
specifier: 5.0.2 specifier: 5.0.2
version: 5.0.2 version: 5.0.2
@ -952,9 +949,6 @@ importers:
'@swc/core': '@swc/core':
specifier: 1.3.42 specifier: 1.3.42
version: 1.3.42 version: 1.3.42
autobind-decorator:
specifier: ^2.4.0
version: 2.4.0
eventemitter3: eventemitter3:
specifier: 5.0.0 specifier: 5.0.0
version: 5.0.0 version: 5.0.0