0
0

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" />
import type { $i } from '@/account';
import type { defaultStore } from '@/store';
import type { instance } from '@/instance';
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

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

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="animation ? $style.transition_fade_enterActive : ''"
:leave-active-class="animation ? $style.transition_fade_leaveActive : ''"
:enter-from-class="animation ? $style.transition_fade_enterFrom : ''"
:leave-to-class="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')"/>
@ -19,6 +19,7 @@ import { MenuItem } from './types/menu.vue';
import contains from '@/scripts/contains';
import { defaultStore } from '@/store';
import * as os from '@/os';
import { defaultStore } from '@/store';
const props = defineProps<{
items: MenuItem[];
@ -29,8 +30,6 @@ const emit = defineEmits<{
(ev: 'closed'): void;
}>();
const animation = $computed(() => defaultStore.state.animation);
let rootEl = $shallowRef<HTMLDivElement>();
let zIndex = $ref<number>(os.claimZIndex('high'));

View File

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

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,27 +1,28 @@
<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;
maxNumber?: number;
note: misskey.entities.Note;
maxNumber?: number;
}>(), {
maxNumber: Infinity,
maxNumber: Infinity,
});
const initialReactions = new Set(Object.keys(props.note.reactions));

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 || 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>
@ -17,5 +17,4 @@ defineProps<{
}>();
const host = toUnicode(hostRaw);
const showFullAcct = $ref(defaultStore.state.showFullAcct);
</script>

View File

@ -1,5 +1,5 @@
<template>
<Transition :name="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>
@ -13,7 +13,6 @@ import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n';
import { defaultStore } from '@/store';
const animation = $ref(defaultStore.reactiveState.animation);
const emit = defineEmits<{
(ev: 'retry'): void;
}>();

View File

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

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

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

View File

@ -201,8 +201,6 @@ if (_DEV_) {
// TODO: 廃止
app.config.globalProperties = {
$i,
$store: defaultStore,
$instance: instance,
$t: i18n.t,
$ts: i18n.ts,
};
@ -356,7 +354,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

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

View File

@ -4,7 +4,7 @@
<MkSpacer :content-max="700" :margin-min="16">
<div class="lxpfedzu">
<div class="banner">
<img :src="$instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
<img :src="instance.iconUrl || '/favicon.ico'" alt="" class="icon"/>
</div>
<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) => {
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');
}
});

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

@ -14,7 +14,7 @@
</div>
<div class="contents">
<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>
<div class="fg">
<h1>

View File

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

View File

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

View File

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

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

@ -2,9 +2,9 @@
<div class="kmwsukvl">
<div class="body">
<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">
<img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
<img :src="instance.iconUrl || instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
</button>
</div>
<div class="middle">
@ -50,6 +50,7 @@ import { navbarItemDef } from '@/navbar';
import { openAccountMenu as openAccountMenu_ } from '@/account';
import { defaultStore } from '@/store';
import { i18n } from '@/i18n';
import { instance } from '@/instance';
const menu = toRef(defaultStore.state, 'menu');
const otherMenuItemIndicated = computed(() => {

View File

@ -2,9 +2,9 @@
<div class="mvcprjjd" :class="{ iconOnly }">
<div class="body">
<div class="top">
<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">
<img :src="$instance.iconUrl || $instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
<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">
<img :src="instance.iconUrl || instance.faviconUrl || '/favicon.ico'" alt="" class="icon"/>
</button>
</div>
<div class="middle">
@ -60,6 +60,7 @@ import { navbarItemDef } from '@/navbar';
import { $i, openAccountMenu as openAccountMenu_ } from '@/account';
import { defaultStore } from '@/store';
import { i18n } from '@/i18n';
import { instance } from '@/instance';
const iconOnly = ref(false);

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

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

View File

@ -33,7 +33,7 @@
<div class="divider"></div>
<div class="about">
<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>
</div>
<!--<MisskeyLogo class="misskey"/>-->
@ -51,6 +51,8 @@ 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';
import { instance } from '@/instance';
export default defineComponent({
components: {
@ -66,12 +68,14 @@ export default defineComponent({
navbarItemDef: navbarItemDef,
iconOnly: false,
settingsWindowed: false,
defaultStore,
instance,
};
},
computed: {
menu(): string[] {
return this.$store.state.menu;
return this.defaultStore.state.menu;
},
otherNavItemIndicated(): boolean {
@ -84,7 +88,7 @@ export default defineComponent({
},
watch: {
'$store.reactiveState.menuDisplay.value'() {
'defaultStore.reactiveState.menuDisplay.value'() {
this.calcViewState();
},
@ -111,7 +115,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

@ -1,6 +1,6 @@
<template>
<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>
<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">
@ -13,7 +13,7 @@
</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>
<h1 v-if="meta"><img v-if="meta.logoImageUrl" class="logo" :src="meta.logoImageUrl"><span v-else class="text">{{ instanceName }}</span></h1>
</div>
@ -42,8 +42,9 @@ 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';
import { instance } from '@/instance';
const DESKTOP_THRESHOLD = 1100;
@ -66,6 +67,8 @@ export default defineComponent({
},
mainRouter,
isDesktop: window.innerWidth >= DESKTOP_THRESHOLD,
defaultStore,
instance,
};
},
@ -74,7 +77,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

@ -1,6 +1,6 @@
<!-- eslint-disable vue/no-v-html -->
<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="contents">
<div class="wrapper">
@ -45,6 +45,7 @@ import MkPagination from '@/components/MkPagination.vue';
import XSigninDialog from '@/components/MkSigninDialog.vue';
import XSignupDialog from '@/components/MkSignupDialog.vue';
import MkButton from '@/components/MkButton.vue';
import { instance } from '@/instance';
export default defineComponent({
components: {
@ -81,6 +82,7 @@ export default defineComponent({
endpoint: 'announcements',
limit: 10,
},
instance,
};
},

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

@ -1,12 +1,12 @@
<template>
<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">
<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 :class="$style.bodyContainer">
<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>
</div>
@ -18,6 +18,7 @@
import { useWidgetPropsManager, Widget, WidgetComponentExpose } from './widget';
import { GetFormResultType } from '@/scripts/form';
import { host } from '@/config';
import { instance } from '@/instance';
const name = 'instanceInfo';

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';

View File

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

View File

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

View File

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