This commit is contained in:
syuilo 2018-02-22 23:53:07 +09:00
parent e98626dbbc
commit b5068aae05
14 changed files with 102 additions and 126 deletions

View file

@ -67,6 +67,16 @@ export default class MiOS extends EventEmitter {
private isMetaFetching = false; private isMetaFetching = false;
public app: Vue;
public new(vm, props) {
const w = new vm({
parent: this.app,
propsData: props
}).$mount();
document.body.appendChild(w.$el);
}
/** /**
* A signing user * A signing user
*/ */

View file

@ -376,11 +376,9 @@ export default Vue.extend({
}, },
newWindow(folder) { newWindow(folder) {
document.body.appendChild(new MkDriveWindow({ (this as any).os.new(MkDriveWindow, {
propsData: {
folder: folder folder: folder
} });
}).$mount().$el);
}, },
move(target) { move(target) {

View file

@ -39,11 +39,9 @@ export default Vue.extend({
}, },
onClick() { onClick() {
document.body.appendChild(new MkImagesImageDialog({ (this as any).os.new(MkImagesImageDialog, {
propsData: {
image: this.image image: this.image
} });
}).$mount().$el);
} }
} }
}); });

View file

@ -12,11 +12,9 @@ import MkMessagingRoomWindow from './messaging-room-window.vue';
export default Vue.extend({ export default Vue.extend({
methods: { methods: {
navigate(user) { navigate(user) {
document.body.appendChild(new MkMessagingRoomWindow({ (this as any).os.new(MkMessagingRoomWindow, {
propsData: {
user: user user: user
} });
}).$mount().$el);
} }
} }
}); });

View file

@ -148,34 +148,26 @@ export default Vue.extend({
}); });
}, },
reply() { reply() {
document.body.appendChild(new MkPostFormWindow({ (this as any).os.new(MkPostFormWindow, {
propsData: {
reply: this.p reply: this.p
} });
}).$mount().$el);
}, },
repost() { repost() {
document.body.appendChild(new MkRepostFormWindow({ (this as any).os.new(MkRepostFormWindow, {
propsData: {
post: this.p post: this.p
} });
}).$mount().$el);
}, },
react() { react() {
document.body.appendChild(new MkReactionPicker({ (this as any).os.new(MkReactionPicker, {
propsData: {
source: this.$refs.reactButton, source: this.$refs.reactButton,
post: this.p post: this.p
} });
}).$mount().$el);
}, },
menu() { menu() {
document.body.appendChild(new MkPostMenu({ (this as any).os.new(MkPostMenu, {
propsData: {
source: this.$refs.menuButton, source: this.$refs.menuButton,
post: this.p post: this.p
} });
}).$mount().$el);
} }
} }
}); });

View file

@ -186,34 +186,26 @@ export default Vue.extend({
} }
}, },
reply() { reply() {
document.body.appendChild(new MkPostFormWindow({ (this as any).os.new(MkPostFormWindow, {
propsData: {
reply: this.p reply: this.p
} });
}).$mount().$el);
}, },
repost() { repost() {
document.body.appendChild(new MkRepostFormWindow({ (this as any).os.new(MkRepostFormWindow, {
propsData: {
post: this.p post: this.p
} });
}).$mount().$el);
}, },
react() { react() {
document.body.appendChild(new MkReactionPicker({ (this as any).os.new(MkReactionPicker, {
propsData: {
source: this.$refs.reactButton, source: this.$refs.reactButton,
post: this.p post: this.p
} });
}).$mount().$el);
}, },
menu() { menu() {
document.body.appendChild(new MkPostMenu({ (this as any).os.new(MkPostMenu, {
propsData: {
source: this.$refs.menuButton, source: this.$refs.menuButton,
post: this.p post: this.p
} });
}).$mount().$el);
}, },
onKeydown(e) { onKeydown(e) {
let shouldBeCancel = true; let shouldBeCancel = true;

View file

@ -70,11 +70,11 @@ export default Vue.extend({
}, },
drive() { drive() {
this.close(); this.close();
document.body.appendChild(new MkDriveWindow().$mount().$el); (this as any).os.new(MkDriveWindow);
}, },
settings() { settings() {
this.close(); this.close();
document.body.appendChild(new MkSettingsWindow().$mount().$el); (this as any).os.new(MkSettingsWindow);
} }
} }
}); });

View file

@ -79,7 +79,7 @@ export default Vue.extend({
}, },
messaging() { messaging() {
document.body.appendChild(new MkMessagingWindow().$mount().$el); (this as any).os.new(MkMessagingWindow);
} }
} }
}); });

View file

@ -17,11 +17,9 @@ export default define({
}).extend({ }).extend({
methods: { methods: {
navigate(user) { navigate(user) {
document.body.appendChild(new MkMessagingRoomWindow({ (this as any).os.new(MkMessagingRoomWindow, {
propsData: {
user: user user: user
} });
}).$mount().$el);
}, },
func() { func() {
if (this.props.design == 1) { if (this.props.design == 1) {

View file

@ -36,21 +36,15 @@ export default Vue.extend({
}, },
methods: { methods: {
showFollowing() { showFollowing() {
document.body.appendChild(new MkFollowingWindow({ (this as any).os.new(MkFollowingWindow, {
parent: this,
propsData: {
user: this.user user: this.user
} });
}).$mount().$el);
}, },
showFollowers() { showFollowers() {
document.body.appendChild(new MkFollowersWindow({ (this as any).os.new(MkFollowersWindow, {
parent: this,
propsData: {
user: this.user user: this.user
} });
}).$mount().$el);
}, },
mute() { mute() {

View file

@ -87,18 +87,6 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
// アプリ基底要素マウント // アプリ基底要素マウント
document.body.innerHTML = '<div id="app"></div>'; document.body.innerHTML = '<div id="app"></div>';
const launch = (api: (os: MiOS) => API) => {
os.apis = api(os);
Vue.mixin({
data() {
return {
os,
api: os.api,
apis: os.apis
};
}
});
const app = new Vue({ const app = new Vue({
router: new VueRouter({ router: new VueRouter({
mode: 'history' mode: 'history'
@ -112,7 +100,25 @@ export default (callback: (launch: (api: (os: MiOS) => API) => [Vue, MiOS]) => v
}); });
}, },
render: createEl => createEl(App) render: createEl => createEl(App)
}).$mount('#app'); });
os.app = app;
const launch = (api: (os: MiOS) => API) => {
os.apis = api(os);
Vue.mixin({
data() {
return {
os,
api: os.api,
apis: os.apis
};
}
});
// マウント
app.$mount('#app');
return [app, os] as [Vue, MiOS]; return [app, os] as [Vue, MiOS];
}; };

View file

@ -154,22 +154,18 @@ export default Vue.extend({
}); });
}, },
react() { react() {
document.body.appendChild(new MkReactionPicker({ (this as any).os.new(MkReactionPicker, {
propsData: {
source: this.$refs.reactButton, source: this.$refs.reactButton,
post: this.p, post: this.p,
compact: true compact: true
} });
}).$mount().$el);
}, },
menu() { menu() {
document.body.appendChild(new MkPostMenu({ (this as any).os.new(MkPostMenu, {
propsData: {
source: this.$refs.menuButton, source: this.$refs.menuButton,
post: this.p, post: this.p,
compact: true compact: true
} });
}).$mount().$el);
} }
} }
}); });

View file

@ -169,22 +169,18 @@ export default Vue.extend({
}); });
}, },
react() { react() {
document.body.appendChild(new MkReactionPicker({ (this as any).os.new(MkReactionPicker, {
propsData: {
source: this.$refs.reactButton, source: this.$refs.reactButton,
post: this.p, post: this.p,
compact: true compact: true
} });
}).$mount().$el);
}, },
menu() { menu() {
document.body.appendChild(new MkPostMenu({ (this as any).os.new(MkPostMenu, {
propsData: {
source: this.$refs.menuButton, source: this.$refs.menuButton,
post: this.p, post: this.p,
compact: true compact: true
} });
}).$mount().$el);
} }
} }
}); });

View file

@ -53,11 +53,9 @@ export default Vue.extend({
id: notification.id id: notification.id
}); });
document.body.appendChild(new MkNotify({ (this as any).os.new(MkNotify, {
propsData: {
notification notification
} });
}).$mount().$el);
} }
} }
}); });