refactor(frontend): remove $i
This commit is contained in:
parent
7a8a756789
commit
f16a7cbcf2
|
@ -1,12 +1,9 @@
|
||||||
/// <reference types="vue/macros-global" />
|
/// <reference types="vue/macros-global" />
|
||||||
|
|
||||||
import type { $i } from '@/account';
|
|
||||||
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;
|
|
||||||
$t: typeof i18n['t'];
|
$t: typeof i18n['t'];
|
||||||
$ts: typeof i18n['ts'];
|
$ts: typeof i18n['ts'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { } from 'vue';
|
import { } from 'vue';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
text: string;
|
text: string;
|
||||||
|
|
|
@ -22,6 +22,7 @@ import * as misskey from 'misskey-js';
|
||||||
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
||||||
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
||||||
import MkCwButton from '@/components/MkCwButton.vue';
|
import MkCwButton from '@/components/MkCwButton.vue';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
|
|
|
@ -33,6 +33,7 @@ import MkCwButton from '@/components/MkCwButton.vue';
|
||||||
import { notePage } from '@/filters/note';
|
import { notePage } from '@/filters/note';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
note: misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
|
|
|
@ -36,6 +36,7 @@ import MkTextarea from '@/components/MkTextarea.vue';
|
||||||
import MkRadio from '@/components/MkRadio.vue';
|
import MkRadio from '@/components/MkRadio.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import * as config from '@/config';
|
import * as config from '@/config';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
|
@ -51,6 +52,7 @@ export default defineComponent({
|
||||||
text: '',
|
text: '',
|
||||||
flag: true,
|
flag: true,
|
||||||
radio: 'misskey',
|
radio: 'misskey',
|
||||||
|
$i,
|
||||||
mfm: `Hello world! This is an @example mention. BTW you are @${this.$i ? this.$i.username : 'guest'}.\nAlso, here is ${config.url} and [example link](${config.url}). for more details, see https://example.com.\nAs you know #misskey is open-source software.`,
|
mfm: `Hello world! This is an @example mention. BTW you are @${this.$i ? this.$i.username : 'guest'}.\nAlso, here is ${config.url} and [example link](${config.url}). for more details, see https://example.com.\nAs you know #misskey is open-source software.`,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,6 +27,7 @@ import * as misskey from 'misskey-js';
|
||||||
import MkMediaList from '@/components/MkMediaList.vue';
|
import MkMediaList from '@/components/MkMediaList.vue';
|
||||||
import MkPoll from '@/components/MkPoll.vue';
|
import MkPoll from '@/components/MkPoll.vue';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
|
|
|
@ -33,6 +33,7 @@ import * as misskey from 'misskey-js';
|
||||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||||
import { userPage } from '@/filters/user';
|
import { userPage } from '@/filters/user';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
user: misskey.entities.UserDetailed;
|
user: misskey.entities.UserDetailed;
|
||||||
|
|
|
@ -60,6 +60,7 @@ 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';
|
import { defaultStore } from '@/store';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
showing: boolean;
|
showing: boolean;
|
||||||
|
|
|
@ -17,6 +17,7 @@ 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';
|
import { defaultStore } from '@/store';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
|
@ -55,7 +56,7 @@ export default defineComponent({
|
||||||
canvas.toBlob(blob => {
|
canvas.toBlob(blob => {
|
||||||
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', $i.token);
|
||||||
if (defaultStore.state.uploadFolder) {
|
if (defaultStore.state.uploadFolder) {
|
||||||
formData.append('folderId', defaultStore.state.uploadFolder);
|
formData.append('folderId', defaultStore.state.uploadFolder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { TextBlock } from '@/scripts/hpml/block';
|
|
||||||
import { Hpml } from '@/scripts/hpml/evaluator';
|
|
||||||
import { defineAsyncComponent, defineComponent, PropType } from 'vue';
|
import { defineAsyncComponent, defineComponent, PropType } from 'vue';
|
||||||
import * as mfm from 'mfm-js';
|
import * as mfm from 'mfm-js';
|
||||||
|
import { TextBlock } from '@/scripts/hpml/block';
|
||||||
|
import { Hpml } from '@/scripts/hpml/evaluator';
|
||||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
|
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
components: {
|
components: {
|
||||||
|
@ -29,6 +30,7 @@ export default defineComponent({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
text: this.hpml.interpolate(this.block.text),
|
text: this.hpml.interpolate(this.block.text),
|
||||||
|
$i,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
@ -200,7 +200,6 @@ if (_DEV_) {
|
||||||
|
|
||||||
// TODO: 廃止
|
// TODO: 廃止
|
||||||
app.config.globalProperties = {
|
app.config.globalProperties = {
|
||||||
$i,
|
|
||||||
$t: i18n.t,
|
$t: i18n.t,
|
||||||
$ts: i18n.ts,
|
$ts: i18n.ts,
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,13 +32,14 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { watch } from 'vue';
|
import { watch } from 'vue';
|
||||||
|
import * as Misskey from 'misskey-js';
|
||||||
import XEmoji from './emojis.emoji.vue';
|
import XEmoji from './emojis.emoji.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import MkInput from '@/components/MkInput.vue';
|
import MkInput from '@/components/MkInput.vue';
|
||||||
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
||||||
import { customEmojis, customEmojiCategories, getCustomEmojiTags } from '@/custom-emojis';
|
import { customEmojis, customEmojiCategories, getCustomEmojiTags } from '@/custom-emojis';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import * as Misskey from 'misskey-js';
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const customEmojiTags = getCustomEmojiTags();
|
const customEmojiTags = getCustomEmojiTags();
|
||||||
let q = $ref('');
|
let q = $ref('');
|
||||||
|
|
|
@ -25,6 +25,7 @@ import MkButton from '@/components/MkButton.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const pagination = {
|
const pagination = {
|
||||||
endpoint: 'announcements' as const,
|
endpoint: 'announcements' as const,
|
||||||
|
|
|
@ -64,6 +64,7 @@ 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';
|
import { defaultStore } from '@/store';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
id: string;
|
id: string;
|
||||||
|
|
|
@ -68,6 +68,7 @@ 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';
|
import { defaultStore } from '@/store';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ import { i18n } from '@/i18n';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
import { pageViewInterruptors, defaultStore } from '@/store';
|
import { pageViewInterruptors, defaultStore } from '@/store';
|
||||||
import { deepClone } from '@/scripts/clone';
|
import { deepClone } from '@/scripts/clone';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
pageName: string;
|
pageName: string;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import FormInfo from '@/components/MkInfo.vue';
|
import FormInfo from '@/components/MkInfo.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { signout } from '@/account';
|
import { signout, $i } from '@/account';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ import { url } from '@/config';
|
||||||
import { userPage, acct } from '@/filters/user';
|
import { userPage, acct } from '@/filters/user';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { iAmAdmin, iAmModerator } from '@/account';
|
import { iAmAdmin, iAmModerator, $i } from '@/account';
|
||||||
import MkRolePreview from '@/components/MkRolePreview.vue';
|
import MkRolePreview from '@/components/MkRolePreview.vue';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<MkMediaList :media-list="note.files"/>
|
<MkMediaList :media-list="note.files"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="note.poll">
|
<div v-if="note.poll">
|
||||||
<MkPoll :note="note" :readOnly="true" />
|
<MkPoll :note="note" :read-only="true"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<MkReactionsViewer ref="reactionsViewer" :note="note"/>
|
<MkReactionsViewer ref="reactionsViewer" :note="note"/>
|
||||||
|
@ -22,13 +22,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
import { Note } from 'misskey-js/built/entities';
|
||||||
|
import { onUpdated } from 'vue';
|
||||||
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
||||||
import MkMediaList from '@/components/MkMediaList.vue';
|
import MkMediaList from '@/components/MkMediaList.vue';
|
||||||
import MkPoll from '@/components/MkPoll.vue';
|
import MkPoll from '@/components/MkPoll.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { Note } from 'misskey-js/built/entities';
|
|
||||||
import { onUpdated } from 'vue';
|
|
||||||
import { getScrollContainer } from '@/scripts/scroll';
|
import { getScrollContainer } from '@/scripts/scroll';
|
||||||
|
import { $i } from '@/account';
|
||||||
|
|
||||||
let notes = $ref<Note[]>([]);
|
let notes = $ref<Note[]>([]);
|
||||||
let isScrolling = $ref(false);
|
let isScrolling = $ref(false);
|
||||||
|
|
|
@ -47,7 +47,7 @@ import { computed, defineAsyncComponent, toRef } from 'vue';
|
||||||
import { openInstanceMenu } from './common';
|
import { openInstanceMenu } from './common';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { navbarItemDef } from '@/navbar';
|
import { navbarItemDef } from '@/navbar';
|
||||||
import { 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';
|
import { instance } from '@/instance';
|
||||||
|
|
|
@ -47,7 +47,7 @@ import { openInstanceMenu } from './_common_/common';
|
||||||
import { host } from '@/config';
|
import { host } from '@/config';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { navbarItemDef } from '@/navbar';
|
import { navbarItemDef } from '@/navbar';
|
||||||
import { openAccountMenu } from '@/account';
|
import { openAccountMenu, $i } 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 { defaultStore } from '@/store';
|
||||||
|
@ -67,6 +67,7 @@ export default defineComponent({
|
||||||
settingsWindowed: false,
|
settingsWindowed: false,
|
||||||
defaultStore,
|
defaultStore,
|
||||||
instance,
|
instance,
|
||||||
|
$i,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ import { openInstanceMenu } from './_common_/common';
|
||||||
import { host } from '@/config';
|
import { host } from '@/config';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { navbarItemDef } from '@/navbar';
|
import { navbarItemDef } from '@/navbar';
|
||||||
import { openAccountMenu } from '@/account';
|
import { openAccountMenu, $i } from '@/account';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
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';
|
||||||
|
@ -70,6 +70,7 @@ export default defineComponent({
|
||||||
settingsWindowed: false,
|
settingsWindowed: false,
|
||||||
defaultStore,
|
defaultStore,
|
||||||
instance,
|
instance,
|
||||||
|
$i,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue