藍モード (#7687)
* wip * wip * シンボリックリンクやめた * install lib dependency * bring live2d assets from misskey-dev/assets * refactor * nanka iroiro * コミット忘れ * random motion * wip * run git submodule update --init * コミット忘れ * refactor * fix bug * Update misskey-assets * lint * lint * lint * 藍モード修正 (#7702) * lazy load live2d script * fix typo * lazy load also widget * hot link to cubism core * https://github.com/misskey-dev/misskey/pull/7702/files#r695623821 * fix lint * remove live2d stuff * use iframe * update * Update gulpfile.ts * update * Update .gitattributes * update Co-authored-by: tamaina <tamaina@hotmail.co.jp>
This commit is contained in:
parent
e1a8b158e0
commit
8407702b38
20 changed files with 158 additions and 34 deletions
|
@ -45,6 +45,10 @@
|
|||
</FormSwitch>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup>
|
||||
<FormSwitch v-model:value="aiChanMode">{{ $ts.aiChanMode }}</FormSwitch>
|
||||
</FormGroup>
|
||||
|
||||
<FormRadios v-model="fontSize">
|
||||
<template #desc>{{ $ts.fontSize }}</template>
|
||||
<option value="small"><span style="font-size: 14px;">Aa</span></option>
|
||||
|
@ -149,6 +153,7 @@ export default defineComponent({
|
|||
enableInfiniteScroll: defaultStore.makeGetterSetter('enableInfiniteScroll'),
|
||||
useReactionPickerForContextMenu: defaultStore.makeGetterSetter('useReactionPickerForContextMenu'),
|
||||
squareAvatars: defaultStore.makeGetterSetter('squareAvatars'),
|
||||
aiChanMode: defaultStore.makeGetterSetter('aiChanMode'),
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
@ -184,6 +189,10 @@ export default defineComponent({
|
|||
this.reloadAsk();
|
||||
},
|
||||
|
||||
aiChanMode() {
|
||||
this.reloadAsk();
|
||||
},
|
||||
|
||||
showGapBetweenNotesInTimeline() {
|
||||
this.reloadAsk();
|
||||
},
|
||||
|
|
|
@ -210,6 +210,10 @@ export const defaultStore = markRaw(new Storage('base', {
|
|||
where: 'device',
|
||||
default: ''
|
||||
},
|
||||
aiChanMode: {
|
||||
where: 'device',
|
||||
default: false
|
||||
},
|
||||
}));
|
||||
|
||||
// TODO: 他のタブと永続化されたstateを同期
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["../*"],
|
||||
"@client/*": ["./*"]
|
||||
"@client/*": ["./*"],
|
||||
"@lib/*": ["../../lib/*"],
|
||||
},
|
||||
"typeRoots": [
|
||||
"node_modules/@types",
|
||||
|
|
|
@ -54,12 +54,14 @@
|
|||
<XWidgets v-if="widgetsShowing" class="tray"/>
|
||||
</transition>
|
||||
|
||||
<iframe v-if="$store.state.aiChanMode" class="ivnzpscs" ref="live2d" src="https://misskey-dev.github.io/mascot-web/?scale=2&y=1.4"></iframe>
|
||||
|
||||
<XCommon/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, defineAsyncComponent } from 'vue';
|
||||
import { defineComponent, defineAsyncComponent, markRaw } from 'vue';
|
||||
import { instanceName } from '@client/config';
|
||||
import { StickySidebar } from '@client/scripts/sticky-sidebar';
|
||||
import XSidebar from './default.sidebar.vue';
|
||||
|
@ -131,6 +133,19 @@ export default defineComponent({
|
|||
this.isMobile = (window.innerWidth <= MOBILE_THRESHOLD);
|
||||
this.isDesktop = (window.innerWidth >= DESKTOP_THRESHOLD);
|
||||
}, { passive: true });
|
||||
|
||||
if (this.$store.state.aiChanMode) {
|
||||
const iframeRect = this.$refs.live2d.getBoundingClientRect();
|
||||
window.addEventListener('mousemove', ev => {
|
||||
this.$refs.live2d.contentWindow.postMessage({
|
||||
type: 'moveCursor',
|
||||
body: {
|
||||
x: ev.clientX - iframeRect.left,
|
||||
y: ev.clientY - iframeRect.top,
|
||||
}
|
||||
}, '*');
|
||||
}, { passive: true });
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -201,6 +216,10 @@ export default defineComponent({
|
|||
}
|
||||
}], e);
|
||||
},
|
||||
|
||||
onAiClick(ev) {
|
||||
//if (this.live2d) this.live2d.click(ev);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -458,5 +477,15 @@ export default defineComponent({
|
|||
overflow: auto;
|
||||
background: var(--bg);
|
||||
}
|
||||
|
||||
> .ivnzpscs {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 300px;
|
||||
height: 600px;
|
||||
border: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
59
src/client/widgets/aichan.vue
Normal file
59
src/client/widgets/aichan.vue
Normal file
|
@ -0,0 +1,59 @@
|
|||
<template>
|
||||
<MkContainer :naked="props.transparent" :show-header="false">
|
||||
<iframe class="dedjhjmo" ref="live2d" @click="touched" src="https://misskey-dev.github.io/mascot-web/?scale=1.5&y=1.1&eyeY=100"></iframe>
|
||||
</MkContainer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
import define from './define';
|
||||
import MkContainer from '@client/components/ui/container.vue';
|
||||
import * as os from '@client/os';
|
||||
|
||||
const widget = define({
|
||||
name: 'ai',
|
||||
props: () => ({
|
||||
transparent: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
});
|
||||
|
||||
export default defineComponent({
|
||||
extends: widget,
|
||||
components: {
|
||||
MkContainer,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
window.addEventListener('mousemove', ev => {
|
||||
const iframeRect = this.$refs.live2d.getBoundingClientRect();
|
||||
this.$refs.live2d.contentWindow.postMessage({
|
||||
type: 'moveCursor',
|
||||
body: {
|
||||
x: ev.clientX - iframeRect.left,
|
||||
y: ev.clientY - iframeRect.top,
|
||||
}
|
||||
}, '*');
|
||||
}, { passive: true });
|
||||
},
|
||||
methods: {
|
||||
touched() {
|
||||
//if (this.live2d) this.live2d.changeExpression('gurugurume');
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.dedjhjmo {
|
||||
width: 100%;
|
||||
height: 350px;
|
||||
border: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
|
@ -19,6 +19,7 @@ export default function(app: App) {
|
|||
app.component('MkwJobQueue', defineAsyncComponent(() => import('./job-queue.vue')));
|
||||
app.component('MkwButton', defineAsyncComponent(() => import('./button.vue')));
|
||||
app.component('MkwAiscript', defineAsyncComponent(() => import('./aiscript.vue')));
|
||||
app.component('MkwAichan', defineAsyncComponent(() => import('./aichan.vue')));
|
||||
}
|
||||
|
||||
export const widgets = [
|
||||
|
@ -40,4 +41,5 @@ export const widgets = [
|
|||
'jobQueue',
|
||||
'button',
|
||||
'aiscript',
|
||||
'aichan',
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue