From e33f2398f542a0f08c327de2fe6b88f01f6abeea Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 6 Sep 2020 12:30:27 +0900 Subject: [PATCH] wip --- src/client/components/acct.vue | 3 +- src/client/components/analog-clock.vue | 1 + src/client/components/autocomplete.vue | 9 ++- src/client/components/avatar.vue | 3 +- src/client/components/avatars.vue | 3 +- src/client/components/captcha.vue | 1 + .../components/channel-follow-button.vue | 5 +- src/client/components/channel-preview.vue | 1 + src/client/components/code-core.vue | 3 +- src/client/components/code.vue | 1 + src/client/components/cw-button.vue | 1 + src/client/components/date-separated-list.vue | 1 + src/client/components/deck/antenna-column.vue | 5 +- src/client/components/deck/column-core.vue | 1 + src/client/components/deck/column.vue | 5 +- src/client/components/deck/direct-column.vue | 3 +- src/client/components/deck/list-column.vue | 5 +- .../components/deck/mentions-column.vue | 3 +- .../components/deck/notifications-column.vue | 1 + src/client/components/deck/tl-column.vue | 3 +- src/client/components/deck/widgets-column.vue | 5 +- src/client/components/dialog.vue | 5 +- .../components/drive-file-thumbnail.vue | 1 + src/client/components/drive-window.vue | 1 + src/client/components/drive.file.vue | 17 +++-- src/client/components/drive.folder.vue | 19 ++--- src/client/components/drive.nav-folder.vue | 5 +- src/client/components/drive.vue | 37 ++++----- src/client/components/emoji-picker.vue | 3 +- src/client/components/emoji.vue | 3 +- src/client/components/error.vue | 1 + src/client/components/file-type-icon.vue | 1 + src/client/components/follow-button.vue | 13 ++-- src/client/components/form-window.vue | 1 + src/client/components/formula-core.vue | 3 +- src/client/components/formula.vue | 3 +- src/client/components/google.vue | 1 + src/client/components/header-clock.vue | 1 + src/client/components/image-viewer.vue | 1 + src/client/components/img-with-blurhash.vue | 1 + src/client/components/instance-stats.vue | 23 +++--- src/client/components/link.vue | 5 +- src/client/components/loading.vue | 1 + src/client/components/media-banner.vue | 1 + src/client/components/media-image.vue | 3 +- src/client/components/media-list.vue | 1 + src/client/components/media-video.vue | 1 + src/client/components/mention.vue | 3 +- src/client/components/menu.vue | 7 +- src/client/components/mfm.ts | 3 +- src/client/components/mini-chart.vue | 1 + .../components/misskey-flavored-markdown.vue | 1 + src/client/components/modal.vue | 3 + src/client/components/note-header.vue | 1 + src/client/components/note-preview.vue | 1 + src/client/components/note.sub.vue | 3 +- src/client/components/note.vue | 75 ++++++++++--------- src/client/components/notes.vue | 3 +- .../notification-setting-window.vue | 1 + src/client/components/notification.vue | 11 +-- src/client/components/notifications.vue | 3 +- src/client/components/page-preview.vue | 1 + src/client/components/page/page.block.vue | 1 + src/client/components/page/page.button.vue | 7 +- src/client/components/page/page.canvas.vue | 1 + src/client/components/page/page.counter.vue | 1 + src/client/components/page/page.if.vue | 1 + src/client/components/page/page.image.vue | 1 + .../components/page/page.number-input.vue | 1 + src/client/components/page/page.post.vue | 9 ++- .../components/page/page.radio-button.vue | 1 + src/client/components/page/page.section.vue | 1 + src/client/components/page/page.switch.vue | 1 + .../components/page/page.text-input.vue | 1 + src/client/components/page/page.text.vue | 1 + .../components/page/page.textarea-input.vue | 1 + src/client/components/page/page.textarea.vue | 1 + src/client/components/page/page.vue | 9 ++- src/client/components/particle.vue | 1 + src/client/components/poll-editor.vue | 1 + src/client/components/poll.vue | 3 +- src/client/components/post-form-attaches.vue | 9 ++- src/client/components/post-form-dialog.vue | 1 + src/client/components/post-form.vue | 17 +++-- src/client/components/reaction-icon.vue | 3 +- src/client/components/reaction-picker.vue | 1 + .../components/reactions-viewer.details.vue | 1 + .../components/reactions-viewer.reaction.vue | 9 ++- src/client/components/reactions-viewer.vue | 1 + src/client/components/remote-caution.vue | 1 + src/client/components/sidebar.vue | 23 +++--- src/client/components/signin-dialog.vue | 1 + src/client/components/signin.vue | 19 ++--- src/client/components/signup-dialog.vue | 1 + src/client/components/signup.vue | 11 +-- src/client/components/stream-indicator.vue | 1 + src/client/components/sub-note-content.vue | 1 + src/client/components/tab.vue | 1 + src/client/components/time.vue | 1 + src/client/components/timeline.vue | 1 + src/client/components/toast.vue | 1 + .../components/token-generate-window.vue | 1 + src/client/components/ui/button.vue | 1 + src/client/components/ui/container.vue | 1 + src/client/components/ui/folder.vue | 1 + src/client/components/ui/hr.vue | 3 +- src/client/components/ui/info.vue | 1 + src/client/components/ui/input.vue | 1 + src/client/components/ui/pagination.vue | 3 +- src/client/components/ui/radio.vue | 3 +- src/client/components/ui/range.vue | 3 +- src/client/components/ui/select.vue | 1 + src/client/components/ui/switch.vue | 3 +- src/client/components/ui/textarea.vue | 1 + src/client/components/ui/tooltip.vue | 1 + src/client/components/uploader.vue | 7 +- src/client/components/url-preview-popup.vue | 1 + src/client/components/url-preview.vue | 3 +- src/client/components/url.vue | 5 +- src/client/components/user-list.vue | 3 +- src/client/components/user-menu.vue | 55 +++++++------- src/client/components/user-name.vue | 1 + src/client/components/user-preview.vue | 3 +- src/client/components/user-select.vue | 3 +- src/client/components/users-dialog.vue | 3 +- src/client/components/visibility-chooser.vue | 1 + src/client/components/window.vue | 1 + src/client/config.ts | 1 + src/client/deck.vue | 19 ++--- src/client/default.vue | 19 ++--- src/client/directives/autocomplete.ts | 2 +- src/client/directives/particle.ts | 2 +- src/client/directives/tooltip.ts | 4 +- src/client/directives/user-preview.ts | 2 +- src/client/filters/user.ts | 4 +- src/client/i18n.ts | 4 +- src/client/init.ts | 16 ++-- src/client/os.ts | 20 +++++ src/client/pages/about-misskey.vue | 5 +- src/client/pages/about.vue | 5 +- src/client/pages/announcements.vue | 7 +- src/client/pages/apps.vue | 5 +- src/client/pages/auth.form.vue | 7 +- src/client/pages/auth.vue | 7 +- src/client/pages/channel-editor.vue | 21 +++--- src/client/pages/channel.vue | 11 +-- src/client/pages/channels.vue | 9 ++- src/client/pages/doc.vue | 5 +- src/client/pages/docs.vue | 3 +- src/client/pages/drive.vue | 5 +- src/client/pages/explore.vue | 11 +-- src/client/pages/favorites.vue | 5 +- src/client/pages/featured.vue | 5 +- src/client/pages/follow-requests.vue | 7 +- src/client/pages/follow.vue | 21 +++--- src/client/pages/index.home.tutorial.vue | 3 +- src/client/pages/index.home.vue | 17 +++-- src/client/pages/index.vue | 1 + src/client/pages/index.welcome.entrance.vue | 13 ++-- src/client/pages/index.welcome.setup.vue | 11 +-- src/client/pages/index.welcome.vue | 3 +- src/client/pages/instance/announcements.vue | 25 ++++--- src/client/pages/instance/emojis.vue | 29 +++---- src/client/pages/instance/federation.vue | 9 ++- src/client/pages/instance/files.vue | 11 +-- .../pages/instance/index.queue-chart.vue | 3 +- src/client/pages/instance/index.vue | 31 ++++---- src/client/pages/instance/instance.vue | 29 +++---- src/client/pages/instance/queue.chart.vue | 3 +- src/client/pages/instance/queue.vue | 9 ++- src/client/pages/instance/relays.vue | 15 ++-- src/client/pages/instance/settings.vue | 41 +++++----- src/client/pages/instance/users.user.vue | 45 +++++------ src/client/pages/instance/users.vue | 29 +++---- src/client/pages/mentions.vue | 5 +- src/client/pages/messages.vue | 5 +- src/client/pages/messaging/index.vue | 19 ++--- .../pages/messaging/messaging-room.form.vue | 15 ++-- .../messaging/messaging-room.message.vue | 5 +- src/client/pages/messaging/messaging-room.vue | 13 ++-- src/client/pages/miauth.vue | 7 +- .../pages/my-antennas/index.antenna.vue | 31 ++++---- src/client/pages/my-antennas/index.vue | 5 +- src/client/pages/my-groups/group.vue | 35 ++++----- src/client/pages/my-groups/index.vue | 21 +++--- src/client/pages/my-lists/index.vue | 11 +-- src/client/pages/my-lists/list.vue | 29 +++---- src/client/pages/my-settings/2fa.vue | 45 +++++------ src/client/pages/my-settings/api.vue | 15 ++-- src/client/pages/my-settings/drive.vue | 11 +-- .../pages/my-settings/import-export.vue | 23 +++--- src/client/pages/my-settings/index.vue | 21 +++--- src/client/pages/my-settings/integration.vue | 5 +- src/client/pages/my-settings/mute-block.vue | 3 +- src/client/pages/my-settings/privacy.vue | 7 +- src/client/pages/my-settings/profile.vue | 23 +++--- src/client/pages/my-settings/reaction.vue | 9 ++- src/client/pages/my-settings/security.vue | 19 ++--- src/client/pages/my-settings/word-mute.vue | 13 ++-- src/client/pages/not-found.vue | 1 + src/client/pages/note.vue | 15 ++-- src/client/pages/notifications.vue | 5 +- .../page-editor/els/page-editor.el.button.vue | 7 +- .../page-editor/els/page-editor.el.canvas.vue | 3 +- .../els/page-editor.el.counter.vue | 3 +- .../page-editor/els/page-editor.el.if.vue | 5 +- .../page-editor/els/page-editor.el.image.vue | 7 +- .../els/page-editor.el.number-input.vue | 3 +- .../page-editor/els/page-editor.el.post.vue | 7 +- .../els/page-editor.el.radio-button.vue | 5 +- .../els/page-editor.el.section.vue | 5 +- .../page-editor/els/page-editor.el.switch.vue | 5 +- .../els/page-editor.el.text-input.vue | 3 +- .../page-editor/els/page-editor.el.text.vue | 1 + .../els/page-editor.el.textarea-input.vue | 5 +- .../els/page-editor.el.textarea.vue | 1 + .../pages/page-editor/page-editor.blocks.vue | 1 + .../page-editor/page-editor.container.vue | 1 + .../page-editor/page-editor.script-block.vue | 7 +- src/client/pages/page-editor/page-editor.vue | 53 ++++++------- src/client/pages/page.vue | 13 ++-- src/client/pages/pages.vue | 9 ++- src/client/pages/preferences/index.vue | 17 +++-- src/client/pages/preferences/plugins.vue | 27 +++---- src/client/pages/preferences/sidebar.vue | 9 ++- src/client/pages/preferences/theme.vue | 29 +++---- src/client/pages/room/preview.vue | 1 + src/client/pages/room/room.vue | 27 +++---- src/client/pages/scratchpad.vue | 13 ++-- src/client/pages/search.vue | 5 +- src/client/pages/share.vue | 7 +- src/client/pages/tag.vue | 5 +- src/client/pages/test.vue | 9 ++- src/client/pages/theme-editor.vue | 31 ++++---- src/client/pages/user/follow-list.vue | 5 +- src/client/pages/user/index.activity.vue | 3 +- src/client/pages/user/index.photos.vue | 5 +- src/client/pages/user/index.timeline.vue | 3 +- src/client/pages/user/index.vue | 17 +++-- src/client/root.vue | 35 +-------- src/client/scripts/aiscript/api.ts | 6 +- src/client/scripts/gen-search-query.ts | 4 +- src/client/scripts/get-static-image-url.ts | 2 +- src/client/scripts/hpml/evaluator.ts | 4 +- src/client/scripts/paging.ts | 5 +- src/client/scripts/please-login.ts | 2 +- src/client/scripts/search.ts | 6 +- src/client/scripts/select-drive-file.ts | 2 +- src/client/scripts/select-drive-folder.ts | 2 +- src/client/scripts/select-file.ts | 8 +- src/client/scripts/stream.ts | 2 +- src/client/store.ts | 53 +++---------- src/client/sw.ts | 2 +- src/client/tsconfig.json | 5 +- src/client/widgets/activity.calendar.vue | 1 + src/client/widgets/activity.chart.vue | 1 + src/client/widgets/activity.vue | 5 +- src/client/widgets/calendar.vue | 1 + src/client/widgets/clock.vue | 5 +- src/client/widgets/define.ts | 2 +- src/client/widgets/digital-clock.vue | 1 + src/client/widgets/federation.vue | 9 ++- src/client/widgets/memo.vue | 3 +- src/client/widgets/notifications.vue | 7 +- src/client/widgets/photos.vue | 7 +- src/client/widgets/rss.vue | 3 +- src/client/widgets/timeline.vue | 11 +-- src/client/widgets/trends.vue | 7 +- src/client/widgets/welcome.vue | 11 +-- webpack.config.ts | 1 + 270 files changed, 1173 insertions(+), 961 deletions(-) create mode 100644 src/client/os.ts diff --git a/src/client/components/acct.vue b/src/client/components/acct.vue index ce39678f5c..c2640291aa 100644 --- a/src/client/components/acct.vue +++ b/src/client/components/acct.vue @@ -8,7 +8,8 @@ diff --git a/src/client/components/ui/info.vue b/src/client/components/ui/info.vue index 1cacea4c54..62ab5c8116 100644 --- a/src/client/components/ui/info.vue +++ b/src/client/components/ui/info.vue @@ -9,6 +9,7 @@ diff --git a/src/client/scripts/aiscript/api.ts b/src/client/scripts/aiscript/api.ts index babf83bc03..181ab8e833 100644 --- a/src/client/scripts/aiscript/api.ts +++ b/src/client/scripts/aiscript/api.ts @@ -9,14 +9,14 @@ export function createAiScriptEnv(vm, opts) { USER_NAME: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.name) : values.NULL, USER_USERNAME: vm.$store.getters.isSignedIn ? values.STR(vm.$store.state.i.username) : values.NULL, 'Mk:dialog': values.FN_NATIVE(async ([title, text, type]) => { - await vm.$store.dispatch('showDialog', { + await vm.os.dialog({ type: type ? type.value : 'info', title: title.value, text: text.value, }); }), 'Mk:confirm': values.FN_NATIVE(async ([title, text, type]) => { - const confirm = await vm.$store.dispatch('showDialog', { + const confirm = await vm.os.dialog({ type: type ? type.value : 'question', showCancelButton: true, title: title.value, @@ -28,7 +28,7 @@ export function createAiScriptEnv(vm, opts) { if (token) utils.assertString(token); apiRequests++; if (apiRequests > 16) return values.NULL; - const res = await vm.$root.api(ep.value, utils.valToJs(param), token ? token.value : (opts.token || null)); + const res = await vm.os.api(ep.value, utils.valToJs(param), token ? token.value : (opts.token || null)); return utils.jsToVal(res); }), 'Mk:save': values.FN_NATIVE(([key, value]) => { diff --git a/src/client/scripts/gen-search-query.ts b/src/client/scripts/gen-search-query.ts index 2520da75df..670d915104 100644 --- a/src/client/scripts/gen-search-query.ts +++ b/src/client/scripts/gen-search-query.ts @@ -1,5 +1,5 @@ import parseAcct from '../../misc/acct/parse'; -import { host as localHost } from '../config'; +import { host as localHost } from '@/config'; export async function genSearchQuery(v: any, q: string) { let host: string; @@ -13,7 +13,7 @@ export async function genSearchQuery(v: any, q: string) { host = at; } } else { - const user = await v.$root.api('users/show', parseAcct(at)).catch(x => null); + const user = await v.os.api('users/show', parseAcct(at)).catch(x => null); if (user) { userId = user.id; } else { diff --git a/src/client/scripts/get-static-image-url.ts b/src/client/scripts/get-static-image-url.ts index eff76af256..e932eb6da5 100644 --- a/src/client/scripts/get-static-image-url.ts +++ b/src/client/scripts/get-static-image-url.ts @@ -1,4 +1,4 @@ -import { url as instanceUrl } from '../config'; +import { url as instanceUrl } from '@/config'; import * as url from '../../prelude/url'; export function getStaticImageUrl(baseUrl: string): string { diff --git a/src/client/scripts/hpml/evaluator.ts b/src/client/scripts/hpml/evaluator.ts index 8c8dcc82c0..6ca9eccc6f 100644 --- a/src/client/scripts/hpml/evaluator.ts +++ b/src/client/scripts/hpml/evaluator.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; import * as seedrandom from 'seedrandom'; import { Variable, PageVar, envVarsDef, funcDefs, Block, isFnBlock } from '.'; -import { version } from '../../config'; +import { version } from '@/config'; import { AiScript, utils, values } from '@syuilo/aiscript'; import { createAiScriptEnv } from '../aiscript/api'; import { collectPageVars } from '../collect-page-vars'; @@ -42,7 +42,7 @@ export class Hpml { }), ...initLib(this)}, { in: (q) => { return new Promise(ok => { - vm.$store.dispatch('showDialog', { + vm.os.dialog({ title: q, input: {} }).then(({ canceled, result: a }) => { diff --git a/src/client/scripts/paging.ts b/src/client/scripts/paging.ts index 129c96004f..debb81db44 100644 --- a/src/client/scripts/paging.ts +++ b/src/client/scripts/paging.ts @@ -1,3 +1,4 @@ +import * as os from '@/os'; import { onScrollTop, isTopVisible } from './scroll'; const SECOND_FETCH_LIMIT = 30; @@ -85,7 +86,7 @@ export default (opts) => ({ let params = typeof this.pagination.params === 'function' ? this.pagination.params(true) : this.pagination.params; if (params && params.then) params = await params; const endpoint = typeof this.pagination.endpoint === 'function' ? this.pagination.endpoint() : this.pagination.endpoint; - await this.$root.api(endpoint, { + await os.api(endpoint, { ...params, limit: this.pagination.noPaging ? (this.pagination.limit || 10) : (this.pagination.limit || 10) + 1, }).then(items => { @@ -117,7 +118,7 @@ export default (opts) => ({ let params = typeof this.pagination.params === 'function' ? this.pagination.params(false) : this.pagination.params; if (params && params.then) params = await params; const endpoint = typeof this.pagination.endpoint === 'function' ? this.pagination.endpoint() : this.pagination.endpoint; - await this.$root.api(endpoint, { + await os.api(endpoint, { ...params, limit: SECOND_FETCH_LIMIT + 1, ...(this.pagination.offsetMode ? { diff --git a/src/client/scripts/please-login.ts b/src/client/scripts/please-login.ts index 78e9d99e60..6ca78d3cc9 100644 --- a/src/client/scripts/please-login.ts +++ b/src/client/scripts/please-login.ts @@ -1,7 +1,7 @@ export default ($root: any) => { if ($root.$store.getters.isSignedIn) return; - $store.dispatch('showDialog', { + os.dialog({ title: $root.$t('signinRequired'), text: null }); diff --git a/src/client/scripts/search.ts b/src/client/scripts/search.ts index a9ab19d7c8..1f6ec5fa1c 100644 --- a/src/client/scripts/search.ts +++ b/src/client/scripts/search.ts @@ -26,7 +26,7 @@ export async function search(v: any, q: string) { } v.$root.$emit('warp', date); - v.$store.dispatch('showDialog', { + v.os.dialog({ icon: faHistory, iconOnly: true, autoClose: true }); @@ -34,7 +34,7 @@ export async function search(v: any, q: string) { } if (q.startsWith('https://')) { - const dialog = v.$store.dispatch('showDialog', { + const dialog = v.os.dialog({ type: 'waiting', text: v.$t('fetchingAsApObject') + '...', showOkButton: false, @@ -43,7 +43,7 @@ export async function search(v: any, q: string) { }); try { - const res = await v.$root.api('ap/show', { + const res = await v.os.api('ap/show', { uri: q }); dialog.close(); diff --git a/src/client/scripts/select-drive-file.ts b/src/client/scripts/select-drive-file.ts index cd36ea55a5..9459bd604b 100644 --- a/src/client/scripts/select-drive-file.ts +++ b/src/client/scripts/select-drive-file.ts @@ -1,6 +1,6 @@ export function selectDriveFile($root: any, multiple) { return new Promise((res, rej) => { - import('../components/drive-window.vue').then(dialog => { + import('@/components/drive-window.vue').then(dialog => { const w = $root.new(dialog, { type: 'file', multiple diff --git a/src/client/scripts/select-drive-folder.ts b/src/client/scripts/select-drive-folder.ts index 9814dac86c..ee6e5c1551 100644 --- a/src/client/scripts/select-drive-folder.ts +++ b/src/client/scripts/select-drive-folder.ts @@ -1,6 +1,6 @@ export function selectDriveFolder($root: any, multiple) { return new Promise((res, rej) => { - import('../components/drive-window.vue').then(dialog => { + import('@/components/drive-window.vue').then(dialog => { const w = $root.new(dialog, { type: 'folder', multiple diff --git a/src/client/scripts/select-file.ts b/src/client/scripts/select-file.ts index a89aaddbf3..c56e39c313 100644 --- a/src/client/scripts/select-file.ts +++ b/src/client/scripts/select-file.ts @@ -1,6 +1,6 @@ import { faUpload, faCloud } from '@fortawesome/free-solid-svg-icons'; import { selectDriveFile } from './select-drive-file'; -import { apiUrl } from '../config'; +import { apiUrl } from '@/config'; // TODO: component引数は消せる(各種操作がstoreに移動し、かつstoreが複数ファイルで共有されるようになったため) export function selectFile(component: any, src: any, label: string | null, multiple = false) { @@ -10,7 +10,7 @@ export function selectFile(component: any, src: any, label: string | null, multi input.type = 'file'; input.multiple = multiple; input.onchange = () => { - const dialog = component.$store.dispatch('showDialog', { + const dialog = component.os.dialog({ type: 'waiting', text: component.$t('uploading') + '...', showOkButton: false, @@ -35,7 +35,7 @@ export function selectFile(component: any, src: any, label: string | null, multi Promise.all(promises).then(driveFiles => { res(multiple ? driveFiles : driveFiles[0]); }).catch(e => { - component.$store.dispatch('showDialog', { + component.os.dialog({ type: 'error', text: e }); @@ -65,7 +65,7 @@ export function selectFile(component: any, src: any, label: string | null, multi }; - component.$store.dispatch('showMenu', { + component.os.menu({ items: [label ? { text: label, type: 'label' diff --git a/src/client/scripts/stream.ts b/src/client/scripts/stream.ts index 86fa90e8fd..a7b37722e5 100644 --- a/src/client/scripts/stream.ts +++ b/src/client/scripts/stream.ts @@ -1,7 +1,7 @@ import autobind from 'autobind-decorator'; import { EventEmitter } from 'eventemitter3'; import ReconnectingWebsocket from 'reconnecting-websocket'; -import { wsUrl } from '../config'; +import { wsUrl } from '@/config'; /** * Misskey stream connection diff --git a/src/client/store.ts b/src/client/store.ts index dee551bf88..8dd682a8e9 100644 --- a/src/client/store.ts +++ b/src/client/store.ts @@ -5,7 +5,7 @@ import * as nestedProperty from 'nested-property'; import { faSatelliteDish, faTerminal, faHashtag, faBroadcastTower, faFireAlt, faSearch, faStar, faAt, faListUl, faUserClock, faUsers, faCloud, faGamepad, faFileAlt, faSatellite, faDoorClosed, faColumns } from '@fortawesome/free-solid-svg-icons'; import { faBell, faEnvelope, faComments } from '@fortawesome/free-regular-svg-icons'; import { AiScript, utils, values } from '@syuilo/aiscript'; -import { apiUrl, deckmode } from './config'; +import { apiUrl, deckmode } from '@/config'; import { erase } from '../prelude/array'; export const defaultSettings = { @@ -110,13 +110,10 @@ export const store = createStore({ spinner: null, dialogs: [] as { id: any; - type: 'info' | 'question' | 'warn' | 'success' | 'error'; - title: string; - text: string; + component: any; + props: Record; result: any; }[], - menus: [], - postForm: null, fullView: false, // Plugin @@ -278,24 +275,6 @@ export const store = createStore({ state.dialogs = state.dialogs.filter(d => d.id !== dialogId); }, - addMenu(state, menu) { - state.menus.push(menu); - }, - - menuDone(state, { id: menuId }) { - const menu = state.menus.find(d => d.id === menuId); - menu.result = 'hoge'; - }, - - removeMenu(state, menuId) { - state.menus = state.menus.filter(d => d.id !== menuId); - }, - - setPostForm(state, postForm) { - if (state.postForm != null && postForm != null) return; - state.postForm = postForm; - }, - setFullView(state, v) { state.fullView = v; }, @@ -391,12 +370,17 @@ export const store = createStore({ } }, - showDialog(ctx, opts) { + showDialog(ctx, { component, props }) { return new Promise((res, rej) => { + const id = Math.random().toString(); // TODO: uuidとか使う const dialog = reactive({ - ...opts, + component, + props: { + ...props, + id + }, result: null, - id: Math.random().toString() // TODO: uuidとか使う + id, }); ctx.commit('addDialog', dialog); const unwatch = watch(() => dialog.result, result => { @@ -406,21 +390,6 @@ export const store = createStore({ }); }, - showMenu(ctx, opts) { - return new Promise((res, rej) => { - const menu = reactive({ - ...opts, - result: null, - id: Math.random().toString() // TODO: uuidとか使う - }); - ctx.commit('addMenu', menu); - const unwatch = watch(() => menu.result, result => { - unwatch(); - res(result); - }); - }); - }, - api(ctx, { endpoint, data, token }) { if (++ctx.state.pendingApiRequestsCount === 1) { // TODO: spinnerの表示はstoreでやらない diff --git a/src/client/sw.ts b/src/client/sw.ts index 341198852e..01ed216029 100644 --- a/src/client/sw.ts +++ b/src/client/sw.ts @@ -3,7 +3,7 @@ */ declare var self: ServiceWorkerGlobalScope; -import composeNotification from './scripts/compose-notification'; +import composeNotification from '@/scripts/compose-notification'; // eslint-disable-next-line no-undef const version = _VERSION_; diff --git a/src/client/tsconfig.json b/src/client/tsconfig.json index aac0d1bfe7..6b6213ee26 100644 --- a/src/client/tsconfig.json +++ b/src/client/tsconfig.json @@ -17,7 +17,10 @@ "strict": true, "strictNullChecks": false, "experimentalDecorators": true, - "resolveJsonModule": true, + "resolveJsonModule": true, + "paths": { + "@/*": ["./*"] + }, "typeRoots": [ "node_modules/@types", "src/@types" diff --git a/src/client/widgets/activity.calendar.vue b/src/client/widgets/activity.calendar.vue index 70d9dbfec0..b833bd65ca 100644 --- a/src/client/widgets/activity.calendar.vue +++ b/src/client/widgets/activity.calendar.vue @@ -25,6 +25,7 @@