This commit is contained in:
syuilo
2020-09-06 18:38:09 +09:00
parent 3762116c17
commit d79a1a4e0e
36 changed files with 135 additions and 130 deletions

View File

@@ -376,7 +376,7 @@ export default defineComponent({
chooseUser() {
this.close();
const vm = this.$root.new(MkUserSelect, {});
const vm = os.popup(MkUserSelect, {});
vm.$once('selected', user => {
this.complete('user', user);
});

View File

@@ -43,7 +43,7 @@ export default defineComponent({
icon: faCog,
text: this.$t('notificationSetting'),
action: async () => {
this.$root.new(await import('../notification-setting-window.vue'), {
os.popup(await import('../notification-setting-window.vue'), {
includingTypes: this.column.includingTypes,
}).$on('ok', async ({ includingTypes }) => {
this.$set(this.column, 'includingTypes', includingTypes);

View File

@@ -1,5 +1,5 @@
<template>
<x-modal ref="modal" @closed="$store.commit('removePopup', id)" @click="onBgClick" :showing="showing">
<x-modal ref="modal" @closed="destroy" @click="onBgClick" :showing="showing">
<div class="mk-dialog" :class="{ iconOnly }">
<template v-if="type == 'signin'">
<mk-signin/>
@@ -65,7 +65,10 @@ export default defineComponent({
},
props: {
id: {
destroy: {
required: true
},
emit: {
required: true
},
type: {
@@ -160,7 +163,7 @@ export default defineComponent({
methods: {
done(canceled, result?) {
this.showing = false;
os.dialogCallbacks[this.id]({ canceled, result });
this.emit({ canceled, result });
},
async ok() {

View File

@@ -72,7 +72,7 @@ export default defineComponent({
if (this.$store.state.device.imageNewTab) {
window.open(this.image.url, '_blank');
} else {
const viewer = this.$root.new(ImageViewer, {
const viewer = os.popup(ImageViewer, {
image: this.image
});
this.$once('hook:beforeDestroy', () => {

View File

@@ -1,5 +1,5 @@
<template>
<x-modal :source="source" :no-center="noCenter" ref="popup" @click="close()" @closed="$store.commit('removePopup', id)" :showing="showing">
<x-modal :source="source" :no-center="noCenter" ref="popup" @click="close()" @closed="destroy" :showing="showing">
<div class="rrevdjwt" :class="{ left: align === 'left' }" ref="items" :style="{ width: width + 'px' }">
<template v-for="(item, i) in items.filter(item => item !== undefined)">
<div v-if="item === null" class="divider" :key="i"></div>
@@ -44,7 +44,7 @@ export default defineComponent({
XModal
},
props: {
id: {
destroy: {
required: true
},
source: {

View File

@@ -110,7 +110,7 @@ import XCwButton from './cw-button.vue';
import XPoll from './poll.vue';
import MkUrlPreview from './url-preview.vue';
import MkReactionPicker from './reaction-picker.vue';
import pleaseLogin from '@/scripts/please-login';
import { pleaseLogin } from '@/scripts/please-login';
import { focusPrev, focusNext } from '@/scripts/focus';
import { url } from '@/config';
import copyToClipboard from '@/scripts/copy-to-clipboard';
@@ -441,7 +441,7 @@ export default defineComponent({
},
reply(viaKeyboard = false) {
pleaseLogin(this.$root);
pleaseLogin();
this.$root.post({
reply: this.appearNote,
animation: !viaKeyboard,
@@ -451,7 +451,7 @@ export default defineComponent({
},
renote(viaKeyboard = false) {
pleaseLogin(this.$root);
pleaseLogin();
this.blur();
os.menu({
items: [{
@@ -483,21 +483,19 @@ export default defineComponent({
},
react(viaKeyboard = false) {
pleaseLogin(this.$root);
pleaseLogin();
this.blur();
const picker = this.$root.new(MkReactionPicker, {
const close = os.popup(MkReactionPicker, {
source: this.$refs.reactButton,
showFocus: viaKeyboard,
});
picker.$once('chosen', reaction => {
}, reaction => {
os.api('notes/reactions/create', {
noteId: this.appearNote.id,
reaction: reaction
}).then(() => {
picker.close();
close();
});
});
picker.$once('closed', this.focus);
}, this.focus);
},
reactDirectly(reaction) {
@@ -516,7 +514,7 @@ export default defineComponent({
},
favorite() {
pleaseLogin(this.$root);
pleaseLogin();
os.api('notes/favorites/create', {
noteId: this.appearNote.id
}).then(() => {

View File

@@ -3,43 +3,48 @@
<svg width="128" height="128" viewBox="0 0 128 128" xmlns="http://www.w3.org/2000/svg">
<circle fill="none" cx="64" cy="64">
<animate attributeName="r"
begin="0s" dur="0.5s"
values="4; 32"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="1" />
begin="0s" dur="0.5s"
values="4; 32"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="1"
/>
<animate attributeName="stroke-width"
begin="0s" dur="0.5s"
values="16; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="1" />
begin="0s" dur="0.5s"
values="16; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="1"
/>
</circle>
<g fill="none" fill-rule="evenodd">
<circle v-for="(particle, i) in particles" :key="i" :fill="particle.color">
<animate attributeName="r"
begin="0s" dur="0.8s"
:values="`${particle.size}; 0`"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="1" />
begin="0s" dur="0.8s"
:values="`${particle.size}; 0`"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="1"
/>
<animate attributeName="cx"
begin="0s" dur="0.8s"
:values="`${particle.xA}; ${particle.xB}`"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="1" />
begin="0s" dur="0.8s"
:values="`${particle.xA}; ${particle.xB}`"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="1"
/>
<animate attributeName="cy"
begin="0s" dur="0.8s"
:values="`${particle.yA}; ${particle.yB}`"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="1" />
begin="0s" dur="0.8s"
:values="`${particle.yA}; ${particle.yB}`"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="1"
/>
</circle>
</g>
</svg>
@@ -52,6 +57,9 @@ import * as os from '@/os';
export default defineComponent({
props: {
destroy: {
required: true
},
x: {
type: Number,
required: true
@@ -86,7 +94,7 @@ export default defineComponent({
},
mounted() {
setTimeout(() => {
this.destroyDom();
this.destroy();
}, 1100);
}
});

View File

@@ -417,7 +417,7 @@ export default defineComponent({
// TODO: information dialog
return;
}
const w = this.$root.new(MkVisibilityChooser, {
const w = os.popup(MkVisibilityChooser, {
source: this.$refs.visibilityButton,
currentVisibility: this.visibility,
currentLocalOnly: this.localOnly
@@ -433,7 +433,7 @@ export default defineComponent({
},
addVisibleUser() {
const vm = this.$root.new(MkUserSelect, {});
const vm = os.popup(MkUserSelect, {});
vm.$once('selected', user => {
this.visibleUsers.push(user);
});
@@ -597,14 +597,14 @@ export default defineComponent({
},
insertMention() {
const vm = this.$root.new(MkUserSelect, {});
const vm = os.popup(MkUserSelect, {});
vm.$once('selected', user => {
insertTextAtCursor(this.$refs.text, getAcct(user) + ' ');
});
},
async insertEmoji(ev) {
const vm = this.$root.new(await import('./emoji-picker.vue'), {
const vm = os.popup(await import('./emoji-picker.vue'), {
source: ev.currentTarget || ev.target
}).$once('chosen', emoji => {
insertTextAtCursor(this.$refs.text, emoji);

View File

@@ -111,7 +111,7 @@ export default defineComponent({
this.closeDetails();
if (!this.isHovering) return;
this.details = this.$root.new(XDetails, {
this.details = os.popup(XDetails, {
reaction: this.reaction,
users,
count: this.count,

View File

@@ -276,7 +276,7 @@ export default defineComponent({
},
async addAcount() {
this.$root.new(await import('./signin-dialog.vue')).$once('login', res => {
os.popup(await import('./signin-dialog.vue')).$once('login', res => {
this.$store.dispatch('addAcount', res);
os.dialog({
type: 'success',
@@ -286,7 +286,7 @@ export default defineComponent({
},
async createAccount() {
this.$root.new(await import('./signup-dialog.vue')).$once('signup', res => {
os.popup(await import('./signup-dialog.vue')).$once('signup', res => {
this.$store.dispatch('addAcount', res);
this.switchAccountWithToken(res.i);
});